ModelAPI_PluginManager::get()->registerPlugin(this);
}
-boost::shared_ptr<ModelAPI_Feature> ConstructionPlugin_Plugin::createFeature(string theFeatureID)
+FeaturePtr ConstructionPlugin_Plugin::createFeature(string theFeatureID)
{
if (theFeatureID == "Point") {
- return boost::shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Point);
+ return FeaturePtr(new ConstructionPlugin_Point);
} else if (theFeatureID == "Extrusion") {
- return boost::shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Extrusion);
+ return FeaturePtr(new ConstructionPlugin_Extrusion);
}
// feature of such kind is not found
- return boost::shared_ptr<ModelAPI_Feature>();
+ return FeaturePtr();
}
#include "ConstructionPlugin.h"
#include "ModelAPI_Plugin.h"
+#include "ModelAPI_Feature.h"
class CONSTRUCTIONPLUGIN_EXPORT ConstructionPlugin_Plugin: public ModelAPI_Plugin
{
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+ virtual FeaturePtr createFeature(std::string theFeatureID);
public:
/// Is needed for python wrapping by swig
boost::shared_ptr<ModelAPI_Attribute> Model_AttributeRefAttr::attr()
{
- boost::shared_ptr<ModelAPI_Feature> aFeature = feature();
+ FeaturePtr aFeature = feature();
if (aFeature) {
boost::shared_ptr<Model_Data> aData =
boost::dynamic_pointer_cast<Model_Data>(aFeature->data());
return boost::shared_ptr<ModelAPI_Attribute>();
}
-void Model_AttributeRefAttr::setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature)
+void Model_AttributeRefAttr::setFeature(FeaturePtr theFeature)
{
if (myID->Get().Length() != 0 || feature() != theFeature) {
boost::shared_ptr<Model_Data> aData =
}
}
-boost::shared_ptr<ModelAPI_Feature> Model_AttributeRefAttr::feature()
+FeaturePtr Model_AttributeRefAttr::feature()
{
if (myRef->Get() != myRef->Label()) { // initialized
boost::shared_ptr<Model_Document> aDoc =
}
}
// not initialized
- return boost::shared_ptr<ModelAPI_Feature>();
+ return FeaturePtr();
}
Model_AttributeRefAttr::Model_AttributeRefAttr(TDF_Label& theLabel)
MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Attribute> attr();
/// Defines the reference to the feature
- MODEL_EXPORT virtual void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ MODEL_EXPORT virtual void setFeature(FeaturePtr theFeature);
/// Returns feature referenced from this attribute
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> feature();
+ MODEL_EXPORT virtual FeaturePtr feature();
protected:
/// Objects are created for features automatically
using namespace std;
-void Model_AttributeRefList::append(boost::shared_ptr<ModelAPI_Feature> theFeature)
+void Model_AttributeRefList::append(FeaturePtr theFeature)
{
boost::shared_ptr<Model_Data> aData =
boost::dynamic_pointer_cast<Model_Data>(theFeature->data());
Events_Loop::loop()->send(aMsg);
}
-void Model_AttributeRefList::remove(boost::shared_ptr<ModelAPI_Feature> theFeature)
+void Model_AttributeRefList::remove(FeaturePtr theFeature)
{
boost::shared_ptr<Model_Data> aData =
boost::dynamic_pointer_cast<Model_Data>(theFeature->data());
return myRef->Extent();
}
-list<boost::shared_ptr<ModelAPI_Feature> > Model_AttributeRefList::list()
+list<FeaturePtr > Model_AttributeRefList::list()
{
- std::list< boost::shared_ptr<ModelAPI_Feature> > aResult;
+ std::list< FeaturePtr > aResult;
boost::shared_ptr<Model_Document> aDoc =
boost::dynamic_pointer_cast<Model_Document>(owner()->document());
if (aDoc) {
#include "Model.h"
#include "ModelAPI_AttributeRefList.h"
+#include "ModelAPI_Feature.h"
+
#include <TDataStd_ReferenceList.hxx>
/**\class Model_AttributeRefList
Handle_TDataStd_ReferenceList myRef; ///< references to the features labels
public:
/// Appends the feature to the end of a list
- MODEL_EXPORT virtual void append(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ MODEL_EXPORT virtual void append(FeaturePtr theFeature);
/// Erases the first meet of the feature in the list
- MODEL_EXPORT virtual void remove(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ MODEL_EXPORT virtual void remove(FeaturePtr theFeature);
/// Returns number of features in the list
MODEL_EXPORT virtual int size();
/// Returns the list of features
- MODEL_EXPORT virtual std::list<boost::shared_ptr<ModelAPI_Feature> > list();
+ MODEL_EXPORT virtual std::list<FeaturePtr > list();
protected:
/// Objects are created for features automatically
using namespace std;
-void Model_AttributeReference::setValue(boost::shared_ptr<ModelAPI_Feature> theFeature)
+void Model_AttributeReference::setValue(FeaturePtr theFeature)
{
if (value() != theFeature) {
boost::shared_ptr<Model_Data> aData =
}
}
-boost::shared_ptr<ModelAPI_Feature> Model_AttributeReference::value()
+FeaturePtr Model_AttributeReference::value()
{
if (!myRef.IsNull()) {
boost::shared_ptr<Model_Document> aDoc =
}
}
// not initialized
- return boost::shared_ptr<ModelAPI_Feature>();
+ return FeaturePtr();
}
Model_AttributeReference::Model_AttributeReference(TDF_Label& theLabel)
#include "Model.h"
#include "ModelAPI_AttributeReference.h"
+#include <ModelAPI_Feature.h>
#include <TDF_Label.hxx>
#include <TDF_Reference.hxx>
Handle_TDF_Reference myRef; ///< references to the feature label
public:
/// Defines the feature referenced from this attribute
- MODEL_EXPORT virtual void setValue(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ MODEL_EXPORT virtual void setValue(FeaturePtr theFeature);
/// Returns feature referenced from this attribute
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> value();
+ MODEL_EXPORT virtual FeaturePtr value();
protected:
/// Objects are created for features automatically
#include "Model.h"
#include <ModelAPI_Data.h>
+#include <ModelAPI_Feature.h>
#include <TDF_Label.hxx>
#include <map>
class ModelAPI_Attribute;
-class ModelAPI_Feature;
/**\class Model_Data
* \ingroup DataModel
std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> > myAttrs;
/// needed here to emit signal that feature changed on change of the attribute
- boost::shared_ptr<ModelAPI_Feature> myFeature;
+ FeaturePtr myFeature;
Model_Data();
MODEL_EXPORT void setLabel(TDF_Label& theLab);
/// Sets the feature of this data
- MODEL_EXPORT virtual void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature)
+ MODEL_EXPORT virtual void setFeature(FeaturePtr theFeature)
{myFeature = theFeature;}
};
subDocument(*aSubIter)->redo();
}
-boost::shared_ptr<ModelAPI_Feature> Model_Document::addFeature(string theID)
+FeaturePtr Model_Document::addFeature(string theID)
{
- boost::shared_ptr<ModelAPI_Feature> aFeature =
+ FeaturePtr aFeature =
ModelAPI_PluginManager::get()->createFeature(theID);
if (aFeature) {
boost::dynamic_pointer_cast<Model_Document>(aFeature->documentToAdd())->addFeature(aFeature);
}
}
-void Model_Document::addFeature(const boost::shared_ptr<ModelAPI_Feature> theFeature)
+void Model_Document::addFeature(const FeaturePtr theFeature)
{
if (theFeature->isAction()) return; // do not add action to the data model
return aResult;
}
-void Model_Document::removeFeature(boost::shared_ptr<ModelAPI_Feature> theFeature)
+void Model_Document::removeFeature(FeaturePtr theFeature)
{
boost::shared_ptr<Model_Data> aData = boost::static_pointer_cast<Model_Data>(theFeature->data());
TDF_Label aFeatureLabel = aData->label();
int aRemovedIndex = RemoveFromRefArray(aGroupLabel, aFeatureLabel);
RemoveFromRefArray(aGroupLabel.FindChild(1), TDF_Label(), aRemovedIndex);
// remove feature from the myFeatures list
- std::vector<boost::shared_ptr<ModelAPI_Feature> >::iterator aFIter = myFeatures.begin();
+ std::vector<FeaturePtr >::iterator aFIter = myFeatures.begin();
while(aFIter != myFeatures.end()) {
if (*aFIter == theFeature) {
aFIter = myFeatures.erase(aFIter);
Events_Loop::loop()->send(aMsg);
}
-boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(TDF_Label& theLabel)
+FeaturePtr Model_Document::feature(TDF_Label& theLabel)
{
// iterate all features, may be optimized later by keeping labels-map
- vector<boost::shared_ptr<ModelAPI_Feature> >::iterator aFIter = myFeatures.begin();
+ vector<FeaturePtr >::iterator aFIter = myFeatures.begin();
for(; aFIter != myFeatures.end(); aFIter++) {
boost::shared_ptr<Model_Data> aData =
boost::dynamic_pointer_cast<Model_Data>((*aFIter)->data());
if (aData->label().IsEqual(theLabel))
return *aFIter;
}
- return boost::shared_ptr<ModelAPI_Feature>(); // not found
+ return FeaturePtr(); // not found
}
boost::shared_ptr<ModelAPI_Document> Model_Document::subDocument(string theDocID)
return Model_Application::getApplication()->getDocument(theDocID);
}
-boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(
+FeaturePtr Model_Document::feature(
const string& theGroupID, const int theIndex, const bool isOperation)
{
TDF_Label aGroupLab = groupLabel(theGroupID);
if (aGroupLab.FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) {
if (aRefs->Lower() <= theIndex && aRefs->Upper() >= theIndex) {
TDF_Label aFeatureLab = aRefs->Value(theIndex);
- boost::shared_ptr<ModelAPI_Feature> aFeature = feature(aFeatureLab);
+ FeaturePtr aFeature = feature(aFeatureLab);
if (theGroupID == FEATURES_GROUP || isOperation) { // just returns the feature from the history
return aFeature;
}
// not found
- return boost::shared_ptr<ModelAPI_Feature>();
+ return FeaturePtr();
}
int Model_Document::size(const string& theGroupID)
return aNew;
}
-void Model_Document::setUniqueName(boost::shared_ptr<ModelAPI_Feature> theFeature)
+void Model_Document::setUniqueName(FeaturePtr theFeature)
{
string aName; // result
// iterate all features but also iterate group of this feature if object is not in history
}
//! Returns the object by the feature
-boost::shared_ptr<ModelAPI_Feature> Model_Document::objectByFeature(
- const boost::shared_ptr<ModelAPI_Feature> theFeature)
+FeaturePtr Model_Document::objectByFeature(
+ const FeaturePtr theFeature)
{
for(int a = 0; a < size(theFeature->getGroup()); a++) {
boost::shared_ptr<Model_Object> anObj =
return anObj;
}
}
- return boost::shared_ptr<ModelAPI_Feature>(); // not found
+ return FeaturePtr(); // not found
}
void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
{
boost::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
// update features
- vector<boost::shared_ptr<ModelAPI_Feature> >::iterator aFIter = myFeatures.begin();
+ vector<FeaturePtr >::iterator aFIter = myFeatures.begin();
// and in parallel iterate labels of features
TDF_ChildIDIterator aFLabIter(groupLabel(FEATURES_GROUP), TDataStd_Comment::GetID());
while(aFIter != myFeatures.end() || aFLabIter.More()) {
Events_Loop::loop()->send(aMsg2);
} else if (aDSTag < aFeatureTag) { // a new feature is inserted
// create a feature
- boost::shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(
+ FeaturePtr aFeature = ModelAPI_PluginManager::get()->createFeature(
TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(
aFLabIter.Value())->Get()).ToCString());
static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_CREATED);
Model_FeatureUpdatedMessage aMsg1(aFeature, anEvent);
Events_Loop::loop()->send(aMsg1);
- boost::shared_ptr<ModelAPI_Feature> anObj = objectByFeature(aFeature);
+ FeaturePtr anObj = objectByFeature(aFeature);
if (anObj) {
Model_FeatureUpdatedMessage aMsg2(anObj, anEvent);
Events_Loop::loop()->send(aMsg2);
#include <Model.h>
#include <ModelAPI_Document.h>
+#include <ModelAPI_Feature.h>
#include <TDocStd_Document.hxx>
#include <map>
//! Adds to the document the new feature of the given feature id
//! \param creates feature and puts it in the document
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
+ MODEL_EXPORT virtual FeaturePtr addFeature(std::string theID);
//! Removes the feature from the document
- MODEL_EXPORT virtual void removeFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ MODEL_EXPORT virtual void removeFeature(FeaturePtr theFeature);
//! Returns the existing feature by the label
//! \param theLabel base label of the feature
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> feature(TDF_Label& theLabel);
+ MODEL_EXPORT virtual FeaturePtr feature(TDF_Label& theLabel);
//! Adds a new sub-document by the identifier, or returns existing one if it is already exist
MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID);
//! \param theGroupID group that contains a feature
//! \param theIndex zero-based index of feature in the group
//! \param isOperation if it is true, returns feature (not Object)
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature>
+ MODEL_EXPORT virtual FeaturePtr
feature(const std::string& theGroupID, const int theIndex, const bool isOperation = false);
//! Returns the number of features in the group
//! Initializes feature with a unique name in this group (unique name is generated as
//! feature type + "_" + index
- void setUniqueName(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ void setUniqueName(FeaturePtr theFeature);
//! Adds to the document the new feature
- void addFeature(const boost::shared_ptr<ModelAPI_Feature> theFeature);
+ void addFeature(const FeaturePtr theFeature);
//! Returns the object by the feature
- boost::shared_ptr<ModelAPI_Feature> objectByFeature(
- const boost::shared_ptr<ModelAPI_Feature> theFeature);
+ FeaturePtr objectByFeature(
+ const FeaturePtr theFeature);
//! Synchronizes myFeatures list with the updated document
void synchronizeFeatures(const bool theMarkUpdated = false);
/// number of nested transactions performed (or -1 if not nested)
int myNestedNum;
/// All features managed by this document (not only in history of OB)
- std::vector<boost::shared_ptr<ModelAPI_Feature> > myFeatures;
+ std::vector<FeaturePtr > myFeatures;
///< set of identifiers of sub-documents of this document
std::set<std::string> mySubs;
#include <string>
#include <set>
-class ModelAPI_Feature;
+#include "ModelAPI_Feature.h"
+
class ModelAPI_Document;
/// Event ID that feature is created (comes with Model_FeatureUpdatedMessage)
/// Message that feature was changed (used for Object Browser update): moved, updated and deleted
class Model_FeatureUpdatedMessage : public Events_MessageGroup {
- std::set<boost::shared_ptr<ModelAPI_Feature> > myFeatures; ///< which feature is changed
+ std::set<FeaturePtr > myFeatures; ///< which feature is changed
public:
/// sender is not important, all information is located in the feature
Model_FeatureUpdatedMessage(
- const boost::shared_ptr<ModelAPI_Feature>& theFeature,
+ const FeaturePtr& theFeature,
const Events_ID& theEvent) : Events_MessageGroup(theEvent, 0)
{if (theFeature) myFeatures.insert(theFeature);}
/// Returns the feature that has been updated
- std::set<boost::shared_ptr<ModelAPI_Feature> > features() const {return myFeatures;}
+ std::set<FeaturePtr > features() const {return myFeatures;}
//! Creates a new empty group (to store it in the loop before flush)
virtual Events_MessageGroup* newEmpty() {
- boost::shared_ptr<ModelAPI_Feature> anEmptyFeature;
+ FeaturePtr anEmptyFeature;
return new Model_FeatureUpdatedMessage(anEmptyFeature, eventID());
}
//! Allows to join the given message with the current one
virtual void Join(Events_MessageGroup& theJoined) {
Model_FeatureUpdatedMessage* aJoined = dynamic_cast<Model_FeatureUpdatedMessage*>(&theJoined);
- std::set<boost::shared_ptr<ModelAPI_Feature> >::iterator aFIter = aJoined->myFeatures.begin();
+ std::set<FeaturePtr >::iterator aFIter = aJoined->myFeatures.begin();
for(; aFIter != aJoined->myFeatures.end(); aFIter++) {
myFeatures.insert(*aFIter);
}
#include "Model_Events.h"
#include <Events_Loop.h>
-boost::shared_ptr<ModelAPI_Feature> Model_Object::featureRef()
+FeaturePtr Model_Object::featureRef()
{
return myRef;
}
}
}
-Model_Object::Model_Object(boost::shared_ptr<ModelAPI_Feature> theRef,
+Model_Object::Model_Object(FeaturePtr theRef,
Handle_TDataStd_Name theName)
: myRef(theRef), myName(theName)
{
*/
class Model_Object : public ModelAPI_Object
{
- boost::shared_ptr<ModelAPI_Feature> myRef; ///< the referenced feature
+ FeaturePtr myRef; ///< the referenced feature
Handle_TDataStd_Name myName; ///< the name of this object that may be changed
public:
/// Reference to the feature-operation that produces this object
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> featureRef();
+ MODEL_EXPORT virtual FeaturePtr featureRef();
/// Returns the name of this object (by default equal to the name of feature)
MODEL_EXPORT virtual std::string getName();
{return myRef->document();}
/// Returns true if feature refers to the same model data instance
- MODEL_EXPORT virtual bool isSame(const boost::shared_ptr<ModelAPI_Feature>& theFeature)
+ MODEL_EXPORT virtual bool isSame(const FeaturePtr& theFeature)
{
boost::shared_ptr<Model_Object> anObj = boost::dynamic_pointer_cast<Model_Object>(theFeature);
return anObj && myRef == anObj->myRef;
private:
/// Constructor fully defines this object
- Model_Object(boost::shared_ptr<ModelAPI_Feature> theRef, Handle_TDataStd_Name theName);
+ Model_Object(FeaturePtr theRef, Handle_TDataStd_Name theName);
friend class Model_Document;
};
static Model_PluginManager* myImpl = new Model_PluginManager();
-boost::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theFeatureID)
+FeaturePtr Model_PluginManager::createFeature(string theFeatureID)
{
if (this != myImpl) return myImpl->createFeature(theFeatureID);
Config_ModuleReader::loadLibrary(myCurrentPluginName);
}
if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) {
- boost::shared_ptr<ModelAPI_Feature> aCreated =
+ FeaturePtr aCreated =
myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);
if (!aCreated) {
Events_Error::send(string("Can not initialize feature '") + theFeatureID +
}
}
- return boost::shared_ptr<ModelAPI_Feature>(); // return nothing
+ return FeaturePtr(); // return nothing
}
boost::shared_ptr<ModelAPI_Document> Model_PluginManager::rootDocument()
#include "Model.h"
#include <ModelAPI_PluginManager.h>
+#include <ModelAPI_Feature.h>
+
#include <Events_Listener.h>
#include <map>
void LoadPluginsInfo();
/// Creates the feature object using plugins functionality
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+ virtual FeaturePtr createFeature(std::string theFeatureID);
};
#endif
#define ModelAPI_AttributeRefAttr_HeaderFile
#include "ModelAPI_Attribute.h"
+#include "ModelAPI_Feature.h"
/**\class ModelAPI_AttributeRefAttr
* \ingroup DataModel
MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Attribute> attr() = 0;
/// Defines the reference to the feature
- MODELAPI_EXPORT virtual void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
+ MODELAPI_EXPORT virtual void setFeature(FeaturePtr theFeature) = 0;
/// Returns feature referenced from this attribute
- MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> feature() = 0;
+ MODELAPI_EXPORT virtual FeaturePtr feature() = 0;
/// Returns the type of this class of attributes
MODELAPI_EXPORT static std::string type() {return "RefAttr";}
#define ModelAPI_AttributeRefList_HeaderFile
#include "ModelAPI_Attribute.h"
+#include "ModelAPI_Feature.h"
#include <list>
/**\class ModelAPI_AttributeRefList
MODELAPI_EXPORT virtual std::string attributeType() {return type();}
/// Appends the feature to the end of a list
- MODELAPI_EXPORT virtual void append(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
+ MODELAPI_EXPORT virtual void append(FeaturePtr theFeature) = 0;
/// Erases the first meet of the feature in the list
- MODELAPI_EXPORT virtual void remove(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
+ MODELAPI_EXPORT virtual void remove(FeaturePtr theFeature) = 0;
/// Returns number of features in the list
MODELAPI_EXPORT virtual int size() = 0;
/// Returns the list of features
- MODELAPI_EXPORT virtual std::list<boost::shared_ptr<ModelAPI_Feature> > list() = 0;
+ MODELAPI_EXPORT virtual std::list<FeaturePtr > list() = 0;
protected:
/// Objects are created for features automatically
#define ModelAPI_AttributeReference_HeaderFile
#include "ModelAPI_Attribute.h"
+#include <ModelAPI_Feature.h>
/**\class ModelAPI_AttributeReference
* \ingroup DataModel
{
public:
/// Defines the feature referenced from this attribute
- MODELAPI_EXPORT virtual void setValue(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
+ MODELAPI_EXPORT virtual void setValue(FeaturePtr theFeature) = 0;
/// Returns feature referenced from this attribute
- MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> value() = 0;
+ MODELAPI_EXPORT virtual FeaturePtr value() = 0;
/// Returns the type of this class of attributes
MODELAPI_EXPORT static std::string type() {return "Reference";}
MODELAPI_EXPORT virtual bool isInHistory() {return false;}
/// Reference to the feature-operation that produces this object
- MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> featureRef() = 0;
+ MODELAPI_EXPORT virtual FeaturePtr featureRef() = 0;
/// Returns the name of this object (by default equal to the name of feature)
MODELAPI_EXPORT virtual std::string getName() = 0;
}
-bool ModuleBase_MetaWidget::storeValue(boost::shared_ptr<ModelAPI_Feature> theFeature)
+bool ModuleBase_MetaWidget::storeValue(FeaturePtr theFeature)
{
#ifdef _DEBUG
std::cout << "ModuleBase_MetaWidget::storeValue"
return true;
}
-bool ModuleBase_MetaWidget::restoreValue(boost::shared_ptr<ModelAPI_Feature> theFeature)
+bool ModuleBase_MetaWidget::restoreValue(FeaturePtr theFeature)
{
#ifdef _DEBUG
std::cout << "ModuleBase_MetaWidget::restoreValue"
MODULEBASE_EXPORT ModuleBase_MetaWidget(QWidget* theWrapped);
virtual ~ModuleBase_MetaWidget();
//! Interface for saving widget's data into the data model
- MODULEBASE_EXPORT virtual bool storeValue(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ MODULEBASE_EXPORT virtual bool storeValue(FeaturePtr theFeature);
//! Interface for loading widget's data from the data model
- MODULEBASE_EXPORT virtual bool restoreValue(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ MODULEBASE_EXPORT virtual bool restoreValue(FeaturePtr theFeature);
/// Set focus to the current widget if it corresponds to the given attribute
/// \param theAttribute name
#include <ModuleBase.h>
+#include <ModelAPI_Feature.h>
+
#include <QObject>
#include <boost/shared_ptr.hpp>
/// Saves the internal parameters to the given feature
/// \param theFeature a model feature to be changed
- virtual bool storeValue(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
+ virtual bool storeValue(FeaturePtr theFeature) = 0;
- virtual bool restoreValue(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
+ virtual bool restoreValue(FeaturePtr theFeature) = 0;
/// Returns whether the widget can accept focus, or if it corresponds to the given attribute
/// \param theAttribute name
return getDescription()->operationId();
}
-boost::shared_ptr<ModelAPI_Feature> ModuleBase_Operation::feature() const
+FeaturePtr ModuleBase_Operation::feature() const
{
return myFeature;
}
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED));
}
-boost::shared_ptr<ModelAPI_Feature> ModuleBase_Operation::createFeature(const bool theFlushMessage)
+FeaturePtr ModuleBase_Operation::createFeature(const bool theFlushMessage)
{
boost::shared_ptr<ModelAPI_Document> aDoc = document();
- boost::shared_ptr<ModelAPI_Feature> aFeature = aDoc->addFeature(
+ FeaturePtr aFeature = aDoc->addFeature(
getDescription()->operationId().toStdString());
if (aFeature) // TODO: generate an error if feature was not created
aFeature->execute();
return aFeature;
}
-void ModuleBase_Operation::setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature)
+void ModuleBase_Operation::setFeature(FeaturePtr theFeature)
{
myFeature = theFeature;
}
#include <ModuleBase.h>
#include <ModuleBase_IOperation.h>
+#include "ModelAPI_Feature.h"
+
#include <QObject>
#include <QString>
#include <boost/shared_ptr.hpp>
-class ModelAPI_Feature;
class ModelAPI_Document;
class QKeyEvent;
QString id() const;
/// Returns the operation feature
/// \return the feature
- boost::shared_ptr<ModelAPI_Feature> feature() const;
+ FeaturePtr feature() const;
/// Returns whether the nested operations are enabled.
/// The state can depend on the operation current state.
virtual void keyReleased(std::string theName, QKeyEvent* theEvent) {};
/// Sets the operation feature
- void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ void setFeature(FeaturePtr theFeature);
protected:
/// Virtual method called when operation started (see start() method for more description)
/// Creates an operation new feature
/// \param theFlushMessage the flag whether the create message should be flushed
/// \returns the created feature
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
+ virtual FeaturePtr createFeature(const bool theFlushMessage = true);
private:
- boost::shared_ptr<ModelAPI_Feature> myFeature; /// the operation feature to be handled
+ FeaturePtr myFeature; /// the operation feature to be handled
};
#endif
{
}
-bool ModuleBase_WidgetPoint2D::storeValue(boost::shared_ptr<ModelAPI_Feature> theFeature)
+bool ModuleBase_WidgetPoint2D::storeValue(FeaturePtr theFeature)
{
boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
return true;
}
-bool ModuleBase_WidgetPoint2D::restoreValue(boost::shared_ptr<ModelAPI_Feature> theFeature)
+bool ModuleBase_WidgetPoint2D::restoreValue(FeaturePtr theFeature)
{
boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
/// Saves the internal parameters to the given feature
/// \param theFeature a model feature to be changed
- virtual bool storeValue(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ virtual bool storeValue(FeaturePtr theFeature);
- virtual bool restoreValue(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ virtual bool restoreValue(FeaturePtr theFeature);
/// Returns whether the widget can accept focus, or if it corresponds to the given attribute
/// \param theAttribute name
{
const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>
(theMessage);
- std::set<boost::shared_ptr<ModelAPI_Feature> > aFeatures = aUpdMsg->features();
- std::set<boost::shared_ptr<ModelAPI_Feature> >::const_iterator anIt = aFeatures.begin(),
- aLast = aFeatures.end();
+ std::set<FeaturePtr > aFeatures = aUpdMsg->features();
+ std::set<FeaturePtr >::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
for (; anIt != aLast; anIt++) {
- boost::shared_ptr<ModelAPI_Feature> aFeature = *anIt;
+ FeaturePtr aFeature = *anIt;
if (myModule->workshop()->displayer()->isVisible(aFeature) ||
aType == EVENT_FEATURE_CREATED) {
myModule->visualizePreview(aFeature, true, false);
myWorkshop->viewer()->fitAll();
}
-void PartSet_Module::onLaunchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature)
+void PartSet_Module::onLaunchOperation(std::string theName, FeaturePtr theFeature)
{
ModuleBase_Operation* anOperation = createOperation(theName.c_str());
PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
if (!isStop) {
std::list<XGUI_ViewerPrs>::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end();
- boost::shared_ptr<ModelAPI_Feature> aFeature;
+ FeaturePtr aFeature;
for (; anIt != aLast; anIt++) {
activateFeature((*anIt).feature(), false);
}
aDisplayer->closeLocalContexts();
}
-void PartSet_Module::onFeatureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
- int theMode)
+void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
{
bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
visualizePreview(theFeature, isDisplay, false);
if (!isDisplay) {
ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
- boost::shared_ptr<ModelAPI_Feature> aSketch;
+ FeaturePtr aSketch;
PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
if (aPrevOp) {
- std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >
- aList = aPrevOp->subPreview();
+ std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > aList = aPrevOp->subPreview();
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
- std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >::const_iterator
+ std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >::const_iterator
anIt = aList.begin(), aLast = aList.end();
for (; anIt != aLast; anIt++) {
- boost::shared_ptr<ModelAPI_Feature> aFeature = (*anIt).first;
+ FeaturePtr aFeature = (*anIt).first;
visualizePreview(aFeature, false, false);
}
aDisplayer->updateViewer();
}
else {
ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
- boost::shared_ptr<ModelAPI_Feature> aSketch;
+ FeaturePtr aSketch;
PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
if (aPrevOp)
aSketch = aPrevOp->sketch();
// connect the operation
PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
if (aPreviewOp) {
- connect(aPreviewOp, SIGNAL(featureConstructed(boost::shared_ptr<ModelAPI_Feature>, int)),
- this, SLOT(onFeatureConstructed(boost::shared_ptr<ModelAPI_Feature>, int)));
- connect(aPreviewOp, SIGNAL(launchOperation(std::string, boost::shared_ptr<ModelAPI_Feature>)),
- this, SLOT(onLaunchOperation(std::string, boost::shared_ptr<ModelAPI_Feature>)));
+ connect(aPreviewOp, SIGNAL(featureConstructed(FeaturePtr, int)),
+ this, SLOT(onFeatureConstructed(FeaturePtr, int)));
+ connect(aPreviewOp, SIGNAL(launchOperation(std::string, FeaturePtr)),
+ this, SLOT(onLaunchOperation(std::string, FeaturePtr)));
connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)),
this, SLOT(onMultiSelectionEnabled(bool)));
Events_Loop::loop()->send(aMessage);
}
-void PartSet_Module::visualizePreview(boost::shared_ptr<ModelAPI_Feature> theFeature, bool isDisplay,
+void PartSet_Module::visualizePreview(FeaturePtr theFeature, bool isDisplay,
const bool isUpdateViewer)
{
ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
aDisplayer->updateViewer();
}
-void PartSet_Module::activateFeature(boost::shared_ptr<ModelAPI_Feature> theFeature,
- const bool isUpdateViewer)
+void PartSet_Module::activateFeature(FeaturePtr theFeature, const bool isUpdateViewer)
{
ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
if (!aPreviewOp)
return;
- boost::shared_ptr<ModelAPI_Feature> aFeature = aPreviewOp->feature();
+ FeaturePtr aFeature = aPreviewOp->feature();
if (!aFeature || aFeature->getKind() != theCmdId)
return;
- std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >
- aList = aPreviewOp->subPreview();
+ std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > aList = aPreviewOp->subPreview();
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
std::list<int> aModes = aPreviewOp->getSelectionModes(aPreviewOp->feature());
- std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >::const_iterator
+ std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >::const_iterator
anIt = aList.begin(), aLast = aList.end();
for (; anIt != aLast; anIt++) {
- boost::shared_ptr<ModelAPI_Feature> aFeature = (*anIt).first;
+ FeaturePtr aFeature = (*anIt).first;
boost::shared_ptr<GeomAPI_Shape> aPreview = (*anIt).second;
Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation(
aFeature, aPreviewOp->sketch(),
/// \param theFeature the feature instance to be displayed
/// \param isDisplay the state whether the presentation should be displayed or erased
/// \param isUpdateViewer the flag whether the viewer should be updated
- void visualizePreview(boost::shared_ptr<ModelAPI_Feature> theFeature, bool isDisplay,
+ void visualizePreview(FeaturePtr theFeature, bool isDisplay,
const bool isUpdateViewer = true);
/// Activates the feature in the displayer
/// \param theFeature the feature instance to be displayed
/// \param isUpdateViewer the flag whether the viewer should be updated
- void activateFeature(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ void activateFeature(FeaturePtr theFeature,
const bool isUpdateViewer);
/// Updates current operation preview, if it has it.
/// SLOT, to fit all current viewer
void onFitAllView();
- void onLaunchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
+ void onLaunchOperation(std::string theName, FeaturePtr theFeature);
/// SLOT, to switch on/off the multi selection in the viewer
/// \param theEnabled the enabled state
/// SLOT, to visualize the feature in another local context mode
/// \param theFeature the feature to be put in another local context mode
/// \param theMode the mode appeared on the feature
- void onFeatureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ void onFeatureConstructed(FeaturePtr theFeature,
int theMode);
protected:
/// Creates a new operation
PartSet_OperationConstraint::PartSet_OperationConstraint(const QString& theId,
QObject* theParent,
- boost::shared_ptr<ModelAPI_Feature> theFeature)
+ FeaturePtr theFeature)
: PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature)
{
}
return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
}
-void PartSet_OperationConstraint::init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+void PartSet_OperationConstraint::init(FeaturePtr theFeature,
const std::list<XGUI_ViewerPrs>& /*theSelected*/,
const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
{
//myInitPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(LINE_ATTR_END));
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationConstraint::sketch() const
+FeaturePtr PartSet_OperationConstraint::sketch() const
{
return mySketch;
}
}
else {
XGUI_ViewerPrs aPrs = theSelected.front();
- boost::shared_ptr<ModelAPI_Feature> aFeature = aPrs.feature();
+ FeaturePtr aFeature = aPrs.feature();
setFeature(aFeature);
setValue(120);
}
else if (aShape.ShapeType() == TopAbs_EDGE) // the line is selected
{
- boost::shared_ptr<ModelAPI_Feature> aFeature = aPrs.feature();
+ FeaturePtr aFeature = aPrs.feature();
if (aFeature) {
double X0, X1, X2, X3;
double Y0, Y1, Y2, Y3;
emit featureConstructed(feature(), FM_Deactivation);
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationConstraint::createFeature(const bool theFlushMessage)
+FeaturePtr PartSet_OperationConstraint::createFeature(const bool theFlushMessage)
{
- boost::shared_ptr<ModelAPI_Feature> aNewFeature = ModuleBase_Operation::createFeature(false);
+ FeaturePtr aNewFeature = ModuleBase_Operation::createFeature(false);
if (sketch()) {
boost::shared_ptr<SketchPlugin_Feature> aFeature =
boost::dynamic_pointer_cast<SketchPlugin_Feature>(sketch());
return aNewFeature;
}
-void PartSet_OperationConstraint::setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature)
+void PartSet_OperationConstraint::setFeature(FeaturePtr theFeature)
{
if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND)
return;
/// \param theParent the operation parent
/// \param theFeature the parent feature
PartSet_OperationConstraint(const QString& theId, QObject* theParent,
- boost::shared_ptr<ModelAPI_Feature> theSketchFeature);
+ FeaturePtr theSketchFeature);
/// Destructor
virtual ~PartSet_OperationConstraint();
/// Initializes some fields accorging to the feature
/// \param theSelected the list of selected presentations
/// \param theHighlighted the list of highlighted presentations
- virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ virtual void init(FeaturePtr theFeature,
const std::list<XGUI_ViewerPrs>& theSelected,
const std::list<XGUI_ViewerPrs>& theHighlighted);
/// Returns the operation sketch feature
/// \returns the sketch instance
- virtual boost::shared_ptr<ModelAPI_Feature> sketch() const;
+ virtual FeaturePtr sketch() const;
/// Gives the current selected objects to be processed by the operation
/// \param theEvent the mouse event
/// the sketch feature
/// \param theFlushMessage the flag whether the create message should be flushed
/// \returns the created feature
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
+ virtual FeaturePtr createFeature(const bool theFlushMessage = true);
/// Set the feature for the constraint
/// \param theFeature the line feature
- void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ void setFeature(FeaturePtr theFeature);
/// Set the value for the constraint
/// \param theValue the constraint value
void setValue(const double theValue);
private:
- boost::shared_ptr<ModelAPI_Feature> mySketch; ///< the sketch feature
+ FeaturePtr mySketch; ///< the sketch feature
};
#endif
PartSet_OperationEditLine::PartSet_OperationEditLine(const QString& theId,
QObject* theParent,
- boost::shared_ptr<ModelAPI_Feature> theFeature)
+ FeaturePtr theFeature)
: PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature), myIsBlockedSelection(false)
{
}
return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
}
-std::list<int> PartSet_OperationEditLine::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
+std::list<int> PartSet_OperationEditLine::getSelectionModes(FeaturePtr theFeature) const
{
return PartSet_OperationSketchBase::getSelectionModes(theFeature);
}
-void PartSet_OperationEditLine::init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+void PartSet_OperationEditLine::init(FeaturePtr theFeature,
const std::list<XGUI_ViewerPrs>& theSelected,
const std::list<XGUI_ViewerPrs>& theHighlighted)
{
myFeatures = theSelected;
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationEditLine::sketch() const
+FeaturePtr PartSet_OperationEditLine::sketch() const
{
return mySketch;
}
{
if (myFeatures.size() == 1)
{
- boost::shared_ptr<ModelAPI_Feature> aFeature;
+ FeaturePtr aFeature;
if (!theHighlighted.empty())
aFeature = theHighlighted.front().feature();
std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
for (; anIt != aLast; anIt++) {
- boost::shared_ptr<ModelAPI_Feature> aFeature = (*anIt).feature();
+ FeaturePtr aFeature = (*anIt).feature();
if (!aFeature || aFeature == feature())
continue;
moveLinePoint(aFeature, aDeltaX, aDeltaY, LINE_ATTR_START);
commit();
std::list<XGUI_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
for (; anIt != aLast; anIt++) {
- boost::shared_ptr<ModelAPI_Feature> aFeature = (*anIt).feature();
+ FeaturePtr aFeature = (*anIt).feature();
if (aFeature)
emit featureConstructed(aFeature, FM_Deactivation);
}
}
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationEditLine::createFeature(const bool /*theFlushMessage*/)
+FeaturePtr PartSet_OperationEditLine::createFeature(const bool /*theFlushMessage*/)
{
// do nothing in order to do not create a new feature
- return boost::shared_ptr<ModelAPI_Feature>();
+ return FeaturePtr();
}
-void PartSet_OperationEditLine::moveLinePoint(boost::shared_ptr<ModelAPI_Feature> theFeature,
+void PartSet_OperationEditLine::moveLinePoint(FeaturePtr theFeature,
double theDeltaX, double theDeltaY,
const std::string& theAttribute)
{
{
static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_MOVED);
- std::list<boost::shared_ptr<ModelAPI_Feature> > aFeatures;
+ std::list<FeaturePtr > aFeatures;
std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
for (; anIt != aLast; anIt++) {
- boost::shared_ptr<ModelAPI_Feature> aFeature = (*anIt).feature();
+ FeaturePtr aFeature = (*anIt).feature();
if (!aFeature)
continue;
/// \param theParent the operation parent
/// \param theFeature the parent feature
PartSet_OperationEditLine(const QString& theId, QObject* theParent,
- boost::shared_ptr<ModelAPI_Feature> theFeature);
+ FeaturePtr theFeature);
/// Destructor
virtual ~PartSet_OperationEditLine();
/// Returns the operation local selection mode
/// \param theFeature the feature object to get the selection mode
/// \return the selection mode
- virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+ virtual std::list<int> getSelectionModes(FeaturePtr theFeature) const;
/// Initializes some fields accorging to the feature
/// \param theFeature the feature
/// \param theSelected the list of selected presentations
/// \param theHighlighted the list of highlighted presentations
- virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ virtual void init(FeaturePtr theFeature,
const std::list<XGUI_ViewerPrs>& theSelected,
const std::list<XGUI_ViewerPrs>& theHighlighted);
/// Returns the operation sketch feature
/// \returns the sketch instance
- virtual boost::shared_ptr<ModelAPI_Feature> sketch() const;
+ virtual FeaturePtr sketch() const;
/// Processes the mouse pressed in the point
/// \param theEvent the mouse event
/// Returns NULL feature. This is an operation of edition, not creation.
/// \param theFlushMessage the flag whether the create message should be flushed
/// \returns the created feature
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
+ virtual FeaturePtr createFeature(const bool theFlushMessage = true);
protected:
/// Emits a signal about the selection blocking. Emits a signal to change the selection.
/// \param theDeltaX the delta for X coordinate is moved
/// \param theDeltaY the delta for Y coordinate is moved
/// \param theAttribute the start or end attribute of the line
- void moveLinePoint(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ void moveLinePoint(FeaturePtr theFeature,
double theDeltaX, double theDeltaY,
const std::string& theAttribute);
/// Sends the features
void sendFeatures();
private:
- boost::shared_ptr<ModelAPI_Feature> mySketch; ///< the sketch feature
+ FeaturePtr mySketch; ///< the sketch feature
std::list<XGUI_ViewerPrs> myFeatures; ///< the features to apply the edit operation
Point myCurPoint; ///< the current 3D point clicked or moved
bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal
{
}
-std::list<int> PartSet_OperationSketch::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
+std::list<int> PartSet_OperationSketch::getSelectionModes(FeaturePtr theFeature) const
{
std::list<int> aModes;
if (!hasSketchPlane())
return aModes;
}
-void PartSet_OperationSketch::init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+void PartSet_OperationSketch::init(FeaturePtr theFeature,
const std::list<XGUI_ViewerPrs>& /*theSelected*/,
const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
{
setFeature(theFeature);
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketch::sketch() const
+FeaturePtr PartSet_OperationSketch::sketch() const
{
return feature();
}
return;
if (theHighlighted.size() == 1) {
- boost::shared_ptr<ModelAPI_Feature> aFeature = theHighlighted.front().feature();
+ FeaturePtr aFeature = theHighlighted.front().feature();
if (aFeature)
restartOperation(PartSet_OperationEditLine::Type(), aFeature);
}
return;
if (myFeatures.size() != 1) {
- boost::shared_ptr<ModelAPI_Feature> aFeature = PartSet_Tools::nearestFeature(theEvent->pos(),
+ FeaturePtr aFeature = PartSet_Tools::nearestFeature(theEvent->pos(),
theView, feature(), myFeatures);
if (aFeature)
restartOperation(PartSet_OperationEditLine::Type(), aFeature);
}
}
-std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >
+std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
PartSet_OperationSketch::subPreview() const
{
- std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> > aPreviewMap;
+ std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > aPreviewMap;
boost::shared_ptr<SketchPlugin_Feature> aFeature;
boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aData->attribute(SKETCH_ATTR_FEATURES));
- std::list<boost::shared_ptr<ModelAPI_Feature> > aFeatures = aRefList->list();
- std::list<boost::shared_ptr<ModelAPI_Feature> >::const_iterator anIt = aFeatures.begin(),
+ std::list<FeaturePtr > aFeatures = aRefList->list();
+ std::list<FeaturePtr >::const_iterator anIt = aFeatures.begin(),
aLast = aFeatures.end();
for (; anIt != aLast; anIt++) {
aFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
/// Returns the operation local selection mode
/// \param theFeature the feature object to get the selection mode
/// \return the selection mode
- virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+ virtual std::list<int> getSelectionModes(FeaturePtr theFeature) const;
/// Initializes some fields accorging to the feature
/// \param theSelected the list of selected presentations
/// \param theHighlighted the list of highlighted presentations
- virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ virtual void init(FeaturePtr theFeature,
const std::list<XGUI_ViewerPrs>& theSelected,
const std::list<XGUI_ViewerPrs>& theHighlighted);
/// Returns the operation sketch feature
/// \returns the sketch instance
- virtual boost::shared_ptr<ModelAPI_Feature> sketch() const;
+ virtual FeaturePtr sketch() const;
/// Processes the mouse pressed in the point
/// \param theEvent the mouse event
/// Returns the map of the operation previews including the nested feature previews
/// \return the map of feature to the feature preview
- virtual std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >
+ virtual std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
subPreview() const;
/// Virtual method called when operation stopped - committed or aborted.
}
boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(
- boost::shared_ptr<ModelAPI_Feature> theFeature)
+ FeaturePtr theFeature)
{
boost::shared_ptr<SketchPlugin_Feature> aFeature =
boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
return aFeature->preview();
}
-std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >
+std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
PartSet_OperationSketchBase::subPreview() const
{
- return std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >();
+ return std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >();
}
-std::list<int> PartSet_OperationSketchBase::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
+std::list<int> PartSet_OperationSketchBase::getSelectionModes(FeaturePtr theFeature) const
{
std::list<int> aModes;
aModes.push_back(TopAbs_VERTEX);
aModes.push_back(TopAbs_EDGE);
return aModes;
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchBase::createFeature(const bool theFlushMessage)
+FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage)
{
- boost::shared_ptr<ModelAPI_Feature> aFeature = ModuleBase_Operation::createFeature(theFlushMessage);
+ FeaturePtr aFeature = ModuleBase_Operation::createFeature(theFlushMessage);
if (aFeature)
emit featureConstructed(aFeature, FM_Activation);
return aFeature;
}
void PartSet_OperationSketchBase::restartOperation(const std::string& theType,
- boost::shared_ptr<ModelAPI_Feature> theFeature)
+ FeaturePtr theFeature)
{
emit launchOperation(theType, theFeature);
}
/// Returns the feature preview shape
/// \param theFeature the feature object to obtain the preview
- static boost::shared_ptr<GeomAPI_Shape> preview(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ static boost::shared_ptr<GeomAPI_Shape> preview(FeaturePtr theFeature);
/// Returns the map of the operation previews including the nested feature previews
/// \return the map of feature to the feature preview
- virtual std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> > subPreview() const;
+ virtual std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > subPreview() const;
/// Returns the operation local selection mode
/// \param theFeature the feature object to get the selection mode
/// \return the selection mode
- virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+ virtual std::list<int> getSelectionModes(FeaturePtr theFeature) const;
/// Initializes some fields accorging to the feature
/// \param theSelected the list of selected presentations
/// \param theHighlighted the list of highlighted presentations
- virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ virtual void init(FeaturePtr theFeature,
const std::list<XGUI_ViewerPrs>& theSelected,
const std::list<XGUI_ViewerPrs>& theHighlighted) {}
/// Returns the operation sketch feature
/// \returns the sketch instance
- virtual boost::shared_ptr<ModelAPI_Feature> sketch() const = 0;
+ virtual FeaturePtr sketch() const = 0;
/// Processes the mouse pressed in the point
/// \param theEvent the mouse event
/// \param theType a type of an operation started
/// theFeature the operation argument
void restartOperation(const std::string& theType,
- boost::shared_ptr<ModelAPI_Feature> theFeature = boost::shared_ptr<ModelAPI_Feature>());
+ FeaturePtr theFeature = FeaturePtr());
signals:
/// signal about the request to launch operation
/// theName the operation name
/// theFeature the operation argument
- void launchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
+ void launchOperation(std::string theName, FeaturePtr theFeature);
/// signal about the focus activated
/// theName the attribute name
void focusActivated(const std::string& theAttibuteName);
/// Signal about the feature construing is finished
/// \param theFeature the result feature
/// \param theMode the mode of the feature modification
- void featureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ void featureConstructed(FeaturePtr theFeature,
int theMode);
/// Signal about the features should be selected
/// \param theSelected the list of selected presentations
/// the sketch feature
/// \param theFlushMessage the flag whether the create message should be flushed
/// \returns the created feature
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
+ virtual FeaturePtr createFeature(const bool theFlushMessage = true);
};
#endif
PartSet_OperationSketchLine::PartSet_OperationSketchLine(const QString& theId,
QObject* theParent,
- boost::shared_ptr<ModelAPI_Feature> theFeature)
+ FeaturePtr theFeature)
: PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature),
myPointSelectionMode(SM_FirstPoint)
{
return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
}
-std::list<int> PartSet_OperationSketchLine::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
+std::list<int> PartSet_OperationSketchLine::getSelectionModes(FeaturePtr theFeature) const
{
std::list<int> aModes;
if (theFeature != feature())
return aModes;
}
-void PartSet_OperationSketchLine::init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+void PartSet_OperationSketchLine::init(FeaturePtr theFeature,
const std::list<XGUI_ViewerPrs>& /*theSelected*/,
const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
{
myInitPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(LINE_ATTR_END));
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchLine::sketch() const
+FeaturePtr PartSet_OperationSketchLine::sketch() const
{
return mySketch;
}
}
else if (aShape.ShapeType() == TopAbs_EDGE) // the line is selected
{
- boost::shared_ptr<ModelAPI_Feature> aFeature = aPrs.feature();
+ FeaturePtr aFeature = aPrs.feature();
if (aFeature) {
double X0, X1, X2, X3;
double Y0, Y1, Y2, Y3;
}
//else
// abort();
- //emit launchOperation(PartSet_OperationSketchLine::Type(), boost::shared_ptr<ModelAPI_Feature>());
+ //emit launchOperation(PartSet_OperationSketchLine::Type(), FeaturePtr());
}
break;
case Qt::Key_Escape: {
emit featureConstructed(feature(), FM_Deactivation);
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchLine::createFeature(const bool theFlushMessage)
+FeaturePtr PartSet_OperationSketchLine::createFeature(const bool theFlushMessage)
{
- boost::shared_ptr<ModelAPI_Feature> aNewFeature = ModuleBase_Operation::createFeature(false);
+ FeaturePtr aNewFeature = ModuleBase_Operation::createFeature(false);
if (sketch()) {
boost::shared_ptr<SketchPlugin_Feature> aFeature =
boost::dynamic_pointer_cast<SketchPlugin_Feature>(sketch());
boost::shared_ptr<GeomDataAPI_Point2D> thePoint2)
{
boost::shared_ptr<ModelAPI_Document> aDoc = document();
- boost::shared_ptr<ModelAPI_Feature> aFeature = aDoc->addFeature(SKETCH_CONSTRAINT_COINCIDENCE_KIND);
+ FeaturePtr aFeature = aDoc->addFeature(SKETCH_CONSTRAINT_COINCIDENCE_KIND);
if (sketch()) {
boost::shared_ptr<SketchPlugin_Feature> aSketch =
break;
}
- boost::shared_ptr<ModelAPI_Feature> aSkFeature = feature();
+ FeaturePtr aSkFeature = feature();
boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aData->attribute(SKETCH_ATTR_FEATURES));
- std::list<boost::shared_ptr<ModelAPI_Feature> > aFeatures = aRefList->list();
- std::list<boost::shared_ptr<ModelAPI_Feature> >::const_iterator anIt = aFeatures.begin(),
+ std::list<FeaturePtr > aFeatures = aRefList->list();
+ std::list<FeaturePtr >::const_iterator anIt = aFeatures.begin(),
aLast = aFeatures.end();
for (; anIt != aLast; anIt++) {
- boost::shared_ptr<ModelAPI_Feature> aFeature = *anIt;
+ FeaturePtr aFeature = *anIt;
boost::shared_ptr<GeomDataAPI_Point2D> aFPoint = findLinePoint(aFeature, theX, theY);
if (aFPoint)
createConstraint(aFPoint, aPoint);
}
}
-void PartSet_OperationSketchLine::getLinePoint(boost::shared_ptr<ModelAPI_Feature> theFeature,
+void PartSet_OperationSketchLine::getLinePoint(FeaturePtr theFeature,
const std::string& theAttribute,
double& theX, double& theY)
{
}
boost::shared_ptr<GeomDataAPI_Point2D> PartSet_OperationSketchLine::findLinePoint(
- boost::shared_ptr<ModelAPI_Feature> theFeature,
+ FeaturePtr theFeature,
double theX, double theY)
{
boost::shared_ptr<GeomDataAPI_Point2D> aPoint2D;
return aPoint2D;
}
-void PartSet_OperationSketchLine::setLinePoint(boost::shared_ptr<ModelAPI_Feature> theFeature,
+void PartSet_OperationSketchLine::setLinePoint(FeaturePtr theFeature,
double theX, double theY,
const std::string& theAttribute)
{
/// \param theParent the operation parent
/// \param theFeature the parent feature
PartSet_OperationSketchLine(const QString& theId, QObject* theParent,
- boost::shared_ptr<ModelAPI_Feature> theSketchFeature);
+ FeaturePtr theSketchFeature);
/// Destructor
virtual ~PartSet_OperationSketchLine();
/// Returns the operation local selection mode
/// \param theFeature the feature object to get the selection mode
/// \return the selection mode
- virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+ virtual std::list<int> getSelectionModes(FeaturePtr theFeature) const;
/// Initializes some fields accorging to the feature
/// \param theSelected the list of selected presentations
/// \param theHighlighted the list of highlighted presentations
- virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ virtual void init(FeaturePtr theFeature,
const std::list<XGUI_ViewerPrs>& theSelected,
const std::list<XGUI_ViewerPrs>& theHighlighted);
/// Returns the operation sketch feature
/// \returns the sketch instance
- virtual boost::shared_ptr<ModelAPI_Feature> sketch() const;
+ virtual FeaturePtr sketch() const;
/// Gives the current selected objects to be processed by the operation
/// \param theEvent the mouse event
/// \param theX the horizontal coordinate
/// \param theY the vertical coordinate
/// \param theAttribute the start or end attribute of the line
- static void setLinePoint(boost::shared_ptr<ModelAPI_Feature>, double theX, double theY,
+ static void setLinePoint(FeaturePtr, double theX, double theY,
const std::string& theAttribute);
protected:
/// the sketch feature
/// \param theFlushMessage the flag whether the create message should be flushed
/// \returns the created feature
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
+ virtual FeaturePtr createFeature(const bool theFlushMessage = true);
/// Creates a constraint on two points
/// \param thePoint1 the first point
/// \param theAttribute the start or end attribute of the line
/// \param theX the horizontal coordinate
/// \param theY the vertical coordinate
- void getLinePoint(boost::shared_ptr<ModelAPI_Feature> theFeature, const std::string& theAttribute,
+ void getLinePoint(FeaturePtr theFeature, const std::string& theAttribute,
double& theX, double& theY);
/// Find a point in the line with given coordinates
/// \param theFeature the line feature
/// \param theX the horizontal point coordinate
/// \param theY the vertical point coordinate
- boost::shared_ptr<GeomDataAPI_Point2D> findLinePoint(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ boost::shared_ptr<GeomDataAPI_Point2D> findLinePoint(FeaturePtr theFeature,
double theX, double theY);
/// \brief Save the point to the line.
void setPointSelectionMode(const PointSelectionMode& theMode, const bool isToEmitSignal = true);
private:
- boost::shared_ptr<ModelAPI_Feature> mySketch; ///< the sketch feature
+ FeaturePtr mySketch; ///< the sketch feature
boost::shared_ptr<GeomDataAPI_Point2D> myInitPoint; ///< the first line point
PointSelectionMode myPointSelectionMode; ///< point selection mode
};
const int SKETCH_WIDTH = 4; /// the plane edge width
Handle(AIS_InteractiveObject) PartSet_Presentation::createPresentation(
- boost::shared_ptr<ModelAPI_Feature> theFeature,
- boost::shared_ptr<ModelAPI_Feature> theSketch,
+ FeaturePtr theFeature,
+ FeaturePtr theSketch,
const TopoDS_Shape& theShape,
Handle_AIS_InteractiveObject thePrevPrs)
{
}
Handle(AIS_InteractiveObject) PartSet_Presentation::createFeature(
- boost::shared_ptr<ModelAPI_Feature> theFeature,
+ FeaturePtr theFeature,
const TopoDS_Shape& theShape,
Handle_AIS_InteractiveObject thePrevPrs)
{
}
Handle(AIS_InteractiveObject) PartSet_Presentation::createSketchConstraintLength(
- boost::shared_ptr<ModelAPI_Feature> theFeature,
- boost::shared_ptr<ModelAPI_Feature> theSketch,
+ FeaturePtr theFeature,
+ FeaturePtr theSketch,
Handle(AIS_InteractiveObject) thePrevPrs)
{
if (!theFeature || !theSketch)
boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(CONSTRAINT_ATTR_ENTITY_A));
if (!anAttr)
return thePrevPrs;
- boost::shared_ptr<ModelAPI_Feature> aFeature = anAttr->feature();
+ FeaturePtr aFeature = anAttr->feature();
if (!aFeature || aFeature->getKind() != SKETCH_LINE_KIND)
return thePrevPrs;
#include <TopoDS_Shape.hxx>
+#include <ModelAPI_Feature.h>
+
#include <boost/shared_ptr.hpp>
-class ModelAPI_Feature;
class Handle_AIS_InteractiveObject;
/*!
/// \param theFeature a feature
/// \return the presentation
static Handle_AIS_InteractiveObject createPresentation(
- boost::shared_ptr<ModelAPI_Feature> theFeature,
- boost::shared_ptr<ModelAPI_Feature> theSketch,
+ FeaturePtr theFeature,
+ FeaturePtr theSketch,
const TopoDS_Shape& theShape,
Handle_AIS_InteractiveObject thePrevPrs);
protected:
static Handle_AIS_InteractiveObject createFeature(
- boost::shared_ptr<ModelAPI_Feature> theFeature,
+ FeaturePtr theFeature,
const TopoDS_Shape& theShape,
Handle_AIS_InteractiveObject thePrevPrs);
static Handle_AIS_InteractiveObject createSketchConstraintLength(
- boost::shared_ptr<ModelAPI_Feature> theFeature,
- boost::shared_ptr<ModelAPI_Feature> theSketch,
+ FeaturePtr theFeature,
+ FeaturePtr theSketch,
Handle_AIS_InteractiveObject thePrevPrs);
};
#include <ModelAPI_Document.h>
static double myTestDelta;
-static boost::shared_ptr<ModelAPI_Feature> myTestFeature;
+static FeaturePtr myTestFeature;
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
ModuleBase_Operation* anOperation = theWorkshop->operationMgr()->currentOperation();
PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
- boost::shared_ptr<ModelAPI_Feature> aSketch;
+ FeaturePtr aSketch;
if (aPreviewOp) {
// create a line
boost::shared_ptr<ModelAPI_Document> aDoc = ModelAPI_PluginManager::get()->rootDocument();
- boost::shared_ptr<ModelAPI_Feature> aFeature = aDoc->addFeature(
+ FeaturePtr aFeature = aDoc->addFeature(
PartSet_OperationSketchLine::Type().c_str());
if (aFeature) // TODO: generate an error if feature was not created
aFeature->execute();
// change the line
if (!myTestFeature)
return;
- boost::shared_ptr<ModelAPI_Feature> aFeature = myTestFeature;
+ FeaturePtr aFeature = myTestFeature;
myTestDelta = myTestDelta - 50;
double aDelta = myTestDelta;
boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchLine::preview(aFeature);
Handle(AIS_InteractiveObject) aPrevAIS;
- boost::shared_ptr<ModelAPI_Feature> aSketch;//NULL
+ FeaturePtr aSketch;//NULL
Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation(
aFeature, aSketch,
aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(),
return ResultPoint;
}
-void PartSet_Tools::convertTo2D(const gp_Pnt& thePoint, boost::shared_ptr<ModelAPI_Feature> theSketch,
+void PartSet_Tools::convertTo2D(const gp_Pnt& thePoint, FeaturePtr theSketch,
Handle(V3d_View) theView, double& theX, double& theY)
{
if (!theSketch)
}
void PartSet_Tools::convertTo3D(const double theX, const double theY,
- boost::shared_ptr<ModelAPI_Feature> theSketch,
+ FeaturePtr theSketch,
gp_Pnt& thePoint)
{
if (!theSketch)
}
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_Tools::nearestFeature(QPoint thePoint,
+FeaturePtr PartSet_Tools::nearestFeature(QPoint thePoint,
Handle_V3d_View theView,
- boost::shared_ptr<ModelAPI_Feature> theSketch,
+ FeaturePtr theSketch,
const std::list<XGUI_ViewerPrs>& theFeatures)
{
double aX, anY;
gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(thePoint, theView);
PartSet_Tools::convertTo2D(aPoint, theSketch, theView, aX, anY);
- boost::shared_ptr<ModelAPI_Feature> aFeature;
+ FeaturePtr aFeature;
std::list<XGUI_ViewerPrs>::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end();
- boost::shared_ptr<ModelAPI_Feature> aDeltaFeature;
+ FeaturePtr aDeltaFeature;
double aMinDelta = -1;
XGUI_ViewerPrs aPrs;
for (; anIt != aLast; anIt++) {
return aDeltaFeature;
}
-double PartSet_Tools::distanceToPoint(boost::shared_ptr<ModelAPI_Feature> theFeature,
+double PartSet_Tools::distanceToPoint(FeaturePtr theFeature,
double theX, double theY)
{
double aDelta = 0;
#include <QPoint>
+#include <ModelAPI_Feature.h>
+
#include <boost/shared_ptr.hpp>
#include <list>
class Handle_V3d_View;
-class ModelAPI_Feature;
class XGUI_ViewerPrs;
/*!
/// \param theSketch the sketch feature
/// \param theX the X coordinate
/// \param theY the Y coordinate
- static void convertTo2D(const gp_Pnt& thePoint, boost::shared_ptr<ModelAPI_Feature> theSketch,
+ static void convertTo2D(const gp_Pnt& thePoint, FeaturePtr theSketch,
Handle(V3d_View) theView, double& theX, double& theY);
/// \brief Converts the 2D projected coodinates on the sketch plane to the 3D point.
/// \param theSketch the sketch feature
/// \param thePoint the 3D point in the viewer
static void convertTo3D(const double theX, const double theY,
- boost::shared_ptr<ModelAPI_Feature> theSketch,
+ FeaturePtr theSketch,
gp_Pnt& thePoint);
/// Returns the point of intersection of the two lines, the first is (v0, v1), the second is (v2, v3),
/// \param theView a 3D view
/// \param theSketch the sketch feature
/// \param theFeatures the list of selected presentations
- static boost::shared_ptr<ModelAPI_Feature> nearestFeature(QPoint thePoint, Handle_V3d_View theView,
- boost::shared_ptr<ModelAPI_Feature> theSketch,
+ static FeaturePtr nearestFeature(QPoint thePoint, Handle_V3d_View theView,
+ FeaturePtr theSketch,
const std::list<XGUI_ViewerPrs>& theFeatures);
private:
/// Return the distance between the feature and the point
/// \param theFeature feature object
/// \param theX the horizontal coordinate of the point
/// \param theX the vertical coordinate of the point
- static double distanceToPoint(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ static double distanceToPoint(FeaturePtr theFeature,
double theX, double theY);
};
ModelAPI_PluginManager::get()->registerPlugin(this);
}
-boost::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
+FeaturePtr PartSetPlugin_Plugin::createFeature(string theFeatureID)
{
if (theFeatureID == "Part") {
- return boost::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Part);
+ return FeaturePtr(new PartSetPlugin_Part);
}
if (theFeatureID == "duplicate") {
- return boost::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Duplicate);
+ return FeaturePtr(new PartSetPlugin_Duplicate);
}
if (theFeatureID == "remove") {
- return boost::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Remove);
+ return FeaturePtr(new PartSetPlugin_Remove);
}
// feature of such kind is not found
- return boost::shared_ptr<ModelAPI_Feature>();
+ return FeaturePtr();
}
#include "PartSetPlugin.h"
#include "ModelAPI_Plugin.h"
+#include "ModelAPI_Feature.h"
class PARTSETPLUGIN_EXPORT PartSetPlugin_Plugin: public ModelAPI_Plugin
{
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+ virtual FeaturePtr createFeature(std::string theFeatureID);
public:
/// Is needed for python wrapping by swig
boost::shared_ptr<ModelAPI_Document> aCurrent;
boost::shared_ptr<PartSetPlugin_Part> a;
for(int a = aRoot->size(getGroup()) - 1; a >= 0; a--) {
- boost::shared_ptr<ModelAPI_Feature> aFeature = aRoot->feature(getGroup(), a, true);
+ FeaturePtr aFeature = aRoot->feature(getGroup(), a, true);
if (aFeature->getKind() == "Part") {
boost::shared_ptr<PartSetPlugin_Part> aPart =
boost::static_pointer_cast<PartSetPlugin_Part>(aFeature);
/// Adds sub-feature of the higher level feature (sub-element of the sketch)
/// \param theFeature sub-feature
SKETCHPLUGIN_EXPORT virtual const void addSub(
- const boost::shared_ptr<ModelAPI_Feature>& theFeature) {};
+ const FeaturePtr& theFeature) {};
/// Use plugin manager for features creation
SketchPlugin_Arc();
/// Adds sub-feature of the higher level feature (sub-element of the sketch)
/// \param theFeature sub-feature
SKETCHPLUGIN_EXPORT virtual const void addSub(
- const boost::shared_ptr<ModelAPI_Feature>& theFeature) {};
+ const FeaturePtr& theFeature) {};
/// Use plugin manager for features creation
SketchPlugin_Circle();
* \param theFeature sub-feature
*/
SKETCHPLUGIN_EXPORT virtual const void addSub(
- const boost::shared_ptr<ModelAPI_Feature>& theFeature) {}
+ const FeaturePtr& theFeature) {}
protected:
/// \brief Use plugin manager for features creation
boost::shared_ptr<SketchPlugin_Sketch> aSketch = boost::
dynamic_pointer_cast<SketchPlugin_Sketch>(document()->feature("Construction", a, true));
if (aSketch) {
- std::list<boost::shared_ptr<ModelAPI_Feature> > aList =
+ std::list<FeaturePtr > aList =
aSketch->data()->reflist(SKETCH_ATTR_FEATURES)->list();
- std::list<boost::shared_ptr<ModelAPI_Feature> >::iterator aSub = aList.begin();
+ std::list<FeaturePtr >::iterator aSub = aList.begin();
for(; aSub != aList.end(); aSub++) {
if ((*aSub)->data()->isEqual(data())) {
mySketch = aSketch.get();
/// Adds sub-feature of the higher level feature (sub-element of the sketch)
/// \param theFeature sub-feature
SKETCHPLUGIN_EXPORT virtual const void addSub(
- const boost::shared_ptr<ModelAPI_Feature>& theFeature) = 0;
+ const FeaturePtr& theFeature) = 0;
/// Returns true if this feature must be displayed in the history (top level of Part tree)
SKETCHPLUGIN_EXPORT virtual bool isInHistory() {return false;}
/// Adds sub-feature of the higher level feature (sub-element of the sketch)
/// \param theFeature sub-feature
SKETCHPLUGIN_EXPORT virtual const void addSub(
- const boost::shared_ptr<ModelAPI_Feature>& theFeature) {};
+ const FeaturePtr& theFeature) {};
/// Use plugin manager for features creation
SketchPlugin_Line();
ModelAPI_PluginManager::get()->registerPlugin(this);
}
-boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string theFeatureID)
+FeaturePtr SketchPlugin_Plugin::createFeature(string theFeatureID)
{
if (theFeatureID == SKETCH_KIND) {
- return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
+ return FeaturePtr(new SketchPlugin_Sketch);
}
else if (theFeatureID == SKETCH_POINT_KIND) {
- return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Point);
+ return FeaturePtr(new SketchPlugin_Point);
}
else if (theFeatureID == SKETCH_LINE_KIND) {
- return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Line);
+ return FeaturePtr(new SketchPlugin_Line);
}
else if (theFeatureID == SKETCH_CIRCLE_KIND) {
- return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Circle);
+ return FeaturePtr(new SketchPlugin_Circle);
}
else if (theFeatureID == SKETCH_CONSTRAINT_COINCIDENCE_KIND) {
- return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintCoincidence);
+ return FeaturePtr(new SketchPlugin_ConstraintCoincidence);
}
else if (theFeatureID == SKETCH_CONSTRAINT_DISTANCE_KIND) {
- return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintDistance);
+ return FeaturePtr(new SketchPlugin_ConstraintDistance);
}
else if (theFeatureID == SKETCH_CONSTRAINT_LENGTH_KIND) {
- return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintLength);
+ return FeaturePtr(new SketchPlugin_ConstraintLength);
}
else if (theFeatureID == SKETCH_CONSTRAINT_PARALLEL_KIND) {
- return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintParallel);
+ return FeaturePtr(new SketchPlugin_ConstraintParallel);
}
else if (theFeatureID == SKETCH_CONSTRAINT_PERPENDICULAR_KIND) {
- return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintPerpendicular);
+ return FeaturePtr(new SketchPlugin_ConstraintPerpendicular);
}
else if (theFeatureID == SKETCH_CONSTRAINT_RADIUS_KIND) {
- return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintRadius);
+ return FeaturePtr(new SketchPlugin_ConstraintRadius);
}
// feature of such kind is not found
- return boost::shared_ptr<ModelAPI_Feature>();
+ return FeaturePtr();
}
#include "SketchPlugin.h"
#include "ModelAPI_Plugin.h"
+#include "ModelAPI_Feature.h"
class SKETCHPLUGIN_EXPORT SketchPlugin_Plugin: public ModelAPI_Plugin
{
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+ virtual FeaturePtr createFeature(std::string theFeatureID);
public:
/// Is needed for python wrapping by swig
/// Adds sub-feature of the higher level feature (sub-element of the sketch)
/// \param theFeature sub-feature
SKETCHPLUGIN_EXPORT virtual const void addSub(
- const boost::shared_ptr<ModelAPI_Feature>& theFeature) {};
+ const FeaturePtr& theFeature) {};
/// Use plugin manager for features creation
SketchPlugin_Point();
return getPreview();
}
-const void SketchPlugin_Sketch::addSub(const boost::shared_ptr<ModelAPI_Feature>& theFeature)
+const void SketchPlugin_Sketch::addSub(const FeaturePtr& theFeature)
{
boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature)->setSketch(this);
data()->reflist(SKETCH_ATTR_FEATURES)->append(theFeature);
/// Adds sub-feature of the higher level feature (sub-element of the sketch)
/// \param theFeature sub-feature
SKETCHPLUGIN_EXPORT virtual const void addSub(
- const boost::shared_ptr<ModelAPI_Feature>& theFeature);
+ const FeaturePtr& theFeature);
/// Converts a 2D sketch space point into point in 3D space
SKETCHPLUGIN_EXPORT boost::shared_ptr<GeomAPI_Pnt> to3D(
// Purpose: create/update the element defined by the feature affected by any constraint
// ============================================================================
Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(
- boost::shared_ptr<ModelAPI_Feature> theEntity)
+ FeaturePtr theEntity)
{
// If the entity is already in the group, try to find it
- std::map<boost::shared_ptr<ModelAPI_Feature>, Slvs_hEntity>::const_iterator
+ std::map<FeaturePtr, Slvs_hEntity>::const_iterator
aEntIter = myEntityFeatMap.find(theEntity);
// defines that the entity already exists
const bool isEntExists = (myEntityFeatMap.find(theEntity) != myEntityFeatMap.end());
}
else anEntAttrIter++;
}
- std::map<boost::shared_ptr<ModelAPI_Feature>, Slvs_hEntity>::iterator
+ std::map<FeaturePtr, Slvs_hEntity>::iterator
anEntFeatIter = myEntityFeatMap.begin();
while (anEntFeatIter != myEntityFeatMap.end())
{
if (anEntToRemove.find(anEntFeatIter->second) != anEntToRemove.end())
{
- std::map<boost::shared_ptr<ModelAPI_Feature>, Slvs_hEntity>::iterator
+ std::map<FeaturePtr, Slvs_hEntity>::iterator
aRemovedIter = anEntFeatIter;
anEntFeatIter++;
myEntityFeatMap.erase(aRemovedIter);
* \return identifier of changed entity or 0 if entity could not be changed
*/
Slvs_hEntity changeEntity(boost::shared_ptr<ModelAPI_Attribute> theEntity);
- Slvs_hEntity changeEntity(boost::shared_ptr<ModelAPI_Feature> theEntity);
+ Slvs_hEntity changeEntity(FeaturePtr theEntity);
/** \brief Adds or updates a normal in the group
*
myConstraintMap; ///< The map between SketchPlugin and SolveSpace constraints
std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>
myEntityAttrMap; ///< The map between "attribute" parameters of constraints and their equivalent SolveSpace entities
- std::map<boost::shared_ptr<ModelAPI_Feature>, Slvs_hEntity>
+ std::map<FeaturePtr, Slvs_hEntity>
myEntityFeatMap; ///< The map between "feature" parameters of constraints and their equivalent SolveSpace entities
// Conincident items
theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_MOVED))
{
const Model_FeatureUpdatedMessage* anUpdateMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
- std::set< boost::shared_ptr<ModelAPI_Feature> > aFeatures = anUpdateMsg->features();
+ std::set< FeaturePtr > aFeatures = anUpdateMsg->features();
bool isModifiedEvt = theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_MOVED);
if (!isModifiedEvt)
{
- std::set< boost::shared_ptr<ModelAPI_Feature> >::iterator aFeatIter;
+ std::set< FeaturePtr >::iterator aFeatIter;
for (aFeatIter = aFeatures.begin(); aFeatIter != aFeatures.end(); aFeatIter++)
{
// Only sketches and constraints can be added by Create event
boost::shared_ptr<ModelAPI_AttributeRefList> aWPFeatures =
boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aWP->data()->attribute(SKETCH_ATTR_FEATURES));
- std::list< boost::shared_ptr<ModelAPI_Feature> > aFeaturesList = aWPFeatures->list();
- std::list< boost::shared_ptr<ModelAPI_Feature> >::const_iterator anIter;
+ std::list< FeaturePtr > aFeaturesList = aWPFeatures->list();
+ std::list< FeaturePtr >::const_iterator anIter;
for (anIter = aFeaturesList.begin(); anIter != aFeaturesList.end(); anIter++)
if (*anIter == theConstraint)
return aWP; // workplane is found
{
}
-bool XGUI_Displayer::isVisible(boost::shared_ptr<ModelAPI_Feature> theFeature)
+bool XGUI_Displayer::isVisible(FeaturePtr theFeature)
{
return myFeature2AISObjectMap.find(theFeature) != myFeature2AISObjectMap.end();
}
-//void XGUI_Displayer::Display(boost::shared_ptr<ModelAPI_Feature> theFeature,
+//void XGUI_Displayer::Display(FeaturePtr theFeature,
// const bool isUpdateViewer)
//{
//}
-/*void XGUI_Displayer::Display(boost::shared_ptr<ModelAPI_Feature> theFeature,
+/*void XGUI_Displayer::Display(FeaturePtr theFeature,
const TopoDS_Shape& theShape, const bool isUpdateViewer)
{
Handle(AIS_InteractiveContext) aContext = AISContext();
std::list<XGUI_ViewerPrs> XGUI_Displayer::getSelected(const int theShapeTypeToSkip)
{
- std::set<boost::shared_ptr<ModelAPI_Feature> > aPrsFeatures;
+ std::set<FeaturePtr > aPrsFeatures;
std::list<XGUI_ViewerPrs> aPresentations;
Handle(AIS_InteractiveContext) aContext = AISContext();
if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
continue;
- boost::shared_ptr<ModelAPI_Feature> aFeature = getFeature(anIO);
+ FeaturePtr aFeature = getFeature(anIO);
if (aPrsFeatures.find(aFeature) != aPrsFeatures.end())
continue;
Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner();
std::list<XGUI_ViewerPrs> XGUI_Displayer::getHighlighted(const int theShapeTypeToSkip)
{
- std::set<boost::shared_ptr<ModelAPI_Feature> > aPrsFeatures;
+ std::set<FeaturePtr > aPrsFeatures;
std::list<XGUI_ViewerPrs> aPresentations;
Handle(AIS_InteractiveContext) aContext = AISContext();
if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
continue;
- boost::shared_ptr<ModelAPI_Feature> aFeature = getFeature(anIO);
+ FeaturePtr aFeature = getFeature(anIO);
if (aPrsFeatures.find(aFeature) != aPrsFeatures.end())
continue;
aPresentations.push_back(XGUI_ViewerPrs(aFeature, aShape, NULL));
return aPresentations;
}
-void XGUI_Displayer::erase(boost::shared_ptr<ModelAPI_Feature> theFeature,
+void XGUI_Displayer::erase(FeaturePtr theFeature,
const bool isUpdateViewer)
{
if (myFeature2AISObjectMap.find(theFeature) == myFeature2AISObjectMap.end())
updateViewer();
}
-bool XGUI_Displayer::redisplay(boost::shared_ptr<ModelAPI_Feature> theFeature,
+bool XGUI_Displayer::redisplay(FeaturePtr theFeature,
Handle(AIS_InteractiveObject) theAIS,
const int theSelectionMode,
const bool isUpdateViewer)
return isCreated;
}
-void XGUI_Displayer::activateInLocalContext(boost::shared_ptr<ModelAPI_Feature> theFeature,
+void XGUI_Displayer::activateInLocalContext(FeaturePtr theFeature,
const std::list<int>& theModes, const bool isUpdateViewer)
{
Handle(AIS_InteractiveContext) aContext = AISContext();
Handle(AIS_Shape) anAIS;
std::list<XGUI_ViewerPrs>::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end();
- boost::shared_ptr<ModelAPI_Feature> aFeature;
+ FeaturePtr aFeature;
for (; anIt != aLast; anIt++) {
aFeature = (*anIt).feature();
if (isVisible(aFeature))
Handle(AIS_InteractiveContext) aContext = AISContext();
std::list<XGUI_ViewerPrs>::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end();
- boost::shared_ptr<ModelAPI_Feature> aFeature;
+ FeaturePtr aFeature;
Handle(AIS_Shape) anAIS;
// we need to unhighligth objects manually in the current local context
FeatureToAISMap::const_iterator aFIt = myFeature2AISObjectMap.begin(),
aFLast = myFeature2AISObjectMap.end();
- std::list<boost::shared_ptr<ModelAPI_Feature>> aRemoved;
+ std::list<FeaturePtr> aRemoved;
for (; aFIt != aFLast; aFIt++)
{
- boost::shared_ptr<ModelAPI_Feature> aFeature = (*aFIt).first;
+ FeaturePtr aFeature = (*aFIt).first;
if (!aFeature || !aFeature->data() || !aFeature->data()->isValid()) {
Handle(AIS_InteractiveObject) anAIS = (*aFIt).second;
if (!anAIS.IsNull()) {
}
}
}
- std::list<boost::shared_ptr<ModelAPI_Feature>>::const_iterator anIt = aRemoved.begin(),
+ std::list<FeaturePtr>::const_iterator anIt = aRemoved.begin(),
aLast = aRemoved.end();
for (; anIt != aLast; anIt++) {
myFeature2AISObjectMap.erase(myFeature2AISObjectMap.find(*anIt));
}
Handle(AIS_InteractiveObject) XGUI_Displayer::getAISObject(
- boost::shared_ptr<ModelAPI_Feature> theFeature) const
+ FeaturePtr theFeature) const
{
Handle(AIS_InteractiveObject) anIO;
if (myFeature2AISObjectMap.find(theFeature) != myFeature2AISObjectMap.end())
return anIO;
}
-boost::shared_ptr<ModelAPI_Feature> XGUI_Displayer::getFeature(Handle(AIS_InteractiveObject) theIO) const
+FeaturePtr XGUI_Displayer::getFeature(Handle(AIS_InteractiveObject) theIO) const
{
- boost::shared_ptr<ModelAPI_Feature> aFeature;
+ FeaturePtr aFeature;
FeatureToAISMap::const_iterator aFIt = myFeature2AISObjectMap.begin(),
aFLast = myFeature2AISObjectMap.end();
for (; aFIt != aFLast && !aFeature; aFIt++) {
#include <AIS_InteractiveContext.hxx>
#include <NCollection_List.hxx>
+#include <ModelAPI_Feature.h>
+
#include <XGUI_ViewerPrs.h>
#include <map>
/// Returns the feature visibility state.
/// \param theFeature a feature instance
- bool isVisible(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ bool isVisible(FeaturePtr theFeature);
/// Display the feature. Obtain the visualized object from the feature.
/// \param theFeature a feature instance
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
- //void Display(boost::shared_ptr<ModelAPI_Feature> theFeature, const bool isUpdateViewer = true);
+ //void Display(FeaturePtr theFeature, const bool isUpdateViewer = true);
/// Display the feature and a shape. This shape would be associated to the given feature
/// \param theFeature a feature instance
/// \param theShape a shape
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
- //void Display(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape,
+ //void Display(FeaturePtr theFeature, const TopoDS_Shape& theShape,
// const bool isUpdateViewer = true);
/// Returns a list of viewer selected presentations
/// \param theAIS an AIS object
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
/// \returns true if the presentation is created
- bool redisplay(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ bool redisplay(FeaturePtr theFeature,
Handle(AIS_InteractiveObject) theAIS,
const int theSelectionMode, const bool isUpdateViewer = true);
/// \param theShape a shape
/// \param theMode a list of local selection modes
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
- void activateInLocalContext(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ void activateInLocalContext(FeaturePtr theFeature,
const std::list<int>& theModes, const bool isUpdateViewer = true);
/// Stop the current selection and color the given features to the selection color
/// Erase the feature and a shape.
/// \param theFeature a feature instance
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
- void erase(boost::shared_ptr<ModelAPI_Feature> theFeature, const bool isUpdateViewer = true);
+ void erase(FeaturePtr theFeature, const bool isUpdateViewer = true);
/// Erase all presentations
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
/// Searches the interactive object by feature
/// \param theFeature the feature or NULL if it not visualized
/// \return theIO an interactive object
- Handle(AIS_InteractiveObject) getAISObject(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+ Handle(AIS_InteractiveObject) getAISObject(FeaturePtr theFeature) const;
protected:
/// Searches the feature by interactive object
/// \param theIO an interactive object
/// \return feature the feature or NULL if it not visualized
- boost::shared_ptr<ModelAPI_Feature> getFeature(Handle(AIS_InteractiveObject) theIO) const;
+ FeaturePtr getFeature(Handle(AIS_InteractiveObject) theIO) const;
/// Deactivate local selection
/// \param isUpdateViewer the state wether the viewer should be updated immediatelly
void closeAllContexts(const bool isUpdateViewer);
protected:
XGUI_Workshop* myWorkshop;
- typedef std::map<boost::shared_ptr<ModelAPI_Feature>, Handle(AIS_InteractiveObject) > FeatureToAISMap;
+ typedef std::map<FeaturePtr, Handle(AIS_InteractiveObject) > FeatureToAISMap;
FeatureToAISMap myFeature2AISObjectMap;
};
return myCustomWidget;
}
-void XGUI_PropertyPanel::updateContentWidget(boost::shared_ptr<ModelAPI_Feature> theFeature)
+void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature)
{
foreach(ModuleBase_ModelWidget* eachWidget, myWidgets) {
eachWidget->restoreValue(theFeature);
virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
public slots:
- void updateContentWidget(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ void updateContentWidget(FeaturePtr theFeature);
/// slot to set the focus to the widget visualized an attribute with the given name
/// \param theAttributteName
void onFocusActivated(const std::string& theAttributeName);
}
//******************************************************************
-bool isModelObject(boost::shared_ptr<ModelAPI_Feature> theFeature)
+bool isModelObject(FeaturePtr theFeature)
{
return theFeature && !theFeature->data();
}
//******************************************************************
-std::string featureInfo(boost::shared_ptr<ModelAPI_Feature> theFeature)
+std::string featureInfo(FeaturePtr theFeature)
{
std::ostringstream aStream;
if (theFeature)
#include <QString>
#include <QRect>
+#include <ModelAPI_Feature.h>
+
#include <boost/shared_ptr.hpp>
class TopoDS_Shape;
-class ModelAPI_Feature;
/*!
\brief Return directory part of the file path.
Returns true if the feature is a model object
\param theFeature a feature
*/
- bool XGUI_EXPORT isModelObject(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ bool XGUI_EXPORT isModelObject(FeaturePtr theFeature);
/*!
Returns the string presentation of the given feature
\param theFeature a feature
*/
- std::string XGUI_EXPORT featureInfo(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature);
}
#endif
{
}
-XGUI_ViewerPrs::XGUI_ViewerPrs(boost::shared_ptr<ModelAPI_Feature> theFeature,
+XGUI_ViewerPrs::XGUI_ViewerPrs(FeaturePtr theFeature,
const TopoDS_Shape& theShape,
Handle(SelectMgr_EntityOwner) theOwner)
: myFeature(theFeature), myShape(theShape), myOwner(theOwner)
{
}
-void XGUI_ViewerPrs::setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature)
+void XGUI_ViewerPrs::setFeature(FeaturePtr theFeature)
{
myFeature = theFeature;
}
-boost::shared_ptr<ModelAPI_Feature> XGUI_ViewerPrs::feature() const
+FeaturePtr XGUI_ViewerPrs::feature() const
{
return myFeature;
}
#include <TopoDS_Shape.hxx>
#include <SelectMgr_EntityOwner.hxx>
-class ModelAPI_Feature;
+#include <ModelAPI_Feature.h>
/**\class XGUI_ViewerPrs
* \ingroup GUI
/// \param theFeature a model feature
/// \param theShape a viewer shape
/// \param theOwner a selection owner
- XGUI_ViewerPrs(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ XGUI_ViewerPrs(FeaturePtr theFeature,
const TopoDS_Shape& theShape,
Handle_SelectMgr_EntityOwner theOwner);
/// Destructor
/// Sets the feature.
/// \param theFeature a feature instance
- void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ void setFeature(FeaturePtr theFeature);
/// Returns the feature.
/// \return a feature instance
- boost::shared_ptr<ModelAPI_Feature> feature() const;
+ FeaturePtr feature() const;
/// Returns the presentation owner
/// \param the owner
const TopoDS_Shape& shape() const;
private:
- boost::shared_ptr<ModelAPI_Feature> myFeature; /// the feature
+ FeaturePtr myFeature; /// the feature
Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
TopoDS_Shape myShape; /// the shape
};