From: nds Date: Wed, 22 Jun 2016 14:54:44 +0000 (+0300) Subject: Selection correction for "objects" type defined in XML. It is not possible to use... X-Git-Tag: V_2.4.0~43 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c850653211e8bc69166445909cfc078b4beee440;p=modules%2Fshaper.git Selection correction for "objects" type defined in XML. It is not possible to use TopAbs_SHAPE mode as '0' can't be combined with other selection modes. Compound is also reserved in NewGeom for shape with the compound shape type. As a result, additional selection mode is implemented. Later the new selection mode should be united somewhere with custom selection modes defined in SketcherPrs package. --- diff --git a/src/BuildPlugin/edge_widget.xml b/src/BuildPlugin/edge_widget.xml index 6890eae4d..196c252aa 100644 --- a/src/BuildPlugin/edge_widget.xml +++ b/src/BuildPlugin/edge_widget.xml @@ -4,7 +4,7 @@ diff --git a/src/BuildPlugin/face_widget.xml b/src/BuildPlugin/face_widget.xml index 49ea6b4cc..9502ee731 100644 --- a/src/BuildPlugin/face_widget.xml +++ b/src/BuildPlugin/face_widget.xml @@ -4,7 +4,7 @@ diff --git a/src/BuildPlugin/vertex_widget.xml b/src/BuildPlugin/vertex_widget.xml index 372da411c..5b4df6673 100644 --- a/src/BuildPlugin/vertex_widget.xml +++ b/src/BuildPlugin/vertex_widget.xml @@ -4,7 +4,7 @@ diff --git a/src/BuildPlugin/wire_widget.xml b/src/BuildPlugin/wire_widget.xml index e2c99d561..b085c2175 100644 --- a/src/BuildPlugin/wire_widget.xml +++ b/src/BuildPlugin/wire_widget.xml @@ -4,7 +4,7 @@ diff --git a/src/ExchangePlugin/plugin-Exchange.xml b/src/ExchangePlugin/plugin-Exchange.xml old mode 100644 new mode 100755 index f75602ca6..9555ff2ee --- a/src/ExchangePlugin/plugin-Exchange.xml +++ b/src/ExchangePlugin/plugin-Exchange.xml @@ -5,12 +5,18 @@ - + - + + + + + + - + \ No newline at end of file diff --git a/src/FeaturesPlugin/boolean_widget.xml b/src/FeaturesPlugin/boolean_widget.xml index d24a8af36..7c5e30ad1 100644 --- a/src/FeaturesPlugin/boolean_widget.xml +++ b/src/FeaturesPlugin/boolean_widget.xml @@ -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"> @@ -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" > diff --git a/src/FeaturesPlugin/extrusion_widget.xml b/src/FeaturesPlugin/extrusion_widget.xml index c63fccc24..25a388dff 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="wires faces objects"> + shape_types="vertices edges wires faces shells solids compsolids compounds"> diff --git a/src/FeaturesPlugin/extrusioncut_widget.xml b/src/FeaturesPlugin/extrusioncut_widget.xml index 02a201527..cdc7fb4b9 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="wires faces objects"> + shape_types="wires faces shells"> + type_choice="wires faces shells"> + shape_types="vertices edges wires faces shells compounds"> + type_choice="vertices edges wires faces shells compounds"> diff --git a/src/FeaturesPlugin/intersection_widget.xml b/src/FeaturesPlugin/intersection_widget.xml index cc8653d3f..e0ecd069e 100644 --- a/src/FeaturesPlugin/intersection_widget.xml +++ b/src/FeaturesPlugin/intersection_widget.xml @@ -4,8 +4,8 @@ @@ -14,8 +14,8 @@ diff --git a/src/FeaturesPlugin/pipe_widget.xml b/src/FeaturesPlugin/pipe_widget.xml index 53165ae7c..f2807b069 100644 --- a/src/FeaturesPlugin/pipe_widget.xml +++ b/src/FeaturesPlugin/pipe_widget.xml @@ -4,7 +4,7 @@ diff --git a/src/FeaturesPlugin/placement_widget.xml b/src/FeaturesPlugin/placement_widget.xml index 482e85803..784026359 100644 --- a/src/FeaturesPlugin/placement_widget.xml +++ b/src/FeaturesPlugin/placement_widget.xml @@ -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" > diff --git a/src/FeaturesPlugin/revolution_widget.xml b/src/FeaturesPlugin/revolution_widget.xml index fe52d714f..db35c6ee2 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="wires faces objects"> + shape_types="vertices edges wires faces shells compounds"> diff --git a/src/FeaturesPlugin/revolutioncut_widget.xml b/src/FeaturesPlugin/revolutioncut_widget.xml index 442fb0d0a..10482c12f 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="wires face objects"> + shape_types="wires faces shells"> + type_choice="wires faces shells"> + shape_types="vertices edges wires faces shells compounds"> + type_choice="vertices edges wires faces shells compounds"> diff --git a/src/FeaturesPlugin/translation_widget.xml b/src/FeaturesPlugin/translation_widget.xml index 5164fb758..63930e29e 100644 --- a/src/FeaturesPlugin/translation_widget.xml +++ b/src/FeaturesPlugin/translation_widget.xml @@ -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"> diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index d9460ce72..bf8e1b607 100755 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -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 diff --git a/src/ModuleBase/ModuleBase_ResultPrs.h b/src/ModuleBase/ModuleBase_ResultPrs.h index e1143734c..6d7dc8b1c 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.h +++ b/src/ModuleBase/ModuleBase_ResultPrs.h @@ -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 diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index fa47856fa..8045264db 100755 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -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 ShapeTypes; +typedef QMap 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)) diff --git a/src/ModuleBase/ModuleBase_Tools.h b/src/ModuleBase/ModuleBase_Tools.h index 4fb4146b0..e2a10092c 100755 --- a/src/ModuleBase/ModuleBase_Tools.h +++ b/src/ModuleBase/ModuleBase_Tools.h @@ -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 diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 378aa4a62..705ca57f2 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -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); diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index 69ed362b6..5a9382a0d 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -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 diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.cpp b/src/ModuleBase/ModuleBase_WidgetSelector.cpp index caa9c798b..a6c82a0dd 100755 --- a/src/ModuleBase/ModuleBase_WidgetSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelector.cpp @@ -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; } diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index b35bd80c8..e2c7460f6 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -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)