Join modifications from branch OCC_development_for_3_2_0a2

This commit is contained in:
jfa 2006-03-13 15:11:51 +00:00
parent 0c9aa567ca
commit 438f4b0922
24 changed files with 403 additions and 392 deletions

View File

@ -14,7 +14,7 @@ VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl
@COMMENCE@
SUBDIRS = idl src doc
SUBDIRS = idl src doc adm_local
RESOURCES_FILES = \
GEOM_en.xml \

41
adm_local/Makefile.in Normal file
View File

@ -0,0 +1,41 @@
# source path
top_srcdir=@top_srcdir@
top_builddir=..
srcdir=@srcdir@
VPATH=.:$(srcdir)/adm_local
all: resources
install:
cp -rf @top_srcdir@/adm_local @prefix@
bin:
resources :
cp -rf @top_srcdir@/adm_local $(top_builddir)
inc:
lib:
depend:
depend_idl:
install-end:
install-include:
install-bin:
uninstall:
uninstall-idl:
distclean:
clean:
distclean-other:

View File

@ -0,0 +1,54 @@
# Check availability of Geom binary distribution
#
# Author : Nicolas REJNERI (OPEN CASCADE, 2003)
#
AC_DEFUN([CHECK_GEOM],[
AC_CHECKING(for Geom)
Geom_ok=no
AC_ARG_WITH(geom,
[ --with-geom=DIR root directory path of GEOM installation ],
GEOM_DIR="$withval",GEOM_DIR="")
if test "x$GEOM_DIR" == "x" ; then
# no --with-geom-dir option used
if test "x$GEOM_ROOT_DIR" != "x" ; then
# GEOM_ROOT_DIR environment variable defined
GEOM_DIR=$GEOM_ROOT_DIR
else
# search Geom binaries in PATH variable
AC_PATH_PROG(TEMP, libGEOM_Swig.py)
if test "x$TEMP" != "x" ; then
GEOM_BIN_DIR=`dirname $TEMP`
GEOM_DIR=`dirname $GEOM_BIN_DIR`
fi
fi
#
fi
if test -f ${GEOM_DIR}/bin/salome/libGEOM_Swig.py ; then
Geom_ok=yes
AC_MSG_RESULT(Using Geom module distribution in ${GEOM_DIR})
if test "x$GEOM_ROOT_DIR" == "x" ; then
GEOM_ROOT_DIR=${GEOM_DIR}
fi
AC_SUBST(GEOM_ROOT_DIR)
else
AC_MSG_WARN("Cannot find compiled Geom module distribution")
fi
AC_MSG_RESULT(for Geom: $Geom_ok)
])dnl

View File

@ -245,13 +245,19 @@ $(top_srcdir)/configure.in: $(top_srcdir)/configure.in.base
ACLOCAL_SRC = \
ac_cxx_bool.m4 check_corba.m4 check_vtk.m4 \
ac_cxx_bool.m4 check_corba.m4 \
ac_cxx_depend_flag.m4 check_hdf5.m4 enable_pthreads.m4 \
ac_cxx_mutable.m4 check_mico.m4 libtool.m4 \
ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \
ac_cxx_partial_specialization.m4 check_opengl.m4 python.m4 \
ac_cxx_partial_specialization.m4 python.m4 \
ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \
ac_cc_warnings.m4 check_qt.m4 check_swig.m4
ac_cc_warnings.m4 check_swig.m4
$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files
ACLOCAL_GUI = \
check_vtk.m4 check_opengl.m4 check_qt.m4 \
check_GUI.m4 check_corba_in_GUI.m4
$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \
$(ACLOCAL_GUI:%=@GUI_ROOT_DIR@/adm_local/unix/config_files/%)
cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \
-I @GUI_ROOT_DIR@/adm_local/unix/config_files

View File

@ -25,6 +25,13 @@ fi
# echo "failed : KERNEL_SRC variable is not correct !"
# exit
#fi
########################################################################
# Test if the GUI_ROOT_DIR is set correctly
if test ! -d "${GUI_ROOT_DIR}"; then
echo "failed : GUI_ROOT_DIR variable is not correct !"
exit
fi
########################################################################
# find_in - utility function
#
@ -202,7 +209,8 @@ else
echo -n "Creating 'configure' script ... "
fi
aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
-I ${GUI_ROOT_DIR}/adm_local/unix/config_files
if autoconf
then
echo "done"

View File

@ -258,6 +258,26 @@ echo
CHECK_HTML_GENERATORS
echo
echo ---------------------------------------------
echo Testing GUI
echo ---------------------------------------------
echo
CHECK_SALOME_GUI
echo
echo ---------------------------------------------
echo Testing full GUI
echo ---------------------------------------------
echo
CHECK_CORBA_IN_GUI
if test "x${CORBA_IN_GUI}" != "xyes"; then
echo "failed : For configure GEOM module necessary full GUI !"
exit
fi
echo
echo ---------------------------------------------
echo Testing Kernel

View File

@ -259,7 +259,7 @@ TCollection_AsciiString GEOM_Object::GetAuxData()
bool GEOM_Object::IsMainShape()
{
Handle(GEOM_Function) aFunction = GetFunction(1);
if(aFunction == NULL || aFunction->GetDriverGUID() != GetSubShapeID()) return true;
if(aFunction.IsNull() || aFunction->GetDriverGUID() != GetSubShapeID()) return true; // mkr : IPAL9921
return false;
}

View File

