SHAPER  9.12.0
ModelAPI_Data Class Referenceabstract

General object of the application that allows to get/set attributes from the document and compute result of an operation. More...

Inheritance diagram for ModelAPI_Data:
Inheritance graph

Public Member Functions

virtual std::wstring name ()=0
 Returns the name of the feature visible by the user in the object browser. More...
 
virtual void setName (const std::wstring &theName)=0
 Defines the name of the feature visible by the user in the object browser. More...
 
virtual bool hasUserDefinedName () const =0
 Return true if the object has been renamed by the user. More...
 
virtual std::string version ()=0
 Returns version of the feature (empty string if not applicable) More...
 
virtual void setVersion (const std::string &theVersion)=0
 Initialize the version of the feature. More...
 
virtual std::shared_ptr< ModelAPI_AttributeDocRefdocument (const std::string &theID)=0
 Returns the attribute that references to another document. More...
 
virtual std::shared_ptr< ModelAPI_AttributeDoublereal (const std::string &theID)=0
 Returns the attribute that contains real value with double precision. More...
 
virtual std::shared_ptr< ModelAPI_AttributeDoubleArrayrealArray (const std::string &theID)=0
 Returns the attribute that contains double values array. More...
 
virtual std::shared_ptr< ModelAPI_AttributeIntegerinteger (const std::string &theID)=0
 Returns the attribute that contains integer value. More...
 
virtual std::shared_ptr< ModelAPI_AttributeReferencereference (const std::string &theID)=0
 Returns the attribute that contains reference to a feature. More...
 
virtual std::shared_ptr< ModelAPI_AttributeSelectionselection (const std::string &theID)=0
 Returns the attribute that contains selection to a shape. More...
 
virtual std::shared_ptr< ModelAPI_AttributeSelectionListselectionList (const std::string &theID)=0
 Returns the attribute that contains selection to a shape. More...
 
virtual std::shared_ptr< ModelAPI_AttributeRefAttrrefattr (const std::string &theID)=0
 Returns the attribute that contains reference to an attribute of a feature. More...
 
virtual std::shared_ptr< ModelAPI_AttributeRefListreflist (const std::string &theID)=0
 Returns the attribute that contains list of references to features. More...
 
virtual std::shared_ptr< ModelAPI_AttributeRefAttrListrefattrlist (const std::string &theID)=0
 Returns the attribute that contains list of references to features or reference to an attribute of a feature. More...
 
virtual std::shared_ptr< ModelAPI_AttributeBooleanboolean (const std::string &theID)=0
 Returns the attribute that contains boolean value. More...
 
virtual std::shared_ptr< ModelAPI_AttributeStringstring (const std::string &theID)=0
 Returns the attribute that contains boolean value. More...
 
virtual std::shared_ptr< ModelAPI_AttributeIntArrayintArray (const std::string &theID)=0
 Returns the attribute that contains integer values array. More...
 
virtual std::shared_ptr< ModelAPI_AttributeStringArraystringArray (const std::string &theID)=0
 Returns the attribute that contains string values array. More...
 
virtual std::shared_ptr< ModelAPI_AttributeImageimage (const std::string &theID)=0
 Returns the attribute that contains image. More...
 
virtual std::shared_ptr< ModelAPI_AttributeTablestables (const std::string &theID)=0
 Returns the attribute that contains tables. More...
 
virtual std::shared_ptr< ModelAPI_Attributeattribute (const std::string &theID)=0
 Returns the generic attribute by identifier. More...
 
virtual std::list< std::shared_ptr< ModelAPI_Attribute > > attributes (const std::string &theType)=0
 Returns all attributes of the feature of the given type or all attributes if "theType" is empty. More...
 
virtual std::list< std::string > attributesIDs (const std::string &theType)=0
 Returns all attributes ids of the feature of the given type or all attributes if "theType" is empty. More...
 
virtual const std::string & id (const std::shared_ptr< ModelAPI_Attribute > &theAttr)=0
 Identifier by the id (not fast, iteration by map) More...
 
virtual bool isEqual (const std::shared_ptr< ModelAPI_Data > &theData)=0
 Returns true if data belongs to same features. More...
 
virtual bool isValid ()=0
 Returns true if it is correctly connected to the data model. More...
 
virtual std::shared_ptr< ModelAPI_AttributeaddAttribute (const std::string &theID, const std::string theAttrType, const int theIndex=-1)=0
 Initializes object by the attributes: must be called just after the object is created for each attribute of the object. More...
 
