From 7632f7682b8b35390be660f5f2f0e44fff0f0108 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 23 Jan 2015 19:58:37 +0300 Subject: [PATCH] Update documentation --- doc/doxyfile.in | 2 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h | 2 +- src/Model/Model_Validator.h | 2 +- src/ModelAPI/ModelAPI_Validator.h | 2 +- src/ModuleBase/ModuleBase_IPrefMgr.h | 6 ++ src/ModuleBase/ModuleBase_IPropertyPanel.h | 27 ++++-- src/ModuleBase/ModuleBase_ModelWidget.h | 47 +++++++---- src/ModuleBase/ModuleBase_Operation.h | 73 ++++++++--------- src/ModuleBase/ModuleBase_WidgetDoubleValue.h | 23 ++++-- src/NewGeom/NewGeom_Module.cpp | 6 ++ src/NewGeom/NewGeom_Module.h | 59 ++++++++++++- src/XGUI/XGUI_Displayer.h | 82 ++++++++++++------- src/XGUI/XGUI_PropertyPanel.h | 42 ++++++++-- 13 files changed, 260 insertions(+), 113 deletions(-) diff --git a/doc/doxyfile.in b/doc/doxyfile.in index 5abca4b86..5ca8b8a0d 100644 --- a/doc/doxyfile.in +++ b/doc/doxyfile.in @@ -1590,7 +1590,7 @@ INCLUDE_FILE_PATTERNS = # undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = +PREDEFINED = Standard_EXPORT __Standard_API __Draw_API Handle(a):=Handle DEFINE_STANDARD_ALLOC DEFINE_NCOLLECTION_ALLOC DEFINE_STANDARD_HANDLE DEFINE_STANDARD_RTTI # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h index 6159b11c6..25812634c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h @@ -12,7 +12,7 @@ //#include /**\class GeomAlgoAPI_MakeShape * \ingroup DataModel - * \Interface to the root class of all topological shapes constructions + * \brief Interface to the root class of all topological shapes constructions */ class GeomAlgoAPI_MakeShape : public GeomAPI_Interface { diff --git a/src/Model/Model_Validator.h b/src/Model/Model_Validator.h index e2f67b617..cab877163 100644 --- a/src/Model/Model_Validator.h +++ b/src/Model/Model_Validator.h @@ -14,7 +14,7 @@ /**\class Model_ValidatorsFactory * \ingroup DataModel - * \breif Manages the registered validators + * \brief Manages the registered validators * * Allows to get a validator by the feature identifier and * the attribute identifier (if attribute is validated). diff --git a/src/ModelAPI/ModelAPI_Validator.h b/src/ModelAPI/ModelAPI_Validator.h index 06068e011..1c7d0fecb 100644 --- a/src/ModelAPI/ModelAPI_Validator.h +++ b/src/ModelAPI/ModelAPI_Validator.h @@ -37,7 +37,7 @@ typedef std::shared_ptr ValidatorPtr; /**\class ModelAPI_ValidatorsFactory * \ingroup DataModel - * \breif Manages the registered validators + * \brief Manages the registered validators * * Allows to get a validator by the feature identifier and * the attribute identifier (if attribute is validated). diff --git a/src/ModuleBase/ModuleBase_IPrefMgr.h b/src/ModuleBase/ModuleBase_IPrefMgr.h index 584659d8e..c2c23ba90 100644 --- a/src/ModuleBase/ModuleBase_IPrefMgr.h +++ b/src/ModuleBase/ModuleBase_IPrefMgr.h @@ -33,6 +33,12 @@ public: SUIT_PreferenceMgr::PrefItemType theType, const QString& theSection, const QString& theName ) = 0; + /** + * \brief Set property of an item + * \param thePropName the property name + * \param theValue the value of the property + * \param theId id of the property + */ virtual void setItemProperty(const QString& thePropName, const QVariant& theValue, const int theId = -1) = 0; diff --git a/src/ModuleBase/ModuleBase_IPropertyPanel.h b/src/ModuleBase/ModuleBase_IPropertyPanel.h index 77b65f2d6..ddd3fc7d2 100644 --- a/src/ModuleBase/ModuleBase_IPropertyPanel.h +++ b/src/ModuleBase/ModuleBase_IPropertyPanel.h @@ -17,10 +17,15 @@ class ModuleBase_ModelWidget; +/** +* A class for Property panel object definition +*/ class MODULEBASE_EXPORT ModuleBase_IPropertyPanel : public QDockWidget { Q_OBJECT public: + /// Constructor + /// \param theParent is a parent of the property panel ModuleBase_IPropertyPanel(QWidget* theParent) : QDockWidget(theParent), myIsEditing(false) {} /// Returns currently active widget @@ -30,19 +35,24 @@ public: virtual const QList& modelWidgets() const = 0; /// Editing mode depends on mode of current operation. This value is defined by it. + /// \param isEditing state of editing mode flag virtual void setEditingMode(bool isEditing) { myIsEditing = isEditing; } + + /// \return State of editing mode flag bool isEditingMode() const { return myIsEditing; } /// Set Enable/Disable state of Ok button + /// \param theEnabled Enable/Disable state of Ok button virtual void setOkEnabled(bool theEnabled) = 0; - /// Returns state of Ok button + /// \return Enable/disable state of Ok button virtual bool isOkEnabled() const = 0; - /// Set Enable/Disable state of Ok button + /// Set Enable/Disable state of Cancel button + /// \param theEnabled Enable/Disable state of Cancel button virtual void setCancelEnabled(bool theEnabled) = 0; - /// Returns state of Ok button + /// \return Enable/Disable state of Cancel button virtual bool isCancelEnabled() const = 0; signals: @@ -65,12 +75,17 @@ public slots: /// Activate the next from current widget in the property panel virtual void activateNextWidget() = 0; - // Makes the given widget active, highlights it and removes - // highlighting from the previous active widget - // emits widgetActivated(theWidget) signal + /** + * Makes the given widget active, highlights it and removes + * highlighting from the previous active widget + * emits widgetActivated(theWidget) signal + * \param theWidget which has to be activated + */ virtual void activateWidget(ModuleBase_ModelWidget* theWidget) = 0; protected: + + /// Flag which shows that current operation is in editing mode bool myIsEditing; }; diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index 15a0c5b2a..35bd16320 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -32,8 +32,9 @@ class MODULEBASE_EXPORT ModuleBase_ModelWidget : public QObject Q_OBJECT public: /// Constructor - /// \theParent the parent object - /// \theData the widget configuation. The attribute of the model widget is obtained from + /// \param theParent the parent object + /// \param theData the widget configuation. The attribute of the model widget is obtained from + /// \param theParentId is Id of a parent of the current attribute ModuleBase_ModelWidget(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); /// Destructor @@ -66,9 +67,9 @@ Q_OBJECT } /// Saves the internal parameters to the given feature - /// \param theObject a model feature to be changed virtual bool storeValue() const = 0; + /// Restore value from attribute data to the widget's control virtual bool restoreValue() = 0; /// Set focus to the first control of the current widget. The focus policy of the control is checked. @@ -90,13 +91,13 @@ Q_OBJECT /// \return a control list virtual QList getControls() const = 0; - /// FocusIn events processing virtual bool eventFilter(QObject* theObject, QEvent *theEvent); - + //! \brief Enables processing of focus event on all controls by the widget void enableFocusProcessing(); + //! Switch On/Off highlighting of the widget void setHighlighted(bool isHighlighted); /// Returns the attribute name @@ -113,11 +114,13 @@ Q_OBJECT return myParentId; } + /// \return Current feature FeaturePtr feature() const { return myFeature; } + /// Set feature which is processing by active operation void setFeature(const FeaturePtr& theFeature) { myFeature = theFeature; @@ -125,42 +128,58 @@ Q_OBJECT /// Editing mode depends on mode of current operation. This value is defined by it. void setEditingMode(bool isEditing) { myIsEditing = isEditing; } + + /// \return Current Editing mode bool isEditingMode() const { return myIsEditing; } signals: /// The signal about widget values changed void valuesChanged(); + /// The signal about key release on the control, that corresponds to the attribute - /// \param theAttributeName a name of the attribute /// \param theEvent key release event void keyReleased(QKeyEvent* theEvent); + /// The signal about the widget is get focus /// \param theWidget the model base widget void focusInWidget(ModuleBase_ModelWidget* theWidget); + /// The signal about the widget is lost focus /// \param theWidget the model base widget void focusOutWidget(ModuleBase_ModelWidget* theWidget); protected: - /// Returns the attribute name - /// \returns the string value + /// \brief Set the attribute name + /// \param theAttribute the string value with attribute name void setAttributeID(const std::string& theAttribute) { myAttributeID = theAttribute; } + /// Sends Update and Redisplay for the given object + /// \param theObj is updating object void updateObject(ObjectPtr theObj) const; + + /// Sends Move event for the given object + /// \param theObj is object for moving void moveObject(ObjectPtr theObj) const; protected: - std::string myAttributeID; /// the attribute name of the model feature - std::string myParentId; /// name of parent - FeaturePtr myFeature; - bool myIsComputedDefault; /// Value should be computed on execute, - /// like radius for circle's constraint (can not be zero) + /// The attribute name of the model feature + std::string myAttributeID; + + /// Name of parent + std::string myParentId; + + /// A feature which is processing by active operation + FeaturePtr myFeature; - bool myIsEditing; + /// Value should be computed on execute, like radius for circle's constraint (can not be zero) + bool myIsComputedDefault; + + /// Flag which shows that current operation is in editing mode + bool myIsEditing; }; #endif diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index 593758907..596b51d1d 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -68,11 +68,6 @@ Q_OBJECT */ virtual bool isGranted(QString theId) const; - /// Sets a list of model widgets, according to the operation feature xml definition - /// \param theXmlRepresentation an xml feature definition - /// \param theWidgets a list of widgets - //void setModelWidgets(const std::string& theXmlRepresentation, - // QList theWidgets); /// Returns True if data of its feature was modified during operation virtual bool isModified() const { return myIsModified; } @@ -87,7 +82,7 @@ Q_OBJECT void setNestedFeatures(const QStringList& theList) { myNestedFeatures = theList; } - // Returns operations Id from it's description + /// Returns operations Id from it's description QString id() const; /// Returns the operation feature @@ -106,21 +101,17 @@ Q_OBJECT /// Returns True if the current operation works with the given object (feature or result) virtual bool hasObject(ObjectPtr theObj) const; - //virtual void keyReleased(const int theKey) {}; - - /// If operation needs to redisplay its result during operation - /// then this method has to return True - //virtual bool hasPreview() const { return false; } - /// Initialisation of operation with preliminary selection - /// \param theSelected the list of selected presentations - /// \param theHighlighted the list of highlighted presentations + /// \param theSelection an instance of Selection class /// \param theViewer a viewer to have the viewer the eye position virtual void initSelection(ModuleBase_ISelection* theSelection, - ModuleBase_IViewer* /* theViewer*/); + ModuleBase_IViewer* theViewer); + /// \brief Set property pane to the operation + /// \param theProp a property panel instance virtual void setPropertyPanel(ModuleBase_IPropertyPanel* theProp); + /// \return Currently installed property panel ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; } /// Activates widgets by preselection if it is accepted. Emits signal if the activation is correct @@ -130,16 +121,31 @@ Q_OBJECT /// then this variable has to be initialised by parent feature /// before operation feature creating void setParentFeature(CompositeFeaturePtr theParent) { myParentFeature = theParent; } + + /// \return Installed parent feature (can be NULL) CompositeFeaturePtr parentFeature() const { return myParentFeature; } signals: - void started(); /// the operation is started - void aborted(); /// the operation is aborted - void committed(); /// the operation is committed - void stopped(); /// the operation is aborted or committed - void resumed(); /// the operation is resumed - void postponed(); /// the operation is postponed - void activatedByPreselection(); /// the operation is filled with existing preselection + /// The operation is started + void started(); + + /// The operation is aborted + void aborted(); + + /// The operation is committed + void committed(); + + /// The operation is aborted or committed + void stopped(); + + /// The operation is resumed + void resumed(); + + /// The operation is postponed + void postponed(); + + /// The operation is filled with existing preselection + void activatedByPreselection(); public slots: /// Starts operation @@ -177,14 +183,6 @@ signals: /// \param theState th flag to abort, if it is true, do nothing, overwise abort void setRunning(bool theState); - // Data model methods. - /// Stores a custom value in model. - //virtual void storeCustomValue(); - - /// Slots which listen the mode widget activation - /// \param theWidget the model widget - //virtual void onWidgetActivated(ModuleBase_ModelWidget* theWidget); - protected: /// Virtual method called when operation started (see start() method for more description) /// Default impl calls corresponding slot and commits immediately. @@ -216,8 +214,7 @@ signals: /// Creates an operation new feature /// \param theFlushMessage the flag whether the create message should be flushed - /// \param theCompositeFeature the feature that must be used for adding the created object or null - /// \returns the created + /// \returns the created feature virtual FeaturePtr createFeature(const bool theFlushMessage = true); /// Verifies whether this operator can be commited. @@ -227,13 +224,6 @@ signals: /// Returns pointer to the root document. std::shared_ptr document() const; - /// Set value to the active widget - /// \param theFeature the feature - /// \param theX the horizontal coordinate - /// \param theY the vertical coordinate - /// \return true if the point is set - //virtual bool setWidgetValue(ObjectPtr theFeature, double theX, double theY); - /// Return a widget value point by the selection and the viewer position /// The default realization returns false /// \param thePrs the presentation @@ -245,11 +235,12 @@ signals: ModuleBase_IViewer* theViewer, double& theX, double& theY); - // Removes the preselection information and clears the map of preselection + /// Removes the preselection information and clears the map of preselection void clearPreselection(); protected: - FeaturePtr myFeature; /// the operation feature to be handled + /// The operation feature to be handled + FeaturePtr myFeature; /// the container to have the operation description ModuleBase_OperationDescription* myDescription; diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.h b/src/ModuleBase/ModuleBase_WidgetDoubleValue.h index a4f0a1b8b..5c1ef4bb9 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.h +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.h @@ -16,22 +16,30 @@ class QWidget; class QLabel; class QTimer; +/** +* A class of property panel widget for double value input +* It can be defined with "doublevalue" keyword. For example: +* "" +*/ class MODULEBASE_EXPORT ModuleBase_WidgetDoubleValue : public ModuleBase_ModelWidget { Q_OBJECT public: /// Constructor - /// \theParent the parent object - /// \theData the widget configuation. The attribute of the model widget is obtained from + /// \param theParent the parent object + /// \param theData the widget configuation. The attribute of the model widget is obtained from + /// \param theParentId is Id of a parent structure (widget, operation, group) ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); virtual ~ModuleBase_WidgetDoubleValue(); - /// Saves the internal parameters to the given feature - /// \param theObject a model feature to be changed + //! Saves the internal parameters to the given feature + // \return True in success virtual bool storeValue() const; + //! Read value of corresponded attribute from data model to the input control + // \return True in success virtual bool restoreValue(); /// Returns list of widget controls @@ -46,13 +54,18 @@ Q_OBJECT } public slots: - /// Delayed value chnged: when user starts typing something, + // Delayed value chnged: when user starts typing something, // it gives him a 0,5 second to finish typing, when sends valueChnaged() signal // void onValueChanged(); protected: + /// Container for thw widget controls QWidget* myContainer; + + /// Label of the widget QLabel* myLabel; + + /// Input value control ModuleBase_DoubleSpinBox* mySpinBox; }; diff --git a/src/NewGeom/NewGeom_Module.cpp b/src/NewGeom/NewGeom_Module.cpp index ca51046f9..9f5c22ceb 100644 --- a/src/NewGeom/NewGeom_Module.cpp +++ b/src/NewGeom/NewGeom_Module.cpp @@ -50,9 +50,15 @@ NewGeom_EXPORT char* getModuleVersion() } } +/** +* Class for preferences management +*/ class NewGeom_PrefMgr: public ModuleBase_IPrefMgr { public: + /// Constructor + /// \param theMgr preferences manager of SALOME + /// \param theModName name of the module NewGeom_PrefMgr(LightApp_Preferences* theMgr, const QString& theModName):myMgr(theMgr), myModName(theModName) {} virtual int addPreference(const QString& theLbl, int pId, diff --git a/src/NewGeom/NewGeom_Module.h b/src/NewGeom/NewGeom_Module.h index 8bb37249b..09cc7181b 100644 --- a/src/NewGeom/NewGeom_Module.h +++ b/src/NewGeom/NewGeom_Module.h @@ -29,12 +29,22 @@ Q_OBJECT virtual ~NewGeom_Module(); //----- LightAPP_Module interface --------------- + + /// \brief Initializing of the module + /// \param theApp application instance virtual void initialize(CAM_Application* theApp); + + /// \brief Definition of module standard windows virtual void windows(QMap& theWndMap) const; + + /// \brief Definition of module viewer virtual void viewManagers(QStringList& theList) const; + + /// \brief The method is called on selection changed event virtual void selectionChanged(); //--- XGUI connector interface ----- + virtual QAction* addFeature(const QString& theWBName, const QString& theId, const QString& theTitle, const QString& theTip, const QIcon& theIcon, const QKeySequence& theKeys = QKeySequence(), @@ -83,52 +93,93 @@ Q_OBJECT //! Returns list of Ids of defined actions (just by NewGeom module) virtual QStringList commandIdList() const; + /// Redefinition of virtual function. + /// \param theClient name of pop-up client + /// \param theMenu popup menu instance + /// \param theTitle menu title. virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle); + /// Redefinition of virtual function for preferences creation. virtual void createPreferences(); - virtual void preferencesChanged(const QString& theSection, const QString& theParam); + /// Redefinition of virtual function for preferences changed event. + virtual void preferencesChanged(const QString& theSection, const QString& theParam); + + /// \return Workshop class instance XGUI_Workshop* workshop() const { return myWorkshop; } + /// \brief Set flag about opened document state void setIsOpened(bool theOpened) { myIsOpened = theOpened; } + /// Register current modules of SALOME void inspectSalomeModules(); public slots: + /// \brief The method is called on the module activation + /// \param theStudy current study virtual bool activateModule(SUIT_Study* theStudy); + + /// \brief The method is called on the module activation + /// \param theStudy current study virtual bool deactivateModule(SUIT_Study* theStudy); protected slots: + /// Redefinition of virtual function + /// \param theMgr view manager virtual void onViewManagerAdded(SUIT_ViewManager* theMgr); + + /// Redefinition of virtual function + /// \param theMgr view manager virtual void onViewManagerRemoved(SUIT_ViewManager* theMgr); + /// Set preferences to default void onDefaultPreferences(); - // Obtains the current application and updates its actions + + /// Obtains the current application and updates its actions void onUpdateCommandStatus(); protected: + /// Create data model CAM_DataModel* createDataModel(); + + /// Create popup menu manager virtual QtxPopupMgr* popupMgr(); private: + /// Create selector for OCC Viewer + /// \param theMgr view manager NewGeom_OCCSelector* createSelector(SUIT_ViewManager* theMgr); + /// List of registered actions QStringList myActionsList; + /// Reference to workshop XGUI_Workshop* myWorkshop; + /// OCC viewer selector instance NewGeom_OCCSelector* mySelector; + /// Proxy viewer for connection to OCC Viewer in SALOME NewGeom_SalomeViewer* myProxyViewer; + /// Map of nested actions [ActionID: list of nested actions Id] QMap myNestedActions; + + /// Map of document types QMap myDocumentType; + /// Flag of opened document state bool myIsOpened; + // the next parameters should be restored after this module deactivation - bool myIsStorePositions; // the application value of the preferences parameter - bool myIsEditEnabled; // the application value + /// The application value of the preferences parameter + bool myIsStorePositions; + + /// The application value + bool myIsEditEnabled; + + /// Popup manager QtxPopupMgr* myPopupMgr; }; diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index 439d254e3..75f424311 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -35,44 +35,54 @@ class XGUI_Workshop; class XGUI_EXPORT XGUI_Displayer { public: - enum DisplayMode { NoMode = -1, Wireframe, Shading }; + /// Enumeration of possible display mode + enum DisplayMode { + NoMode = -1, /// Mode is not defined + Wireframe, /// Wireframe display mode + Shading /// Shading display mode + }; /// Constructor - /// \param theViewer the viewer + /// \param theWorkshop a workshop instance XGUI_Displayer(XGUI_Workshop* theWorkshop); + /// Destructor virtual ~XGUI_Displayer(); /// Returns the feature visibility state. - /// \param theFeature a feature instance + /// \param theObject an object instance bool isVisible(ObjectPtr theObject) const; /// Display the feature. Obtain the visualized object from the feature. - /// \param theFeature a feature instance + /// \param theObject an object to display /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly /// Returns true if the Feature succesfully displayed void display(ObjectPtr theObject, bool isUpdateViewer = true); /// Display the given AIS object. To hide this object use corresponde erase method + /// \param theAIS AIOS object to display + /// \param isUpdate the parameter whether the viewer should be update immediatelly void displayAIS(AISObjectPtr theAIS, bool isUpdate = true); /** * Add presentations which corresponds to the given features to current selection * \param theFeatures a list of features to be selected - * isUpdateViewer the parameter whether the viewer should be update immediatelly + * \param isUpdateViewer the parameter whether the viewer should be update immediatelly */ void setSelected(const QObjectPtrList& theFeatures, bool isUpdateViewer = true); - /// Un select all objects + /// Unselect all objects void clearSelected(); /// Erase the feature and a shape. - /// \param theFeature a feature instance + /// \param theObject an object instance /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly void erase(ObjectPtr theObject, const bool isUpdateViewer = true); /// Erase the given AIS object displayed by corresponded display method + /// \param theAIS instance of AIS object + /// \param isUpdate the parameter whether the viewer should be update immediatelly void eraseAIS(AISObjectPtr theAIS, const bool isUpdate = true); /// Erase all presentations @@ -83,10 +93,15 @@ class XGUI_EXPORT XGUI_Displayer /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly void closeLocalContexts(const bool isUpdateViewer = true); + /// \brief Add selection filter + /// \param theFilter a filter instance void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter); + /// \brief Remove selection filter + /// \param theFilter a filter instance void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter); + /// Remove all selection filters void removeFilters(); /** @@ -100,32 +115,40 @@ class XGUI_EXPORT XGUI_Displayer void updateViewer(); /// Searches the interactive object by feature - /// \param theFeature the object or presentable feature + /// \param theObject the object or presentable feature /// \return theIO an interactive object - AISObjectPtr getAISObject(ObjectPtr theFeature) const; + AISObjectPtr getAISObject(ObjectPtr theObject) const; /// Searches the feature by interactive object /// \param theIO an interactive object /// \return feature the feature or NULL if it not visualized ObjectPtr getObject(const AISObjectPtr& theIO) const; + + /// Searches the feature by interactive object + /// \param theIO an interactive object + /// \return corresponded object or NULL if it not found ObjectPtr getObject(const Handle(AIS_InteractiveObject)& theIO) const; /// Deactivates the given object (not allow selection) - void deactivate(ObjectPtr theFeature); + /// \param theObject object to deactivate + void deactivate(ObjectPtr theObject); /// Activates the given object (it can be selected) + /// \param theObject object to activate /// \param theModes - modes on which it has to be activated (can be empty) - void activate(ObjectPtr theFeature, const QIntList& theModes); + void activate(ObjectPtr theObject, const QIntList& theModes); /// Returns the modes of activation - /// \param theFeature the feature or NULL if it not visualized + /// \param theObject the feature or NULL if it not visualized /// \param theModes - modes on which it is activated (can be empty) void getModesOfActivation(ObjectPtr theObject, QIntList& theModes); /// Activates the given object with default modes - void activate(ObjectPtr theFeature); + /// \param theObject object to activate + void activate(ObjectPtr theObject); /// Returns true if the given object can be selected + /// \param theObject object to check bool isActive(ObjectPtr theObject) const; /// Activates in local context displayed outside of the context. @@ -140,18 +163,21 @@ class XGUI_EXPORT XGUI_Displayer /// Returns current display mode for the given object. /// If object is not dis played then returns NoMode. + /// \param theObject object to check DisplayMode displayMode(ObjectPtr theObject) const; - /// Displays only objects listed in the list + /// \param theList list of objects void showOnly(const QObjectPtrList& theList); /// Returns number of displayed objects int objectsCount() const { return myResult2AISObjectMap.size(); } + /// Returns list of displayed objects QObjectPtrList displayedObjects() const { return myResult2AISObjectMap.keys(); } /// Returns true if the given object can be shown in shaded mode + /// \param theObject object to check bool canBeShaded(ObjectPtr theObject) const; protected: @@ -163,24 +189,16 @@ class XGUI_EXPORT XGUI_Displayer Handle(SelectMgr_AndFilter) GetFilter(); /// Display the feature and a shape. This shape would be associated to the given feature - /// \param theFeature a feature instance + /// \param theObject an object instance /// \param theAIS AIS presentation + /// \param isShading flag to show in shading mode /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly - /// Returns true if the Feature succesfully displayed + /// \return true if the object is succesfully displayed void display(ObjectPtr theObject, AISObjectPtr theAIS, bool isShading, bool isUpdateViewer = true); - /// Display the shape and activate selection of sub-shapes - /// \param theFeature a feature instance - /// \param theAIS an AIS object - /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly - /// \returns true if the presentation is created - //bool redisplay(ObjectPtr theObject, - // AISObjectPtr theAIS, - // const bool isUpdateViewer = true); - /** Redisplay the shape if it was displayed - * \param theFeature a feature instance + * \param theObject an object instance * \param isUpdateViewer the parameter whether the viewer should be update immediatelly */ void redisplay(ObjectPtr theObject, bool isUpdateViewer = true); @@ -189,19 +207,23 @@ class XGUI_EXPORT XGUI_Displayer void openLocalContext(); protected: + /// Reference to workshop XGUI_Workshop* myWorkshop; + /// A container for selection filters Handle(SelectMgr_AndFilter) myAndFilter; + /// Definition of a type of map which defines correspondance between objects and presentations typedef QMap ResultToAISMap; + + /// A map of displayed objects ResultToAISMap myResult2AISObjectMap; - // A flag of initialization of external objects selection - //bool myUseExternalObjects; - // Selection modes installed for external objects in local context + /// Selection modes installed for external objects in local context QIntList myActiveSelectionModes; - bool myEnableUpdateViewer; /// the enable update viewer flag + /// the enable update viewer flag + bool myEnableUpdateViewer; }; #endif diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index 1bd6e71be..6e89ac0d6 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -20,17 +20,27 @@ class QKeyEvent; class QVBoxLayout; +/// Internal name of property panel widget const static char* PROP_PANEL = "property_panel_dock"; + +/// Internal name of Ok button const static char* PROP_PANEL_OK = "property_panel_ok"; + +/// Internal name of Cancel button const static char* PROP_PANEL_CANCEL = "property_panel_cancel"; +/** +* Realization of Property panel object. +*/ class XGUI_EXPORT XGUI_PropertyPanel : public ModuleBase_IPropertyPanel { Q_OBJECT public: - + /// Constructor + /// \param theParent is a parent of the property panel XGUI_PropertyPanel(QWidget* theParent); + virtual ~XGUI_PropertyPanel(); /// Returns main widget of the property panel, which children will be created @@ -57,37 +67,51 @@ Q_OBJECT /// Activate the next from current widget in the property panel virtual void activateNextWidget(); + /// \brief Enable/Disable stretch area in the panel void setStretchEnabled(bool isEnabled); /// Set Enable/Disable state of Ok button + /// \param theEnabled Enable/Disable state of Ok button virtual void setOkEnabled(bool theEnabled); - /// Returns state of Ok button + /// \return Enable/disable state of Ok button virtual bool isOkEnabled() const; - /// Set Enable/Disable state of Ok button + /// Set Enable/Disable state of Cancel button + /// \param theEnabled Enable/Disable state of Cancel button virtual void setCancelEnabled(bool theEnabled); - /// Returns state of Ok button + /// \return Enable/Disable state of Cancel button virtual bool isCancelEnabled() const; /// Editing mode depends on mode of current operation. This value is defined by it. + /// \param isEditing state of editing mode flag virtual void setEditingMode(bool isEditing); public slots: + + /// \brief Update all widgets in property panel with values from the given feature + /// \param theFeature a Feature to update values in widgets void updateContentWidget(FeaturePtr theFeature); - // Enables / disables "ok" ("accept") button - void setAcceptEnabled(bool); - // Makes the given widget active, highlights it and removes - // highlighting from the previous active widget - // emits widgetActivated(theWidget) signal + /// Enables / disables "ok" ("accept") button + /// \param toEnable enable/disable state of button + void setAcceptEnabled(bool toEnable); + + /** + * Makes the given widget active, highlights it and removes + * highlighting from the previous active widget + * emits widgetActivated(theWidget) signal + * \param theWidget which has to be activated + */ virtual void activateWidget(ModuleBase_ModelWidget* theWidget); private: QWidget* myCustomWidget; QList myWidgets; QVBoxLayout* myMainLayout; + + /// Currently active widget ModuleBase_ModelWidget* myActiveWidget; }; -- 2.39.2