@ -21,6 +21,11 @@
#include <TDF_Tool.hxx>
#include <TopAbs.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
namespace GEOM
{
size_t TPythonDump::myCounter = 0;
@ -89,6 +94,14 @@ namespace GEOM
return *this;
}
TPythonDump& TPythonDump::operator<< (const TopAbs_ShapeEnum theArg)
{
myStream<<"geompy.ShapeType[\"";
TopAbs::Print(theArg, myStream);
myStream<<"\"]";
return *this;
}
TPythonDump& TPythonDump::operator<< (const Handle(GEOM_Object)& theObject)
{
TCollection_AsciiString anEntry;
@ -96,4 +109,40 @@ namespace GEOM
myStream << anEntry.ToCString();
return *this;
}
Handle(GEOM_Object) GetCreatedLast(const Handle(GEOM_Object)& theObj1,
const Handle(GEOM_Object)& theObj2)
{
if (theObj1.IsNull()) return theObj2;
if (theObj2.IsNull()) return theObj1;
TColStd_ListOfInteger aTags1, aTags2;
TDF_Tool::TagList(theObj1->GetEntry(), aTags1);
TDF_Tool::TagList(theObj2->GetEntry(), aTags2);
TColStd_ListIteratorOfListOfInteger aListIter1(aTags1), aListIter2(aTags2);
for (; aListIter1.More(); aListIter1.Next()) {
if (!aListIter2.More())
return theObj1; // anObj1 is stored under anObj2
if (aListIter1.Value() > aListIter2.Value())
return theObj1;
else if (aListIter1.Value() < aListIter2.Value())
return theObj2;
}
return theObj1;
}
Handle(GEOM_Object) GetCreatedLast(const Handle(TColStd_HSequenceOfTransient)& theObjects)
{
Handle(GEOM_Object) anObject, aLatest;
int i, aLen = theObjects->Length();
if (aLen < 1)
return aLatest;
for (i = 1; i <= aLen; i++) {
anObject = Handle(GEOM_Object)::DownCast(theObjects->Value(i));
aLatest = GetCreatedLast(aLatest, anObject);
}
return aLatest;
}
}

View File

@ -49,8 +49,18 @@ namespace GEOM
Standard_EXPORT TPythonDump& operator<< (float theArg);
Standard_EXPORT TPythonDump& operator<< (const void* theArg);
Standard_EXPORT TPythonDump& operator<< (const char* theArg);
Standard_EXPORT TPythonDump& operator<< (const TopAbs_ShapeEnum theArg);
Standard_EXPORT TPythonDump& operator<< (const Handle(GEOM_Object)& theObject);
};
/*! Returns an object from two given, which has the latest entry
*/
Handle(GEOM_Object) GetCreatedLast (const Handle(GEOM_Object)& theObj1,
const Handle(GEOM_Object)& theObj2);
/*! Returns an object from \a theObjects, which has the latest entry
*/
Handle(GEOM_Object) GetCreatedLast (const Handle(TColStd_HSequenceOfTransient)& theObjects);
}
#endif

View File

