Code refactoring

This commit is contained in:
inv 2010-12-29 11:12:27 +00:00
parent e9605e4e5b
commit 5a0b94e3b5
29 changed files with 562 additions and 755 deletions

View File

@ -410,10 +410,9 @@ void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument() {
// nbSel == 1
if (aSelList.Extent() == 1) {
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO);
if (!CORBA::is_nil(aSelectedObject)) {
QString aName = GEOMBase::GetName(aSelectedObject);
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
@ -471,9 +470,8 @@ void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument() {
DisplayPreview();
}
// Standard_Boolean testResult = Standard_False;
// GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
// if (!testResult || aSelectedObject->_is_nil())
// GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
// if (aSelectedObject->_is_nil())
// return;
//
// myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));

View File

@ -269,9 +269,8 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
}
}
// nbSel == 1
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !CORBA::is_nil( aSelectedObject ) ) {
QString aName = GEOMBase::GetName(aSelectedObject);
// Get Selected object if selected subshape

View File

@ -334,9 +334,8 @@ void BasicGUI_CircleDlg::SelectionIntoArgument()
// nbSel == 1
Handle(SALOME_InteractiveObject) anIO = aList.First();
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
if ( !CORBA::is_nil( aSelectedObject ) ) {
QString aName = GEOMBase::GetName( aSelectedObject );
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;

View File

@ -286,8 +286,6 @@ void BasicGUI_CurveDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText( "" );
Standard_Boolean aRes = Standard_False;
SalomeApp_Application* app = myGeomGUI->getApp();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
_PTR(Study) aDStudy = appStudy->studyDS();
@ -308,8 +306,8 @@ void BasicGUI_CurveDlg::SelectionIntoArgument()
// that will actually be put into myPoints
for (SALOME_ListIteratorOfListIO anIt (selected); anIt.More(); anIt.Next()) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() );
if (!CORBA::is_nil(aSelectedObject) ) {
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
aSelMgr->GetIndexes(anIt.Value(), aMapIndexes);

View File

@ -235,10 +235,9 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
return;
}
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
if (!CORBA::is_nil(aSelectedObject) ) {
QString aName = GEOMBase::GetName(aSelectedObject);
// Get Selected object if selected subshape

View File

@ -252,9 +252,8 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
return;
}
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !CORBA::is_nil( aSelectedObject ) ) {
QString aName = GEOMBase::GetName( aSelectedObject );
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
if ( myEditCurrentArgument == GroupFaces->LineEdit1 ||

View File

@ -333,11 +333,10 @@ void BasicGUI_MarkerDlg::onSelectionDone0()
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) {
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO );
if ( aRes && !aSelectedObj->_is_nil() ) {
if ( !aSelectedObj->_is_nil() ) {
TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
// Existing LCS selected
@ -409,11 +408,10 @@ void BasicGUI_MarkerDlg::onSelectionDone()
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) {
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO );
if ( !CORBA::is_nil( aSelectedObj ) && aRes ) {
if ( !CORBA::is_nil( aSelectedObj ) ) {
QString aName = GEOMBase::GetName( aSelectedObj );
if ( getConstructorId() == 1 ) { // by shape position

View File

@ -442,9 +442,8 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
}
// nbSel == 1
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !CORBA::is_nil( aSelectedObject ) ) {
QString aName = GEOMBase::GetName( aSelectedObject );
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
if ( myEditCurrentArgument == GroupPntDir->LineEdit2 || myEditCurrentArgument == Group2Vec->LineEdit1 || myEditCurrentArgument == Group2Vec->LineEdit2)

View File

@ -489,10 +489,9 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) {
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
if ( !CORBA::is_nil( aSelectedObject ) ) {
QString aName = GEOMBase::GetName(aSelectedObject);
TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
@ -531,7 +530,7 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
else { // Global Selection
if ( aShape.ShapeType() != myNeedType ) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
aName = "";
if ( id == GEOM_POINT_XYZ ) return;
}
}

View File

@ -286,9 +286,8 @@ void BasicGUI_VectorDlg::SelectionIntoArgument()
}
// nbSel == 1
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (!CORBA::is_nil(aSelectedObject) ) {
QString aName = GEOMBase::GetName(aSelectedObject);
TopoDS_Shape aShape;

View File

@ -247,10 +247,9 @@ void BlocksGUI_BlockDlg::SelectionIntoArgument()
}
// nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (!testResult || CORBA::is_nil(aSelectedObject))
if ( CORBA::is_nil(aSelectedObject) )
return;
QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -213,10 +213,9 @@ void BlocksGUI_ExplodeDlg::SelectionIntoArgument()
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) {
if ( GEOMBase::IsShape(anObj) ) {
myObject = anObj;
myGrp1->LineEdit1->setText(GEOMBase::GetName(anObj));
}

View File

@ -156,9 +156,8 @@ void BlocksGUI_PropagateDlg::SelectionIntoArgument()
if (aSelList.Extent() == 1) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes )
myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
if ( !CORBA::is_nil( myObject ) )
myGrp->LineEdit1->setText( GEOMBase::GetName( myObject ) );
}
}