virtual std::shared_ptr< ModelAPI_AttributeaddFloatingAttribute (const std::string &theID, const std::string theAttrType, const std::string &theGroup)=0
 Adds a floating attribute (that may be added/removed during the data life) More...
 
virtual void allGroups (std::list< std::string > &theGroups)=0
 Returns all groups of this data (ordered). More...
 
virtual void attributesOfGroup (const std::string &theGroup, std::list< std::shared_ptr< ModelAPI_Attribute > > &theAttrs)=0
 Returns an ordered list of attributes that belong to the given group. More...
 
virtual void removeAttributes (const std::string &theGroup)=0
 Remove all attributes of the given group. More...
 
virtual void sendAttributeUpdated (ModelAPI_Attribute *theAttr)=0
 Useful method for "set" methods of the attributes: sends an UPDATE event and makes attribute initialized. More...
 
virtual bool blockSendAttributeUpdated (const bool theBlock, const bool theSendMessage=true)=0
 Blocks sending "attribute updated" if theBlock is true. More...
 
virtual void erase ()=0
 Erases all the data from the data model. More...
 
virtual ~ModelAPI_Data ()
 To virtually destroy the fields of successors. More...
 
virtual void execState (const ModelAPI_ExecState theState)=0
 Stores the state of the object to execute it later accordingly. More...
 
virtual ModelAPI_ExecState execState ()=0
 Returns the state of the latest execution of the feature. More...
 
virtual void setError (const std::string &theError, bool theSend=true)=0
 Registers error during the execution, causes the ExecutionFailed state. More...
 
virtual std::string error () const =0
 Returns error, arose during the execution. More...
 
virtual int featureId () const =0
 Returns the identifier of feature-owner, unique in this document. More...
 
virtual const std::set< std::shared_ptr< ModelAPI_Attribute > > & refsToMe ()=0
 returns all objects referenced to this More...
 
virtual void referencesToObjects (std::list< std::pair< std::string, std::list< std::shared_ptr< ModelAPI_Object > > > > &theRefs)=0
 returns all references by attributes of this data More...
 
virtual void copyTo (std::shared_ptr< ModelAPI_Data > theTarget)=0
 Copies all attributes content into theTarget data. More...
 
virtual std::shared_ptr< ModelAPI_DatainvalidPtr ()=0
 Returns the invalid data pointer (to avoid working with NULL shared pointers in swig) More...
 
virtual int updateID ()=0
 Identifier of the transaction when object (feature or result) was updated last time. More...
 
virtual void setUpdateID (const int theID)=0
 Identifier of the transaction when object (feature or result) was updated last time. More...
 
virtual std::shared_ptr< ModelAPI_Objectowner ()=0
 Returns the owner of this data. More...
 
virtual bool isDeleted ()=0
 Returns true if the object is deleted, but some data is still kept in memory. More...
 
virtual void setIsDeleted (const bool theFlag)=0
 Sets true if the object is deleted, but some data is still kept in memory. More...
 
virtual bool isPrecedingAttribute (const std::string &theAttribute1, const std::string &theAttribute2) const =0
 Returns true if theAttribute1 is going earlier than theAttribute2 in the data. More...
 

Protected Member Functions

 ModelAPI_Data ()
 Objects are created for features automatically. More...
 
virtual bool isInHistory ()=0
 Returns true if "is in history" custom behaviors is defined for the feature. More...
 
virtual void setIsInHistory (const bool theFlag)=0
 Defines the custom "is in history" behavior. More...
 
virtual bool isDisplayed ()=0
 Returns true if object must be displayed in the viewer: flag is stored in the data model, so on undo/redo, open/save or recreation of object by history-playing it keeps the original state in the current transaction. More...
 
virtual void setDisplayed (const bool theDisplay)=0
 Sets the displayed/hidden state of the object. More...
 

Friends

class ModelAPI_Object
 

Detailed Description

General object of the application that allows to get/set attributes from the document and compute result of an operation.

Constructor & Destructor Documentation

◆ ~ModelAPI_Data()

ModelAPI_Data::~ModelAPI_Data ( )
virtual

To virtually destroy the fields of successors.

◆ ModelAPI_Data()

ModelAPI_Data::ModelAPI_Data ( )
protected

Objects are created for features automatically.