@ -81,12 +81,8 @@ void GEOMBase_Skeleton::Init()
{
myGeomGUI = 0;
SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
{
SalomeApp_Module* module = dynamic_cast<SalomeApp_Module*>(app->loadModule("Geometry"));
if (module)
myGeomGUI = dynamic_cast<GeometryGUI*>(module);
}
if( app )
myGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
/* init variables */
myGeomBase = new GEOMBase(); // SAN -- TO BE REMOVED !!!
@ -95,10 +91,10 @@ void GEOMBase_Skeleton::Init()
/* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
if (myGeomGUI)
{
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
}
{
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
}
/* Move widget on the botton right corner of main widget */
// int x, y;

View File

@ -551,13 +551,13 @@ void GeometryGUI::OnGUIEvent( int id )
// function : GeometryGUI::OnKeyPress()
// purpose : Called when any key is pressed by user [static]
//=================================================================================
bool GeometryGUI::OnKeyPress( QKeyEvent* pe, SUIT_ViewWindow* win )
void GeometryGUI::OnKeyPress( SUIT_ViewWindow* win, QKeyEvent* pe )
{
GUIMap::Iterator it;
bool bOk = true;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
bOk = bOk && it.data()->OnKeyPress( pe, application()->desktop(), win );
return bOk;
// return bOk;
}
@ -565,13 +565,13 @@ bool GeometryGUI::OnKeyPress( QKeyEvent* pe, SUIT_ViewWindow* win )
// function : GeometryGUI::OnMouseMove()
// purpose : Manages mouse move events [static]
//=================================================================================
bool GeometryGUI::OnMouseMove( QMouseEvent* pe, SUIT_ViewWindow* win )
void GeometryGUI::OnMouseMove( SUIT_ViewWindow* win, QMouseEvent* pe )
{
GUIMap::Iterator it;
bool bOk = true;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
bOk = bOk && it.data()->OnMouseMove( pe, application()->desktop(), win );
return bOk;
// return bOk;
}
@ -579,7 +579,7 @@ bool GeometryGUI::OnMouseMove( QMouseEvent* pe, SUIT_ViewWindow* win )
// function : GeometryGUI::0nMousePress()
// purpose : Manage mouse press events [static]
//=================================================================================
bool GeometryGUI::OnMousePress( QMouseEvent* pe, SUIT_ViewWindow* win )
void GeometryGUI::OnMousePress( SUIT_ViewWindow* win, QMouseEvent* pe )
{
GUIMap::Iterator it;
// OnMousePress() should return false if this event should be processed further
@ -587,7 +587,7 @@ bool GeometryGUI::OnMousePress( QMouseEvent* pe, SUIT_ViewWindow* win )
bool processed = false;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
processed = processed || it.data()->OnMousePress( pe, application()->desktop(), win );
return processed;
// return processed;
}
/*
@ -1117,10 +1117,6 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
connect( (STD_Application*)application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
connect( (STD_Application*)application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
GUIMap::Iterator it;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
@ -1161,10 +1157,6 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study )
disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
disconnect( (STD_Application*)application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
disconnect( (STD_Application*)application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
EmitSignalCloseAllDialogs();
@ -1535,6 +1527,15 @@ void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm )
{
if ( vm->getType() == OCCViewer_Viewer::Type() )
{
qDebug( "connect" );
connect( vm, SIGNAL( keyPress ( SUIT_ViewWindow*, QKeyEvent* ) ),
this, SLOT( OnKeyPress( SUIT_ViewWindow*, QKeyEvent* ) ) );
connect( vm, SIGNAL( mousePress( SUIT_ViewWindow*, QMouseEvent* ) ),
this, SLOT( OnMousePress( SUIT_ViewWindow*, QMouseEvent* ) ) );
connect( vm, SIGNAL( mouseMove ( SUIT_ViewWindow*, QMouseEvent* ) ),
this, SLOT( OnMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
LightApp_SelectionMgr* sm = getApp()->selectionMgr();
myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) );

View File

@ -117,10 +117,6 @@ public:
void OnGUIEvent( int id );
virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
// virtual bool SetSettings();
// virtual void SupportedViewType ( int* buffer, int bufferSize );
virtual void BuildPresentation( const Handle(SALOME_InteractiveObject)&, SUIT_ViewWindow* = 0 );
@ -145,11 +141,16 @@ public:
public slots:
virtual bool deactivateModule( SUIT_Study* );
virtual bool activateModule( SUIT_Study* );
virtual void OnKeyPress ( SUIT_ViewWindow*, QKeyEvent* );
virtual void OnMousePress( SUIT_ViewWindow*, QMouseEvent* );
virtual void OnMouseMove ( SUIT_ViewWindow*, QMouseEvent* );
protected slots:
virtual void onViewManagerAdded( SUIT_ViewManager* );
virtual void onViewManagerRemoved( SUIT_ViewManager* );
private slots:
void OnGUIEvent();
void onViewManagerAdded( SUIT_ViewManager* );
void onViewManagerRemoved( SUIT_ViewManager* );
void onWindowActivated( SUIT_ViewWindow* );
signals :

View File

@ -537,12 +537,11 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetPoint
//The GetPoint() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
GEOM::TPythonDump(aFunction, /*append=*/true)
<< aResult << " = geompy.GetPoint(" << theShape << ", "
<< theX << ", " << theY << ", " << theZ << ", " << theEpsilon << ")";
<< theX << ", " << theY << ", " << theZ << ", " << theEpsilon << ")";
SetErrorCode(OK);
return aResult;
@ -2447,12 +2446,11 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::ExplodeCompound
//The explode doesn't change object so no new function is required.
aFunction = theCompound->GetLastFunction();
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t["
<< anAsciiList.ToCString() << "] = geompy.MakeBlockExplode("
<< theCompound << ", " << theMinNbFaces << ", " << theMaxNbFaces << ")";
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "[" << anAsciiList.ToCString() << "] = geompy.MakeBlockExplode("
<< theCompound << ", " << theMinNbFaces << ", " << theMaxNbFaces << ")";
SetErrorCode(OK);
return aBlocks;
@ -3118,11 +3116,10 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::Propagate
// The Propagation doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
// Make a Python command
GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t["
<< aListRes.ToCString() << "] = geompy.Propagate(" << theShape << ")";
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "[" << aListRes.ToCString() << "] = geompy.Propagate(" << theShape << ")";
SetErrorCode(OK);
return aSeq;

View File

@ -75,7 +75,7 @@ GEOMImpl_IGroupOperations::~GEOMImpl_IGroupOperations()
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup
(Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum theShapeType)
(Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum theShapeType)
{
SetErrorCode(KO);
@ -94,14 +94,12 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup
//Make a Python command
Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
//TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" << aGroup
GEOM::TPythonDump(aFunction) << aGroup
<< " = geompy.CreateGroup(" << theMainShape << ", " << (int)theShapeType << ")";
<< " = geompy.CreateGroup(" << theMainShape << ", " << theShapeType << ")";
SetErrorCode(OK);
return aGroup;
return aGroup;
}
//=============================================================================
@ -156,9 +154,7 @@ void GEOMImpl_IGroupOperations::AddObject(Handle(GEOM_Object) theGroup, int theS
}
//Make a Python command
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "geompy.AddObject(" << theGroup << ", " << theSubShapeID << ")";
SetErrorCode(OK);
@ -222,9 +218,7 @@ void GEOMImpl_IGroupOperations::RemoveObject (Handle(GEOM_Object) theGroup, int
}
//Make a Python command
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "geompy.RemoveObject(" << theGroup << ", " << theSubShapeID << ")";
SetErrorCode(OK);
@ -242,6 +236,12 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup,
SetErrorCode(KO);
if (theGroup.IsNull()) return;
Standard_Integer aLen = theSubShapes->Length();
if (aLen < 1) {
SetErrorCode("The list is empty");
return;
}
Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
if (aFunction.IsNull()) return;
@ -277,7 +277,7 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup,
TopExp::MapShapes(aMainShape, mapIndices);
// Get IDs of sub-shapes to add
Standard_Integer i, new_id, aLen = theSubShapes->Length();
Standard_Integer i, new_id;
for (i = 1; i <= aLen; i++) {
Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
@ -363,11 +363,13 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup,
aSSI.SetIndices(aNewSeq);
}
//Make a Python command
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
Handle(GEOM_Object) aLatest = GEOM::GetCreatedLast(theSubShapes);
aLatest = GEOM::GetCreatedLast(aLatest, theGroup);
Handle(GEOM_Function) aLastFunc = aLatest->GetLastFunction();
GEOM::TPythonDump pd (aFunction);
pd << anOldDescr.ToCString() << "\n\t" << "geompy.UnionList(" << theGroup << ", [";
GEOM::TPythonDump pd (aLastFunc, /*append=*/true);
pd << "geompy.UnionList(" << theGroup << ", [";
for (i = 1; i <= aLen; i++) {
Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
@ -388,6 +390,12 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup,
SetErrorCode(KO);
if (theGroup.IsNull()) return;
Standard_Integer aLen = theSubShapes->Length();
if (aLen < 1) {
SetErrorCode("The list is empty");
return;
}
Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
if (aFunction.IsNull()) return;
@ -424,7 +432,7 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup,
TopExp::MapShapes(aMainShape, mapIndices);
// Get IDs of sub-shapes to be removed
Standard_Integer i, rem_id, aLen = theSubShapes->Length();
Standard_Integer i, rem_id;
for (i = 1; i <= aLen; i++) {
Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
@ -514,10 +522,12 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup,
}
//Make a Python command
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
Handle(GEOM_Object) aLatest = GEOM::GetCreatedLast(theSubShapes);
aLatest = GEOM::GetCreatedLast(aLatest, theGroup);
Handle(GEOM_Function) aLastFunc = aLatest->GetLastFunction();
GEOM::TPythonDump pd (aFunction);
pd << anOldDescr.ToCString() << "\n\t" << "geompy.DifferenceList(" << theGroup << ", [";
GEOM::TPythonDump pd (aLastFunc, /*append=*/true);
pd << "geompy.DifferenceList(" << theGroup << ", [";
for (i = 1; i <= aLen; i++) {
Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
@ -526,6 +536,7 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup,
SetErrorCode(OK);
}
//=============================================================================
/*!
* UnionIDs
@ -537,6 +548,12 @@ void GEOMImpl_IGroupOperations::UnionIDs (Handle(GEOM_Object) theGroup,
SetErrorCode(KO);
if (theGroup.IsNull()) return;
Standard_Integer aLen = theSubShapes->Length();
if (aLen < 1) {
SetErrorCode("The list is empty");
return;
}
Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
if (aFunction.IsNull()) return;
@ -572,7 +589,7 @@ void GEOMImpl_IGroupOperations::UnionIDs (Handle(GEOM_Object) theGroup,
TopExp::MapShapes(aMainShape, mapIndices);
// Get IDs of sub-shapes to add
Standard_Integer i, new_id, aLen = theSubShapes->Length();
Standard_Integer i, new_id;
for (i = 1; i <= aLen; i++) {
new_id = theSubShapes->Value(i);
@ -594,6 +611,13 @@ void GEOMImpl_IGroupOperations::UnionIDs (Handle(GEOM_Object) theGroup,
aSSI.SetIndices(aNewSeq);
}
//Make a Python command
GEOM::TPythonDump pd (aFunction, /*append=*/true);
pd << "geompy.UnionIDs(" << theGroup << ", [";
for (i = 1; i < aLen; i++)
pd << theSubShapes->Value(i) << ", ";
pd << theSubShapes->Value(aLen) << "])";
SetErrorCode(OK);
}
@ -608,6 +632,12 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup,
SetErrorCode(KO);
if (theGroup.IsNull()) return;
Standard_Integer aLen = theSubShapes->Length();
if (aLen < 1) {
SetErrorCode("The list is empty");
return;
}
Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
if (aFunction.IsNull()) return;
@ -644,7 +674,7 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup,
TopExp::MapShapes(aMainShape, mapIndices);
// Get IDs of sub-shapes to be removed
Standard_Integer i, rem_id, aLen = theSubShapes->Length();
Standard_Integer i, rem_id;
for (i = 1; i <= aLen; i++) {
rem_id = theSubShapes->Value(i);
if (mapIDsCurrent.Contains(rem_id)) {
@ -666,6 +696,13 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup,
aSSI.SetIndices(aNewSeq);
}
//Make a Python command
GEOM::TPythonDump pd (aFunction, /*append=*/true);
pd << "geompy.DifferenceIDs(" << theGroup << ", [";
for (i = 1; i < aLen; i++)
pd << theSubShapes->Value(i) << ", ";
pd << theSubShapes->Value(aLen) << "])";
SetErrorCode(OK);
}
@ -709,9 +746,7 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape (Handle(GEOM_Object)
if (aMainShape.IsNull()) return NULL;
//Make a Python command
TCollection_AsciiString anOldDescr = aGroupFunction->GetDescription();
GEOM::TPythonDump(aGroupFunction) << anOldDescr.ToCString() << "\n\t"
GEOM::TPythonDump(aGroupFunction, /*append=*/true)
<< aMainShape << " = geompy.GetMainShape(" << theGroup << ")";
SetErrorCode(OK);
@ -726,12 +761,12 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape (Handle(GEOM_Object)
Handle(TColStd_HArray1OfInteger) GEOMImpl_IGroupOperations::GetObjects(Handle(GEOM_Object) theGroup)
{
SetErrorCode(KO);
if(theGroup.IsNull()) return NULL;
if(theGroup.IsNull()) return NULL;
Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
if(aFunction.IsNull()) return NULL;
GEOM_ISubShape aSSI(aFunction);
Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices();
if(aSeq.IsNull()) return NULL;

View File

@ -93,9 +93,6 @@
#include <TColStd_HArray1OfInteger.hxx>
#include <vector>
//#include <iostream>
//#include <OSD_Timer.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
@ -533,9 +530,6 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
const Standard_Integer theShapeType,
const Standard_Boolean isSorted)
{
// OSD_Timer timer1, timer2, timer3, timer4;
// timer1.Start();
SetErrorCode(KO);
if (theShape.IsNull()) return NULL;
@ -573,15 +567,9 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
return aSeq;
}
// timer1.Stop();
// timer2.Start();
if (isSorted)
SortShapes(listShape);
// timer2.Stop();
// timer3.Start();
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aShape, anIndices);
Handle(TColStd_HArray1OfInteger) anArray;
@ -605,26 +593,14 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
anAsciiList.Trunc(anAsciiList.Length() - 1);
aFunction = theShape->GetLastFunction();
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
GEOM::TPythonDump pd (aFunction);
pd << anOldDescr.ToCString() << "\n\t[" << anAsciiList.ToCString();
GEOM::TPythonDump pd (aFunction, /*append=*/true);
pd << "[" << anAsciiList.ToCString();
pd << "] = geompy.SubShapeAll" << (isSorted ? "Sorted(" : "(");
pd << theShape << ", " << theShapeType << ")";
pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
SetErrorCode(OK);
// timer4.Stop();
// cout << "Explosure takes:" << endl;
// timer1.Show();
// cout << "Sorting takes:" << endl;
// timer2.Show();
// cout << "Sub-shapes addition takes:" << endl;
// timer3.Show();
// cout << "Update Description takes:" << endl;
// timer4.Show();
return aSeq;
}
@ -687,13 +663,12 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs
}
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
GEOM::TPythonDump pd (aFunction);
pd << anOldDescr.ToCString() << "\n\tlistSubShapeIDs = geompy.SubShapeAll";
GEOM::TPythonDump pd (aFunction, /*append=*/true);
pd << "listSubShapeIDs = geompy.SubShapeAll";
pd << (isSorted ? "SortedIDs(" : "IDs(");
pd << theShape << ", " << theShapeType << ")";
pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
SetErrorCode(OK);
return aSeq;
@ -873,11 +848,10 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetFreeFacesIDs
//The explode doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
GEOM::TPythonDump(aFunction) << anOldDescr.ToCString()
<< "\n\tlistFreeFacesIDs = geompy.GetFreeFacesIDs(" << theShape << ")";
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listFreeFacesIDs = geompy.GetFreeFacesIDs(" << theShape << ")";
SetErrorCode(OK);
return aSeq;
@ -942,7 +916,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes
GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
<< "] = geompy.GetSharedShapes(" << theShape1 << ", "
<< theShape2 << ", " << theShapeType << ")";
<< theShape2 << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
SetErrorCode(OK);
return aSeq;
@ -1084,9 +1058,6 @@ Handle(TColStd_HSequenceOfInteger)
GEOMAlgo_State theState)
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
// MESSAGE("--------------------------- GetShapesOnPlane phase 1 takes:");
// OSD_Timer timer1;
// timer1.Start();
// Check presence of triangulation, build if need
if (!CheckTriangulation(theShape))
@ -1112,19 +1083,7 @@ Handle(TColStd_HSequenceOfInteger)
// Default value=0
aFinder.SetNbPntsMax(100);
// timer1.Stop();
// timer1.Show();
// MESSAGE("--------------------------- Perform on Plane takes:");
// timer1.Reset();
// timer1.Start();
aFinder.Perform();
// timer1.Stop();
// timer1.Show();
// MESSAGE("--------------------------- GetShapesOnPlane phase 3 takes:");
// timer1.Reset();
// timer1.Start();
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
@ -1149,13 +1108,6 @@ Handle(TColStd_HSequenceOfInteger)
return aSeqOfIDs;
}
// timer1.Stop();
// timer1.Show();
// MESSAGE("--------------------------- GetShapesOnPlane phase 4 takes:");
// timer1.Reset();
// timer1.Start();
// Fill sequence of object IDs
aSeqOfIDs = new TColStd_HSequenceOfInteger;
@ -1167,8 +1119,7 @@ Handle(TColStd_HSequenceOfInteger)
int id = anIndices.FindIndex(itSub.Value());
aSeqOfIDs->Append(id);
}
// timer1.Stop();
// timer1.Show();
return aSeqOfIDs;
}
@ -1250,10 +1201,6 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan
{
SetErrorCode(KO);
// MESSAGE("--------------------------- GetShapesOnPlane phase 1 takes:");
// OSD_Timer timer1;
// timer1.Start();
if (theShape.IsNull() || theAx1.IsNull()) return NULL;
TopoDS_Shape aShape = theShape->GetValue();
@ -1277,13 +1224,6 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan
if ( aSeq.IsNull() || aSeq->Length() == 0 )
return NULL;
// timer1.Stop();
// timer1.Show();
// MESSAGE("--------------------------- GetShapesOnPlane phase 5 takes:");
// timer1.Reset();
// timer1.Start();
// Make a Python command
Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 ));
@ -1291,7 +1231,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan
GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
<< "] = geompy.GetShapesOnPlane(" << theShape << ", "
<< theShapeType << ", " << theAx1 << ", " << theState << ")";
<< aShapeType << ", " << theAx1 << ", " << theState << ")";
SetErrorCode(OK);
return aSeq;
@ -1340,7 +1280,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCyli
Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
<< "] = geompy.GetShapesOnCylinder(" << theShape << ", " << theShapeType
<< "] = geompy.GetShapesOnCylinder(" << theShape << ", " << aShapeType
<< ", " << theAxis << ", " << theRadius << ", " << theState << ")";
SetErrorCode(OK);
@ -1393,31 +1333,13 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnSphe
Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
<< "] = geompy.GetShapesOnSphere(" << theShape << ", " << theShapeType
<< "] = geompy.GetShapesOnSphere(" << theShape << ", " << aShapeType
<< ", " << theCenter << ", " << theRadius << ", " << theState << ")";
SetErrorCode(OK);
return aSeq;
}
//=======================================================================
//function : getCreatedLast
/*!
* \brief Select the object created last
* \param theObj1 - Object 1
* \param theObj2 - Object 2
* \retval Handle(GEOM_Object) - selected object
*/
//=======================================================================
Handle(GEOM_Object) GEOMImpl_IShapesOperations::getCreatedLast(const Handle(GEOM_Object)& theObj1,
const Handle(GEOM_Object)& theObj2)
{
if ( theObj1.IsNull() ) return theObj2;
if ( theObj2.IsNull() ) return theObj1;
return ( theObj1->GetEntry().Tag() > theObj2->GetEntry().Tag() ) ? theObj1 : theObj2;
}
//=============================================================================
/*!
* GetShapesOnPlaneIDs
@ -1452,13 +1374,12 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnPlaneI
aSeq = getShapesOnSurfaceIDs( aPlane, aShape, aShapeType, theState );
// The GetShapesOnPlaneIDs() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theAx1)->GetLastFunction();
Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAx1)->GetLastFunction();
// Make a Python command
const bool append = true;
GEOM::TPythonDump(aFunction,append)
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnPlane = geompy.GetShapesOnPlaneIDs"
<< "(" << theShape << "," << theShapeType << "," << theAx1 << "," << theState << ")";
<< "(" << theShape << "," << aShapeType << "," << theAx1 << "," << theState << ")";
SetErrorCode(OK);
return aSeq;
@ -1499,13 +1420,12 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnCylind
aSeq = getShapesOnSurfaceIDs( aCylinder, aShape, aShapeType, theState );
// The GetShapesOnCylinder() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theAxis)->GetLastFunction();
Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAxis)->GetLastFunction();
// Make a Python command
const bool append = true;
GEOM::TPythonDump(aFunction,append)
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs"
<< "(" << theShape << ", " << theShapeType << ", " << theAxis << ", "
<< "(" << theShape << ", " << aShapeType << ", " << theAxis << ", "
<< theRadius << ", " << theState << ")";
SetErrorCode(OK);
@ -1550,13 +1470,12 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnSphere
aSeq = getShapesOnSurfaceIDs( aSphere, aShape, aShapeType, theState );
// The GetShapesOnSphere() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theCenter)->GetLastFunction();
Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theCenter)->GetLastFunction();
// Make a Python command
const bool append = true;
GEOM::TPythonDump(aFunction,append)
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs"
<< "(" << theShape << ", " << theShapeType << ", " << theCenter << ", "
<< "(" << theShape << ", " << aShapeType << ", " << theCenter << ", "
<< theRadius << ", " << theState << ")";
SetErrorCode(OK);
@ -1738,7 +1657,7 @@ Handle(TColStd_HSequenceOfTransient)
GEOM::TPythonDump(aFunction)
<< "[" << anAsciiList.ToCString() << "] = geompy.GetShapesOnQuadrangle("
<< theShape << ", "
<< theShapeType << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", "
<< theTopLeftPoint << ", "
<< theTopRigthPoint << ", "
<< theBottomLeftPoint << ", "
@ -1788,17 +1707,16 @@ Handle(TColStd_HSequenceOfInteger)
// Make a Python command
// The GetShapesOnCylinder() doesn't change object so no new function is required.
Handle(GEOM_Object) lastObj = getCreatedLast(theShape,theTopLeftPoint);
lastObj = getCreatedLast(lastObj,theTopRigthPoint);
lastObj = getCreatedLast(lastObj,theBottomRigthPoint);
lastObj = getCreatedLast(lastObj,theBottomLeftPoint);
Handle(GEOM_Object) lastObj = GEOM::GetCreatedLast(theShape,theTopLeftPoint);
lastObj = GEOM::GetCreatedLast(lastObj,theTopRigthPoint);
lastObj = GEOM::GetCreatedLast(lastObj,theBottomRigthPoint);
lastObj = GEOM::GetCreatedLast(lastObj,theBottomLeftPoint);
Handle(GEOM_Function) aFunction = lastObj->GetLastFunction();
const bool append = true;
GEOM::TPythonDump(aFunction,append)
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnQuadrangle = geompy.GetShapesOnQuadrangleIDs("
<< theShape << ", "
<< theShapeType << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", "
<< theTopLeftPoint << ", "
<< theTopRigthPoint << ", "
<< theBottomLeftPoint << ", "
@ -2099,6 +2017,7 @@ void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL)
MidXYZ.SetValue(Index,
GPoint.X()*999 + GPoint.Y()*99 + GPoint.Z()*0.9);
}
// Sorting
Standard_Integer aTemp;
Standard_Boolean exchange, Sort = Standard_True;
@ -2133,11 +2052,6 @@ void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL)
//=======================================================================
bool GEOMImpl_IShapesOperations::CheckTriangulation (const TopoDS_Shape& aShape)
{
// MESSAGE("CheckTriangulation");
//
// OSD_Timer timer1;
// timer1.Start();
TopExp_Explorer exp (aShape, TopAbs_FACE);
if (!exp.More()) {
SetErrorCode("Shape without faces given");
@ -2158,15 +2072,10 @@ bool GEOMImpl_IShapesOperations::CheckTriangulation (const TopoDS_Shape& aShape)
Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
// MESSAGE("Deflection = " << aDeflection);
Standard_Real aHLRAngle = 0.349066;
BRepMesh_IncrementalMesh Inc (aShape, aDeflection, Standard_False, aHLRAngle);
}
// timer1.Stop();
// timer1.Show();
return true;
}

View File

@ -93,7 +93,7 @@ EXPORT_HEADERS= GEOMImpl_Gen.hxx \
# additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome $(CAS_LDPATH) -lTKCAF -lTKFillet -lTKOffset -lCASCatch -lGEOMbasic -lNMTAlgo -lGEOMAlgo -lShHealOper
LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome $(CAS_LDPATH) -lTKCAF -lTKFillet -lTKOffset -lGEOMbasic -lNMTAlgo -lGEOMAlgo -lShHealOper
# additional file to be cleaned

View File

@ -33,7 +33,6 @@
#include "GeometryGUI.h"
#include "GEOMToolsGUI_TransparencyDlg.h"
#include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement
#include "GEOMToolsGUI_NameDlg.h"
#include "GEOM_Actor.h"
#include "GEOMBase.h"
@ -57,10 +56,12 @@
#include <SUIT_MessageBox.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Module.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_NameDlg.h>
#include "SALOMEDSClient.hxx"
#include "utilities.h"
@ -195,7 +196,7 @@ void GEOMToolsGUI::OnRename()
if( obj->FindAttribute(anAttr, "AttributeName") ) {
_PTR(AttributeName) aName (anAttr);
QString newName = GEOMToolsGUI_NameDlg::getName( app->desktop(), aName->Value().c_str() );
QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() );
if ( !newName.isEmpty() ) {
aName->SetValue( newName.latin1() ); // rename the SObject
IObject->setName( newName.latin1() );// rename the InteractiveObject

View File

@ -1,135 +0,0 @@
// SALOME GEOMToolsGUI : implementation of desktop and GUI kernel
//
// Copyright (C) 2003 CEA/DEN, EDF R&D
//
//
//
// File : GEOMToolsGUI_NameDlg.cxx
// Author : Vadim SANDLER
// Module : SALOME
// $Header$
#include "GEOMToolsGUI_NameDlg.h"
#include <SUIT_Session.h>
#include <SUIT_Application.h>
#include <SUIT_Desktop.h>
#include <SUIT_Tools.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
//using namespace std;
/*!
Constructor
*/
GEOMToolsGUI_NameDlg::GEOMToolsGUI_NameDlg( QWidget* parent )
: QDialog( parent ? parent : SUIT_Session::session()->activeApplication()->desktop(),
"GEOMToolsGUI_NameDlg",
true,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
setCaption( tr("TLT_RENAME") );
setSizeGripEnabled( TRUE );
QVBoxLayout* topLayout = new QVBoxLayout( this );
topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
/***************************************************************/
QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 );
QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 );
QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" );
TextLabel->setText( tr( "NAME_LBL" ) );
GroupC1Layout->addWidget( TextLabel );
myLineEdit = new QLineEdit( GroupC1, "LineEdit1" );
myLineEdit->setMinimumSize( 250, 0 );
GroupC1Layout->addWidget( myLineEdit );
/***************************************************************/
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 );
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );
myButtonOk = new QPushButton( GroupButtons, "buttonOk" );
myButtonOk->setText( tr( "GEOM_BUT_OK" ) );
myButtonOk->setAutoDefault( TRUE );
myButtonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( myButtonOk );
GroupButtonsLayout->addStretch();
myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" );
myButtonCancel->setText( tr( "GEOM_BUT_CANCEL" ) );
myButtonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( myButtonCancel );
/***************************************************************/
topLayout->addWidget( GroupC1 );
topLayout->addWidget( GroupButtons );
// signals and slots connections
connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
/* Move widget on the botton right corner of main widget */
SUIT_Tools::centerWidget( this, parent );
}
/*!
Destructor
*/
GEOMToolsGUI_NameDlg::~GEOMToolsGUI_NameDlg()
{
}
/*!
Sets name
*/
void GEOMToolsGUI_NameDlg::setName( const QString& name )
{
myLineEdit->setText( name );
myLineEdit->end(false);
myLineEdit->home(true);
}
/*!
Returns name entered by user
*/
QString GEOMToolsGUI_NameDlg::name()
{
return myLineEdit->text();
}
void GEOMToolsGUI_NameDlg::accept()
{
if ( name().stripWhiteSpace().isEmpty() )
return;
QDialog::accept();
}
/*!
Creates modal <Rename> dialog and returns name entered [ static ]
*/
QString GEOMToolsGUI_NameDlg::getName( QWidget* parent, const QString& oldName )
{
QString n;
GEOMToolsGUI_NameDlg* dlg = new GEOMToolsGUI_NameDlg( parent );
if ( !oldName.isNull() )
dlg->setName( oldName );
if ( dlg->exec() == QDialog::Accepted )
n = dlg->name();
delete dlg;
return n;
}