View File

@ -239,9 +239,8 @@ void BlocksGUI_QuadFaceDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
if (aResult && !anObj->_is_nil()) {
anObj = GEOMBase::ConvertIOinGEOMObject(aSelList. First() );
if ( !anObj->_is_nil() ) {
aName = GEOMBase::GetName(anObj);
// Get Selected object if selected subshape

View File

@ -240,10 +240,9 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument()
{
// If selection of main object is activated
if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) {
if ( GEOMBase::IsShape(anObj) ) {
aName = GEOMBase::GetName(anObj);
}
}
@ -257,9 +256,8 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument()
// If face selection is activated
int anIndex = -1;
if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) {
anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( GEOMBase::IsShape(anObj) ) {
aName = GEOMBase::GetName(anObj);
TColStd_IndexedMapOfInteger anIndexes;
aSelMgr->GetIndexes(aSelList.First(), anIndexes);

View File

@ -209,9 +209,8 @@ void BooleanGUI_Dialog::SelectionIntoArgument()
}
// nbSel == 1
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject))
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( GEOMBase::IsShape(aSelectedObject) )
{
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
@ -314,9 +313,8 @@ GEOM::GEOM_IOperations_ptr BooleanGUI_Dialog::createOperation()
bool BooleanGUI_Dialog::isValid (QString&)
{
//Handle(SALOME_InteractiveObject) IO = firstIObject();
//Standard_Boolean testResult;
//GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult);
//if (!testResult || anObject->_is_nil())
//GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO );
//if ( anObject->_is_nil() )
// return false;
return !CORBA::is_nil(myObject1) && !CORBA::is_nil(myObject2);

View File

@ -246,10 +246,9 @@ void BuildGUI_EdgeDlg::SelectionIntoArgument()
}
// nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( testResult && !aSelectedObject->_is_nil() ) {
if ( !aSelectedObject->_is_nil() ) {
QString aName = GEOMBase::GetName( aSelectedObject );
TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupWire->LineEdit1 ? TopAbs_WIRE : TopAbs_VERTEX;

View File

@ -216,11 +216,10 @@ void BuildGUI_WireDlg::SelectionIntoArgument()
std::list<GEOM::GEOM_Object_var> aList; // subshapes list
TopoDS_Shape aShape;
Standard_Boolean aRes = Standard_False;
for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) {
TColStd_IndexedMapOfInteger aMap;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes );
if ( !CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() );
if ( !CORBA::is_nil(aSelectedObject) && GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
aSelMgr->GetIndexes( anIt.Value(), aMap );
if ( aMap.Extent() > 0 ) { // local selection

View File

@ -299,9 +299,8 @@ void EntityGUI_3DSketcherDlg::SelectionIntoArgument()
int nbSel = aSelList.Extent();
if ( nbSel == 1 ) {
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !CORBA::is_nil(aSelectedObject) ) {
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE)) { // Explore the shape if its a local selection
TColStd_IndexedMapOfInteger aMap;

View File

@ -1144,9 +1144,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument()
int nbSel = aSelList.Extent();
if (nbSel == 1 && myEditCurrentArgument == Group1Sel->LineEdit1) {
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !CORBA::is_nil(aSelectedObject) ) {
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
gp_Trsf aTrans;
@ -1188,9 +1187,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument()
}
if (nbSel == 1 && myEditCurrentArgument == Group1Sel1Spin->LineEdit1) {
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !CORBA::is_nil(aSelectedObject) ) {
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
gp_Trsf aTrans;
@ -1232,9 +1230,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument()
}
if (nbSel == 1 && myEditCurrentArgument == Group2Sel->LineEdit1) {
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !CORBA::is_nil(aSelectedObject) ) {
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
gp_Trsf aTrans;
@ -1280,9 +1277,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument()
myX=tmpX; // If yes keep the old values of X and Y
myY=tmpY;
}
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !CORBA::is_nil(aSelectedObject) ) {
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
gp_Trsf aTrans;

View File

@ -213,7 +213,6 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument()
if (nbSel != 1)
return;
TopoDS_Shape S;
Handle(SALOME_InteractiveObject) IO = aSelList.First();
if ( !IO->hasEntry() ) {
SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) );
@ -221,17 +220,15 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument()
return;
}
if (!GEOMBase::GetTopoFromSelection(aSelList, S) ||
S.IsNull() ||
S.ShapeType() == TopAbs_VERTEX) {
TopoDS_Shape S = GEOMBase::GetTopoFromSelection( aSelList );
if ( S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) {
myObject = GEOM::GEOM_Object::_nil();
updateButtonState();
return;
}
Standard_Boolean testResult;
myObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult);
if (!testResult || myObject->_is_nil()) {
myObject = GEOMBase::ConvertIOinGEOMObject( IO );
if ( myObject->_is_nil() ) {
updateButtonState();
return;
}
@ -537,9 +534,8 @@ bool EntityGUI_SubShapeDlg::isValid (QString& msg)
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) {
Standard_Boolean testResult;
GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (testResult && !anObj->_is_nil()) {
GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( !anObj->_is_nil() ) {
TColStd_IndexedMapOfInteger aMapIndex;
aSelMgr->GetIndexes(aSelList.First(), aMapIndex);
isOk = aMapIndex.Extent() > 0;
@ -572,11 +568,10 @@ bool EntityGUI_SubShapeDlg::execute (ObjectList& objects)
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (aResult && !anObj->_is_nil()) {
if ( !anObj->_is_nil() ) {
TColStd_IndexedMapOfInteger aMapIndex;
aSelMgr->GetIndexes(aSelList.First(), aMapIndex);

File diff suppressed because it is too large Load Diff

View File

@ -54,70 +54,75 @@ class GEOMBASE_EXPORT GEOMBase
{
public :
/* Selection and objects management */
static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType);
static TopoDS_Shape GetShapeFromIOR(QString IOR);
static bool GetShape(const GEOM::GEOM_Object_ptr&, TopoDS_Shape&,
const TopAbs_ShapeEnum = TopAbs_SHAPE);
static bool GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& tds);
static int GetNameOfSelectedIObjects(const SALOME_ListIO& aList, QString& aName,
const bool theShapesOnly = false);
static bool GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString);
static int GetIndex( const TopoDS_Shape& subshape, const TopoDS_Shape& shape );
static TopoDS_Shape GetShapeFromIOR( const QString& IOR );
static bool GetShape( GEOM::GEOM_Object_ptr object,
TopoDS_Shape& shape,
const TopAbs_ShapeEnum type = TopAbs_SHAPE );
static TopoDS_Shape GetTopoFromSelection( const SALOME_ListIO& IObjects );
static int GetNameOfSelectedIObjects( const SALOME_ListIO& IObjects,
QString& name,
const bool shapesOnly = false );
static QString GetShapeTypeString( const TopoDS_Shape& shape );
/* Convertions */
static GEOM::GEOM_Object_ptr ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO,
Standard_Boolean& testResult);
static Handle(GEOM_AISShape) ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO,
Standard_Boolean& testResult,
bool onlyInActiveView = false);
static Handle(GEOM_AISShape)
ConvertIOinGEOMAISShape( const Handle(SALOME_InteractiveObject)& IO,
bool onlyInActiveView = false );
static Handle(AIS_InteractiveObject) GetAIS(const Handle(SALOME_InteractiveObject)& theIO,
const bool isOnlyInActiveView = false);
static void ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList,
GEOM::string_array& listIOR);
static Handle(AIS_InteractiveObject)
GetAIS( const Handle(SALOME_InteractiveObject)& IO,
bool onlyInActiveView = false,
bool onlyGeom = false );
static QStringList ConvertListOfIOInListOfIOR( const SALOME_ListIO& IObjects );
static Handle(GEOM_AISShape) ConvertIORinGEOMAISShape(const char * IOR,
Standard_Boolean& testResult,
bool onlyInActiveView = false);
static GEOM_Actor* ConvertIORinGEOMActor(const char * IOR, Standard_Boolean& testResult,
bool onlyInActiveView = false);
static Handle(GEOM_AISShape)
ConvertIORinGEOMAISShape( const QString& IOR,
bool onlyInActiveView = false );
static GEOM_Actor* ConvertIORinGEOMActor( const QString& IOR,
bool onlyInActiveView = false );
static GEOM::GEOM_Object_ptr ConvertIOinGEOMObject(const Handle(SALOME_InteractiveObject)& IO,
Standard_Boolean& testResult);
static GEOM::GEOM_Object_ptr
ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& IO );
static void ConvertListOfIOInListOfGO(const SALOME_ListIO& aList,
GEOM::ListOfGO& listGO,
const bool theShapesOnly = false);
static void ConvertListOfIOInListOfGO( const SALOME_ListIO& IObjects,
GEOM::ListOfGO& geomObjects,
bool shapesOnly = false );
static GEOM::GEOM_Object_ptr GetObjectFromIOR(const char* theIOR);
static GEOM::GEOM_Object_ptr
GetObjectFromIOR( const QString& IOR );
static QString GetIORFromObject(const GEOM::GEOM_Object_ptr& theObject);
static QString GetIORFromObject( GEOM::GEOM_Object_ptr object );
/* Geometry */
static bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P);
static bool VertexToPoint( const TopoDS_Shape& shape, gp_Pnt& point );
/* Used just by Plane and Prism */
static bool LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2);
static void GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz);
static bool LinearEdgeExtremities( const TopoDS_Shape& shape,
gp_Pnt& point1, gp_Pnt& point2 );
static void GetBipointDxDyDz( const gp_Pnt& point1, const gp_Pnt& point2,
double& dx, double& dy, double& dz );
/* Simulation management */
static bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone);
static TopoDS_Shape CreateArrowForLinearEdge( const TopoDS_Shape& tds );
/* Generates default names */
static bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName,
const SALOME_ListIO& aList);
static bool SelectionByNameInDialogs( QWidget* widget,
const QString& userObjectName,
const SALOME_ListIO& IObjects );
/* Shows message box with error code */
static bool DefineDlgPosition(QWidget* aDlg, int& x, int& y);
static void DefineDlgPosition( QWidget* dlg, int& x, int& y );
/* This method generates default names for results of geometrical operations */
static QString GetDefaultName(const QString& theOperation, const bool extractPrefix = false);
static QString GetDefaultName( const QString& operation, bool extractPrefix = false );
/* Shows message box with error code and comment */
static void ShowErrorMessage(const char* theErrorCode, const char* theComment = 0);
static void ShowErrorMessage( const QString& errorCode, const QString& comment = QString() );
/* Gets name of object */
static QString GetName(GEOM::GEOM_Object_ptr);
static QString GetName( GEOM::GEOM_Object_ptr object );
static bool IsShape(GEOM::GEOM_Object_ptr theObj);
static bool IsShape( GEOM::GEOM_Object_ptr object );
};
#endif // GEOMBASE_H