Member Function Documentation

◆ name()

virtual std::wstring ModelAPI_Data::name ( )
pure virtual

Returns the name of the feature visible by the user in the object browser.

Implemented in Model_Data.

◆ setName()

virtual void ModelAPI_Data::setName ( const std::wstring &  theName)
pure virtual

Defines the name of the feature visible by the user in the object browser.

Implemented in Model_Data.

◆ hasUserDefinedName()

virtual bool ModelAPI_Data::hasUserDefinedName ( ) const
pure virtual

Return true if the object has been renamed by the user.

Implemented in Model_Data.

◆ version()

virtual std::string ModelAPI_Data::version ( )
pure virtual

Returns version of the feature (empty string if not applicable)

Implemented in Model_Data.

◆ setVersion()

virtual void ModelAPI_Data::setVersion ( const std::string &  theVersion)
pure virtual

Initialize the version of the feature.

Implemented in Model_Data.

◆ document()

virtual std::shared_ptr<ModelAPI_AttributeDocRef> ModelAPI_Data::document ( const std::string &  theID)
pure virtual

Returns the attribute that references to another document.

Implemented in Model_Data.

◆ real()

virtual std::shared_ptr<ModelAPI_AttributeDouble> ModelAPI_Data::real ( const std::string &  theID)
pure virtual

Returns the attribute that contains real value with double precision.

Implemented in Model_Data.

◆ realArray()

virtual std::shared_ptr<ModelAPI_AttributeDoubleArray> ModelAPI_Data::realArray ( const std::string &  theID)
pure virtual

Returns the attribute that contains double values array.

Implemented in Model_Data.

◆ integer()

virtual std::shared_ptr<ModelAPI_AttributeInteger> ModelAPI_Data::integer ( const std::string &  theID)
pure virtual

Returns the attribute that contains integer value.

Implemented in Model_Data.

◆ reference()

virtual std::shared_ptr<ModelAPI_AttributeReference> ModelAPI_Data::reference ( const std::string &  theID)
pure virtual

Returns the attribute that contains reference to a feature.

Implemented in Model_Data.

◆ selection()

virtual std::shared_ptr<ModelAPI_AttributeSelection> ModelAPI_Data::selection ( const std::string &  theID)
pure virtual

Returns the attribute that contains selection to a shape.

Implemented in Model_Data.

◆ selectionList()

virtual std::shared_ptr<ModelAPI_AttributeSelectionList> ModelAPI_Data::selectionList ( const std::string &  theID)
pure virtual

Returns the attribute that contains selection to a shape.

Implemented in Model_Data.

◆ refattr()

virtual std::shared_ptr<ModelAPI_AttributeRefAttr> ModelAPI_Data::refattr ( const std::string &  theID)
pure virtual

Returns the attribute that contains reference to an attribute of a feature.

Implemented in Model_Data.

◆ reflist()

virtual std::shared_ptr<ModelAPI_AttributeRefList> ModelAPI_Data::reflist ( const std::string &  theID)
pure virtual

Returns the attribute that contains list of references to features.

Implemented in Model_Data.

◆ refattrlist()

virtual std::shared_ptr<ModelAPI_AttributeRefAttrList> ModelAPI_Data::refattrlist ( const std::string &  theID)
pure virtual

Returns the attribute that contains list of references to features or reference to an attribute of a feature.

Implemented in Model_Data.

◆ boolean()

virtual std::shared_ptr<ModelAPI_AttributeBoolean> ModelAPI_Data::boolean ( const std::string &  theID)
pure virtual

Returns the attribute that contains boolean value.

Implemented in Model_Data.

◆ string()

virtual std::shared_ptr<ModelAPI_AttributeString> ModelAPI_Data::string ( const std::string &  theID)
pure virtual

Returns the attribute that contains boolean value.

Implemented in Model_Data.

◆ intArray()

virtual std::shared_ptr<ModelAPI_AttributeIntArray> ModelAPI_Data::intArray ( const std::string &  theID)
pure virtual

Returns the attribute that contains integer values array.

Implemented in Model_Data.

◆ stringArray()

virtual std::shared_ptr<ModelAPI_AttributeStringArray> ModelAPI_Data::stringArray ( const std::string &  theID)
pure virtual

Returns the attribute that contains string values array.

Implemented in Model_Data.

◆ image()