View File

@ -1,46 +0,0 @@
// SALOME GEOMToolsGUI : implementation of desktop and GUI kernel
//
// Copyright (C) 2003 CEA/DEN, EDF R&D
//
//
//
// File : GEOMToolsGUI_NameDlg.h
// Author : Vadim SANDLER
// Module : SALOME
// $Header$
#ifndef GEOMToolsGUI_NAMEDLG_H
#define GEOMToolsGUI_NAMEDLG_H
#include <qdialog.h>
class QLineEdit;
class QPushButton;
//=================================================================================
// class : GEOMToolsGUI_NameDlg
// purpose : Common <Rename> dialog box class
//=================================================================================
class GEOMToolsGUI_NameDlg : public QDialog
{
Q_OBJECT
public:
GEOMToolsGUI_NameDlg( QWidget* parent = 0 );
~GEOMToolsGUI_NameDlg();
void setName( const QString& name );
QString name();
static QString getName( QWidget* parent = 0, const QString& oldName = QString::null );
protected slots:
void accept();
private:
QPushButton* myButtonOk;
QPushButton* myButtonCancel;
QLineEdit* myLineEdit;
};
#endif // GEOMToolsGUI_NAMEDLG_H

View File

@ -38,17 +38,15 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
LIB = libGEOMToolsGUI.la
# header files
EXPORT_HEADERS=
EXPORT_HEADERS =
LIB_SRC = GEOMToolsGUI.cxx \
GEOMToolsGUI_1.cxx \
GEOMToolsGUI_TransparencyDlg.cxx \
GEOMToolsGUI_NbIsosDlg.cxx \
GEOMToolsGUI_NameDlg.cxx
GEOMToolsGUI_NbIsosDlg.cxx
LIB_MOC = GEOMToolsGUI_TransparencyDlg.h \
GEOMToolsGUI_NbIsosDlg.h \
GEOMToolsGUI_NameDlg.h
GEOMToolsGUI_NbIsosDlg.h
LIB_CLIENT_IDL = SALOMEDS_Attributes.idl \
SALOME_GenericObj.idl \

