From f3fdd2dc5bb6d6eef3343293a0d7fb2257f464b6 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 15 Jul 2009 08:09:58 +0000 Subject: [PATCH] Merge from V5_1_2_BR branch (14 July 2009) --- doc/salome/gui/GEOM/input/import_export.doc | 5 +- .../input/remove_extra_edges_operation.doc | 4 +- src/BasicGUI/BasicGUI_CurveDlg.cxx | 1 + src/BasicGUI/BasicGUI_EllipseDlg.cxx | 1 + src/BooleanGUI/BooleanGUI_Dialog.cxx | 1 + src/EntityGUI/EntityGUI_SubShapeDlg.cxx | 2 +- src/GEOM/GEOM_Engine.cxx | 41 ++++--- src/GEOM/GEOM_Engine.hxx | 7 +- src/GEOMImpl/GEOMImpl_IShapes.hxx | 2 +- src/GEOMImpl/GEOMImpl_ShapeDriver.cxx | 26 +++-- src/GEOM_SWIG/geompyDC.py | 2 +- .../GenerationGUI_FillingDlg.cxx | 1 + src/GenerationGUI/GenerationGUI_PipeDlg.cxx | 1 + src/GenerationGUI/GenerationGUI_RevolDlg.cxx | 1 + .../OperationGUI_ArchimedeDlg.cxx | 1 + .../OperationGUI_GetShapesOnShapeDlg.cxx | 1 + .../RepairGUI_ChangeOrientationDlg.cxx | 1 + src/RepairGUI/RepairGUI_CloseContourDlg.cxx | 1 + src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx | 104 +++++++++--------- src/RepairGUI/RepairGUI_DivideEdgeDlg.h | 2 +- .../RepairGUI_RemoveExtraEdgesDlg.cxx | 1 + src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx | 1 + src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx | 1 + src/RepairGUI/RepairGUI_SewingDlg.cxx | 1 + src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx | 1 + .../TransformationGUI_MirrorDlg.cxx | 1 + .../TransformationGUI_OffsetDlg.cxx | 1 + .../TransformationGUI_RotationDlg.cxx | 57 ++++++---- 28 files changed, 157 insertions(+), 112 deletions(-) diff --git a/doc/salome/gui/GEOM/input/import_export.doc b/doc/salome/gui/GEOM/input/import_export.doc index cedbe93d6..296c68b22 100644 --- a/doc/salome/gui/GEOM/input/import_export.doc +++ b/doc/salome/gui/GEOM/input/import_export.doc @@ -23,10 +23,9 @@ the module and its contents (geometrical object) will be displayed in the Object Browser. \note If the selected file is in IGES format and the length is not -expressed in meters, it will be sussested to scale the model into the +expressed in meters, it will be suggested to scale the model into the metric system: -y types (solid, face, edge and -vertex) for all named shapes + \image html iges_unit.png \par diff --git a/doc/salome/gui/GEOM/input/remove_extra_edges_operation.doc b/doc/salome/gui/GEOM/input/remove_extra_edges_operation.doc index 401e200c3..4988009e6 100644 --- a/doc/salome/gui/GEOM/input/remove_extra_edges_operation.doc +++ b/doc/salome/gui/GEOM/input/remove_extra_edges_operation.doc @@ -7,8 +7,8 @@ \n This operation removes all seam and degenerated edges from a given shape. Its main purpose is healing of solids and compounds to obtain hexahedral solids and compounds of hexahedral solids. -However, there is an option to unite all faces, sharing one -surface, which allows obaining not only hexahedral solids. +However, there is an option to unite all faces sharing one +surface, which produces not only hexahedral solids. \n TUI Command: geompy.RemoveExtraEdges(theShape,theOptimumNbFaces), where theShape is a compound or a single solid diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index 05a7baf26..0212cdb31 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -129,6 +129,7 @@ void BasicGUI_CurveDlg::Init() SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ; initName( tr( "GEOM_CURVE" ) ); + resize(100,100); ConstructorsClicked( 0 ); } diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index dee60ede9..3faa71277 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -157,6 +157,7 @@ void BasicGUI_EllipseDlg::Init() initName( tr( "GEOM_ELLIPSE" ) ); + resize(100,100); displayPreview(); } diff --git a/src/BooleanGUI/BooleanGUI_Dialog.cxx b/src/BooleanGUI/BooleanGUI_Dialog.cxx index 85e1f1990..7b1e3df5a 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.cxx +++ b/src/BooleanGUI/BooleanGUI_Dialog.cxx @@ -161,6 +161,7 @@ void BooleanGUI_Dialog::Init() myGroup->PushButton1->click(); SelectionIntoArgument(); + resize(100,100); } //================================================================================= diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx index af81a31bb..45e27d2e7 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -143,7 +143,7 @@ void EntityGUI_SubShapeDlg::Init() SIGNAL( currentSelectionChanged( )), this, SLOT( SelectionIntoArgument() ) ); updateButtonState(); - + resize(100,100); SelectionIntoArgument(); } diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index 2ec87cbcf..436287cff 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -18,7 +18,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// + #ifdef WNT #pragma warning( disable:4786 ) #endif @@ -248,17 +248,12 @@ Handle(GEOM_Object) GEOM_Engine::AddObject(int theDocID, int theType) // if this label has been freed (object deleted) bool useExisting = false; TDF_Label aChild; - if (!_lastCleared.IsNull()) { - if (_lastCleared.Root() == aDoc->Main().Root()) { + if (_freeLabels.find(theDocID) != _freeLabels.end()) { + std::list& aFreeLabels = _freeLabels[theDocID]; + if (!aFreeLabels.empty()) { useExisting = true; - aChild = _lastCleared; - // 0020229: if next label exists and is empty, try to reuse it - Standard_Integer aNextTag = aChild.Tag() + 1; - TDF_Label aNextL = aDoc->Main().FindChild(aNextTag, Standard_False); - if (!aNextL.IsNull() && !aNextL.HasAttribute()) - _lastCleared = aNextL; - else - _lastCleared.Nullify(); + aChild = aFreeLabels.front(); + aFreeLabels.pop_front(); } } if (!useExisting) { @@ -294,6 +289,7 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, // if this label has been freed (object deleted) bool useExisting = false; TDF_Label aChild; + /* if (!_lastCleared.IsNull()) { if (_lastCleared.Root() == aDoc->Main().Root()) { useExisting = true; @@ -307,6 +303,16 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, _lastCleared.Nullify(); } } + */ + int aDocID = theMainShape->GetDocID(); + if (_freeLabels.find(aDocID) != _freeLabels.end()) { + std::list& aFreeLabels = _freeLabels[aDocID]; + if (!aFreeLabels.empty()) { + useExisting = true; + aChild = aFreeLabels.front(); + aFreeLabels.pop_front(); + } + } if (!useExisting) { // create new label aChild = TDF_TagSource::NewChild(aDoc->Main()); @@ -366,6 +372,8 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_Object) theObject) { if (!theObject) return false; + int aDocID = theObject->GetDocID(); + //Remove an object from the map of available objects TCollection_AsciiString anID = BuildIDFromObject(theObject); if (_objects.IsBound(anID)) _objects.UnBind(anID); @@ -380,7 +388,10 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_Object) theObject) TDF_Label aLabel = theObject->GetEntry(); aLabel.ForgetAllAttributes(Standard_True); - _lastCleared = aLabel; + + // Remember the label to reuse it then + std::list& aFreeLabels = _freeLabels[aDocID]; + aFreeLabels.push_back(aLabel); theObject.Nullify(); @@ -464,7 +475,11 @@ void GEOM_Engine::Close(int theDocID) } for (Standard_Integer i=1; i<=aSeq.Length(); i++) _objects.UnBind(aSeq.Value(i)); - _lastCleared.Nullify(); + // Forget free labels for this document + TFreeLabelsList::iterator anIt = _freeLabels.find(theDocID); + if (anIt != _freeLabels.end()) { + _freeLabels.erase(anIt); + } _mapIDDocument.UnBind(theDocID); _OCAFApp->Close(aDoc); diff --git a/src/GEOM/GEOM_Engine.hxx b/src/GEOM/GEOM_Engine.hxx index 5a45bdc93..c901123b6 100644 --- a/src/GEOM/GEOM_Engine.hxx +++ b/src/GEOM/GEOM_Engine.hxx @@ -18,7 +18,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// + #ifndef _GEOM_Engine_HXX_ #define _GEOM_Engine_HXX_ @@ -34,6 +34,7 @@ #include #include +#include #include struct TVariable{ @@ -67,6 +68,8 @@ private: typedef std::map TVariablesList; +typedef std::map > TFreeLabelsList; + class GEOM_Engine { public: @@ -139,7 +142,7 @@ class GEOM_Engine Resource_DataMapOfAsciiStringAsciiString _studyEntry2NameMap; - TDF_Label _lastCleared; + TFreeLabelsList _freeLabels; }; #endif diff --git a/src/GEOMImpl/GEOMImpl_IShapes.hxx b/src/GEOMImpl/GEOMImpl_IShapes.hxx index e0827f4ea..504dbd315 100644 --- a/src/GEOMImpl/GEOMImpl_IShapes.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapes.hxx @@ -72,7 +72,7 @@ class GEOMImpl_IShapes void SetTolerance(const Standard_Real theValue) { _func->SetReal(SHAPE_ARG_TOLERANCE, theValue); } - Standard_Integer GetTolerance() { return _func->GetReal(SHAPE_ARG_TOLERANCE); } + Standard_Real GetTolerance() { return _func->GetReal(SHAPE_ARG_TOLERANCE); } private: diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx index 1165007ea..ca0f348ed 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -168,20 +168,22 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const if (aFW->StatusConnected(ShapeExtend_FAIL)) { Standard_ConstructionError::Raise("Wire construction failed: cannot build connected wire"); } - // IMP 0019766 - aFW->FixGapsByRangesMode() = Standard_True; - if (aFW->FixGaps3d()) { - Handle(ShapeExtend_WireData) sbwd = aFW->WireData(); - Handle(ShapeFix_Edge) aFe = new ShapeFix_Edge; - for (Standard_Integer iedge = 1; iedge <= sbwd->NbEdges(); iedge++) { - TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(iedge)); - aFe->FixVertexTolerance(aEdge); - aFe->FixSameParameter(aEdge); + if (aFW->StatusConnected(ShapeExtend_DONE3)) { + // Confused with but not Analyzer.Precision(), set the same + aFW->FixGapsByRangesMode() = Standard_True; + if (aFW->FixGaps3d()) { + Handle(ShapeExtend_WireData) sbwd = aFW->WireData(); + Handle(ShapeFix_Edge) aFe = new ShapeFix_Edge; + for (Standard_Integer iedge = 1; iedge <= sbwd->NbEdges(); iedge++) { + TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(iedge)); + aFe->FixVertexTolerance(aEdge); + aFe->FixSameParameter(aEdge); + } + } + else if (aFW->StatusGaps3d(ShapeExtend_FAIL)) { + Standard_ConstructionError::Raise("Wire construction failed: cannot fix 3d gaps"); } - } - else if (aFW->StatusGaps3d(ShapeExtend_FAIL)) { - Standard_ConstructionError::Raise("Wire construction failed: cannot fix 3d gaps"); } aShape = aFW->WireAPIMake(); diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 3cf6cabc6..e6e7b8dd2 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -407,7 +407,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create a tangent plane, corresponding to the given parameter on the given face. # @param theFace The face for which tangent plane should be built. # @param theParameterV vertical value of the center point (0.0 - 1.0). - # @param theParameterU horisontal value of the center point (0.0 - 1.0). + # @param theParameterU horisontal value of the center point (0.0 - 1.0). # @param theTrimSize the size of plane. # @return New GEOM_Object, containing the created tangent. # diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index 4f46e1962..986f62864 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -149,6 +149,7 @@ void GenerationGUI_FillingDlg::Init() SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_FILLING" ) ); + resize(100,100); } //================================================================================= diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index e560176dc..78d7abfce 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -135,6 +135,7 @@ void GenerationGUI_PipeDlg::Init() connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked())); initName(tr("GEOM_PIPE")); + resize(100,100); GroupPoints->TextLabel3->hide(); GroupPoints->PushButton3->hide(); diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 2a5d00b43..99d8ba14e 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -138,6 +138,7 @@ void GenerationGUI_RevolDlg::Init() connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); initName(tr("GEOM_REVOLUTION")); + resize(100,100); GroupPoints->PushButton1->click(); SelectionIntoArgument(); diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx index fdf1778e3..96840b012 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -130,6 +130,7 @@ void OperationGUI_ArchimedeDlg::Init() globalSelection( GEOM_ALLSHAPES ); SelectionIntoArgument(); + resize(100,100); } diff --git a/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx b/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx index 778af7b67..70e011f7a 100644 --- a/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx +++ b/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx @@ -144,6 +144,7 @@ void OperationGUI_GetShapesOnShapeDlg::Init() GroupPoints->PushButton1->click(); SelectionIntoArgument(); + resize(100,100); } //================================================================================= diff --git a/src/RepairGUI/RepairGUI_ChangeOrientationDlg.cxx b/src/RepairGUI/RepairGUI_ChangeOrientationDlg.cxx index 485127b1f..4d6e6aeef 100644 --- a/src/RepairGUI/RepairGUI_ChangeOrientationDlg.cxx +++ b/src/RepairGUI/RepairGUI_ChangeOrientationDlg.cxx @@ -116,6 +116,7 @@ void RepairGUI_ChangeOrientationDlg::Init() SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "CHANGE_ORIENTATION_NEW_OBJ_NAME" ) ); + resize(100,100); } diff --git a/src/RepairGUI/RepairGUI_CloseContourDlg.cxx b/src/RepairGUI/RepairGUI_CloseContourDlg.cxx index 85705502f..a65cd69f7 100644 --- a/src/RepairGUI/RepairGUI_CloseContourDlg.cxx +++ b/src/RepairGUI/RepairGUI_CloseContourDlg.cxx @@ -133,6 +133,7 @@ void RepairGUI_CloseContourDlg::Init() GroupPoints->PushButton1->click(); SelectionIntoArgument(); + resize(100,100); } //================================================================================= diff --git a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx index e70168621..2f3d7a582 100644 --- a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx @@ -41,8 +41,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -124,6 +126,7 @@ void RepairGUI_DivideEdgeDlg::Init() myEditCurrentArgument = GroupPoints->LineEdit1; myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; //myGeomGUI->SetState( 0 ); initSelection(); @@ -141,6 +144,7 @@ void RepairGUI_DivideEdgeDlg::Init() SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "DEVIDE_EDGE_NEW_OBJECT_NAME" ) ); + resize(100,100); } //================================================================================= @@ -163,20 +167,26 @@ void RepairGUI_DivideEdgeDlg::displayPreview() TopoDS_Shape aShape; gp_Pnt aPnt; - if ( GEOMBase::GetShape( myObject, aShape, TopAbs_SHAPE ) ) { - if (aShape.ShapeType() == TopAbs_EDGE) { - Standard_Real aFP, aLP, aP; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aShape), aFP, aLP); - aP = aFP + (aLP - aFP) * myValEdt->value(); - aPnt = aCurve->Value(aP); - BRepBuilderAPI_MakeVertex mkVertex (aPnt); - aShape = mkVertex.Shape(); - // Build prs - SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aShape ); - if ( aPrs != 0 && !aPrs->IsNull() ) - GEOMBase_Helper::displayPreview( aPrs, false, true ); - } + GEOMBase::GetShape( myObject, aShape, TopAbs_SHAPE ); + + if ( myIndex != -1) { + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes(aShape, aShapes); + aShape = aShapes.FindKey(myIndex); } + + if (aShape.ShapeType() == TopAbs_EDGE) { + Standard_Real aFP, aLP, aP; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aShape), aFP, aLP); + aP = aFP + (aLP - aFP) * myValEdt->value(); + aPnt = aCurve->Value(aP); + BRepBuilderAPI_MakeVertex mkVertex (aPnt); + aShape = mkVertex.Shape(); + // Build prs + SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aShape ); + if ( aPrs != 0 && !aPrs->IsNull() ) + GEOMBase_Helper::displayPreview( aPrs, false, true ); + } } //================================================================================= @@ -203,6 +213,7 @@ bool RepairGUI_DivideEdgeDlg::ClickOnApply() myEditCurrentArgument->setText( "" ); myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; initSelection(); @@ -220,6 +231,7 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument() myEditCurrentArgument->setText( "" ); myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; @@ -228,46 +240,45 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument() if ( aSelList.Extent() == 1 ) { Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Standard_Boolean aRes; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - QString aName = GEOMBase::GetName( aSelectedObject ); + GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + if ( !CORBA::is_nil( aSelectedObj ) && aRes ) + { TopoDS_Shape aShape; - if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) ) { + QString aName = GEOMBase::GetName( aSelectedObj ); + if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) + { const int aType = aShape.ShapeType(); - if ( aType <= TopAbs_EDGE ) { - // edge, wire, face, shell, solid, compound + if ( aType <= TopAbs_EDGE ) // edge, wire, face, shell, solid, compound + { GEOM::short_array anIndexes; TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes( anIO, aMap ); - - if ( aMap.Extent() == 1 ) { // local selection - int anIndex = aMap( 1 ); - myEditCurrentArgument->setText( aName += QString( ":edge_%1" ).arg( anIndex ) ); - - //Find SubShape Object in Father - GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName ); - if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study - GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - myObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); - } - else { - myObject = aFindedObject; // get Object from study - } + SalomeApp_Application* anApp = + (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); + anApp->selectionMgr()->GetIndexes( anIO, aMap ); + + if ( !aMap.IsEmpty() ) // subshape selection + { + myIndex = aMap( 1 ); + myObject = aSelectedObj; + myEditCurrentArgument->setText( aName += QString( ":edge_%1" ).arg( myIndex ) ); } - else if ( aType == TopAbs_EDGE ) { - // single shape selection - myObject = aSelectedObject; + else if ( aType == TopAbs_EDGE ) // single shape selection + { + myIndex = -1; + myObject = aSelectedObj; myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); } - else { - // face, shell, solid or compound was selected, and NOT its subshape. + else // face, shell, solid or compound was selected, and NOT its subshape. + { + myIndex = -1; myObject = GEOM::GEOM_Object::_nil(); } } } } } + displayPreview(); } @@ -309,6 +320,7 @@ void RepairGUI_DivideEdgeDlg::ActivateThisDialog() SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); // myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; //myGeomGUI->SetState( 0 ); initSelection(); @@ -351,7 +363,7 @@ bool RepairGUI_DivideEdgeDlg::isValid( QString& msg ) bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->DivideEdge - ( myObject, -1, myValEdt->value(), getIsByParameter() ); + ( myObject, myIndex, myValEdt->value(), getIsByParameter() ); bool aResult = !anObj->_is_nil(); if ( aResult ) { @@ -387,15 +399,3 @@ void RepairGUI_DivideEdgeDlg::initSelection() GEOM::GEOM_Object_var aNullGeomObject; localSelection( aNullGeomObject, TopAbs_EDGE ); // load local selection on ALL objects } - -//================================================================================= -// function : addSubshapeToStudy -// purpose : virtual method to add new SubObjects if local selection -//================================================================================= -void RepairGUI_DivideEdgeDlg::addSubshapesToStudy() -{ - QMap objMap; - objMap[GroupPoints->LineEdit1->text()] = myObject; - - addSubshapesToFather( objMap ); -} diff --git a/src/RepairGUI/RepairGUI_DivideEdgeDlg.h b/src/RepairGUI/RepairGUI_DivideEdgeDlg.h index d7ceed40e..d2a71bf35 100644 --- a/src/RepairGUI/RepairGUI_DivideEdgeDlg.h +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.h @@ -49,7 +49,6 @@ protected: virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool isValid( QString& ); virtual bool execute( ObjectList& ); - virtual void addSubshapesToStudy(); private: void Init(); @@ -57,6 +56,7 @@ private: void initSelection(); bool getIsByParameter() const; + int myIndex; private: GEOM::GEOM_Object_var myObject; diff --git a/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.cxx b/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.cxx index 8d7be6e72..25fceb12f 100644 --- a/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.cxx +++ b/src/RepairGUI/RepairGUI_RemoveExtraEdgesDlg.cxx @@ -121,6 +121,7 @@ void RepairGUI_RemoveExtraEdgesDlg::Init() this, SLOT( SelectionIntoArgument() ) ); initName( tr( "REMOVE_EXTRA_EDGES_NEW_OBJ_NAME" ) ); + resize(100,100); } diff --git a/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx b/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx index 3ef74ca4a..cc90a25cd 100644 --- a/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx +++ b/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx @@ -134,6 +134,7 @@ void RepairGUI_RemoveHolesDlg::Init() GroupPoints->PushButton1->click(); SelectionIntoArgument(); + resize(100,100); } //================================================================================= diff --git a/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx index 8079b166d..90b89b872 100644 --- a/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx +++ b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx @@ -122,6 +122,7 @@ void RepairGUI_RemoveIntWiresDlg::Init() GroupPoints->PushButton1->click(); SelectionIntoArgument(); + resize(100,100); } //================================================================================= diff --git a/src/RepairGUI/RepairGUI_SewingDlg.cxx b/src/RepairGUI/RepairGUI_SewingDlg.cxx index a5d6465d9..a709997e5 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.cxx +++ b/src/RepairGUI/RepairGUI_SewingDlg.cxx @@ -134,6 +134,7 @@ void RepairGUI_SewingDlg::Init() connect( myFreeBoundBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) ); initName( tr( "SEWING_NEW_OBJ_NAME" ) ); + resize(100,100); } diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx index 7daaab8e1..6149e963f 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx @@ -118,6 +118,7 @@ void RepairGUI_SuppressFacesDlg::Init() SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "SUPRESS_FACE_NEW_OBJ_NAME" ) ); + resize(100,100); } diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index 4e3abf683..772755da5 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -139,6 +139,7 @@ void TransformationGUI_MirrorDlg::Init() initName(tr("GEOM_MIRROR")); ConstructorsClicked(0); + resize(0,0); } //================================================================================= diff --git a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx index f548ca48e..df5a0dd1e 100644 --- a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx @@ -128,6 +128,7 @@ void TransformationGUI_OffsetDlg::Init() initName( tr( "GEOM_OFFSET" ) ); globalSelection( GEOM_ALLSHAPES ); + resize(100,100); } diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index c56fd9c9b..7171cb4ae 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -263,6 +263,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); + GEOM::GEOM_Object_var aSelectedObject; QString aName; @@ -274,8 +275,6 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects); if (!myObjects.length()) return; - else - myEditCurrentArgument->setText(aName); } else { if (aSelList.Extent() != 1) @@ -283,7 +282,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); if (!testResult || CORBA::is_nil(aSelectedObject)) return; @@ -328,30 +327,36 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() } } } + } + + myEditCurrentArgument->setText(aName); - myEditCurrentArgument->setText(aName); - - if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) { - myAxis = aSelectedObject; - if (!myAxis->_is_nil() && !myObjects.length()) - GroupPoints->PushButton1->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) { - myCentPoint = aSelectedObject; - if (!myCentPoint->_is_nil() && myPoint1->_is_nil()) - GroupPoints->PushButton4->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit4) { - myPoint1 = aSelectedObject; - if (!myPoint1->_is_nil() && myPoint2->_is_nil()) - GroupPoints->PushButton5->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit5) { - myPoint2 = aSelectedObject; - if (!myPoint2->_is_nil() && !myObjects.length()) - GroupPoints->PushButton1->click(); + if (myEditCurrentArgument == GroupPoints->LineEdit1) { + if (myObjects.length()) { + if (getConstructorId() == 0 && myAxis->_is_nil() || getConstructorId() == 1 && myCentPoint->_is_nil() ) + GroupPoints->PushButton2->click(); } } + else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) { + myAxis = aSelectedObject; + if (!myAxis->_is_nil() && !myObjects.length()) + GroupPoints->PushButton1->click(); + } + else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) { + myCentPoint = aSelectedObject; + if (!myCentPoint->_is_nil() && myPoint1->_is_nil()) + GroupPoints->PushButton4->click(); + } + else if (myEditCurrentArgument == GroupPoints->LineEdit4) { + myPoint1 = aSelectedObject; + if (!myPoint1->_is_nil() && myPoint2->_is_nil()) + GroupPoints->PushButton5->click(); + } + else if (myEditCurrentArgument == GroupPoints->LineEdit5) { + myPoint2 = aSelectedObject; + if (!myPoint2->_is_nil() && !myObjects.length()) + GroupPoints->PushButton1->click(); + } // clear selection disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); @@ -377,7 +382,11 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->PushButton2->setDown(false); + GroupPoints->PushButton4->setDown(false); + GroupPoints->PushButton5->setDown(false); GroupPoints->LineEdit2->setEnabled(false); + GroupPoints->LineEdit4->setEnabled(false); + GroupPoints->LineEdit5->setEnabled(false); } else if (send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; -- 2.39.2