-// Copyright (C) 2016-20xx CEA/DEN, EDF R&D -->
-
-// File: ModelHighAPI_Dumper.h
-// Created: 1 August 2016
-// Author: Artem ZHIDKOV
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
#ifndef ModelHighAPI_Dumper_H_
#define ModelHighAPI_Dumper_H_
class ModelAPI_AttributeSelection;
class ModelAPI_AttributeSelectionList;
class ModelAPI_AttributeString;
+class ModelAPI_AttributeStringArray;
class ModelAPI_CompositeFeature;
class ModelAPI_Document;
class ModelAPI_Entity;
/// Add module to list of imported modules
/// \param theModuleName name of the module to be imported
- /// \param theObject name of the entity to be imported from the module (if empty, while module will be imported)
+ /// \param theObject name of the entity to be imported
+ /// from the module (if empty, while module will be imported)
MODELHIGHAPI_EXPORT
void importModule(const std::string& theModuleName,
const std::string& theObject = std::string());
/// Returns name of specified entity
/// \param theEntity [in] named entity
- /// \param theSaveNotDumped [in] if \c true, the entity should be stored as not dumped (will be dumped automatically)
- /// \param theUseEntityName [in] if \c true, the entity name should be used "as is" without changing default name
+ /// \param theSaveNotDumped [in]
+ /// if \c true, the entity should be stored as not dumped (will be dumped automatically)
+ /// \param theUseEntityName [in]
+ /// if \c true, the entity name should be used "as is" without changing default name
/// \return name of the entity
MODELHIGHAPI_EXPORT
- const std::string& name(const EntityPtr& theEntity, bool theSaveNotDumped = true, bool theUseEntityName = false);
+ const std::string& name(const EntityPtr& theEntity, bool theSaveNotDumped = true,
+ bool theUseEntityName = false);
/// Returns name of parent composite feature for specified entity
MODELHIGHAPI_EXPORT
/// Dump given feature
virtual void dumpFeature(const FeaturePtr& theFeature, const bool theForce = false) = 0;
+ /// Set a feature that should not be dumped anyway
+ MODELHIGHAPI_EXPORT
+ void doNotDumpFeature(const FeaturePtr& theFeature)
+ { myFeaturesToSkip.insert(theFeature); }
+
/// Dump sub-feature name and color, without dumping feature creation.
/// Used for features which creates sub-features in their execute method.
/// \param theSubFeatureGet [in] method for getting sub-feature (e.g. "Feature_1.subFeature(0)")
friend
MODELHIGHAPI_EXPORT
ModelHighAPI_Dumper& operator<<(ModelHighAPI_Dumper& theDumper,
- std::basic_ostream<char>& (*theEndl)(std::basic_ostream<char>&));
+ std::basic_ostream<char>& (*theEndl)(std::basic_ostream<char>&));
/// Dump GeomAPI_Pnt in the following form:
/// "GeomAPI_Pnt(X, Y, Z)"
ModelHighAPI_Dumper& operator<<(const ResultPtr& theResult);
/// Dump Attribute
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_Attribute>& theAttr);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_Attribute>& theAttr);
/// Dump Object
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_Object>& theObject);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_Object>& theObject);
/// Dump AttributeRefAttr
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttr>& theRefAttr);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttr>& theRefAttr);
/// Dump AttributeRefAttrList as follows:
/// "[obj1, obj2, obj3, ...]"
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttrList>& theRefAttrList);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttrList>& theRefAttrList);
/// Dump AttributeRefList as follows:
/// "[obj1, obj2, obj3, ...]"
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeRefList>& theRefList);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeRefList>& theRefList);
/// Dump AttributeSelection
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeSelection>& theAttrSelect);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeSelection>& theAttrSelect);
/// Dump AttributeSelectionList
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeSelectionList>& theAttrSelList);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeSelectionList>& theAttrSelList);
/// Dump AttributeReference
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeReference>& theReference);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeReference>& theReference);
+ /// Dump AttributeStringArray
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeStringArray>& theArray);
/// Clear dump buffer
MODELHIGHAPI_EXPORT
bool process(const std::shared_ptr<ModelAPI_Document>& theDoc);
/// Dump composite feature and all it sub-features
- bool process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite, bool isForce = false);
+ bool process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
+ bool isForce = false);
/// Iterate all features in composite feature and dump them into intermediate buffer
/// \param theComposite [in] parent composite feature
/// \param theDumpModelDo [in] shows that command "model.do()" should be written at the end
MODELHIGHAPI_EXPORT
- bool processSubs(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite, bool theDumpModelDo = false);
+ bool processSubs(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
+ bool theDumpModelDo = false);
/// Check the entity is already dumped
bool isDumped(const EntityPtr& theEntity) const;
std::string myCurrentName; ///< default name of current feature
std::string myUserName; ///< user-defined name
bool myIsDefault; ///< \c true if the name is default
+ bool myIsDumped; ///< shows that the names of the feature are already stored
EntityName() {}
EntityName(const std::string& theCurName, const std::string& theUserName, bool theDefault)
- : myCurrentName(theCurName), myUserName(theUserName), myIsDefault(theDefault)
+ : myCurrentName(theCurName),
+ myUserName(theUserName),
+ myIsDefault(theDefault),
+ myIsDumped(false)
{}
};
struct LastDumpedEntity {
EntityPtr myEntity; ///< last dumped entity
bool myUserName; ///< the entity hase user-defined name
- std::list<ResultPtr> myResults; ///< results of this entity, which has user-defined names or specific colors
+ /// results of this entity, which has user-defined names or specific colors
+ std::list<ResultPtr> myResults;
- LastDumpedEntity(EntityPtr theEntity, bool theUserName, const std::list<ResultPtr>& theResults)
+ LastDumpedEntity(EntityPtr theEntity, bool theUserName,
+ const std::list<ResultPtr>& theResults)
: myEntity(theEntity), myUserName(theUserName), myResults(theResults)
{}
};
NbFeaturesMap myFeatureCount; ///< number of features of each kind
+ /// features which should not be dumped (like coincidence and tangency created by tangent arc)
+ std::set<FeaturePtr> myFeaturesToSkip;
+
protected:
- std::set<EntityPtr> myNotDumpedEntities; ///< list of entities, used by other features but not dumped yet
+ /// list of entities, used by other features but not dumped yet
+ std::set<EntityPtr> myNotDumpedEntities;
friend class SketchAPI_Sketch;
};