SHAPER  9.12.0
Model_Document Class Reference

Document for internal data structure of any object storage. More...

Inheritance diagram for Model_Document:
Inheritance graph

Public Member Functions

virtual MODEL_EXPORT const std::string & kind () const
 Returns the kind of the document: "PartSet", "Part", or something else. More...
 
virtual MODEL_EXPORT bool load (const char *theDirName, const char *theFileName, DocumentPtr theThis)
 Loads the OCAF document from the file. More...
 
virtual MODEL_EXPORT bool importPart (const char *theFileName, std::list< std::shared_ptr< ModelAPI_Feature > > &theImported, bool theCheckOnly=false)
 Loads the OCAF document from the file into the current document. More...
 
virtual MODEL_EXPORT bool save (const char *theDirName, const char *theFileName, std::list< std::string > &theResults)
 Saves the OCAF document to the file. More...
 
virtual MODEL_EXPORT bool save (const char *theFilename, const std::list< std::shared_ptr< ModelAPI_Feature > > &theExportFeatures) const
 Export the list of features to the file. More...
 
virtual MODEL_EXPORT void close (const bool theForever=false)
 Removes document data. More...
 
virtual MODEL_EXPORT void startOperation ()
 Starts a new operation (opens a transaction) More...
 
virtual MODEL_EXPORT bool finishOperation ()
 Finishes the previously started operation (closes the transaction) More...
 
virtual MODEL_EXPORT void abortOperation ()
 Aborts the operation. More...
 
virtual MODEL_EXPORT bool isOperation () const
 Returns true if operation has been started, but not yet finished or aborted. More...
 
virtual MODEL_EXPORT bool isModified ()
 Returns true if document was modified (since creation/opening) More...
 
virtual MODEL_EXPORT bool canUndo ()
 Returns True if there are available Undo-s. More...
 
virtual MODEL_EXPORT void undo ()
 Undoes last operation. More...
 
virtual MODEL_EXPORT bool canRedo ()
 Returns True if there are available Redo-s. More...
 
virtual MODEL_EXPORT void redo ()
 Redoes last operation. More...
 
virtual MODEL_EXPORT void clearUndoRedo ()
 Clears undo/redo lists. More...
 
virtual MODEL_EXPORT FeaturePtr addFeature (std::string theID, const bool theMakeCurrent=true)
 Adds to the document the new feature of the given feature id. More...
 
virtual MODEL_EXPORT void refsToFeature (FeaturePtr theFeature, std::set< FeaturePtr > &theRefs, const bool isSendError=true)
 Return a list of features, which refers to the feature. More...
 
virtual MODEL_EXPORT void removeFeature (FeaturePtr theFeature)
 Removes the feature from the document (with result) It is necessary to flush REDISPLAY signal manually after this method because the method sends it, but for the performance purpose does not flush it. More...
 
virtual MODEL_EXPORT void moveFeature (FeaturePtr theMoved, FeaturePtr theAfterThis, const bool theSplit=false)
 Moves the feature to make it after the given one in the history. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ObjectobjectByName (const std::string &theGroupID, const std::wstring &theName)
 Returns the first found object in the group by the object name. More...
 
virtual MODEL_EXPORT const int index (std::shared_ptr< ModelAPI_Object > theObject, const bool theAllowFolder=false)
 Returns the object index in the group. More...
 
virtual MODEL_EXPORT std::shared_ptr< Model_DocumentsubDoc (int theDocID)
 Internal sub-document by ID. More...
 
virtual MODEL_EXPORT const int id () const
 ! Returns the id of the document More...
 
virtual MODEL_EXPORT ObjectPtr object (const std::string &theGroupID, const int theIndex, const bool theAllowFolder=false)
 Returns the feature in the group by the index (started from zero) More...
 
virtual MODEL_EXPORT int size (const std::string &theGroupID, const bool theAllowFolder=false)
 Returns the number of features in the group. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Objectparent (const std::shared_ptr< ModelAPI_Object > theChild)
 Returns the parent object of this child. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_FeaturecurrentFeature (const bool theVisible)
 Returns the feature that is currently edited in this document, normally this is the latest created feature. More...
 
virtual MODEL_EXPORT void setCurrentFeature (std::shared_ptr< ModelAPI_Feature > theCurrent, const bool theVisible)
 Sets the current feature: all features below will be disabled, new features will be appended after this one. More...
 