View File

@ -47,6 +47,7 @@
#include <TCollection_AsciiString.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <OSD.hxx>
#include "SALOMEDS_Tool.hxx"
@ -67,6 +68,7 @@ GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb,
_impl = new ::GEOMImpl_Gen;
OSD::SetSignal( true );
}

View File

@ -242,15 +242,19 @@ def TestOtherOperations (geompy, math):
geompy.AddObject(CreateGroup, f_ind_6) # box_faces[5]
geompy.AddObject(CreateGroup, f_ind_1) # box_faces[0]
geompy.AddObject(CreateGroup, f_ind_4) # box_faces[3]
# Now contains f_ind_6, f_ind_1, f_ind_4
# UnionList
geompy.UnionList(CreateGroup, [box_faces[2], box_faces[4], box_faces[5]])
# Now contains f_ind_6, f_ind_1, f_ind_4, f_ind_3, f_ind_5
# RemoveObject(theGroup, theSubShapeID)
geompy.RemoveObject(CreateGroup, f_ind_1) # box_faces[0]
# Now contains f_ind_6, f_ind_4, f_ind_3, f_ind_5
# DifferenceList
geompy.DifferenceList(CreateGroup, [box_faces[1], box_faces[0], box_faces[3]])
# Now contains f_ind_6, f_ind_3, f_ind_5
# GetObjectIDs
GetObjectIDs = geompy.GetObjectIDs(CreateGroup)
@ -262,6 +266,21 @@ def TestOtherOperations (geompy, math):
BoxCopy = geompy.GetMainShape(CreateGroup)
# DifferenceIDs
geompy.DifferenceIDs(CreateGroup, [f_ind_3, f_ind_5])
# Now contains f_ind_6
# UnionIDs
geompy.UnionIDs(CreateGroup, [f_ind_1, f_ind_2, f_ind_6])
# Now contains f_ind_6, f_ind_1, f_ind_2
# Check
GetObjectIDs = geompy.GetObjectIDs(CreateGroup)
print "Group of Box's faces includes the following IDs:"
print "(must be ", f_ind_6, ", ", f_ind_1, " and ", f_ind_2, ")"
for ObjectID in GetObjectIDs:
print " ", ObjectID
# -----------------------------------------------------------------------------
# enumeration ShapeTypeString as a dictionary
# -----------------------------------------------------------------------------
@ -392,12 +411,26 @@ def TestOtherOperations (geompy, math):
for face_i in faces_on_pln:
geompy.addToStudy(face_i, "Face on Plane (N = (0, 1, 1)) or below it")
# GetShapesOnPlaneIDs
faces_above_pln_ids = geompy.GetShapesOnPlaneIDs(blocksComp, geompy.ShapeType["FACE"],
v_0pp, geompy.GEOM.ST_OUT)
faces_above = geompy.CreateGroup(blocksComp, geompy.ShapeType["FACE"])
geompy.UnionIDs(faces_above, faces_above_pln_ids)
geompy.addToStudy(faces_above, "Group of faces above Plane (N = (0, 1, 1))")
# GetShapesOnCylinder
edges_on_cyl = geompy.GetShapesOnCylinder(blocksComp, geompy.ShapeType["EDGE"],
vy, 55, geompy.GEOM.ST_OUT)
for edge_i in edges_on_cyl:
edges_out_cyl = geompy.GetShapesOnCylinder(blocksComp, geompy.ShapeType["EDGE"],
vy, 55, geompy.GEOM.ST_OUT)
for edge_i in edges_out_cyl:
geompy.addToStudy(edge_i, "Edge out of Cylinder (axis = (0, 1, 0), r = 55)")
# GetShapesOnCylinderIDs
edges_in_cyl_ids = geompy.GetShapesOnCylinderIDs(blocksComp, geompy.ShapeType["EDGE"],
vy, 55, geompy.GEOM.ST_IN)
edges_in = geompy.CreateGroup(blocksComp, geompy.ShapeType["EDGE"])
geompy.UnionIDs(edges_in, edges_in_cyl_ids)
geompy.addToStudy(edges_in, "Group of edges inside Cylinder (axis = (0, 1, 0), r = 55)")
# GetShapesOnSphere
vertices_on_sph = geompy.GetShapesOnSphere(blocksComp, geompy.ShapeType["VERTEX"],
p0, 100, geompy.GEOM.ST_ON)
@ -405,6 +438,13 @@ def TestOtherOperations (geompy, math):
geompy.addToStudy(vertex_i, "Vertex on Sphere (center = (0, 0, 0), r = 100)")
pass
# GetShapesOnSphereIDs
vertices_on_sph_ids = geompy.GetShapesOnSphereIDs(blocksComp, geompy.ShapeType["VERTEX"],
p0, 100, geompy.GEOM.ST_ON)
vertices_on = geompy.CreateGroup(blocksComp, geompy.ShapeType["VERTEX"])
geompy.UnionIDs(vertices_on, vertices_on_sph_ids)
geompy.addToStudy(vertices_on, "Group of vertices on Sphere (center = (0, 0, 0), r = 100)")
# GetShapesOnQuadrangle
geompy.addToStudy(f12, "F12" )
@ -428,6 +468,13 @@ def TestOtherOperations (geompy, math):
print "Error in GetShapesOnQuadrangle()"
pass
# GetShapesOnQuadrangleIDs
vertices_on_quad_ids = geompy.GetShapesOnQuadrangleIDs(f12, geompy.ShapeType["VERTEX"],
tl, tr, bl, br, geompy.GEOM.ST_ON)
vertices_on_quad = geompy.CreateGroup(f12, geompy.ShapeType["VERTEX"])
geompy.UnionIDs(vertices_on_quad, vertices_on_quad_ids)
geompy.addToStudy(vertices_on_quad, "Group of vertices on Quadrangle F12")
# GetInPlace(theShapeWhere, theShapeWhat)
box5 = geompy.MakeBoxDXDYDZ(100, 100, 100)
box6 = geompy.MakeTranslation(box5, 50, 50, 0)

