/*!
* \class Config_AttributeMessage
* \brief Class to pass an attribute's (widget's) entry info extracted from xml file.
+ * \code
* <widget id="tool_object" concealment="true" obligatory="0"/>
+ * \endcode
*/
class Config_AttributeMessage : public Events_Message
{
* \class Config_FeatureMessage\r
* \brief Class to pass a feature entry extracted from xml file.\r
* Example of the feature entry:\r
+ * \code\r
* <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>\r
+ * \endcode\r
*/\r
class Config_FeatureMessage : public Events_Message\r
{\r
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
/*!
\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
/*!
\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;
}
#include <QDoubleSpinBox>
#include <QValidator>
+
+/**
+* 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;
};
class ModuleBase_Filter
{
public:
+ /// Constructor
MODULEBASE_EXPORT ModuleBase_Filter() {}
/**
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
#include <StdSelect_TypeOfFace.hxx>
+/**
+* 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() {}
#include <StdSelect_TypeOfEdge.hxx>
+/**
+* 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() {}
virtual void createFilter();
protected:
- std::list<std::string> myArguments; /// the filter arguments
+ /// the filter arguments
+ std::list<std::string> myArguments;
};
#endif //ModuleBase_FilterMulti
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) {}
DEFINE_STANDARD_RTTI(ModuleBase_FilterNoConsructionSubShapes)
protected:
+ /// Instance of workshop interface
ModuleBase_IWorkshop* myWorkshop;
};
#include <StdSelect_TypeOfFace.hxx>
+/**
+* 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();
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
Q_OBJECT\r
public:\r
\r
+ /// Constructor\r
+ /// \param theParent instance of workshop intrface\r
ModuleBase_IModule(ModuleBase_IWorkshop* theParent);\r
\r
virtual ~ModuleBase_IModule() {}\r
/// Called on creation of menu item in desktop\r
virtual void actionCreated(QAction*);\r
\r
- /// Called when user selects feature for editing\r
+ /// Launching of a edit operation on the feature \r
+ /// \param theFeature feature for editing\r
virtual void editFeature(FeaturePtr theFeature);\r
\r
/// Creates an operation and send it to loop\r
/// Realizes some functionality by an operation abort\r
virtual void operationAborted(ModuleBase_Operation* theOperation) {}\r
\r
- /// Called when it is necessary to update a command state (enable or disable it)\r
- //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;\r
-\r
/// Creates custom widgets for property panel\r
+ /// \param theType a type of widget\r
+ /// \param theParent the parent object\r
+ /// \param theWidgetApi the widget configuation. The attribute of the model widget is obtained from\r
+ /// \param theParentId is Id of a parent of the current attribute\r
+ /// \param theModelWidgets list of widget objects\r
virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent,\r
Config_WidgetAPI* theWidgetApi, std::string theParentId,\r
QList<ModuleBase_ModelWidget*>& theModelWidgets)\r
return 0;\r
}\r
\r
+ /// Returns current workshop\r
ModuleBase_IWorkshop* workshop() const { return myWorkshop; }\r
\r
/// Call back forlast tuning of property panel before operation performance\r
virtual void propertyPanelDefined(ModuleBase_Operation* theOperation) {}\r
\r
public slots:\r
+ /// Called on call of command corresponded to a feature\r
void onFeatureTriggered();\r
\r
protected slots:\r
/// Called on selection changed event\r
virtual void onSelectionChanged() {}\r
\r
- /// SLOT, that is called by mouse press in the viewer.\r
- /// The mouse released point is sent to the current operation to be processed.\r
- /// \param theEvent the mouse event\r
- //virtual void onMousePressed(QMouseEvent* theEvent) {}\r
-\r
- /// SLOT, that is called by mouse release in the viewer.\r
- /// The mouse released point is sent to the current operation to be processed.\r
- /// \param theEvent the mouse event\r
- //virtual void onMouseReleased(QMouseEvent* theEvent) {}\r
- \r
- /// SLOT, that is called by mouse move in the viewer.\r
- /// The mouse moved point is sent to the current operation to be processed.\r
- /// \param theEvent the mouse event\r
- //virtual void onMouseMoved(QMouseEvent* theEvent) {}\r
-\r
- /// SLOT, that is called by the mouse double click in the viewer.\r
- /// \param theEvent the mouse event\r
- //virtual void onMouseDoubleClick(QMouseEvent* theEvent) {}\r
-\r
- /// SLOT, that is called by the key in the viewer is clicked.\r
- /// \param theEvent the mouse event\r
- //virtual void onKeyRelease(QKeyEvent* theEvent) {}\r
-\r
protected:\r
/// Sends the operation for launching\r
/// \param theOperation the operation\r
\r
/// Creates a new operation\r
/// \param theCmdId the operation name\r
- /// \param theFeatureKind a kind of feature to get the feature xml description\r
- virtual ModuleBase_Operation* createOperation(const std::string& theFeatureId);\r
+ virtual ModuleBase_Operation* createOperation(const std::string& theCmdId);\r
\r
/// Register validators for this module\r
virtual void registerValidators() {}\r
\r
protected:\r
\r
+ /// Reference to workshop\r
ModuleBase_IWorkshop* myWorkshop;\r
+\r
+ /// Map of features in XML\r
std::map<std::string, std::string> myFeaturesInFiles;\r
};\r
\r
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent a parent object
ModuleBase_IViewer(QObject* theParent)
: QObject(theParent)
{
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
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
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*);
};
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent parent object
ModuleBase_IWorkshop(QObject* theParent)
: QObject(theParent)
{}
virtual ~ModuleBase_IWorkshop()
{}
+ /// Return current selection instance
virtual ModuleBase_ISelection* selection() const = 0;
/// Activate sub-shapes selection (opens local context)
virtual void setSelected(const QObjectPtrList& theFeatures) = 0;
signals:
+ /// Signal selection chaged.
void selectionChanged();
/// Signal which is emited after activation of property panel
\r
/*!\r
* \class ModuleBase_OperationDescription\r
- *\r
+ * Description of operation from XML\r
*/\r
class MODULEBASE_EXPORT ModuleBase_OperationDescription\r
{\r
/// \return string name of the operation.\r
const QString& operationId() const;\r
\r
- /// Returns XML representation of the operation's widget.\r
- /// \return XML QString\r
- //const QString& xmlRepresentation() const;\r
-\r
/// Returns a short description of operation (will be\r
/// inserted in title of property panel)\r
const QString& description() const;\r
/// inserted in title of property panel)\r
void setDescription(const QString& theDescription);\r
\r
- /// Sets a list of model widgets, according to the operation feature xml definition\r
- /// \param theWidgets a list of widgets\r
- //void setModelWidgets(const std::string& theXmlRepresentation,\r
- // const QList<ModuleBase_ModelWidget*>& theWidgets);\r
-\r
- /// Sets a list of model widgets, according to the operation feature xml definition\r
- /// \param theWidgets a list of widgets\r
- //const QList<ModuleBase_ModelWidget*>& modelWidgets() const;\r
-\r
/// Returns XML representation of the operation's widget.\r
/// \return XML QString\r
const QString& xmlRepresentation() const;\r
\r
private:\r
//!< Next fields could be extracted into a subclass;\r
- QString myOperationId; /// the operation identifier\r
- QString myDescription; /// the short description of the opertaion\r
- QString myXmlRepresentation; /// the xml definition\r
- //QList<ModuleBase_ModelWidget*> myWidgets; /// the list of operation widgets\r
+ /// the operation identifier\r
+ QString myOperationId; \r
+\r
+ /// the short description of the opertaion\r
+ QString myDescription; \r
+\r
+ /// the xml definition\r
+ QString myXmlRepresentation; \r
};\r
\r
-#endif //ModuleBase_OperationDescription_H\r
\ No newline at end of file
+#endif //ModuleBase_OperationDescription_H\r
class SUIT_ResourceMgr;
class QWidget;
-// Pair of values: section name, value name
+/// \typedef ModuleBase_Pref Pair of values: section name, value name
typedef QPair<QString, QString> ModuleBase_Pref;
+
+/// \typedef ModuleBase_Prefs list of preferences
typedef QList<ModuleBase_Pref> ModuleBase_Prefs;
//***********************************************************************
/// 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
/// 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:
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theResource resource manager
+ /// \param theParent a paren widget
ModuleBase_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent)
: SUIT_PreferenceMgr(theResource, theParent)
{
#include <string>
/**
-* \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,
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;
};
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;
};
/**
* 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;
};
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
+* <multi_selector id="group_list"
+* tooltip="Select a set of objects"
+* type_choice="Vertices Edges Faces Solids" />
+* \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,
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();
/// \return a control list
virtual QList<QWidget*> 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<TopoDS_Shape>& theShapesToFilter,
NCollection_List<TopoDS_Shape>& 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
/// 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<ResultPtr, GeomShapePtr> GeomSelection;
+
+ /// Variable of GeomSelection type
QList<GeomSelection> mySelection;
+ /// An action for pop-up menu in a list control
QAction* myCopyAction;
};
class XGUI_EXPORT XGUI_Displayer
{
public:
- /// \enum display mode
+ /// \enum DisplayMode display mode
enum DisplayMode {
/// Mode is not defined
NoMode = -1,