20 #ifndef ModelAPI_Document_H_
21 #define ModelAPI_Document_H_
24 #include "ModelAPI_Entity.h"
58 virtual const std::string&
kind()
const = 0;
63 virtual void close(
const bool theForever =
false) = 0;
68 virtual std::shared_ptr<ModelAPI_Feature>
addFeature(std::string theID,
69 const bool theMakeCurrent =
true) = 0;
75 virtual void refsToFeature(std::shared_ptr<ModelAPI_Feature> theFeature,
76 std::set<std::shared_ptr<ModelAPI_Feature> >& theRefs,
77 const bool isSendError =
true) = 0;
81 virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
84 virtual void moveFeature(std::shared_ptr<ModelAPI_Feature> theMoved,
85 std::shared_ptr<ModelAPI_Feature> theAfterThis,
86 const bool theSplit =
false) = 0;
89 virtual const int id()
const = 0;
95 virtual std::shared_ptr<ModelAPI_Object>
object(
const std::string& theGroupID,
97 const bool theAllowFolder =
false) = 0;
103 virtual std::shared_ptr<ModelAPI_Object>
objectByName(
const std::string& theGroupID,
104 const std::wstring& theName) = 0;
110 virtual int index(std::shared_ptr<ModelAPI_Object> theObject,
111 const bool theAllowFolder =
false) = 0;
116 virtual int size(
const std::string& theGroupID,
const bool theAllowFolder =
false) = 0;
120 virtual std::shared_ptr<ModelAPI_Object>
parent(
121 const std::shared_ptr<ModelAPI_Object> theChild) = 0;
127 virtual std::shared_ptr<ModelAPI_Feature>
currentFeature(
const bool theVisible) = 0;
135 const bool theVisible) = 0;
154 const std::shared_ptr<ModelAPI_Data>& theFeatureData,
const int theIndex = 0) = 0;
157 const std::shared_ptr<ModelAPI_Data>& theFeatureData,
const int theIndex = 0) = 0;
160 const std::shared_ptr<ModelAPI_Data>& theFeatureData,
const int theIndex = 0) = 0;
162 virtual std::shared_ptr<ModelAPI_ResultPart>
copyPart(
163 const std::shared_ptr<ModelAPI_ResultPart>& theOrigin,
164 const std::shared_ptr<ModelAPI_Data>& theFeatureData,
const int theIndex = 0) = 0;
167 const std::shared_ptr<ModelAPI_Data>& theFeatureData,
const int theIndex = 0) = 0;
170 const std::shared_ptr<ModelAPI_Data>& theFeatureData,
const int theIndex = 0) = 0;
173 const std::shared_ptr<ModelAPI_Data>& theFeatureData,
const int theIndex = 0) = 0;
176 virtual std::shared_ptr<ModelAPI_Feature>
feature(
177 const std::shared_ptr<ModelAPI_Result>& theResult) = 0;
181 virtual std::list<std::shared_ptr<ModelAPI_Feature> >
allFeatures() = 0;
185 virtual std::list<std::shared_ptr<ModelAPI_Object> >
allObjects() = 0;
191 std::shared_ptr<ModelAPI_Feature> theAddBefore = std::shared_ptr<ModelAPI_Feature>()) = 0;
193 virtual void removeFolder(std::shared_ptr<ModelAPI_Folder> theFolder) = 0;
198 const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures) = 0;
203 const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures) = 0;
210 const std::shared_ptr<ModelAPI_Feature>& theFeature,
211 int& theIndexInFolder) = 0;
215 virtual bool moveToFolder(
const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
216 const std::shared_ptr<ModelAPI_Folder>& theFolder) = 0;
224 const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
225 const bool theBefore =
true) = 0;
237 std::shared_ptr<ModelAPI_Result> theResult,
238 const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
241 virtual bool isLater(std::shared_ptr<ModelAPI_Feature> theLater,
242 std::shared_ptr<ModelAPI_Feature> theCurrent)
const = 0;
261 MODELAPI_EXPORT
virtual std::shared_ptr<ModelAPI_Feature>
nextFeature(
262 std::shared_ptr<ModelAPI_Feature> theCurrent,
const bool theReverse =
false)
const = 0;
271 MODELAPI_EXPORT
virtual bool importPart(
const char* theFileName,
272 std::list<std::shared_ptr<ModelAPI_Feature> >& theImported,
273 bool theCheckOnly =
false) = 0;
278 MODELAPI_EXPORT
virtual bool save(
const char* theFilename,
279 const std::list<std::shared_ptr<ModelAPI_Feature> >& theExportFeatures)
const = 0;
286 MODELAPI_EXPORT
virtual void updateHistory(
const std::shared_ptr<ModelAPI_Object> theObject) = 0;
293 typedef std::shared_ptr<ModelAPI_Document> DocumentPtr;
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
General object of the application that allows to get/set attributes from the document and compute res...
Definition: ModelAPI_Data.h:73
Document for internal data structure of any object storage.
Definition: ModelAPI_Document.h:53
virtual void setActive(const bool theFlag)=0
Informs the document that it becomes active and some actions must be performed.
virtual std::list< std::shared_ptr< ModelAPI_Object > > allObjects()=0
Returns all objects of the document including the hidden features which are not in history.
virtual void removeFolder(std::shared_ptr< ModelAPI_Folder > theFolder)=0
Removes the folder from the document (all features in the folder will be kept).
virtual std::shared_ptr< ModelAPI_Folder > findFolderBelow(const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures)=0
Search a folder below the list of features applicable to store them (it means the list of features st...
virtual void close(const bool theForever=false)=0
Removes document data.
virtual std::shared_ptr< ModelAPI_Folder > findFolderAbove(const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures)=0
Search a folder above the list of features applicable to store them (it means the list of features st...
virtual ~ModelAPI_Document()
To virtually destroy the fields of successors.
Definition: ModelAPI_Document.cpp:22
virtual std::shared_ptr< ModelAPI_Feature > internalFeature(const int theIndex)=0
Returns the feature by zero-based index: features in the history or not.
virtual const int id() const =0
! Returns the id of the document
virtual void updateHistory(const std::string theGroup)=0
Internally makes document know that feature was removed or added in history after creation.
virtual bool isOpened()=0
Returns true if document is opened and valid.
virtual void eraseAllFeatures()=0
Just removes all features without touching the document data (to be able undo)
virtual std::shared_ptr< ModelAPI_ResultField > createField(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)=0
Creates a field result.
virtual void moveFeature(std::shared_ptr< ModelAPI_Feature > theMoved, std::shared_ptr< ModelAPI_Feature > theAfterThis, const bool theSplit=false)=0
Moves the feature to make it after the given one in the history.
virtual bool removeFromFolder(const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures, const bool theBefore=true)=0
Remove features from the folder.
virtual std::list< std::shared_ptr< ModelAPI_Feature > > allFeatures()=0
Returns all features of the document including the hidden features which are not in history.
virtual std::shared_ptr< ModelAPI_Feature > producedByFeature(std::shared_ptr< ModelAPI_Result > theResult, const std::shared_ptr< GeomAPI_Shape > &theShape)=0
Returns the feature that produced the given face of the given result.
virtual void synchronizeTransactions()=0
Performs synchronization of transactions with the module document: If some document is not active (by...
virtual std::shared_ptr< ModelAPI_ResultPart > copyPart(const std::shared_ptr< ModelAPI_ResultPart > &theOrigin, const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)=0
Copies a part result, keeping the reference to the origin.
virtual bool save(const char *theFilename, const std::list< std::shared_ptr< ModelAPI_Feature > > &theExportFeatures) const =0
Export the list of features to the file.
virtual std::shared_ptr< ModelAPI_Folder > addFolder(std::shared_ptr< ModelAPI_Feature > theAddBefore=std::shared_ptr< ModelAPI_Feature >())=0
Creates a folder (group of the features in the object browser)
virtual std::shared_ptr< ModelAPI_ResultBody > createBody(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)=0
Creates a body result.
virtual std::shared_ptr< ModelAPI_Feature > addFeature(std::string theID, const bool theMakeCurrent=true)=0
Adds to the document the new feature of the given feature id.
ModelAPI_Document()
Only for SWIG wrapping it is here.
Definition: ModelAPI_Document.cpp:27
virtual std::shared_ptr< ModelAPI_ResultConstruction > createConstruction(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)=0
Creates a construction result.
virtual std::shared_ptr< ModelAPI_Feature > nextFeature(std::shared_ptr< ModelAPI_Feature > theCurrent, const bool theReverse=false) const =0
Returns the next (from the history point of view) feature, any: invisible or disabled.
virtual int size(const std::string &theGroupID, const bool theAllowFolder=false)=0
Returns the number of objects in the group of objects.
virtual std::shared_ptr< ModelAPI_ResultGroup > createGroup(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)=0
Creates a group result.
virtual std::shared_ptr< ModelAPI_ResultPart > createPart(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)=0
Creates a part result.
virtual void storeNodesState(const std::list< bool > &theStates)=0
Stores in the document boolean flags: states of the nodes in the object browser.
virtual std::shared_ptr< ModelAPI_Object > object(const std::string &theGroupID, const int theIndex, const bool theAllowFolder=false)=0
Returns the object in the group by the index (started from zero)
virtual const std::string & kind() const =0
Returns the kind of the document: "PartSet", "Part", or something else.
virtual std::shared_ptr< ModelAPI_ResultParameter > createParameter(const std::shared_ptr< ModelAPI_Data > &theFeatureData, const int theIndex=0)=0
Creates a parameter result.
virtual void restoreNodesState(std::list< bool > &theStates) const =0
Returns the stored nodes states.
virtual bool isActive() const =0
Returns true if this document is currently active.
virtual void refsToFeature(std::shared_ptr< ModelAPI_Feature > theFeature, std::set< std::shared_ptr< ModelAPI_Feature > > &theRefs, const bool isSendError=true)=0
Return a list of features, which refers to the feature.
virtual bool moveToFolder(const std::list< std::shared_ptr< ModelAPI_Feature > > &theFeatures, const std::shared_ptr< ModelAPI_Folder > &theFolder)=0
Add a list of features to the folder.
virtual bool isLater(std::shared_ptr< ModelAPI_Feature > theLater, std::shared_ptr< ModelAPI_Feature > theCurrent) const =0
Returns true if theLater is in history of features creation later than theCurrent.
virtual void updateHistory(const std::shared_ptr< ModelAPI_Object > theObject)=0
Internally makes document know that feature was removed or added in history after creation.
virtual std::shared_ptr< ModelAPI_Feature > feature(const std::shared_ptr< ModelAPI_Result > &theResult)=0
Returns a feature by result (owner of result)
virtual std::shared_ptr< ModelAPI_Feature > currentFeature(const bool theVisible)=0
Returns the feature that is currently edited in this document, normally this is the latest created fe...
virtual int numInternalFeatures()=0
Returns the number of all features: in the history or not.
virtual void removeFeature(std::shared_ptr< ModelAPI_Feature > theFeature)=0
Removes the feature from the document.
virtual std::shared_ptr< ModelAPI_Object > objectByName(const std::string &theGroupID, const std::wstring &theName)=0
Returns the first found object in the group by the object name.
virtual int index(std::shared_ptr< ModelAPI_Object > theObject, const bool theAllowFolder=false)=0
Returns the object index in the group.
virtual void setCurrentFeature(std::shared_ptr< ModelAPI_Feature > theCurrent, const bool theVisible)=0
Sets the current feature: all features below will be disabled, new features will be appended after th...
virtual std::shared_ptr< ModelAPI_Object > parent(const std::shared_ptr< ModelAPI_Object > theChild)=0
Returns the parent object of this child.
virtual bool importPart(const char *theFileName, std::list< std::shared_ptr< ModelAPI_Feature > > &theImported, bool theCheckOnly=false)=0
Loads the OCAF document from the file into the current document.
virtual void setCurrentFeatureUp()=0
Makes the current feature one feature upper.
virtual std::shared_ptr< ModelAPI_Folder > findContainingFolder(const std::shared_ptr< ModelAPI_Feature > &theFeature, int &theIndexInFolder)=0
Search a folder containing the given feature.
Represents a common parent class for Objects and documents.
Definition: ModelAPI_Entity.h:32
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:41
Folder feature (groups the features).
Definition: ModelAPI_Folder.h:31
Represents any object in the data model and in the object browser.
Definition: ModelAPI_Object.h:45
The body (shape) result of a feature.
Definition: ModelAPI_ResultBody.h:43
The construction element result of a feature.
Definition: ModelAPI_ResultConstruction.h:37
The fields result.
Definition: ModelAPI_ResultField.h:35
The groups result.
Definition: ModelAPI_ResultGroup.h:35
The construction element result of a feature.
Definition: ModelAPI_ResultParameter.h:34
The Part document, result of a creation of new part feature.
Definition: ModelAPI_ResultPart.h:37
The result of a feature.
Definition: ModelAPI_Result.h:37