# of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces.
-ALPHABETICAL_INDEX = NO
+ALPHABETICAL_INDEX = YES
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
@SET PATH=%DOXYGEN_ROOT_DIR%\bin;%PATH%
@REM -------------------------
+@REM -------------------------
+@REM GRAPHVIZ
+@SET GRAPHVIZ_ROOT_DIR=%PDIR%\graphviz-2.38.0
+@SET GRAPHVIZHOME=%GRAPHVIZ_ROOT_DIR%
+@SET PATH=%GRAPHVIZ_ROOT_DIR%\bin;%PATH%
+@REM -------------------------
+
@REM -------------------------
@REM SUIT
@SET SUIT_DIR=%PDIR%\suit
/*!
* \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
/// attribute name for distance
const std::string DISTANCE_ATTR = "distance";
-/**\class ConstructionPlugin_Axis
+/**\class ConstructionPlugin_Plane
* \ingroup DataModel
- * \brief Feature for creation of the new axis in PartSet.
+ * \brief Feature for creation of the new planar surface in PartSet.
*/
class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustomPrs
{
#include "ModelAPI_Plugin.h"
#include "ModelAPI_Feature.h"
+/**\class ConstructionPlugin_Plugin
+ * \ingroup Plugins
+ * \brief The main class for management the construction features as plugin.
+ */
class CONSTRUCTIONPLUGIN_EXPORT ConstructionPlugin_Plugin : public ModelAPI_Plugin
{
- public:
+public:
/// Creates the feature object of this plugin by the feature string ID
virtual FeaturePtr createFeature(std::string theFeatureID);
- public:
+ /// Default constructor
ConstructionPlugin_Plugin();
};
#include <string>
+/**\class Events_Error
+ * \ingroup EventsLoop
+ * \brief An error message event.
+ *
+ * Is generated by any algorithm or GUI of the application to inform the user about
+ * the problem. In GUI mode all such errors are collected in the message log window.
+ */
class EVENTS_EXPORT Events_Error : public Events_Message
{
char* myDescription; ///< pointer to the description of the error
- public:
+public:
+ /// default destructor
virtual ~Events_Error();
+ /// Identifier of this event (one for all errors)
static Events_ID errorID();
+ /// Specific error string
char* description() const;
+ /// Allows to send an error quickly: it creates and sends the error object automatically
static void send(char* theDescription, const void* theSender = 0);
+ /// Allows to send an error quickly: it creates and sends the error object automatically
static void send(std::string theDescription, const void* theSender = 0);
- protected:
+protected:
+ /// Default constructor. Use "send" message for generation an error.
Events_Error(char* theDescription, const void* theSender = 0);
};
*/
class EVENTS_EXPORT Events_LongOp : public Events_Message
{
- public:
+public:
+ /// Default destructor
virtual ~Events_LongOp();
/// Returns the identifier of this event
static Events_ID eventID();
/// Returns true if the long operation is performed
static bool isPerformed();
- protected:
+protected:
+ /// Default constructor. Use "start" and "end" for generation.
Events_LongOp(void* theSender = 0);
};
class Events_MessageGroup;
-/**\class Events_Lopp
+/**\class Events_Loop
* \ingroup EventsLoop
* \brief Base class that manages the receiving and sending of all
* not Qt-events in the application.
EVENTS_EXPORT static Events_ID eventByName(const char* theName);
//! Allows to send an event
+ //! \param theMessage the enevt message to send
//! \param isGroup is true for grouping messages if possible
EVENTS_EXPORT void send(const std::shared_ptr<Events_Message>& theMessage, bool isGroup = true);
#include <Events_Message.h>
#include <memory>
-/**\class Events_Message
+/**\class Events_MessageGroup
* \ingroup EventsLoop
* \brief Message that allows to group messages and send them later as a group of messages.
*
#include <map>
+/**\class ExchangePlugin_ImportFeature
+ * \ingroup Plugins
+ * \brief Feature for import shapes from the external files in CAD formats.
+ *
+ * The set of supported formats is defined in the configuration file.
+ */
class ExchangePlugin_ImportFeature : public ModelAPI_Feature
{
public:
static const std::string MY_FILE_PATH_ID("import_file_selector");
return MY_FILE_PATH_ID;
}
-
+ /// default constructor
EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature();
+ /// default destructor
EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature();
/// Returns the unique kind of a feature
}
protected:
+ /// POerforms the import of the file
EXCHANGEPLUGIN_EXPORT bool importFile(const std::string& theFileName);
private:
#include <ModelAPI_Plugin.h>
#include <ModelAPI_Feature.h>
+/**\class ExchangePlugin_Plugin
+ * \ingroup Plugins
+ * \brief The main class for management the import and export operations as plugin.
+ */
class EXCHANGEPLUGIN_EXPORT ExchangePlugin_Plugin : public ModelAPI_Plugin
{
public:
return result;
}
-bool ExchangePlugin_ImportFormatValidator::parsePlugins(const std::list<std::string>& theArguments,
- std::list<std::string>& outPlugins)
-{
- std::list<std::string>::const_iterator it = theArguments.begin();
- bool result = true;
- for (; it != theArguments.end(); ++it) {
- std::string anArg = *it;
- int aSepPos = anArg.find(":");
- if (aSepPos == std::string::npos) {
- result = false;
- continue;
- }
- outPlugins.push_back(anArg.substr(aSepPos + 1));
- }
- return result;
-}
-
bool ExchangePlugin_ImportFormatValidator::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments) const
{
#include "ExchangePlugin.h"
#include <ModelAPI_AttributeValidator.h>
+/**\class ExchangePlugin_ImportFormatValidator
+ * \ingroup Validators
+ * \brief Validator for the imported formats checking
+ *
+ * The configuration file of import/export features contains the information
+ * about which formats are supported and the extension of the associated files.
+ * This validator filters out files that are out of this description.
+ */
class ExchangePlugin_ImportFormatValidator : public ModelAPI_AttributeValidator
{
- /*
+ /**
* Parses input arguments "BREP:BREPImport", "STEP:STEPImport"
* into list of file formats "BREP","STEP"
* and list of corresponding plugins: "BREPImport", "STEPImport"
*/
static bool parseFormats(const std::list<std::string>& theArguments,
std::list<std::string>& outFormats);
- static bool parsePlugins(const std::list<std::string>& theArguments,
- std::list<std::string>& outPlugins);
- public:
+public:
+ /**
+ * Returns true is the file-name attribute correctly corresponds to the set of
+ * allowed formats.
+ */
virtual bool isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments) const;
#include <GeomAPI_Shape.h>
#include <GeomAlgoAPI_Boolean.h>
+/**\class FeaturesPlugin_Boolean
+ * \ingroup Plugins
+ * \brief Feature for applying of Boolean operations on Solids.
+ *
+ * Supports three kinds of Boolean operations: Cut, Fuse and Common.
+ * For all of them requires two Solids: object and tool.
+ */
class FeaturesPlugin_Boolean : public ModelAPI_Feature
{
- public:
+public:
/// Extrusion kind
inline static const std::string& ID()
{
BOOL_COMMON
};
-
/// Returns the kind of a feature
FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
{
#include <ModelAPI_ResultBody.h>
#include <GeomAlgoAPI_Extrusion.h>
#include <GeomAPI_Shape.h>
+
+/**\class FeaturesPlugin_Extrusion
+ * \ingroup Plugins
+ * \brief Feature for creation of extrusion from the planar face.
+ *
+ * Extrusion creates the lateral faces based on edges of the base face and
+ * the top face equal to the base face. Direction of extrusion is taken from the face
+ * plane, but can be corrected by the "reverse" flag.
+ */
class FeaturesPlugin_Extrusion : public ModelAPI_Feature
{
public:
#include <ModelAPI_Feature.h>
#include <GeomAPI_Shape.h>
+/**\class FeaturesPlugin_Group
+ * \ingroup Plugins
+ * \brief Feature for selection of sub-shapes of some shapes.
+ *
+ * All selected sub-shapes must be of equal type (vertex, edge, face, etc) but may
+ * be selected on different objects.
+ */
class FeaturesPlugin_Group : public ModelAPI_Feature
{
public:
static const std::string MY_GROUP_ID("Group");
return MY_GROUP_ID;
}
- /// attribute name of group name
- //inline static const std::string& NAME_ID()
- //{
- // static const std::string MY_GROUP_NAME_ID("group_name");
- // return MY_GROUP_NAME_ID;
- //}
/// attribute name of selected entities list
inline static const std::string& LIST_ID()
{
class ModelAPI_ResultBody;
class GeomAPI_Shape;
+/**\class FeaturesPlugin_Placement
+ * \ingroup Plugins
+ * \brief Feature for applying of placement operation: relative movement of Solid.
+ *
+ * Locates the selected attractable_face of the solid in the middle of the selected
+ * placement_base face. Faces must be planar. Orientation of the placed solid is
+ * depended on the underlied planes of both faces.
+ */
class FeaturesPlugin_Placement : public ModelAPI_Feature
{
public:
#include <ModelAPI_Plugin.h>
#include <ModelAPI_Feature.h>
+/**\class FeaturesPlugin_Plugin
+ * \ingroup Plugins
+ * \brief The main class for management the 3D features as plugin.
+ */
class FEATURESPLUGIN_EXPORT FeaturesPlugin_Plugin : public ModelAPI_Plugin
{
public:
virtual FeaturePtr createFeature(std::string theFeatureID);
public:
+ /// Default constructor
FeaturesPlugin_Plugin();
};
GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape()
:GeomAPI_Interface((void *)new TopTools_DataMapOfShapeShape){}
-/// Clear
void GeomAPI_DataMapOfShapeShape::clear()
{
implPtr<TopTools_DataMapOfShapeShape>()->Clear();
}
-/// Size
int GeomAPI_DataMapOfShapeShape::size()
{
return implPtr<TopTools_DataMapOfShapeShape>()->Extent();
}
-/// Adds the Key <K> to the Map <me> with the Item. Returns True if the Key was not already in the map
bool GeomAPI_DataMapOfShapeShape::bind (std::shared_ptr<GeomAPI_Shape> theKey, std::shared_ptr<GeomAPI_Shape> theItem)
{
bool flag(false);
return flag;
}
-/// Returns true if theKey is stored in the map.
bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey)
{
bool flag(false);
return flag;
}
-/// Returns the Item stored with the Key in the Map. To be checked before with isBound()
const std::shared_ptr<GeomAPI_Shape> GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
{
std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
return aShape;
}
-/// Removes the Key from the map. Returns true if the Key was in the Map
bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
{
bool flag(false);
* \ingroup DataModel
* \brief DataMap of Shape - Shape defined by TopoDS_Shapes
*/
-
class GEOMAPI_EXPORT GeomAPI_DataMapOfShapeShape : public GeomAPI_Interface
{
public:
/// Size of the map
int size();
- /// Adds the Key <K> to the Map <me> with the Item. Returns True if the Key was not already in the map
+ /// Adds \a theKey to me with \a theItem. Returns True if the Key was not already in the map
bool bind (std::shared_ptr<GeomAPI_Shape> theKey, std::shared_ptr<GeomAPI_Shape> theItem);
/// Returns true if theKey is stored in the map.
class GeomAPI_ICustomPrs
{
public:
+ /// Modifies the given presentation in the custom way.
virtual void customisePresentation(AISObjectPtr thePrs) = 0;
};
/**\class GeomAPI_PlanarEdges
* \ingroup DataModel
- * \brief Interface to the edge object
+ * \brief Interface to the set of edges located in one plane
+ *
+ * Normally this interface corresponds to theedges of the sketch
*/
-
class GeomAPI_PlanarEdges : public GeomAPI_Shape
{
public:
/// Creation of empty (null) shape
GEOMAPI_EXPORT GeomAPI_PlanarEdges();
+ /// Returns whether the shape is alone vertex
GEOMAPI_EXPORT virtual bool isVertex() const;
- /// Returns whether the shape is an edge
+ /// Returns whether the shape is alone edge
GEOMAPI_EXPORT virtual bool isEdge() const;
-
+ /// Appends the edge to the set
GEOMAPI_EXPORT void addEdge(std::shared_ptr<GeomAPI_Shape> theEdge);
+ /// Returns the list of edges in this interface
GEOMAPI_EXPORT std::list<std::shared_ptr<GeomAPI_Shape> > getEdges();
/// Returns True if the wire is defined in a plane
GEOMAPI_EXPORT bool hasPlane() const;
- /// Set/Get origin point
+ /// Sets origin point
GEOMAPI_EXPORT void setOrigin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin);
+ /// Returns the plane origin point
GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Pnt> origin() const;
- /// Set/Get X direction vector
+ /// Sets X direction vector
GEOMAPI_EXPORT void setDirX(const std::shared_ptr<GeomAPI_Dir>& theDirX);
+ /// Returns X direction vector
GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> dirX() const;
- /// Set/Get Y direction vector
+ /// Sets Y direction vector
GEOMAPI_EXPORT void setDirY(const std::shared_ptr<GeomAPI_Dir>& theDirY);
+ /// Returns Y direction vector
GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> dirY() const;
- /// Set/Get Normal direction vector
+ /// Sets Z direction vector
GEOMAPI_EXPORT void setNorm(const std::shared_ptr<GeomAPI_Dir>& theNorm);
+ /// Returns Z direction vector
GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> norm() const;
private:
+ /// Origin point of the plane
std::shared_ptr<GeomAPI_Pnt> myOrigin;
+ /// The X direction inside of the plane
std::shared_ptr<GeomAPI_Dir> myDirX;
+ /// The Y direction inside of the plane
std::shared_ptr<GeomAPI_Dir> myDirY;
+ /// The normal direction to the plane
std::shared_ptr<GeomAPI_Dir> myNorm;
};
/// Creation of empty (null) shape
GeomAPI_Shape();
+ /// Returns true if the underlied shape is null
bool isNull() const;
/// Returns whether the shapes are equal
bool computeSize(double& theXmin, double& theYmin, double& theZmin,
double& theXmax, double& theYmax, double& theZmax) const;
+ /// Returns the shape as BRep stream
std::string getShapeStream() const;
};
class GeomAlgoAPI_Boolean : public GeomAPI_Interface
{
public:
- /* \brief Creates cut boolean operation
+ /**\brief Creates cut boolean operation
* \param[in] theShape the main shape
* \param[in] theTool toole shape for boolean
* \return a solid as result of operation
*/
GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> makeCut(
std::shared_ptr<GeomAPI_Shape> theShape,
- std::shared_ptr<GeomAPI_Shape> theTool);
+ std::shared_ptr<GeomAPI_Shape> theTool);
- /* \brief Creates fuse boolean operation
+ /**\brief Creates fuse boolean operation
* \param[in] theShape the main shape
* \param[in] theTool second shape
* \return a solid as result of operation
std::shared_ptr<GeomAPI_Shape> theShape,
std::shared_ptr<GeomAPI_Shape> theTool);
- /* \brief Creates common boolean operation
+ /**\brief Creates common boolean operation
* \param[in] theObject the main shape
* \param[in] theTool second shape
- * \param[in] theType type of the operation: Fuse, Cut, Common
* \return a solid as result of operation
*/
GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> makeCommon(
return myShape;
}
-/// Returns the list of shapes generated from the shape <theShape>
void GeomAlgoAPI_MakeShape::generated(
const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory)
{
}
}
-/// Returns the list of shapes modified from the shape <theShape>
void GeomAlgoAPI_MakeShape::modified(
const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory)
{
}
}
-/// Returns whether the shape is an edge
bool GeomAlgoAPI_MakeShape::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
{
bool isDeleted(false);
#include <GeomAPI_Shape.h>
#include <memory>
#include <GeomAlgoAPI.h>
-//#include <BRepBuilderAPI_MakeShape.hxx>
+
/**\class GeomAlgoAPI_MakeShape
* \ingroup DataModel
* \brief Interface to the root class of all topological shapes constructions
*/
class GeomAlgoAPI_MakeShape : public GeomAPI_Interface
{
- public:
- /// Constructor
+public:
+ /// Constructor
GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape();
-
+ /// Constructor by the already stored builder in the interface
GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(void* theBuilder);
/// Returns a shape built by the shape construction algorithm
GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape> shape() const;
- /// Returns the list of shapes generated from the shape <theShape>
+ /// Returns the list of shapes generated from the shape \a theShape
GEOMALGOAPI_EXPORT virtual void generated(
const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory);
- /// Returns the list of shapes modified from the shape <theShape>
+ /// Returns the list of shapes modified from the shape \a theShape
GEOMALGOAPI_EXPORT virtual void modified(
const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory);
/// Returns whether the shape is an edge
GEOMALGOAPI_EXPORT virtual bool isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
-
+ /// Initializes the algorithm by the builder stored in the interface
GEOMALGOAPI_EXPORT void init(void* theMkShape);
protected:
+ /// The resulting shape
std::shared_ptr<GeomAPI_Shape> myShape;
};
ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS})
-ADD_LIBRARY(Model MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+ADD_LIBRARY(Model SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES})
INCLUDE_DIRECTORIES(
/**\class Model_Application
* \ingroup DataModel
* \brief Realization of Open CASCADE application abstraction. Class for internal use only.
+ *
* Application supports the formats and document management. It is uses OCAF-lke
* architecture and just implements specific features of the module.
*/
class Model_Application : public TDocStd_Application
{
- public:
+public:
// useful methods inside of the module
// CASCADE RTTI
- DEFINE_STANDARD_RTTI(Model_Application)
- ;
+ /// Definition of "Handles" usage
+ /// \param Model_Application is the class name that is covered by the OCCT Handle
+ DEFINE_STANDARD_RTTI(Model_Application);
//! Retuns the application: one per process
MODEL_EXPORT static Handle_Model_Application getApplication();
if (aContext->groupName() == ModelAPI_ResultBody::group()) {
// body: just a named shape, use selection mechanism from OCCT
TNaming_Selector aSelector(aSelLab);
- bool aResult = aSelector.Solve(scope()) == Standard_True;
+ bool aResult = true;//aSelector.Solve(scope()) == Standard_True;
owner()->data()->sendAttributeUpdated(this);
return aResult;
} else if (aContext->groupName() == ModelAPI_ResultConstruction::group()) {
/// Returns the number ofselection attributes in the list
MODEL_EXPORT virtual int size();
+ /// The type of all elements selection
+ /// \returns the index of the OCCT enumeration of the type of shape
MODEL_EXPORT virtual int selectionType();
- MODEL_EXPORT virtual void setSelectionType(int);
+ /// Sets the type of all elements selection
+ /// \param theType the index of the OCCT enumeration of the type of shape
+ MODEL_EXPORT virtual void setSelectionType(int theType);
/// Returns the attribute selection by the index (zero based)
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex);
/// Returns the identifier of feature-owner, unique in this document
MODEL_EXPORT virtual int featureId() const;
- // returns all objects referenced to this
+ /// returns all objects referenced to this
MODEL_EXPORT virtual const std::set<AttributePtr>& refsToMe() {return myRefsToMe;}
- // returns all references by attributes of this data
- // \param theRefs returned list of pairs: id of referenced attribute and list of referenced objects
+ /// returns all references by attributes of this data
+ /// \param theRefs returned list of pairs: id of referenced attribute and list of referenced objects
MODEL_EXPORT virtual void referencesToObjects(
std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs);
private:
- // removes all information about back references
+ /// removes all information about back references
void eraseBackReferences();
// adds a back reference (with identifier which attribute references to this object
void addBackReference(FeaturePtr theFeature, std::string theAttrID);
subDoc(*aSubIter)->close(theForever);
// close for thid document needs no transaction in this document
- if (this == aPM->moduleDocument().get())
- std::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(false);
+ std::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(false);
// delete all features of this document
std::shared_ptr<ModelAPI_Document> aThis =
myDoc->Close();
}
- if (this == aPM->moduleDocument().get())
- std::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(true);
+ std::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(true);
}
void Model_Document::startOperation()
//! Loads the OCAF document from the file.
//! \param theFileName full name of the file to load
- //! \param theStudyID identifier of the SALOME study to associate with loaded file
//! \returns true if file was loaded successfully
MODEL_EXPORT virtual bool load(const char* theFileName);
MODEL_EXPORT virtual void redo();
//! Adds to the document the new feature of the given feature id
- //! \param creates feature and puts it in the document
+ //! \param theID creates feature and puts it in the document
MODEL_EXPORT virtual FeaturePtr addFeature(std::string theID);
//! Removes the feature from the document (with result)
+ //! \param theFeature the feature to be removed
//! \param theCheck if it is false, do not check the references
MODEL_EXPORT virtual void removeFeature(FeaturePtr theFeature, const bool theCheck = true);
//! Returns the feature in the group by the index (started from zero)
//! \param theGroupID group that contains a feature
//! \param theIndex zero-based index of feature in the group
- //! \param isOperation if it is true, returns feature (not Object)
//! \param theHidden if it is true, it counts also the features that are not in tree
MODEL_EXPORT virtual ObjectPtr object(const std::string& theGroupID, const int theIndex,
const bool theHidden = false);
//! Creates new document with binary file format
Model_Document(const std::string theID, const std::string theKind);
+ //! Returns the internal OCCT document of this interface
Handle_TDocStd_Document document()
{
return myDoc;
return myGroups;
}
+ /// Returns the new empty message of this type
virtual std::shared_ptr<Events_MessageGroup> newEmpty();
+ /// Returns the identifier of this message
virtual const Events_ID messageId();
+ /// Appends to this message the given one
virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined);
};
#include <set>
#include <map>
+/**\class Model_FeatureValidator
+ * \ingroup DataModel
+ * \brief The geneneric validator for the whole feature.
+ *
+ * Can be redefined for some specific feature, but by default for each feature this validator is
+ * used: it checks each argument of the feature and if one of it is not valid (and obligatory),
+ * the hole feature is invalid.
+ */
class Model_FeatureValidator : public ModelAPI_FeatureValidator
{
// not obligatory attributes, not checked for initialization
std::map<std::string, std::set<std::string> > myNotObligatory;
- public:
+public:
/// Returns true if feature and/or attributes are valid
/// \param theFeature the validated feature
+ /// \param theArguments the arguments in the configuration file for this validator
+ /// \returns true if feature is valid
MODEL_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<std::string>& theArguments) const;
- // sets not obligatory attributes, not checked for initialization
+ /// sets not obligatory attributes, not checked for initialization
virtual void registerNotObligatory(std::string theFeature, std::string theAttribute);
/// Returns true if the attribute in feature is not obligatory for the feature execution
class TNaming_Builder;
-/**\class ModelAPI_ResultBody
+/**\class Model_ResultBody
* \ingroup DataModel
* \brief The body (shape) result of a feature.
*
#include "Model.h"
#include <ModelAPI_ResultConstruction.h>
-/**\class ModelAPI_ResultConstruction
+/**\class Model_ResultConstruction
* \ingroup DataModel
* \brief The construction element result of a feature.
*
#include "Model.h"
#include <ModelAPI_ResultGroup.h>
-/**\class ModelAPI_ResultGroup
+/**\class Model_ResultGroup
* \ingroup DataModel
* \brief The groups result.
*
#include "Model.h"
#include <ModelAPI_ResultPart.h>
-/**\class ModelAPI_ResultPart
+/**\class Model_ResultPart
* \ingroup DataModel
* \brief The Part document, result of a creation of new part feature.
*
//! Loads the OCAF document from the file.
//! \param theFileName full name of the file to load
- //! \param theStudyID identifier of the SALOME study to associate with loaded file
//! \returns true if file was loaded successfully
MODEL_EXPORT virtual bool load(const char* theFileName);
/// Returns the validators factory: the only one instance per application
MODEL_EXPORT virtual ModelAPI_ValidatorsFactory* validators();
+ /// Sets the flag to check modifications outside the transaction or not
void setCheckTransactions(const bool theCheck)
{
myCheckTransactions = theCheck;
virtual bool isConcealed(std::string theFeature, std::string theAttribute);
protected:
+ /// Adds the defualt validators that are usefull for all features.
void addDefaultValidators(std::list<ModelAPI_Validator*>& theValidators,
std::list<std::list<std::string> >& theArguments) const;
/// Get instance from Session
/// Returns the number ofselection attributes in the list
virtual int size() = 0;
+ /// The type of all elements selection
+ /// \returns the index of the enumeration of the type of shape
virtual int selectionType() = 0;
- virtual void setSelectionType(int) = 0;
+ /// Sets the type of all elements selection
+ /// \param theType the index of the enumeration of the type of shape
+ virtual void setSelectionType(int theType) = 0;
/// Returns the attribute selection by the index (zero based)
virtual std::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex) = 0;
/// Returns the identifier of feature-owner, unique in this document
virtual int featureId() const = 0;
- // returns all objects referenced to this
+ /// returns all objects referenced to this
virtual const std::set<std::shared_ptr<ModelAPI_Attribute> >& refsToMe() = 0;
- // returns all references by attributes of this data
- // \param theRefs returned list of pairs: id of referenced attribute and list of referenced objects
+ /// returns all references by attributes of this data
+ /// \param theRefs returned list of pairs: id of referenced attribute and list of referenced objects
virtual void referencesToObjects(
std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> > > >& theRefs) = 0;
protected:
class ModelAPI_ResultGroup;
class ModelAPI_Data;
-/**\class Model_Document
+/**\class ModelAPI_Document
* \ingroup DataModel
* \brief Document for internal data structure of any object storage.
* Document contains all data that must be stored/retrived in the file.
virtual void close(const bool theForever = false) = 0;
//! Adds to the document the new feature of the given feature id
- //! \param creates feature and puts it in the document (if it is not action)
+ //! \param theID creates feature and puts it in the document (if it is not action)
virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) = 0;
//! Removes the feature from the document
class MODELAPI_EXPORT ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup
{
protected:
+ /// Creates an empty message
ModelAPI_ObjectUpdatedMessage(const Events_ID theID, const void* theSender = 0);
+ /// The virtual destructor
virtual ~ModelAPI_ObjectUpdatedMessage();
public:
/// Message that feature was deleted (used for Object Browser update)
class MODELAPI_EXPORT ModelAPI_ObjectDeletedMessage : public Events_MessageGroup
{
- protected:
+protected:
+ /// Creates an empty message
ModelAPI_ObjectDeletedMessage(const Events_ID theID, const void* theSender = 0);
+ /// The virtual destructor
virtual ~ModelAPI_ObjectDeletedMessage();
- public:
+public:
/// Returns the feature that has been updated
virtual std::shared_ptr<ModelAPI_Document> document() const = 0;
/// Returns the group where the feature was deleted
virtual const std::set<std::string>& groups() const = 0;
+ /// Creates the new empty message of this kind
virtual std::shared_ptr<Events_MessageGroup> newEmpty() = 0;
+ /// Returns the identifier of the kind of a message
virtual const Events_ID messageId() = 0;
+ /// Appenad to this message the given one.
virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined) = 0;
};
/// Allows to create ModelAPI messages
class MODELAPI_EXPORT ModelAPI_EventCreator
{
- public:
+public:
/// creates created, updated or moved messages and sends to the loop
virtual void sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent,
const bool isGroupped = true) const = 0;
};
// TODO(sbh): Move this message into a separate package, like "GuiAPI"
+/// Contains the state information about the feature: is it enabled or disabled.
class ModelAPI_FeatureStateMessage : public Events_Message
{
- public:
+public:
+ /// Creates an empty message
MODELAPI_EXPORT ModelAPI_FeatureStateMessage(const Events_ID theID, const void* theSender = 0);
+ /// The virtual destructor
MODELAPI_EXPORT virtual ~ModelAPI_FeatureStateMessage();
- // For request
+ /// Returns the feature this message is related to
MODELAPI_EXPORT std::shared_ptr<ModelAPI_Feature> feature() const;
+ /// Stores the feature this message is related to
MODELAPI_EXPORT void setFeature(std::shared_ptr<ModelAPI_Feature>& theFeature);
// For response
+ /// Returns true if feature has specific state
MODELAPI_EXPORT bool hasState(const std::string& theFeatureId) const;
+ /// Returns true if feature is enabled
MODELAPI_EXPORT bool state(const std::string& theFeatureId, bool theDefault = false) const;
+ /// Stores the feature state
MODELAPI_EXPORT void setState(const std::string& theFeatureId, bool theValue);
+ /// Returns all feature IDs with states
MODELAPI_EXPORT std::list<std::string> features() const;
private:
- // For Request
+ /// For Request
std::shared_ptr<ModelAPI_Feature> myCurrentFeature;
- // For response
+ /// For response
std::map<std::string, bool> myFeatureState;
};
/// To virtually destroy the fields of successors
MODELAPI_EXPORT virtual ~ModelAPI_Feature();
+ /// Returns the feature by the object (result).
MODELAPI_EXPORT static std::shared_ptr<ModelAPI_Feature> feature(ObjectPtr theObject);
//
// Helper methods, aliases for data()->method()
// -----------------------------------------------------------------------------------------------
+ /// Returns the name stored in the attribute
inline std::string name()
{
return data()->name();
}
-
+ /// Returns the Boolean attribute by the identifier
inline std::shared_ptr<ModelAPI_AttributeBoolean> boolean(const std::string& theID)
{
return data()->boolean(theID);
}
-
+ /// Returns the document reference attribute
inline std::shared_ptr<ModelAPI_AttributeDocRef> document(const std::string& theID)
{
return data()->document(theID);
}
-
+ /// Returns the real attribute by the identifier
inline std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string& theID)
{
return data()->real(theID);
}
-
+ /// Returns the integer attribute by the identifier
inline std::shared_ptr<ModelAPI_AttributeInteger> integer(const std::string& theID)
{
return data()->integer(theID);
}
-
+ /// Returns the reference attribute by the identifier
inline std::shared_ptr<ModelAPI_AttributeRefAttr> refattr(const std::string& theID)
{
return data()->refattr(theID);
}
-
+ /// Returns the reference attribute by the identifier
inline std::shared_ptr<ModelAPI_AttributeReference> reference(const std::string& theID)
{
return data()->reference(theID);
}
-
+ /// Returns the list of references attribute by the identifier
inline std::shared_ptr<ModelAPI_AttributeRefList> reflist(const std::string& theID)
{
return data()->reflist(theID);
}
-
+ /// Returns the shape selection attribute by the identifier
inline std::shared_ptr<ModelAPI_AttributeSelection> selection(const std::string& theID)
{
return data()->selection(theID);
}
-
+ /// Returns the list of shape selections attribute by the identifier
inline std::shared_ptr<ModelAPI_AttributeSelectionList> selectionList(const std::string& theID)
{
return data()->selectionList(theID);
}
-
+ /// Returns the string attribute by the identifier
inline std::shared_ptr<ModelAPI_AttributeString> string(const std::string& theID)
{
return data()->string(theID);
}
-
+ /// Returns the attribute by the identifier
inline std::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID)
{
return data()->attribute(theID);
#include "ModelAPI.h"
#include "ModelAPI_Validator.h"
+/**\class ModelAPI_FeatureValidator
+ * \ingroup DataModel
+ * \brief The geneneric validator for the whole feature.
+ *
+ * Can be redefined for some specific feature, but by default for each feature this validator is
+ * used: it checks each argument of the feature and if one of it is not valid (and obligatory),
+ * the hole feature is invalid.
+ */
class ModelAPI_FeatureValidator : public ModelAPI_Validator
{
public:
/// Returns true if feature and/or attributes are valid
/// \param theFeature the validated feature
- /// \param theAttr the validated attribute ID, empty string of feature is validated
/// \param theArguments list of string, feature attribute names: dependent attributes
virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<std::string>& theArguments) const = 0;
* \ingroup DataModel
* \brief Interface common for any plugin: allows to use plugin by the plugins manager.
*/
-
class MODELAPI_EXPORT ModelAPI_Plugin
{
public:
#include <ModelAPI_Attribute.h>
#include <ModelAPI_AttributeValidator.h>
-/*
+/**\class ModelAPI_RefAttrValidator
+ * \ingroup DataModel
* Used for filtering out the object that can be used for reference attribute value
*/
class ModelAPI_RefAttrValidator : public ModelAPI_AttributeValidator
#include "ModelAPI_Validator.h"
#include "ModelAPI_Object.h"
+/**\class ModelAPI_ResultValidator
+ * \ingroup DataModel
+ * \brief The base class for selection filter for results of features.
+ *
+ * The referenced arguments of feature is normally results displayed in the viewer or by the
+ * selection attribute. This filter allows to filter out the results not usable as this argument.
+ */
class ModelAPI_ResultValidator : public ModelAPI_Validator
{
- public:
+public:
+ /// The abstract method for implementation in the specific validator.
+ /// \param theObject the checked object as an argument
+ /// \returns true if object is OK for this filter
virtual bool isValid(const ObjectPtr theObject) const = 0;
};
//! Loads the OCAF document from the file.
//! \param theFileName full name of the file to load
- //! \param theStudyID identifier of the SALOME study to associate with loaded file
//! \returns true if file was loaded successfully
virtual bool load(const char* theFileName) = 0;
protected:
/// Creates the feature object using plugins functionality
virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
-
+ /// Sets the session interface implementation (once per application launch)
static void setSession(std::shared_ptr<ModelAPI_Session> theManager);
friend class Model_Document;
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() {}
#include <StdSelect_TypeOfFace.hxx>
+/**
+* An implementation of filter which support using of several filters according to OR statement
+*/
class ModuleBase_FilterMulti: public 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 <list>
#include <string>
+/**
+* A validator of selection
+*/
class ModuleBase_SelectionValidator : public ModelAPI_Validator
{
public:
+ /// Returns True if selection is valid
+ /// \param theSelection selection instance
virtual bool isValid(const ModuleBase_ISelection* theSelection) const = 0;
+
+ /// Returns True if selection is valid
+ /// \param theSelection selection instance
+ /// \param theArguments list of arguments
virtual bool isValid(const ModuleBase_ISelection* theSelection,
const std::list<std::string>& theArguments) const
{
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;
};
/**
* A class of property panel widget for double value input
* It can be defined with "doublevalue" keyword. For example:
-* "<doublevalue id="x" label="X:" icon=":pictures/x_point.png" tooltip="X coordinate"/>"
+* \code
+* <doublevalue id="x" label="X:" icon=":pictures/x_point.png" tooltip="X coordinate"/>
+* \endcode
*/
class MODULEBASE_EXPORT ModuleBase_WidgetDoubleValue : public ModuleBase_ModelWidget
{
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 QToolButton;
class ModuleBase_IWorkshop;
+/**
+* Implementation of widget for shapes selection.
+* This type of widget can be defined in XML file with 'shape_selector' keyword.
+* For example:
+* \code
+* <shape_selector id="main_object"
+* label="Main object"
+* icon=":icons/cut_shape.png"
+* tooltip="Select an object solid"
+* shape_types="solid shell"
+* concealment="true"
+* />
+* \endcode
+* It can use following parameters:
+* - id - name of object attribute
+* - label - content of widget's label
+* - icon - icon which can be used instead label
+* - tooltip - the witget's tooltip text
+* - shape_types - list of shape types for selection.
+* Possible values: face, vertex, wire, edge, shell, solid
+* - object_types - types of selectable objects.
+* For today it supports only one type "construction"
+* which corresponds to ModelAPI_ResultConstruction object type
+* - concealment - hide or not hide selected object after operation
+*/
class MODULEBASE_EXPORT ModuleBase_WidgetShapeSelector : public ModuleBase_ModelWidget
{
Q_OBJECT
public:
+
+ /// Converts string value (name of shape type) to shape enum value
+ /// \param theType - string with shape type name
+ /// \return TopAbs_ShapeEnum value
static TopAbs_ShapeEnum shapeType(const QString& theType);
+ /// 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_WidgetShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData, const std::string& theParentId);
/// \return a control list
virtual QList<QWidget*> getControls() const;
+ /// Returns currently selected data object
ObjectPtr selectedFeature() const
{
return mySelectedObject;
void activateSelection(bool toActivate);
private slots:
+ /// Slot which is called on selection event
void onSelectionChanged();
protected:
+ /// Computes and updates name of selected object in the widget
void updateSelectionName();
- void raisePanel() const;
- /// Returns true if shape of given object corresponds to requested shape type
- /// This method is called only in non sub-shapes selection mode
- //virtual bool acceptObjectShape(const ObjectPtr theObject) const;
+ /// Raise panel which contains this widget
+ void raisePanel() const;
/// Returns true if selected shape corresponds to requested shape types
- /// This method is called only in sub-shapes selection mode
+ /// \param theShape a shape
virtual bool acceptSubShape(std::shared_ptr<GeomAPI_Shape> theShape) const;
/// Returns true if selected object corresponds to requested Object type
/// Thid method is used in any selection mode
+ /// \param theObject an object
virtual bool acceptObjectType(const ObjectPtr theObject) const;
// Set the given object as a value of the widget
+ /// \param theObj an object
+ /// \param theShape a shape
void setObject(ObjectPtr theObj, std::shared_ptr<GeomAPI_Shape> theShape = std::shared_ptr<GeomAPI_Shape>());
/// Check the selected with validators if installed
+ /// \param theObj the object for checking
+ /// \param theShape the shape for checking
virtual bool isValid(ObjectPtr theObj, std::shared_ptr<GeomAPI_Shape> theShape);
/// Clear attribute
//----------- Class members -------------
protected:
+
+ /// Container of the widget's control
QWidget* myContainer;
+
+ /// Label of the widget
QLabel* myLabel;
+
+ /// Input control of the widget
QLineEdit* myTextLine;
+ /// Reference to workshop
ModuleBase_IWorkshop* myWorkshop;
+ /// Pointer to selected object
ObjectPtr mySelectedObject;
- std::shared_ptr<GeomAPI_Shape> myShape;
+ /// Pointer to selected shape
+ GeomShapePtr myShape;
+
+ /// List of accepting shapes types
QStringList myShapeTypes;
+
+ /// List of accepting object types
QStringList myObjectTypes;
+ /// Active/inactive flag
bool myIsActive;
+ /// Filter by objects types
Handle(ModuleBase_ObjectTypesFilter) myObjTypeFilter;
};
#include <memory>
+/**\class FeaturesPlugin_Plugin
+ * \ingroup Plugins
+ * \brief The main class for management the part set operations as plugin.
+ */
class PARTSETPLUGIN_EXPORT PartSetPlugin_Plugin : public ModelAPI_Plugin,
public Events_Listener
{
/// Returns true is sketch element is under the rigid constraint
SKETCHPLUGIN_EXPORT virtual bool isFixed() {return false;}
+ /// Returns true of the feature is created basing on the external shape of not-this-sketch object
inline bool isExternal() const
{
AttributeSelectionPtr aAttr = data()->selection(EXTERNAL_ID());
#include <ModelAPI_Feature.h>
#include <ModelAPI_Events.h>
+/**\class SketchPlugin_Plugin
+ * \ingroup DataModel
+ * \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
{
- public:
+public:
/// Creates the feature object of this plugin by the feature string ID
virtual FeaturePtr createFeature(std::string theFeatureID);
SketchPlugin_Plugin();
//! Redefinition of Events_Listener method
virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
- protected:
+protected:
+ //! Returns the state of the feature in the WorkBench: enabled or disabled for the moment.
std::shared_ptr<ModelAPI_FeatureStateMessage> getFeaturesState(
const std::shared_ptr<ModelAPI_Feature>& theFeature) const;
};
#include <ModelAPI_ResultValidator.h>
#include <ModelAPI_Object.h>
+/**\class SketchPlugin_ResultPointValidator
+ * \ingroup Validators
+ * \brief Validator for the points selection
+ *
+ * Allows to select points only.
+ */
class SketchPlugin_ResultPointValidator : public ModelAPI_ResultValidator
{
- public:
+public:
+ /// Returns true if theObject is a point
SKETCHPLUGIN_EXPORT virtual bool isValid(const ObjectPtr theObject) const;
};
+/**\class SketchPlugin_ResultLineValidator
+ * \ingroup Validators
+ * \brief Validator for the linear segments selection
+ *
+ * Allows to select linear segments only.
+ */
class SketchPlugin_ResultLineValidator : public ModelAPI_ResultValidator
{
- public:
+public:
+ /// Returns true if theObject is a line
SKETCHPLUGIN_EXPORT virtual bool isValid(const ObjectPtr theObject) const;
};
+/**\class SketchPlugin_ResultArcValidator
+ * \ingroup Validators
+ * \brief Validator for the circular segments selection
+ *
+ * Allows to select circular segments only.
+ */
class SketchPlugin_ResultArcValidator : public ModelAPI_ResultValidator
{
public:
+ /// Returns true if theObject is an arc
SKETCHPLUGIN_EXPORT virtual bool isValid(const ObjectPtr theObject) const;
};
SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
protected:
- /// Creates a plane and append it to the list
- /// \param theX the X normal value
- /// \param theY the Y normal value
- /// \param theZ the Z normal value
- /// \param theShapes the list of result shapes
- //void addPlane(double theX, double theY, double theZ,
- // std::list<std::shared_ptr<GeomAPI_Shape> >& theShapes) const;
-
/// Checks whether the plane is set in the sketch.
/// \returns the boolean state
bool isPlaneSet();
#include "SketchPlugin.h"
#include <ModelAPI_RefAttrValidator.h>
+/**\class SketchPlugin_DistanceAttrValidator
+ * \ingroup Validators
+ * \brief Validator for the distance input.
+ *
+ * It just checks that distance is greater than zero.
+ */
class SketchPlugin_DistanceAttrValidator : public ModelAPI_RefAttrValidator
{
public:
const AttributePtr& theAttribute) const { return true; };
};
-/**
+/**\class SketchPlugin_DifferentObjectsValidator
+ * \ingroup Validators
+ *
* Check that there is no same object was already selected in the feature.
* For an example: to avoid perpendicularity on line and the same line.
*/
return ARC;
}
} else {
- const std::string aType = anAttrRef->attr()->attributeType();
- if (aType == GeomDataAPI_Point2D::type())
- return POINT2D;
- if (aType == GeomDataAPI_Point2D::type())
- return POINT2D;
+ if (anAttrRef->attr().get() != NULL) {
+ const std::string aType = anAttrRef->attr()->attributeType();
+ if (aType == GeomDataAPI_Point2D::type())
+ return POINT2D;
+ if (aType == GeomDataAPI_Point2D::type())
+ return POINT2D;
+ }
}
return UNKNOWN;
*/
class SketchSolver_Constraint
{
- public:
+public:
+ /// Default constructor
SketchSolver_Constraint();
+ /// Creates constraint to manage the given constraint from plugin
SketchSolver_Constraint(std::shared_ptr<SketchPlugin_Constraint> theConstraint);
/** \brief Compute constraint type according to SolveSpace identifiers
/// Tolerance for value of parameters
const double tolerance = 1.e-10;
-/*
+/**
* Collects all sketch solver error' codes
* as inline static functions
- * TODO: Move this class into a separate file
*/
+ // TODO: Move this class into a separate file
class SketchSolver_Error
{
public:
* \return \c true if the constraint added or updated successfully
*/
bool changeConstraint(std::shared_ptr<SketchPlugin_Constraint> theConstraint);
+ /** \brief Adds or updates a rigid constraint in the group
+ * \param[in] theConstraint constraint to be changed
+ * \return \c true if the constraint added or updated successfully
+ */
bool changeRigidConstraint(std::shared_ptr<SketchPlugin_Constraint> theConstraint);
/** \brief Verifies the feature attributes are used in this group
*/
bool isBaseWorkplane(std::shared_ptr<ModelAPI_CompositeFeature> theWorkplane) const;
+ /// Returns the current workplane
std::shared_ptr<ModelAPI_CompositeFeature> getWorkplane() const
{
return mySketch;
* \param[in] theEntity attribute of the constraint
*/
void updateRelatedConstraints(std::shared_ptr<ModelAPI_Attribute> theEntity) const;
+ /** \brief Searches the constraints built on the entity and emit the signal to update them
+ * \param[in] theFeature feature of the constraint
+ */
void updateRelatedConstraintsFeature(std::shared_ptr<ModelAPI_Feature> theFeature) const;
/** \brief Adds or updates an entity in the group
// Unknown entity
#define SLVS_E_UNKNOWN 0
+/**
+ * The main class that performs the high-level operations for connection to the SolveSpace.
+ */
class SketchSolver_Solver
{
public:
class XGUI_EXPORT XGUI_Displayer
{
public:
- /// Enumeration of possible display mode
+ /// \enum DisplayMode display mode
enum DisplayMode {
- NoMode = -1, /// Mode is not defined
- Wireframe, /// Wireframe display mode
- Shading /// Shading display mode
+ /// Mode is not defined
+ NoMode = -1,
+ /// Wireframe display mode
+ Wireframe,
+ /// Shading display mode
+ Shading
};
/// Constructor
class XGUI_Workshop;
+/**
+* Implementation of \ref ModuleBase_ISelection interface.
+*/
class XGUI_EXPORT XGUI_Selection : public ModuleBase_ISelection
{
public:
+ /// Constructor
+ /// \param theWorkshop reference to workshop instance
XGUI_Selection(XGUI_Workshop* theWorkshop);
/// Returns a list of viewer selected presentations