* The geometrical algorithms implementation (basing on OCCT libraries) are located in <b>GeomAlgoAPI</b>.
*
*/
+
/**
* \defgroup Plugins Plugins
* <b>PartSetPlugin</b>, <b>ConstructionPlugin</b>, <b>SketchPlugin</b>, <b>FeaturesPlugins</b>, etc.
*
*/
+
+ /**
+ * \defgroup Config Config
+ *
+ * \brief XML processing tools used in the application
+ *
+ * The tools for reading definitions of plugins, features and widgets.
+ *
+ */
/**
* \defgroup GUI GUI of the application
*/
class Config_AttributeMessage : public Events_Message
{
- std::string myAttributeId; //Feature unique id
- std::string myFeatureId; //Feature unique id
- bool myIsObligatory;
- bool myIsConcealment;
+ std::string myAttributeId; ///< Attribute's unique id
+ std::string myFeatureId; ///< Attribute's feature's unique id
+ bool myIsObligatory; ///< Required to be set by user, else it's feature is invalid.
+ bool myIsConcealment; ///< If true, conceals features used as input
public:
- // Same event as Config_FeatureMessage::MODEL_EVENT()
+ /// Same event as Config_FeatureMessage::MODEL_EVENT()
inline static const char* MODEL_EVENT()
{
return Config_FeatureMessage::MODEL_EVENT();
}
- //const Events_ID theID, const void* theSender = 0
+ /// Constructor
CONFIG_EXPORT Config_AttributeMessage(const Events_ID theId, const void* theParent = 0);
+ /// Destructor
CONFIG_EXPORT virtual ~Config_AttributeMessage();
//Auto-generated getters/setters
+ /// Returns attribute's unique id
CONFIG_EXPORT const std::string& attributeId() const;
+ /// Returns attribute's feature's unique id
CONFIG_EXPORT const std::string& featureId() const;
+ /// Returns true if attribute is obligatory:
+ /// Required to be set by user, else it's feature is invalid.
CONFIG_EXPORT bool isObligatory() const;
+ /// Returns true if attribute should conceal input features
CONFIG_EXPORT bool isConcealment() const;
+ /// Set attribute's unique id
CONFIG_EXPORT void setAttributeId(const std::string& theId);
+ /// Set attribute's feature's unique id
CONFIG_EXPORT void setFeatureId(const std::string& id);
+ /// Returns attribute's concealment state
CONFIG_EXPORT void setConcealment(bool isConcealment);
+ /// Returns attribute's obligatory state
CONFIG_EXPORT void setObligatory(bool isObligatory);
};
* Should be used for case insensitive string matching.
*/
CONFIG_EXPORT std::string normalize(const char* theString);
+/*!
+ * Returns normalized (lower case) version of string.
+ * Should be used for case insensitive string matching.
+ */
CONFIG_EXPORT std::string normalize(const std::string& theString);
#endif
\r
/*!\r
* \class Config_FeatureMessage\r
+ * \ingroup Config\r
* \brief Class to pass a feature entry extracted from xml file.\r
* Example of the feature entry:\r
* \code\r
*/\r
class Config_FeatureMessage : public Events_Message\r
{\r
- std::string myId; //Feature unique id\r
- std::string myText; //Represents action's text\r
- std::string myTooltip; //Represents action's tooltip\r
- std::string myIcon; //Represents action's icon\r
- std::string myKeysequence; //Represents action's key sequence\r
+ std::string myId; ///<Feature unique id\r
+ std::string myText; ///<Represents action's text\r
+ std::string myTooltip; ///<Represents action's tooltip\r
+ std::string myIcon; ///<Represents action's icon\r
+ std::string myKeysequence; ///<Represents action's key sequence\r
\r
- std::string myGroupId; //Id of feature's group\r
- std::string myWorkbenchId; //Id of feature's workbench\r
- std::string myDocumentKind; // kind of the document of the workbench (all documents if empty)\r
- std::string myPluginLibrary; //Name of feature's library\r
+ std::string myGroupId; ///<Id of feature's group\r
+ std::string myWorkbenchId; ///<Id of feature's workbench\r
+ std::string myDocumentKind; ///< kind of the document of the workbench (all documents if empty)\r
+ std::string myPluginLibrary; ///<Name of feature's library\r
\r
- bool myUseInput; //Action is being checked until user commit the operation\r
- bool myInternal; //Internal feature without GUI representation\r
- std::string myNestedFeatures;\r
+ bool myUseInput; ///<Action is being checked until user commit the operation\r
+ bool myInternal; ///<Internal feature without GUI representation\r
+ std::string myNestedFeatures; ///<Comma separated list of child features\r
\r
public:\r
/// Event ID that feature is loaded in workbench (GUI)\r
static const char * MY_GUI_EVENT_ID("WorkshopFeatureLoaded");\r
return MY_GUI_EVENT_ID;\r
}\r
+ /// Event ID that feature is loaded in workbench (Model)\r
inline static const char* MODEL_EVENT()\r
{\r
static const char * MY_MODEL_EVENT_ID("ModelFeatureLoaded");\r
return MY_MODEL_EVENT_ID;\r
}\r
\r
- //const Events_ID theID, const void* theSender = 0\r
+ /// Constructs Config_FeatureMessage\r
CONFIG_EXPORT Config_FeatureMessage(const Events_ID theId, const void* theParent = 0);\r
+ /// Deletes Config_FeatureMessage\r
CONFIG_EXPORT virtual ~Config_FeatureMessage();\r
\r
//Auto-generated getters/setters\r
- CONFIG_EXPORT const std::string& icon() const;\r
+ /// Feature's Id\r
CONFIG_EXPORT const std::string& id() const;\r
+ /// Feature's Icon\r
+ CONFIG_EXPORT const std::string& icon() const;\r
+ /// Feature's shortcut\r
CONFIG_EXPORT const std::string& keysequence() const;\r
+ /// Feature's text\r
CONFIG_EXPORT const std::string& text() const;\r
+ /// Feature's tooltip\r
CONFIG_EXPORT const std::string& tooltip() const;\r
+ /// Id of Feature's Group\r
CONFIG_EXPORT const std::string& groupId() const;\r
+ /// Id of Feature's Workbench\r
CONFIG_EXPORT const std::string& workbenchId() const;\r
+ /// Kind of a document which contains the feature\r
CONFIG_EXPORT const std::string& documentKind() const;\r
+ /// Name of a library which contains the feature\r
CONFIG_EXPORT const std::string& pluginLibrary() const;\r
+ /// Comma separated list of nested features\r
CONFIG_EXPORT const std::string& nestedFeatures() const;\r
+ /// If false - feature has no Property panel representation\r
CONFIG_EXPORT bool isUseInput() const;\r
+ /// If true - feature will not be added into the workbench\r
CONFIG_EXPORT bool isInternal() const;\r
\r
- CONFIG_EXPORT void setIcon(const std::string& icon);\r
+ ///Set feature's Id\r
CONFIG_EXPORT void setId(const std::string& id);\r
+ ///Set feature's Icon\r
+ CONFIG_EXPORT void setIcon(const std::string& icon);\r
+ ///Set feature's shortcut\r
CONFIG_EXPORT void setKeysequence(const std::string& keysequence);\r
+ ///Set feature's text\r
CONFIG_EXPORT void setText(const std::string& text);\r
+ ///Set feature's tooltip\r
CONFIG_EXPORT void setTooltip(const std::string& tooltip);\r
+ ///Set id of Feature's Group\r
CONFIG_EXPORT void setGroupId(const std::string& groupId);\r
+ ///Set id of Feature's Workbench\r
CONFIG_EXPORT void setWorkbenchId(const std::string& workbenchId);\r
+ ///Set kind of a document which contains the feature\r
CONFIG_EXPORT void setDocumentKind(const std::string& documentKind);\r
+ ///Set name of a library which contains the feature\r
CONFIG_EXPORT void setPluginLibrary(const std::string& thePluginLibrary);\r
+ ///Set comma separated list of nested features\r
CONFIG_EXPORT void setNestedFeatures(const std::string& theNestedFeatures);\r
+ ///Set use input state; If false - feature has no Property panel representation\r
CONFIG_EXPORT void setUseInput(bool isUseInput);\r
+ ///Set internal state; If true - feature will not be added into the workbench\r
CONFIG_EXPORT void setInternal(bool isInternal);\r
};\r
\r
/*!
* \class Config_FeatureReader
+ * \ingroup Config
* \brief Class to process feature's xml definition.
*/
class Config_FeatureReader : public Config_XMLReader
{
public:
+ /// Constructor
Config_FeatureReader(const std::string& theXmlFile,
const std::string& theLibraryName,
const char* theEventGenerated = 0);
/*!
* \class Config_ModuleReader
+ * \ingroup Config
* \brief Class to process plugins.xml - definition of plugins (scripts, libraries).
*/
class Config_ModuleReader : public Config_XMLReader
};
public:
+ /// Constructor
CONFIG_EXPORT Config_ModuleReader(const char* theEventGenerated = 0);
+ /// Destructor
CONFIG_EXPORT virtual ~Config_ModuleReader();
-
+ /// Returns map that describes which file contains a feature (the feature is key, the file is value)
CONFIG_EXPORT const std::map<std::string, std::string>& featuresInFiles() const;
-
+ /// Returns module name: an xml attribute from the root of the plugins.xml:
+ /// e.g <plugins module="PartSet">
CONFIG_EXPORT std::string getModuleName();
-
+ /// Detects type of the given plugin and loads it using loadLibrary or loadScript.
CONFIG_EXPORT static void loadPlugin(const std::string& thePluginName);
/// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform
CONFIG_EXPORT static void loadLibrary(const std::string& theLibName);
/// loads the python module with specified name
CONFIG_EXPORT static void loadScript(const std::string& theFileName);
- // extends set of modules, which will be used for dependency
- // checking (if there is no required module in the set, a plugin will not be loaded)
+ /*!
+ * Extends set of modules, used for dependency checking (if there is no
+ * required module in the set, a plugin will not be loaded)
+ */
CONFIG_EXPORT static void addDependencyModule(const std::string& theModuleName);
protected:
- void processNode(xmlNodePtr aNode);
- bool processChildren(xmlNodePtr aNode);
-
+ /// Recursively process the given xmlNode
+ virtual void processNode(xmlNodePtr aNode);
+ /// Defines if the reader should process children of the given node
+ virtual bool processChildren(xmlNodePtr aNode);
+ /// check if dependencies of the given node are in the list of loaded modules
bool hasRequiredModules(xmlNodePtr aNode) const;
+ /// reads info about plugin's features from plugin xml description
std::list<std::string> importPlugin(const std::string& thePluginLibrary,
const std::string& thePluginFile);
+ /// stores information about plugin in the internal cache
std::string addPlugin(const std::string& aPluginLibrary,
const std::string& aPluginScript,
const std::string& aPluginConf);
private:
- std::map<std::string, std::string> myFeaturesInFiles;
- static std::map<std::string, PluginType> myPluginTypes;
- static std::set<std::string> myDependencyModules;
- const char* myEventGenerated;
+ std::map<std::string, std::string> myFeaturesInFiles; ///< a feature name is key, a file is value
+ static std::map<std::string, PluginType> myPluginTypes; ///< a plugin name is key, a plugin type is value
+ static std::set<std::string> myDependencyModules; ///< set of loaded modules
+ const char* myEventGenerated; ///< gives ability to send Feature_Messages to various listeners
};
#endif /* CONFIG_XMLMODULEREADER_H_ */
/*!
* \class Config_PointerMessage
+ * \ingroup Config
* \brief A general class to pass pointers over the event loop.
*/
class CONFIG_EXPORT Config_PointerMessage : public Events_Message
{
public:
+ /// Constructor
Config_PointerMessage(const Events_ID theId, const void* theParent = 0);
virtual ~Config_PointerMessage();
+ /// Returns pointer to an object
void* pointer() const;
+ /// Sets pointer to an object
void setPointer(void* pointer);
private:
- void* myPointer;
+ void* myPointer; ///< Pointer to an object
};
#endif /* PARTSET_MESSAGE_H_ */
#include <string>
#include <list>
-/// Class which describes a one property
+/*!
+ * \class Config_Prop
+ * \brief Class which describes a one property
+ * \ingroup Config
+ */
class Config_Prop
{
public:
+ /// Type of stored property
enum PropType
{
Disabled,
myDefaultValue = theDefaultValue;
}
+ /// Get name of section
std::string section() const
{
return mySection;
}
+ /// Get name of property
std::string name() const
{
return myName;
}
-
+ /// Get title of property
std::string title() const
{
return myTitle;
}
+ /// Set title of property
void setTitle(const std::string& theTitle)
{
myTitle = theTitle;
}
-
+ /// Get type of property
PropType type() const
{
return myType;
}
+ /// Set type of property
void setType(PropType theType)
{
myType = theType;
}
-
+ /// Get property's value in string format
std::string value() const
{
return myValue;
}
-
+ /// Set property's value in string format
CONFIG_EXPORT void setValue(const std::string& theValue);
-
+ /// Get default value of property
std::string defaultValue() const
{
return myDefaultValue;
}
-
+ /// Set default value of property
CONFIG_EXPORT void setDefaultValue(const std::string& theValue);
-
+ /// Alows to compare Config_Prop with each other
bool operator==(const Config_Prop* theProp) const
{
return (mySection == theProp->section()) && (myName == theProp->name());
}
private:
- std::string mySection;
- std::string myName;
- std::string myTitle;
- PropType myType;
- std::string myValue;
- std::string myDefaultValue;
+ std::string mySection; ///< Name of section
+ std::string myName; ///< Name of property
+ std::string myTitle; ///< Title of property
+ PropType myType; ///< Type of property
+ std::string myValue; // Value in string format
+ std::string myDefaultValue; // Default value
};
typedef std::list<Config_Prop*> Config_Properties;
#include <string>
#include <vector>
-//! Class which let to register properties
+/*
+ * \class Config_PropManager
+ * \ingroup Config
+ * \brief Class which let to register properties
+ */
class Config_PropManager
{
public:
/**
* Registers property parameters
- * \param theOwnerId - name of owner (name of plugin for example)
* \param theSection - name of section (domain of using) of the property.
* \param theName - name (title) of the value.
* \param theType - type of the value.
*/
CONFIG_EXPORT static Config_Prop* registerProp(const std::string& theSection, const std::string& theName,
const std::string& theTitle, Config_Prop::PropType theType, const std::string& theDefValue = "");
-
+ //! Finds property in the given section by the given name, if property not found returns NULL
CONFIG_EXPORT static Config_Prop* findProp(
const std::string& theSection, const std::string& theName);
-
+ //! Returns std::list of all existing properies
CONFIG_EXPORT static Config_Properties getProperties();
-
//! Returns list of registered section names.
CONFIG_EXPORT static std::list<std::string> getSections();
-
//! Returns list of properties by its owner and section.
CONFIG_EXPORT static Config_Properties getProperties(const std::string& theSection);
//! Returns value of the property by its owner, section, and name
- CONFIG_EXPORT static std::string string(
- const std::string& theSection, const std::string& theName, const std::string& theDefault);
-
- CONFIG_EXPORT static std::vector<int> color(
- const std::string& theSection, const std::string& theName, const std::string& theDefault);
-
- CONFIG_EXPORT static int integer(
- const std::string& theSection, const std::string& theName, const std::string& theDefault);
-
- CONFIG_EXPORT static double real(
- const std::string& theSection, const std::string& theName, const std::string& theDefault);
+ CONFIG_EXPORT static std::string string(const std::string& theSection,
+ const std::string& theName,
+ const std::string& theDefault);
+ //! Returns color by given section and name as 3-element vector {r,g,b}.
+ CONFIG_EXPORT static std::vector<int> color(const std::string& theSection,
+ const std::string& theName,
+ const std::string& theDefault);
+ //! Returns integer by given section and name
+ CONFIG_EXPORT static int integer(const std::string& theSection,
+ const std::string& theName,
+ const std::string& theDefault);
+ //! Returns real by given section and name
+ CONFIG_EXPORT static double real(const std::string& theSection,
+ const std::string& theName,
+ const std::string& theDefault);
private:
- CONFIG_EXPORT static Config_Properties myProps;
+ CONFIG_EXPORT static Config_Properties myProps; ///< List of all stored properties
};
#endif
/*!
* \class Config_SelectionFilterMessage
+ * \ingroup Config
* \brief Transmits info about selection filters on "SelectionFilterLoaded" event
*/
class Config_SelectionFilterMessage : public Events_Message
CONFIG_EXPORT Config_SelectionFilterMessage(const Events_ID theId, const void* theParent = 0);
CONFIG_EXPORT virtual ~Config_SelectionFilterMessage();
+ //! Get id of the filter
CONFIG_EXPORT const std::string& selectionFilterId() const;
+ //! Get id of a feature to which the filter belongs to
CONFIG_EXPORT const std::string& featureId() const;
+ //! Get id of an attribute to which the filter belongs to
CONFIG_EXPORT const std::string& attributeId() const;
+ //! Get filter parameters
CONFIG_EXPORT const std::list<std::string>& parameters() const;
+ //! Set id of the filter
CONFIG_EXPORT void setSelectionFilterId(const std::string& theId);
+ //! Set id of a feature to which the filter belongs to
CONFIG_EXPORT void setFeatureId(const std::string& theId);
+ //! Set id of an attribute to which the filter belongs to
CONFIG_EXPORT void setAttributeId(const std::string& theId);
+ //! Get filter parameters
CONFIG_EXPORT void setFilterParameters(const std::list<std::string>& parameters);
};
/*!
* \class Config_ValidatorMessage
+ * \ingroup Config
* \brief Transmits info about created validator on "ValidatorLoaded" event
*/
class Config_ValidatorMessage : public Events_Message
CONFIG_EXPORT Config_ValidatorMessage(const Events_ID theId, const void* theParent = 0);
CONFIG_EXPORT virtual ~Config_ValidatorMessage();
- //CONFIG_EXPORT static const char* UID() const;
-
+ //! Get id of the filter
CONFIG_EXPORT const std::string& validatorId() const;
+ //! Get id of a feature to which the filter belongs to
CONFIG_EXPORT const std::string& featureId() const;
+ //! Get id of an attribute to which the filter belongs to
CONFIG_EXPORT const std::string& attributeId() const;
+ //! Get filter parameters
CONFIG_EXPORT const std::list<std::string>& parameters() const;
+ //! Returns true if validator id is not empty
CONFIG_EXPORT bool isValid() const;
+ //! Set id of the filter
CONFIG_EXPORT void setValidatorId(const std::string& theId);
+ //! Set id of a feature to which the filter belongs to
CONFIG_EXPORT void setFeatureId(const std::string& theId);
+ //! Set id of an attribute to which the filter belongs to
CONFIG_EXPORT void setAttributeId(const std::string& theId);
+ //! Get filter parameters
CONFIG_EXPORT void setValidatorParameters(const std::list<std::string>& parameters);
};
/*!
* \class Config_WidgetAPI
+ * \ingroup Config
* \brief Provides low-level API for WidgetFactory for reading xml definitions of widgets
*/
class CONFIG_EXPORT Config_WidgetAPI
public:
virtual ~Config_WidgetAPI();
+ //! Returns name of widget's node (attribute)
std::string widgetType() const;
+ //! Returns true if widget has container type, which means it able to contain other widgets
bool isContainerWidget() const;
+ //! Returns true if widget has page type;
+ //! Page is container widget with combo box control to switch between pages
bool isPagedWidget() const;
+ //! Returns id of current widget
std::string widgetId() const;
+ //! Returns icon of current widget
std::string widgetIcon() const;
+ //! Returns text for label of current widget
std::string widgetLabel() const;
+ //! Returns text for tooltip of current widget
std::string widgetTooltip() const;
-
+ //! Returns a custom property of current widget
std::string getProperty(const char* thePropName) const;
- /// Checks if the XML representation of widget has given attribute,
- /// if yes - returns it's bool value, if no, or if the value can not
- /// be converted to bool - returns theDefault.
- /// \param theAttributeName attribute to check
- /// \param theDefault default value on bad data
- /// \return the boolean result
+ /*! Checks if the XML representation of widget has given attribute,
+ * if yes - returns it's bool value, if no, or if the value can not
+ * be converted to bool - returns theDefault.
+ * \param theAttributeName attribute to check
+ * \param theDefault default value on bad data
+ * \return the boolean result
+ */
bool getBooleanAttribute(const char* theAttributeName, bool theDefault) const;
- bool isComputedDefault() const;
-
protected:
/// These fields are accessible for ModuleBase_WidgetFactory only
Config_WidgetAPI(std::string theRawXml);
+ //! Pass to the next (sibling) node of widget's xml definition. If impossible, returns false
bool toNextWidget();
+ //! Pass into the child node of widget's xml definition. If impossible, returns false
bool toChildWidget();
+ //! Pass into the parent node of widget's xml definition. If impossible, returns false
bool toParentWidget();
private:
- xmlDocPtr myDoc;
- xmlNodePtr myCurrentNode;
+ xmlDocPtr myDoc; //!< Pointer to the root of widget's xml definition
+ xmlNodePtr myCurrentNode; //!< Pointer to the current node in the widget's xml definition
friend class ModuleBase_WidgetFactory;
};
/*!
* \class Config_WidgetReader
+ * \ingroup Config
* \brief Class that dumps xml definitions of widgets for
* further processing in the WidgetFactory
*/
CONFIG_EXPORT Config_WidgetReader(const std::string& theXmlFile);
CONFIG_EXPORT virtual ~Config_WidgetReader();
+ /// Extract feature's widget configuration from local cache, stored on node processing
CONFIG_EXPORT std::string featureWidgetCfg(const std::string& theFeatureName);
+ /// Extract feature's description from local cache, stored on node processing
CONFIG_EXPORT std::string featureDescription(const std::string& theFeatureName);
protected:
+ /// Overloaded method. Defines how to process each node
void processNode(xmlNodePtr theNode);
+ /// Overloaded method. Defines if the given node should be parsed recursively
bool processChildren(xmlNodePtr theNode);
+ /// Extracts xml definition of the given node and it's children
std::string dumpNode(xmlNodePtr theNode);
+ /// Replace all "source" nodes with their content (used before dumping nodes)
void resolveSourceNodes(xmlNodePtr theNode);
private:
xmlFreeDoc(myXmlDoc);
}
-/*!
- * Read all nodes in associated xml file,
- * recursively if processChildren(xmlNode) is true for the xmlNode.
- * For each read node the processNode will be called.
- */
void Config_XMLReader::readAll()
{
xmlNodePtr aRoot = findRoot();
readRecursively(aRoot);
}
-/*!
- * Allows to customize reader's behavior for a node. Virtual.
- * The default impl does nothing. (In debug mode prints
- * some info)
- */
void Config_XMLReader::processNode(xmlNodePtr theNode)
{
if (isNode(theNode, NODE_SOURCE, NULL)) {
}
}
-/*!
- * Defines which nodes should be processed recursively. Virtual.
- * The default impl is to read all nodes.
- */
bool Config_XMLReader::processChildren(xmlNodePtr aNode)
{
return true;
}
-/*!
- * Returns xmlNodePtr to the root of reader's document
- * or NULL if not found
- */
xmlNodePtr Config_XMLReader::findRoot()
{
if (myXmlDoc == NULL) {
return aRoot;
}
-/*!
- * Calls processNode() for each child (for some - recursively)
- * of the given node.
- * \sa ReadAll()
- */
void Config_XMLReader::readRecursively(xmlNodePtr theParent)
{
if (!theParent)
}
}
-/*!
- * void* -> xmlNodePtr
- */
xmlNodePtr Config_XMLReader::node(void* theNode)
{
return static_cast<xmlNodePtr>(theNode);
}
-/*!
- * Gets xml node name
- */
std::string Config_XMLReader::getNodeName(xmlNodePtr theNode)
{
std::string result = "";
return result;
}
-/*!
- * Retrieves all the necessary info from the validator node.
- * Sends ValidatorLoaded event
- */
void Config_XMLReader::processValidator(xmlNodePtr theNode)
{
Events_ID aValidatoEvent = Events_Loop::eventByName(EVENT_VALIDATOR_LOADED);
aEvLoop->send(aMessage);
}
-/*!
- * Retrieves all the necessary info from the SelectionFilter node.
- * Sends SelectionFilterLoaded event
- */
void Config_XMLReader::processSelectionFilter(xmlNodePtr theNode)
{
Events_ID aFilterEvent = Events_Loop::eventByName(EVENT_SELFILTER_LOADED);
/*!
* \class Config_XMLReader
+ * \ingroup Config
* \brief Base class for all libxml readers. Provides high-level API
* for all xml operations.
*/
public:
CONFIG_EXPORT Config_XMLReader(const std::string& theXmlFile);
CONFIG_EXPORT virtual ~Config_XMLReader();
-
+ /*!
+ * Read all nodes in associated xml file,
+ * recursively if processChildren(xmlNode) is true for the xmlNode.
+ * For each read node the processNode will be called.
+ */
CONFIG_EXPORT void readAll();
-
- public:
+ /*!
+ * Returns xmlNodePtr to the root of reader's document
+ * or NULL if not found
+ */
CONFIG_EXPORT xmlNodePtr findRoot();
protected:
+ /*!
+ * \brief Allows to customize reader's behavior for a node. Virtual.
+ * The default implementation process "source", "validator" and
+ * "selection_filter" nodes.
+ */
virtual void processNode(xmlNodePtr aNode);
+ /*!
+ * \brief Defines which nodes should be processed recursively. Virtual.
+ * The default impl is to read all nodes.
+ */
virtual bool processChildren(xmlNodePtr aNode);
-
+ /*!
+ * Calls processNode() for each child (for some - recursively)
+ * of the given node.
+ * \sa ReadAll()
+ */
void readRecursively(xmlNodePtr theParent);
-
+ /*!
+ * \brief void* -> xmlNodePtr
+ */
xmlNodePtr node(void* theNode);
+ /// Gets xml node name
std::string getNodeName(xmlNodePtr theNode);
+ /*!
+ * \brief Retrieves all the necessary info from the validator node.
+ * Sends ValidatorLoaded event
+ */
void processValidator(xmlNodePtr theNode);
+ /*!
+ * \brief Retrieves all the necessary info from the SelectionFilter node.
+ * Sends SelectionFilterLoaded event
+ */
void processSelectionFilter(xmlNodePtr theNode);
protected:
- std::string myCurrentFeature;
-
- protected:
- std::string myDocumentPath;
- xmlDocPtr myXmlDoc;
+ std::string myCurrentFeature; ///< Name of currently processed feature
+ std::string myDocumentPath; ///< Path to the xml document
+ xmlDocPtr myXmlDoc; ///< Root of the xml document
};
#endif /* CONFIG_XMLREADER_H_ */
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Iterator.hxx>
using namespace std;
-//#define DEB_NAMING 1
+#define DEB_NAMING 1
#ifdef DEB_NAMING
#include <BRepTools.hxx>
#endif
return;
}
}
- aSel.Select(aNewShape, aContext);
+ aSel.Select(aNewShape, aContext);
}
/// registers the name of the shape in the label (theID == 0) of sub label (theID is a tag)
{
std::shared_ptr<GeomAPI_Shape> aSubSh = value();
ResultPtr aCont = context();
- std::string aName;
+ std::string aName("Undefined name");
if(!aSubSh.get() || aSubSh->isNull() || !aCont.get() || aCont->shape()->isNull())
return aName;
TopoDS_Shape aSubShape = aSubSh->impl<TopoDS_Shape>();
+ TopoDS_Shape aContext = aCont->shape()->impl<TopoDS_Shape>();
#ifdef DEB_NAMING
BRepTools::Write(aSubShape, "Selection.brep");
+ BRepTools::Write(aContext, "Context.brep");
#endif
- TopoDS_Shape aContext = aCont->shape()->impl<TopoDS_Shape>();
std::shared_ptr<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(aCont->document());
aName = GetShapeName(aDoc, aSubShape, selectionLabel());
if(aName.empty() ) { // not in the document!
TopAbs_ShapeEnum aType = aSubShape.ShapeType();
+ aName = "Undefined name";
switch (aType) {
case TopAbs_FACE:
// the Face should be in DF. If it is not the case, it is an error ==> to be debugged
case TopAbs_EDGE:
{
// name structure: F1 | F2 [| F3 | F4], where F1 & F2 the faces which gives the Edge in trivial case
- // if it is not atrivial case we use localization by neighbours. F3 & F4 - neighbour faces
- TopTools_IndexedMapOfShape aSMap; // map for ancestors of the sub-shape
+ // if it is not atrivial case we use localization by neighbours. F3 & F4 - neighbour faces
TopTools_IndexedDataMapOfShapeListOfShape aMap;
TopExp::MapShapesAndAncestors(aContext, TopAbs_EDGE, TopAbs_FACE, aMap);
+ TopTools_IndexedMapOfShape aSMap; // map for ancestors of the sub-shape
bool isTrivialCase(true);
- for (int i = 1; i <= aMap.Extent(); i++) {
+/* for (int i = 1; i <= aMap.Extent(); i++) {
const TopoDS_Shape& aKey = aMap.FindKey(i);
- if (aKey.IsNotEqual(aSubShape)) continue; // find exactly the selected key
-
+ //if (aKey.IsNotEqual(aSubShape)) continue; // find exactly the selected key
+ if (aKey.IsSame(aSubShape)) continue;
const TopTools_ListOfShape& anAncestors = aMap.FindFromIndex(i);
// check that it is not a trivial case (F1 & F2: aNumber = 1)
isTrivialCase = isTrivial(anAncestors, aSMap);
break;
- }
-
+ }*/
+ if(aMap.Contains(aSubShape)) {
+ const TopTools_ListOfShape& anAncestors = aMap.FindFromKey(aSubShape);
+ // check that it is not a trivial case (F1 & F2: aNumber = 1)
+ isTrivialCase = isTrivial(anAncestors, aSMap);
+ } else
+ break;
TopTools_ListOfShape aListOfNbs;
if(!isTrivialCase) { // find Neighbors
TNaming_Localizer aLocalizer;
/**
+* \ingroup GUI
* An extension and customozation of QDoubleSpinBox class
*/
class MODULEBASE_EXPORT ModuleBase_DoubleSpinBox : public QDoubleSpinBox
#include <list>
/**
+ * \ingroup GUI
* This object is assigned by the name
* in the XML file to the specific attribute or to the whole feature.
* If isOK method of the filter returns "false", it is signalized in user interface
#include "ModuleBase_Filter.h"
/**
+* \ingroup GUI
* This is a child of ModuleBase_Filter to be used in the factory of filters. Despite of other
* child it does not create the internal filter itself, it get it from the constructor argument.
* This is useful for custom filters, which are not the standard OCC filters. It is not necessary
#include <StdSelect_TypeOfFace.hxx>
/**
+* \ingroup GUI
* A class of a viewer filter by faces
*/
class ModuleBase_FilterFace: public ModuleBase_Filter
#include <set>
/**
+ * \ingroup GUI
* Allows to get a selection filter by the feature identifier and
* the attribute identifier (if attribute is validated).
* All accessible filters must be registered by the ID string first.
#include <StdSelect_TypeOfEdge.hxx>
/**
+* \ingroup GUI
* A class of a viewer filter by linear edges
*/
class ModuleBase_FilterLinearEdge: public ModuleBase_Filter
#include <StdSelect_TypeOfFace.hxx>
/**
+* \ingroup GUI
* An implementation of filter which support using of several filters according to OR statement
*/
class ModuleBase_FilterMulti: public ModuleBase_Filter
class ModuleBase_IWorkshop;
/**
+* \ingroup GUI
* \class ModuleBase_FilterNoConsructionSubShapes
* A filter which provides filtering of selection in 3d viewer.
* Installing of this filter lets to select objects which belong to
#include <StdSelect_TypeOfFace.hxx>
/**
+* \ingroup GUI
* A class of a viewer filter by shape type
*/
class ModuleBase_FilterShapeType: public ModuleBase_Filter
class ModuleBase_IWorkshop;\r
\r
/**\r
+ * \ingroup GUI\r
* Interface to a module\r
*/\r
class MODULEBASE_EXPORT ModuleBase_IModule : public QObject\r
#include <SUIT_PreferenceMgr.h>
/**
+* \ingroup GUI
* An interface class which provides incapsulation of SUIT_PreferenceMgr class instance
* It is used in order to make common interface to Preference manager in Salome
* and this application
class ModuleBase_ModelWidget;
/**
+* \ingroup GUI
* A class for Property panel object definition
*/
class MODULEBASE_EXPORT ModuleBase_IPropertyPanel : public QDockWidget
#include <QList>
/**
+* \ingroup GUI
* A class which provides access to selection.
* A selection can be obtained as from a viewer as from Object browser in various forms
*/
/**
+* \ingroup GUI
* Interface to ViewWindow object which contains 3d scene
*/
class ModuleBase_IViewWindow
class ModuleBase_IViewWindow;
/**
+ * \ingroup GUI
* A Base object for definition of connector object to
* Salome Viewer. Reimplemented in NewGeom_SalomeViewer class
*/
class ModuleBase_FilterFactory;
/**
+ * \ingroup GUI
* Class which provides access to Workshop object serveces
*/
class MODULEBASE_EXPORT ModuleBase_IWorkshop : public QObject
class QKeyEvent;
/**\class ModuleBase_ModelWidget
+ * \ingroup GUI
* \brief An abstract custom widget class. This class realization is assumed to create some controls.
* The controls values modification should send signal about values change.
*
class QKeyEvent;
/*!
- \class ModuleBase_Operation
+ * \class ModuleBase_Operation
+ * \ingroup GUI
* \brief Base class for all operations
*
* Base class for all operations. If you perform an action it is reasonable to create
\r
/*!\r
* \class ModuleBase_OperationDescription\r
+ * \ingroup GUI\r
* Description of operation from XML\r
*/\r
class MODULEBASE_EXPORT ModuleBase_OperationDescription\r
typedef QList<ModuleBase_Pref> ModuleBase_Prefs;
//***********************************************************************
+/// \ingroup GUI
/// Class for manipulation with preferences in the application
class MODULEBASE_EXPORT ModuleBase_Preferences
{
};
//***********************************************************************
+/// \ingroup GUI
/// Manager of preferences
class MODULEBASE_EXPORT ModuleBase_PreferencesMgr : public SUIT_PreferenceMgr
{
};
//***********************************************************************
+/// \ingroup GUI
/// Dialog box for preferences editing
class MODULEBASE_EXPORT ModuleBase_PreferencesDlg : public QDialog
{
DEFINE_STANDARD_HANDLE(ModuleBase_ResultPrs, AIS_Shape)
/**
+* \ingroup GUI
* A redefinition of standard AIS Interactive Object in order to provide specific behaviour
* for wire presentations based in a one plane
*/
#include <string>
/**
+* \ingroup Validators
* A validator of selection
*/
class ModuleBase_SelectionValidator : public ModelAPI_Validator
/**
+ * \ingroup GUI
* Methods to modify a resource pixmap
*/
+
//! Create composite pixmap.
//! Pixmap \a theAdditionalIcon is drawn over pixmap \a dest with coordinates
//! specified relatively to the upper left corner of \a theIcon.
/**
* \class ModuleBase_ShapeDocumentFilter
+* \ingroup GUI
* 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
+* \ingroup GUI
* 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
+* \ingroup GUI
* 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:
#include <ModelAPI_Result.h>
/**\class ModuleBase_ViewerPrs
- * \ingroup Module base
+ * \ingroup GUI
* \brief Presentation. Provides container to have feature, shape and/or selection owner.
*/
class ModuleBase_ViewerPrs
}
/// Constructor
- /// \param theFeature a model feature
+ /// \param theResult an object
/// \param theShape a viewer shape
/// \param theOwner a selection owner
ModuleBase_ViewerPrs(ObjectPtr theResult, const TopoDS_Shape& theShape,
{
}
- /// Sets the feature.
- /// \param theFeature a feature instance
+ /// Sets the object.
+ /// \param theResult an object instance
void setFeature(ObjectPtr theResult)
{
myResult = theResult;
return myResult;
}
- /// Returns the presentation owner
- /// \param the owner
+ /// Set the presentation owner
+ /// \param theOwner an owner to set
void setOwner(Handle_SelectMgr_EntityOwner theOwner)
{
myOwner = theOwner;
return myShape;
}
+ /// Set interactive object
+ /// \param theIO an interactive object
void setInteractive(const Handle(AIS_InteractiveObject)& theIO)
{
myInteractive = theIO;
}
+ /// Returns interactive object if it is installed
Handle(AIS_InteractiveObject) interactive() const
{
return myInteractive;
}
+ /// Returns True if the current object is equal to the given one
+ /// \param thePrs an object to compare
bool operator==(const ModuleBase_ViewerPrs& thePrs)
{
bool aResult = (myResult.get() == thePrs.object().get());
ObjectPtr myResult; /// the feature
Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
TopoDS_Shape myShape; /// the shape
- Handle(AIS_InteractiveObject) myInteractive;
+ Handle(AIS_InteractiveObject) myInteractive; /// interactive object
};
#endif
class QCheckBox;
/**
+* \ingroup GUI
* Implementation of widget for boolean input (check box)
*/
class MODULEBASE_EXPORT ModuleBase_WidgetBoolValue : public ModuleBase_ModelWidget
class QComboBox;
/**
+* \ingroup GUI
* Implementation of model widget for choice widget definition (combo box)
* It can be defined as following:
* \code
class QTimer;
/**
+* \ingroup GUI
* A class of property panel widget for double value input
* It can be defined with "doublevalue" keyword. For example:
* \code
class ModuleBase_IWorkshop;
/**
+* \ingroup GUI
* A class for creation of widgets instances in for property panel using XML deskription of
* a feature
*/
class QLineEdit;
/**
+* \ingroup GUI
* Implementation of model widget for open file widget.
* It can be defined as following:
* \code
class QLabel;
/**
+* \ingroup GUI
* Implementation of model widget for a label control
*/
class MODULEBASE_EXPORT ModuleBase_WidgetLabel : public ModuleBase_ModelWidget
class QLineEdit;
/**
+* \ingroup GUI
* Implementation of model widget for line edit widget.
* It can be defined with "stringvalue" keyword.
*/
/**
+* \ingroup GUI
* Implementation of widget for shapes selection. This widget provides selection of several shapes.
* It can be defined in XML file as following:
* \code
class ModuleBase_IWorkshop;
/**
+* \ingroup GUI
* Implementation of widget for shapes selection.
* This type of widget can be defined in XML file with 'shape_selector' keyword.
* For example:
class OCCViewer_Viewer;
/**
+ * \ingroup Salome
* An implementation of SALOME connector class for implementation of
* XGUI functionality as a module of SALOME
*/
#include <LightApp_OCCSelector.h>
/**
+* \ingroup Salome
* Redefinition of standard OCC selector in order to adapt it to NewGeom needs
*/
class NewGeom_EXPORT NewGeom_OCCSelector : public LightApp_OCCSelector
class SUIT_ViewManager;
/**
+* \ingroup Salome
* A class for providing access of NewGeom functionality to
* SALOME view window functionality
*/
virtual Handle(V3d_View) v3dView() const;
+ /// Set the current viewer
+ /// \param theViewer a viewer instance
void setViewer(OCCViewer_Viewer* theViewer) { myViewer = theViewer; }
+
+ /// Returns current viewer
OCCViewer_Viewer* viewer() const { return myViewer; }
private:
/**
+* \ingroup Salome
* A class for providing access of NewGeom functionality to
* SALOME viewer functionality
*/
/// \param theZ the Z projection value
virtual void setViewProjection(double theX, double theY, double theZ);
+ /// Set selector
+ /// \param theSel a selector instance
void setSelector(NewGeom_OCCSelector* theSel);
/// Add selection filter to the viewer
/// Remove all selection filters from the viewer
virtual void clearSelectionFilters();
+ /// Returns current selector
NewGeom_OCCSelector* selector() const
{
return mySelector;
SET(PROJECT_HEADERS
PartSet.h
PartSet_Constants.h
- PartSet_EditLine.h
PartSet_Module.h
PartSet_Tools.h
PartSet_WidgetSketchLabel.h
)
SET(PROJECT_SOURCES
- PartSet_EditLine.cpp
PartSet_Module.cpp
PartSet_Tools.cpp
PartSet_WidgetSketchLabel.cpp
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: PartSet_EditLine.h
-// Created: 02 June 2014
-// Author: Natalia ERMOLAEVA
-
-#include <PartSet_EditLine.h>
-
-#include <QLineEdit>
-
-PartSet_EditLine::PartSet_EditLine(QWidget* theParent)
- : QObject(theParent)
-{
- myEditor = new QLineEdit(theParent);
- myEditor->setWindowFlags(Qt::ToolTip);
- myEditor->setFocusPolicy(Qt::StrongFocus);
-
- connect(myEditor, SIGNAL(returnPressed()), this, SLOT(onStopEditing()));
-}
-
-void PartSet_EditLine::start(const QPoint& thePoint, double theValue)
-{
- myEditor->move(thePoint);
- myEditor->setText(QString::number(theValue));
- myEditor->show();
-
- myEditor->selectAll();
- myEditor->setFocus();
-}
-
-bool PartSet_EditLine::isStarted() const
-{
- return myEditor->isVisible();
-}
-
-void PartSet_EditLine::stop()
-{
- myEditor->hide();
-}
-
-double PartSet_EditLine::getValue() const
-{
- return myEditor->text().toDouble();
-}
-
-void PartSet_EditLine::onStopEditing()
-{
- stop();
- emit stopped(getValue());
-}
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: PartSet_EditLine.h
-// Created: 02 Jun 2014
-// Author: Natalia ERMOLAEVA
-
-#ifndef PartSet_EditLine_H
-#define PartSet_EditLine_H
-
-#include "PartSet.h"
-
-#include <QObject>
-#include <QPoint>
-
-class QLineEdit;
-class QWidget;
-
-/*!
- \class PartSet_EditLine
- * \brief The class to give an editor to modify a real value
- */
-class PARTSET_EXPORT PartSet_EditLine : public QObject
-{
-Q_OBJECT
- public:
- /// Constructor
- PartSet_EditLine(QWidget* theParent);
- /// Destructor
- virtual ~PartSet_EditLine()
- {
- }
- ;
-
- /// Show the editor in the given global position
- /// \param thePoint a position
- /// \param theValue a value for the editor
- void start(const QPoint& thePoint, double theValue);
-
- /// Checks whether the editor is started
- /// \returns true if the editor is activated
- bool isStarted() const;
-
- /// Stop the editor, in other words hide it
- void stop();
-
-signals:
- /// Signals about the editing stop
- /// \param theValue the editor value
- void stopped(double theValue);
-
- protected:
- /// Returns the editor value
- /// \return the real value
- double getValue() const;
-
- protected slots:
- /// Slot to check the editing stop
- void onStopEditing();
-
- protected:
- QLineEdit* myEditor; /// the value editor
-};
-
-#endif
/**
+* \class PartSet_GlobalFilter
+* \ingroup Modules
* A class which filters groups object in addition to documents (see issue #310)
*/
DEFINE_STANDARD_HANDLE(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter);
class PartSet_GlobalFilter: public ModuleBase_ShapeDocumentFilter
{
public:
+ /// Constructor
+ /// \param theWorkshop a pointer to workshop
PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop)
: ModuleBase_ShapeDocumentFilter(theWorkshop) {}
+ /// Returns True if selected presentation can be selected
+ /// \param theOwner an owner of the persentation
Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
DEFINE_STANDARD_RTTI(PartSet_GlobalFilter)
class ModuleBase_Operation;
class ModuleBase_IViewWindow;
+/**
+* \ingroup Modules
+* Implementation of Partset module
+*/
class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule
{
Q_OBJECT
};
public:
+ /// Constructor
+ /// \param theWshop a pointer to a workshop
PartSet_Module(ModuleBase_IWorkshop* theWshop);
virtual ~PartSet_Module();
/// Called when previous operation is finished
virtual void onSelectionChanged();
- /// SLOT, that is called by mouse press in the viewer.
- /// \param theWnd - the window where the event happens
- /// \param theEvent the mouse event
- //void onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
-
- /// SLOT, that is called by mouse release in the viewer.
- /// \param theWnd - the window where the event happens
- /// \param theEvent the mouse event
- //void onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
-
- /// SLOT, that is called by mouse move in the viewer.
- /// \param theWnd - the window where the event happens
- /// \param theEvent the mouse event
- //void onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
-
- /// SLOT, that is called by mouse double click in the viewer.
- /// \param theWnd - the window where the event happens
- /// \param theEvent the mouse event
- //void onMouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
-
/// SLOT, that is called by key release in the viewer.
- /// The mouse moved point is sent to the current operation to be processed.
+ /// \param theWnd a view window
/// \param theEvent the key event
void onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
virtual void registerFilters();
private slots:
+ /// Processing of vertex selected
void onVertexSelected();
-
private:
-
/// Breaks sequense of automatically resterted operations
void breakOperationSequence();
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: PartSet_Operation.cpp
-// Created: 24 Nov 2014
-// Author: Vitaly SMETANNIKOV
-
-#include "PartSet_Operation.h"
-
-#include <ModuleBase_IWorkshop.h>
-#include <ModuleBase_ISelection.h>
-
-void PartSet_Operation::onSelectionChanged()
-{
- if (isEditOperation()) {
- ModuleBase_ISelection* aSelection = myWorkshop->selection();
- QList<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
- QList<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
- }
-}
\ No newline at end of file
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: PartSet_Operation.h
-// Created: 24 Nov 2014
-// Author: Vitaly SMETANNIKOV
-
-#ifndef PartSet_Operation_H
-#define PartSet_Operation_H
-
-#include "PartSet.h"
-
-#include <ModuleBase_Operation.h>
-
-class ModuleBase_IWorkshop;
-
-class PARTSET_EXPORT PartSet_Operation : public ModuleBase_Operation
-{
-Q_OBJECT
- public:
- PartSet_Operation(const QString& theId = "", QObject* theParent = 0)
- :ModuleBase_Operation(theId, theParent) {}
-
- void setWorkshop(ModuleBase_IWorkshop* theWorkshop) { myWorkshop = theWorkshop; }
-
-public slots:
- void onSelectionChanged();
-
-private:
- ModuleBase_IWorkshop* myWorkshop;
-};
-
-#endif
\ No newline at end of file
class QMouseEvent;
/**
+* \ingroup Modules
* A class for management of sketch operations
At the time of the sketcher operation active, only the sketch sub-feature results are
displayed in the viewer. After the sketch create/edit operation is finished, the sub-feature
double myCurX, myCurY; /// the point coordinates
};
public:
+ /// Constructor
+ /// \param theModule a pointer to PartSet module
PartSet_SketcherMgr(PartSet_Module* theModule);
virtual ~PartSet_SketcherMgr();
+ /// Returns list of strings which contains id's of sketch operations
static QStringList sketchOperationIdList();
/// Launches the operation from current highlighting
void launchEditing();
- // Returns current Sketch feature/ Returns NULL if there is no launched sketch operation
+ /// Returns current Sketch feature/ Returns NULL if there is no launched sketch operation
CompositeFeaturePtr activeSketch() const { return myCurrentSketch; }
/// Starts sketch operation
- void startSketch(ModuleBase_Operation* theOperation);
+ void startSketch(ModuleBase_Operation* );
/// Stops sketch operation
- void stopSketch(ModuleBase_Operation* theOperation);
+ void stopSketch(ModuleBase_Operation* );
public slots:
+ /// Process sketch plane selected event
void onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
class GeomAPI_Vertex;
/*!
- \class PartSet_Tools
+ * \class PartSet_Tools
+ * \ingroup Modules
* \brief The operation for the sketch feature creation
*/
class PARTSET_EXPORT PartSet_Tools
/// Converts the 2D screen point to the 3D point on the view according to the point of view
/// \param thePoint a screen point
/// \param theView a 3D view
- // Transferred to ModuleBase
static gp_Pnt convertClickToPoint(QPoint thePoint, Handle_V3d_View theView);
/// \brief Converts the 3D point to the projected coodinates on the sketch plane.
/// \param thePoint the 3D point in the viewer
/// \param theSketch the sketch feature
+ /// \param theView a view 3d object
/// \param theX the X coordinate
/// \param theY the Y coordinate
static void convertTo2D(const gp_Pnt& thePoint, FeaturePtr theSketch,
/// \param theX the X coordinate
/// \param theY the Y coordinate
/// \param theSketch the sketch feature
- /// \param thePoint the 3D point in the viewer
static std::shared_ptr<GeomAPI_Pnt> convertTo3D(const double theX, const double theY, FeaturePtr theSketch);
/// Returns an object that is under the mouse point. Firstly it checks the highlighting,
/// Returns pointer to the root document.
static std::shared_ptr<ModelAPI_Document> document();
-
+ /// Find an attribute which corresponds to a given pont coordinates
+ /// \param theSketch the sketch feature
+ /// \param theX X coordinate
+ /// \param theY Y coordinate
+ /// \param theTolerance tolerance
+ /// \param theIgnore list of features which has to be ignored
static std::shared_ptr<GeomDataAPI_Point2D> findAttributePoint(CompositeFeaturePtr theSketch,
double theX, double theY, double theTolerance, const QList<FeaturePtr>& theIgnore = QList<FeaturePtr>());
/// \brief Save the double to the feature. If the attribute is double, it is filled.
/// \param theFeature the feature
- /// \param theValue the horizontal coordinate
+ /// \param theX the horizontal coordinate
/// \param theAttribute the feature attribute
static void setFeatureValue(FeaturePtr theFeature, double theX, const std::string& theAttribute);
const std::string& theKind);
/// Creates a constraint on two points
+ /// \param theSketch a sketch feature
/// \param thePoint1 the first point
- /// \param thePoint1 the second point
+ /// \param thePoint2 the second point
static void createConstraint(CompositeFeaturePtr theSketch,
std::shared_ptr<GeomDataAPI_Point2D> thePoint1,
std::shared_ptr<GeomDataAPI_Point2D> thePoint2);
/// Creates a line (arc or circle) by given edge
/// Created line will have fixed constraint
- /// \param theEdge - an edge
- /// \return - result of created feature
+ /// \param theShape an edge
+ /// \param theObject a selected result object
+ /// \param theSketch a sketch feature
+ /// \return result of created feature
static ResultPtr createFixedObjectByEdge(const TopoDS_Shape& theShape,
const ObjectPtr& theObject,
CompositeFeaturePtr theSketch);
* Selector validators
*/
+//! \ingroup Validators
//! A class to validate a selection for Distance constraint operation
class PartSet_DistanceValidator : public ModuleBase_SelectionValidator
{
PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
};
+//! \ingroup Validators
//! A class to validate a selection for Length constraint operation
class PartSet_LengthValidator : public ModuleBase_SelectionValidator
{
PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
};
+//! \ingroup Validators
//! A class to validate a selection for Perpendicular constraint operation
class PartSet_PerpendicularValidator : public ModuleBase_SelectionValidator
{
PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
};
+//! \ingroup Validators
//! A class to validate a selection for Perpendicular constraint operation
class PartSet_ParallelValidator : public ModuleBase_SelectionValidator
{
PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
};
+//! \ingroup Validators
//! A class to validate a selection for Perpendicular constraint operation
class PartSet_RadiusValidator : public ModuleBase_SelectionValidator
{
PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
};
+//! \ingroup Validators
//! A class to validate a selection for Perpendicular constraint operation
class PartSet_RigidValidator : public ModuleBase_SelectionValidator
{
PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
};
+/**
+* \ingroup Validators
+* A validator which checks that objects selected for feature attributes are different (not the same)
+*/
class PartSet_DifferentObjectsValidator : public ModelAPI_RefAttrValidator
{
public:
+ /// Returns True if the feature is valid
+ /// \param theFeature a feature to check
+ /// \param theArguments a list of arguments (names of attributes to check)
+ /// \param theObject a selected object
virtual bool isValid(const FeaturePtr& theFeature, const std::list<std::string>& theArguments,
const ObjectPtr& theObject) const;
+
//! Returns true if the attribute is good for the feature attribute
+ //! \param theFeature a feature to check
+ //! \param theArguments a list of arguments (names of attributes to check)
+ //! \param theAttribute an attribute
virtual bool isValid(const FeaturePtr& theFeature, const std::list<std::string>& theArguments,
const AttributePtr& theAttribute) const;
+ //! Returns true if the attribute is good for the feature attribute
+ //! \param theAttribute an attribute
+ //! \param theArguments a list of arguments (names of attributes to check)
virtual bool isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments) const;
};
/**
-* aValidator which validates tha selected object is a Sketch
+* \ingroup Validators
+* A Validator which validates tha selected object is a Sketch
*/
class PartSet_SketchValidator : public ModelAPI_ResultValidator
{
public:
+ /// Returns True if the given object is a sketch
+ /// \param theObject an object
virtual bool isValid(const ObjectPtr theObject) const;
};
class QMouseEvent;
/**\class PartSet_WidgetPoint2D
- * \ingroup GUI
- * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls
+ * \ingroup Modules
+ * \brief Implementation of model widget to provide widget to input point 2d
+ * In XML can be defined as folloung:
+ * \code
+ * <sketch-2dpoint_selector id="CircleCenter" title="Center" tooltip="Center coordinates"/>
+ * \endcode
*/
class PARTSET_EXPORT PartSet_WidgetPoint2D : public ModuleBase_ModelWidget
{
Q_OBJECT
public:
/// Constructor
- /// \theParent the parent object
- /// \theParent the parent object
- /// \theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParent the parent object
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
PartSet_WidgetPoint2D(QWidget* theParent, const Config_WidgetAPI* theData,
const std::string& theParentId);
/// Destructor
/// \param theValue the wrapped widget value
virtual bool setSelection(ModuleBase_ViewerPrs theValue);
- /// Saves the internal parameters to the given feature
- /// \param theObject a model feature to be changed
virtual bool storeValue() const;
virtual bool restoreValue();
/// The methiod called when widget is deactivated
virtual void deactivate();
+ /// Return workshop
XGUI_Workshop* workshop() const { return myWorkshop; }
+ /// Set workshop
void setWorkshop(XGUI_Workshop* theWork) { myWorkshop = theWork; }
/// \returns the sketch instance
CompositeFeaturePtr sketch() const { return mySketch; }
+
+ /// Set sketch instance
void setSketch(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
/// Fill the widget values by given point
- /// \param thePoint the point
+ /// \param theX the X coordinate
+ /// \param theY the Y coordinate
void setPoint(double theX, double theY);
/// Returns coordinate X currently defined in the control
signals:
/// Signal about selection of an existing vertex from an object
- /// \param theObject - the selected object
- /// \param theShape - the selected shape
void vertexSelected();
protected slots:
+ /// Process mouse release event
+ /// \param theWnd a view window
+ /// \param theEvent a mouse event
void onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
+
+ /// Process mouse move event
+ /// \param theWnd a view window
+ /// \param theEvent a mouse event
void onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
private slots:
+ /// Process value changed event
void onValuesChanged();
private:
+ /// Returns point 2d from selected vertex
+ /// \param theView a view window
+ /// \param theShape a vertex shape
+ /// \param theX an output value of X coordinate
+ /// \param theY an output value of Y coordinate
bool getPoint2d(const Handle(V3d_View)& theView, const TopoDS_Shape& theShape,
double& theX, double& theY) const;
class ModuleBase_IViewWindow;
class QMouseEvent;
+/**
+* \ingroup Modules
+* Implementation of model widget for widget which provides input of a distance between two points
+* In XML file can be defined as following:
+* \code
+* <point2ddistance id="CircleRadius"
+* first_point="CircleCenter"
+* label="Radius:"
+* min="0"
+* step="1.0"
+* default="0"
+* icon=":icons/radius.png"
+* tooltip="Set radius">
+* <validator id="GeomValidators_Positive"/>
+* </point2ddistance>
+* \endcode
+*/
class PARTSET_EXPORT PartSet_WidgetPoint2dDistance : public ModuleBase_WidgetDoubleValue
{
Q_OBJECT
public:
/// Constructor
- /// \theParent the parent object
- /// \theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParent the parent object
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
PartSet_WidgetPoint2dDistance(QWidget* theParent, const Config_WidgetAPI* theData,
const std::string& theParentId);
/// The methiod called when widget is deactivated
virtual void deactivate();
- /// Set the given wrapped value to the current widget
- /// This value should be processed in the widget according to the needs
- /// \param theValue the wrapped widget value
- //virtual bool setValue(ModuleBase_WidgetValue* theValue);
-
+ /// Returns workshop
XGUI_Workshop* workshop() const { return myWorkshop; }
+ /// Set workshop
+ /// \param theWork a pointer to workshop
void setWorkshop(XGUI_Workshop* theWork) { myWorkshop = theWork; }
/// \returns the sketch instance
CompositeFeaturePtr sketch() const { return mySketch; }
+
+ /// Set sketch instance
void setSketch(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
protected slots:
+ /// Process of mouse release
+ /// \param theWnd a pointer to a window
+ /// \param theEvent a mouse event
void onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
+
+ /// Process of mouse move
+ /// \param theWnd a pointer to a window
+ /// \param theEvent a mouse event
void onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
protected:
void setPoint(FeaturePtr theFeature, const std::shared_ptr<GeomAPI_Pnt2d>& thePnt);
private slots:
+ /// Process values changed event
void onValuesChanged();
private:
#include <ModelAPI_CompositeFeature.h>
+
+/**
+* \ingroup Modules
+* Customosation of ModuleBase_WidgetShapeSelector in order to provide
+* working with sketch specific objects.
+*/
class PARTSET_EXPORT PartSet_WidgetShapeSelector: public ModuleBase_WidgetShapeSelector
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theWorkshop instance of workshop interface
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
PartSet_WidgetShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData, const std::string& theParentId)
: ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData, theParentId) {}
virtual ~PartSet_WidgetShapeSelector() {}
- /// Saves the internal parameters to the given feature
virtual bool storeValue() const;
+ /// Set sketcher
+ /// \param theSketch a sketcher object
void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
+
+ /// Retrurns installed sketcher
CompositeFeaturePtr sketch() const { return mySketch; }
protected:
virtual bool isValid(ObjectPtr theObj, std::shared_ptr<GeomAPI_Shape> theShape);
private:
+ /// Pointer to a sketch
CompositeFeaturePtr mySketch;
};
-
+/**
+* \ingroup Modules
+* Customosation of ModuleBase_WidgetShapeSelector in order to provide
+* working with constraints.
+*/
class PARTSET_EXPORT PartSet_WidgetConstraintShapeSelector: public ModuleBase_WidgetShapeSelector
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theWorkshop instance of workshop interface
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
PartSet_WidgetConstraintShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData, const std::string& theParentId)
: ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData, theParentId) {}
/// Saves the internal parameters to the given feature
virtual bool storeValue() const;
+ /// Set sketcher
+ /// \param theSketch a sketcher object
void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
+
+ /// Retrurns installed sketcher
CompositeFeaturePtr sketch() const { return mySketch; }
private:
+ /// Pointer to a sketch
CompositeFeaturePtr mySketch;
};
class XGUI_OperationMgr;
class XGUI_Workshop;
+/**
+* \ingroup Modules
+* A model widget implementation for a label which provides specific behaviour
+* for sketcher starting and launching operations
+*/
class PARTSET_EXPORT PartSet_WidgetSketchLabel : public ModuleBase_ModelWidget
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
PartSet_WidgetSketchLabel(QWidget* theParent, const Config_WidgetAPI* theData,
const std::string& theParentId);
virtual ~PartSet_WidgetSketchLabel();
- /// Saves the internal parameters to the given feature
- /// \param theFeature a model feature to be changed
virtual bool storeValue() const
{
return true;
/// The methiod called when widget is deactivated
virtual void deactivate();
+ /// Returns pointer to workshop
XGUI_Workshop* workshop() const { return myWorkshop; }
+ /// Set pointer to workshop
+ /// \param theWork a pointer to workshop
void setWorkshop(XGUI_Workshop* theWork) { myWorkshop = theWork; }
+ /// Returns sketcher plane
std::shared_ptr<GeomAPI_Pln> plane() const;
signals:
+ /// Signal on plane selection
void planeSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
private slots:
+ /// Slot on plane selection
void onPlaneSelected();
+
+ /// Set sketch specific mode of selection
void setSketchingMode();
private:
+ /// Create preview of planes for sketch plane selection
+ /// \param theOrigin an origin of the plane
+ /// \param theNorm a normal vector of the plane
+ /// \param theRGB a color of plane presentation [r, g, b] array
AISObjectPtr createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
std::shared_ptr<GeomAPI_Dir> theNorm,
const int theRGB[3]);
+ /// Set sketch plane by shape
+ /// \param theShape a planar face
std::shared_ptr<GeomAPI_Dir> setSketchPlane(const TopoDS_Shape& theShape);
+ /// Erase preview planes
void erasePreviewPlanes();
+
+ /// Show preview planes
void showPreviewPlanes();
class QMenu;
/**
+ * \ingroup GUI
* A claas wihich provides manement of context menu
*/
class XGUI_EXPORT XGUI_ContextMenuMgr : public QObject
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent a parent object
XGUI_ContextMenuMgr(XGUI_Workshop* theParent);
virtual ~XGUI_ContextMenuMgr();
void createActions();
/// Returns action according to the given ID
+ /// \param theId an id of an action
QAction* action(const QString& theId) const;
/// Returns list of registered actions Ids
void connectViewer() const;
/// Add menu atems for viewer into the given menu (used in SALOME mode)
+ /// \param theMenu a menu instance
void addViewerItems(QMenu* theMenu) const;
signals:
+ /// Signal aabout triggered action
+ /// \param theId an id of triggered action
+ /// \param isChecked is checked flag
void actionTriggered(const QString& theId, bool isChecked);
private slots:
+ /// Process action event
+ /// \param isChecked a checked action flag
void onAction(bool isChecked);
+ /// Process context menu event
+ /// \param theEvent a context menu event
void onContextMenuRequest(QContextMenuEvent* theEvent);
private:
*/
void addAction(const QString& theId, QAction* theAction);
+ /// Creates menu for object browser
QMenu* objectBrowserMenu() const;
+
+ /// Creates menu for viewer
QMenu* viewerMenu() const;
+ /// Map of created actions [id : Action]
QMap<QString, QAction*> myActions;
+ /// Reference to workshop
XGUI_Workshop* myWorkshop;
};
class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel
{
public:
+ /// Constructor
+ /// \param theParent a parent object
XGUI_FeaturesModel(QObject* theParent)
: QAbstractItemModel(theParent),
myItemsColor(Qt::black)
//! Returns Feature object by the given Model index.
//! Returns 0 if the given index is not index of a feature
+ /// \param theIndex a model index
virtual ObjectPtr object(const QModelIndex& theIndex) const = 0;
//! Returns QModelIndex which corresponds to the given feature
virtual QModelIndex findParent(const ObjectPtr& theObject) const = 0;
//! Returns index corresponded to the group
+ //! \param theGroup a group name
virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
+ //! Set color of items
void setItemsColor(const QColor& theColor)
{
myItemsColor = theColor;
}
+ //! Returns color of items
QColor itemsColor() const
{
return myItemsColor;
}
protected:
+ /// Color of items
QColor myItemsColor;
};
class XGUI_PartModel : public XGUI_FeaturesModel
{
public:
+ /// Constructor
+ /// \param theParent a parent object
XGUI_PartModel(QObject* theParent)
: XGUI_FeaturesModel(theParent)
{
}
+ /// Set part id
+ /// \param theId a new id
void setPartId(int theId)
{
myId = theId;
}
//! Returns true if the given document is a sub-document of this tree
+ //! \param theDoc a document to check
virtual bool hasDocument(const DocumentPtr& theDoc) const = 0;
//! Return a Part object
{
Q_OBJECT
public:
-
+ /// Constructor
+ /// \param theParent a parent object
XGUI_DocumentDataModel(QObject* theParent);
virtual ~XGUI_DocumentDataModel();
- // Event Listener method
+ /// Event Listener method
+ /// \param theMessage an event message
virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
+ /// Returns the data stored under the given role for the item referred to by the index.
+ /// \param theIndex a model index
+ /// \param theRole a data role (see Qt::ItemDataRole)
virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
+
+ /// Returns the data for the given role and section in the header with the specified orientation.
+ /// \param theSection a section
+ /// \param theOrient an orientation
+ /// \param theRole a data role (see Qt::ItemDataRole)
virtual QVariant headerData(int theSection, Qt::Orientation theOrient, int theRole =
Qt::DisplayRole) const;
+ /// Returns the number of rows under the given parent. When the parent is valid it means that
+ /// rowCount is returning the number of children of parent.
+ /// \param theParent a parent model index
virtual int rowCount(const QModelIndex& theParent = QModelIndex()) const;
+
+ /// Returns the number of columns for the children of the given parent.
+ /// It has a one column
+ /// \param theParent a parent model index
virtual int columnCount(const QModelIndex& theParent = QModelIndex()) const;
- virtual QModelIndex index(int theRow, int theColumn, const QModelIndex &parent =
+ /// Returns the index of the item in the model specified by the given row, column and parent index.
+ /// \param theRow a row
+ /// \param theColumn a column
+ /// \param theParent a parent model index
+ virtual QModelIndex index(int theRow, int theColumn, const QModelIndex &theParent =
QModelIndex()) const;
+ /// Returns the parent of the model item with the given index.
+ /// If the item has no parent, an invalid QModelIndex is returned.
+ /// \param theIndex a model index
virtual QModelIndex parent(const QModelIndex& theIndex) const;
+ /// Returns true if parent has any children; otherwise returns false.
+ /// \param theParent a parent model index
virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
+ /// Inserts count rows into the model before the given row.
+ /// Items in the new row will be children of the item represented by the parent model index.
+ /// \param theRow a start row
+ /// \param theCount a nember of rows to insert
+ /// \param theParent a parent model index
bool insertRows(int theRow, int theCount, const QModelIndex& theParent = QModelIndex());
+ /// Removes count rows starting with the given row under parent parent from the model.
+ /// \param theRow a start row
+ /// \param theCount a nember of rows to remove
+ /// \param theParent a parent model index
bool removeRows(int theRow, int theCount, const QModelIndex& theParent = QModelIndex());
+ /// Returns the item flags for the given index.
+ /// \param theIndex a model index
Qt::ItemFlags flags(const QModelIndex& theIndex) const;
//! Returns an object by the given Model index.
//! Returns 0 if the given index is not index of an object
ObjectPtr object(const QModelIndex& theIndex) const;
+ //! Returns index of the object
+ //! \param theObject object to find
QModelIndex objectIndex(const ObjectPtr theObject) const;
//! Returns QModelIndex which corresponds to the given part
//! If the object is not found then index is not valid
+ //! \param thePart a part for analysis
QModelIndex partIndex(const ResultPartPtr& thePart) const;
//! Activates a part data model if the index is a Part node index.
//! Returns true if active part changed.
+ //! \param theIndex a model index
bool activatedIndex(const QModelIndex& theIndex);
//! Retrurns active part
//! Deactivates a Part
void deactivatePart();
+ //! Rebuild data tree
void rebuildDataTree();
//! Clear internal data
class QTextEdit;
/**
+* \ingroup GUI
* A class of dialog to show error message
*/
class XGUI_ErrorDialog : public QDialog
class XGUI_Displayer;
/**
+ * \ingroup GUI
* Implementation of IWorkshop interface which provides access to Workshop sevices at module level
*/
class XGUI_EXPORT XGUI_ModuleConnector : public ModuleBase_IWorkshop
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theWorkshop a workshop
XGUI_ModuleConnector(XGUI_Workshop* theWorkshop);
virtual ~XGUI_ModuleConnector();
//! If the list is empty then selection will be cleared
virtual void setSelected(const QObjectPtrList& theFeatures);
+ //! Returns workshop
XGUI_Workshop* workshop() const { return myWorkshop; }
private:
+ /// Reference to workshop
XGUI_Workshop* myWorkshop;
/// A filter which provides selection within a current document or whole PartSet
/// else, or if there is no parent - returns NULL
ModuleBase_Operation* previousOperation(ModuleBase_Operation* theOperation) const;
+ /// Redefinition of virtual function
virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
/// Start the operation and append it to the stack of operations
/// \return the state whether the current operation is started
bool startOperation(ModuleBase_Operation* theOperation);
+ /// Abort all operations
bool abortAllOperations();
/// Returns whether the operation can be started. Check if there is already started operation and
/// Commits the current operatin if it is valid
bool commitOperation();
+
/// Sets the current operation or NULL
/// \param theOperation the started operation
- /// \param isCheckBeforeStart the flag whether to check whether the operation can be started
- /// \return the state whether the operation is resumed
void resumeOperation(ModuleBase_Operation* theOperation);
public slots:
/// SLOT, that is called by the key in the property panel is clicked.
- /// \param theName the attribute name
/// \param theEvent the mouse event
bool onKeyReleased(QKeyEvent* theEvent);
/// Slot that is called by an operation stop. Removes the stopped operation form the stack.
/// If there is a suspended operation, restart it.
void onOperationStopped();
+
+ /// Slot called on operation start
void onOperationStarted();
+
+ /// Slot called on operation abort
void onOperationAborted();
+
+ /// Slot called on operation commit
void onOperationCommitted();
+
+ /// Slot called on operation resume
void onOperationResumed();
private:
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent a parent object
XGUI_TopDataModel(QObject* theParent);
virtual ~XGUI_TopDataModel();
// Reimpl from QAbstractItemModel
+
+ /// Returns the data stored under the given role for the item referred to by the index.
+ /// \param theIndex a model index
+ /// \param theRole a data role (see Qt::ItemDataRole)
virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
- virtual QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ /// Returns the data for the given role and section in the header with the specified orientation.
+ /// \param theSection a section
+ /// \param theOrient an orientation
+ /// \param theRole a data role (see Qt::ItemDataRole)
+ virtual QVariant headerData(int theSection, Qt::Orientation theOrient,
+ int theRole = Qt::DisplayRole) const;
+
+ /// Returns the number of rows under the given parent. When the parent is valid it means that
+ /// rowCount is returning the number of children of parent.
+ /// \param theParent a parent model index
+ virtual int rowCount(const QModelIndex &theParent = QModelIndex()) const;
+
+ /// Returns the number of columns for the children of the given parent.
+ /// It has a one column
+ /// \param theParent a parent model index
+ virtual int columnCount(const QModelIndex &theParent = QModelIndex()) const;
+
+ /// Returns the index of the item in the model specified by the given row, column and parent index.
+ /// \param theRow a row
+ /// \param theColumn a column
+ /// \param theParent a parent model index
virtual QModelIndex index(int theRow, int theColumn, const QModelIndex& theParent =
QModelIndex()) const;
+ /// Returns the parent of the model item with the given index.
+ /// If the item has no parent, an invalid QModelIndex is returned.
+ /// \param theIndex a model index
virtual QModelIndex parent(const QModelIndex& theIndex) const;
+ /// Returns true if parent has any children; otherwise returns false.
+ /// \param theParent a parent model index
virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
//! Returns object by the given Model index.
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent a parent object
XGUI_PartDataModel(QObject* theParent);
virtual ~XGUI_PartDataModel();
// Reimpl from QAbstractItemModel
- virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
- virtual QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ /// Returns the data stored under the given role for the item referred to by the index.
+ /// \param theIndex a model index
+ /// \param theRole a data role (see Qt::ItemDataRole)
+ virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
+ /// Returns the data for the given role and section in the header with the specified orientation.
+ /// \param theSection a section
+ /// \param theOrient an orientation
+ /// \param theRole a data role (see Qt::ItemDataRole)
+ virtual QVariant headerData(int theSection, Qt::Orientation theOrient,
+ int theRole = Qt::DisplayRole) const;
+
+ /// Returns the number of rows under the given parent. When the parent is valid it means that
+ /// rowCount is returning the number of children of parent.
+ /// \param theParent a parent model index
+ virtual int rowCount(const QModelIndex &theParent = QModelIndex()) const;
+
+ /// Returns the number of columns for the children of the given parent.
+ /// It has a one column
+ /// \param theParent a parent model index
+ virtual int columnCount(const QModelIndex &theParent = QModelIndex()) const;
+
+ /// Returns the index of the item in the model specified by the given row, column and parent index.
+ /// \param theRow a row
+ /// \param theColumn a column
+ /// \param theParent a parent model index
virtual QModelIndex index(int theRow, int theColumn, const QModelIndex& theParent =
QModelIndex()) const;
+ /// Returns the parent of the model item with the given index.
+ /// If the item has no parent, an invalid QModelIndex is returned.
+ /// \param theIndex a model index
virtual QModelIndex parent(const QModelIndex& theIndex) const;
+ /// Returns true if parent has any children; otherwise returns false.
+ /// \param theParent a parent model index
virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
//! Returns object by the given Model index.
//! Returns document of the current part
DocumentPtr partDocument() const;
+ //! Returns defult number of rows
int getRowsNumber() const;
//! Types of QModelIndexes
const static char* PROP_PANEL_CANCEL = "property_panel_cancel";
/**
+* \ingroup GUI
* Realization of Property panel object.
*/
class XGUI_EXPORT XGUI_PropertyPanel : public ModuleBase_IPropertyPanel
#include <QString>
/**
+* \ingroup GUI
* Class of event to send application events in multi thread environment
*/
class XGUI_EXPORT PostponeMessageQtEvent : public QEvent
{
public:
+ /// An event type
static QEvent::Type PostponeMessageQtEventType;
/// Constructor
class ModuleBase_IViewer;
/**
+ * \ingroup GUI
* An interface which provides a connection of XGUI functionality
* with functionality of SALOME module interface.
*/
//! Returns interface to Salome viewer
virtual ModuleBase_IViewer* viewer() const = 0;
+ //! Create preferences
virtual void createPreferences() = 0;
};
class XGUI_Workshop;
/**
+* \ingroup GUI
* Implementation of \ref ModuleBase_ISelection interface.
*/
class XGUI_EXPORT XGUI_Selection : public ModuleBase_ISelection
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent a parent workshop
XGUI_SelectionMgr(XGUI_Workshop* theParent);
virtual ~XGUI_SelectionMgr();
+ /// Returns current selection
XGUI_Selection* selection() const
{
return mySelection;
void selectionChanged();
private slots:
+ /// Reaction on selectio0n in Object browser
void onObjectBrowserSelection();
+
+ /// Reaction on selectio0n in Viewer
void onViewerSelection();
private:
+ /// Reference to workshop
XGUI_Workshop* myWorkshop;
+
+ /// Current selection object
XGUI_Selection* mySelection;
};
#include <memory>
/*!
+ \ingroup GUI
\brief Return directory part of the file path.
If the file path does not include directory part (the file is in the
\return directory part of the file path
*/
namespace XGUI_Tools {
+
+/**
+* Returns directory name from name of file
+* \param path a path to a file
+* \param isAbs is absolute or relative path
+*/
QString XGUI_EXPORT dir(const QString& path, bool isAbs = true);
/*!
class AppElements_ViewWindow;
/**
+ * \ingroup GUI
* Proxy class which repersents or AppElements_Viewer or Salome Viewer
* dependently on current launching environment.
* It is reccomennded to use this class in operation for accessing to viewer
{
Q_OBJECT
public:
+ /// Constructor
+ /// \param theParent a parent object
XGUI_ViewerProxy(XGUI_Workshop* theParent);
//! Returns AIS_InteractiveContext from current OCCViewer
connect(myPropertyPanel, SIGNAL(noMoreWidgets()), myModule, SLOT(onNoMoreWidgets()));
aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
- hidePropertyPanel(); //<! Invisible by default
+ hidePropertyPanel(); ///<! Invisible by default
hideObjectBrowser();
aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel);
myPropertyPanel->installEventFilter(myOperationMgr);
void XGUI_Workshop::showPropertyPanel()
{
QAction* aViewAct = myPropertyPanel->toggleViewAction();
- //<! Restore ability to close panel from the window's menu
+ ///<! Restore ability to close panel from the window's menu
aViewAct->setEnabled(true);
myPropertyPanel->show();
myPropertyPanel->raise();
void XGUI_Workshop::hidePropertyPanel()
{
QAction* aViewAct = myPropertyPanel->toggleViewAction();
- //<! Do not allow to show empty property panel
+ ///<! Do not allow to show empty property panel
aViewAct->setEnabled(false);
myPropertyPanel->hide();
}
}
//**************************************************************
-void XGUI_Workshop::activateLastPart()
-{
- SessionPtr aMgr = ModelAPI_Session::get();
- DocumentPtr aDoc = aMgr->moduleDocument();
- std::string aGrpName = ModelAPI_ResultPart::group();
- ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
- ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
- if (aPart) {
- activatePart(aPart);
- }
-}
+//void XGUI_Workshop::activateLastPart()
+//{
+// SessionPtr aMgr = ModelAPI_Session::get();
+// DocumentPtr aDoc = aMgr->moduleDocument();
+// std::string aGrpName = ModelAPI_ResultPart::group();
+// ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
+// ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
+// if (aPart) {
+// activatePart(aPart);
+// }
+//}
//**************************************************************
void XGUI_Workshop::deleteObjects(const QObjectPtrList& theList)
{
Q_OBJECT
public:
-
+ /// Constructor
+ /// \param theConnector a Salome connector object.
+ /// Used only if the workshop is launched in Salome environment
XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
virtual ~XGUI_Workshop();
return myObjectBrowser;
}
+ /// This method is called by Salome module when selection is changed
void salomeViewerSelectionChanged();
+ /// Returns viewer which unifies access as to Salome viewer as to standalone viewer
XGUI_ViewerProxy* viewer() const
{
return myViewerProxy;
//! Show the given features in 3d Viewer
void showOnlyObjects(const QObjectPtrList& theList);
+ /// Set display mode for the given onjects
+ /// \param theList a list of displayed objects
+ /// \param theMode a mode to set (see \ref XGUI_Displayer)
void setDisplayMode(const QObjectPtrList& theList, int theMode);
+ /// Returns current module
ModuleBase_IModule* module() const
{
return myModule;
*/
void saveDocument(const QString& theName, std::list<std::string>& theFileNames);
- /*
+ /**
* If there is an active (uncommited) operation shows a prompt to abort it
* and performs abortion if user agreed. Returns true if
* - operation aborted successfully
bool isActiveOperationAborted();
signals:
+ /// Emitted when selection happens in Salome viewer
void salomeViewerSelection();
+
+ /// Emitted when error in applivation happens
void errorOccurred(const QString&);
+
//! the signal about the workshop actions states are updated.
void commandStatusUpdated();
void applicationStarted();
public slots:
+ /// Update of commands status
void updateCommandStatus();
+ /// Create a new dokument
void onNew();
+
+ /// Open document from file
void onOpen();
+
+ /// Save current document
bool onSave();
+
+ /// Save current document to a file selected by user
bool onSaveAs();
+
+ /// Exit application
void onExit();
+
+ /// Undo last command
void onUndo();
+
+ /// Redo previous command
void onRedo();
+
+ /// Rebuild data tree
void onRebuild();
+
+ /// Open preferences dialog box
void onPreferences();
+ /// Show property panel
void showPropertyPanel();
+
+ /// Hide property panel
void hidePropertyPanel();
+
+ /// Show object Browser
void showObjectBrowser();
+
+ /// Hide object Browser
void hideObjectBrowser();
+ /// Reaction on command call
void onFeatureTriggered();
+
+ /// Change active document
+ /// \param theObj a part object. If it is NULL then active document is a main document
void changeCurrentDocument(ObjectPtr theObj);
- void activateLastPart();
+ //void activateLastPart();
+ /// Close document
void closeDocument();
protected:
- // Find the nested features and set them into the operation
- // \param theOperation an operation
+ /// Find the nested features and set them into the operation
+ /// \param theOperation an operation
void setNestedFeatures(ModuleBase_Operation* theOperation);
- // Update the property panel content by the XML description of the operation and set the panel
- // into the operation
- // \param theOperation an operation
+
+ /// Update the property panel content by the XML description of the operation and set the panel
+ /// into the operation
+ /// \param theOperation an operation
void setPropertyPanel(ModuleBase_Operation* theOperation);
+ /// Procedure to process postponed events
bool event(QEvent * theEvent);
+
//Event-loop processing methods:
+
+ /// Process event "Add a feature"
void addFeature(const std::shared_ptr<Config_FeatureMessage>&);
+
+ /// Connect to operation signals
+ /// \param theOperation an operation
void connectWithOperation(ModuleBase_Operation* theOperation);
- void onFeatureUpdatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
- void onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
- void onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
- void onObjectDeletedMsg(const std::shared_ptr<ModelAPI_ObjectDeletedMessage>& theMsg);
+ /// Process feature update message
+ void onFeatureUpdatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
- void validateOperation(const QString& theOperationId);
+ ///Process feature created message
+ void onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
+ /// Process feature redisplay message
+ void onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
+
+ /// Process feature delete message
+ void onObjectDeletedMsg(const std::shared_ptr<ModelAPI_ObjectDeletedMessage>& );
+
+ /// Display all results
void displayAllResults();
+
+ /// Displau results from document
+ /// \param theDoc a document
void displayDocumentResults(DocumentPtr theDoc);
+
+ /// Display results from a group
void displayGroupResults(DocumentPtr theDoc, std::string theGroup);
private slots:
/// \param theOpertion an aborted operation
void onOperationAborted(ModuleBase_Operation* theOperation);
+ /// Process context menu command
+ /// \param theId id of the command
+ /// \param isChecked is checked flag
void onContextMenuCommand(const QString& theId, bool isChecked);
+ /// Processing of values changed in model widget
void onWidgetValuesChanged();
+ /// Set waiting cursor
void onStartWaiting();
private:
+ /// Init menu
void initMenu();
+ /// Register validators
void registerValidators() const;
+ /// Load module from external library
+ /// \param theModule name of the module
ModuleBase_IModule* loadModule(const QString& theModule);
+
+ /// Activate module
bool activateModule();
+ /// Create object browser widget
+ /// \param theParent a parent of widget
QDockWidget* createObjectBrowser(QWidget* theParent);
+
+ /// Create property panel widget
+ /// \param theParent a parent of widget
QDockWidget* createPropertyPanel(QWidget* theParent);
// Creates Dock widgets: Object browser and Property panel