X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FPartSet%2FPartSet_CustomPrs.h;h=da5c247732bac633cb78f7fb553a6a7bb51f4a0c;hb=031179ada6681b874314c450eeda806f9f8abd28;hp=d21bdd0e3afe43e303da98caec158062aaba447d;hpb=38a503cd21409d05639a2508de05b5065f1805fa;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_CustomPrs.h b/src/PartSet/PartSet_CustomPrs.h index d21bdd0e3..da5c24773 100755 --- a/src/PartSet/PartSet_CustomPrs.h +++ b/src/PartSet/PartSet_CustomPrs.h @@ -11,6 +11,7 @@ #include "PartSet_OperationPrs.h" +#include #include #include #include @@ -29,60 +30,100 @@ class XGUI_Workshop; class PartSet_CustomPrs { public: + /// Returns yellow color + static const std::string OPERATION_PARAMETER_COLOR() { return "255, 255, 0"; } + /// 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"; } + +public: + /// Constructor + /// \param theWorkshop a reference to workshop PARTSET_EXPORT PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop); PARTSET_EXPORT virtual ~PartSet_CustomPrs() {}; /// Returns true if the presentation is active - bool isActive(); + /// \param theFlag an object AIS presentation type + bool isActive(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag); /// Initializes the operation presentation by the parameter object and display the presentation /// \param theObject an operation feature source to fill the presentation + /// \param theFlag an object AIS presentation type /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly /// \returns true if the presentation is displayed - bool activate(const FeaturePtr& theObject, const bool theUpdateViewer); + bool activate(const FeaturePtr& theObject, + const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + const bool theUpdateViewer); /// Initializes the operation presentation by empty object and erase the presentation /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly + /// \param theFlag an object AIS presentation type /// \returns true if the presentation has been displayed and now it is erased - bool deactivate(const bool theUpdateViewer); + bool deactivate(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + const bool theUpdateViewer); /// If the presentation is active[displayed], the shapes of the presentation is recomputed /// and the presentation is redisplayed. + /// \param theObject an object to redisplay + /// \param theFlag an object AIS presentation type /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly /// \returns true if the presentation is redisplayed - bool redisplay(const ObjectPtr& theObject, const bool theUpdateViewer); + bool redisplay(const ObjectPtr& theObject, + const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + const bool theUpdateViewer); - /// Nullify the operation presentation. For example, it can be useful when the viewer/context + /// Nullify all internal presentations. For example, it can be useful when the viewer/context /// is closed. If this is not performed and the presentation is assigned in another context, /// it caused erroneus case because the presentation has linkage to the previous context. void clearPrs(); private: /// Creates the AIS operation presentation - void initPrs(); + /// \param theFlag an object AIS presentation type + void initPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag); - /// Returns the AIS presentation - Handle(PartSet_OperationPrs) getPresentation(); + /// Gets an AIS presentation by the flag + /// \param theFlag an object AIS presentation type + /// \return the AIS prsentation + Handle(PartSet_OperationPrs) getPresentation( + const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag); //! Returns workshop XGUI_Workshop* workshop() const; /// Displays the internal presentation in the viewer of workshop + /// \param theFlag an object AIS presentation type /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - void displayPresentation(const bool theUpdateViewer); + /// \param returns whether the presentation is displayed/redisplayed + bool displayPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + const bool theUpdateViewer); /// 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 bool theUpdateViewer); + void erasePresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + const bool theUpdateViewer); - /// Sets color, point size and width of the presentation - /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly - void customizePresentation(const bool theUpdateViewer); + /// Nullify the operation presentation. For example, it can be useful when the viewer/context + /// is closed. If this is not performed and the presentation is assigned in another context, + /// it caused erroneus case because the presentation has linkage to the previous context. + /// \param theFlag an object AIS presentation type + void clearPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag); + + /// Returns presentation color according to the flag + /// \param theFlag an object AIS presentation type + /// \return theShapeColor a color + Quantity_Color getShapeColor(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag); private: - bool myIsActive; + FeaturePtr myFeature; /// Reference to a feature object ModuleBase_IWorkshop* myWorkshop; /// current workshop - AISObjectPtr myOperationPrs; /// the AIS presentation, which is displayed/erased in the viewer + /// map of presentation type to AIS object + QMap myPresentations; + /// State whether the presentation is activated/deactivated + QMap myIsActive; }; #endif