Salome HOME
Issue #1820 Selection of two points in sketchPlane
[modules/shaper.git] / src / PartSet / PartSet_CustomPrs.h
index 69393817f850e816156c8afa08ab38ed760d9d8e..f64ed35cd6c953458fe4f92c7a2491acf5bb9218 100755 (executable)
@@ -16,6 +16,8 @@
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Feature.h>
 
+#include <Events_Listener.h>
+
 #include <GeomAPI_ICustomPrs.h>
 #include <GeomAPI_AISObject.h>
 #include <GeomAPI_Shape.h>
@@ -27,7 +29,7 @@ class XGUI_Workshop;
  * This is the module custom presentation, which manage an AIS presentation, that can be filled
  * by a feature and visualized in the viewer additionally to usual workshop objects.
 */
-class PartSet_CustomPrs
+class PartSet_CustomPrs : public Events_Listener
 {
 public:
   /// Returns yellow color
@@ -35,8 +37,7 @@ public:
   /// Returns green color
   static const std::string OPERATION_RESULT_COLOR() { return "0,225, 0"; }
   /// Returns color between white and color of highlight
-  /// highlight color is equal Quantity_Color(0.5,1,1) or QColor(122, 255,255) // 188
-  static const std::string OPERATION_HIGHLIGHT_COLOR() { return "188, 255, 255"; }
+  static const std::string OPERATION_HIGHLIGHT_COLOR() { return "128, 0, 0"; }
 
 public:
   /// Constructor
@@ -79,6 +80,9 @@ public:
   /// it caused erroneus case because the presentation has linkage to the previous context.
   void clearPrs();
 
+  //! Redefinition of Events_Listener method to listen a moment that the presentation becomes empty
+  virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
+
 private:
   /// Creates the AIS operation presentation
   /// \param theFlag an object AIS presentation type
@@ -104,7 +108,8 @@ private:
   /// Erases the internal presentation from the viewer of workshop
   /// \param theFlag an object AIS presentation type
   /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
-  void erasePresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+  /// \param returns whether the presentation is erased
+  bool erasePresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
                          const bool theUpdateViewer);
 
   /// Nullify the operation presentation. For example, it can be useful when the viewer/context
@@ -119,6 +124,7 @@ private:
   Quantity_Color getShapeColor(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag);
 
 private:
+  bool myPresentationIsEmpty; /// Boolean state about empty presentation
   FeaturePtr myFeature; /// Reference to a feature object
   ModuleBase_IWorkshop* myWorkshop; /// current workshop
   /// map of presentation type to AIS object