Salome HOME
updated copyright message
[modules/shaper.git] / src / PartSet / PartSet_OperationPrs.h
old mode 100755 (executable)
new mode 100644 (file)
index adafbdf..b702e25
@@ -1,8 +1,21 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        PartSet_OperationPrs.h
-// Created:     01 Jul 2015
-// Author:      Natalia ERMOLAEVA
+// Copyright (C) 2014-2023  CEA, EDF
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #ifndef PartSet_OperationPrs_H
 #define PartSet_OperationPrs_H
 #include <Standard_DefineHandle.hxx>
 
 #include <Quantity_Color.hxx>
+#include <NCollection_List.hxx>
+#include <NCollection_DataMap.hxx>
+#include <TopoDS_Shape.hxx>
+#include <AIS_InteractiveObject.hxx>
 
 #include <QMap>
 #include <QList>
@@ -31,6 +48,7 @@
 DEFINE_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape)
 
 class XGUI_Displayer;
+class SelectMgr_Selection;
 
 /**
 * \ingroup GUI
@@ -56,7 +74,7 @@ public:
   /// Switch on using of the AIS presentation with of the shape object increased on the delta
   void useAISWidth();
 
-  DEFINE_STANDARD_RTTI(PartSet_OperationPrs)
+  DEFINE_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape)
 
 protected:
   /// Redefinition of virtual function
@@ -69,18 +87,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
@@ -102,6 +113,16 @@ private:
                               QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes,
                               const bool theListShouldBeCleared = true);
 
+  /// Fills the map by the feature presentation if the feature is presentable
+  /// \param theFeature a current feature
+  /// \param theWorkshop a current workshop
+  /// \param theObjectShapes an output map
+  /// \param theObjectShape an output map of objects
+  static void getPresentationShapes(const FeaturePtr& theFeature,
+                              ModuleBase_IWorkshop* theWorkshop,
+                              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
   /// fill map by object and shapes
@@ -136,12 +157,22 @@ private:
                                    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
+  /// list of visualized shapes
+  NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)> myShapeToPrsMap;
 
   ModuleBase_IWorkshop* myWorkshop; /// current workshop
   Quantity_Color myShapeColor; /// color of feature depended shapes
-  bool myUseAISWidth; /// flag if the width of a shape object should be used for the shape visualization
+
+  /// flag if the width of a shape object should be used for the shape visualization
+  bool myUseAISWidth;
 
   friend class PartSet_CustomPrs;
 };