From: nds Date: Thu, 26 May 2016 12:56:26 +0000 (+0300) Subject: Improvement: providing wire selection mode for sketch. From now on, wire selection... X-Git-Tag: V_2.3.1~50 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=80ed41cda3ee151700a2be67a9d7b0ff5bee051d;p=modules%2Fshaper.git Improvement: providing wire selection mode for sketch. From now on, wire selection mode(defined in XML) switches wire selection of sketch. PartSet_Module modification for selection Faces on Sketch is temporary commented. --- diff --git a/src/FeaturesPlugin/extrusion_widget.xml b/src/FeaturesPlugin/extrusion_widget.xml index a2ec80b16..d52aae72a 100644 --- a/src/FeaturesPlugin/extrusion_widget.xml +++ b/src/FeaturesPlugin/extrusion_widget.xml @@ -7,13 +7,13 @@ 1. Planar face of non-sketch object or a plane. Sketch creation will be started.<br /> 2. An existing sketch face or contour. Extrusion will be filled by it.<br /> 3. An existing result shape of kind: wires/edge/vertices.Extrusion will be filled by it." - shape_types="faces objects"> + shape_types="wires faces objects"> diff --git a/src/FeaturesPlugin/extrusioncut_widget.xml b/src/FeaturesPlugin/extrusioncut_widget.xml index 833f390ef..5c0fbb3e2 100755 --- a/src/FeaturesPlugin/extrusioncut_widget.xml +++ b/src/FeaturesPlugin/extrusioncut_widget.xml @@ -8,14 +8,14 @@ 1. Planar face of non-sketch object or a plane. Sketch creation will be started.<br /> 2. An existing sketch face or contour. Extrusion will be filled by it.<br /> 3. An existing result shape of kind: wires/edge/vertices.Extrusion will be filled by it." - shape_types="face objects"> + shape_types="wires faces objects"> + type_choice="wires faces objects"> + shape_types="wires faces objects"> + type_choice="wires faces objects"> diff --git a/src/FeaturesPlugin/revolution_widget.xml b/src/FeaturesPlugin/revolution_widget.xml index 6a4f020d1..9cb27ef73 100644 --- a/src/FeaturesPlugin/revolution_widget.xml +++ b/src/FeaturesPlugin/revolution_widget.xml @@ -7,13 +7,13 @@ 1. Planar face of non-sketch object or a plane. Sketch creation will be started.<br /> 2. An existing sketch face or contour. Extrusion will be filled by it.<br /> 3. An existing result shape of kind: wires/edge/vertices.Extrusion will be filled by it." - shape_types="faces objects"> + shape_types="wires faces objects"> diff --git a/src/FeaturesPlugin/revolutioncut_widget.xml b/src/FeaturesPlugin/revolutioncut_widget.xml index 25e82fe45..442fb0d0a 100644 --- a/src/FeaturesPlugin/revolutioncut_widget.xml +++ b/src/FeaturesPlugin/revolutioncut_widget.xml @@ -8,14 +8,14 @@ 1. Planar face of non-sketch object or a plane. Sketch creation will be started.<br /> 2. An existing sketch face or contour. Extrusion will be filled by it.<br /> 3. An existing result shape of kind: wires/edge/vertices.Extrusion will be filled by it." - shape_types="face objects"> + shape_types="wires face objects"> + type_choice="wires faces objects"> + shape_types="wires face objects"> + type_choice="wires faces objects"> (theResult); aValid = aCResult.get() && aCResult->facesNum() > 0; } - if (!aValid) { - // the compared shape types are not equal but presentation might allow some type for another - // exactly it allow Wire type of the shape for Face XML shape type - aValid = ModuleBase_ResultPrs::isValidShapeType(aCurrentShapeType, aShapeType); - } } } return aValid; diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 1df95bb8a..b8b46fb90 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1326,7 +1326,7 @@ void PartSet_Module::setDefaultConstraintShown() //****************************************************** bool PartSet_Module::canActivateSelectionMode(const Handle(AIS_InteractiveObject)& theIO, int theMode) const { - if (theMode == TopAbs_FACE) { + /*if (theMode == TopAbs_FACE) { Handle(PartSet_ResultSketchPrs) aSketchPrs = Handle(PartSet_ResultSketchPrs)::DownCast(theIO); if (!aSketchPrs.IsNull()) { ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); @@ -1344,7 +1344,7 @@ bool PartSet_Module::canActivateSelectionMode(const Handle(AIS_InteractiveObject } else return false; } - } + }*/ return true; } @@ -1352,8 +1352,8 @@ bool PartSet_Module::canActivateSelectionMode(const Handle(AIS_InteractiveObject bool PartSet_Module::needDeactivateSelectionMode(const Handle(AIS_InteractiveObject)& theIO, int theMode) const { if (theMode == TopAbs_FACE) { - Handle(PartSet_ResultSketchPrs) aSketchPrs = Handle(PartSet_ResultSketchPrs)::DownCast(theIO); - return !aSketchPrs.IsNull(); + // Handle(PartSet_ResultSketchPrs) aSketchPrs = Handle(PartSet_ResultSketchPrs)::DownCast(theIO); + // return !aSketchPrs.IsNull(); } return false; } diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index 0715850b9..384741ced 100755 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -126,7 +126,9 @@ void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection) // In order to avoid using custom selection modes return; - if (aMode == AIS_Shape::SelectionMode(TopAbs_FACE)) { + bool aShapeIsChanged = false; + if (aMode == AIS_Shape::SelectionMode(TopAbs_FACE) || + aMode == AIS_Shape::SelectionMode(TopAbs_WIRE)) { #ifdef DEBUG_WIRE const TopoDS_Shape& aShape = Shape(); debugInfo(aShape, TopAbs_VERTEX); // 24 @@ -142,9 +144,6 @@ void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection) for(NCollection_List::Iterator anIt(mySketchFaceList); anIt.More(); anIt.Next()) { const TopoDS_Shape& aFace = anIt.Value(); aBuilder.Add(aComp, aFace); - // for sketch presentation in the face mode wires should be selectable also - // accoring to #1343 Improvement of Extrusion and Revolution operations - appendShapeSelection(aSelection, aFace, TopAbs_WIRE); } #ifdef DEBUG_WIRE debugInfo(aComp, TopAbs_VERTEX); // 24 @@ -153,18 +152,23 @@ void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection) debugInfo(aComp, TopAbs_FACE); // 2 #endif Set(aComp); - } else + aShapeIsChanged = true; + } + else Set(myOriginalShape); // append auxiliary compound to selection of edges/vertices if (aMode == AIS_Shape::SelectionMode(TopAbs_EDGE) || aMode == AIS_Shape::SelectionMode(TopAbs_VERTEX)) { - bool isVertex = aMode == AIS_Shape::SelectionMode(TopAbs_VERTEX); + bool isVertex = aMode == AIS_Shape::SelectionMode(TopAbs_VERTEX); appendShapeSelection(aSelection, myAuxiliaryCompound, isVertex ? TopAbs_VERTEX : TopAbs_EDGE); } AIS_Shape::ComputeSelection(aSelection, aMode); + + if (aShapeIsChanged) + Set(myOriginalShape); } void PartSet_ResultSketchPrs::appendShapeSelection(const Handle(SelectMgr_Selection)& theSelection,