myReal = TDataStd_Real::Set(theLabel, 0.);
}
}
-
Handle(TDataStd_Comment) aFeatureID;
if (theLabel.FindAttribute(TDataStd_Comment::GetID(), aFeatureID)) {
string anID(TCollection_AsciiString(aFeatureID->Get()).ToCString());
- std::shared_ptr<ModelAPI_Feature> aResult = Model_PluginManager::get()->createFeature(anID);
+ std::shared_ptr<ModelAPI_Feature> aResult =
+ Model_PluginManager::get()->createFeature(anID, false);
std::shared_ptr<Model_Object> aData(new Model_Object);
aData->setLabel(theLabel);
aResult->setData(aData);
static Model_PluginManager* myImpl = new Model_PluginManager();
-std::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theFeatureID)
+std::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(
+ string theFeatureID, const bool theAddToDoc)
{
if (this != myImpl) return myImpl->createFeature(theFeatureID);
}
if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) {
std::shared_ptr<ModelAPI_Feature> aCreated =
- myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);
+ myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID, theAddToDoc);
return aCreated;
}
}
std::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
public:
/// Creates the feature object using plugins functionality
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> createFeature(
+ std::string theFeatureID, const bool theAddToDoc = true);
/// Returns the root document of the application (that may contains sub-documents)
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> rootDocument();
#include "ModelAPI_Attribute.h"
#include "ModelAPI_AttributeDocRef.h"
#include "ModelAPI_AttributeDouble.h"
+ #include "ModelAPI_Iterator.h"
%}
// to avoid error on this
%shared_ptr(ModelAPI_Attribute)
%shared_ptr(ModelAPI_AttributeDocRef)
%shared_ptr(ModelAPI_AttributeDouble)
+%shared_ptr(ModelAPI_Iterator)
// all supported interfaces
%include "ModelAPI_Document.h"
%include "ModelAPI_Attribute.h"
%include "ModelAPI_AttributeDocRef.h"
%include "ModelAPI_AttributeDouble.h"
+%include "ModelAPI_Iterator.h"
{
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+ virtual std::shared_ptr<ModelAPI_Feature> createFeature(
+ std::string theFeatureID, const bool theAddToDoc) = 0;
protected:
/// Is needed for python wrapping by swig
{
public:
/// Creates the feature object using plugins functionality
- virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+ virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID,
+ const bool theAddToDoc = true) = 0;
/// Returns the real implementation (the alone instance per application) of the plugin manager
static std::shared_ptr<ModelAPI_PluginManager> get();
ModelAPI_PluginManager::get()->registerPlugin(this);
}
-std::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
+std::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(
+ string theFeatureID, const bool theAddToDoc)
{
std::shared_ptr<ModelAPI_Feature> aCreated;
bool isCurrent = true; // to create a feature in the current document
}
// add to a root document for the current moment
- if (aCreated) {
+ if (aCreated && theAddToDoc) {
shared_ptr<ModelAPI_Document> aDoc = isCurrent ?
ModelAPI_PluginManager::get()->currentDocument() :
ModelAPI_PluginManager::get()->rootDocument();
{
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+ virtual std::shared_ptr<ModelAPI_Feature> createFeature(
+ std::string theFeatureID, const bool theAddToDoc);
public:
/// Is needed for python wrapping by swig