From 5b24ea6ca4e9754fa89f7c742dce060abb2f3cda Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 27 Jan 2015 16:14:14 +0300 Subject: [PATCH] Update code documentation --- .../ModuleBase_FilterNoConsructionSubShapes.h | 1 + src/ModuleBase/ModuleBase_ISelection.h | 10 +++- src/ModuleBase/ModuleBase_Preferences.cpp | 8 ++- src/ModuleBase/ModuleBase_ResultPrs.h | 15 +++++ src/ModuleBase/ModuleBase_ViewerFilters.h | 3 + src/ModuleBase/ModuleBase_WidgetBoolValue.h | 15 +++-- src/ModuleBase/ModuleBase_WidgetChoice.h | 25 ++++++++- src/ModuleBase/ModuleBase_WidgetEditor.h | 18 +++--- src/ModuleBase/ModuleBase_WidgetFactory.cpp | 2 +- src/ModuleBase/ModuleBase_WidgetFactory.h | 56 ++++++++++++++++++- .../ModuleBase_WidgetFileSelector.h | 34 +++++++++-- src/ModuleBase/ModuleBase_WidgetLabel.h | 8 +++ src/ModuleBase/ModuleBase_WidgetLineEdit.h | 18 ++++-- src/NewGeom/NewGeom_OCCSelector.h | 9 +++ src/NewGeom/NewGeom_SalomeViewer.h | 14 ++++- src/XGUI/XGUI_ErrorDialog.h | 21 ++++++- src/XGUI/XGUI_QtEvents.h | 9 +++ 17 files changed, 224 insertions(+), 42 deletions(-) diff --git a/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h b/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h index d70bfa6ce..4d5d3af91 100644 --- a/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h +++ b/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h @@ -16,6 +16,7 @@ class ModuleBase_IWorkshop; /** +* \class ModuleBase_FilterNoConsructionSubShapes * A filter which provides filtering of selection in 3d viewer. * Installing of this filter lets to select objects which belong to * currently active document or to global document diff --git a/src/ModuleBase/ModuleBase_ISelection.h b/src/ModuleBase/ModuleBase_ISelection.h index b6983d25a..5551999f4 100644 --- a/src/ModuleBase/ModuleBase_ISelection.h +++ b/src/ModuleBase/ModuleBase_ISelection.h @@ -18,6 +18,10 @@ #include +/** +* A class which provides access to selection. +* A selection can be obtained as from a viewer as from Object browser in various forms +*/ class ModuleBase_ISelection { public: @@ -46,9 +50,13 @@ class ModuleBase_ISelection virtual QModelIndexList selectedIndexes() const = 0; //! Returns list of currently selected AIS objects + //! \param theList returning list of selected AIS objects virtual void selectedAISObjects(AIS_ListOfInteractive& theList) const = 0; - //! Returns list of currently selected shapes + //! Returns list of currently selected shapes and their owners (objects). + //! Both lists are synchronized + //! \param theList returning list of selected AIS objects + //! \param theOwners list of objects virtual void selectedShapes(NCollection_List& theList, std::list& theOwners) const = 0; diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index 50d95a7a0..616e659e0 100644 --- a/src/ModuleBase/ModuleBase_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -146,12 +146,14 @@ void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int } } -//********************************************************** -//********************************************************** -//********************************************************** +/** +* Implementation of preferences manager interface +*/ class ModuleBase_PrefMgr: public ModuleBase_IPrefMgr { public: + /// Constructor + /// \param theMgr a preferences manager ModuleBase_PrefMgr(ModuleBase_PreferencesMgr* theMgr):myMgr(theMgr) {} virtual int addPreference(const QString& theLbl, int pId, diff --git a/src/ModuleBase/ModuleBase_ResultPrs.h b/src/ModuleBase/ModuleBase_ResultPrs.h index e009a03ae..f37bef1b4 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.h +++ b/src/ModuleBase/ModuleBase_ResultPrs.h @@ -16,29 +16,44 @@ DEFINE_STANDARD_HANDLE(ModuleBase_ResultPrs, AIS_Shape) +/** +* A redefinition of standard AIS Interactive Object in order to provide specific behaviour +* for wire presentations based in a one plane +*/ class ModuleBase_ResultPrs: public AIS_Shape { public: + /// Constructor + /// \param theResult a result object Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult); + /// Returns result object Standard_EXPORT ResultPtr getResult() const { return myResult; } + /// Returns True if the presentation is in sketch mode Standard_EXPORT bool isSketchMode() const { return myIsSketchMode; } DEFINE_STANDARD_RTTI(ModuleBase_ResultPrs) protected: + /// Redefinition of virtual function Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); + /// Redefinition of virtual function Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) ; private: + /// Reference to result object ResultPtr myResult; + /// A sketch mode flag bool myIsSketchMode; + /// Original shape of the result object TopoDS_Shape myOriginalShape; + + /// List of faces std::list > myFacesList; }; diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.h b/src/ModuleBase/ModuleBase_ViewerFilters.h index 0b3493094..da1ba9f04 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.h +++ b/src/ModuleBase/ModuleBase_ViewerFilters.h @@ -19,6 +19,7 @@ class ModuleBase_IWorkshop; /** +* \class ModuleBase_ShapeDocumentFilter * A filter which provides filtering of selection in 3d viewer. * Installing of this filter lets to select objects which belong to * currently active document or to global document @@ -44,6 +45,7 @@ protected: }; /** +* \class ModuleBase_ShapeInPlaneFilter * A filter which provides filtering of selection in 3d viewer. * Installing of this filter lets to select of Vertexes and Edges which belongs to the given plane */ @@ -73,6 +75,7 @@ private: /** +* \class ModuleBase_ObjectTypesFilter * A filter which provides filtering of selection in 3d viewer. * Installing of this filter lets to select only object of requested type * Accepts following objects types: diff --git a/src/ModuleBase/ModuleBase_WidgetBoolValue.h b/src/ModuleBase/ModuleBase_WidgetBoolValue.h index cf41b6b89..5325b4d99 100644 --- a/src/ModuleBase/ModuleBase_WidgetBoolValue.h +++ b/src/ModuleBase/ModuleBase_WidgetBoolValue.h @@ -14,33 +14,32 @@ class Config_WidgetAPI; class QWidget; class QCheckBox; +/** +* Implementation of widget for boolean input (check box) +*/ class MODULEBASE_EXPORT ModuleBase_WidgetBoolValue : 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 of the current attribute ModuleBase_WidgetBoolValue(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); virtual ~ModuleBase_WidgetBoolValue(); - /// Saves the internal parameters to the given feature - /// \param theObject a model feature to be changed virtual bool storeValue() const; virtual bool restoreValue(); - /// Returns list of widget controls - /// \return a control list virtual QList getControls() const; - /// Returns the internal parent wiget control, that can be shown anywhere - /// \returns the widget QWidget* getControl() const; private: + /// The check box QCheckBox* myCheckBox; }; diff --git a/src/ModuleBase/ModuleBase_WidgetChoice.h b/src/ModuleBase/ModuleBase_WidgetChoice.h index 99bd281f9..9b5206b08 100644 --- a/src/ModuleBase/ModuleBase_WidgetChoice.h +++ b/src/ModuleBase/ModuleBase_WidgetChoice.h @@ -14,17 +14,30 @@ class QWidget; class QLabel; class QComboBox; +/** +* Implementation of model widget for choice widget definition (combo box) +* It can be defined as following: +* \code +* +* \endcode +*/ class MODULEBASE_EXPORT ModuleBase_WidgetChoice : public ModuleBase_ModelWidget { Q_OBJECT public: + /// Constructor + /// \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_WidgetChoice(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); virtual ~ModuleBase_WidgetChoice(); - /// Saves the internal parameters to the given feature - /// \param theObject a model feature to be changed virtual bool storeValue() const; virtual bool restoreValue(); @@ -39,15 +52,21 @@ Q_OBJECT } /// Returns list of widget controls - /// \return a control list + /// \return a controls list virtual QList getControls() const; private slots: + /// Slot called on combo box index change void onCurrentIndexChanged(int theIndex); private: + /// Container widget QWidget* myContainer; + + /// The label QLabel* myLabel; + + /// The control QComboBox* myCombo; }; diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.h b/src/ModuleBase/ModuleBase_WidgetEditor.h index 9f9358fae..c992e60f9 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.h +++ b/src/ModuleBase/ModuleBase_WidgetEditor.h @@ -25,15 +25,14 @@ class MODULEBASE_EXPORT ModuleBase_WidgetEditor : public ModuleBase_WidgetDouble Q_OBJECT public: /// Constructor - /// \theParent the parent object - /// \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_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); /// Constructor - /// \theParent the parent object - /// \theParent the parent object - /// \theData the widget configuation. The attribute of the model widget is obtained from + /// \param theParent the parent object + /// \param theAttribute The attribute of the model widget ModuleBase_WidgetEditor(QWidget* theParent, const std::string& theAttribute); /// Destructor @@ -54,8 +53,11 @@ Q_OBJECT void showPopupEditor(); private: - FeaturePtr myFeature; ///< the current widget feature - QStringList myFeatureKinds; ///< the kinds of possible features + ///< the current widget feature + FeaturePtr myFeature; + + ///< the kinds of possible features + QStringList myFeatureKinds; }; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.cpp b/src/ModuleBase/ModuleBase_WidgetFactory.cpp index a72670413..40f7227ca 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFactory.cpp @@ -254,7 +254,7 @@ QWidget* ModuleBase_WidgetFactory::multiSelectorControl(QWidget* theParent) return aMultiselectorWgt->getControl(); } -QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) const +QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) { return QString::fromStdString(theStdString); } diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.h b/src/ModuleBase/ModuleBase_WidgetFactory.h index f81ee61c9..3fa399e98 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.h +++ b/src/ModuleBase/ModuleBase_WidgetFactory.h @@ -21,42 +21,92 @@ class QWidget; class Config_WidgetAPI; class ModuleBase_IWorkshop; +/** +* A class for creation of widgets instances in for property panel using XML deskription of +* a feature +*/ class MODULEBASE_EXPORT ModuleBase_WidgetFactory { public: + /// Constructor + /// \param theXmlRepresentation content of XML file + /// \param theWorkshop reference to workshop instance ModuleBase_WidgetFactory(const std::string& theXmlRepresentation, ModuleBase_IWorkshop* theWorkshop); virtual ~ModuleBase_WidgetFactory(); + /// Creates content widget for property panel + /// \param theParent a parent widget void createWidget(QWidget* theParent); + /// Returns list of model widgets QList getModelWidgets() const { return myModelWidgets; } protected: - //Widgets + /// Create widget by its type + /// \param theType a type + /// \param theParent a parent widget QWidget* createWidgetByType(const std::string& theType, QWidget* theParent = NULL); + + /// Create a widget of container type + /// \param theType a type + /// \param theParent a parent widget QWidget* createContainer(const std::string& theType, QWidget* theParent = NULL); + + /// Create label widget + /// \param theParent a parent widget QWidget* labelControl(QWidget* theParent); + + /// Create double spin box widget + /// \param theParent a parent widget QWidget* doubleSpinBoxControl(QWidget* theParent); + + /// Create double value editor widget + /// \param theParent a parent widget QWidget* doubleValueEditor(QWidget* theParent); + + /// Create shape selector widget + /// \param theParent a parent widget QWidget* shapeSelectorControl(QWidget* theParent); + + /// Create boolean input widget + /// \param theParent a parent widget QWidget* booleanControl(QWidget* theParent); + + /// Create file selector widget + /// \param theParent a parent widget QWidget* fileSelectorControl(QWidget* theParent); + + /// Create choice widget (combo box) + /// \param theParent a parent widget QWidget* choiceControl(QWidget* theParent); + + /// Create line edit widget + /// \param theParent a parent widget QWidget* lineEditControl(QWidget* theParent); - QWidget* multiSelectorControl(QWidget* theParent); + /// Create multi selector widget + /// \param theParent a parent widget + QWidget* multiSelectorControl(QWidget* theParent); - QString qs(const std::string& theStdString) const; + /// Convert STD string to QT string + /// \param theStdString is STD string + static QString qs(const std::string& theStdString); private: + /// API object for XML reading Config_WidgetAPI* myWidgetApi; + + /// Reference to workshop ModuleBase_IWorkshop* myWorkshop; + /// List of created model widgets QList myModelWidgets; + + /// Id of current parent std::string myParentId; }; diff --git a/src/ModuleBase/ModuleBase_WidgetFileSelector.h b/src/ModuleBase/ModuleBase_WidgetFileSelector.h index 2133fe786..06ca8bf5c 100644 --- a/src/ModuleBase/ModuleBase_WidgetFileSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetFileSelector.h @@ -20,27 +20,37 @@ class QWidget; class QLineEdit; +/** +* Implementation of model widget for open file widget. +* It can be defined as following: +* \code +* +* +* +* \endcode +*/ class MODULEBASE_EXPORT ModuleBase_WidgetFileSelector : public ModuleBase_ModelWidget { Q_OBJECT public: + /// Constructor + /// \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_WidgetFileSelector(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); virtual ~ModuleBase_WidgetFileSelector(); - /// Saves the internal parameters to the given feature - /// \param theObject a model feature to be changed virtual bool storeValue() const; virtual bool restoreValue(); - /// Returns the internal parent wiget control, that can be shown anywhere - /// \returns the widget QWidget* getControl() const; - /// Returns list of widget controls - /// \return a control list virtual QList getControls() const; /// Returns true if a file on the current path in the line edit @@ -48,18 +58,30 @@ class MODULEBASE_EXPORT ModuleBase_WidgetFileSelector : public ModuleBase_ModelW bool isCurrentPathValid(); public slots: + /// Processing of path selection button press void onPathSelectionBtn(); + + /// Processing of path changing void onPathChanged(); protected: + /// Returns string containing formats QString formatsString() const; + + /// Return list of validator formats QStringList getValidatorFormats() const; private: + /// A control for path input QLineEdit* myPathField; + + /// Container QWidget* myMainWidget; + /// A title of open file dialog box QString myTitle; + + /// Default path QString myDefaultPath; }; diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.h b/src/ModuleBase/ModuleBase_WidgetLabel.h index 3fbf7e883..c3489952e 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabel.h +++ b/src/ModuleBase/ModuleBase_WidgetLabel.h @@ -12,10 +12,17 @@ class QLabel; +/** +* Implementation of model widget for a label control +*/ class MODULEBASE_EXPORT ModuleBase_WidgetLabel : public ModuleBase_ModelWidget { Q_OBJECT public: + /// Constructor + /// \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_WidgetLabel(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); @@ -43,6 +50,7 @@ Q_OBJECT virtual bool focusTo() { return false; } private: + /// A label control QLabel* myLabel; }; diff --git a/src/ModuleBase/ModuleBase_WidgetLineEdit.h b/src/ModuleBase/ModuleBase_WidgetLineEdit.h index 09d02fae3..0e47acbb8 100644 --- a/src/ModuleBase/ModuleBase_WidgetLineEdit.h +++ b/src/ModuleBase/ModuleBase_WidgetLineEdit.h @@ -20,34 +20,40 @@ class QWidget; class QLineEdit; +/** +* Implementation of model widget for line edit widget. +* It can be defined with "stringvalue" keyword. +*/ class MODULEBASE_EXPORT ModuleBase_WidgetLineEdit : public ModuleBase_ModelWidget { Q_OBJECT public: + /// Constructor + /// \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_WidgetLineEdit(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); virtual ~ModuleBase_WidgetLineEdit(); - /// Saves the internal parameters to the given feature - /// \param theObject a model feature to be changed virtual bool storeValue() const; virtual bool restoreValue(); - /// Returns the internal parent wiget control, that can be shown anywhere - /// \returns the widget QWidget* getControl() const; - /// Returns list of widget controls - /// \return a control list virtual QList getControls() const; public slots: + /// A slot for processing text changed event void onTextChanged(); private: + /// A line edit control QLineEdit* myLineEdit; + + /// A container widget QWidget* myMainWidget; }; diff --git a/src/NewGeom/NewGeom_OCCSelector.h b/src/NewGeom/NewGeom_OCCSelector.h index e086444f0..59a3ee0a6 100644 --- a/src/NewGeom/NewGeom_OCCSelector.h +++ b/src/NewGeom/NewGeom_OCCSelector.h @@ -7,14 +7,23 @@ #include +/** +* Redefinition of standard OCC selector in order to adapt it to NewGeom needs +*/ class NewGeom_EXPORT NewGeom_OCCSelector : public LightApp_OCCSelector { public: + /// Constructor + /// \param theViewer a viewer + /// \param theMgr a selection manager NewGeom_OCCSelector(OCCViewer_Viewer* theViewer, SUIT_SelectionMgr* theMgr); virtual ~NewGeom_OCCSelector(); protected: + /// Redifinition of virtual function virtual void getSelection(SUIT_DataOwnerPtrList& theList) const; + + /// Redifinition of virtual function virtual void setSelection(const SUIT_DataOwnerPtrList& theList); }; diff --git a/src/NewGeom/NewGeom_SalomeViewer.h b/src/NewGeom/NewGeom_SalomeViewer.h index 7ac8ea6a3..0377ce7e0 100644 --- a/src/NewGeom/NewGeom_SalomeViewer.h +++ b/src/NewGeom/NewGeom_SalomeViewer.h @@ -19,10 +19,15 @@ class NewGeom_OCCSelector; class OCCViewer_Viewer; class SUIT_ViewManager; - +/** +* A class for providing access of NewGeom functionality to +* SALOME view window functionality +*/ class NewGeom_SalomeView: public ModuleBase_IViewWindow { public: + /// Constructor + /// \param theViewer a reference to a viewer NewGeom_SalomeView(OCCViewer_Viewer* theViewer) { myViewer = theViewer; } virtual Handle(V3d_View) v3dView() const; @@ -31,14 +36,21 @@ public: OCCViewer_Viewer* viewer() const { return myViewer; } private: + /// A reference to a viewer OCCViewer_Viewer* myViewer; }; +/** +* A class for providing access of NewGeom functionality to +* SALOME viewer functionality +*/ class NewGeom_SalomeViewer : public ModuleBase_IViewer { Q_OBJECT public: + /// Constructor + /// \param theParent a parent object NewGeom_SalomeViewer(QObject* theParent); ~NewGeom_SalomeViewer(); diff --git a/src/XGUI/XGUI_ErrorDialog.h b/src/XGUI/XGUI_ErrorDialog.h index 9a5ca5803..b442effba 100644 --- a/src/XGUI/XGUI_ErrorDialog.h +++ b/src/XGUI/XGUI_ErrorDialog.h @@ -15,18 +15,35 @@ class QTextEdit; +/** +* A class of dialog to show error message +*/ class XGUI_ErrorDialog : public QDialog { Q_OBJECT public: + /// Constructor + /// \param parent a parent widget XGUI_EXPORT XGUI_ErrorDialog(QWidget* parent);XGUI_EXPORT virtual ~XGUI_ErrorDialog(); public slots: - XGUI_EXPORT void refresh();XGUI_EXPORT void clear();XGUI_EXPORT void addError(const QString&);XGUI_EXPORT void removeError( - const QString&); + /// Update dialog box + XGUI_EXPORT void refresh(); + + /// Clear messages + XGUI_EXPORT void clear(); + + /// Add error message + XGUI_EXPORT void addError(const QString&); + + /// Remove error message + XGUI_EXPORT void removeError(const QString&); private: + /// Widget for error log QTextEdit* myErrorLog; + + /// List of errors QStringList myErrors; }; diff --git a/src/XGUI/XGUI_QtEvents.h b/src/XGUI/XGUI_QtEvents.h index 7aa6fc34f..f7c2211bd 100644 --- a/src/XGUI/XGUI_QtEvents.h +++ b/src/XGUI/XGUI_QtEvents.h @@ -18,24 +18,33 @@ #include #include +/** +* Class of event to send application events in multi thread environment +*/ class XGUI_EXPORT PostponeMessageQtEvent : public QEvent { public: static QEvent::Type PostponeMessageQtEventType; + /// Constructor + /// \param theMessage an event message to send PostponeMessageQtEvent(const std::shared_ptr& theMessage) : QEvent(PostponeMessageQtEventType), myMessage(theMessage) { } + + /// Returns type of the event static QEvent::Type type() { return PostponeMessageQtEventType; } + /// Returns current messasge std::shared_ptr postponedMessage(); private: + /// Message std::shared_ptr myMessage; }; -- 2.39.2