]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Selection correction for "objects" type defined in XML. It is not possible to use...
authornds <nds@opencascade.com>
Wed, 22 Jun 2016 14:54:44 +0000 (17:54 +0300)
committernds <nds@opencascade.com>
Wed, 22 Jun 2016 15:00:49 +0000 (18:00 +0300)
26 files changed:
src/BuildPlugin/edge_widget.xml
src/BuildPlugin/face_widget.xml
src/BuildPlugin/vertex_widget.xml
src/BuildPlugin/wire_widget.xml
src/ExchangePlugin/plugin-Exchange.xml [changed mode: 0644->0755]
src/FeaturesPlugin/boolean_widget.xml
src/FeaturesPlugin/extrusion_widget.xml
src/FeaturesPlugin/extrusioncut_widget.xml
src/FeaturesPlugin/extrusionfuse_widget.xml
src/FeaturesPlugin/group_widget.xml
src/FeaturesPlugin/intersection_widget.xml
src/FeaturesPlugin/pipe_widget.xml
src/FeaturesPlugin/placement_widget.xml
src/FeaturesPlugin/revolution_widget.xml
src/FeaturesPlugin/revolutioncut_widget.xml
src/FeaturesPlugin/revolutionfuse_widget.xml
src/FeaturesPlugin/rotation_widget.xml
src/FeaturesPlugin/translation_widget.xml
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/ModuleBase/ModuleBase_ResultPrs.h
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_Tools.h
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/XGUI/XGUI_Displayer.cpp

index 6890eae4d997a92a84193053942847becf84209c..196c252aab7299db27b0821d97ec83128c220da4 100644 (file)
@@ -4,7 +4,7 @@
   <multi_selector id="base_objects"
                   label="Edges:"
                   tooltip="Select edges on sketch or edges objects."
-                  type_choice="edges objects"
+                  type_choice="edges"
                   concealment="true">
     <validator id="BuildPlugin_ValidatorBaseForBuild" parameters="edge"/>
   </multi_selector>
index 49ea6b4cc95c58810c33ca571e1fdbb2461c5885..9502ee731d79408251abea8beacc6a0a80615ebf 100644 (file)
@@ -4,7 +4,7 @@
   <multi_selector id="base_objects"
                   label="Segments and wires:"
                   tooltip="Select edges on sketch, edges or wires objects."
-                  type_choice="edges objects"
+                  type_choice="edges wires"
                   concealment="true">
     <validator id="BuildPlugin_ValidatorBaseForBuild" parameters="edge,wire"/>
   </multi_selector>
index 372da411cc36515925ddf563bcf283e39726ce74..5b4df6673d104de3bb9b8f9dde9ffac2a9fa6d23 100644 (file)
@@ -4,7 +4,7 @@
   <multi_selector id="base_objects"
                   label="Vertices:"
                   tooltip="Select vertices on sketch or vertex objects."
-                  type_choice="vertices objects"
+                  type_choice="vertices"
                   concealment="true">
     <validator id="BuildPlugin_ValidatorBaseForBuild" parameters="vertex"/>
   </multi_selector>
index e2c99d561ef73e312319c6a688486903a257082c..b085c21758cb86209539459b85b1c9bc8370bca7 100644 (file)
@@ -4,7 +4,7 @@
   <multi_selector id="base_objects"
                   label="Segments and wires:"
                   tooltip="Select edges on sketch, edges or wires objects."
-                  type_choice="edges objects"
+                  type_choice="edges wires"
                   concealment="true">
     <validator id="BuildPlugin_ValidatorBaseForBuild" parameters="edge,wire"/>
   </multi_selector>
old mode 100644 (file)
new mode 100755 (executable)
index f75602c..9555ff2
@@ -5,12 +5,18 @@
     <group id="Exchange">
       <feature id="Import" title="Import" tooltip="Import a file" icon="icons/Exchange/import.png" document="Part">
         <file_selector id="file_path" title="Import file" path="">