virtual std::shared_ptr<ModelAPI_AttributeImage> ModelAPI_Data::image ( const std::string &  theID)
pure virtual

Returns the attribute that contains image.

Implemented in Model_Data.

◆ tables()

virtual std::shared_ptr<ModelAPI_AttributeTables> ModelAPI_Data::tables ( const std::string &  theID)
pure virtual

Returns the attribute that contains tables.

Implemented in Model_Data.

◆ attribute()

virtual std::shared_ptr<ModelAPI_Attribute> ModelAPI_Data::attribute ( const std::string &  theID)
pure virtual

Returns the generic attribute by identifier.

Parameters
theIDidentifier of the attribute

Implemented in Model_Data.

◆ attributes()

virtual std::list<std::shared_ptr<ModelAPI_Attribute> > ModelAPI_Data::attributes ( const std::string &  theType)
pure virtual

Returns all attributes of the feature of the given type or all attributes if "theType" is empty.

Implemented in Model_Data.

◆ attributesIDs()

virtual std::list<std::string> ModelAPI_Data::attributesIDs ( const std::string &  theType)
pure virtual

Returns all attributes ids of the feature of the given type or all attributes if "theType" is empty.

Implemented in Model_Data.

◆ id()

virtual const std::string& ModelAPI_Data::id ( const std::shared_ptr< ModelAPI_Attribute > &  theAttr)
pure virtual

Identifier by the id (not fast, iteration by map)

Parameters
theAttrattribute already created in this data

Implemented in Model_Data.

◆ isEqual()

virtual bool ModelAPI_Data::isEqual ( const std::shared_ptr< ModelAPI_Data > &  theData)
pure virtual

Returns true if data belongs to same features.

Implemented in Model_Data.

◆ isValid()

virtual bool ModelAPI_Data::isValid ( )
pure virtual

Returns true if it is correctly connected to the data model.

Implemented in Model_Data.

◆ addAttribute()

virtual std::shared_ptr<ModelAPI_Attribute> ModelAPI_Data::addAttribute ( const std::string &  theID,
const std::string  theAttrType,
const int  theIndex = -1 
)
pure virtual

Initializes object by the attributes: must be called just after the object is created for each attribute of the object.

Parameters
theIDidentifier of the attribute that can be referenced by this ID later
theAttrTypetype of the created attribute (received from the type method)
theIndexindex of the attribute in the internal data structure, for not-floating attributes it is -1 to let it automatically be added
Returns
the just created attribute

Implemented in Model_Data.

◆ addFloatingAttribute()

virtual std::shared_ptr<ModelAPI_Attribute> ModelAPI_Data::addFloatingAttribute ( const std::string &  theID,
const std::string  theAttrType,
const std::string &  theGroup 
)
pure virtual

Adds a floating attribute (that may be added/removed during the data life)

Parameters
theIDidentifier of the attribute that can be referenced by this ID later
theAttrTypetype of the created attribute (received from the type method)
theGroupidentifier of the group this attribute belongs to, may be an empty string

Implemented in Model_Data.

◆ allGroups()

virtual void ModelAPI_Data::allGroups ( std::list< std::string > &  theGroups)
pure virtual

Returns all groups of this data (ordered).

Implemented in Model_Data.

◆ attributesOfGroup()

virtual void ModelAPI_Data::attributesOfGroup ( const std::string &  theGroup,
std::list< std::shared_ptr< ModelAPI_Attribute > > &  theAttrs 
)
pure virtual

Returns an ordered list of attributes that belong to the given group.

Implemented in Model_Data.

◆ removeAttributes()

virtual void ModelAPI_Data::removeAttributes ( const std::string &  theGroup)
pure virtual

Remove all attributes of the given group.

Implemented in Model_Data.

◆ sendAttributeUpdated()

virtual void ModelAPI_Data::sendAttributeUpdated ( ModelAPI_Attribute theAttr)
pure virtual

Useful method for "set" methods of the attributes: sends an UPDATE event and makes attribute initialized.

Implemented in Model_Data.

◆ blockSendAttributeUpdated()

virtual bool ModelAPI_Data::blockSendAttributeUpdated ( const bool  theBlock,
const bool  theSendMessage = true 
)
pure virtual

Blocks sending "attribute updated" if theBlock is true.

Parameters
theIDidentifier of the attribute that can be referenced by this ID later
theAttrTypetype of the created attribute (received from the type method)
Returns
the previous state of block

