--- /dev/null
+// Special file to define and describe the modules (goups)
+
+/**
+ * \defgroup DataModel Data model
+ *
+ * \brief Structures for storage and management the application data.
+ *
+ * Data structures are unified and splitted in universal <b>ModelAPI</b> package.
+ * The OCCT specialized implementation of ModelAPI interfaces is located in the <b>Model</b>.
+ * The geometrical primitives interfaces in <b>GeomAPI</b> package are supported by geometrical
+ * persistence elements in <b>GeomDatAPI</b> interface and has OCCT-specific implementation in GeomData package.
+ *
+ */
+
+/**
+ * \defgroup DataAlgo Algorithms
+ *
+ * \brief Different algorithm used in the application
+ *
+ * The geometrical algorithms implementation (basing on OCCT libraries) are located in <b>GeomAlgoAPI</b>.
+ *
+ */
+
+/**
+ * \defgroup Plugins Plugins
+ *
+ * \brief Implementation of specific features of the application is concentrated in plugins.
+ *
+ * The C++ and Python features implementations are located in plugins: specially organized libraries
+ * and configuration files that allows to define the user interface and specific algorithms.
+ * There are many plugins that should be extended with the development of the application. The names
+ * of plugin-packages are ended with "Plugin" string:
+ * <b>PartSetPlugin</b>, <b>ConstructionPlugin</b>, <b>SketchPlugin</b>, <b>FeaturesPlugins</b>, etc.
+ *
+ */
+
+/**
+ * \defgroup GUI GUI of the application
+ *
+ * \brief Classes for griphic user interface definition
+ *
+ * Classes of application windows definition, operations launching,
+ * and objects presentations. It consists of two packages:
+ * - ModuleBase - level for modules definition
+ * - XGUI - implementation of Application GUI.
+ */
+
+/**
+ * \defgroup Salome A Salome connector
+ *
+ * \brief A set of classes which provide wrapping of
+ * OpenParts application as SALOME module
+ */
+
+/**
+ * \defgroup Desktop Classes for standalone application
+ *
+ * \brief This group contains classes for launching the application
+ * in standalone desktop (without SALOME)
+ */
+
+/**
+ * \defgroup Modules Modules
+ *
+ * \brief Definition of a module as a set of classes for plugins management
+ */
+
+/**
+ * \defgroup Validators Validators
+ *
+ * \brief Implementation of internal logic of the feature
+ *
+ * Validators are used for checking validity of the feature: each argument,
+ * dependencies between the arguments. Validators are defined in the
+ * configuration files and may be also used for selection filters (ModuleBase_SelectionValidator),
+ * passing configurable parameters from XML file to the feature implementation
+ * (like in ExchangePlugin_ImportFormatValidator).
+ *
+ */
+
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = @PROJECT_SOURCE_DIR@/src
+INPUT = @PROJECT_SOURCE_DIR@/src @CMAKE_CURRENT_SOURCE_DIR@
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
FILE_PATTERNS = *.h \
*.cpp \
*.hxx \
- *.cxx
+ *.cxx \
+ *.doc
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
# directories that contain image that are included in the documentation (see
# the \image command).
-IMAGE_PATH =
+IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
--- /dev/null
+/*!
+\page general_architecture General Architecture
+
+New GEOM is used either as a stand-alone application or as a Module integrated to the SALOME environment in order to, ultimately, replace the old GEOM.
+
+<h2>Stand-alone New GEOM</h2>
+
+When used outside SALOME, New GEOM must be hosted by an application window implementing the general ergonomics of New GEOM (the GUI), including the layout of the user interface, organization of menus, runtime help, etc.
+\n
+It is proposed that this application window can host several so-called Modules. Below, this main application window is named the Workshop.
+\n\n
+Each Module hosted by the Workshop deals with one type of document (ModelAPI_Document) only, saved in a format supported by the Module. One document type per Module. Also, in a Workshop window, only one document of a given type can be newed. So, when launching the Workshop, the user selects a type of document to be created. Then, from the application session, creating a new document will launch a new instance of the Workshop.
+\n\n
+The geometric model (i.e. the whole geometry produce by New GEOM) is created through operations, or features (ModelAPI_Feature), which define a meaningful piece of design (e.g. PartSetPlugin_Part, FeaturesPlugin_Extrusion, FeaturesPlugin_Placement, etc.). In order to easily create dedicated variants of the modeler, also to gradually develop New GEOM, each feature is implemented in a <i>Plug-in</i> (ModelAPI_Plugin, a piece of application including its own GUI, built separately from the application. It is loaded dynamically to the application). In other words, a Module is made of a collection of Plug-ins.
+\n\n
+The Workshop structures the features by related functionality presented in a tabbed interface. Each tab displays a set of available actions. These sets of features are called below <i>Workbenches</i>.
+\n\n
+Additionally, a Module can either reference or include other Modules:
+<ul>
+<li>
+A Module references another one when the document it produces references a document created by the other Module.
+In this case, each document is edited from the corresponding Module running in separate instances of the Workshop. The Workbenches of each Module are presented into distinct windows.
+</li>
+<li>
+A Module include another Module when additionally, the Module of referenced document runs into the same Workshop.
+In this context, both documents can be edited from a single instance of the Workshop. The Workbenches of both Modules are presented into the same window.
+</li>
+</ul>
+
+
+
+<h2>Application to New GEOM</h2>
+
+New GEOM is made of one Module, Set of Parts (a Set of Parts is a flat list of Parts, on the contrary of an Assembly in which the Parts are structured), including two other Modules, <i>Part</i> and <i>Properties</i>. The Set of Parts Module produces a <i>PartSet</i> document which references a list of Parts (one document per Part), the PartSet document being referenced by a Properties document (one document per PartSet).
+\n\n
+The Set of Parts, its Properties and the Parts it references are all edited from the same Workshop window. The Properties and Part documents cannot be open independently of PartSet (the corresponding Modules being available only as included in Set of Parts).
+\n
+When creating a new PartSet, a Property document is automatically created. The Workbench of the Set of Parts Module includes a feature for creating a new Part. Once the first Part is created, the Workbenches of Part Module are activated. One Part of the ParSet being always active, the features of Part Module apply to this Part.
+\n
+When the user saves its session, all documents are saved: the PartSet, its Properties and each Part.
+\n\n
+\image html general_architecture_1.png
+\n
+
+<b>Summary of the general architecture of New GEOM:</b>
+<ul>
+<li> New GEOM consists of several Modules running within a Workshop.</li>
+<li> Each Module produces one type of Document only.</li>
+<li> A Module is made of Plug-in implementing the Features supported by the Module.</li>
+<li> These Features are structured by Workbenches.</li>
+<li> A Module can provide access to the Workbenches of other Modules by including these Modules.</li>
+<li> The Modules communicate with the Workshop through Interfaces.</li>
+<li> The API of New GEOM consists of the Interface of the Workshop and of Modules.</li>
+<li> A configuration file describes the composition of the Workshop where the Modules and the Plug-in are referenced by their Global Unique Identifier (GUID).</li>
+</ul>
+
+
+
+<h2>New GEOM as SALOME module</h2>
+
+The NewGeom package allows to launch the application as one of the module of SALOME platform. In that case all user interface elements are integrated into SALOME platform: the \b NewGeom package is used for this connection.
+
+Initially the New GEOM application is defined as a Light SALOME module, later it may be changed in order to manage the communication with other SALOME modules correctly.
+\n
+To integrate New GEOM into SALOME the next steps are done:
+<ol>
+<li> LightApp_Module class from SALOME GUI LightApp package is redefined. This redefined class provides a connection between LightApp_Module interface and Workshop object of the application.</li>
+<li>Provide Workshop with a <i>module</i> mode of launching in SALOME environment. In this case it is launched without its own main window, 3d viewer and main menu.</li>
+<li>In <i>module</i> mode workshop uses:
+ <ol>
+ <li>SALOME desktop as a main window.</li>
+ <li>OCC viewer from SALOME platform instead of its own 3d viewer.</li>
+ <li>SALOME main menu and toolbars for creation of workbenches commands.</li>
+ <li>Object Browser of New GEOM application is used instead of SALOME Object Browser.</li>
+ <li>Creation of a New GEOM property panel as a docking window of SALOME desktop.</li>
+ <li>Use SALOME Python console instead of console in main window. Since 3 packages from SALOME GUI module become shared between this project and SALOME mod-ules and they are independed from other SALOME parts, it is proposed in the future to detach it from SALOME platform into separated prerequisite product to avoid code duplication.</li>
+ </ol>
+</li>
+<li>Each workbench will be defined as a menu in main menu bar of SALOME desktop and as a toolbar with corresponded title.</li>
+<li>Each feature in the workbench will be defined as a menu item in the corresponded menu and a button in the corresponded toolbar.</li>
+<li>Object Browser of SALOME is hidden on activation of NewGEOM and restored on its deactivation.</li>
+<li>Object Browser and Property panel of NewGEOM is shown on activation of the module and hidden on its deactivation.</li>
+<li>Persistent of NewGEOM is compatible with persistent of SALOME. On saving of SALOME study the content of NewGEOM data structure is saved into study also and restored on restoring of study.</li>
+</ol>
+
+*/
--- /dev/null
+/*! \mainpage
+
+To browse the New GEOM module Developer Documentation, follow the links below or use navigation menu at the top and left of the page:
+<ul>
+<li> <a href="modules.html">Modules</a> - documentation of functionality splitted into groups.</li>
+<li> <a href="hierarchy.html">Class hierarchy</a></li> - graphical representation of classes hierarchy.</li>
+<li> <a href="annotated.html">Data Structures</a> - list of all data structures and classes with brief descriptions.</li>
+<li> <a href="files.html">Files</a> - list of all files with brief descriptions.</li>
+</ul>
+
+Also you may see \subpage general_architecture document that describes
+the main principles and terms of the development.
+
+The creation of new feature in C++ or python can be done with help of \subpage first_feature_help .
+
+*/
const std::string POINT_ATTR_SECOND = "secondPoint";
/**\class ConstructionPlugin_Axis
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of the new axis in PartSet.
*/
class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomPrs
const std::string DISTANCE_ATTR = "distance";
/**\class ConstructionPlugin_Plane
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of the new planar surface in PartSet.
*/
class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustomPrs
const std::string POINT_ATTR_Z = "z";
/**\class ConstructionPlugin_Point
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of the new part in PartSet.
*/
class ConstructionPlugin_Point : public ModelAPI_Feature
GeomAPI_Curve.cpp
GeomAPI_DataMapOfShapeShape.cpp
GeomAPI_Vertex.cpp
+ GeomAPI_ICustomPrs.cpp
)
SET(PROJECT_LIBRARIES
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: GeomAPI_ICustomPrs.cpp
+// Created: 11 Dec 2014
+// Author: Vitaly SMETANNIKOV
+
+#include <GeomAPI_ICustomPrs.h>
+
+GeomAPI_ICustomPrs::~GeomAPI_ICustomPrs()
+{
+
+}
#ifndef GeomAPI_ICustomPrs_H
#define GeomAPI_ICustomPrs_H
+#include "GeomAPI.h"
#include "GeomAPI_AISObject.h"
/**
class GeomAPI_ICustomPrs
{
public:
+ GEOMAPI_EXPORT virtual ~GeomAPI_ICustomPrs();
+
/// Modifies the given presentation in the custom way.
virtual void customisePresentation(AISObjectPtr thePrs) = 0;
};
typedef std::shared_ptr<GeomAPI_ICustomPrs> GeomCustomPrsPtr;
-#endif
\ No newline at end of file
+#endif
namespace BREPImport {
+/// Implementation of the import BREP files algorithms
GEOMALGOAPI_EXPORT
TopoDS_Shape Import(const TCollection_AsciiString& theFileName,
const TCollection_AsciiString& theFormatName,
#include <GeomAlgoAPI_MakeShape.h>
#include <GeomAPI_DataMapOfShapeShape.h>
#include <memory>
+
/**\class GeomAlgoAPI_Extrusion
* \ingroup DataAlgo
* \brief Allows to create the prism based on a given face and a direction
#include <GeomAlgoAPI.h>
/**\class GeomAlgoAPI_MakeShape
- * \ingroup DataModel
+ * \ingroup DataAlgo
* \brief Interface to the root class of all topological shapes constructions
*/
class GeomAlgoAPI_MakeShape : public GeomAPI_Interface
namespace STEPImport {
+/// Implementation of the import parameter from the STEP file
GEOMALGOAPI_EXPORT
Handle(TCollection_HAsciiString) GetValue(const TCollection_AsciiString& theFileName,
const TCollection_AsciiString& theParameterName,
TCollection_AsciiString& theError);
+
+/// Implementation of the import STEP files algorithms
GEOMALGOAPI_EXPORT
TopoDS_Shape Import(const TCollection_AsciiString& theFileName,
const TCollection_AsciiString& theFormatName, TCollection_AsciiString& theError,
class ModuleBase_IWorkshop;
/**
+* \class ModuleBase_FilterNoConsructionSubShapes
* A filter which provides filtering of selection in 3d viewer.
* Installing of this filter lets to select objects which belong to
* currently active document or to global document
/// \return State of editing mode flag
bool isEditingMode() const { return myIsEditing; }
- /// Set Enable/Disable state of Ok button
- /// \param theEnabled Enable/Disable state of Ok button
- virtual void setOkEnabled(bool theEnabled) = 0;
-
- /// \return Enable/disable state of Ok button
- virtual bool isOkEnabled() const = 0;
-
/// Set Enable/Disable state of Cancel button
/// \param theEnabled Enable/Disable state of Cancel button
virtual void setCancelEnabled(bool theEnabled) = 0;
#include <QList>
+/**
+* A class which provides access to selection.
+* A selection can be obtained as from a viewer as from Object browser in various forms
+*/
class ModuleBase_ISelection
{
public:
virtual QModelIndexList selectedIndexes() const = 0;
//! Returns list of currently selected AIS objects
+ //! \param theList returning list of selected AIS objects
virtual void selectedAISObjects(AIS_ListOfInteractive& theList) const = 0;
- //! Returns list of currently selected shapes
+ //! Returns list of currently selected shapes and their owners (objects).
+ //! Both lists are synchronized
+ //! \param theList returning list of selected AIS objects
+ //! \param theOwners list of objects
virtual void selectedShapes(NCollection_List<TopoDS_Shape>& theList,
std::list<ObjectPtr>& theOwners) const = 0;
}
}
-//**********************************************************
-//**********************************************************
-//**********************************************************
+/**
+* Implementation of preferences manager interface
+*/
class ModuleBase_PrefMgr: public ModuleBase_IPrefMgr
{
public:
+ /// Constructor
+ /// \param theMgr a preferences manager
ModuleBase_PrefMgr(ModuleBase_PreferencesMgr* theMgr):myMgr(theMgr) {}
virtual int addPreference(const QString& theLbl, int pId,
class SUIT_ResourceMgr;
class QWidget;
-/// \typedef ModuleBase_Pref Pair of values: section name, value name
+/// Pair of values: section name, value name
typedef QPair<QString, QString> ModuleBase_Pref;
-/// \typedef ModuleBase_Prefs list of preferences
+/// List of preferences
typedef QList<ModuleBase_Pref> ModuleBase_Prefs;
//***********************************************************************
class MODULEBASE_EXPORT ModuleBase_Preferences
{
public:
+ /// Name of preferences of viewer section
static const QString VIEWER_SECTION;
+
+ /// Name of preferences of menu section
static const QString MENU_SECTION;
+ /// Shows a dialog box to edit preferences
+ /// \param theModified a list of modified preferences
static bool editPreferences(ModuleBase_Prefs& theModified);
/// Returns currently installed resource manager
static void updateConfigByResources();
/// Updates SUIT_ResourceMgr values by Config_PropManager properties
- /// \param theUpdateOnlyInvalid flag to update only invalid values, if it is false, all are updated
static void updateResourcesByConfig();
/// Set default values to the Config_PropManager properties
{
}
+ /// Returns True if preferences were modified
ModuleBase_Prefs modified() const
{
return myModified;
}
protected:
+ /// Store changed resource
virtual void changedResources(const ResourceMap& theMap);
private:
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theResurces resources manager
+ /// \param theParent a parent widget
ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0);
virtual ~ModuleBase_PreferencesDlg();
+ /// Returns True if preferences were changed
bool isChanged() const
{
return myIsChanged;
}
+ /// Returns list of modified preferences
+ /// \param theModified output list of modified preferences
void modified(ModuleBase_Prefs& theModified) const;
public slots:
+ /// A slot called on Ok button press
virtual void accept();
protected slots:
+ /// A slot called on Default button press
void onDefault();
private:
DEFINE_STANDARD_HANDLE(ModuleBase_ResultPrs, AIS_Shape)
+/**
+* A redefinition of standard AIS Interactive Object in order to provide specific behaviour
+* for wire presentations based in a one plane
+*/
class ModuleBase_ResultPrs: public AIS_Shape
{
public:
+ /// Constructor
+ /// \param theResult a result object
Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult);
+ /// Returns result object
Standard_EXPORT ResultPtr getResult() const { return myResult; }
+ /// Returns True if the presentation is in sketch mode
Standard_EXPORT bool isSketchMode() const { return myIsSketchMode; }
DEFINE_STANDARD_RTTI(ModuleBase_ResultPrs)
protected:
+ /// Redefinition of virtual function
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
+ /// Redefinition of virtual function
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode) ;
private:
+ /// Reference to result object
ResultPtr myResult;
+ /// A sketch mode flag
bool myIsSketchMode;
+ /// Original shape of the result object
TopoDS_Shape myOriginalShape;
+
+ /// List of faces
std::list<std::shared_ptr<GeomAPI_Shape> > myFacesList;
};
/**
+* \class ModuleBase_ShapeDocumentFilter
* A filter which provides filtering of selection in 3d viewer.
* Installing of this filter lets to select objects which belong to
* currently active document or to global document
};
/**
+* \class ModuleBase_ShapeInPlaneFilter
* A filter which provides filtering of selection in 3d viewer.
* Installing of this filter lets to select of Vertexes and Edges which belongs to the given plane
*/
/**
+* \class ModuleBase_ObjectTypesFilter
* A filter which provides filtering of selection in 3d viewer.
* Installing of this filter lets to select only object of requested type
* Accepts following objects types:
class QWidget;
class QCheckBox;
+/**
+* Implementation of widget for boolean input (check box)
+*/
class MODULEBASE_EXPORT ModuleBase_WidgetBoolValue : public ModuleBase_ModelWidget
{
Q_OBJECT
public:
/// Constructor
- /// \theParent the parent object
- /// \theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParent the parent object
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
ModuleBase_WidgetBoolValue(QWidget* theParent, const Config_WidgetAPI* theData,
const std::string& theParentId);
virtual ~ModuleBase_WidgetBoolValue();
- /// Saves the internal parameters to the given feature
- /// \param theObject a model feature to be changed
virtual bool storeValue() const;
virtual bool restoreValue();
- /// Returns list of widget controls
- /// \return a control list
virtual QList<QWidget*> getControls() const;
- /// Returns the internal parent wiget control, that can be shown anywhere
- /// \returns the widget
QWidget* getControl() const;
private:
+ /// The check box
QCheckBox* myCheckBox;
};
class QLabel;
class QComboBox;
+/**
+* Implementation of model widget for choice widget definition (combo box)
+* It can be defined as following:
+* \code
+* <choice id="bool_type"
+* label="Type"
+* tooltip="Type of boolean operation"
+* string_list="Cut Fuse Common"
+* />
+* \endcode
+*/
class MODULEBASE_EXPORT ModuleBase_WidgetChoice : public ModuleBase_ModelWidget
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
ModuleBase_WidgetChoice(QWidget* theParent, const Config_WidgetAPI* theData,
const std::string& theParentId);
virtual ~ModuleBase_WidgetChoice();
- /// Saves the internal parameters to the given feature
- /// \param theObject a model feature to be changed
virtual bool storeValue() const;
virtual bool restoreValue();
}
/// Returns list of widget controls
- /// \return a control list
+ /// \return a controls list
virtual QList<QWidget*> getControls() const;
private slots:
+ /// Slot called on combo box index change
void onCurrentIndexChanged(int theIndex);
private:
+ /// Container widget
QWidget* myContainer;
+
+ /// The label
QLabel* myLabel;
+
+ /// The control
QComboBox* myCombo;
};
Q_OBJECT
public:
/// Constructor
- /// \theParent the parent object
- /// \theParent the parent object
- /// \theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParent the parent object
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
ModuleBase_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData,
const std::string& theParentId);
/// Constructor
- /// \theParent the parent object
- /// \theParent the parent object
- /// \theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParent the parent object
+ /// \param theAttribute The attribute of the model widget
ModuleBase_WidgetEditor(QWidget* theParent, const std::string& theAttribute);
/// Destructor
void showPopupEditor();
private:
- FeaturePtr myFeature; ///< the current widget feature
- QStringList myFeatureKinds; ///< the kinds of possible features
+ ///< the current widget feature
+ FeaturePtr myFeature;
+
+ ///< the kinds of possible features
+ QStringList myFeatureKinds;
};
#endif
return aMultiselectorWgt->getControl();
}
-QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) const
+QString ModuleBase_WidgetFactory::qs(const std::string& theStdString)
{
return QString::fromStdString(theStdString);
}
class Config_WidgetAPI;
class ModuleBase_IWorkshop;
+/**
+* A class for creation of widgets instances in for property panel using XML deskription of
+* a feature
+*/
class MODULEBASE_EXPORT ModuleBase_WidgetFactory
{
public:
+ /// Constructor
+ /// \param theXmlRepresentation content of XML file
+ /// \param theWorkshop reference to workshop instance
ModuleBase_WidgetFactory(const std::string& theXmlRepresentation,
ModuleBase_IWorkshop* theWorkshop);
virtual ~ModuleBase_WidgetFactory();
+ /// Creates content widget for property panel
+ /// \param theParent a parent widget
void createWidget(QWidget* theParent);
+ /// Returns list of model widgets
QList<ModuleBase_ModelWidget*> getModelWidgets() const
{
return myModelWidgets;
}
protected:
- //Widgets
+ /// Create widget by its type
+ /// \param theType a type
+ /// \param theParent a parent widget
QWidget* createWidgetByType(const std::string& theType, QWidget* theParent = NULL);
+
+ /// Create a widget of container type
+ /// \param theType a type
+ /// \param theParent a parent widget
QWidget* createContainer(const std::string& theType, QWidget* theParent = NULL);
+
+ /// Create label widget
+ /// \param theParent a parent widget
QWidget* labelControl(QWidget* theParent);
+
+ /// Create double spin box widget
+ /// \param theParent a parent widget
QWidget* doubleSpinBoxControl(QWidget* theParent);
+
+ /// Create double value editor widget
+ /// \param theParent a parent widget
QWidget* doubleValueEditor(QWidget* theParent);
+
+ /// Create shape selector widget
+ /// \param theParent a parent widget
QWidget* shapeSelectorControl(QWidget* theParent);
+
+ /// Create boolean input widget
+ /// \param theParent a parent widget
QWidget* booleanControl(QWidget* theParent);
+
+ /// Create file selector widget
+ /// \param theParent a parent widget
QWidget* fileSelectorControl(QWidget* theParent);
+
+ /// Create choice widget (combo box)
+ /// \param theParent a parent widget
QWidget* choiceControl(QWidget* theParent);
+
+ /// Create line edit widget
+ /// \param theParent a parent widget
QWidget* lineEditControl(QWidget* theParent);
- QWidget* multiSelectorControl(QWidget* theParent);
+ /// Create multi selector widget
+ /// \param theParent a parent widget
+ QWidget* multiSelectorControl(QWidget* theParent);
- QString qs(const std::string& theStdString) const;
+ /// Convert STD string to QT string
+ /// \param theStdString is STD string
+ static QString qs(const std::string& theStdString);
private:
+ /// API object for XML reading
Config_WidgetAPI* myWidgetApi;
+
+ /// Reference to workshop
ModuleBase_IWorkshop* myWorkshop;
+ /// List of created model widgets
QList<ModuleBase_ModelWidget*> myModelWidgets;
+
+ /// Id of current parent
std::string myParentId;
};
class QWidget;
class QLineEdit;
+/**
+* Implementation of model widget for open file widget.
+* It can be defined as following:
+* \code
+* <file_selector
+* id="import_file_selector"
+* title="Import file"
+* path="">
+* <validator id="ExchangePlugin_ImportFormat" parameters="BREP:BREPImport,STEP:STEPImport" />
+* </file_selector>
+* \endcode
+*/
class MODULEBASE_EXPORT ModuleBase_WidgetFileSelector : public ModuleBase_ModelWidget
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
ModuleBase_WidgetFileSelector(QWidget* theParent,
const Config_WidgetAPI* theData,
const std::string& theParentId);
virtual ~ModuleBase_WidgetFileSelector();
- /// Saves the internal parameters to the given feature
- /// \param theObject a model feature to be changed
virtual bool storeValue() const;
virtual bool restoreValue();
- /// Returns the internal parent wiget control, that can be shown anywhere
- /// \returns the widget
QWidget* getControl() const;
- /// Returns list of widget controls
- /// \return a control list
virtual QList<QWidget*> getControls() const;
/// Returns true if a file on the current path in the line edit
bool isCurrentPathValid();
public slots:
+ /// Processing of path selection button press
void onPathSelectionBtn();
+
+ /// Processing of path changing
void onPathChanged();
protected:
+ /// Returns string containing formats
QString formatsString() const;
+
+ /// Return list of validator formats
QStringList getValidatorFormats() const;
private:
+ /// A control for path input
QLineEdit* myPathField;
+
+ /// Container
QWidget* myMainWidget;
+ /// A title of open file dialog box
QString myTitle;
+
+ /// Default path
QString myDefaultPath;
};
class QLabel;
+/**
+* Implementation of model widget for a label control
+*/
class MODULEBASE_EXPORT ModuleBase_WidgetLabel : public ModuleBase_ModelWidget
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
ModuleBase_WidgetLabel(QWidget* theParent, const Config_WidgetAPI* theData,
const std::string& theParentId);
virtual bool focusTo() { return false; }
private:
+ /// A label control
QLabel* myLabel;
};
class QWidget;
class QLineEdit;
+/**
+* Implementation of model widget for line edit widget.
+* It can be defined with "stringvalue" keyword.
+*/
class MODULEBASE_EXPORT ModuleBase_WidgetLineEdit : public ModuleBase_ModelWidget
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
ModuleBase_WidgetLineEdit(QWidget* theParent,
const Config_WidgetAPI* theData,
const std::string& theParentId);
virtual ~ModuleBase_WidgetLineEdit();
- /// Saves the internal parameters to the given feature
- /// \param theObject a model feature to be changed
virtual bool storeValue() const;
virtual bool restoreValue();
- /// Returns the internal parent wiget control, that can be shown anywhere
- /// \returns the widget
QWidget* getControl() const;
- /// Returns list of widget controls
- /// \return a control list
virtual QList<QWidget*> getControls() const;
public slots:
+ /// A slot for processing text changed event
void onTextChanged();
private:
+ /// A line edit control
QLineEdit* myLineEdit;
+
+ /// A container widget
QWidget* myMainWidget;
};
/// If true then local selector has to be activated in context
bool myIsActive;
- /// \typedef GeomSelection provides correspondance between Result object and its shape
+ /// Provides correspondance between Result object and its shape
typedef QPair<ResultPtr, GeomShapePtr> GeomSelection;
/// Variable of GeomSelection type
virtual bool restoreValue();
+ /// Defines if it is supposed that the widget should interact with the viewer.
+ virtual bool isViewerSelector() { return true; }
+
/// Returns the internal parent wiget control, that can be shown anywhere
/// \returns the widget
QWidget* getControl() const
class QComboBox;
class QVBoxLayout;
+/**
+* \ingroup GUI
+* Implements a model widget for swithch as a container widget. It can be defined in XML with "switch" keyword
+*/
class MODULEBASE_EXPORT ModuleBase_WidgetSwitch : public QFrame
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param parent a parent widget
ModuleBase_WidgetSwitch(QWidget* parent = NULL);
virtual ~ModuleBase_WidgetSwitch();
+ /// Add a page to the widget
+ /// \param theWidget a page widget
+ /// \param theName a name of page
int addPage(QWidget * theWidget, const QString & theName);
+
+ /// Returns count of pages
int count() const;
+
+ /// Returns index of current page
int currentIndex() const;
+
+ /// Returns current widget (page)
QWidget * currentWidget() const;
+
+ /// Returns index of widget (page)
+ /// \param theWidget a widget page
int indexOf(QWidget * theWidget) const;
+
+ /// Insert page
+ /// \param index an index (position) to insert
+ /// \param theWidget a page widget
+ /// \param theName a name of the page
int insertPage(int index, QWidget * theWidget, const QString & theName);
+
+ /// Returns True if a page by given index is enabled
+ /// \param index index of the page
bool isPageEnabled(int index) const;
+
+ /// Returns text of the page by its id
+ /// \param index index of the page
QString pageText(int index) const;
+
+ /// Returns tooltip of the page by its id
+ /// \param index index of the page
QString pageToolTip(int index) const;
+
+ /// Remove page by its id
+ /// \param index index of the page
void removePage(int index);
+
+ /// Enale/disable a page by its Id
+ /// \param index index of the page
+ /// \param enabled an enable flag
void setPageEnabled(int index, bool enabled);
+
+ /// Set page name
+ /// \param index index of the page
+ /// \param text a name of the page
void setPageName(int index, const QString & text);
+
+ /// Set page tooltip
+ /// \param index index of the page
+ /// \param toolTip a tooltip of the page
void setPageToolTip(int index, const QString & toolTip);
public slots:
+ /// Set current page by index
+ /// \param index index of the page
void setCurrentIndex(int index);
signals:
+ /// Emitted on current page change
void currentPageChanged(int);
protected:
+ /// Update widget
void refresh();
private:
+ /// Layout
QVBoxLayout* myMainLay;
+
+ /// Combo box
QComboBox* myCombo;
+
+ /// List of pages
QWidgetList myCases;
};
class NewGeom_Module;
+/**
+* \ingroup Salome
+* A Data Model class provides a connection of SALOME data structure and OpenParts application data model
+*/
class NewGeom_EXPORT NewGeom_DataModel : public LightApp_DataModel
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theModule a module instance
NewGeom_DataModel(NewGeom_Module* theModule);
virtual ~NewGeom_DataModel();
+ /// Open a data file
+ /// \param thePath a path to the directory
+ /// \param theStudy a current study
+ /// \param theFiles a list of files to open
virtual bool open(const QString& thePath, CAM_Study* theStudy, QStringList theFiles);
+
+ /// Save module data to file
+ /// \param theFiles list of created files
virtual bool save(QStringList& theFiles);
+
+ /// Save module data to a file
+ /// \param thePath a path to the directory
+ /// \param theStudy a current study
+ /// \param theFiles a list of files to open
virtual bool saveAs(const QString& thePath, CAM_Study* theStudy, QStringList& theFiles);
+
+ /// Close data structure
virtual bool close();
+
+ /// Create data structure
+ /// \param theStudy a current study
virtual bool create(CAM_Study* theStudy);
+ /// Returns True if the data structure has been modified
virtual bool isModified() const;
+
+ /// Returns True if the data structure is already saved
virtual bool isSaved() const;
+ /// Update data object
+ /// \param theObj an data object
+ /// \param theStudy a current study
virtual void update(LightApp_DataObject* theObj = 0, LightApp_Study* theStudy = 0);
protected:
static void removeDirectory(const QString& theDirectoryName);
private:
+ /// Pat to a study file
QString myStudyPath;
- QString myTmpDirectory; /// a path to the temporary directory, created by opening a document file
+
+ /// a path to the temporary directory, created by opening a document file
+ QString myTmpDirectory;
+
/// it should be created because the files reading is postponed in the module. The directory
// should be removed after the model document is closed.
NewGeom_Module* myModule;
#include <LightApp_OCCSelector.h>
+/**
+* Redefinition of standard OCC selector in order to adapt it to NewGeom needs
+*/
class NewGeom_EXPORT NewGeom_OCCSelector : public LightApp_OCCSelector
{
public:
+ /// Constructor
+ /// \param theViewer a viewer
+ /// \param theMgr a selection manager
NewGeom_OCCSelector(OCCViewer_Viewer* theViewer, SUIT_SelectionMgr* theMgr);
virtual ~NewGeom_OCCSelector();
protected:
+ /// Redifinition of virtual function
virtual void getSelection(SUIT_DataOwnerPtrList& theList) const;
+
+ /// Redifinition of virtual function
virtual void setSelection(const SUIT_DataOwnerPtrList& theList);
};
class OCCViewer_Viewer;
class SUIT_ViewManager;
-
+/**
+* A class for providing access of NewGeom functionality to
+* SALOME view window functionality
+*/
class NewGeom_SalomeView: public ModuleBase_IViewWindow
{
public:
+ /// Constructor
+ /// \param theViewer a reference to a viewer
NewGeom_SalomeView(OCCViewer_Viewer* theViewer) { myViewer = theViewer; }
virtual Handle(V3d_View) v3dView() const;
OCCViewer_Viewer* viewer() const { return myViewer; }
private:
+ /// A reference to a viewer
OCCViewer_Viewer* myViewer;
};
+/**
+* A class for providing access of NewGeom functionality to
+* SALOME viewer functionality
+*/
class NewGeom_SalomeViewer : public ModuleBase_IViewer
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent a parent object
NewGeom_SalomeViewer(QObject* theParent);
~NewGeom_SalomeViewer();
aPnt2dWgt->setPoint(aPoint->x(), aPoint->y());
PartSet_Tools::setConstraints(mySketchMgr->activeSketch(), theOperation->feature(),
aWgt->attributeID(), aPoint->x(), aPoint->y());
- theOperation->propertyPanel()->activateNextWidget(aPnt2dWgt);
+ aPanel->activateNextWidget(aPnt2dWgt);
}
}
}
if (!(theEvent->buttons() & Qt::LeftButton))
return;
+ ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
+ ModuleBase_Operation* aOperation = aWorkshop->currentOperation();
+ if (aOperation && aOperation->isEditOperation()) {
+ ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
+ ModuleBase_ModelWidget* aActiveWgt = aPanel->activeWidget();
+ // If the current widget is a selector, do do nothing, it processes the mouse press
+ if(aActiveWgt && aActiveWgt->isViewerSelector()) {
+ return;
+ }
+ }
+
// Clear dragging mode
myIsDragging = false;
- ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
- ModuleBase_Operation* aOperation = aWorkshop->currentOperation();
// Use only for sketch operations
if (aOperation && myCurrentSketch) {
if (!PartSet_Tools::sketchPlane(myCurrentSketch))
#include <XGUI_ModuleConnector.h>
#include <XGUI_SelectionMgr.h>
#include <XGUI_Selection.h>
-#include <XGUI_PropertyPanel.h>
#include <XGUI_OperationMgr.h>
#include <ModuleBase_DoubleSpinBox.h>
QIntList aModes;
aModes << TopAbs_VERTEX;
myWorkshop->moduleConnector()->activateSubShapesSelection(aModes);
- // the control value is stored to the mode by the focus in on the widget
- // we need the value is initialized in order to enable the apply button in the property panel
- storeValue();
+ if (!isEditingMode()) {
+ // the control value is stored to the mode by the focus in on the widget
+ // we need the value is initialized in order to enable the apply button in the property panel
+ // it should happens only in the creation mode because during edition all fields are filled
+ storeValue();
+ }
}
void PartSet_WidgetPoint2D::deactivate()
// the Ok button should be disabled in the property panel by moving the mouse point in the viewer
// this leads that the user does not try to click Ok and it avoids an incorrect situation that the
// line is moved to the cursor to the Ok button
- myWorkshop->propertyPanel()->setOkEnabled(false);
+ myWorkshop->operationMgr()->setApplyEnabled(false);
gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWnd->v3dView());
void PartSet_WidgetPoint2dDistance::onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
myWorkshop->operationMgr()->setLockValidating(true);
- myWorkshop->propertyPanel()->setOkEnabled(false);
+ myWorkshop->operationMgr()->setApplyEnabled(false);
gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWnd->v3dView());
#include "PartSet_WidgetShapeSelector.h"
#include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Validator.h>
+#include <ModelAPI_RefAttrValidator.h>
+#include <ModelAPI_ResultValidator.h>
+
#include <PartSet_Tools.h>
#include <SketchPlugin_Feature.h>
if (aRefAttr) {
TopoDS_Shape aShape = myShape->impl<TopoDS_Shape>();
AttributePtr aPntAttr = PartSet_Tools::findAttributeBy2dPoint(mySelectedObject, aShape, mySketch);
+
// this is an alternative, whether the attribute should be set or object in the attribute
// the first check is the attribute because the object already exist
// the object is set only if there is no selected attribute
return ModuleBase_WidgetShapeSelector::storeValue();
}
+//********************************************************************
+bool PartSet_WidgetShapeSelector::isValid(ObjectPtr theObj, std::shared_ptr<GeomAPI_Shape> theShape)
+{
+ // the method is redefined to analize the selected shape in validators
+ SessionPtr aMgr = ModelAPI_Session::get();
+ ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
+ std::list<ModelAPI_Validator*> aValidators;
+ std::list<std::list<std::string> > anArguments;
+ aFactory->validators(parentID(), attributeID(), aValidators, anArguments);
+
+ // Check the type of selected object
+ std::list<ModelAPI_Validator*>::iterator aValidator = aValidators.begin();
+ bool isValid = true;
+ for (; aValidator != aValidators.end(); aValidator++) {
+ const ModelAPI_ResultValidator* aResValidator =
+ dynamic_cast<const ModelAPI_ResultValidator*>(*aValidator);
+ if (aResValidator) {
+ isValid = false;
+ if (aResValidator->isValid(theObj)) {
+ isValid = true;
+ break;
+ }
+ }
+ }
+ if (!isValid)
+ return false;
+
+ // Check the acceptability of the object and shape as validator attribute
+ AttributePtr aPntAttr;
+ DataPtr aData = myFeature->data();
+ if (theShape.get() != NULL) {
+ AttributePtr aAttr = aData->attribute(attributeID());
+ AttributeRefAttrPtr aRefAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aAttr);
+ if (aRefAttr) {
+ TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+ aPntAttr = PartSet_Tools::findAttributeBy2dPoint(theObj, aShape, mySketch);
+ }
+ }
+ // Check the acceptability of the object as attribute
+ aValidator = aValidators.begin();
+ std::list<std::list<std::string> >::iterator aArgs = anArguments.begin();
+ for (; aValidator != aValidators.end(); aValidator++, aArgs++) {
+ const ModelAPI_RefAttrValidator* aAttrValidator =
+ dynamic_cast<const ModelAPI_RefAttrValidator*>(*aValidator);
+ if (aAttrValidator) {
+ if (aPntAttr.get() != NULL)
+ {
+ if (!aAttrValidator->isValid(myFeature, *aArgs, aPntAttr)) {
+ return false;
+ }
+ }
+ else
+ {
+ if (!aAttrValidator->isValid(myFeature, *aArgs, theObj)) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+}
+
//*********************************************
bool PartSet_WidgetConstraintShapeSelector::storeValue() const
{
}
return ModuleBase_WidgetShapeSelector::storeValue();
}
-
void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
CompositeFeaturePtr sketch() const { return mySketch; }
+protected:
+ /// Check the selected with validators if installed
+ virtual bool isValid(ObjectPtr theObj, std::shared_ptr<GeomAPI_Shape> theShape);
+
private:
CompositeFeaturePtr mySketch;
};
#include "PartSetPlugin_Part.h"
/**\class PartSetPlugin_Duplicate
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Duplicates the active part (not root). Creates a new "part" feature.
*/
class PartSetPlugin_Duplicate : public PartSetPlugin_Part
#include <ModelAPI_Feature.h>
/**\class PartSetPlugin_Part
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of the new part in PartSet.
*/
class PartSetPlugin_Part : public ModelAPI_Feature
#include <ModelAPI_Feature.h>
/**\class PartSetPlugin_Remove
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of the new part in PartSet.
*/
class PartSetPlugin_Remove : public ModelAPI_Feature
#include <GeomAPI_IPresentable.h>
/**\class SketchPlugin_Arc
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of the new arc of circle in PartSet.
* The visualization of this object is separated in two parts. The first one is an AIS object
* calculated when there is non-initialized attributes of the arc. The second is a result and
#include <GeomAPI_IPresentable.h>
/**\class SketchPlugin_Circle
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of the new circle in PartSet.
*/
class SketchPlugin_Circle : public SketchPlugin_Feature
#include <list>
-/* Description:
+/** Description:
* Each constraint uses a set of parameters. In the SolveSpace library
* these parameters are named "valA", "ptA", "ptB", "entityA", "entityB".
* The "ptA" and "ptB" parameters represents a point in the constraint.
*/
/** \class SketchPlugin_ConstraintBase
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of a new constraint between other features.
* Some feature's methods implemented here as dummy to
* Base class for all constraints.
#include <list>
/** \class SketchPlugin_ConstraintCoincidence
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of a new constraint which defines equivalence of two points
*
* This constraint has two attributes:
#define DISTANCE_COLOR "#ff00ff"
/** \class SketchPlugin_ConstraintDistance
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of a new constraint which defines a distance
* between a point and another feature (point, line, plane or face)
*
#define LENGTH_COLOR "#ff00ff"
/** \class SketchPlugin_ConstraintLength
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of a new constraint which defines a length of a line segment
*
* This constraint has two attributes:
#define PARALLEL_COLOR "#ffff00"
/** \class SketchPlugin_ConstraintParallel
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of a new constraint parallelism of two lines
*
* This constraint has two attributes:
#define PERPENDICULAR_COLOR "#ffff00"
/** \class SketchPlugin_ConstraintPerpendicular
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of a new constraint for perpendicularity of two lines
*
* This constraint has two attributes:
#define RADIUS_COLOR "#ff00ff"
/** \class SketchPlugin_ConstraintRadius
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of a new constraint which defines
* a radius of a circle or an arc of circle
*
#define FIXING_COLOR "#ffff00"
/** \class SketchPlugin_ConstraintRigid
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of a new constraint which defines immovable object
*
* This constraint has one attribute:
class Handle_AIS_InteractiveObject;
/**\class SketchPlugin_Feature
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of the new feature in PartSet. This is an abstract class to give
* an interface to create the sketch feature preview.
*/
#include <list>
/**\class SketchPlugin_Line
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of the new part in PartSet.
*/
class SketchPlugin_Line : public SketchPlugin_Feature
#include <ModelAPI_Events.h>
/**\class SketchPlugin_Plugin
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Interface common for any plugin: allows to use plugin by the plugins manager.
*/
class SKETCHPLUGIN_EXPORT SketchPlugin_Plugin : public ModelAPI_Plugin, public Events_Listener
#include <list>
/**\class SketchPlugin_Point
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of a new point.
*/
class SketchPlugin_Point : public SketchPlugin_Feature
#define PLANE_SIZE "200"
/**\class SketchPlugin_Sketch
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Feature for creation of the new part in PartSet.
*/
class SketchPlugin_Sketch : public ModelAPI_CompositeFeature//, public GeomAPI_IPresentable
// If the object is not a line then it is accepted
const ModelAPI_ResultValidator* aLineValidator =
dynamic_cast<const ModelAPI_ResultValidator*>(aFactory->validator("SketchPlugin_ResultLine"));
- if (!aLineValidator->isValid(theObject))
+ bool aLineValid = aLineValidator->isValid(theObject);
+
+ const ModelAPI_ResultValidator* anArcValidator =
+ dynamic_cast<const ModelAPI_ResultValidator*>(aFactory->validator("SketchPlugin_ResultArc"));
+ bool anArcValid = anArcValidator->isValid(theObject);
+
+ if (!aLineValid && !anArcValid)
return true;
// If it is a line then we have to check that first attribute id not a line
bool SketchPlugin_DistanceAttrValidator::isValid(
const AttributePtr& theAttribute, const std::list<std::string>& theArguments ) const
{
- std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
- if (anAttr) {
- const ObjectPtr& anObj = theAttribute->owner();
- const FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObj);
- return isValid(aFeature, theArguments, anAttr->object());
- }
- return true; // it may be not reference attribute, in this case, it is OK
+ // any point attribute is acceptable for the distance operation
+ return true;
+}
+
+bool SketchPlugin_DistanceAttrValidator::isValid(const FeaturePtr& theFeature,
+ const std::list<std::string>& theArguments,
+ const AttributePtr& theAttribute) const
+{
+ return isValid(theAttribute, theArguments);
}
bool SketchPlugin_DifferentObjectsValidator::isValid(const FeaturePtr& theFeature,
//! Returns true if the attribute is good for the feature attribute
virtual bool isValid(const FeaturePtr& theFeature, const std::list<std::string>& theArguments,
- const AttributePtr& theAttribute) const { return true; };
+ const AttributePtr& theAttribute) const;
};
/**\class SketchPlugin_DifferentObjectsValidator
tooltip="Select point, line end point, line, center of circle or arc."
shape_types="edge vertex">
<validator id="SketchPlugin_DifferentObjects"/>
+ <validator id="SketchPlugin_DistanceAttr" parameters="ConstraintEntityA"/>
<selection_filter id="MultiFilter" parameters="line,vertex"/>
</sketch_shape_selector>
#include <vector>
/** \class SketchSolver_Constraint
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Obtain information about SketchPlugin's constraint
*/
class SketchSolver_Constraint
ConstraintMap;
/** \class SketchSolver_ConstraintGroup
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Keeps the group of constraints which based on the same entities
*/
class SketchSolver_ConstraintGroup
#include <set>
/** \class SketchSolver_ConstraintManager
- * \ingroup DataModel
+ * \ingroup Plugins
* \brief Listens the changes of SketchPlugin features and transforms the Constraint
* feature into the format understandable by SolveSpace library.
*
class ModuleBase_Operation;
class QAction;
+/**
+* \ingroup GUI
+* A class for management of actions (features) activation/deactivation
+*/
class XGUI_EXPORT XGUI_ActionsMgr : public QObject, public Events_Listener
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theWorkshop an instance of workshop
XGUI_ActionsMgr(XGUI_Workshop* theWorkshop);
virtual ~XGUI_ActionsMgr();
//! Please note that nested commands in the Salome mode (No AppElements_Command, pure QActions)
//! won't be extracted and should be added manually using the addNestedCommands method.
void addCommand(QAction* theCmd);
+
//! Sets relation between the command (with given Id) and it's nested actions.
void addNestedCommands(const QString& theId, const QStringList& theCommands);
+ //! Returns list of nested commands by parent command Id
+ //! \param theId a parent command Id
QStringList nestedCommands(const QString& theId) const;
+ /// Returns True if the given Id is an Id of nested command
+ /// \param theId an Id to check
bool isNested(const QString& theId) const;
+ /// Registers shortcut (key sequence) for the command triggering
+ /// \param theKeySequence a key sequence to register
QKeySequence registerShortcut(const QString& theKeySequence);
//! Redefinition of Events_Listener method
class QTextEdit;
+/**
+* A class of dialog to show error message
+*/
class XGUI_ErrorDialog : public QDialog
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param parent a parent widget
XGUI_EXPORT XGUI_ErrorDialog(QWidget* parent);XGUI_EXPORT virtual ~XGUI_ErrorDialog();
public slots:
- XGUI_EXPORT void refresh();XGUI_EXPORT void clear();XGUI_EXPORT void addError(const QString&);XGUI_EXPORT void removeError(
- const QString&);
+ /// Update dialog box
+ XGUI_EXPORT void refresh();
+
+ /// Clear messages
+ XGUI_EXPORT void clear();
+
+ /// Add error message
+ XGUI_EXPORT void addError(const QString&);
+
+ /// Remove error message
+ XGUI_EXPORT void removeError(const QString&);
private:
+ /// Widget for error log
QTextEdit* myErrorLog;
+
+ /// List of errors
QStringList myErrors;
};
class XGUI_DocumentDataModel;
class QLineEdit;
+/**
+* \ingroup GUI
+* Implementation of Data Tree object for Object Browser
+*/
class XGUI_DataTree : public QTreeView
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent a parent widget
XGUI_DataTree(QWidget* theParent);
virtual ~XGUI_DataTree();
return mySelectedData;
}
+ /// Returns current data model
XGUI_DocumentDataModel* dataModel() const;
signals:
//! Emited when selection is changed
void selectionChanged();
+
+ //! Emited when active part changed
void activePartChanged(ObjectPtr thePart);
//! Emited on context menu request
void contextMenuRequested(QContextMenuEvent* theEvent);
public slots:
+ /// Clear content of data tree
virtual void clear();
protected slots:
+ /// Commit modified data (used for renaming of objects)
virtual void commitData(QWidget* theEditor);
protected:
+ /// Redefinition of virtual method
virtual void mouseDoubleClickEvent(QMouseEvent* theEvent);
+
+ /// Redefinition of virtual method
virtual void contextMenuEvent(QContextMenuEvent* theEvent);
private slots:
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent a parent widget
XGUI_ObjectsBrowser(QWidget* theParent);
virtual ~XGUI_ObjectsBrowser();
return myObjectsList;
}
+ /// Set selected list of objects
+ /// \param theObjects list of objects to select
void setObjectsSelected(const QObjectPtrList& theObjects);
//! Returns currently selected indexes
//! Activates currently selected part. Signal activePartChanged will not be sent
void activatePart(const ResultPartPtr& thePart);
+ /// Rebuild data tree
void rebuildDataTree();
+ /// Process application event
+ /// \param theMessage an event message
void processEvent(const std::shared_ptr<Events_Message>& theMessage);
- // Resets the object browser into initial state
+ /// Resets the object browser into initial state
void clearContent();
signals:
void contextMenuRequested(QContextMenuEvent* theEvent);
protected:
+ /// Redefinition of virtual method
virtual bool eventFilter(QObject* obj, QEvent* theEvent);
private slots:
+ /// Activate part
+ /// \param thePart a part to activate
void onActivePartChanged(ObjectPtr thePart);
+
+ /// Show context menu
+ /// \param theEvent a context menu event
void onContextMenuRequested(QContextMenuEvent* theEvent);
+
+ /// Show context menu on upper label
+ /// \param thePnt a position of context menu
void onLabelContextMenuRequested(const QPoint& thePnt);
//! Called on Edit command request
void onEditItem();
+ /// Process selection changed event
void onSelectionChanged();
private:
return;
ModuleBase_Operation* anOperation = currentOperation();
if(anOperation && (!myIsValidationLock)) {
- bool isValid = anOperation->isValid();
- emit operationValidated(isValid);
+ setApplyEnabled(anOperation->isValid());
}
}
+void XGUI_OperationMgr::setApplyEnabled(const bool theEnabled)
+{
+ myIsApplyEnabled = theEnabled;
+ emit applyEnableChanged(theEnabled);
+}
+
+bool XGUI_OperationMgr::isApplyEnabled() const
+{
+ return myIsApplyEnabled;
+}
+
+bool XGUI_OperationMgr::canStopOperation()
+{
+ ModuleBase_Operation* anOperation = currentOperation();
+ if(operationsCount() > 1) //in case of nested (sketch) operation no confirmation needed
+ return true;
+ if (anOperation && anOperation->isModified()) {
+ QString aMessage = tr("%1 operation will be aborted.").arg(anOperation->id());
+ int anAnswer = QMessageBox::question(qApp->activeWindow(),
+ tr("Abort operation"),
+ aMessage,
+ QMessageBox::Ok | QMessageBox::Cancel,
+ QMessageBox::Cancel);
+ return anAnswer == QMessageBox::Ok;
+ }
+ return true;
+}
+
bool XGUI_OperationMgr::commitOperation()
{
if (hasOperation() && currentOperation()->isValid()) {
ModuleBase_Operation* aCurrentOp = currentOperation();
if (aCurrentOp) {
if (!aCurrentOp->isGranted(theId)) {
- if (canAbortOperation()) {
- aCurrentOp->abort();
+ if (canStopOperation()) {
+ if (myIsApplyEnabled)
+ aCurrentOp->commit();
+ else
+ aCurrentOp->abort();
} else {
aCanStart = false;
}
void XGUI_OperationMgr::onAbortOperation()
{
- if (hasOperation() && canAbortOperation()) {
+ if (hasOperation() && canStopOperation()) {
currentOperation()->abort();
}
}
-bool XGUI_OperationMgr::canAbortOperation()
-{
- ModuleBase_Operation* anOperation = currentOperation();
- if(operationsCount() > 1) //in case of nested (sketch) operation no confirmation needed
- return true;
- if (anOperation && anOperation->isModified()) {
- QString aMessage = tr("%1 operation will be aborted.").arg(anOperation->id());
- int anAnswer = QMessageBox::question(qApp->activeWindow(),
- tr("Abort operation"),
- aMessage,
- QMessageBox::Ok | QMessageBox::Cancel,
- QMessageBox::Cancel);
- return anAnswer == QMessageBox::Ok;
- }
- return true;
-}
-
void XGUI_OperationMgr::onOperationStarted()
{
ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
/// \param theId id of the operation which is going to start
bool canStartOperation(QString theId);
- bool canStopOperation();
-
- /// Returns true if the operation can be aborted
- bool canAbortOperation();
-
/// Blocking/unblocking enabling of Ok button in property panel.
/// It is used when operation can not be validated even all attributes are valid
void setLockValidating(bool toLock) { myIsValidationLock = toLock; }
/// Returns state of validation locking
bool isValidationLocked() const { return myIsValidationLock; }
- public slots:
+ /// Sets apply state to the value and emit signal about this state is changed
+ /// \param theEnabled the state value
+ void setApplyEnabled(const bool theEnabled);
+
+ /// Returns enable apply state
+ /// \return theEnabled a boolean value
+ bool isApplyEnabled() const;
+
+ public slots:
/// Slot that commits the current operation.
void onCommitOperation();
/// Slot that aborts the current operation.
/// Emitted when current operation is aborted
void operationAborted(ModuleBase_Operation* theOperation);
- /// Signal is emitted after the validate methods calls.
- void operationValidated(bool);
+ /// Signal is emitted after the apply enable state changed.
+ void applyEnableChanged(bool);
/// Signal is emitted after the current operation is filled with existing preselection.
void operationActivatedByPreselection();
protected:
+ /// Returns true if the operation can be aborted
+ bool canStopOperation();
/// Commits the current operatin if it is valid
bool commitOperation();
/// Lock/Unlock access to Ok button in property panel
bool myIsValidationLock;
+ /// Lock/Unlock access to Ok button in property panel
+ bool myIsApplyEnabled;
};
#endif
emit noMoreWidgets();
}
-void XGUI_PropertyPanel::setOkEnabled(bool theEnabled)
-{
- QPushButton* anOkBtn = findChild<QPushButton*>(PROP_PANEL_OK);
- anOkBtn->setEnabled(theEnabled);
-}
-
-bool XGUI_PropertyPanel::isOkEnabled() const
-{
- QPushButton* anOkBtn = findChild<QPushButton*>(PROP_PANEL_OK);
- return anOkBtn->isEnabled();
-}
-
void XGUI_PropertyPanel::setCancelEnabled(bool theEnabled)
{
QPushButton* anCancelBtn = findChild<QPushButton*>(PROP_PANEL_CANCEL);
/// \brief Enable/Disable stretch area in the panel
void setStretchEnabled(bool isEnabled);
- /// Set Enable/Disable state of Ok button
- /// \param theEnabled Enable/Disable state of Ok button
- virtual void setOkEnabled(bool theEnabled);
-
- /// \return Enable/disable state of Ok button
- virtual bool isOkEnabled() const;
-
/// Set Enable/Disable state of Cancel button
/// \param theEnabled Enable/Disable state of Cancel button
virtual void setCancelEnabled(bool theEnabled);
#include <QEvent>
#include <QString>
+/**
+* Class of event to send application events in multi thread environment
+*/
class XGUI_EXPORT PostponeMessageQtEvent : public QEvent
{
public:
static QEvent::Type PostponeMessageQtEventType;
+ /// Constructor
+ /// \param theMessage an event message to send
PostponeMessageQtEvent(const std::shared_ptr<Events_Message>& theMessage)
: QEvent(PostponeMessageQtEventType),
myMessage(theMessage)
{
}
+
+ /// Returns type of the event
static QEvent::Type type()
{
return PostponeMessageQtEventType;
}
+ /// Returns current messasge
std::shared_ptr<Events_Message> postponedMessage();
private:
+ /// Message
std::shared_ptr<Events_Message> myMessage;
};
#include <ModelAPI_Result.h>
#include <ModelAPI_Object.h>
+#include <SelectMgr_ListIteratorOfListOfFilter.hxx>
+
XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop* theParent)
: QObject(theParent),
myWorkshop(theParent)
}
}
+//**************************************************************
+void XGUI_SelectionMgr::updateSelectedOwners(bool isUpdateViewer)
+{
+ Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+ const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
+
+ SelectMgr_IndexedMapOfOwner anOwnersToDeselect;
+
+ SelectMgr_ListIteratorOfListOfFilter anIt(aFilters);
+ for (; anIt.More(); anIt.Next()) {
+ Handle(SelectMgr_Filter) aFilter = anIt.Value();
+ for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
+ Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner();
+ if (!aFilter->IsOk(anOwner))
+ anOwnersToDeselect.Add(aContext->SelectedOwner());
+ }
+ }
+
+ setSelectedOwners(anOwnersToDeselect, false);
+
+ if (isUpdateViewer)
+ aContext->UpdateCurrentViewer();
+}
+
//**************************************************************
void XGUI_SelectionMgr::onObjectBrowserSelection()
{
void setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners,
bool isUpdateViewer);
+ //! Check that the selected owners are valid for the current filters
+ /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+ void updateSelectedOwners(bool isUpdateViewer);
+
signals:
//! Emited when selection in a one of viewers was changed
void selectionChanged();
connect(aCancelBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onAbortOperation()));
connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)), myOperationMgr,
SLOT(onKeyReleased(QKeyEvent*)));
- connect(myOperationMgr, SIGNAL(operationValidated(bool)), myPropertyPanel,
+ connect(myOperationMgr, SIGNAL(applyEnableChanged(bool)), myPropertyPanel,
SLOT(setAcceptEnabled(bool)));
}