-          <validator id="ExchangePlugin_ImportFormat" parameters="BREP|BRP:BREP,STEP|STP:STEP,IGES|IGS:IGES,XAO:XAO" />
+          <validator id="ExchangePlugin_ImportFormat" parameters="BREP|BRP:BREP,STEP|STP:STEP,IGES|IGS:IGES" />
         </file_selector>
       </feature>
       <feature id="Export" title="Export" tooltip="Export to file" icon="icons/Exchange/export.png">
-        <source path="export_widget.xml" />
+        <export_file_selector id="file_path" type="save" title="Export file" path="">
+          <validator id="ExchangePlugin_ExportFormat" parameters="BREP|BRP:BREP,STEP|STP:STEP,IGES|IGS:IGES-5.1,IGES|IGS:IGES-5.3" />
+        </export_file_selector>
+        <multi_selector id="selection_list" tooltip="Select a set of objects"
+                        type_choice="Vertices Edges Faces Solids Objects" use_choice="true">
+          <validator id="GeomValidators_Finite"/>
+        </multi_selector>
       </feature>
     </group>
   </workbench>
-</plugin>
+</plugin>
\ No newline at end of file
index d24a8af36658b9c617520799a085a75c436e4275..7c5e30ad131bb73c95b837d551a70b274ee250c1 100644 (file)
@@ -15,7 +15,7 @@
     label="Main objects"
     icon=""
     tooltip="Select solid objects"
-    type_choice="Solids Objects"
+    type_choice="solids edges faces"
     use_choice="false"
     concealment="true">
     <validator id="PartSet_DifferentObjects"/>
@@ -25,7 +25,7 @@
     label="Tool objects"
     icon=""
     tooltip="Select a tool solid"
-    type_choice="Solids Objects"
+    type_choice="solids edges faces"
     use_choice="false"
     concealment="true" >
     <validator id="PartSet_DifferentObjects"/>
index c63fccc242d290565a5dd92fa757ec692ddadf19..25a388dffb92d64cedcd05360f487b82eb82a568 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="wires faces objects">
+                   shape_types="vertices edges wires faces shells solids compsolids compounds">
     <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
   </sketch_launcher>
   <multi_selector id="base"
                   label="Base objects:"
                   tooltip="Select a base objects"
-                  type_choice="wires faces objects"
+                  type_choice="vertices edges wires faces shells compounds"
                   concealment="true">
     <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
   </multi_selector>
index 02a201527ffa91f9c9aa71a2a308f2fe19139d16..cdc7fb4b9ee8ed794ca7f32f2eabe7f054b86485 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="wires faces objects">
+      shape_types="wires faces shells">
       <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="wires faces objects">
+      type_choice="wires faces shells">
       <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="face,shell"/>
     </multi_selector>
     <shape_selector id="direction_object"
index 728e9edc8af1748d8856641e095e807bb1cd58f9..96a843907cc5b796ec6b7c4fd4da281a3e058d22 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="wires faces objects">
+      shape_types="vertices edges wires faces shells compounds">
       <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="wires faces objects">
+      type_choice="vertices edges wires faces shells compounds">
       <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
     </multi_selector>
     <shape_selector id="direction_object"
index 6192e9826a17fda234fa6215031f7084cba65d5a..076b6ba41fa017082c9bd5c72bf0893c14eeee67 100644 (file)
@@ -3,7 +3,7 @@
 <source>
   <multi_selector id="group_list"
     tooltip="Select a set of objects"
-    type_choice="Vertices Edges Faces Solids"
+    type_choice="vertices edges faces solids"
     use_choice="true"
     clear_in_neutral_point="false">
     <validator id="GeomValidators_BodyShapes"/>
index cc8653d3fb2f294c32532d28a10c4b616843b2f8..e0ecd069e910c72c76628bd2c739cdcc020c4f4d 100644 (file)
@@ -4,8 +4,8 @@
   <multi_selector id="main_objects"
     label="Main objects"
     icon="icons/Features/cut_shape.png"