View File

@ -1095,23 +1095,17 @@ void GEOMBase_Helper::addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
_PTR(Study) aDStudy = appStudy->studyDS();
GEOM::GEOM_IGroupOperations_var anOp = getGeomEngine()->GetIGroupOperations( getStudyId() );
for( QMap<QString, GEOM::GEOM_Object_var>::Iterator it = theMap.begin(); it != theMap.end(); it++ ) {
if ( !anOp->_is_nil() ) {
GEOM::GEOM_Object_var aFatherObj = anOp->GetMainShape( it.value() );
if ( !aFatherObj->_is_nil() ) {
QString aFatherEntry = getEntry( aFatherObj );
if ( aFatherEntry != "") { // additional checking that object is valid 0020598 EDF 1191
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aFatherObj, it.key().toLatin1().data() );
//Add Object to study if its not exist
if ( aFindedObject->_is_nil() )
GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy),
it.value(), it.key().toLatin1().data(), aFatherObj );
}
GEOM::GEOM_Object_var aFatherObj = it.value()->GetMainShape();
if ( !aFatherObj->_is_nil() ) {
QString aFatherEntry = getEntry( aFatherObj );
if ( aFatherEntry != "") { // additional checking that object is valid 0020598 EDF 1191
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aFatherObj, it.key().toLatin1().data() );
//Add Object to study if its not exist
if ( aFindedObject->_is_nil() )
GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy),
it.value(), it.key().toLatin1().data(), aFatherObj );
}
} else {
//cout << " anOperations is NULL! " << endl;
}
}
}

