From 537afa7e604c3b071def66b40f00a04cb74261de Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 28 Jan 2015 17:33:33 +0300 Subject: [PATCH] Update code documentation --- src/ModuleBase/ModuleBase_ViewerPrs.h | 17 ++-- src/NewGeom/NewGeom_SalomeViewer.h | 7 ++ src/PartSet/CMakeLists.txt | 2 - src/PartSet/PartSet_EditLine.cpp | 50 ---------- src/PartSet/PartSet_EditLine.h | 64 ------------ src/PartSet/PartSet_Filters.h | 6 ++ src/PartSet/PartSet_Module.h | 31 ++---- src/PartSet/PartSet_Operation.cpp | 19 ---- src/PartSet/PartSet_Operation.h | 32 ------ src/PartSet/PartSet_SketcherMgr.h | 11 ++- src/PartSet/PartSet_Tools.h | 24 +++-- src/PartSet/PartSet_Validators.h | 20 +++- src/PartSet/PartSet_WidgetPoint2d.h | 38 ++++++-- src/PartSet/PartSet_WidgetPoint2dDistance.h | 40 ++++++-- src/PartSet/PartSet_WidgetShapeSelector.h | 33 ++++++- src/PartSet/PartSet_WidgetSketchLabel.h | 28 +++++- src/XGUI/XGUI_ContextMenuMgr.h | 16 +++ src/XGUI/XGUI_DataTreeModel.h | 12 +++ src/XGUI/XGUI_DocumentDataModel.h | 48 ++++++++- src/XGUI/XGUI_ModuleConnector.h | 5 + src/XGUI/XGUI_OperationMgr.h | 14 ++- src/XGUI/XGUI_PartDataModel.h | 74 ++++++++++++-- src/XGUI/XGUI_QtEvents.h | 1 + src/XGUI/XGUI_SalomeConnector.h | 1 + src/XGUI/XGUI_SelectionMgr.h | 9 ++ src/XGUI/XGUI_Tools.h | 6 ++ src/XGUI/XGUI_ViewerProxy.h | 2 + src/XGUI/XGUI_Workshop.cpp | 22 ++--- src/XGUI/XGUI_Workshop.h | 103 +++++++++++++++++--- 29 files changed, 467 insertions(+), 268 deletions(-) delete mode 100644 src/PartSet/PartSet_EditLine.cpp delete mode 100644 src/PartSet/PartSet_EditLine.h delete mode 100644 src/PartSet/PartSet_Operation.cpp delete mode 100644 src/PartSet/PartSet_Operation.h diff --git a/src/ModuleBase/ModuleBase_ViewerPrs.h b/src/ModuleBase/ModuleBase_ViewerPrs.h index 6dec54b93..3a189d37b 100644 --- a/src/ModuleBase/ModuleBase_ViewerPrs.h +++ b/src/ModuleBase/ModuleBase_ViewerPrs.h @@ -29,7 +29,7 @@ class ModuleBase_ViewerPrs } /// Constructor - /// \param theFeature a model feature + /// \param theResult an object /// \param theShape a viewer shape /// \param theOwner a selection owner ModuleBase_ViewerPrs(ObjectPtr theResult, const TopoDS_Shape& theShape, @@ -45,8 +45,8 @@ class ModuleBase_ViewerPrs { } - /// Sets the feature. - /// \param theFeature a feature instance + /// Sets the object. + /// \param theResult an object instance void setFeature(ObjectPtr theResult) { myResult = theResult; @@ -59,8 +59,8 @@ class ModuleBase_ViewerPrs return myResult; } - /// Returns the presentation owner - /// \param the owner + /// Set the presentation owner + /// \param theOwner an owner to set void setOwner(Handle_SelectMgr_EntityOwner theOwner) { myOwner = theOwner; @@ -87,16 +87,21 @@ class ModuleBase_ViewerPrs return myShape; } + /// Set interactive object + /// \param theIO an interactive object void setInteractive(const Handle(AIS_InteractiveObject)& theIO) { myInteractive = theIO; } + /// Returns interactive object if it is installed Handle(AIS_InteractiveObject) interactive() const { return myInteractive; } + /// Returns True if the current object is equal to the given one + /// \param thePrs an object to compare bool operator==(const ModuleBase_ViewerPrs& thePrs) { bool aResult = (myResult.get() == thePrs.object().get()); @@ -110,7 +115,7 @@ class ModuleBase_ViewerPrs ObjectPtr myResult; /// the feature Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner TopoDS_Shape myShape; /// the shape - Handle(AIS_InteractiveObject) myInteractive; + Handle(AIS_InteractiveObject) myInteractive; /// interactive object }; #endif diff --git a/src/NewGeom/NewGeom_SalomeViewer.h b/src/NewGeom/NewGeom_SalomeViewer.h index 0377ce7e0..ca3675b9b 100644 --- a/src/NewGeom/NewGeom_SalomeViewer.h +++ b/src/NewGeom/NewGeom_SalomeViewer.h @@ -32,7 +32,11 @@ public: virtual Handle(V3d_View) v3dView() const; + /// Set the current viewer + /// \param theViewer a viewer instance void setViewer(OCCViewer_Viewer* theViewer) { myViewer = theViewer; } + + /// Returns current viewer OCCViewer_Viewer* viewer() const { return myViewer; } private: @@ -85,6 +89,8 @@ Q_OBJECT /// \param theZ the Z projection value virtual void setViewProjection(double theX, double theY, double theZ); + /// Set selector + /// \param theSel a selector instance void setSelector(NewGeom_OCCSelector* theSel); /// Add selection filter to the viewer @@ -96,6 +102,7 @@ Q_OBJECT /// Remove all selection filters from the viewer virtual void clearSelectionFilters(); + /// Returns current selector NewGeom_OCCSelector* selector() const { return mySelector; diff --git a/src/PartSet/CMakeLists.txt b/src/PartSet/CMakeLists.txt index 9f0f38e8b..8c0eff955 100644 --- a/src/PartSet/CMakeLists.txt +++ b/src/PartSet/CMakeLists.txt @@ -7,7 +7,6 @@ SET(CMAKE_AUTOMOC ON) SET(PROJECT_HEADERS PartSet.h PartSet_Constants.h - PartSet_EditLine.h PartSet_Module.h PartSet_Tools.h PartSet_WidgetSketchLabel.h @@ -20,7 +19,6 @@ SET(PROJECT_HEADERS ) SET(PROJECT_SOURCES - PartSet_EditLine.cpp PartSet_Module.cpp PartSet_Tools.cpp PartSet_WidgetSketchLabel.cpp diff --git a/src/PartSet/PartSet_EditLine.cpp b/src/PartSet/PartSet_EditLine.cpp deleted file mode 100644 index c063172b2..000000000 --- a/src/PartSet/PartSet_EditLine.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: PartSet_EditLine.h -// Created: 02 June 2014 -// Author: Natalia ERMOLAEVA - -#include - -#include - -PartSet_EditLine::PartSet_EditLine(QWidget* theParent) - : QObject(theParent) -{ - myEditor = new QLineEdit(theParent); - myEditor->setWindowFlags(Qt::ToolTip); - myEditor->setFocusPolicy(Qt::StrongFocus); - - connect(myEditor, SIGNAL(returnPressed()), this, SLOT(onStopEditing())); -} - -void PartSet_EditLine::start(const QPoint& thePoint, double theValue) -{ - myEditor->move(thePoint); - myEditor->setText(QString::number(theValue)); - myEditor->show(); - - myEditor->selectAll(); - myEditor->setFocus(); -} - -bool PartSet_EditLine::isStarted() const -{ - return myEditor->isVisible(); -} - -void PartSet_EditLine::stop() -{ - myEditor->hide(); -} - -double PartSet_EditLine::getValue() const -{ - return myEditor->text().toDouble(); -} - -void PartSet_EditLine::onStopEditing() -{ - stop(); - emit stopped(getValue()); -} diff --git a/src/PartSet/PartSet_EditLine.h b/src/PartSet/PartSet_EditLine.h deleted file mode 100644 index cf85b78d3..000000000 --- a/src/PartSet/PartSet_EditLine.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: PartSet_EditLine.h -// Created: 02 Jun 2014 -// Author: Natalia ERMOLAEVA - -#ifndef PartSet_EditLine_H -#define PartSet_EditLine_H - -#include "PartSet.h" - -#include -#include - -class QLineEdit; -class QWidget; - -/*! - \class PartSet_EditLine - * \brief The class to give an editor to modify a real value - */ -class PARTSET_EXPORT PartSet_EditLine : public QObject -{ -Q_OBJECT - public: - /// Constructor - PartSet_EditLine(QWidget* theParent); - /// Destructor - virtual ~PartSet_EditLine() - { - } - ; - - /// Show the editor in the given global position - /// \param thePoint a position - /// \param theValue a value for the editor - void start(const QPoint& thePoint, double theValue); - - /// Checks whether the editor is started - /// \returns true if the editor is activated - bool isStarted() const; - - /// Stop the editor, in other words hide it - void stop(); - -signals: - /// Signals about the editing stop - /// \param theValue the editor value - void stopped(double theValue); - - protected: - /// Returns the editor value - /// \return the real value - double getValue() const; - - protected slots: - /// Slot to check the editing stop - void onStopEditing(); - - protected: - QLineEdit* myEditor; /// the value editor -}; - -#endif diff --git a/src/PartSet/PartSet_Filters.h b/src/PartSet/PartSet_Filters.h index 56a34e531..1eac11c7b 100644 --- a/src/PartSet/PartSet_Filters.h +++ b/src/PartSet/PartSet_Filters.h @@ -11,15 +11,21 @@ /** +* \class PartSet_GlobalFilter +* \ingroup Module * A class which filters groups object in addition to documents (see issue #310) */ DEFINE_STANDARD_HANDLE(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter); class PartSet_GlobalFilter: public ModuleBase_ShapeDocumentFilter { public: + /// Constructor + /// \param theWorkshop a pointer to workshop PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop) : ModuleBase_ShapeDocumentFilter(theWorkshop) {} + /// Returns True if selected presentation can be selected + /// \param theOwner an owner of the persentation Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; DEFINE_STANDARD_RTTI(PartSet_GlobalFilter) diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 9723d53e3..529553713 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -26,6 +26,10 @@ class ModuleBase_Operation; class ModuleBase_IViewWindow; +/** +* \ingroup Module +* Implementation of Partset module +*/ class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule { Q_OBJECT @@ -39,6 +43,8 @@ enum RestartingMode { }; public: + /// Constructor + /// \param theWshop a pointer to a workshop PartSet_Module(ModuleBase_IWorkshop* theWshop); virtual ~PartSet_Module(); @@ -80,28 +86,8 @@ protected slots: /// Called when previous operation is finished virtual void onSelectionChanged(); - /// SLOT, that is called by mouse press in the viewer. - /// \param theWnd - the window where the event happens - /// \param theEvent the mouse event - //void onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); - - /// SLOT, that is called by mouse release in the viewer. - /// \param theWnd - the window where the event happens - /// \param theEvent the mouse event - //void onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); - - /// SLOT, that is called by mouse move in the viewer. - /// \param theWnd - the window where the event happens - /// \param theEvent the mouse event - //void onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); - - /// SLOT, that is called by mouse double click in the viewer. - /// \param theWnd - the window where the event happens - /// \param theEvent the mouse event - //void onMouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); - /// SLOT, that is called by key release in the viewer. - /// The mouse moved point is sent to the current operation to be processed. + /// \param theWnd a view window /// \param theEvent the key event void onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent); @@ -122,11 +108,10 @@ protected slots: virtual void registerFilters(); private slots: + /// Processing of vertex selected void onVertexSelected(); - private: - /// Breaks sequense of automatically resterted operations void breakOperationSequence(); diff --git a/src/PartSet/PartSet_Operation.cpp b/src/PartSet/PartSet_Operation.cpp deleted file mode 100644 index 13352894d..000000000 --- a/src/PartSet/PartSet_Operation.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: PartSet_Operation.cpp -// Created: 24 Nov 2014 -// Author: Vitaly SMETANNIKOV - -#include "PartSet_Operation.h" - -#include -#include - -void PartSet_Operation::onSelectionChanged() -{ - if (isEditOperation()) { - ModuleBase_ISelection* aSelection = myWorkshop->selection(); - QList aHighlighted = aSelection->getHighlighted(); - QList aSelected = aSelection->getSelected(); - } -} \ No newline at end of file diff --git a/src/PartSet/PartSet_Operation.h b/src/PartSet/PartSet_Operation.h deleted file mode 100644 index 83fce7e9b..000000000 --- a/src/PartSet/PartSet_Operation.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: PartSet_Operation.h -// Created: 24 Nov 2014 -// Author: Vitaly SMETANNIKOV - -#ifndef PartSet_Operation_H -#define PartSet_Operation_H - -#include "PartSet.h" - -#include - -class ModuleBase_IWorkshop; - -class PARTSET_EXPORT PartSet_Operation : public ModuleBase_Operation -{ -Q_OBJECT - public: - PartSet_Operation(const QString& theId = "", QObject* theParent = 0) - :ModuleBase_Operation(theId, theParent) {} - - void setWorkshop(ModuleBase_IWorkshop* theWorkshop) { myWorkshop = theWorkshop; } - -public slots: - void onSelectionChanged(); - -private: - ModuleBase_IWorkshop* myWorkshop; -}; - -#endif \ No newline at end of file diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 0b79b084e..97dbea056 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -31,6 +31,7 @@ class ModuleBase_Operation; class QMouseEvent; /** +* \ingroup Module * A class for management of sketch operations */ class PARTSET_EXPORT PartSet_SketcherMgr : public QObject @@ -67,25 +68,29 @@ class PARTSET_EXPORT PartSet_SketcherMgr : public QObject double myCurX, myCurY; /// the point coordinates }; public: + /// Constructor + /// \param theModule a pointer to PartSet module PartSet_SketcherMgr(PartSet_Module* theModule); virtual ~PartSet_SketcherMgr(); + /// Returns list of strings which contains id's of sketch operations static QStringList sketchOperationIdList(); /// Launches the operation from current highlighting void launchEditing(); - // Returns current Sketch feature/ Returns NULL if there is no launched sketch operation + /// Returns current Sketch feature/ Returns NULL if there is no launched sketch operation CompositeFeaturePtr activeSketch() const { return myCurrentSketch; } /// Starts sketch operation - void startSketch(ModuleBase_Operation* theOperation); + void startSketch(ModuleBase_Operation* ); /// Stops sketch operation - void stopSketch(ModuleBase_Operation* theOperation); + void stopSketch(ModuleBase_Operation* ); public slots: + /// Process sketch plane selected event void onPlaneSelected(const std::shared_ptr& thePln); diff --git a/src/PartSet/PartSet_Tools.h b/src/PartSet/PartSet_Tools.h index 05104bb01..058c00baa 100644 --- a/src/PartSet/PartSet_Tools.h +++ b/src/PartSet/PartSet_Tools.h @@ -33,7 +33,8 @@ class GeomAPI_Edge; class GeomAPI_Vertex; /*! - \class PartSet_Tools + * \class PartSet_Tools + * \ingroup Module * \brief The operation for the sketch feature creation */ class PARTSET_EXPORT PartSet_Tools @@ -42,12 +43,12 @@ class PARTSET_EXPORT PartSet_Tools /// Converts the 2D screen point to the 3D point on the view according to the point of view /// \param thePoint a screen point /// \param theView a 3D view - // Transferred to ModuleBase static gp_Pnt convertClickToPoint(QPoint thePoint, Handle_V3d_View theView); /// \brief Converts the 3D point to the projected coodinates on the sketch plane. /// \param thePoint the 3D point in the viewer /// \param theSketch the sketch feature + /// \param theView a view 3d object /// \param theX the X coordinate /// \param theY the Y coordinate static void convertTo2D(const gp_Pnt& thePoint, FeaturePtr theSketch, @@ -58,7 +59,6 @@ class PARTSET_EXPORT PartSet_Tools /// \param theX the X coordinate /// \param theY the Y coordinate /// \param theSketch the sketch feature - /// \param thePoint the 3D point in the viewer static std::shared_ptr convertTo3D(const double theX, const double theY, FeaturePtr theSketch); /// Returns an object that is under the mouse point. Firstly it checks the highlighting, @@ -77,7 +77,12 @@ class PARTSET_EXPORT PartSet_Tools /// Returns pointer to the root document. static std::shared_ptr document(); - + /// Find an attribute which corresponds to a given pont coordinates + /// \param theSketch the sketch feature + /// \param theX X coordinate + /// \param theY Y coordinate + /// \param theTolerance tolerance + /// \param theIgnore list of features which has to be ignored static std::shared_ptr findAttributePoint(CompositeFeaturePtr theSketch, double theX, double theY, double theTolerance, const QList& theIgnore = QList()); @@ -90,7 +95,7 @@ class PARTSET_EXPORT PartSet_Tools /// \brief Save the double to the feature. If the attribute is double, it is filled. /// \param theFeature the feature - /// \param theValue the horizontal coordinate + /// \param theX the horizontal coordinate /// \param theAttribute the feature attribute static void setFeatureValue(FeaturePtr theFeature, double theX, const std::string& theAttribute); @@ -111,8 +116,9 @@ class PARTSET_EXPORT PartSet_Tools const std::string& theKind); /// Creates a constraint on two points + /// \param theSketch a sketch feature /// \param thePoint1 the first point - /// \param thePoint1 the second point + /// \param thePoint2 the second point static void createConstraint(CompositeFeaturePtr theSketch, std::shared_ptr thePoint1, std::shared_ptr thePoint2); @@ -145,8 +151,10 @@ class PARTSET_EXPORT PartSet_Tools /// Creates a line (arc or circle) by given edge /// Created line will have fixed constraint - /// \param theEdge - an edge - /// \return - result of created feature + /// \param theShape an edge + /// \param theObject a selected result object + /// \param theSketch a sketch feature + /// \return result of created feature static ResultPtr createFixedObjectByEdge(const TopoDS_Shape& theShape, const ObjectPtr& theObject, CompositeFeaturePtr theSketch); diff --git a/src/PartSet/PartSet_Validators.h b/src/PartSet/PartSet_Validators.h index eb44d6daa..6334a87c7 100644 --- a/src/PartSet/PartSet_Validators.h +++ b/src/PartSet/PartSet_Validators.h @@ -60,25 +60,43 @@ class PartSet_RigidValidator : public ModuleBase_SelectionValidator PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const; }; +/** +* \ingroup Module +* A validator which checks that objects selected for feature attributes are different (not the same) +*/ class PartSet_DifferentObjectsValidator : public ModelAPI_RefAttrValidator { public: + /// Returns True if the feature is valid + /// \param theFeature a feature to check + /// \param theArguments a list of arguments (names of attributes to check) + /// \param theObject a selected object virtual bool isValid(const FeaturePtr& theFeature, const std::list& theArguments, const ObjectPtr& theObject) const; + //! Returns true if the attribute is good for the feature attribute + //! \param theFeature a feature to check + //! \param theArguments a list of arguments (names of attributes to check) + //! \param theAttribute an attribute virtual bool isValid(const FeaturePtr& theFeature, const std::list& theArguments, const AttributePtr& theAttribute) const; + //! Returns true if the attribute is good for the feature attribute + //! \param theAttribute an attribute + //! \param theArguments a list of arguments (names of attributes to check) virtual bool isValid(const AttributePtr& theAttribute, const std::list& theArguments) const; }; /** -* aValidator which validates tha selected object is a Sketch +* \ingroup Module +* A Validator which validates tha selected object is a Sketch */ class PartSet_SketchValidator : public ModelAPI_ResultValidator { public: + /// Returns True if the given object is a sketch + /// \param theObject an object virtual bool isValid(const ObjectPtr theObject) const; }; diff --git a/src/PartSet/PartSet_WidgetPoint2d.h b/src/PartSet/PartSet_WidgetPoint2d.h index ad0395461..59649caad 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.h +++ b/src/PartSet/PartSet_WidgetPoint2d.h @@ -27,17 +27,21 @@ class QGroupBox; class QMouseEvent; /**\class PartSet_WidgetPoint2D - * \ingroup GUI - * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls + * \ingroup Module + * \brief Implementation of model widget to provide widget to input point 2d + * In XML can be defined as folloung: + * \code + * + * \endcode */ class PARTSET_EXPORT PartSet_WidgetPoint2D : public ModuleBase_ModelWidget { 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 PartSet_WidgetPoint2D(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); /// Destructor @@ -48,8 +52,6 @@ Q_OBJECT /// \param theValue the wrapped widget value virtual bool setSelection(ModuleBase_ViewerPrs theValue); - /// Saves the internal parameters to the given feature - /// \param theObject a model feature to be changed virtual bool storeValue() const; virtual bool restoreValue(); @@ -70,16 +72,21 @@ Q_OBJECT /// The methiod called when widget is deactivated virtual void deactivate(); + /// Return workshop XGUI_Workshop* workshop() const { return myWorkshop; } + /// Set workshop void setWorkshop(XGUI_Workshop* theWork) { myWorkshop = theWork; } /// \returns the sketch instance CompositeFeaturePtr sketch() const { return mySketch; } + + /// Set sketch instance void setSketch(CompositeFeaturePtr theSketch) { mySketch = theSketch; } /// Fill the widget values by given point - /// \param thePoint the point + /// \param theX the X coordinate + /// \param theY the Y coordinate void setPoint(double theX, double theY); /// Returns coordinate X currently defined in the control @@ -90,18 +97,29 @@ Q_OBJECT signals: /// Signal about selection of an existing vertex from an object - /// \param theObject - the selected object - /// \param theShape - the selected shape void vertexSelected(); protected slots: + /// Process mouse release event + /// \param theWnd a view window + /// \param theEvent a mouse event void onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + + /// Process mouse move event + /// \param theWnd a view window + /// \param theEvent a mouse event void onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); private slots: + /// Process value changed event void onValuesChanged(); private: + /// Returns point 2d from selected vertex + /// \param theView a view window + /// \param theShape a vertex shape + /// \param theX an output value of X coordinate + /// \param theY an output value of Y coordinate bool getPoint2d(const Handle(V3d_View)& theView, const TopoDS_Shape& theShape, double& theX, double& theY) const; diff --git a/src/PartSet/PartSet_WidgetPoint2dDistance.h b/src/PartSet/PartSet_WidgetPoint2dDistance.h index ca95b75fd..50c2626a4 100644 --- a/src/PartSet/PartSet_WidgetPoint2dDistance.h +++ b/src/PartSet/PartSet_WidgetPoint2dDistance.h @@ -17,13 +17,31 @@ class XGUI_Workshop; class ModuleBase_IViewWindow; class QMouseEvent; +/** +* \ingroup Module +* Implementation of model widget for widget which provides input of a distance between two points +* In XML file can be defined as following: +* \code +* +* +* +* \endcode +*/ class PARTSET_EXPORT PartSet_WidgetPoint2dDistance : public ModuleBase_WidgetDoubleValue { 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 PartSet_WidgetPoint2dDistance(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); @@ -35,21 +53,28 @@ Q_OBJECT /// The methiod called when widget is deactivated virtual void deactivate(); - /// Set the given wrapped value to the current widget - /// This value should be processed in the widget according to the needs - /// \param theValue the wrapped widget value - //virtual bool setValue(ModuleBase_WidgetValue* theValue); - + /// Returns workshop XGUI_Workshop* workshop() const { return myWorkshop; } + /// Set workshop + /// \param theWork a pointer to workshop void setWorkshop(XGUI_Workshop* theWork) { myWorkshop = theWork; } /// \returns the sketch instance CompositeFeaturePtr sketch() const { return mySketch; } + + /// Set sketch instance void setSketch(CompositeFeaturePtr theSketch) { mySketch = theSketch; } protected slots: + /// Process of mouse release + /// \param theWnd a pointer to a window + /// \param theEvent a mouse event void onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + + /// Process of mouse move + /// \param theWnd a pointer to a window + /// \param theEvent a mouse event void onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); protected: @@ -57,6 +82,7 @@ protected: void setPoint(FeaturePtr theFeature, const std::shared_ptr& thePnt); private slots: + /// Process values changed event void onValuesChanged(); private: diff --git a/src/PartSet/PartSet_WidgetShapeSelector.h b/src/PartSet/PartSet_WidgetShapeSelector.h index 8f187cd8b..6c81641c8 100644 --- a/src/PartSet/PartSet_WidgetShapeSelector.h +++ b/src/PartSet/PartSet_WidgetShapeSelector.h @@ -14,20 +14,34 @@ #include + +/** +* \ingroup Module +* Customosation of ModuleBase_WidgetShapeSelector in order to provide +* working with sketch specific objects. +*/ class PARTSET_EXPORT PartSet_WidgetShapeSelector: public ModuleBase_WidgetShapeSelector { 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 PartSet_WidgetShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData, const std::string& theParentId) : ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData, theParentId) {} virtual ~PartSet_WidgetShapeSelector() {} - /// Saves the internal parameters to the given feature virtual bool storeValue() const; + /// Set sketcher + /// \param theSketch a sketcher object void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; } + + /// Retrurns installed sketcher CompositeFeaturePtr sketch() const { return mySketch; } protected: @@ -35,14 +49,24 @@ protected: virtual bool isValid(ObjectPtr theObj, std::shared_ptr theShape); private: + /// Pointer to a sketch CompositeFeaturePtr mySketch; }; - +/** +* \ingroup Module +* Customosation of ModuleBase_WidgetShapeSelector in order to provide +* working with constraints. +*/ class PARTSET_EXPORT PartSet_WidgetConstraintShapeSelector: public ModuleBase_WidgetShapeSelector { 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 PartSet_WidgetConstraintShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData, const std::string& theParentId) : ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData, theParentId) {} @@ -52,10 +76,15 @@ Q_OBJECT /// Saves the internal parameters to the given feature virtual bool storeValue() const; + /// Set sketcher + /// \param theSketch a sketcher object void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; } + + /// Retrurns installed sketcher CompositeFeaturePtr sketch() const { return mySketch; } private: + /// Pointer to a sketch CompositeFeaturePtr mySketch; }; diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index 0dbc1da33..ac845c279 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -24,17 +24,24 @@ class QTimer; class XGUI_OperationMgr; class XGUI_Workshop; +/** +* \ingroup Module +* A model widget implementation for a label which provides specific behaviour +* for sketcher starting and launching operations +*/ class PARTSET_EXPORT PartSet_WidgetSketchLabel : 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 PartSet_WidgetSketchLabel(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); virtual ~PartSet_WidgetSketchLabel(); - /// Saves the internal parameters to the given feature - /// \param theFeature a model feature to be changed virtual bool storeValue() const { return true; @@ -57,27 +64,44 @@ Q_OBJECT /// The methiod called when widget is deactivated virtual void deactivate(); + /// Returns pointer to workshop XGUI_Workshop* workshop() const { return myWorkshop; } + /// Set pointer to workshop + /// \param theWork a pointer to workshop void setWorkshop(XGUI_Workshop* theWork) { myWorkshop = theWork; } + /// Returns sketcher plane std::shared_ptr plane() const; signals: + /// Signal on plane selection void planeSelected(const std::shared_ptr& thePln); private slots: + /// Slot on plane selection void onPlaneSelected(); + + /// Set sketch specific mode of selection void setSketchingMode(); private: + /// Create preview of planes for sketch plane selection + /// \param theOrigin an origin of the plane + /// \param theNorm a normal vector of the plane + /// \param theRGB a color of plane presentation [r, g, b] array AISObjectPtr createPreviewPlane(std::shared_ptr theOrigin, std::shared_ptr theNorm, const int theRGB[3]); + /// Set sketch plane by shape + /// \param theShape a planar face std::shared_ptr setSketchPlane(const TopoDS_Shape& theShape); + /// Erase preview planes void erasePreviewPlanes(); + + /// Show preview planes void showPreviewPlanes(); diff --git a/src/XGUI/XGUI_ContextMenuMgr.h b/src/XGUI/XGUI_ContextMenuMgr.h index c7af183f4..0fe548e2a 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.h +++ b/src/XGUI/XGUI_ContextMenuMgr.h @@ -20,6 +20,8 @@ class XGUI_EXPORT XGUI_ContextMenuMgr : public QObject { Q_OBJECT public: + /// Constructor + /// \param theParent a parent object XGUI_ContextMenuMgr(XGUI_Workshop* theParent); virtual ~XGUI_ContextMenuMgr(); @@ -27,6 +29,7 @@ Q_OBJECT void createActions(); /// Returns action according to the given ID + /// \param theId an id of an action QAction* action(const QString& theId) const; /// Returns list of registered actions Ids @@ -42,14 +45,22 @@ Q_OBJECT void connectViewer() const; /// Add menu atems for viewer into the given menu (used in SALOME mode) + /// \param theMenu a menu instance void addViewerItems(QMenu* theMenu) const; signals: + /// Signal aabout triggered action + /// \param theId an id of triggered action + /// \param isChecked is checked flag void actionTriggered(const QString& theId, bool isChecked); private slots: + /// Process action event + /// \param isChecked a checked action flag void onAction(bool isChecked); + /// Process context menu event + /// \param theEvent a context menu event void onContextMenuRequest(QContextMenuEvent* theEvent); private: @@ -60,11 +71,16 @@ signals: */ void addAction(const QString& theId, QAction* theAction); + /// Creates menu for object browser QMenu* objectBrowserMenu() const; + + /// Creates menu for viewer QMenu* viewerMenu() const; + /// Map of created actions [id : Action] QMap myActions; + /// Reference to workshop XGUI_Workshop* myWorkshop; }; diff --git a/src/XGUI/XGUI_DataTreeModel.h b/src/XGUI/XGUI_DataTreeModel.h index 72a3d93f5..fb28e59f8 100644 --- a/src/XGUI/XGUI_DataTreeModel.h +++ b/src/XGUI/XGUI_DataTreeModel.h @@ -19,6 +19,8 @@ class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel { public: + /// Constructor + /// \param theParent a parent object XGUI_FeaturesModel(QObject* theParent) : QAbstractItemModel(theParent), myItemsColor(Qt::black) @@ -27,6 +29,7 @@ class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel //! Returns Feature object by the given Model index. //! Returns 0 if the given index is not index of a feature + /// \param theIndex a model index virtual ObjectPtr object(const QModelIndex& theIndex) const = 0; //! Returns QModelIndex which corresponds to the given feature @@ -37,19 +40,23 @@ class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel virtual QModelIndex findParent(const ObjectPtr& theObject) const = 0; //! Returns index corresponded to the group + //! \param theGroup a group name virtual QModelIndex findGroup(const std::string& theGroup) const = 0; + //! Set color of items void setItemsColor(const QColor& theColor) { myItemsColor = theColor; } + //! Returns color of items QColor itemsColor() const { return myItemsColor; } protected: + /// Color of items QColor myItemsColor; }; @@ -60,17 +67,22 @@ class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel class XGUI_PartModel : public XGUI_FeaturesModel { public: + /// Constructor + /// \param theParent a parent object XGUI_PartModel(QObject* theParent) : XGUI_FeaturesModel(theParent) { } + /// Set part id + /// \param theId a new id void setPartId(int theId) { myId = theId; } //! Returns true if the given document is a sub-document of this tree + //! \param theDoc a document to check virtual bool hasDocument(const DocumentPtr& theDoc) const = 0; //! Return a Part object diff --git a/src/XGUI/XGUI_DocumentDataModel.h b/src/XGUI/XGUI_DocumentDataModel.h index 0b3f35fd1..63fa17a9f 100644 --- a/src/XGUI/XGUI_DocumentDataModel.h +++ b/src/XGUI/XGUI_DocumentDataModel.h @@ -25,45 +25,86 @@ class XGUI_EXPORT XGUI_DocumentDataModel : public QAbstractItemModel, public Eve { Q_OBJECT public: - + /// Constructor + /// \param theParent a parent object XGUI_DocumentDataModel(QObject* theParent); virtual ~XGUI_DocumentDataModel(); - // Event Listener method + /// Event Listener method + /// \param theMessage an event message virtual void processEvent(const std::shared_ptr& theMessage); + /// Returns the data stored under the given role for the item referred to by the index. + /// \param theIndex a model index + /// \param theRole a data role (see Qt::ItemDataRole) virtual QVariant data(const QModelIndex& theIndex, int theRole) const; + + /// Returns the data for the given role and section in the header with the specified orientation. + /// \param theSection a section + /// \param theOrient an orientation + /// \param theRole a data role (see Qt::ItemDataRole) virtual QVariant headerData(int theSection, Qt::Orientation theOrient, int theRole = Qt::DisplayRole) const; + /// Returns the number of rows under the given parent. When the parent is valid it means that + /// rowCount is returning the number of children of parent. + /// \param theParent a parent model index virtual int rowCount(const QModelIndex& theParent = QModelIndex()) const; + + /// Returns the number of columns for the children of the given parent. + /// It has a one column + /// \param theParent a parent model index virtual int columnCount(const QModelIndex& theParent = QModelIndex()) const; - virtual QModelIndex index(int theRow, int theColumn, const QModelIndex &parent = + /// Returns the index of the item in the model specified by the given row, column and parent index. + /// \param theRow a row + /// \param theColumn a column + /// \param theParent a parent model index + virtual QModelIndex index(int theRow, int theColumn, const QModelIndex &theParent = QModelIndex()) const; + /// Returns the parent of the model item with the given index. + /// If the item has no parent, an invalid QModelIndex is returned. + /// \param theIndex a model index virtual QModelIndex parent(const QModelIndex& theIndex) const; + /// Returns true if parent has any children; otherwise returns false. + /// \param theParent a parent model index virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const; + /// Inserts count rows into the model before the given row. + /// Items in the new row will be children of the item represented by the parent model index. + /// \param theRow a start row + /// \param theCount a nember of rows to insert + /// \param theParent a parent model index bool insertRows(int theRow, int theCount, const QModelIndex& theParent = QModelIndex()); + /// Removes count rows starting with the given row under parent parent from the model. + /// \param theRow a start row + /// \param theCount a nember of rows to remove + /// \param theParent a parent model index bool removeRows(int theRow, int theCount, const QModelIndex& theParent = QModelIndex()); + /// Returns the item flags for the given index. + /// \param theIndex a model index Qt::ItemFlags flags(const QModelIndex& theIndex) const; //! Returns an object by the given Model index. //! Returns 0 if the given index is not index of an object ObjectPtr object(const QModelIndex& theIndex) const; + //! Returns index of the object + //! \param theObject object to find QModelIndex objectIndex(const ObjectPtr theObject) const; //! Returns QModelIndex which corresponds to the given part //! If the object is not found then index is not valid + //! \param thePart a part for analysis QModelIndex partIndex(const ResultPartPtr& thePart) const; //! Activates a part data model if the index is a Part node index. //! Returns true if active part changed. + //! \param theIndex a model index bool activatedIndex(const QModelIndex& theIndex); //! Retrurns active part @@ -78,6 +119,7 @@ Q_OBJECT //! Deactivates a Part void deactivatePart(); + //! Rebuild data tree void rebuildDataTree(); //! Clear internal data diff --git a/src/XGUI/XGUI_ModuleConnector.h b/src/XGUI/XGUI_ModuleConnector.h index ab3b09a17..266967988 100644 --- a/src/XGUI/XGUI_ModuleConnector.h +++ b/src/XGUI/XGUI_ModuleConnector.h @@ -17,12 +17,15 @@ class XGUI_Workshop; class XGUI_Displayer; /** + * \ingroup GUI * Implementation of IWorkshop interface which provides access to Workshop sevices at module level */ class XGUI_EXPORT XGUI_ModuleConnector : public ModuleBase_IWorkshop { Q_OBJECT public: + /// Constructor + /// \param theWorkshop a workshop XGUI_ModuleConnector(XGUI_Workshop* theWorkshop); virtual ~XGUI_ModuleConnector(); @@ -59,9 +62,11 @@ Q_OBJECT //! If the list is empty then selection will be cleared virtual void setSelected(const QObjectPtrList& theFeatures); + //! Returns workshop XGUI_Workshop* workshop() const { return myWorkshop; } private: + /// Reference to workshop XGUI_Workshop* myWorkshop; /// A filter which provides selection within a current document or whole PartSet diff --git a/src/XGUI/XGUI_OperationMgr.h b/src/XGUI/XGUI_OperationMgr.h index f5683f81a..04505fed0 100644 --- a/src/XGUI/XGUI_OperationMgr.h +++ b/src/XGUI/XGUI_OperationMgr.h @@ -63,6 +63,7 @@ Q_OBJECT /// else, or if there is no parent - returns NULL ModuleBase_Operation* previousOperation(ModuleBase_Operation* theOperation) const; + /// Redefinition of virtual function virtual bool eventFilter(QObject *theObject, QEvent *theEvent); /// Start the operation and append it to the stack of operations @@ -70,6 +71,7 @@ Q_OBJECT /// \return the state whether the current operation is started bool startOperation(ModuleBase_Operation* theOperation); + /// Abort all operations bool abortAllOperations(); /// Returns whether the operation can be started. Check if there is already started operation and @@ -133,15 +135,13 @@ signals: /// Commits the current operatin if it is valid bool commitOperation(); + /// Sets the current operation or NULL /// \param theOperation the started operation - /// \param isCheckBeforeStart the flag whether to check whether the operation can be started - /// \return the state whether the operation is resumed void resumeOperation(ModuleBase_Operation* theOperation); public slots: /// SLOT, that is called by the key in the property panel is clicked. - /// \param theName the attribute name /// \param theEvent the mouse event bool onKeyReleased(QKeyEvent* theEvent); @@ -149,9 +149,17 @@ signals: /// Slot that is called by an operation stop. Removes the stopped operation form the stack. /// If there is a suspended operation, restart it. void onOperationStopped(); + + /// Slot called on operation start void onOperationStarted(); + + /// Slot called on operation abort void onOperationAborted(); + + /// Slot called on operation commit void onOperationCommitted(); + + /// Slot called on operation resume void onOperationResumed(); private: diff --git a/src/XGUI/XGUI_PartDataModel.h b/src/XGUI/XGUI_PartDataModel.h index 4ef9cd58f..56f28ad5e 100644 --- a/src/XGUI/XGUI_PartDataModel.h +++ b/src/XGUI/XGUI_PartDataModel.h @@ -15,22 +15,50 @@ class XGUI_EXPORT XGUI_TopDataModel : public XGUI_FeaturesModel { Q_OBJECT public: + /// Constructor + /// \param theParent a parent object XGUI_TopDataModel(QObject* theParent); virtual ~XGUI_TopDataModel(); // Reimpl from QAbstractItemModel + + /// Returns the data stored under the given role for the item referred to by the index. + /// \param theIndex a model index + /// \param theRole a data role (see Qt::ItemDataRole) virtual QVariant data(const QModelIndex& theIndex, int theRole) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + /// Returns the data for the given role and section in the header with the specified orientation. + /// \param theSection a section + /// \param theOrient an orientation + /// \param theRole a data role (see Qt::ItemDataRole) + virtual QVariant headerData(int theSection, Qt::Orientation theOrient, + int theRole = Qt::DisplayRole) const; + + /// Returns the number of rows under the given parent. When the parent is valid it means that + /// rowCount is returning the number of children of parent. + /// \param theParent a parent model index + virtual int rowCount(const QModelIndex &theParent = QModelIndex()) const; + + /// Returns the number of columns for the children of the given parent. + /// It has a one column + /// \param theParent a parent model index + virtual int columnCount(const QModelIndex &theParent = QModelIndex()) const; + + /// Returns the index of the item in the model specified by the given row, column and parent index. + /// \param theRow a row + /// \param theColumn a column + /// \param theParent a parent model index virtual QModelIndex index(int theRow, int theColumn, const QModelIndex& theParent = QModelIndex()) const; + /// Returns the parent of the model item with the given index. + /// If the item has no parent, an invalid QModelIndex is returned. + /// \param theIndex a model index virtual QModelIndex parent(const QModelIndex& theIndex) const; + /// Returns true if parent has any children; otherwise returns false. + /// \param theParent a parent model index virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const; //! Returns object by the given Model index. @@ -70,22 +98,49 @@ class XGUI_PartDataModel : public XGUI_PartModel { Q_OBJECT public: + /// Constructor + /// \param theParent a parent object XGUI_PartDataModel(QObject* theParent); virtual ~XGUI_PartDataModel(); // Reimpl from QAbstractItemModel - virtual QVariant data(const QModelIndex& theIndex, int theRole) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + /// Returns the data stored under the given role for the item referred to by the index. + /// \param theIndex a model index + /// \param theRole a data role (see Qt::ItemDataRole) + virtual QVariant data(const QModelIndex& theIndex, int theRole) const; + /// Returns the data for the given role and section in the header with the specified orientation. + /// \param theSection a section + /// \param theOrient an orientation + /// \param theRole a data role (see Qt::ItemDataRole) + virtual QVariant headerData(int theSection, Qt::Orientation theOrient, + int theRole = Qt::DisplayRole) const; + + /// Returns the number of rows under the given parent. When the parent is valid it means that + /// rowCount is returning the number of children of parent. + /// \param theParent a parent model index + virtual int rowCount(const QModelIndex &theParent = QModelIndex()) const; + + /// Returns the number of columns for the children of the given parent. + /// It has a one column + /// \param theParent a parent model index + virtual int columnCount(const QModelIndex &theParent = QModelIndex()) const; + + /// Returns the index of the item in the model specified by the given row, column and parent index. + /// \param theRow a row + /// \param theColumn a column + /// \param theParent a parent model index virtual QModelIndex index(int theRow, int theColumn, const QModelIndex& theParent = QModelIndex()) const; + /// Returns the parent of the model item with the given index. + /// If the item has no parent, an invalid QModelIndex is returned. + /// \param theIndex a model index virtual QModelIndex parent(const QModelIndex& theIndex) const; + /// Returns true if parent has any children; otherwise returns false. + /// \param theParent a parent model index virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const; //! Returns object by the given Model index. @@ -113,6 +168,7 @@ Q_OBJECT //! Returns document of the current part DocumentPtr partDocument() const; + //! Returns defult number of rows int getRowsNumber() const; //! Types of QModelIndexes diff --git a/src/XGUI/XGUI_QtEvents.h b/src/XGUI/XGUI_QtEvents.h index f7c2211bd..6cd29e870 100644 --- a/src/XGUI/XGUI_QtEvents.h +++ b/src/XGUI/XGUI_QtEvents.h @@ -24,6 +24,7 @@ class XGUI_EXPORT PostponeMessageQtEvent : public QEvent { public: + /// An event type static QEvent::Type PostponeMessageQtEventType; /// Constructor diff --git a/src/XGUI/XGUI_SalomeConnector.h b/src/XGUI/XGUI_SalomeConnector.h index 13ce80b05..e67078e90 100644 --- a/src/XGUI/XGUI_SalomeConnector.h +++ b/src/XGUI/XGUI_SalomeConnector.h @@ -85,6 +85,7 @@ class XGUI_EXPORT XGUI_SalomeConnector //! Returns interface to Salome viewer virtual ModuleBase_IViewer* viewer() const = 0; + //! Create preferences virtual void createPreferences() = 0; }; diff --git a/src/XGUI/XGUI_SelectionMgr.h b/src/XGUI/XGUI_SelectionMgr.h index 6503f175d..98755ea20 100644 --- a/src/XGUI/XGUI_SelectionMgr.h +++ b/src/XGUI/XGUI_SelectionMgr.h @@ -26,9 +26,12 @@ class XGUI_EXPORT XGUI_SelectionMgr : public QObject { Q_OBJECT public: + /// Constructor + /// \param theParent a parent workshop XGUI_SelectionMgr(XGUI_Workshop* theParent); virtual ~XGUI_SelectionMgr(); + /// Returns current selection XGUI_Selection* selection() const { return mySelection; @@ -52,11 +55,17 @@ signals: void selectionChanged(); private slots: + /// Reaction on selectio0n in Object browser void onObjectBrowserSelection(); + + /// Reaction on selectio0n in Viewer void onViewerSelection(); private: + /// Reference to workshop XGUI_Workshop* myWorkshop; + + /// Current selection object XGUI_Selection* mySelection; }; diff --git a/src/XGUI/XGUI_Tools.h b/src/XGUI/XGUI_Tools.h index 614b2be23..9ea32e03e 100644 --- a/src/XGUI/XGUI_Tools.h +++ b/src/XGUI/XGUI_Tools.h @@ -22,6 +22,12 @@ \return directory part of the file path */ namespace XGUI_Tools { + +/** +* Returns directory name from name of file +* \param path a path to a file +* \param isAbs is absolute or relative path +*/ QString XGUI_EXPORT dir(const QString& path, bool isAbs = true); /*! diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index 7cd1f90d6..d882b4791 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -19,6 +19,8 @@ class XGUI_EXPORT XGUI_ViewerProxy : public ModuleBase_IViewer { Q_OBJECT public: + /// Constructor + /// \param theParent a parent object XGUI_ViewerProxy(XGUI_Workshop* theParent); //! Returns AIS_InteractiveContext from current OCCViewer diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 7b234a365..43f8e9f83 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1245,17 +1245,17 @@ void XGUI_Workshop::activatePart(ResultPartPtr theFeature) } //************************************************************** -void XGUI_Workshop::activateLastPart() -{ - SessionPtr aMgr = ModelAPI_Session::get(); - DocumentPtr aDoc = aMgr->moduleDocument(); - std::string aGrpName = ModelAPI_ResultPart::group(); - ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1); - ResultPartPtr aPart = std::dynamic_pointer_cast(aLastPart); - if (aPart) { - activatePart(aPart); - } -} +//void XGUI_Workshop::activateLastPart() +//{ +// SessionPtr aMgr = ModelAPI_Session::get(); +// DocumentPtr aDoc = aMgr->moduleDocument(); +// std::string aGrpName = ModelAPI_ResultPart::group(); +// ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1); +// ResultPartPtr aPart = std::dynamic_pointer_cast(aLastPart); +// if (aPart) { +// activatePart(aPart); +// } +//} //************************************************************** void XGUI_Workshop::deleteObjects(const QObjectPtrList& theList) diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 13fa9039e..34ce06b91 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -55,7 +55,9 @@ class XGUI_EXPORT XGUI_Workshop : public QObject, public Events_Listener { Q_OBJECT public: - + /// Constructor + /// \param theConnector a Salome connector object. + /// Used only if the workshop is launched in Salome environment XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0); virtual ~XGUI_Workshop(); @@ -131,8 +133,10 @@ Q_OBJECT return myObjectBrowser; } + /// This method is called by Salome module when selection is changed void salomeViewerSelectionChanged(); + /// Returns viewer which unifies access as to Salome viewer as to standalone viewer XGUI_ViewerProxy* viewer() const { return myViewerProxy; @@ -161,8 +165,12 @@ Q_OBJECT //! Show the given features in 3d Viewer void showOnlyObjects(const QObjectPtrList& theList); + /// Set display mode for the given onjects + /// \param theList a list of displayed objects + /// \param theMode a mode to set (see \ref XGUI_Displayer) void setDisplayMode(const QObjectPtrList& theList, int theMode); + /// Returns current module ModuleBase_IModule* module() const { return myModule; @@ -181,7 +189,7 @@ Q_OBJECT */ void saveDocument(const QString& theName, std::list& theFileNames); - /* + /** * If there is an active (uncommited) operation shows a prompt to abort it * and performs abortion if user agreed. Returns true if * - operation aborted successfully @@ -190,8 +198,12 @@ Q_OBJECT bool isActiveOperationAborted(); signals: + /// Emitted when selection happens in Salome viewer void salomeViewerSelection(); + + /// Emitted when error in applivation happens void errorOccurred(const QString&); + //! the signal about the workshop actions states are updated. void commandStatusUpdated(); @@ -199,53 +211,102 @@ signals: void applicationStarted(); public slots: + /// Update of commands status void updateCommandStatus(); + /// Create a new dokument void onNew(); + + /// Open document from file void onOpen(); + + /// Save current document bool onSave(); + + /// Save current document to a file selected by user bool onSaveAs(); + + /// Exit application void onExit(); + + /// Undo last command void onUndo(); + + /// Redo previous command void onRedo(); + + /// Rebuild data tree void onRebuild(); + + /// Open preferences dialog box void onPreferences(); + /// Show property panel void showPropertyPanel(); + + /// Hide property panel void hidePropertyPanel(); + + /// Show object Browser void showObjectBrowser(); + + /// Hide object Browser void hideObjectBrowser(); + /// Reaction on command call void onFeatureTriggered(); + + /// Change active document + /// \param theObj a part object. If it is NULL then active document is a main document void changeCurrentDocument(ObjectPtr theObj); - void activateLastPart(); + //void activateLastPart(); + /// Close document void closeDocument(); protected: - // Find the nested features and set them into the operation - // \param theOperation an operation + /// Find the nested features and set them into the operation + /// \param theOperation an operation void setNestedFeatures(ModuleBase_Operation* theOperation); - // Update the property panel content by the XML description of the operation and set the panel - // into the operation - // \param theOperation an operation + + /// Update the property panel content by the XML description of the operation and set the panel + /// into the operation + /// \param theOperation an operation void setPropertyPanel(ModuleBase_Operation* theOperation); + /// Procedure to process postponed events bool event(QEvent * theEvent); + //Event-loop processing methods: + + /// Process event "Add a feature" void addFeature(const std::shared_ptr&); + + /// Connect to operation signals + /// \param theOperation an operation void connectWithOperation(ModuleBase_Operation* theOperation); - void onFeatureUpdatedMsg(const std::shared_ptr& theMsg); - void onFeatureCreatedMsg(const std::shared_ptr& theMsg); - void onFeatureRedisplayMsg(const std::shared_ptr& theMsg); - void onObjectDeletedMsg(const std::shared_ptr& theMsg); + /// Process feature update message + void onFeatureUpdatedMsg(const std::shared_ptr& ); - void validateOperation(const QString& theOperationId); + ///Process feature created message + void onFeatureCreatedMsg(const std::shared_ptr& ); + /// Process feature redisplay message + void onFeatureRedisplayMsg(const std::shared_ptr& ); + + /// Process feature delete message + void onObjectDeletedMsg(const std::shared_ptr& ); + + /// Display all results void displayAllResults(); + + /// Displau results from document + /// \param theDoc a document void displayDocumentResults(DocumentPtr theDoc); + + /// Display results from a group void displayGroupResults(DocumentPtr theDoc, std::string theGroup); private slots: @@ -272,21 +333,37 @@ signals: /// \param theOpertion an aborted operation void onOperationAborted(ModuleBase_Operation* theOperation); + /// Process context menu command + /// \param theId id of the command + /// \param isChecked is checked flag void onContextMenuCommand(const QString& theId, bool isChecked); + /// Processing of values changed in model widget void onWidgetValuesChanged(); + /// Set waiting cursor void onStartWaiting(); private: + /// Init menu void initMenu(); + /// Register validators void registerValidators() const; + /// Load module from external library + /// \param theModule name of the module ModuleBase_IModule* loadModule(const QString& theModule); + + /// Activate module bool activateModule(); + /// Create object browser widget + /// \param theParent a parent of widget QDockWidget* createObjectBrowser(QWidget* theParent); + + /// Create property panel widget + /// \param theParent a parent of widget QDockWidget* createPropertyPanel(QWidget* theParent); // Creates Dock widgets: Object browser and Property panel -- 2.39.2