Salome HOME
Issue #1664: In the Sketcher, add the function Split a segment: split of arc, move...
[modules/shaper.git] / src / PartSet / PartSet_OperationPrs.h
index bf1e5a2bc6bda3cf0650d26b912387947bf6480e..cc1416451b8e923a8f083b2d5d2e612d34035b9b 100755 (executable)
@@ -22,6 +22,7 @@
 #include <Standard_DefineHandle.hxx>
 
 #include <Quantity_Color.hxx>
+#include <NCollection_List.hxx>
 
 #include <QMap>
 #include <QList>
@@ -30,8 +31,8 @@
 
 DEFINE_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape)
 
-class XGUI_Workshop;
 class XGUI_Displayer;
+class Handle_AIS_InteractiveObject;
 
 /**
 * \ingroup GUI
@@ -70,18 +71,11 @@ protected:
                                                 const Standard_Integer aMode) ;
 
 protected:
-  /// Returns map of feature shapes to be able to fill it outside this class, e.g. in friend
-  /// \return a map of object to shape
-  QMap<ObjectPtr, QList<GeomShapePtr> >& featureShapes() { return myFeatureShapes; }
+  /// list of visualized shapes
+  /// \return a map of shapes
+  NCollection_DataMap<TopoDS_Shape, Handle_AIS_InteractiveObject>& shapesMap();
 
 private:
-  /// Return true if the object is visible. If the object is feature, it returns true
-  /// if all results of the feature are shown
-  /// \param theDisplayer a displayer
-  /// \param theObject an object
-  /// \return a boolean value
-  static bool isVisible(XGUI_Displayer* theDislayer, const ObjectPtr& theObject);
-
   /// Fills the map by the feature object and shapes, which should be visuaziled
   /// Gets feature attributes, collect objects to whom the attributes refer
   /// \param theFeature a current feature
@@ -100,7 +94,8 @@ private:
   /// \param theObjectShape an output map of objects
   static void getResultShapes(const FeaturePtr& theFeature,
                               ModuleBase_IWorkshop* theWorkshop,
-                              QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
+                              QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes,
+                              const bool theListShouldBeCleared = true);
 
   /// Fills the map by the feature object and shapes, which should be visuaziled
   /// Gets the active widget, obtain the highlighted presentations if it has such and
@@ -115,13 +110,36 @@ private:
   /// \return a boolean value
   static bool isSelectionAttribute(const AttributePtr& theAttribute);
 
-  /// Converts the current workshop to XGUI workshop
-  /// \param theWorkshop an interface workshop
-  /// \return a workshop instance
-  static XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop);
+  /// Appends the shape for the result into the container if the result is visible and
+  /// the shape is not null.
+  /// \param theWorkshop a current workshop
+  /// \param theResult an object to be appended
+  /// \param theGeomShape a shape to be appended
+  /// \param theObjectShapes a filled container
+  static void addValue(const ObjectPtr& theObject, const GeomShapePtr& theShape,
+                const FeaturePtr& theFeature, ModuleBase_IWorkshop* theWorkshop,
+                QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
+
+  /// Appends the shape for the result into the container if the result is visible and
+  /// the shape is not null.
+  /// \param theWorkshop a current workshop
+  /// \param theObject an object to be appended
+  /// \param theGeomShape a shape to be appended
+  /// \param theObjectShapes a filled container
+  static void appendShapeIfVisible(ModuleBase_IWorkshop* theWorkshop,
+                                   const ObjectPtr& theObject,
+                                   GeomShapePtr theGeomShape,
+                                   QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
+
+  /// Fills the list of shapes by map of model objects
+  /// \param theFeatureShape a container to find shapes
+  /// \param theShapesMap an out container
+  static void fillShapeList(const QMap<ObjectPtr, QList<GeomShapePtr> >& theFeatureShapes,
+          ModuleBase_IWorkshop* theWorkshop,
+          NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>& theShapeToPrsMap);
 
 private:
-  QMap<ObjectPtr, QList<GeomShapePtr> > myFeatureShapes; /// visualized shapes
+  NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)> myShapeToPrsMap; /// list of visualized shapes
 
   ModuleBase_IWorkshop* myWorkshop; /// current workshop
   Quantity_Color myShapeColor; /// color of feature depended shapes