From 331af9b7eb4feddf17c37fe2ce1f0f046f522145 Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 27 Jan 2015 10:19:55 +0300 Subject: [PATCH] Code documentation update --- src/Config/Config_AttributeMessage.h | 2 + src/Config/Config_FeatureMessage.h | 2 + src/ModuleBase/ModuleBase_DoubleSpinBox.cpp | 12 ++--- src/ModuleBase/ModuleBase_DoubleSpinBox.h | 22 ++++++++- src/ModuleBase/ModuleBase_Filter.h | 4 +- src/ModuleBase/ModuleBase_FilterFace.h | 6 +++ src/ModuleBase/ModuleBase_FilterLinearEdge.h | 6 +++ src/ModuleBase/ModuleBase_FilterMulti.h | 3 +- .../ModuleBase_FilterNoConsructionSubShapes.h | 3 ++ src/ModuleBase/ModuleBase_FilterShapeType.h | 8 +++- src/ModuleBase/ModuleBase_IModule.h | 44 ++++++----------- src/ModuleBase/ModuleBase_IViewer.h | 28 +++++++++++ src/ModuleBase/ModuleBase_IWorkshop.h | 4 ++ .../ModuleBase_OperationDescription.h | 29 ++++-------- src/ModuleBase/ModuleBase_Preferences.h | 12 ++++- .../ModuleBase_SelectionValidator.h | 6 +-- src/ModuleBase/ModuleBase_ViewerFilters.h | 21 +++++++++ .../ModuleBase_WidgetMultiSelector.h | 47 ++++++++++++++++++- src/XGUI/XGUI_Displayer.h | 2 +- 19 files changed, 195 insertions(+), 66 deletions(-) diff --git a/src/Config/Config_AttributeMessage.h b/src/Config/Config_AttributeMessage.h index 160efa7e8..9272a7b6e 100644 --- a/src/Config/Config_AttributeMessage.h +++ b/src/Config/Config_AttributeMessage.h @@ -12,7 +12,9 @@ /*! * \class Config_AttributeMessage * \brief Class to pass an attribute's (widget's) entry info extracted from xml file. + * \code * + * \endcode */ class Config_AttributeMessage : public Events_Message { diff --git a/src/Config/Config_FeatureMessage.h b/src/Config/Config_FeatureMessage.h index f890f44c3..28ae49c38 100644 --- a/src/Config/Config_FeatureMessage.h +++ b/src/Config/Config_FeatureMessage.h @@ -12,7 +12,9 @@ * \class Config_FeatureMessage * \brief Class to pass a feature entry extracted from xml file. * Example of the feature entry: + * \code * + * \endcode */ class Config_FeatureMessage : public Events_Message { diff --git a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp index 683d21578..a8489408d 100644 --- a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp @@ -52,10 +52,11 @@ const double PSEUDO_ZERO = 1.e-20; a step value of 1.0 and a precision of 2 decimal places. The value is initially set to 0.00. - \param parent parent object + \param theParent parent object + \param thePrecision precision of values input */ -ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* parent, int thePrecision) - : QDoubleSpinBox(parent), +ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* theParent, int thePrecision) + : QDoubleSpinBox(theParent), myCleared(false) { // VSR 01/07/2010: Disable thousands separator for spin box @@ -165,7 +166,7 @@ QString ModuleBase_DoubleSpinBox::textFromValue(double val) const /*! \brief Return source string with removed leading and trailing zeros. - \param str source string + \param src source string \return resulting string */ QString ModuleBase_DoubleSpinBox::removeTrailingZeroes(const QString& src) const @@ -300,9 +301,8 @@ QValidator::State ModuleBase_DoubleSpinBox::validate(QString& str, int& pos) con /*! \brief Called when user enters the text in the spin box. - \param txt current spin box text (not used) */ -void ModuleBase_DoubleSpinBox::onTextChanged(const QString& /*txt*/) +void ModuleBase_DoubleSpinBox::onTextChanged(const QString& ) { myCleared = false; } diff --git a/src/ModuleBase/ModuleBase_DoubleSpinBox.h b/src/ModuleBase/ModuleBase_DoubleSpinBox.h index b8d8c2bea..5eb2d976e 100644 --- a/src/ModuleBase/ModuleBase_DoubleSpinBox.h +++ b/src/ModuleBase/ModuleBase_DoubleSpinBox.h @@ -11,35 +11,55 @@ #include #include + +/** +* An extension and customozation of QDoubleSpinBox class +*/ class MODULEBASE_EXPORT ModuleBase_DoubleSpinBox : public QDoubleSpinBox { Q_OBJECT public: - ModuleBase_DoubleSpinBox(QWidget* = 0, int thePrecision = 6); + ModuleBase_DoubleSpinBox(QWidget* theParent = 0, int thePrecision = 6); virtual ~ModuleBase_DoubleSpinBox(); + /// Returns true if the control is clear bool isCleared() const; + + /// Set control clear virtual void setCleared(const bool); + /// Returns current precision int getPrecision() const; + + /// Set precision void setPrecision(const int); + /// Set step virtual void stepBy(int); + /// Converts value from string to double virtual double valueFromText(const QString&) const; + + /// Convert value from double to string virtual QString textFromValue(double) const; + /// Validate current value virtual QValidator::State validate(QString&, int&) const; protected slots: + /// Called on text changed virtual void onTextChanged(const QString&); protected: + /// Removes extra trailing zero symbols QString removeTrailingZeroes(const QString&) const; private: + /// Is clear flag bool myCleared; + + /// Precision value int myPrecision; }; diff --git a/src/ModuleBase/ModuleBase_Filter.h b/src/ModuleBase/ModuleBase_Filter.h index 7b1f63d1e..4b684e272 100644 --- a/src/ModuleBase/ModuleBase_Filter.h +++ b/src/ModuleBase/ModuleBase_Filter.h @@ -24,6 +24,7 @@ class ModuleBase_Filter { public: + /// Constructor MODULEBASE_EXPORT ModuleBase_Filter() {} /** @@ -45,7 +46,8 @@ protected: virtual void createFilter() = 0; protected: - Handle(SelectMgr_Filter) myFilter; // current instance of the OCC selection filter + /// current instance of the OCC selection filter + Handle(SelectMgr_Filter) myFilter; }; #endif //ModuleBase_Filter diff --git a/src/ModuleBase/ModuleBase_FilterFace.h b/src/ModuleBase/ModuleBase_FilterFace.h index 4e6919a37..c73f602f1 100644 --- a/src/ModuleBase/ModuleBase_FilterFace.h +++ b/src/ModuleBase/ModuleBase_FilterFace.h @@ -13,11 +13,17 @@ #include +/** +* A class of a viewer filter by faces +*/ class ModuleBase_FilterFace: public ModuleBase_Filter { public: + /// Convert string to StdSelect_TypeOfFace value + /// \param theType a string value static MODULEBASE_EXPORT StdSelect_TypeOfFace faceType(const std::string& theType); + /// Constructor MODULEBASE_EXPORT ModuleBase_FilterFace(): ModuleBase_Filter() {} diff --git a/src/ModuleBase/ModuleBase_FilterLinearEdge.h b/src/ModuleBase/ModuleBase_FilterLinearEdge.h index cdfa8e435..10bc1d32e 100644 --- a/src/ModuleBase/ModuleBase_FilterLinearEdge.h +++ b/src/ModuleBase/ModuleBase_FilterLinearEdge.h @@ -13,11 +13,17 @@ #include +/** +* A class of a viewer filter by linear edges +*/ class ModuleBase_FilterLinearEdge: public ModuleBase_Filter { public: + /// Convert string to StdSelect_TypeOfFace value + /// \param theType a string value static MODULEBASE_EXPORT StdSelect_TypeOfEdge edgeType(const std::string& theType); + /// Constructor MODULEBASE_EXPORT ModuleBase_FilterLinearEdge(): ModuleBase_Filter() {} diff --git a/src/ModuleBase/ModuleBase_FilterMulti.h b/src/ModuleBase/ModuleBase_FilterMulti.h index 2d5b7edaa..9a69d59ba 100644 --- a/src/ModuleBase/ModuleBase_FilterMulti.h +++ b/src/ModuleBase/ModuleBase_FilterMulti.h @@ -43,7 +43,8 @@ protected: virtual void createFilter(); protected: - std::list myArguments; /// the filter arguments + /// the filter arguments + std::list myArguments; }; #endif //ModuleBase_FilterMulti diff --git a/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h b/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h index 49b112799..d70bfa6ce 100644 --- a/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h +++ b/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h @@ -24,6 +24,8 @@ DEFINE_STANDARD_HANDLE(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter class ModuleBase_FilterNoConsructionSubShapes: public SelectMgr_Filter { public: + /// Constructor + /// \param theWorkshop instance of workshop interface Standard_EXPORT ModuleBase_FilterNoConsructionSubShapes(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(), myWorkshop(theWorkshop) {} @@ -38,6 +40,7 @@ public: DEFINE_STANDARD_RTTI(ModuleBase_FilterNoConsructionSubShapes) protected: + /// Instance of workshop interface ModuleBase_IWorkshop* myWorkshop; }; diff --git a/src/ModuleBase/ModuleBase_FilterShapeType.h b/src/ModuleBase/ModuleBase_FilterShapeType.h index 2b20a2965..9cf3208eb 100644 --- a/src/ModuleBase/ModuleBase_FilterShapeType.h +++ b/src/ModuleBase/ModuleBase_FilterShapeType.h @@ -13,9 +13,14 @@ #include +/** +* A class of a viewer filter by shape type +*/ class ModuleBase_FilterShapeType: public ModuleBase_Filter { public: + /// Constructor + /// \param theType type of shape static MODULEBASE_EXPORT TopAbs_ShapeEnum shapeType(const std::string& theType); MODULEBASE_EXPORT ModuleBase_FilterShapeType(); @@ -33,7 +38,8 @@ protected: virtual void createFilter(); private: - TopAbs_ShapeEnum myShapeType; /// the shape type of the filter + /// the shape type of the filter + TopAbs_ShapeEnum myShapeType; }; #endif //ModuleBase_FilterShapeType diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h index 5703bb3c0..29cdc430d 100644 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -30,6 +30,8 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject Q_OBJECT public: + /// Constructor + /// \param theParent instance of workshop intrface ModuleBase_IModule(ModuleBase_IWorkshop* theParent); virtual ~ModuleBase_IModule() {} @@ -40,7 +42,8 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// Called on creation of menu item in desktop virtual void actionCreated(QAction*); - /// Called when user selects feature for editing + /// Launching of a edit operation on the feature + /// \param theFeature feature for editing virtual void editFeature(FeaturePtr theFeature); /// Creates an operation and send it to loop @@ -64,10 +67,12 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// Realizes some functionality by an operation abort virtual void operationAborted(ModuleBase_Operation* theOperation) {} - /// Called when it is necessary to update a command state (enable or disable it) - //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0; - /// Creates custom widgets for property panel + /// \param theType a type of widget + /// \param theParent the parent object + /// \param theWidgetApi the widget configuation. The attribute of the model widget is obtained from + /// \param theParentId is Id of a parent of the current attribute + /// \param theModelWidgets list of widget objects virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent, Config_WidgetAPI* theWidgetApi, std::string theParentId, QList& theModelWidgets) @@ -75,6 +80,7 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject return 0; } + /// Returns current workshop ModuleBase_IWorkshop* workshop() const { return myWorkshop; } /// Call back forlast tuning of property panel before operation performance @@ -82,35 +88,13 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject virtual void propertyPanelDefined(ModuleBase_Operation* theOperation) {} public slots: + /// Called on call of command corresponded to a feature void onFeatureTriggered(); protected slots: /// Called on selection changed event virtual void onSelectionChanged() {} - /// SLOT, that is called by mouse press in the viewer. - /// The mouse released point is sent to the current operation to be processed. - /// \param theEvent the mouse event - //virtual void onMousePressed(QMouseEvent* theEvent) {} - - /// SLOT, that is called by mouse release in the viewer. - /// The mouse released point is sent to the current operation to be processed. - /// \param theEvent the mouse event - //virtual void onMouseReleased(QMouseEvent* theEvent) {} - - /// SLOT, that is called by mouse move in the viewer. - /// The mouse moved point is sent to the current operation to be processed. - /// \param theEvent the mouse event - //virtual void onMouseMoved(QMouseEvent* theEvent) {} - - /// SLOT, that is called by the mouse double click in the viewer. - /// \param theEvent the mouse event - //virtual void onMouseDoubleClick(QMouseEvent* theEvent) {} - - /// SLOT, that is called by the key in the viewer is clicked. - /// \param theEvent the mouse event - //virtual void onKeyRelease(QKeyEvent* theEvent) {} - protected: /// Sends the operation for launching /// \param theOperation the operation @@ -118,8 +102,7 @@ protected slots: /// Creates a new operation /// \param theCmdId the operation name - /// \param theFeatureKind a kind of feature to get the feature xml description - virtual ModuleBase_Operation* createOperation(const std::string& theFeatureId); + virtual ModuleBase_Operation* createOperation(const std::string& theCmdId); /// Register validators for this module virtual void registerValidators() {} @@ -132,7 +115,10 @@ protected slots: protected: + /// Reference to workshop ModuleBase_IWorkshop* myWorkshop; + + /// Map of features in XML std::map myFeaturesInFiles; }; diff --git a/src/ModuleBase/ModuleBase_IViewer.h b/src/ModuleBase/ModuleBase_IViewer.h index 33205b817..c84a7d058 100644 --- a/src/ModuleBase/ModuleBase_IViewer.h +++ b/src/ModuleBase/ModuleBase_IViewer.h @@ -21,6 +21,8 @@ class MODULEBASE_EXPORT ModuleBase_IViewer : public QObject { Q_OBJECT public: + /// Constructor + /// \param theParent a parent object ModuleBase_IViewer(QObject* theParent) : QObject(theParent) { @@ -36,12 +38,14 @@ Q_OBJECT virtual Handle(V3d_View) activeView() const = 0; //! Enable or disable selection in the viewer + //! \param isEnabled is enable or disable flag virtual void enableSelection(bool isEnabled) = 0; //! Returns true if selection is enabled virtual bool isSelectionEnabled() const = 0; //! Enable or disable multiselection in the viewer + //! \param isEnable is enable or disable flag virtual void enableMultiselection(bool isEnable) = 0; //! Returns true if multiselection is enabled @@ -57,9 +61,11 @@ Q_OBJECT virtual void setViewProjection(double theX, double theY, double theZ) = 0; /// Add selection filter to the viewer + /// \param theFilter a selection filter virtual void addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0; /// Remove selection filter from the viewer + /// \param theFilter a selection filter virtual void removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter) = 0; /// Remove all selection filters from the viewer @@ -69,21 +75,43 @@ Q_OBJECT virtual void update() = 0; signals: + /// Signal emited when last view window is closed void lastViewClosed(); + + /// Signal emited before view window is closed void tryCloseView(ModuleBase_IViewWindow* theWnd); + + /// Signal emited on delete view window void deleteView(ModuleBase_IViewWindow* theWnd); + + /// Signal emited on creation of view window void viewCreated(ModuleBase_IViewWindow* theWnd); + + /// Signal emited on key release void activated(ModuleBase_IViewWindow* theWnd); + /// Signal emited on mouse press void mousePress(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + + /// Signal emited on mouse release void mouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + + /// Signal emited on mouse double click void mouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + + /// Signal emited on mouse move void mouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + /// Signal emited on key press void keyPress(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent); + + /// Signal emited on key release void keyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent); + /// Signal emited on selection changed void selectionChanged(); + + /// Signal emited on selection changed void contextMenuRequested(QContextMenuEvent*); }; diff --git a/src/ModuleBase/ModuleBase_IWorkshop.h b/src/ModuleBase/ModuleBase_IWorkshop.h index 3679e30d2..e755062f6 100644 --- a/src/ModuleBase/ModuleBase_IWorkshop.h +++ b/src/ModuleBase/ModuleBase_IWorkshop.h @@ -28,6 +28,8 @@ class MODULEBASE_EXPORT ModuleBase_IWorkshop : public QObject { Q_OBJECT public: + /// Constructor + /// \param theParent parent object ModuleBase_IWorkshop(QObject* theParent) : QObject(theParent) {} @@ -35,6 +37,7 @@ Q_OBJECT virtual ~ModuleBase_IWorkshop() {} + /// Return current selection instance virtual ModuleBase_ISelection* selection() const = 0; /// Activate sub-shapes selection (opens local context) @@ -70,6 +73,7 @@ Q_OBJECT virtual void setSelected(const QObjectPtrList& theFeatures) = 0; signals: + /// Signal selection chaged. void selectionChanged(); /// Signal which is emited after activation of property panel diff --git a/src/ModuleBase/ModuleBase_OperationDescription.h b/src/ModuleBase/ModuleBase_OperationDescription.h index bd9f52551..65c87285d 100644 --- a/src/ModuleBase/ModuleBase_OperationDescription.h +++ b/src/ModuleBase/ModuleBase_OperationDescription.h @@ -23,7 +23,7 @@ /*! * \class ModuleBase_OperationDescription - * + * Description of operation from XML */ class MODULEBASE_EXPORT ModuleBase_OperationDescription { @@ -38,10 +38,6 @@ class MODULEBASE_EXPORT ModuleBase_OperationDescription /// \return string name of the operation. const QString& operationId() const; - /// Returns XML representation of the operation's widget. - /// \return XML QString - //const QString& xmlRepresentation() const; - /// Returns a short description of operation (will be /// inserted in title of property panel) const QString& description() const; @@ -50,15 +46,6 @@ class MODULEBASE_EXPORT ModuleBase_OperationDescription /// inserted in title of property panel) void setDescription(const QString& theDescription); - /// Sets a list of model widgets, according to the operation feature xml definition - /// \param theWidgets a list of widgets - //void setModelWidgets(const std::string& theXmlRepresentation, - // const QList& theWidgets); - - /// Sets a list of model widgets, according to the operation feature xml definition - /// \param theWidgets a list of widgets - //const QList& modelWidgets() const; - /// Returns XML representation of the operation's widget. /// \return XML QString const QString& xmlRepresentation() const; @@ -73,10 +60,14 @@ class MODULEBASE_EXPORT ModuleBase_OperationDescription private: //!< Next fields could be extracted into a subclass; - QString myOperationId; /// the operation identifier - QString myDescription; /// the short description of the opertaion - QString myXmlRepresentation; /// the xml definition - //QList myWidgets; /// the list of operation widgets + /// the operation identifier + QString myOperationId; + + /// the short description of the opertaion + QString myDescription; + + /// the xml definition + QString myXmlRepresentation; }; -#endif //ModuleBase_OperationDescription_H \ No newline at end of file +#endif //ModuleBase_OperationDescription_H diff --git a/src/ModuleBase/ModuleBase_Preferences.h b/src/ModuleBase/ModuleBase_Preferences.h index e04c63bbc..b7783c09d 100644 --- a/src/ModuleBase/ModuleBase_Preferences.h +++ b/src/ModuleBase/ModuleBase_Preferences.h @@ -16,8 +16,10 @@ class SUIT_ResourceMgr; class QWidget; -// Pair of values: section name, value name +/// \typedef ModuleBase_Pref Pair of values: section name, value name typedef QPair ModuleBase_Pref; + +/// \typedef ModuleBase_Prefs list of preferences typedef QList ModuleBase_Prefs; //*********************************************************************** @@ -35,6 +37,7 @@ class MODULEBASE_EXPORT ModuleBase_Preferences /// Sets a resource manager /// It is used in case of necessity to define external resource manager (not NewGeom) + /// \param theMgr resource manager static void setResourceMgr(SUIT_ResourceMgr* theMgr) { myResourceMgr = theMgr; } /// Updates Config_PropManager properties by module from SUIT_ResourceMgr @@ -50,7 +53,9 @@ class MODULEBASE_EXPORT ModuleBase_Preferences /// Loads properties defined by module to Config_PropManager static void loadCustomProps(); - /// + /// Create editable content + /// \param thePref interface to preference manager + /// \param thePage an id of a page static void createEditContent(ModuleBase_IPrefMgr* thePref, int thePage); private: @@ -66,6 +71,9 @@ class MODULEBASE_EXPORT ModuleBase_PreferencesMgr : public SUIT_PreferenceMgr { Q_OBJECT public: + /// Constructor + /// \param theResource resource manager + /// \param theParent a paren widget ModuleBase_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent) : SUIT_PreferenceMgr(theResource, theParent) { diff --git a/src/ModuleBase/ModuleBase_SelectionValidator.h b/src/ModuleBase/ModuleBase_SelectionValidator.h index 4863146bc..045e730e2 100644 --- a/src/ModuleBase/ModuleBase_SelectionValidator.h +++ b/src/ModuleBase/ModuleBase_SelectionValidator.h @@ -16,16 +16,16 @@ #include /** -* \class A validator of selection +* A validator of selection */ class ModuleBase_SelectionValidator : public ModelAPI_Validator { public: - /// \fn Returns True if selection is valid + /// Returns True if selection is valid /// \param theSelection selection instance virtual bool isValid(const ModuleBase_ISelection* theSelection) const = 0; - /// \fn Returns True if selection is valid + /// Returns True if selection is valid /// \param theSelection selection instance /// \param theArguments list of arguments virtual bool isValid(const ModuleBase_ISelection* theSelection, diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.h b/src/ModuleBase/ModuleBase_ViewerFilters.h index 708eb9e03..0b3493094 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.h +++ b/src/ModuleBase/ModuleBase_ViewerFilters.h @@ -27,14 +27,19 @@ DEFINE_STANDARD_HANDLE(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter); class ModuleBase_ShapeDocumentFilter: public SelectMgr_Filter { public: + /// Constructor + /// \param theWorkshop instance of workshop interface Standard_EXPORT ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(), myWorkshop(theWorkshop) {} + /// Returns True if the given owner is acceptable for selection + /// \param theOwner the selected owner Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; DEFINE_STANDARD_RTTI(ModuleBase_ShapeDocumentFilter) protected: + /// Reference to workshop ModuleBase_IWorkshop* myWorkshop; }; @@ -46,15 +51,23 @@ DEFINE_STANDARD_HANDLE(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter); class ModuleBase_ShapeInPlaneFilter: public SelectMgr_Filter { public: + /// Constructor Standard_EXPORT ModuleBase_ShapeInPlaneFilter(): SelectMgr_Filter() {} + /// Set working plane + /// \param thePane plane object void setPlane(const gp_Pln& thePane) { myPlane = thePane; } + + /// Returns current working plane gp_Pln plane() const { return myPlane; } + /// Returns True if the given owner is acceptable for selection + /// \param theOwner the selected owner Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; DEFINE_STANDARD_RTTI(ModuleBase_ShapeInPlaneFilter) private: + /// Working plane gp_Pln myPlane; }; @@ -62,18 +75,26 @@ private: /** * 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: +* - "construction" - to select ModelAPI_ResultConstruction objects */ DEFINE_STANDARD_HANDLE(ModuleBase_ObjectTypesFilter, SelectMgr_Filter); class ModuleBase_ObjectTypesFilter: public ModuleBase_ShapeDocumentFilter { public: + /// Constructor + /// \param theWorkshop instance of workshop interface + /// \param theTypes list of object types Standard_EXPORT ModuleBase_ObjectTypesFilter(ModuleBase_IWorkshop* theWorkshop, const QStringList& theTypes): ModuleBase_ShapeDocumentFilter(theWorkshop), myTypes(theTypes) {} + /// Returns True if the given owner is acceptable for selection + /// \param theOwner the selected owner Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; DEFINE_STANDARD_RTTI(ModuleBase_ObjectTypesFilter) private: + /// List of object types QStringList myTypes; }; diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index bf8f8841a..66ef0bc87 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -31,10 +31,29 @@ class QComboBox; class ModuleBase_IWorkshop; class QAction; + +/** +* Implementation of widget for shapes selection. This widget provides selection of several shapes. +* It can be defined in XML file as following: +* \code +* +* \endcode +* It uses folloing parameters: +* - id - is a name of corresponded attribute +* - tooltip - a tooltip for the widget +* - type_choice - list of expected shape types. +*/ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_ModelWidget { Q_OBJECT public: + /// Constructor + /// \param theParent the parent object + /// \param theWorkshop instance of workshop interface + /// \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_WidgetMultiSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData, @@ -42,7 +61,6 @@ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_Model virtual ~ModuleBase_WidgetMultiSelector(); /// Saves the internal parameters to the given feature - /// \param theObject a model feature to be changed virtual bool storeValue() const; virtual bool restoreValue(); @@ -55,28 +73,49 @@ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_Model /// \return a control list virtual QList getControls() const; - virtual bool eventFilter(QObject* theObj, QEvent* theEvent); + virtual bool eventFilter(QObject* , QEvent* ); public slots: + /// Activate or deactivate selection void activateSelection(bool toActivate); + + /// Slot is called on selection type changed void onSelectionTypeChanged(); + + /// Slot is called on selection changed void onSelectionChanged(); protected slots: + /// Slot for copy command in a list pop-up menu void onCopyItem(); + + /// Slot is called on selection of list of selected items void onListSelection(); protected: + /// Provide filtering of selected shapes + /// \param theShapesToFilter source list of shapes + /// \param theResult result list of shapes void filterShapes(const NCollection_List& theShapesToFilter, NCollection_List& theResult); + + /// Set current shape type for selection void setCurrentShapeType(const TopAbs_ShapeEnum theShapeType); + + /// Start shape selection void activateShapeSelection(); private: + /// Update selection list void updateSelectionList(AttributeSelectionListPtr); + /// List control QListWidget* myListControl; + + /// Combobox of types QComboBox* myTypeCombo; + + /// Container QWidget* myMainWidget; //TODO: Move into the base of selectors @@ -85,9 +124,13 @@ protected slots: /// If true then local selector has to be activated in context bool myIsActive; + /// \typedef GeomSelection provides correspondance between Result object and its shape typedef QPair GeomSelection; + + /// Variable of GeomSelection type QList mySelection; + /// An action for pop-up menu in a list control QAction* myCopyAction; }; diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index 09a880ecf..b917e55eb 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -35,7 +35,7 @@ class XGUI_Workshop; class XGUI_EXPORT XGUI_Displayer { public: - /// \enum display mode + /// \enum DisplayMode display mode enum DisplayMode { /// Mode is not defined NoMode = -1, -- 2.39.2