-    tooltip="Select objects(objects, compsoilds, solids, shells, faces or edges)"
-    type_choice="Solids Objects"
+    tooltip="Select objects(compounds, compsolids, solids, shells, faces or edges)"
+    type_choice="edges faces shells solids compsolids compounds"
     use_choice="false"
     concealment="true">
     <validator id="PartSet_DifferentObjects"/>
@@ -14,8 +14,8 @@
   <multi_selector id="tool_objects"
     label="Tool objects"
     icon="icons/Features/cut_tool.png"
-    tooltip="Select tools(objects, compsoilds, solids, shells, faces or edges)"
-    type_choice="Solids Objects"
+    tooltip="Select tools(compounds, compsolids, solids, shells, faces or edges)"
+    type_choice="edges faces shells solids compsolids compounds"
     use_choice="false"
     concealment="true">
     <validator id="PartSet_DifferentObjects"/>
index 53165ae7c8c01b1b0ea4fbe2dcbb5e7413f3d209..f2807b069e7f6e211782f7b2e2ecec25c6649a7e 100644 (file)
@@ -4,7 +4,7 @@
   <multi_selector id="base_objects"
                   label="Base objects:"
                   tooltip="Select a base objects"
-                  type_choice="wires faces objects"
+                  type_choice="vertices edges wires faces shells compsolids"
                   use_choice="false"
                   concealment="true">
     <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
index 482e8580317c84b9ce3a25731dae4b0e10a9089a..784026359f1d9aa20ec9dad42b8afe7217f0bdf5 100644 (file)
@@ -5,7 +5,7 @@
     label="Select objects to move"
     icon="icons/Features/cut_shape.png"
     tooltip="Select solid objects"
-    type_choice="solids objects"
+    type_choice="objects"
     concealment="true" >
     <validator id="FeaturesPlugin_ValidatorTransform"/>
   </multi_selector>
index fe52d714f061c15b3846f11db73cb86bc1b4e916..db35c6ee28ca882f57d96871b964c66fbcd7e376 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="wires faces objects">
+                   shape_types="vertices edges wires faces shells compounds">
     <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
   </sketch_launcher>
   <multi_selector id="base"
                   label="Base objects:"
                   tooltip="Select a base objects"
-                  type_choice="wires faces objects"
+                  type_choice="vertices edges wires faces shells compounds"
                   concealment="true">
     <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
   </multi_selector>
index 442fb0d0aa062559737ccb1517fef1102149e2f8..10482c12f08fd0eefc022bcd3ae817cbe6c2db47 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="wires face objects">
+      shape_types="wires faces shells">
       <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="wires faces objects">
+      type_choice="wires faces shells">
       <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="face,shell"/>
     </multi_selector>
     <shape_selector id="axis_object"
index 614db45418456722c9cdee7a0d4ae634ef57166b..7e36ba71ffd47e166228dd132d2f835501a252b9 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="wires face objects">
+      shape_types="vertices edges wires faces shells compounds">
       <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="wires faces objects">
+      type_choice="vertices edges wires faces shells compounds">
       <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
     </multi_selector>
     <shape_selector id="axis_object"
index 1a2fe1c9a97ba9424a75beec51dea91fba4230d0..a5eddcf7f0cf1032f2c600e351a3da158dfa09ea 100755 (executable)
@@ -5,7 +5,7 @@
     label="Main objects"
     icon="icons/Features/cut_shape.png"
     tooltip="Select solid objects"
-    type_choice="solids objects"
+    type_choice="objects"
     concealment="true">
     <validator id="FeaturesPlugin_ValidatorTransform"/>
   </multi_selector>
index 5164fb758d181dfe9bd1fa11dc9fcef5aefd0805..63930e29efcbe008f2e6b8f1173421e301ddf5f8 100644 (file)
@@ -5,7 +5,7 @@
     label="Main objects"
     icon="icons/Features/cut_shape.png"
     tooltip="Select solid objects"
-    type_choice="solids objects"
+    type_choice="objects"
     concealment="true">
     <validator id="FeaturesPlugin_ValidatorTransform"/>
   </multi_selector>