View File

@ -779,10 +779,9 @@ bool GEOMToolsGUI::Export()
SALOME_ListIteratorOfListIO It( selectedObjects );
for(;It.More();It.Next()) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
Standard_Boolean found;
GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(IObject, found);
GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( IObject );
if ( !found || anObj->_is_nil() )
if ( anObj->_is_nil() )
continue;
QString fileType;

View File

@ -219,10 +219,8 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument()
}
// nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult)
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( CORBA::is_nil( aSelectedObject ) )
return;
if (myEditCurrentArgument == GroupPoints->LineEdit1) {

View File

@ -248,11 +248,10 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
if (aSelList.Extent() < 1)
return;
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
QString aName = GEOMBase::GetName(aSelectedObject);
if (!testResult || aSelectedObject->_is_nil())
if ( aSelectedObject->_is_nil() )
return;
TopoDS_Shape S;

View File

@ -349,10 +349,9 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
return;
}
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || CORBA::is_nil(aSelectedObject))
GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if ( CORBA::is_nil(aSelectedObject) )
return;
QString aName = GEOMBase::GetName(aSelectedObject);
@ -408,11 +407,10 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
return;
}
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
if (!testResult || CORBA::is_nil(aSelectedObject))
if ( CORBA::is_nil(aSelectedObject) )
return;
QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -224,11 +224,10 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
if (aSelList.Extent() < 1)
return;
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
QString aName = GEOMBase::GetName(aSelectedObject);
if (!testResult || aSelectedObject->_is_nil())
if ( aSelectedObject->_is_nil() )
return;
TopoDS_Shape S;