Salome HOME
"2.11 Constraint with a point from the intersection between an outer edge and plane...
[modules/shaper.git] / src / PartSet / PartSet_OperationPrs.h
index ea645140ce9f0f9810db282dd36088ffb186010e..bf1e5a2bc6bda3cf0650d26b912387947bf6480e 100755 (executable)
@@ -11,6 +11,7 @@
 
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
 #include <ModelAPI_Attribute.h>
 
 #include <ModuleBase_IWorkshop.h>
 #include <ViewerData_AISShape.hxx>
 #include <Standard_DefineHandle.hxx>
 
+#include <Quantity_Color.hxx>
+
 #include <QMap>
 #include <QList>
 
+#include <list>
+
 DEFINE_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape)
 
 class XGUI_Workshop;
@@ -42,20 +47,15 @@ public:
   /// Constructor
   Standard_EXPORT PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop);
 
-  /// Returns true if the feature contains attributes, which has references to other features
-  /// \param theFeature a feature
-  /// \return boolean result
-  bool canActivate(const FeaturePtr& theFeature);
+  /// Returns true if the feature contains shapes or results
+  bool hasShapes();
 
-  /// Sets the operation feature. It is used in Compute method to group the feature parameter shapes
-  /// theFeature a feature
-  void setFeature(const FeaturePtr& theFeature);
+  /// Sets the colors for the presentation compute
+  /// \param theColor an argument shapes color
+  void setShapeColor(const Quantity_Color& theColor);
 
-  /// Returns true if the presentation 
-  bool dependOn(const ObjectPtr& theObject);
-
-  // Recompute internal list of shaped dependent on the current feature
-  void updateShapes();
+  /// Switch on using of the AIS presentation with of the shape object increased on the delta
+  void useAISWidth();
 
   DEFINE_STANDARD_RTTI(PartSet_OperationPrs)
 
@@ -68,18 +68,47 @@ protected:
   /// Redefinition of virtual function
   Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
                                                 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; }
+
 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
-  bool isVisible(XGUI_Displayer* theDislayer, const ObjectPtr& theObject);
+  static bool isVisible(XGUI_Displayer* theDislayer, const ObjectPtr& theObject);
 
   /// Fills the map by the feature object and shapes, which should be visuaziled
-  /// Gets the feature attribute, collect objects to whom the attribute refers
+  /// Gets feature attributes, collect objects to whom the attributes refer
+  /// \param theFeature a current feature
+  /// \param theWorkshop a current workshop
+  /// \param theObjectShapes an output map
   /// \param theObjectShape an output map of objects
-  void getFeatureShapes(QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
+  static void getFeatureShapes(const FeaturePtr& theFeature,
+                               ModuleBase_IWorkshop* theWorkshop,
+                               QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
+
+  /// 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
+  /// \param theWorkshop a current workshop
+  /// \param theObjectShapes an output map
+  /// \param theObjectShape an output map of objects
+  static void getResultShapes(const FeaturePtr& theFeature,
+                              ModuleBase_IWorkshop* theWorkshop,
+                              QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
+
+  /// 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
+  /// \param theWorkshop a current workshop
+  /// \param theObjectShapes an output map of objects
+  static void getHighlightedShapes(ModuleBase_IWorkshop* theWorkshop,
+                                   QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes);
 
   /// Returns true if the attribute type belong to reference attribute
   /// \param theAttribute an attribute
@@ -87,13 +116,18 @@ private:
   static bool isSelectionAttribute(const AttributePtr& theAttribute);
 
   /// Converts the current workshop to XGUI workshop
+  /// \param theWorkshop an interface workshop
   /// \return a workshop instance
-  XGUI_Workshop* workshop() const;
+  static XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop);
 
 private:
-  ModuleBase_IWorkshop* myWorkshop;
-  FeaturePtr myFeature; /// Reference to a feature object
-  QMap<ObjectPtr, QList<GeomShapePtr> > myFeatureShapes;
+  QMap<ObjectPtr, QList<GeomShapePtr> > myFeatureShapes; /// visualized shapes
+
+  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
+
+  friend class PartSet_CustomPrs;
 };