X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelHighAPI%2FModelHighAPI_Dumper.h;h=8cb9c5457eb0998048ed12f93aa17d42eb70dbc5;hb=2cb8023bec0da9fc7b138da0a467bca74d4b825c;hp=c2fe0cd54de1bb6734d24f182989a7007e7ac565;hpb=6f213b9cc0ff018596fee19029d88ff8f8346025;p=modules%2Fshaper.git diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.h b/src/ModelHighAPI/ModelHighAPI_Dumper.h index c2fe0cd54..8cb9c5457 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.h +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.h @@ -54,12 +54,14 @@ class ModelAPI_CompositeFeature; class ModelAPI_Document; class ModelAPI_Entity; class ModelAPI_Feature; +class ModelAPI_Folder; class ModelAPI_Object; class ModelAPI_Result; typedef std::shared_ptr DocumentPtr; typedef std::shared_ptr EntityPtr; typedef std::shared_ptr FeaturePtr; +typedef std::shared_ptr FolderPtr; typedef std::shared_ptr ResultPtr; /**\class ModelHighAPI_Dumper @@ -84,6 +86,11 @@ public: /// Destructor virtual ~ModelHighAPI_Dumper() {} + /// Set/unset flag to dump selection attributes by geometrical properties: + /// inner point in the selected shape + void setSelectionByGeometry(bool theDumpByGeom = true) + { myGeometricalSelection = theDumpByGeom; } + /// Dump given document into the file /// \return \c true, if succeed MODELHIGHAPI_EXPORT @@ -116,6 +123,13 @@ public: virtual void dumpParameter(const FeaturePtr& theFeature) = 0; /// Dump given feature virtual void dumpFeature(const FeaturePtr& theFeature, const bool theForce = false) = 0; + /// Dump folder + virtual void dumpFolder(const FolderPtr& theFolder) = 0; + + /// Set feature postponed until all its dependencies are not dumped. + /// The name of the feature is stored anyway. + MODELHIGHAPI_EXPORT + void postpone(const EntityPtr& theEntity); /// Set a feature that should not be dumped anyway MODELHIGHAPI_EXPORT @@ -203,6 +217,10 @@ public: MODELHIGHAPI_EXPORT ModelHighAPI_Dumper& operator<<(const FeaturePtr& theEntity); + /// Dump folder + MODELHIGHAPI_EXPORT + ModelHighAPI_Dumper& operator<<(const FolderPtr& theFolder); + /// Dump result MODELHIGHAPI_EXPORT ModelHighAPI_Dumper& operator<<(const ResultPtr& theResult); @@ -244,6 +262,16 @@ public: /// clear list of not dumped entities MODELHIGHAPI_EXPORT void clearNotDumped(); + /// Check the entity is already dumped + MODELHIGHAPI_EXPORT + bool isDumped(const EntityPtr& theEntity) const; + /// Check theRefAttr is already dumped + MODELHIGHAPI_EXPORT + bool isDumped(const std::shared_ptr& theRefAttr) const; + /// Check all objects in theRefList are already dumped + MODELHIGHAPI_EXPORT + bool isDumped(const std::shared_ptr& theRefList) const; + protected: /// Dump "setName" command if last entity had user-defined name MODELHIGHAPI_EXPORT void dumpEntitySetName(); @@ -266,9 +294,6 @@ private: bool processSubs(const std::shared_ptr& theComposite, bool theDumpModelDo = false); - /// Check the entity is already dumped - bool isDumped(const EntityPtr& theEntity) const; - /// Stores names of results for the given feature void saveResultNames(const FeaturePtr& theFeature); @@ -281,6 +306,9 @@ private: /// Check the result feature has default transparency bool isDefaultTransparency(const ResultPtr& theResult) const; + /// Dump postponed entities + void dumpPostponed(bool theDumpFolders = false); + private: struct EntityName { std::string myCurrentName; ///< default name of current feature @@ -298,9 +326,9 @@ private: {} }; - typedef std::map EntityNameMap; - typedef std::map > ModulesMap; - typedef std::map > NbFeaturesMap; + typedef std::map EntityNameMap; + typedef std::map > ModulesMap; + typedef std::map > > NbFeaturesMap; struct LastDumpedEntity { EntityPtr myEntity; ///< last dumped entity @@ -309,7 +337,7 @@ private: std::list myResults; LastDumpedEntity(EntityPtr theEntity, bool theUserName, - const std::list& theResults) + const std::list& theResults = std::list()) : myEntity(theEntity), myUserName(theUserName), myResults(theResults) {} }; @@ -329,11 +357,17 @@ private: /// features which should not be dumped (like coincidence and tangency created by tangent arc) std::set myFeaturesToSkip; + std::list myPostponed; ///< list of postponed entities (sketch constraints or folders) + bool myDumpPostponedInProgress; ///< processing postponed is in progress + + bool myGeometricalSelection; ///< dump selection not by naming, but by coordinates of inner point + protected: - /// list of entities, used by other features but not dumped yet + /// list of entities, used by other features but not dumped yet std::set myNotDumpedEntities; friend class SketchAPI_Sketch; + friend class ModelHighAPI_Folder; }; #endif