virtual MODEL_EXPORT void setCurrentFeatureUp ()
 Makes the current feature one feature upper. More...
 
virtual MODEL_EXPORT int numInternalFeatures ()
 Returns the number of all features: in the history or not. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_FeatureinternalFeature (const int theIndex)
 Returns the feature by zero-based index: features in the history or not. More...
 
virtual MODEL_EXPORT void synchronizeTransactions ()
 Performs synchronization of transactions with the module document: If some document is not active (by undo of activation) but in memory, on activation the transactions must be synchronized because all redo-s performed without this participation. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultConstructioncreateConstruction (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
 Creates construction results. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultBodycreateBody (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
 Creates a body results. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultPartcreatePart (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
 Creates a part results. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultPartcopyPart (const std::shared_ptr< ModelAPI_ResultPart > &theOrigin, const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
 Copies a part result, keeping the reference to origin. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultGroupcreateGroup (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
 Creates a group result. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultFieldcreateField (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
 Creates a field result. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_ResultParametercreateParameter (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)
 Creates a parameter result. More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_Featurefeature (const std::shared_ptr< ModelAPI_Result > &theResult)
 Returns a feature by result (owner of result) More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_FolderaddFolder (std::shared_ptr< ModelAPI_Feature > theAddBefore=std::shared_ptr< ModelAPI_Feature >())
 Creates a folder (group of the features in the object browser) More...
 
virtual MODEL_EXPORT void removeFolder (std::shared_ptr< ModelAPI_Folder > theFolder)
 Removes the folder from the document (all features in the folder will be kept). More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_FolderfindFolderAbove (const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures)
 Search a folder above the list of features applicable to store them (it means the list of features stored in the folder should be consequential) More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_FolderfindFolderBelow (const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures)
 Search a folder below the list of features applicable to store them (it means the list of features stored in the folder should be consequential) More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_FolderfindContainingFolder (const std::shared_ptr< ModelAPI_Feature > &theFeature, int &theIndexInFolder)
 Search a folder containing the given feature. More...
 
virtual MODEL_EXPORT bool moveToFolder (const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures, const std::shared_ptr< ModelAPI_Folder > &theFolder)
 Add a list of features to the folder. More...
 
virtual MODEL_EXPORT bool removeFromFolder (const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures, const bool theBefore=true)
 Remove features from the folder. More...
 
bool executeFeatures ()
 ! Returns true if parametric updater need to execute feature on recomputation On abort, undo or redo it is not necessary: results in document are updated automatically More...
 
void setExecuteFeatures (const bool theFlag)
 ! On abort, undo or redo it is not necessary: results in document are updated automatically More...
 
void addNamingName (const TDF_Label theLabel, std::wstring theName)
 Registers the name of the shape for the topological naming needs. More...
 
void changeNamingName (std::wstring theOldName, const std::wstring theNewName, const TDF_Label &theLabel)
 Updates the name of some object. More...
 
TDF_Label findNamingName (std::wstring theName, ResultPtr theContext)
 Returns the label, keeper of the name for the topological naming needs. More...
 
int numberOfNameInHistory (const ObjectPtr &theNameObject, const TDF_Label &theStartFrom)
 Returns the number of the name in the history relatively to the given object (by label). More...
 
ResultPtr findByName (std::wstring &theName, std::wstring &theSubShapeName, bool &theUniqueContext)
 Returns the result by name of the result (names of results must be unique, used for naming selection by name. More...
 
virtual MODEL_EXPORT std::list< std::shared_ptr< ModelAPI_Feature > > allFeatures ()
 ! Returns all features of the document including the hidden features which are not in history. More...
 
virtual MODEL_EXPORT std::list< std::shared_ptr< ModelAPI_Object > > allObjects ()
 Returns all objects of the document including the hidden features which are not in history. More...
 
virtual MODEL_EXPORT int transactionID ()
 Returns the global identifier of the current transaction (needed for the update algo) More...
 
virtual MODEL_EXPORT void incrementTransactionID ()
 Increases the transaction ID. More...
 
virtual MODEL_EXPORT bool isOpened ()
 Returns true if document is opened and valid. More...
 
FeaturePtr lastFeature ()
 Returns the last feature in the document (even not visible or disabled) More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_FeatureproducedByFeature (std::shared_ptr< ModelAPI_Result > theResult, const std::shared_ptr< GeomAPI_Shape > &theShape)
 Returns the feature that produced the given face of the given result. More...
 
virtual MODEL_EXPORT bool isLater (FeaturePtr theLater, FeaturePtr theCurrent) const
 Returns true if theLater is in history of features creation later than theCurrent. More...
 
virtual MODEL_EXPORT void eraseAllFeatures ()
 Just removes all features without touching the document data (to be able undo) More...
 
virtual MODEL_EXPORT std::shared_ptr< ModelAPI_FeaturenextFeature (std::shared_ptr< ModelAPI_Feature > theCurrent, const bool theReverse=false) const
 Returns the next (from the history point of view) feature, any: invisible or disabled. More...
 
 ~Model_Document ()
 Erases the document structure. More...
 
virtual void emptyFunction () const
 Empty function which is added for virtualiation of the interface. More...
 

Protected Member Functions

TDF_Label generalLabel () const
 Returns (creates if needed) the general label. More...
 
 Model_Document (const int theID, const std::string theKind)
 Creates new document with binary file format. More...
 
Handle_TDocStd_Document document ()
 Returns the internal OCCT document of this interface. More...
 
void compactNested ()
 performs compactification of all nested operations into one More...
 
const std::set< int > subDocuments () const
 Returns all loaded sub documents. More...
 
void undoInternal (const bool theWithSubs, const bool theSynchronize)
 The implementation of undo: with or without recursive calls in the sub-documents. More...
 
void operationId (const std::string &theId)
 Stores the Id of the current operation (normally is called for the root document) More...
 
std::list< std::string > undoList () const
 Returns the list of Ids of the operations that can be undone (called for the root document) More...
 
std::list< std::string > redoList () const
 Returns the list of Ids of the operations that can be redone (called for the root document) More...
 
virtual void updateHistory (const std::shared_ptr< ModelAPI_Object > theObject)
 Internally makes document know that feature was removed or added in history after creation. More...
 
virtual void updateHistory (const std::string theGroup)
 Internally makes document know that feature was removed or added in history after creation. More...
 
bool isRoot () const
 Returns true if the document is root module document. More...
 
void setThis (DocumentPtr theDoc)
 Sets shared pointer to this. More...
 
Model_Objectsobjects ()
 Returns the objects manager. More...
 
virtual void setActive (const bool theFlag)
 ! Informs the document that it becomes active and some actions must be performed More...
 
virtual bool isActive () const
 Returns true if this document is currently active. More...
 
std::shared_ptr< ModelAPI_AttributeSelectionListselectionInPartFeature ()
 Returns the selection attribute that is used for calculation of selection externally from the document. More...
 
virtual void storeNodesState (const std::list< bool > &theStates)
 Stores in the document boolean flags: states of the nodes in the object browser. More...
 
virtual void restoreNodesState (std::list< bool > &theStates) const
 Returns the stored nodes states. More...
 
TDF_Label extConstructionsLabel () const
 Label that contains structures for selection of constructions of another document. More...
 
FeaturePtr featureByLab (const TDF_Label &theLab)
 searches in this document feature that contains this label More...
 
ResultPtr resultByLab (const TDF_Label &theLab)
 searches in this document result that contains this label More...
 
bool isLaterByDep (FeaturePtr theThis, FeaturePtr theOther)
 returns true if theThis is later in the features tree and dependencies than theOther More...
 
void appendTransactionToPrevious ()
 appends the latest transaction to the previous one (used for AutoUpdate enabling transaction) More...
 
void setAutoRecomutationState (const bool theState)
 Sets the automatic recomputation flag: true means enabled. More...
 
bool autoRecomutationState () const
 Returns the current automatic recomputation flag: true means enabled. More...
 

Friends

class Model_Application
 
class Model_Session
 
class Model_Update
 
class Model_AttributeReference
 
class Model_AttributeRefAttr
 
class Model_AttributeRefList
 
class Model_AttributeRefAttrList
 
class Model_AttributeSelection
 
class Model_AttributeSelectionList
 
class Model_ResultPart
 
class Model_ResultBody
 
class Model_ResultConstruction
 
class Model_SelectionNaming
 
class Model_BodyBuilder
 
class DFBrowser
 

Detailed Description

Document for internal data structure of any object storage.

Document contains all data that must be stored/retrieved in the file. Also it provides access to this data: open/save, transactions management etc.

Constructor & Destructor Documentation

◆ ~Model_Document()

Model_Document::~Model_Document ( )

Erases the document structure.

◆ Model_Document()

Model_Document::Model_Document ( const int  theID,
const std::string  theKind 
)
protected

Creates new document with binary file format.

Member Function Documentation

◆ kind()

virtual MODEL_EXPORT const std::string& Model_Document::kind ( ) const
inlinevirtual

Returns the kind of the document: "PartSet", "Part", or something else.

This kind is used for feature buttons enable/disable depending on active document (it uses workbench "document" identifier in XML configuration file for this)

Implements ModelAPI_Document.

◆ load()

bool Model_Document::load ( const char *  theDirName,
const char *  theFileName,
DocumentPtr  theThis 
)
virtual

Loads the OCAF document from the file.

Parameters
theDirNamedirectory of the loaded file
theFileNamea name of the file to load
theThisthe common shared pointer to the document to manage with it later
Returns
true if file was loaded successfully

◆ importPart()

bool Model_Document::importPart ( const char *  theFileName,
std::list< std::shared_ptr< ModelAPI_Feature > > &  theImported,
bool  theCheckOnly = false 
)
virtual

Loads the OCAF document from the file into the current document.

All the features are added after the active feature.

Parameters
theFileNamename of the file to import
theImportedlist of features imported from the file
theCheckOnlyverify the document does not contain unappropriate features (useful for import to PartSet), but do not import it
Returns
true if file was loaded successfully

Implements ModelAPI_Document.

◆ save() [1/2]

bool Model_Document::save ( const char *  theDirName,
const char *  theFileName,
std::list< std::string > &  theResults 
)
virtual

Saves the OCAF document to the file.

Parameters
theDirNamedirectory where the document will be saved
theFileNamea name of the document file to store
theResultsthe result full file names that were stored by "save"
Returns
true if file was stored successfully

◆ save() [2/2]

bool Model_Document::save ( const char *  theFilename,
const std::list< std::shared_ptr< ModelAPI_Feature > > &  theExportFeatures 
) const
virtual

Export the list of features to the file.

Parameters
theFilenamepath to save the file
theExportFeatureslist of features to export

Implements ModelAPI_Document.

◆ close()

void Model_Document::close ( const bool  theForever = false)
virtual

Removes document data.

Parameters
theForeverif it is false, document is just hidden (to keep possibility make it back on Undo/Redo)

Implements ModelAPI_Document.

◆ startOperation()

void Model_Document::startOperation ( )
virtual

Starts a new operation (opens a transaction)

◆ finishOperation()

bool Model_Document::finishOperation ( )
virtual

Finishes the previously started operation (closes the transaction)

Returns
true if transaction in this document is not empty and really was performed

◆ abortOperation()

void Model_Document::abortOperation ( )
virtual

Aborts the operation.

◆ isOperation()

bool Model_Document::isOperation ( ) const
virtual

Returns true if operation has been started, but not yet finished or aborted.

◆ isModified()

bool Model_Document::isModified ( )
virtual

Returns true if document was modified (since creation/opening)

◆ canUndo()

bool Model_Document::canUndo ( )
virtual

Returns True if there are available Undo-s.

◆ undo()

void Model_Document::undo ( )
virtual

Undoes last operation.

◆ canRedo()

bool Model_Document::canRedo ( )
virtual

Returns True if there are available Redo-s.

◆ redo()

void Model_Document::redo ( )
virtual

Redoes last operation.

◆ clearUndoRedo()

void Model_Document::clearUndoRedo ( )
virtual

Clears undo/redo lists.

◆ addFeature()

FeaturePtr Model_Document::addFeature ( std::string  theID,
const bool  theMakeCurrent = true 
)
virtual

Adds to the document the new feature of the given feature id.

Parameters
theIDcreates feature and puts it in the document
theMakeCurrentto make current this new feature in this document

Implements ModelAPI_Document.

◆ refsToFeature()

void Model_Document::refsToFeature ( FeaturePtr  theFeature,
std::set< FeaturePtr > &  theRefs,
const bool  isSendError = true 
)
virtual

Return a list of features, which refers to the feature.

Parameters
theFeaturea feature
theRefsa list of reference features
isSendErrora flag whether the error message should be send

Implements ModelAPI_Document.

◆ removeFeature()

void Model_Document::removeFeature ( FeaturePtr  theFeature)
virtual

Removes the feature from the document (with result) It is necessary to flush REDISPLAY signal manually after this method because the method sends it, but for the performance purpose does not flush it.

Parameters
theFeaturea removed feature

Implements ModelAPI_Document.

◆ moveFeature()

void Model_Document::moveFeature ( FeaturePtr  theMoved,
FeaturePtr  theAfterThis,
const bool  theSplit = false 
)
virtual

Moves the feature to make it after the given one in the history.

Implements ModelAPI_Document.

◆ objectByName()

std::shared_ptr< ModelAPI_Object > Model_Document::objectByName ( const std::string &  theGroupID,
const std::wstring &  theName 
)
virtual

Returns the first found object in the group by the object name.

Parameters
theGroupIDgroup that contains an object
theNamename of the object to search
Returns
null if such object is not found

Implements ModelAPI_Document.

◆ index()

const int Model_Document::index ( std::shared_ptr< ModelAPI_Object theObject,
const bool  theAllowFolder = false 
)
virtual

Returns the object index in the group.

Object must be visible. Otherwise returns -1.

Parameters
theObjectobject of this document
theAllowFoldertake into account grouping feature by folders
Returns
index started from zero, or -1 if object is invisible or belongs to another document

Implements ModelAPI_Document.

◆ subDoc()

std::shared_ptr< Model_Document > Model_Document::subDoc ( int  theDocID)
virtual

Internal sub-document by ID.

◆ id()

virtual MODEL_EXPORT const int Model_Document::id ( ) const
inlinevirtual

! Returns the id of the document

Implements ModelAPI_Document.

◆ object()

ObjectPtr Model_Document::object ( const std::string &  theGroupID,
const int  theIndex,
const bool  theAllowFolder = false 
)
virtual

Returns the feature in the group by the index (started from zero)

Parameters
theGroupIDgroup that contains a feature
theIndexzero-based index of feature in the group
theAllowFoldertake into account grouping feature by folders

Implements ModelAPI_Document.

◆ size()

int Model_Document::size ( const std::string &  theGroupID,
const bool  theAllowFolder = false 
)
virtual

Returns the number of features in the group.

Parameters
theGroupIDgroup of objects
theAllowFoldertake into account grouping feature by folders

Implements ModelAPI_Document.

◆ parent()

std::shared_ptr< ModelAPI_Object > Model_Document::parent ( const std::shared_ptr< ModelAPI_Object theChild)
virtual

Returns the parent object of this child.

This may be result or feature, parent of a top result. Fast method, that uses internal data structure specifics.

Implements ModelAPI_Document.

◆ currentFeature()

std::shared_ptr< ModelAPI_Feature > Model_Document::currentFeature ( const bool  theVisible)
virtual

Returns the feature that is currently edited in this document, normally this is the latest created feature.

Parameters
theVisibleuse visible features only: flag is true for Object Browser functionality
Returns
null if next created feature must be the first

Implements ModelAPI_Document.

◆ setCurrentFeature()

void Model_Document::setCurrentFeature ( std::shared_ptr< ModelAPI_Feature theCurrent,
const bool  theVisible 
)
virtual

Sets the current feature: all features below will be disabled, new features will be appended after this one.

Parameters
theCurrentthe selected feature as current: below it everything becomes disabled
theVisibleuse visible features only: flag is true for Object Browser functionality

Implements ModelAPI_Document.

◆ setCurrentFeatureUp()

void Model_Document::setCurrentFeatureUp ( )
virtual

Makes the current feature one feature upper.

Implements ModelAPI_Document.

◆ numInternalFeatures()

int Model_Document::numInternalFeatures ( )
virtual

Returns the number of all features: in the history or not.

Implements ModelAPI_Document.

◆ internalFeature()

std::shared_ptr< ModelAPI_Feature > Model_Document::internalFeature ( const int  theIndex)
virtual

Returns the feature by zero-based index: features in the history or not.

Implements ModelAPI_Document.

◆ synchronizeTransactions()

void Model_Document::synchronizeTransactions ( )
virtual

Performs synchronization of transactions with the module document: If some document is not active (by undo of activation) but in memory, on activation the transactions must be synchronized because all redo-s performed without this participation.

Implements ModelAPI_Document.

◆ createConstruction()

std::shared_ptr< ModelAPI_ResultConstruction > Model_Document::createConstruction ( const std::shared_ptr< ModelAPI_Data > &  theFeatureData,
const int  theIndex = 0 
)
virtual

Creates construction results.

Implements ModelAPI_Document.

◆ createBody()

std::shared_ptr< ModelAPI_ResultBody > Model_Document::createBody ( const std::shared_ptr< ModelAPI_Data > &  theFeatureData,
const int  theIndex = 0 
)
virtual

Creates a body results.

Implements ModelAPI_Document.

◆ createPart()

std::shared_ptr< ModelAPI_ResultPart > Model_Document::createPart ( const std::shared_ptr< ModelAPI_Data > &  theFeatureData,
const int  theIndex = 0 
)
virtual

Creates a part results.

Implements ModelAPI_Document.

◆ copyPart()

std::shared_ptr< ModelAPI_ResultPart > Model_Document::copyPart ( const std::shared_ptr< ModelAPI_ResultPart > &  theOrigin,
const std::shared_ptr< ModelAPI_Data > &  theFeatureData,
const int  theIndex = 0 
)
virtual

Copies a part result, keeping the reference to origin.

Implements ModelAPI_Document.

◆ createGroup()

std::shared_ptr< ModelAPI_ResultGroup > Model_Document::createGroup ( const std::shared_ptr< ModelAPI_Data > &  theFeatureData,
const int  theIndex = 0 
)
virtual

Creates a group result.

Implements ModelAPI_Document.

◆ createField()

std::shared_ptr< ModelAPI_ResultField > Model_Document::createField ( const std::shared_ptr< ModelAPI_Data > &  theFeatureData,
const int  theIndex = 0 
)
virtual

Creates a field result.

Implements ModelAPI_Document.

◆ createParameter()

std::shared_ptr< ModelAPI_ResultParameter > Model_Document::createParameter ( const std::shared_ptr< ModelAPI_Data > &  theFeatureData,
const int  theIndex = 0 
)
virtual

Creates a parameter result.

Implements ModelAPI_Document.

◆ feature()

std::shared_ptr< ModelAPI_Feature > Model_Document::feature ( const std::shared_ptr< ModelAPI_Result > &  theResult)
virtual

Returns a feature by result (owner of result)

Implements ModelAPI_Document.

◆ addFolder()

std::shared_ptr< ModelAPI_Folder > Model_Document::addFolder ( std::shared_ptr< ModelAPI_Feature theAddBefore = std::shared_ptr<ModelAPI_Feature>())
virtual

Creates a folder (group of the features in the object browser)

Parameters
theAddBeforea feature, the folder is added before (if empty, the folder is added after the last feature)

Implements ModelAPI_Document.

◆ removeFolder()

void Model_Document::removeFolder ( std::shared_ptr< ModelAPI_Folder theFolder)
virtual

Removes the folder from the document (all features in the folder will be kept).

Implements ModelAPI_Document.

◆ findFolderAbove()

std::shared_ptr< ModelAPI_Folder > Model_Document::findFolderAbove ( const std::list< std::shared_ptr< ModelAPI_Feature > > &  theFeatures)
virtual

Search a folder above the list of features applicable to store them (it means the list of features stored in the folder should be consequential)

Returns
Empty pointer if there is no applicable folder

Implements ModelAPI_Document.

◆ findFolderBelow()

std::shared_ptr< ModelAPI_Folder > Model_Document::findFolderBelow ( const std::list< std::shared_ptr< ModelAPI_Feature > > &  theFeatures)
virtual

Search a folder below the list of features applicable to store them (it means the list of features stored in the folder should be consequential)

Returns
Empty pointer if there is no applicable folder

Implements ModelAPI_Document.

◆ findContainingFolder()

std::shared_ptr< ModelAPI_Folder > Model_Document::findContainingFolder ( const std::shared_ptr< ModelAPI_Feature > &  theFeature,
int &  theIndexInFolder 
)
virtual

Search a folder containing the given feature.

Additionally calculates a zero-based index of the feature in this folder.

Parameters
theFeaturefeature to search
theIndexInFolderzero-based index in the folder or -1 if the feature is top-level.
Returns
the folder containing the feature or empty pointer if the feature is top-level.

Implements ModelAPI_Document.

◆ moveToFolder()

bool Model_Document::moveToFolder ( const std::list< std::shared_ptr< ModelAPI_Feature > > &  theFeatures,
const std::shared_ptr< ModelAPI_Folder > &  theFolder 
)
virtual

Add a list of features to the folder.

The correctness of the adding is not performed (such checks have been done in corresponding find.. method).

Returns
true if the movement is successful

Implements ModelAPI_Document.

◆ removeFromFolder()

bool Model_Document::removeFromFolder ( const std::list< std::shared_ptr< ModelAPI_Feature > > &  theFeatures,
const bool  theBefore = true 
)
virtual

Remove features from the folder.

Parameters
theFeatureslist of features to be removed
theBeforeextract features before the folder (this parameter is applicable only when all features in the folder are taking out, in other cases the direction is taken automatically)
Returns
true if the features have been moved out

Implements ModelAPI_Document.

◆ executeFeatures()

bool Model_Document::executeFeatures ( )
inline

! Returns true if parametric updater need to execute feature on recomputation On abort, undo or redo it is not necessary: results in document are updated automatically

◆ setExecuteFeatures()

void Model_Document::setExecuteFeatures ( const bool  theFlag)

! On abort, undo or redo it is not necessary: results in document are updated automatically

◆ addNamingName()

void Model_Document::addNamingName ( const TDF_Label  theLabel,
std::wstring  theName 
)

Registers the name of the shape for the topological naming needs.

◆ changeNamingName()

void Model_Document::changeNamingName ( std::wstring  theOldName,
const std::wstring  theNewName,
const TDF_Label &  theLabel 
)

Updates the name of some object.

◆ findNamingName()

TDF_Label Model_Document::findNamingName ( std::wstring  theName,
ResultPtr  theContext 
)

Returns the label, keeper of the name for the topological naming needs.

◆ numberOfNameInHistory()

int Model_Document::numberOfNameInHistory ( const ObjectPtr &  theNameObject,
const TDF_Label &  theStartFrom 
)

Returns the number of the name in the history relatively to the given object (by label).

Start from 1 (this object).

◆ findByName()

ResultPtr Model_Document::findByName ( std::wstring &  theName,
std::wstring &  theSubShapeName,
bool &  theUniqueContext 
)

Returns the result by name of the result (names of results must be unique, used for naming selection by name.

◆ allFeatures()

std::list< std::shared_ptr< ModelAPI_Feature > > Model_Document::allFeatures ( )
virtual

! Returns all features of the document including the hidden features which are not in history.

Not very fast method, for calling once, not in big cycles.

Implements ModelAPI_Document.

◆ allObjects()

std::list< std::shared_ptr< ModelAPI_Object > > Model_Document::allObjects ( )
virtual

Returns all objects of the document including the hidden features which are not in history.

Not very fast method, for calling once, not in big cycles.

Implements ModelAPI_Document.

◆ transactionID()

int Model_Document::transactionID ( )
virtual

Returns the global identifier of the current transaction (needed for the update algo)

◆ incrementTransactionID()

void Model_Document::incrementTransactionID ( )
virtual

Increases the transaction ID.

◆ isOpened()

bool Model_Document::isOpened ( )
virtual

Returns true if document is opened and valid.

Implements ModelAPI_Document.

◆ lastFeature()

FeaturePtr Model_Document::lastFeature ( )

Returns the last feature in the document (even not visible or disabled)

Returns
null if there is no features

◆ producedByFeature()

std::shared_ptr< ModelAPI_Feature > Model_Document::producedByFeature ( std::shared_ptr< ModelAPI_Result theResult,
const std::shared_ptr< GeomAPI_Shape > &  theShape 
)
virtual

Returns the feature that produced the given face of the given result.

Implements ModelAPI_Document.

◆ isLater()

bool Model_Document::isLater ( FeaturePtr  theLater,
FeaturePtr  theCurrent 
) const
virtual

Returns true if theLater is in history of features creation later than theCurrent.

Implements ModelAPI_Document.

◆ eraseAllFeatures()

void Model_Document::eraseAllFeatures ( )
virtual

Just removes all features without touching the document data (to be able undo)

Implements ModelAPI_Document.

◆ nextFeature()

std::shared_ptr< ModelAPI_Feature > Model_Document::nextFeature ( std::shared_ptr< ModelAPI_Feature theCurrent,
const bool  theReverse = false 
) const
virtual

Returns the next (from the history point of view) feature, any: invisible or disabled.

Parameters
theCurrentprevious to the resulting feature
theReverseif it is true, iterates in reversed order (next becomes previous)

Implements ModelAPI_Document.

◆ generalLabel()

TDF_Label Model_Document::generalLabel ( ) const
protected

Returns (creates if needed) the general label.

◆ document()

Handle_TDocStd_Document Model_Document::document ( )
inlineprotected

Returns the internal OCCT document of this interface.

◆ compactNested()

void Model_Document::compactNested ( )
protected

performs compactification of all nested operations into one

Returns
true if resulting transaction is not empty and can be undone

◆ subDocuments()

const std::set< int > Model_Document::subDocuments ( ) const
protected

Returns all loaded sub documents.

◆ undoInternal()

void Model_Document::undoInternal ( const bool  theWithSubs,
const bool  theSynchronize 
)
protected

The implementation of undo: with or without recursive calls in the sub-documents.

◆ operationId()

void Model_Document::operationId ( const std::string &  theId)
protected

Stores the Id of the current operation (normally is called for the root document)

◆ undoList()

std::list< std::string > Model_Document::undoList ( ) const
protected

Returns the list of Ids of the operations that can be undone (called for the root document)

◆ redoList()

std::list< std::string > Model_Document::redoList ( ) const
protected

Returns the list of Ids of the operations that can be redone (called for the root document)

◆ updateHistory() [1/2]

void Model_Document::updateHistory ( const std::shared_ptr< ModelAPI_Object theObject)
protectedvirtual

Internally makes document know that feature was removed or added in history after creation.

Implements ModelAPI_Document.

◆ updateHistory() [2/2]

void Model_Document::updateHistory ( const std::string  theGroup)
protectedvirtual

Internally makes document know that feature was removed or added in history after creation.

Implements ModelAPI_Document.

◆ isRoot()

bool Model_Document::isRoot ( ) const
protected

Returns true if the document is root module document.

◆ setThis()

void Model_Document::setThis ( DocumentPtr  theDoc)
protected

Sets shared pointer to this.

◆ objects()

Model_Objects* Model_Document::objects ( )
inlineprotected

Returns the objects manager.

◆ setActive()

void Model_Document::setActive ( const bool  theFlag)
protectedvirtual

! Informs the document that it becomes active and some actions must be performed

Implements ModelAPI_Document.

◆ isActive()

bool Model_Document::isActive ( ) const
protectedvirtual

Returns true if this document is currently active.

Implements ModelAPI_Document.

◆ selectionInPartFeature()

AttributeSelectionListPtr Model_Document::selectionInPartFeature ( )
protected

Returns the selection attribute that is used for calculation of selection externally from the document.

Returns the feature that is used for calculation of selection externally from the document.

◆ storeNodesState()

void Model_Document::storeNodesState ( const std::list< bool > &  theStates)
protectedvirtual

Stores in the document boolean flags: states of the nodes in the object browser.

Normally is called outside of the transaction, just before "save".

Implements ModelAPI_Document.

◆ restoreNodesState()

void Model_Document::restoreNodesState ( std::list< bool > &  theStates) const
protectedvirtual

Returns the stored nodes states.

Normally it is called just after "open". Appends the values to theStates list.

Implements ModelAPI_Document.

◆ extConstructionsLabel()

TDF_Label Model_Document::extConstructionsLabel ( ) const
protected

Label that contains structures for selection of constructions of another document.

◆ featureByLab()

FeaturePtr Model_Document::featureByLab ( const TDF_Label &  theLab)
protected

searches in this document feature that contains this label

◆ resultByLab()

ResultPtr Model_Document::resultByLab ( const TDF_Label &  theLab)
protected

searches in this document result that contains this label

◆ isLaterByDep()

bool Model_Document::isLaterByDep ( FeaturePtr  theThis,
FeaturePtr  theOther 
)
protected

returns true if theThis is later in the features tree and dependencies than theOther

◆ appendTransactionToPrevious()

void Model_Document::appendTransactionToPrevious ( )
protected

appends the latest transaction to the previous one (used for AutoUpdate enabling transaction)

◆ setAutoRecomutationState()

void Model_Document::setAutoRecomutationState ( const bool  theState)
protected

Sets the automatic recomputation flag: true means enabled.

◆ autoRecomutationState()

bool Model_Document::autoRecomutationState ( ) const
protected

Returns the current automatic recomputation flag: true means enabled.

◆ emptyFunction()

virtual void ModelAPI_Entity::emptyFunction ( ) const
inlinevirtualinherited

Empty function which is added for virtualiation of the interface.