Salome HOME
Improvement: providing wire selection mode for sketch. From now on, wire selection...
authornds <nds@opencascade.com>
Thu, 26 May 2016 12:56:26 +0000 (15:56 +0300)
committernds <nds@opencascade.com>
Thu, 26 May 2016 12:56:26 +0000 (15:56 +0300)
PartSet_Module modification for selection Faces on Sketch is temporary commented.

13 files changed:
src/FeaturesPlugin/extrusion_widget.xml
src/FeaturesPlugin/extrusioncut_widget.xml
src/FeaturesPlugin/extrusionfuse_widget.xml
src/FeaturesPlugin/pipe_widget.xml
src/FeaturesPlugin/revolution_widget.xml
src/FeaturesPlugin/revolutioncut_widget.xml
src/FeaturesPlugin/revolutionfuse_widget.xml
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/ModuleBase/ModuleBase_ResultPrs.h
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_ResultSketchPrs.cpp

index a2ec80b160e22203e66b973dd696b3abbe2c45e3..d52aae72a7bb12ed84d5a2f780ddf5435f295d4c 100644 (file)
@@ -7,13 +7,13 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 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">
     <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
   </sketch_launcher>
   <multi_selector id="base"
                   label="Base objects:"
                   tooltip="Select a base objects"
-                  type_choice="faces objects"
+                  type_choice="wires faces objects"
                   concealment="true">
     <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell"/>
   </multi_selector>
index 833f390ef30332d0e126465473611659c8dc9469..5c0fbb3e24f9750565ac076dfd1ab4018eb64a53 100755 (executable)
@@ -8,14 +8,14 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 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">
       <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
     </sketch_launcher>
     <multi_selector id="base"
       label="Select a sketch face"
       icon="icons/Features/sketch.png"
       tooltip="Select a sketch face"
-      type_choice="Faces Objects">
+      type_choice="wires faces objects">
       <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="face,shell"/>
     </multi_selector>
     <shape_selector id="direction_object"
index 9dfda52f4798ed7e713524d9c9006d057e08577d..daccc15c1f452a410b29264dcb2bfe41aabb619b 100644 (file)
@@ -8,14 +8,14 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 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">
       <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
     </sketch_launcher>
     <multi_selector id="base"
       label="Select a sketch face"
       icon="icons/Features/sketch.png"
       tooltip="Select a sketch face"
-      type_choice="Faces Objects">
+      type_choice="wires faces objects">
       <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell"/>
     </multi_selector>
     <shape_selector id="direction_object"
index dfaa7994541fa9ecd02e9af5d179d92f45b66847..591b9e420a0fa615dfa6e26a10b392225f374956 100644 (file)
@@ -4,7 +4,7 @@
   <multi_selector id="base_objects"
                   label="Base objects:"
                   tooltip="Select a base objects"
-                  type_choice="faces objects"
+                  type_choice="wires faces objects"
                   use_choice="false"
                   concealment="true">
     <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell"/>
index 6a4f020d1dce21a64a8de645daf93603564716c6..9cb27ef7369c464b61fe94819d3c77fa3a7b335b 100644 (file)
@@ -7,13 +7,13 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 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">
     <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
   </sketch_launcher>
   <multi_selector id="base"
                   label="Base objects:"
                   tooltip="Select a base objects"
-                  type_choice="faces objects"
+                  type_choice="wires faces objects"
                   concealment="true">
     <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell"/>
   </multi_selector>
index 25e82fe453c87906dca436e8d5c364ff2629fafd..442fb0d0aa062559737ccb1517fef1102149e2f8 100644 (file)
@@ -8,14 +8,14 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 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">
       <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
     </sketch_launcher>
     <multi_selector id="base"
       label="Select a sketch face"
       icon="icons/Features/sketch.png"
       tooltip="Select a sketch face"
-      type_choice="Faces Objects">
+      type_choice="wires faces objects">
       <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="face,shell"/>
     </multi_selector>
     <shape_selector id="axis_object"
index 633b1ca2a1c8ae0f23c434a5dc9b5e50d98a0029..1a6055aca205263df7e037be158d4e44de67adfa 100644 (file)
@@ -8,14 +8,14 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 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">
       <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
     </sketch_launcher>
     <multi_selector id="base"
       label="Select a sketch face"
       icon="icons/Features/sketch.png"
       tooltip="Select a sketch face"
-      type_choice="Faces Objects">
+      type_choice="wires faces objects">
       <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell"/>
     </multi_selector>
     <shape_selector id="axis_object"
index 310bb78f87cae91d1c6dd9f67bf5d880ae5bb289..4085f399eccbe8f0a7707ec79214d0040cfaa6ec 100755 (executable)
@@ -59,18 +59,6 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
   SetAutoHilight(aCompSolid.get() == NULL);
 }
 
-bool ModuleBase_ResultPrs::isValidShapeType(const TopAbs_ShapeEnum& theBaseType,
-                                            const TopAbs_ShapeEnum& theCheckedType)
-{
-  bool aValid = theBaseType == theCheckedType;
-  if (!aValid) {
-    // currently this functionality is for all, as we have no separate wire selection mode
-    // lately it should be corrected to have the following check only for sketch presentations
-    aValid = theBaseType == TopAbs_FACE && theCheckedType == TopAbs_WIRE;
-  }
-  return aValid;
-}
-
 void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
                                    const Handle(Prs3d_Presentation)& thePresentation, 
                                    const Standard_Integer theMode)
index 7ed3db9ccfd5220c6927fd3517e0c73eeb9a5771..240d64eafd18e2c84a2789d880bdaeafd0e64c3f 100644 (file)
@@ -61,13 +61,6 @@ public:
   /// \param theResult a result object
   Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult);
 
-  /// Returns true if the checked type can be accepted for the base selection type
-  /// It returns true if they are coicide or if the base type is face and the checked type is wire
-  /// @return boolean result
-  static Standard_EXPORT bool isValidShapeType(const TopAbs_ShapeEnum& theBaseType,
-                                               const TopAbs_ShapeEnum& theCheckedType);
-
-
   //! Method which draws selected owners ( for fast presentation draw )
   Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, 
                                                const SelectMgr_SequenceOfOwner& theOwners);
index 822640eac33ff7484bc693686c92d47e9bfdae5c..37e6500b4d58f567de51b101f825e315a57e3f16 100755 (executable)
@@ -312,6 +312,7 @@ TopAbs_ShapeEnum shapeType(const QString& theType)
     MyShapeTypes["vertex"] = TopAbs_VERTEX;
     MyShapeTypes["vertices"] = TopAbs_VERTEX;
     MyShapeTypes["wire"] = TopAbs_WIRE;
+    MyShapeTypes["wires"] = TopAbs_WIRE;
     MyShapeTypes["edge"] = TopAbs_EDGE;
     MyShapeTypes["edges"] = TopAbs_EDGE;
     MyShapeTypes["shell"] = TopAbs_SHELL;
index 2912af30c2f2fd5297482fe2a19ac0e4b69e9531..ce06eb4a63673f628a4fd1cab95b20e5bf4b9160 100755 (executable)
@@ -136,11 +136,6 @@ bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape,
                                 std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(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;
index 1df95bb8a63115fecae382f4728b8fe94dccd3cc..b8b46fb90555be4072ae17092e1e5d3c6fd0e798 100755 (executable)
@@ -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;
 }
index 0715850b9c9764cee537e440f25a88750f9b409d..384741cedf30442e8fa09f3275dde8409bc2beee 100755 (executable)
@@ -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<TopoDS_Shape>::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,