index d9460ce72b20da44fd6db842e46e20a2e42edddc..bf8e1b607d8db487b800a9a82c573ec967333d7e 100755 (executable)
@@ -94,9 +94,13 @@ void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t
 void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
                                             const Standard_Integer aMode)
 {
-  if (aMode > 8)
+  if (aMode > TopAbs_SHAPE) {
     // In order to avoid using custom selection modes
+    if (aMode == ModuleBase_ResultPrs::Sel_Result) {
+      AIS_Shape::ComputeSelection(aSelection, TopAbs_COMPOUND);
+    }
     return;
+  }
 
   // TODO: OCCT issue should be created for the COMPOUND processing
   // before it is fixed, the next workaround in necessary
index e1143734ca13e70b0925bbac148525bea447ef82..6d7dc8b1c52d4d4eedf1f3745f1cdcf9c676714f 100644 (file)
@@ -58,6 +58,13 @@ DEFINE_STANDARD_HANDLE(ModuleBase_ResultPrs, ViewerData_AISShape)
 */
 class ModuleBase_ResultPrs: public ViewerData_AISShape
 {
+public:
+  enum SelectionModes {
+    Sel_Result = TopAbs_SHAPE + 1 /// it should be combined with Compsolid results, so it is not
+                                  /// the Shape type. It is not defined in XML as compound type
+                                  /// because this type is processed as shape with compounds inside.
+  };
+
 public:
   /// Constructor
   /// \param theResult a result object
index fa47856fa7d23b918cebf5092e1402ded7935f4f..8045264db33622361bbd0e3ce65240e8ac19b7ad 100755 (executable)
@@ -12,6 +12,7 @@
 #include <ModuleBase_IWorkshop.h>
 #include <ModuleBase_IModule.h>
 #include <ModuleBase_IconFactory.h>
+#include <ModuleBase_ResultPrs.h>
 
 #include <ModelAPI_Attribute.h>
 #include <ModelAPI_AttributeRefAttr.h>
@@ -348,6 +349,8 @@ QString getShapeTypeInfo(const int theType)
     case TopAbs_EDGE:      anInfo = "edge"; break;
     case TopAbs_VERTEX:    anInfo = "vertex"; break;
     case TopAbs_SHAPE:     anInfo = "shape"; break;
+    case ModuleBase_ResultPrs::Sel_Result:
+                           anInfo = "result_shape"; break;
     default: break;
   }
   return anInfo;
@@ -521,10 +524,10 @@ void selectionInfo(Handle(AIS_InteractiveContext)& theContext, const std::string
 #endif
 }
 
-typedef QMap<QString, TopAbs_ShapeEnum> ShapeTypes;
+typedef QMap<QString, int> ShapeTypes;
 static ShapeTypes myShapeTypes;
 
-TopAbs_ShapeEnum shapeType(const QString& theType)
+int shapeType(const QString& theType)
 {
   if (myShapeTypes.count() == 0) {
     myShapeTypes["compound"]   = TopAbs_COMPOUND;
@@ -543,7 +546,8 @@ TopAbs_ShapeEnum shapeType(const QString& theType)
     myShapeTypes["edges"]      = TopAbs_EDGE;
     myShapeTypes["vertex"]     = TopAbs_VERTEX;
     myShapeTypes["vertices"]   = TopAbs_VERTEX;
-    myShapeTypes["objects"]    = TopAbs_SHAPE;
+    myShapeTypes["object"]     = ModuleBase_ResultPrs::Sel_Result;
+    myShapeTypes["objects"]    = ModuleBase_ResultPrs::Sel_Result;
   }
   QString aType = theType.toLower();
   if(myShapeTypes.contains(aType))
index 4fb4146b02bf2268a942b08883730bc075b70f8e..e2a10092cd9968c9565b1ef85fc0c8367f6c71bf 100755 (executable)
@@ -144,7 +144,7 @@ MODULEBASE_EXPORT void selectionInfo(Handle_AIS_InteractiveContext& theContext,
 /// Converts string value (name of shape type) to shape enum value
 /// \param theType - string with shape type name
 /// \return TopAbs_ShapeEnum value
-MODULEBASE_EXPORT TopAbs_ShapeEnum shapeType(const QString& theType);
+MODULEBASE_EXPORT int shapeType(const QString& theType);
 
 /// Checks whether the object is a sub result. It gets the feature of the object,
 /// obtains all results of the feature and check if the object is a sub result
index 378aa4a6229ed16f18e9578249bc27b21abc568b..705ca57f231732cdadaa3d7e21dfb35dda4bcb30 100755 (executable)
@@ -448,13 +448,13 @@ QIntList ModuleBase_WidgetMultiSelector::shapeTypes() const
 }
 
 //********************************************************************
-void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const TopAbs_ShapeEnum theShapeType)
+void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const int theShapeType)
 {
   QString aShapeTypeName;
   
   for (int idx = 0; idx < myTypeCombo->count(); ++idx) {
     aShapeTypeName = myTypeCombo->itemText(idx);
-    TopAbs_ShapeEnum aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
+    int aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
     if(aRefType == theShapeType && idx != myTypeCombo->currentIndex()) {
       bool aWasActivated = activateSelectionAndFilters(false);
       bool isBlocked = myTypeCombo->blockSignals(true);
index 69ed362b6052dc8b3c16fcde9084356bb6870eae..5a9382a0dedcee423850054742383f08a9ffdd2a 100755 (executable)
@@ -124,7 +124,7 @@ protected:
   virtual QIntList shapeTypes() const;
 
   /// Set current shape type for selection
-  void setCurrentShapeType(const TopAbs_ShapeEnum theShapeType);
+  void setCurrentShapeType(const int theShapeType);
 
   /// Return the attribute values wrapped in a list of viewer presentations
   /// \return a list of viewer presentations, which contains an attribute result and
index caa9c798b476182f4e98df1cda537e894cfcca93..a6c82a0dd45823fe51a04a57000e3427a7e14837 100755 (executable)
@@ -78,7 +78,7 @@ void ModuleBase_WidgetSelector::updateOnSelectionChanged(const bool theDone)
 QIntList ModuleBase_WidgetSelector::getShapeTypes() const
 {
   QIntList aShapeTypes = shapeTypes();
-  if (aShapeTypes.contains(TopAbs_SOLID) || aShapeTypes.contains(TopAbs_SHAPE)) {
+  if (aShapeTypes.contains(TopAbs_SOLID) || aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result/*TopAbs_SHAPE*/)) {
     // it should be selectable for both, "solids" and "objects" types
     aShapeTypes.append(TopAbs_COMPSOLID);
   }
@@ -104,8 +104,8 @@ bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape,
     aValid = true;
     return aValid;
   }
-  // when the SHAPE type is provided by XML, the hole result shape can be selected.
-  if (!aShape.get() && aShapeTypes.contains(TopAbs_SHAPE)) {
+  // when the SHAPE type is provided by XML as Object, the whole result shape should be selected.
+  if (!aShape.get() && aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result)) {
     aValid = true;
     return aValid;
   }
index b35bd80c8a5ae4e00a3ab473ae18c0e7a4cb3cea..e2c7460f6749ec23856c2614078ee7a50f662097 100644 (file)
@@ -447,8 +447,8 @@ void XGUI_Displayer::getModesOfActivation(ObjectPtr theObject, QIntList& theMode
 
 int XGUI_Displayer::getSelectionMode(int theShapeType)
 {
-  return (theShapeType >= TopAbs_SHAPE)? theShapeType : 
-    AIS_Shape::SelectionMode((TopAbs_ShapeEnum)theShapeType);
+  return (theShapeType > TopAbs_SHAPE) ? theShapeType : 
+                                         AIS_Shape::SelectionMode((TopAbs_ShapeEnum)theShapeType);
 }
 
 bool XGUI_Displayer::isVisible(XGUI_Displayer* theDisplayer, const ObjectPtr& theObject)