Salome HOME
2.17. Improved management of overconstraint situation: VPA correction in symbol prs...
[modules/shaper.git] / src / PartSet / PartSet_OperationPrs.h
index 9d2cc93b03bc1ea3272bca9b6bfff9b67f2e3056..bf1e5a2bc6bda3cf0650d26b912387947bf6480e 100755 (executable)
@@ -9,27 +9,56 @@
 
 #include "PartSet.h"
 
-#include <ModelAPI_Result.h>
+#include <ModelAPI_Object.h>
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
+#include <ModelAPI_Attribute.h>
+
+#include <ModuleBase_IWorkshop.h>
+
+#include <GeomAPI_Shape.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;
+class XGUI_Displayer;
+
 /**
 * \ingroup GUI
-* A redefinition of standard AIS Interactive Object in order to provide specific behaviour 
-* for wire presentations based in a one plane
+* A redefinition of standard AIS Interactive Object in order to provide colored presentation of
+* a list of shapes. It contains a shapes where the parameter feature refers. It processes the following
+* types of attributes: ModelAPI_AttributeSelectionList, ModelAPI_AttributeRefAttr,
+* ModelAPI_AttributeSelection and ModelAPI_AttributeReference.
+* The selection for this presentation is absent.
 */
 class PartSet_OperationPrs : public ViewerData_AISShape
 {
 public:
   /// Constructor
-  /// \param theResult a result object
-  Standard_EXPORT PartSet_OperationPrs(FeaturePtr theFeature);
+  Standard_EXPORT PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop);
+
+  /// Returns true if the feature contains shapes or results
+  bool hasShapes();
+
+  /// Sets the colors for the presentation compute
+  /// \param theColor an argument shapes color
+  void setShapeColor(const Quantity_Color& theColor);
+
+  /// Switch on using of the AIS presentation with of the shape object increased on the delta
+  void useAISWidth();
 
   DEFINE_STANDARD_RTTI(PartSet_OperationPrs)
+
 protected:
   /// Redefinition of virtual function
   Standard_EXPORT virtual void Compute(
@@ -39,9 +68,66 @@ 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
+  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
+  /// \param theWorkshop a current workshop
+  /// \param theObjectShapes an output map
+  /// \param theObjectShape an output map of objects
+  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
+  /// \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);
+
 private:
-  /// Reference to a feature object
-  FeaturePtr myFeature;
+  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;
 };