View File

@ -954,6 +954,8 @@ def GetShapesOnPlane(theShape, theShapeType, theAx1, theState):
def GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState):
"""
* Works like the above method, but returns list of sub-shapes indices
* Example: see GEOM_TestOthers.py
"""
aList = ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
if ShapesOp.IsDone() == 0:
@ -983,6 +985,8 @@ def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState):
def GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState):
"""
* Works like the above method, but returns list of sub-shapes indices
* Example: see GEOM_TestOthers.py
"""
aList = ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
if ShapesOp.IsDone() == 0:
@ -1011,6 +1015,8 @@ def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState):
def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState):
"""
* Works like the above method, but returns list of sub-shapes indices
* Example: see GEOM_TestOthers.py
"""
aList = ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
if ShapesOp.IsDone() == 0:
@ -1039,6 +1045,8 @@ def GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPo
def GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
"""
* Works like the above method, but returns list of sub-shapes indices
* Example: see GEOM_TestOthers.py
"""
aList = ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
if ShapesOp.IsDone() == 0:
@ -2473,6 +2481,8 @@ def UnionIDs(theGroup, theSubShapes):
"""
* Works like the above method, but argument
* theSubShapes here is a list of sub-shapes indices
* Example: see GEOM_TestOthers.py
"""
GroupOp.UnionIDs(theGroup, theSubShapes)
if GroupOp.IsDone() == 0:
@ -2494,6 +2504,8 @@ def DifferenceIDs(theGroup, theSubShapes):
"""
* Works like the above method, but argument
* theSubShapes here is a list of sub-shapes indices
* Example: see GEOM_TestOthers.py
"""
GroupOp.DifferenceIDs(theGroup, theSubShapes)
if GroupOp.IsDone() == 0:

View File

@ -323,6 +323,8 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
// try to find out and process the object browser selection
if ( !aMapIndex.Extent() ) {
globalSelection( GEOM_ALLSHAPES );
GEOM::ListOfGO anObjects;
GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), anObjects);
GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() );
@ -334,6 +336,9 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
aMapIndex.Add( anIndex );
}
}
if ( !myMainObj->_is_nil() )
localSelection( myMainObj, getShapeType() );
}
if (aMapIndex.Extent() >= 1) {
@ -656,8 +661,8 @@ bool GroupGUI_GroupDlg::isValid( QString& theMessage )
RETURN_WITH_MSG( !CORBA::is_nil( myMainObj ), tr( "NO_GROUP" ) )
}
const char* aName = getNewObjectName();
RETURN_WITH_MSG ( aName && strlen( aName ), tr( "EMPTY_NAME" ) )
QString aName (getNewObjectName());
RETURN_WITH_MSG ( !aName.stripWhiteSpace().isEmpty(), tr( "EMPTY_NAME" ) )
RETURN_WITH_MSG ( myIdList->count(), tr( "EMPTY_LIST" ) )
return true;