SHAPER
9.13.0
|
Manager of objects of the document. More...
Public Member Functions | |
void | addFeature (FeaturePtr theFeature, const FeaturePtr theAfterThis) |
Registers the feature in the data structure. More... | |
void | refsToFeature (FeaturePtr theFeature, std::set< FeaturePtr > &theRefs, const bool isSendError=true) |
Return a list of features, which refers to the feature. More... | |
void | removeFeature (FeaturePtr theFeature) |
Removes the feature from the document (with result) More... | |
void | moveFeature (FeaturePtr theMoved, FeaturePtr theAfterThis) |
Moves the feature to make it after the given one in the history. More... | |
FeaturePtr | feature (TDF_Label theLabel) const |
Returns the existing feature by the label. More... | |
ObjectPtr | object (TDF_Label theLabel) |
Returns the existing object: result or feature. More... | |
std::shared_ptr< ModelAPI_Object > | objectByName (const std::string &theGroupID, const std::wstring &theName) |
Returns the first found object in the group by the object name. More... | |
ResultPtr | findByName (const std::wstring theName) |
Returns the result by the result name. More... | |
const int | index (std::shared_ptr< ModelAPI_Object > theObject, const bool theAllowFolder=false) |
Returns the object index in the group. More... | |
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... | |
int | size (const std::string &theGroupID, const bool theAllowFolder=false) |
Returns the number of features in the group. More... | |
std::shared_ptr< ModelAPI_Object > | parent (const std::shared_ptr< ModelAPI_Object > theChild) |
Returns the parent object of this child. More... | |
void | allResults (const std::string &theGroupID, std::list< ResultPtr > &theResults) |
Returns all (and disabled) results of the given type. More... | |
int | numInternalFeatures () |
Returns the number of all features: in the history or not. More... | |
std::shared_ptr< ModelAPI_Feature > | internalFeature (const int theIndex) |
Returns the feature by zero-based index: features in the history or not. More... | |
std::shared_ptr< ModelAPI_ResultConstruction > | createConstruction (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0) |
Creates a construction result. More... | |
std::shared_ptr< ModelAPI_ResultBody > | createBody (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0, const std::wstring &theNameShape=L"") |
Creates a body result. More... | |
std::shared_ptr< ModelAPI_ResultPart > | createPart (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0) |
Creates a part result. More... | |
std::shared_ptr< ModelAPI_ResultPart > | copyPart (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... | |
std::shared_ptr< ModelAPI_ResultGroup > | createGroup (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0) |
Creates a group result. More... | |
std::shared_ptr< ModelAPI_ResultField > | createField (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0) |
Creates a field result. More... | |
std::shared_ptr< ModelAPI_ResultParameter > | createParameter (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0) |
Creates a parameter result. More... | |
std::shared_ptr< ModelAPI_Feature > | feature (const std::shared_ptr< ModelAPI_Result > &theResult) |
Returns a feature by result (owner of result) More... | |
std::shared_ptr< ModelAPI_Folder > | createFolder (const std::shared_ptr< ModelAPI_Feature > &theBeforeThis) |
Creates a folder (group of the features in the object browser) More... | |
void | removeFolder (std::shared_ptr< ModelAPI_Folder > theFolder) |
Removes the folder from the document (all features in the folder will be kept). More... | |
std::shared_ptr< ModelAPI_Folder > | findFolder (const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures, const bool theBelow) |
Search a folder applicable for the list of features (it means the list of features stored in the folder should be consequential) More... | |
std::shared_ptr< ModelAPI_Folder > | findContainingFolder (const std::shared_ptr< ModelAPI_Feature > &theFeature, int &theIndexInFolder) |
Search a folder containing the given feature. More... | |
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... | |
bool | removeFromFolder (const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures, const bool theBefore=true) |
Remove features from the folder. More... | |
void | setOwner (DocumentPtr theDoc) |
Sets the owner of this manager. More... | |
DocumentPtr | owner () |
Returns the owner of this manager. More... | |
virtual | ~Model_Objects () |
Deletes all managed features with emitting of corresponded signal. More... | |
Protected Member Functions | |
TDF_Label | featuresLabel () const |
Returns (creates if needed) the features label. More... | |
void | setUniqueName (FeaturePtr theFeature) |
Initializes feature with a unique name in this group (unique name is generated as feature type + "_" + index. More... | |
void | setUniqueName (FolderPtr theFolder) |
Initializes the folder with an unique name ("Folder_" + index) More... | |
void | synchronizeFeatures (const TDF_LabelList &theUpdated, const bool theUpdateReferences, const bool theOpen, const bool theExecuteFeatures, const bool theFlush) |
Synchronizes myFeatures list with the updated document. More... | |
void | synchronizeBackRefs () |
Synchronizes the BackReferences list in Data of Features and Results. More... | |
Model_Objects (TDF_Label theMainLab) | |
Creates manager on the OCAF document main label. More... | |
void | initData (ObjectPtr theObj, TDF_Label theLab, const int theTag) |
Initializes the data fields of the feature. More... | |
void | storeResult (std::shared_ptr< ModelAPI_Data > theFeatureData, std::shared_ptr< ModelAPI_Result > theResult, const int theResultIndex=0, const std::wstring &theNameShape=L"") |
Allows to store the result in the data tree of the document (attaches 'data' of result to tree) More... | |
TDF_Label | resultLabel (const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theResultIndex) |
returns the label of result by index; creates this label if it was not created before More... | |
void | updateResults (FeaturePtr theFeature, std::set< FeaturePtr > &theProcessed) |
Updates the results list of the feature basing on the current data tree theProcessed is used to avoid update twice (since the function is recursive) More... | |
void | updateHistory (const std::shared_ptr< ModelAPI_Object > theObject) |
Internally makes document know that feature was removed or added in history after creation. More... | |
void | updateHistory (const std::string theGroup) |
Internally makes document know that feature was removed or added in history after creation. More... | |
void | clearHistory (ObjectPtr theObj) |
Clears the history arrays related to this object. More... | |
void | createHistory (const std::string &theGroupID) |
Creates the history: up to date with the current state. More... | |
FeaturePtr | nextFeature (FeaturePtr theCurrent, int &theIndex, const bool theReverse=false) |
Returns the next (from the history point of view) feature, any: invisible or disabled. More... | |
FeaturePtr | firstFeature () |
Returns to the first (from the history point of view) feature, any: invisible or disabled. More... | |
FeaturePtr | lastFeature () |
Returns to the last (from the history point of view) feature, any: invisible or disabled. More... | |
bool | isLater (FeaturePtr theLater, FeaturePtr theCurrent) const |
Returns true if theLater is in history of features creation later than theCurrent. More... | |
TDF_Label | nextLabel (TDF_Label theCurrent, int &theIndex, const bool theReverse=false) |
Returns the next or previous label. More... | |
std::string | featureResultGroup (FeaturePtr theFeature) |
Returns the result group identifier of the given feature (for this at least one result must be created before) More... | |
std::list< std::shared_ptr< ModelAPI_Feature > > | allFeatures () |
Returns all features of the document including the hidden features which are not in history. More... | |
std::list< std::shared_ptr< ModelAPI_Object > > | allObjects () |
Returns all objects of the document including the hidden features which are not in history. More... | |
void | synchronizeBackRefsForObject (const std::set< std::shared_ptr< ModelAPI_Attribute >> &theNewRefs, ObjectPtr theObject) |
synchronizes back references for the given object basing on the collected data More... | |
virtual void | eraseAllFeatures () |
Just removes all features without touching the document data (to be able undo) More... | |
bool | hasCustomName (DataPtr theFeatureData, ResultPtr theResult, int theResultIndex, std::wstring &theParentName) const |
const ObjectPtr & | folder (TDF_Label theLabel) const |
Return object representing a folder or empty pointer. More... | |
Manager of objects of the document.
Normally one this class corresponds to one document and just helper to manage objects (ModelAPI_Objects) inside of the document on the level of data storage.
|
virtual |
Deletes all managed features with emitting of corresponded signal.
|
protected |
Creates manager on the OCAF document main label.
0:1:2 - where features are located 0:1:2:N:1 - data of the feature N 0:1:2:N:2:K:1 - data of the K result of the feature N
void Model_Objects::addFeature | ( | FeaturePtr | theFeature, |
const FeaturePtr | theAfterThis | ||
) |
Registers the feature in the data structure.
theFeature | feature that must be added to the data structure |
theAfterThis | the feature will be added after this feature; if it is null, the added feature will be the first |
void Model_Objects::refsToFeature | ( | FeaturePtr | theFeature, |
std::set< FeaturePtr > & | theRefs, | ||
const bool | isSendError = true |
||
) |
Return a list of features, which refers to the feature.
theFeature | a feature |
theRefs | a list of reference features |
isSendError | a flag whether the error message should be send |
void Model_Objects::removeFeature | ( | FeaturePtr | theFeature | ) |
Removes the feature from the document (with result)
theFeature | a removed feature |
void Model_Objects::moveFeature | ( | FeaturePtr | theMoved, |
FeaturePtr | theAfterThis | ||
) |
Moves the feature to make it after the given one in the history.
FeaturePtr Model_Objects::feature | ( | TDF_Label | theLabel | ) | const |
Returns the existing feature by the label.
theLabel | base label of the feature |
ObjectPtr Model_Objects::object | ( | TDF_Label | theLabel | ) |
Returns the existing object: result or feature.
theLabel | base label of the object |
std::shared_ptr< ModelAPI_Object > Model_Objects::objectByName | ( | const std::string & | theGroupID, |
const std::wstring & | theName | ||
) |
Returns the first found object in the group by the object name.
theGroupID | group that contains an object |
theName | name of the object to search |
ResultPtr Model_Objects::findByName | ( | const std::wstring | theName | ) |
Returns the result by the result name.
const int Model_Objects::index | ( | std::shared_ptr< ModelAPI_Object > | theObject, |
const bool | theAllowFolder = false |
||
) |
Returns the object index in the group.
Object must be visible. Otherwise returns -1.
theObject | object of this document |
theAllowFolder | take into account grouping feature by folders |
ObjectPtr Model_Objects::object | ( | const std::string & | theGroupID, |
const int | theIndex, | ||
const bool | theAllowFolder = false |
||
) |
Returns the feature in the group by the index (started from zero)
theGroupID | group that contains a feature |
theIndex | zero-based index of feature in the group |
theAllowFolder | take into account grouping feature by folders |
int Model_Objects::size | ( | const std::string & | theGroupID, |
const bool | theAllowFolder = false |
||
) |
Returns the number of features in the group.
theGroupID | group of objects |
theAllowFolder | take into account grouping feature by folders |
std::shared_ptr< ModelAPI_Object > Model_Objects::parent | ( | const std::shared_ptr< ModelAPI_Object > | theChild | ) |
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.
void Model_Objects::allResults | ( | const std::string & | theGroupID, |
std::list< ResultPtr > & | theResults | ||
) |
Returns all (and disabled) results of the given type.
Not fast method (iterates all features).
int Model_Objects::numInternalFeatures | ( | ) |
Returns the number of all features: in the history or not.
std::shared_ptr< ModelAPI_Feature > Model_Objects::internalFeature | ( | const int | theIndex | ) |
Returns the feature by zero-based index: features in the history or not.
std::shared_ptr< ModelAPI_ResultConstruction > Model_Objects::createConstruction | ( | const std::shared_ptr< ModelAPI_Data > & | theFeatureData, |
const int | theIndex = 0 |
||
) |
Creates a construction result.
std::shared_ptr< ModelAPI_ResultBody > Model_Objects::createBody | ( | const std::shared_ptr< ModelAPI_Data > & | theFeatureData, |
const int | theIndex = 0 , |
||
const std::wstring & | theNameShape = L"" |
||
) |
Creates a body result.
std::shared_ptr< ModelAPI_ResultPart > Model_Objects::createPart | ( | const std::shared_ptr< ModelAPI_Data > & | theFeatureData, |
const int | theIndex = 0 |
||
) |
Creates a part result.
std::shared_ptr< ModelAPI_ResultPart > Model_Objects::copyPart | ( | 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.
std::shared_ptr< ModelAPI_ResultGroup > Model_Objects::createGroup | ( | const std::shared_ptr< ModelAPI_Data > & | theFeatureData, |
const int | theIndex = 0 |
||
) |
Creates a group result.
std::shared_ptr< ModelAPI_ResultField > Model_Objects::createField | ( | const std::shared_ptr< ModelAPI_Data > & | theFeatureData, |
const int | theIndex = 0 |
||
) |
Creates a field result.
std::shared_ptr< ModelAPI_ResultParameter > Model_Objects::createParameter | ( | const std::shared_ptr< ModelAPI_Data > & | theFeatureData, |
const int | theIndex = 0 |
||
) |
Creates a parameter result.
std::shared_ptr< ModelAPI_Feature > Model_Objects::feature | ( | const std::shared_ptr< ModelAPI_Result > & | theResult | ) |
Returns a feature by result (owner of result)
std::shared_ptr< ModelAPI_Folder > Model_Objects::createFolder | ( | const std::shared_ptr< ModelAPI_Feature > & | theBeforeThis | ) |
Creates a folder (group of the features in the object browser)
void Model_Objects::removeFolder | ( | std::shared_ptr< ModelAPI_Folder > | theFolder | ) |
Removes the folder from the document (all features in the folder will be kept).
std::shared_ptr< ModelAPI_Folder > Model_Objects::findFolder | ( | const std::list< std::shared_ptr< ModelAPI_Feature > > & | theFeatures, |
const bool | theBelow | ||
) |
Search a folder applicable for the list of features (it means the list of features stored in the folder should be consequential)
theFeatures | list of features to be added to folder |
theBelow | search the folder below the features (if false , search above) |
FolderPtr Model_Objects::findContainingFolder | ( | const std::shared_ptr< ModelAPI_Feature > & | theFeature, |
int & | theIndexInFolder | ||
) |
Search a folder containing the given feature.
Additionally calculates a zero-based index of the feature in this folder.
theFeature | feature to search |
theIndexInFolder | zero-based index in the folder or -1 if the feature is top-level. |
bool Model_Objects::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.
The correctness of the adding is not performed (such checks have been done in corresponding find.. method).
true
if the movement is successful bool Model_Objects::removeFromFolder | ( | const std::list< std::shared_ptr< ModelAPI_Feature > > & | theFeatures, |
const bool | theBefore = true |
||
) |
Remove features from the folder.
theFeatures | list of features to be removed |
theBefore | extract 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) |
true
if the features have been moved out void Model_Objects::setOwner | ( | DocumentPtr | theDoc | ) |
Sets the owner of this manager.
|
inline |
Returns the owner of this manager.
|
protected |
Returns (creates if needed) the features label.
|
protected |
Initializes feature with a unique name in this group (unique name is generated as feature type + "_" + index.
|
protected |
Initializes the folder with an unique name ("Folder_" + index)
|
protected |
Synchronizes myFeatures list with the updated document.
theUpdated | list of labels that are marked as modified, so features must be also |
theUpdateReferences | causes the update of back-references |
theExecuteFeatures | requires re-execute modified persistent features (not needed on undo/redo/abort/open) |
theOpen | - on open nothing must be re-executed, except not persistent results |
theFlush | makes flush all events in the end of all modifications of this method |
|
protected |
Synchronizes the BackReferences list in Data of Features and Results.
|
protected |
Initializes the data fields of the feature.
|
protected |
Allows to store the result in the data tree of the document (attaches 'data' of result to tree)
|
protected |
returns the label of result by index; creates this label if it was not created before
|
protected |
Updates the results list of the feature basing on the current data tree theProcessed is used to avoid update twice (since the function is recursive)
|
protected |
Internally makes document know that feature was removed or added in history after creation.
|
protected |
Internally makes document know that feature was removed or added in history after creation.
|
protected |
Clears the history arrays related to this object.
|
protected |
Creates the history: up to date with the current state.
|
protected |
Returns the next (from the history point of view) feature, any: invisible or disabled.
theCurrent | previous to the resulting feature |
theReverse | if it is true, iterates in reversed order (next becomes previous) |
theIndex | may be used for optimization: index of theCurrent in references array |
|
protected |
Returns to the first (from the history point of view) feature, any: invisible or disabled.
|
protected |
Returns to the last (from the history point of view) feature, any: invisible or disabled.
|
protected |
Returns true if theLater is in history of features creation later than theCurrent.
|
protected |
Returns the next or previous label.
theCurrent | given label |
theReverse | if it is true, iterates in reversed order (next becomes previous) |
|
protected |
Returns the result group identifier of the given feature (for this at least one result must be created before)
|
protected |
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.
|
protected |
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.
|
protected |
synchronizes back references for the given object basing on the collected data
|
protectedvirtual |
Just removes all features without touching the document data (to be able undo)
|
protected |
Return object representing a folder or empty pointer.