Implemented in Model_Data.

◆ erase()

virtual void ModelAPI_Data::erase ( )
pure virtual

Erases all the data from the data model.

Implemented in Model_Data.

◆ execState() [1/2]

virtual void ModelAPI_Data::execState ( const ModelAPI_ExecState  theState)
pure virtual

Stores the state of the object to execute it later accordingly.

Implemented in Model_Data.

◆ execState() [2/2]

virtual ModelAPI_ExecState ModelAPI_Data::execState ( )
pure virtual

Returns the state of the latest execution of the feature.

Implemented in Model_Data.

◆ setError()

virtual void ModelAPI_Data::setError ( const std::string &  theError,
bool  theSend = true 
)
pure virtual

Registers error during the execution, causes the ExecutionFailed state.

Implemented in Model_Data.

◆ error()

virtual std::string ModelAPI_Data::error ( ) const
pure virtual

Returns error, arose during the execution.

Implemented in Model_Data.

◆ featureId()

virtual int ModelAPI_Data::featureId ( ) const
pure virtual

Returns the identifier of feature-owner, unique in this document.

Implemented in Model_Data.

◆ refsToMe()

virtual const std::set<std::shared_ptr<ModelAPI_Attribute> >& ModelAPI_Data::refsToMe ( )
pure virtual

returns all objects referenced to this

Implemented in Model_Data.

◆ referencesToObjects()

virtual void ModelAPI_Data::referencesToObjects ( std::list< std::pair< std::string, std::list< std::shared_ptr< ModelAPI_Object > > > > &  theRefs)
pure virtual

returns all references by attributes of this data

Parameters
theRefsreturned list of pairs: id of referenced attribute and list of referenced objects

Implemented in Model_Data.

◆ copyTo()

virtual void ModelAPI_Data::copyTo ( std::shared_ptr< ModelAPI_Data theTarget)
pure virtual

Copies all attributes content into theTarget data.

Implemented in Model_Data.

◆ invalidPtr()

virtual std::shared_ptr<ModelAPI_Data> ModelAPI_Data::invalidPtr ( )
pure virtual

Returns the invalid data pointer (to avoid working with NULL shared pointers in swig)

Implemented in Model_Data.

◆ updateID()

virtual int ModelAPI_Data::updateID ( )
pure virtual

Identifier of the transaction when object (feature or result) was updated last time.

Implemented in Model_Data.

◆ setUpdateID()

virtual void ModelAPI_Data::setUpdateID ( const int  theID)
pure virtual

Identifier of the transaction when object (feature or result) was updated last time.

This method is called by the updater.

Implemented in Model_Data.

◆ owner()

virtual std::shared_ptr<ModelAPI_Object> ModelAPI_Data::owner ( )
pure virtual

Returns the owner of this data.

Implemented in Model_Data.

◆ isDeleted()

virtual bool ModelAPI_Data::isDeleted ( )
pure virtual

Returns true if the object is deleted, but some data is still kept in memory.

Implemented in Model_Data.

◆ setIsDeleted()

virtual void ModelAPI_Data::setIsDeleted ( const bool  theFlag)
pure virtual

Sets true if the object is deleted, but some data is still kept in memory.

Implemented in Model_Data.

◆ isPrecedingAttribute()

virtual bool ModelAPI_Data::isPrecedingAttribute ( const std::string &  theAttribute1,
const std::string &  theAttribute2 
) const
pure virtual

Returns true if theAttribute1 is going earlier than theAttribute2 in the data.

◆ isInHistory()

virtual bool ModelAPI_Data::isInHistory ( )
protectedpure virtual

Returns true if "is in history" custom behaviors is defined for the feature.

Implemented in Model_Data.

◆ setIsInHistory()

virtual void ModelAPI_Data::setIsInHistory ( const bool  theFlag)
protectedpure virtual

Defines the custom "is in history" behavior.

Implemented in Model_Data.

◆ isDisplayed()

virtual bool ModelAPI_Data::isDisplayed ( )
protectedpure virtual

Returns true if object must be displayed in the viewer: flag is stored in the data model, so on undo/redo, open/save or recreation of object by history-playing it keeps the original state in the current transaction.

◆ setDisplayed()

virtual void ModelAPI_Data::setDisplayed ( const bool  theDisplay)
protectedpure virtual

Sets the displayed/hidden state of the object.

If it is changed, sends the "redisplay" signal.