From: nds Date: Wed, 4 Jun 2014 10:28:22 +0000 (+0400) Subject: Replace boost::shared_ptr on FeaturePtr X-Git-Tag: V_0.4.4~322 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f581964034f8df715c46a07c5ecb762492d6b4cf;p=modules%2Fshaper.git Replace boost::shared_ptr on FeaturePtr --- diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp index a825c5608..4e1bfd19c 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp @@ -16,13 +16,13 @@ ConstructionPlugin_Plugin::ConstructionPlugin_Plugin() ModelAPI_PluginManager::get()->registerPlugin(this); } -boost::shared_ptr ConstructionPlugin_Plugin::createFeature(string theFeatureID) +FeaturePtr ConstructionPlugin_Plugin::createFeature(string theFeatureID) { if (theFeatureID == "Point") { - return boost::shared_ptr(new ConstructionPlugin_Point); + return FeaturePtr(new ConstructionPlugin_Point); } else if (theFeatureID == "Extrusion") { - return boost::shared_ptr(new ConstructionPlugin_Extrusion); + return FeaturePtr(new ConstructionPlugin_Extrusion); } // feature of such kind is not found - return boost::shared_ptr(); + return FeaturePtr(); } diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.h b/src/ConstructionPlugin/ConstructionPlugin_Plugin.h index 0201b40a3..1c772033b 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plugin.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.h @@ -8,12 +8,13 @@ #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 createFeature(std::string theFeatureID); + virtual FeaturePtr createFeature(std::string theFeatureID); public: /// Is needed for python wrapping by swig diff --git a/src/Model/Model_AttributeRefAttr.cpp b/src/Model/Model_AttributeRefAttr.cpp index 16a86b194..397977226 100644 --- a/src/Model/Model_AttributeRefAttr.cpp +++ b/src/Model/Model_AttributeRefAttr.cpp @@ -34,7 +34,7 @@ void Model_AttributeRefAttr::setAttr(boost::shared_ptr theAt boost::shared_ptr Model_AttributeRefAttr::attr() { - boost::shared_ptr aFeature = feature(); + FeaturePtr aFeature = feature(); if (aFeature) { boost::shared_ptr aData = boost::dynamic_pointer_cast(aFeature->data()); @@ -44,7 +44,7 @@ boost::shared_ptr Model_AttributeRefAttr::attr() return boost::shared_ptr(); } -void Model_AttributeRefAttr::setFeature(boost::shared_ptr theFeature) +void Model_AttributeRefAttr::setFeature(FeaturePtr theFeature) { if (myID->Get().Length() != 0 || feature() != theFeature) { boost::shared_ptr aData = @@ -58,7 +58,7 @@ void Model_AttributeRefAttr::setFeature(boost::shared_ptr theF } } -boost::shared_ptr Model_AttributeRefAttr::feature() +FeaturePtr Model_AttributeRefAttr::feature() { if (myRef->Get() != myRef->Label()) { // initialized boost::shared_ptr aDoc = @@ -70,7 +70,7 @@ boost::shared_ptr Model_AttributeRefAttr::feature() } } // not initialized - return boost::shared_ptr(); + return FeaturePtr(); } Model_AttributeRefAttr::Model_AttributeRefAttr(TDF_Label& theLabel) diff --git a/src/Model/Model_AttributeRefAttr.h b/src/Model/Model_AttributeRefAttr.h index f9d2bc42e..69fda0163 100644 --- a/src/Model/Model_AttributeRefAttr.h +++ b/src/Model/Model_AttributeRefAttr.h @@ -33,10 +33,10 @@ public: MODEL_EXPORT virtual boost::shared_ptr attr(); /// Defines the reference to the feature - MODEL_EXPORT virtual void setFeature(boost::shared_ptr theFeature); + MODEL_EXPORT virtual void setFeature(FeaturePtr theFeature); /// Returns feature referenced from this attribute - MODEL_EXPORT virtual boost::shared_ptr feature(); + MODEL_EXPORT virtual FeaturePtr feature(); protected: /// Objects are created for features automatically diff --git a/src/Model/Model_AttributeRefList.cpp b/src/Model/Model_AttributeRefList.cpp index f6520fce8..af4cbd3ea 100644 --- a/src/Model/Model_AttributeRefList.cpp +++ b/src/Model/Model_AttributeRefList.cpp @@ -12,7 +12,7 @@ using namespace std; -void Model_AttributeRefList::append(boost::shared_ptr theFeature) +void Model_AttributeRefList::append(FeaturePtr theFeature) { boost::shared_ptr aData = boost::dynamic_pointer_cast(theFeature->data()); @@ -23,7 +23,7 @@ void Model_AttributeRefList::append(boost::shared_ptr theFeatu Events_Loop::loop()->send(aMsg); } -void Model_AttributeRefList::remove(boost::shared_ptr theFeature) +void Model_AttributeRefList::remove(FeaturePtr theFeature) { boost::shared_ptr aData = boost::dynamic_pointer_cast(theFeature->data()); @@ -36,9 +36,9 @@ int Model_AttributeRefList::size() return myRef->Extent(); } -list > Model_AttributeRefList::list() +list Model_AttributeRefList::list() { - std::list< boost::shared_ptr > aResult; + std::list< FeaturePtr > aResult; boost::shared_ptr aDoc = boost::dynamic_pointer_cast(owner()->document()); if (aDoc) { diff --git a/src/Model/Model_AttributeRefList.h b/src/Model/Model_AttributeRefList.h index bf6290c07..340f5cdf0 100644 --- a/src/Model/Model_AttributeRefList.h +++ b/src/Model/Model_AttributeRefList.h @@ -7,6 +7,8 @@ #include "Model.h" #include "ModelAPI_AttributeRefList.h" +#include "ModelAPI_Feature.h" + #include /**\class Model_AttributeRefList @@ -19,16 +21,16 @@ class Model_AttributeRefList : public ModelAPI_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 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 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 > list(); + MODEL_EXPORT virtual std::list list(); protected: /// Objects are created for features automatically diff --git a/src/Model/Model_AttributeReference.cpp b/src/Model/Model_AttributeReference.cpp index 5d7c24466..adcfe4ab4 100644 --- a/src/Model/Model_AttributeReference.cpp +++ b/src/Model/Model_AttributeReference.cpp @@ -11,7 +11,7 @@ using namespace std; -void Model_AttributeReference::setValue(boost::shared_ptr theFeature) +void Model_AttributeReference::setValue(FeaturePtr theFeature) { if (value() != theFeature) { boost::shared_ptr aData = @@ -30,7 +30,7 @@ void Model_AttributeReference::setValue(boost::shared_ptr theF } } -boost::shared_ptr Model_AttributeReference::value() +FeaturePtr Model_AttributeReference::value() { if (!myRef.IsNull()) { boost::shared_ptr aDoc = @@ -41,7 +41,7 @@ boost::shared_ptr Model_AttributeReference::value() } } // not initialized - return boost::shared_ptr(); + return FeaturePtr(); } Model_AttributeReference::Model_AttributeReference(TDF_Label& theLabel) diff --git a/src/Model/Model_AttributeReference.h b/src/Model/Model_AttributeReference.h index e17855e48..6406d0bfb 100644 --- a/src/Model/Model_AttributeReference.h +++ b/src/Model/Model_AttributeReference.h @@ -7,6 +7,7 @@ #include "Model.h" #include "ModelAPI_AttributeReference.h" +#include #include #include @@ -20,10 +21,10 @@ class Model_AttributeReference : public ModelAPI_AttributeReference 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 theFeature); + MODEL_EXPORT virtual void setValue(FeaturePtr theFeature); /// Returns feature referenced from this attribute - MODEL_EXPORT virtual boost::shared_ptr value(); + MODEL_EXPORT virtual FeaturePtr value(); protected: /// Objects are created for features automatically diff --git a/src/Model/Model_Data.h b/src/Model/Model_Data.h index deb7239a5..6eb34e17c 100644 --- a/src/Model/Model_Data.h +++ b/src/Model/Model_Data.h @@ -7,12 +7,12 @@ #include "Model.h" #include +#include #include #include class ModelAPI_Attribute; -class ModelAPI_Feature; /**\class Model_Data * \ingroup DataModel @@ -27,7 +27,7 @@ class Model_Data: public ModelAPI_Data std::map > myAttrs; /// needed here to emit signal that feature changed on change of the attribute - boost::shared_ptr myFeature; + FeaturePtr myFeature; Model_Data(); @@ -83,7 +83,7 @@ public: MODEL_EXPORT void setLabel(TDF_Label& theLab); /// Sets the feature of this data - MODEL_EXPORT virtual void setFeature(boost::shared_ptr theFeature) + MODEL_EXPORT virtual void setFeature(FeaturePtr theFeature) {myFeature = theFeature;} }; diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 76b72fe0c..e17a14af5 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -319,9 +319,9 @@ void Model_Document::redo() subDocument(*aSubIter)->redo(); } -boost::shared_ptr Model_Document::addFeature(string theID) +FeaturePtr Model_Document::addFeature(string theID) { - boost::shared_ptr aFeature = + FeaturePtr aFeature = ModelAPI_PluginManager::get()->createFeature(theID); if (aFeature) { boost::dynamic_pointer_cast(aFeature->documentToAdd())->addFeature(aFeature); @@ -348,7 +348,7 @@ static void AddToRefArray(TDF_Label& theArrayLab, TDF_Label& theReferenced) { } } -void Model_Document::addFeature(const boost::shared_ptr theFeature) +void Model_Document::addFeature(const FeaturePtr theFeature) { if (theFeature->isAction()) return; // do not add action to the data model @@ -421,7 +421,7 @@ static int RemoveFromRefArray( return aResult; } -void Model_Document::removeFeature(boost::shared_ptr theFeature) +void Model_Document::removeFeature(FeaturePtr theFeature) { boost::shared_ptr aData = boost::static_pointer_cast(theFeature->data()); TDF_Label aFeatureLabel = aData->label(); @@ -430,7 +430,7 @@ void Model_Document::removeFeature(boost::shared_ptr theFeatur int aRemovedIndex = RemoveFromRefArray(aGroupLabel, aFeatureLabel); RemoveFromRefArray(aGroupLabel.FindChild(1), TDF_Label(), aRemovedIndex); // remove feature from the myFeatures list - std::vector >::iterator aFIter = myFeatures.begin(); + std::vector::iterator aFIter = myFeatures.begin(); while(aFIter != myFeatures.end()) { if (*aFIter == theFeature) { aFIter = myFeatures.erase(aFIter); @@ -448,17 +448,17 @@ void Model_Document::removeFeature(boost::shared_ptr theFeatur Events_Loop::loop()->send(aMsg); } -boost::shared_ptr 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 >::iterator aFIter = myFeatures.begin(); + vector::iterator aFIter = myFeatures.begin(); for(; aFIter != myFeatures.end(); aFIter++) { boost::shared_ptr aData = boost::dynamic_pointer_cast((*aFIter)->data()); if (aData->label().IsEqual(theLabel)) return *aFIter; } - return boost::shared_ptr(); // not found + return FeaturePtr(); // not found } boost::shared_ptr Model_Document::subDocument(string theDocID) @@ -469,7 +469,7 @@ boost::shared_ptr Model_Document::subDocument(string theDocID return Model_Application::getApplication()->getDocument(theDocID); } -boost::shared_ptr Model_Document::feature( +FeaturePtr Model_Document::feature( const string& theGroupID, const int theIndex, const bool isOperation) { TDF_Label aGroupLab = groupLabel(theGroupID); @@ -477,7 +477,7 @@ boost::shared_ptr Model_Document::feature( if (aGroupLab.FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { if (aRefs->Lower() <= theIndex && aRefs->Upper() >= theIndex) { TDF_Label aFeatureLab = aRefs->Value(theIndex); - boost::shared_ptr aFeature = feature(aFeatureLab); + FeaturePtr aFeature = feature(aFeatureLab); if (theGroupID == FEATURES_GROUP || isOperation) { // just returns the feature from the history return aFeature; @@ -492,7 +492,7 @@ boost::shared_ptr Model_Document::feature( } // not found - return boost::shared_ptr(); + return FeaturePtr(); } int Model_Document::size(const string& theGroupID) @@ -534,7 +534,7 @@ TDF_Label Model_Document::groupLabel(const string theGroup) return aNew; } -void Model_Document::setUniqueName(boost::shared_ptr 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 @@ -571,8 +571,8 @@ void Model_Document::setUniqueName(boost::shared_ptr theFeatur } //! Returns the object by the feature -boost::shared_ptr Model_Document::objectByFeature( - const boost::shared_ptr theFeature) +FeaturePtr Model_Document::objectByFeature( + const FeaturePtr theFeature) { for(int a = 0; a < size(theFeature->getGroup()); a++) { boost::shared_ptr anObj = @@ -581,14 +581,14 @@ boost::shared_ptr Model_Document::objectByFeature( return anObj; } } - return boost::shared_ptr(); // not found + return FeaturePtr(); // not found } void Model_Document::synchronizeFeatures(const bool theMarkUpdated) { boost::shared_ptr aThis = Model_Application::getApplication()->getDocument(myID); // update features - vector >::iterator aFIter = myFeatures.begin(); + vector::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()) { @@ -614,7 +614,7 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated) Events_Loop::loop()->send(aMsg2); } else if (aDSTag < aFeatureTag) { // a new feature is inserted // create a feature - boost::shared_ptr aFeature = ModelAPI_PluginManager::get()->createFeature( + FeaturePtr aFeature = ModelAPI_PluginManager::get()->createFeature( TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast( aFLabIter.Value())->Get()).ToCString()); @@ -637,7 +637,7 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated) static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_CREATED); Model_FeatureUpdatedMessage aMsg1(aFeature, anEvent); Events_Loop::loop()->send(aMsg1); - boost::shared_ptr anObj = objectByFeature(aFeature); + FeaturePtr anObj = objectByFeature(aFeature); if (anObj) { Model_FeatureUpdatedMessage aMsg2(anObj, anEvent); Events_Loop::loop()->send(aMsg2); diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index 41f7d51f6..adc4846ec 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -61,14 +62,14 @@ public: //! 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 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 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 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 subDocument(std::string theDocID); @@ -80,7 +81,7 @@ public: //! \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 + MODEL_EXPORT virtual FeaturePtr feature(const std::string& theGroupID, const int theIndex, const bool isOperation = false); //! Returns the number of features in the group @@ -93,14 +94,14 @@ protected: //! Initializes feature with a unique name in this group (unique name is generated as //! feature type + "_" + index - void setUniqueName(boost::shared_ptr theFeature); + void setUniqueName(FeaturePtr theFeature); //! Adds to the document the new feature - void addFeature(const boost::shared_ptr theFeature); + void addFeature(const FeaturePtr theFeature); //! Returns the object by the feature - boost::shared_ptr objectByFeature( - const boost::shared_ptr theFeature); + FeaturePtr objectByFeature( + const FeaturePtr theFeature); //! Synchronizes myFeatures list with the updated document void synchronizeFeatures(const bool theMarkUpdated = false); @@ -124,7 +125,7 @@ private: /// 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 > myFeatures; + std::vector myFeatures; ///< set of identifiers of sub-documents of this document std::set mySubs; diff --git a/src/Model/Model_Events.h b/src/Model/Model_Events.h index 0bce1c980..1fbf1980e 100644 --- a/src/Model/Model_Events.h +++ b/src/Model/Model_Events.h @@ -12,7 +12,8 @@ #include #include -class ModelAPI_Feature; +#include "ModelAPI_Feature.h" + class ModelAPI_Document; /// Event ID that feature is created (comes with Model_FeatureUpdatedMessage) @@ -26,27 +27,27 @@ static const char * EVENT_FEATURE_MOVED = "FeaturesMoved"; /// Message that feature was changed (used for Object Browser update): moved, updated and deleted class Model_FeatureUpdatedMessage : public Events_MessageGroup { - std::set > myFeatures; ///< which feature is changed + std::set myFeatures; ///< which feature is changed public: /// sender is not important, all information is located in the feature Model_FeatureUpdatedMessage( - const boost::shared_ptr& 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 > features() const {return myFeatures;} + std::set features() const {return myFeatures;} //! Creates a new empty group (to store it in the loop before flush) virtual Events_MessageGroup* newEmpty() { - boost::shared_ptr 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(&theJoined); - std::set >::iterator aFIter = aJoined->myFeatures.begin(); + std::set::iterator aFIter = aJoined->myFeatures.begin(); for(; aFIter != aJoined->myFeatures.end(); aFIter++) { myFeatures.insert(*aFIter); } diff --git a/src/Model/Model_Object.cpp b/src/Model/Model_Object.cpp index 269c547cf..e0c5b3028 100644 --- a/src/Model/Model_Object.cpp +++ b/src/Model/Model_Object.cpp @@ -7,7 +7,7 @@ #include "Model_Events.h" #include -boost::shared_ptr Model_Object::featureRef() +FeaturePtr Model_Object::featureRef() { return myRef; } @@ -29,7 +29,7 @@ void Model_Object::setName(std::string theName) } } -Model_Object::Model_Object(boost::shared_ptr theRef, +Model_Object::Model_Object(FeaturePtr theRef, Handle_TDataStd_Name theName) : myRef(theRef), myName(theName) { diff --git a/src/Model/Model_Object.h b/src/Model/Model_Object.h index 811edf709..73975bc28 100644 --- a/src/Model/Model_Object.h +++ b/src/Model/Model_Object.h @@ -19,11 +19,11 @@ */ class Model_Object : public ModelAPI_Object { - boost::shared_ptr 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 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(); @@ -42,7 +42,7 @@ public: {return myRef->document();} /// Returns true if feature refers to the same model data instance - MODEL_EXPORT virtual bool isSame(const boost::shared_ptr& theFeature) + MODEL_EXPORT virtual bool isSame(const FeaturePtr& theFeature) { boost::shared_ptr anObj = boost::dynamic_pointer_cast(theFeature); return anObj && myRef == anObj->myRef; @@ -57,7 +57,7 @@ public: private: /// Constructor fully defines this object - Model_Object(boost::shared_ptr theRef, Handle_TDataStd_Name theName); + Model_Object(FeaturePtr theRef, Handle_TDataStd_Name theName); friend class Model_Document; }; diff --git a/src/Model/Model_PluginManager.cpp b/src/Model/Model_PluginManager.cpp index 1a6cef9d8..c95ab1242 100644 --- a/src/Model/Model_PluginManager.cpp +++ b/src/Model/Model_PluginManager.cpp @@ -24,7 +24,7 @@ using namespace std; static Model_PluginManager* myImpl = new Model_PluginManager(); -boost::shared_ptr Model_PluginManager::createFeature(string theFeatureID) +FeaturePtr Model_PluginManager::createFeature(string theFeatureID) { if (this != myImpl) return myImpl->createFeature(theFeatureID); @@ -36,7 +36,7 @@ boost::shared_ptr Model_PluginManager::createFeature(string th Config_ModuleReader::loadLibrary(myCurrentPluginName); } if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) { - boost::shared_ptr aCreated = + FeaturePtr aCreated = myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID); if (!aCreated) { Events_Error::send(string("Can not initialize feature '") + theFeatureID + @@ -48,7 +48,7 @@ boost::shared_ptr Model_PluginManager::createFeature(string th } } - return boost::shared_ptr(); // return nothing + return FeaturePtr(); // return nothing } boost::shared_ptr Model_PluginManager::rootDocument() diff --git a/src/Model/Model_PluginManager.h b/src/Model/Model_PluginManager.h index 4efef6a4c..bed54c08b 100644 --- a/src/Model/Model_PluginManager.h +++ b/src/Model/Model_PluginManager.h @@ -7,6 +7,8 @@ #include "Model.h" #include +#include + #include #include @@ -62,7 +64,7 @@ protected: void LoadPluginsInfo(); /// Creates the feature object using plugins functionality - virtual boost::shared_ptr createFeature(std::string theFeatureID); + virtual FeaturePtr createFeature(std::string theFeatureID); }; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeRefAttr.h b/src/ModelAPI/ModelAPI_AttributeRefAttr.h index 4fd883466..a16813609 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefAttr.h +++ b/src/ModelAPI/ModelAPI_AttributeRefAttr.h @@ -6,6 +6,7 @@ #define ModelAPI_AttributeRefAttr_HeaderFile #include "ModelAPI_Attribute.h" +#include "ModelAPI_Feature.h" /**\class ModelAPI_AttributeRefAttr * \ingroup DataModel @@ -26,10 +27,10 @@ public: MODELAPI_EXPORT virtual boost::shared_ptr attr() = 0; /// Defines the reference to the feature - MODELAPI_EXPORT virtual void setFeature(boost::shared_ptr theFeature) = 0; + MODELAPI_EXPORT virtual void setFeature(FeaturePtr theFeature) = 0; /// Returns feature referenced from this attribute - MODELAPI_EXPORT virtual boost::shared_ptr feature() = 0; + MODELAPI_EXPORT virtual FeaturePtr feature() = 0; /// Returns the type of this class of attributes MODELAPI_EXPORT static std::string type() {return "RefAttr";} diff --git a/src/ModelAPI/ModelAPI_AttributeRefList.h b/src/ModelAPI/ModelAPI_AttributeRefList.h index 973fbc46d..87800fb36 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefList.h +++ b/src/ModelAPI/ModelAPI_AttributeRefList.h @@ -6,6 +6,7 @@ #define ModelAPI_AttributeRefList_HeaderFile #include "ModelAPI_Attribute.h" +#include "ModelAPI_Feature.h" #include /**\class ModelAPI_AttributeRefList @@ -23,16 +24,16 @@ public: 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 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 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 > list() = 0; + MODELAPI_EXPORT virtual std::list list() = 0; protected: /// Objects are created for features automatically diff --git a/src/ModelAPI/ModelAPI_AttributeReference.h b/src/ModelAPI/ModelAPI_AttributeReference.h index 37b22560c..0af5898ff 100644 --- a/src/ModelAPI/ModelAPI_AttributeReference.h +++ b/src/ModelAPI/ModelAPI_AttributeReference.h @@ -6,6 +6,7 @@ #define ModelAPI_AttributeReference_HeaderFile #include "ModelAPI_Attribute.h" +#include /**\class ModelAPI_AttributeReference * \ingroup DataModel @@ -16,10 +17,10 @@ class ModelAPI_AttributeReference : public ModelAPI_Attribute { public: /// Defines the feature referenced from this attribute - MODELAPI_EXPORT virtual void setValue(boost::shared_ptr theFeature) = 0; + MODELAPI_EXPORT virtual void setValue(FeaturePtr theFeature) = 0; /// Returns feature referenced from this attribute - MODELAPI_EXPORT virtual boost::shared_ptr value() = 0; + MODELAPI_EXPORT virtual FeaturePtr value() = 0; /// Returns the type of this class of attributes MODELAPI_EXPORT static std::string type() {return "Reference";} diff --git a/src/ModelAPI/ModelAPI_Object.h b/src/ModelAPI/ModelAPI_Object.h index 55ee09527..581f04588 100644 --- a/src/ModelAPI/ModelAPI_Object.h +++ b/src/ModelAPI/ModelAPI_Object.h @@ -23,7 +23,7 @@ public: MODELAPI_EXPORT virtual bool isInHistory() {return false;} /// Reference to the feature-operation that produces this object - MODELAPI_EXPORT virtual boost::shared_ptr 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; diff --git a/src/ModuleBase/ModuleBase_MetaWidget.cpp b/src/ModuleBase/ModuleBase_MetaWidget.cpp index a8a65232b..ba8eb260d 100644 --- a/src/ModuleBase/ModuleBase_MetaWidget.cpp +++ b/src/ModuleBase/ModuleBase_MetaWidget.cpp @@ -21,7 +21,7 @@ ModuleBase_MetaWidget::~ModuleBase_MetaWidget() } -bool ModuleBase_MetaWidget::storeValue(boost::shared_ptr theFeature) +bool ModuleBase_MetaWidget::storeValue(FeaturePtr theFeature) { #ifdef _DEBUG std::cout << "ModuleBase_MetaWidget::storeValue" @@ -30,7 +30,7 @@ bool ModuleBase_MetaWidget::storeValue(boost::shared_ptr theFe return true; } -bool ModuleBase_MetaWidget::restoreValue(boost::shared_ptr theFeature) +bool ModuleBase_MetaWidget::restoreValue(FeaturePtr theFeature) { #ifdef _DEBUG std::cout << "ModuleBase_MetaWidget::restoreValue" diff --git a/src/ModuleBase/ModuleBase_MetaWidget.h b/src/ModuleBase/ModuleBase_MetaWidget.h index 0bbc6fbcd..42504e0f0 100644 --- a/src/ModuleBase/ModuleBase_MetaWidget.h +++ b/src/ModuleBase/ModuleBase_MetaWidget.h @@ -23,9 +23,9 @@ public: 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 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 theFeature); + MODULEBASE_EXPORT virtual bool restoreValue(FeaturePtr theFeature); /// Set focus to the current widget if it corresponds to the given attribute /// \param theAttribute name diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index afdc1f2ca..ff9b6da88 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -7,6 +7,8 @@ #include +#include + #include #include @@ -34,9 +36,9 @@ public: /// Saves the internal parameters to the given feature /// \param theFeature a model feature to be changed - virtual bool storeValue(boost::shared_ptr theFeature) = 0; + virtual bool storeValue(FeaturePtr theFeature) = 0; - virtual bool restoreValue(boost::shared_ptr 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 diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index 600c27a34..4b9a4faa0 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -37,7 +37,7 @@ QString ModuleBase_Operation::id() const return getDescription()->operationId(); } -boost::shared_ptr ModuleBase_Operation::feature() const +FeaturePtr ModuleBase_Operation::feature() const { return myFeature; } @@ -113,10 +113,10 @@ void ModuleBase_Operation::flushCreated() Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED)); } -boost::shared_ptr ModuleBase_Operation::createFeature(const bool theFlushMessage) +FeaturePtr ModuleBase_Operation::createFeature(const bool theFlushMessage) { boost::shared_ptr aDoc = document(); - boost::shared_ptr aFeature = aDoc->addFeature( + FeaturePtr aFeature = aDoc->addFeature( getDescription()->operationId().toStdString()); if (aFeature) // TODO: generate an error if feature was not created aFeature->execute(); @@ -126,7 +126,7 @@ boost::shared_ptr ModuleBase_Operation::createFeature(const bo return aFeature; } -void ModuleBase_Operation::setFeature(boost::shared_ptr theFeature) +void ModuleBase_Operation::setFeature(FeaturePtr theFeature) { myFeature = theFeature; } diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index 73e00f663..bbbfd04d2 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -12,12 +12,13 @@ #include #include +#include "ModelAPI_Feature.h" + #include #include #include -class ModelAPI_Feature; class ModelAPI_Document; class QKeyEvent; @@ -54,7 +55,7 @@ public: QString id() const; /// Returns the operation feature /// \return the feature - boost::shared_ptr feature() const; + FeaturePtr feature() const; /// Returns whether the nested operations are enabled. /// The state can depend on the operation current state. @@ -71,7 +72,7 @@ public: virtual void keyReleased(std::string theName, QKeyEvent* theEvent) {}; /// Sets the operation feature - void setFeature(boost::shared_ptr theFeature); + void setFeature(FeaturePtr theFeature); protected: /// Virtual method called when operation started (see start() method for more description) @@ -94,10 +95,10 @@ protected: /// Creates an operation new feature /// \param theFlushMessage the flag whether the create message should be flushed /// \returns the created feature - virtual boost::shared_ptr createFeature(const bool theFlushMessage = true); + virtual FeaturePtr createFeature(const bool theFlushMessage = true); private: - boost::shared_ptr myFeature; /// the operation feature to be handled + FeaturePtr myFeature; /// the operation feature to be handled }; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp index cbc61430a..ae601b620 100644 --- a/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp +++ b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp @@ -68,7 +68,7 @@ ModuleBase_WidgetPoint2D::~ModuleBase_WidgetPoint2D() { } -bool ModuleBase_WidgetPoint2D::storeValue(boost::shared_ptr theFeature) +bool ModuleBase_WidgetPoint2D::storeValue(FeaturePtr theFeature) { boost::shared_ptr aData = theFeature->data(); boost::shared_ptr aPoint = @@ -82,7 +82,7 @@ bool ModuleBase_WidgetPoint2D::storeValue(boost::shared_ptr th return true; } -bool ModuleBase_WidgetPoint2D::restoreValue(boost::shared_ptr theFeature) +bool ModuleBase_WidgetPoint2D::restoreValue(FeaturePtr theFeature) { boost::shared_ptr aData = theFeature->data(); boost::shared_ptr aPoint = diff --git a/src/ModuleBase/ModuleBase_WidgetPoint2D.h b/src/ModuleBase/ModuleBase_WidgetPoint2D.h index 1a09516b0..c544b6c16 100644 --- a/src/ModuleBase/ModuleBase_WidgetPoint2D.h +++ b/src/ModuleBase/ModuleBase_WidgetPoint2D.h @@ -34,9 +34,9 @@ public: /// Saves the internal parameters to the given feature /// \param theFeature a model feature to be changed - virtual bool storeValue(boost::shared_ptr theFeature); + virtual bool storeValue(FeaturePtr theFeature); - virtual bool restoreValue(boost::shared_ptr theFeature); + virtual bool restoreValue(FeaturePtr theFeature); /// Returns whether the widget can accept focus, or if it corresponds to the given attribute /// \param theAttribute name diff --git a/src/PartSet/PartSet_Listener.cpp b/src/PartSet/PartSet_Listener.cpp index 183a2459b..1f3505ee7 100644 --- a/src/PartSet/PartSet_Listener.cpp +++ b/src/PartSet/PartSet_Listener.cpp @@ -41,11 +41,10 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage) { const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast (theMessage); - std::set > aFeatures = aUpdMsg->features(); - std::set >::const_iterator anIt = aFeatures.begin(), - aLast = aFeatures.end(); + std::set aFeatures = aUpdMsg->features(); + std::set::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); for (; anIt != aLast; anIt++) { - boost::shared_ptr aFeature = *anIt; + FeaturePtr aFeature = *anIt; if (myModule->workshop()->displayer()->isVisible(aFeature) || aType == EVENT_FEATURE_CREATED) { myModule->visualizePreview(aFeature, true, false); diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index aa63b63e7..3de97e8b3 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -221,7 +221,7 @@ void PartSet_Module::onFitAllView() myWorkshop->viewer()->fitAll(); } -void PartSet_Module::onLaunchOperation(std::string theName, boost::shared_ptr theFeature) +void PartSet_Module::onLaunchOperation(std::string theName, FeaturePtr theFeature) { ModuleBase_Operation* anOperation = createOperation(theName.c_str()); PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(anOperation); @@ -250,7 +250,7 @@ void PartSet_Module::onStopSelection(const std::list& theFeature XGUI_Displayer* aDisplayer = myWorkshop->displayer(); if (!isStop) { std::list::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end(); - boost::shared_ptr aFeature; + FeaturePtr aFeature; for (; anIt != aLast; anIt++) { activateFeature((*anIt).feature(), false); } @@ -276,25 +276,23 @@ void PartSet_Module::onCloseLocalContext() aDisplayer->closeLocalContexts(); } -void PartSet_Module::onFeatureConstructed(boost::shared_ptr 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 aSketch; + FeaturePtr aSketch; PartSet_OperationSketchBase* aPrevOp = dynamic_cast(aCurOperation); if (aPrevOp) { - std::map, boost::shared_ptr > - aList = aPrevOp->subPreview(); + std::map > aList = aPrevOp->subPreview(); XGUI_Displayer* aDisplayer = myWorkshop->displayer(); std::list aModes = aPrevOp->getSelectionModes(aPrevOp->feature()); - std::map, boost::shared_ptr >::const_iterator + std::map >::const_iterator anIt = aList.begin(), aLast = aList.end(); for (; anIt != aLast; anIt++) { - boost::shared_ptr aFeature = (*anIt).first; + FeaturePtr aFeature = (*anIt).first; visualizePreview(aFeature, false, false); } aDisplayer->updateViewer(); @@ -325,7 +323,7 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI } else { ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation(); - boost::shared_ptr aSketch; + FeaturePtr aSketch; PartSet_OperationSketchBase* aPrevOp = dynamic_cast(aCurOperation); if (aPrevOp) aSketch = aPrevOp->sketch(); @@ -346,10 +344,10 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI // connect the operation PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(anOperation); if (aPreviewOp) { - connect(aPreviewOp, SIGNAL(featureConstructed(boost::shared_ptr, int)), - this, SLOT(onFeatureConstructed(boost::shared_ptr, int))); - connect(aPreviewOp, SIGNAL(launchOperation(std::string, boost::shared_ptr)), - this, SLOT(onLaunchOperation(std::string, boost::shared_ptr))); + 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))); @@ -384,7 +382,7 @@ void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation) Events_Loop::loop()->send(aMessage); } -void PartSet_Module::visualizePreview(boost::shared_ptr theFeature, bool isDisplay, +void PartSet_Module::visualizePreview(FeaturePtr theFeature, bool isDisplay, const bool isUpdateViewer) { ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation(); @@ -416,8 +414,7 @@ void PartSet_Module::visualizePreview(boost::shared_ptr theFea aDisplayer->updateViewer(); } -void PartSet_Module::activateFeature(boost::shared_ptr theFeature, - const bool isUpdateViewer) +void PartSet_Module::activateFeature(FeaturePtr theFeature, const bool isUpdateViewer) { ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation(); PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(anOperation); @@ -438,19 +435,18 @@ void PartSet_Module::updateCurrentPreview(const std::string& theCmdId) if (!aPreviewOp) return; - boost::shared_ptr aFeature = aPreviewOp->feature(); + FeaturePtr aFeature = aPreviewOp->feature(); if (!aFeature || aFeature->getKind() != theCmdId) return; - std::map, boost::shared_ptr > - aList = aPreviewOp->subPreview(); + std::map > aList = aPreviewOp->subPreview(); XGUI_Displayer* aDisplayer = myWorkshop->displayer(); std::list aModes = aPreviewOp->getSelectionModes(aPreviewOp->feature()); - std::map, boost::shared_ptr >::const_iterator + std::map >::const_iterator anIt = aList.begin(), aLast = aList.end(); for (; anIt != aLast; anIt++) { - boost::shared_ptr aFeature = (*anIt).first; + FeaturePtr aFeature = (*anIt).first; boost::shared_ptr aPreview = (*anIt).second; Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation( aFeature, aPreviewOp->sketch(), diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index d92604bbb..f906f939a 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -44,13 +44,13 @@ public: /// \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 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 theFeature, + void activateFeature(FeaturePtr theFeature, const bool isUpdateViewer); /// Updates current operation preview, if it has it. @@ -92,7 +92,7 @@ public slots: /// SLOT, to fit all current viewer void onFitAllView(); - void onLaunchOperation(std::string theName, boost::shared_ptr theFeature); + void onLaunchOperation(std::string theName, FeaturePtr theFeature); /// SLOT, to switch on/off the multi selection in the viewer /// \param theEnabled the enabled state @@ -113,7 +113,7 @@ public slots: /// 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 theFeature, + void onFeatureConstructed(FeaturePtr theFeature, int theMode); protected: /// Creates a new operation diff --git a/src/PartSet/PartSet_OperationConstraint.cpp b/src/PartSet/PartSet_OperationConstraint.cpp index 99e167d41..6c65c0eac 100644 --- a/src/PartSet/PartSet_OperationConstraint.cpp +++ b/src/PartSet/PartSet_OperationConstraint.cpp @@ -45,7 +45,7 @@ using namespace std; PartSet_OperationConstraint::PartSet_OperationConstraint(const QString& theId, QObject* theParent, - boost::shared_ptr theFeature) + FeaturePtr theFeature) : PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature) { } @@ -59,7 +59,7 @@ bool PartSet_OperationConstraint::isGranted(ModuleBase_IOperation* theOperation) return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type(); } -void PartSet_OperationConstraint::init(boost::shared_ptr theFeature, +void PartSet_OperationConstraint::init(FeaturePtr theFeature, const std::list& /*theSelected*/, const std::list& /*theHighlighted*/) { @@ -70,7 +70,7 @@ void PartSet_OperationConstraint::init(boost::shared_ptr theFe //myInitPoint = boost::dynamic_pointer_cast(aData->attribute(LINE_ATTR_END)); } -boost::shared_ptr PartSet_OperationConstraint::sketch() const +FeaturePtr PartSet_OperationConstraint::sketch() const { return mySketch; } @@ -99,7 +99,7 @@ void PartSet_OperationConstraint::mouseReleased(QMouseEvent* theEvent, Handle(V3 } else { XGUI_ViewerPrs aPrs = theSelected.front(); - boost::shared_ptr aFeature = aPrs.feature(); + FeaturePtr aFeature = aPrs.feature(); setFeature(aFeature); setValue(120); @@ -120,7 +120,7 @@ void PartSet_OperationConstraint::mouseReleased(QMouseEvent* theEvent, Handle(V3 } else if (aShape.ShapeType() == TopAbs_EDGE) // the line is selected { - boost::shared_ptr aFeature = aPrs.feature(); + FeaturePtr aFeature = aPrs.feature(); if (aFeature) { double X0, X1, X2, X3; double Y0, Y1, Y2, Y3; @@ -226,9 +226,9 @@ void PartSet_OperationConstraint::afterCommitOperation() emit featureConstructed(feature(), FM_Deactivation); } -boost::shared_ptr PartSet_OperationConstraint::createFeature(const bool theFlushMessage) +FeaturePtr PartSet_OperationConstraint::createFeature(const bool theFlushMessage) { - boost::shared_ptr aNewFeature = ModuleBase_Operation::createFeature(false); + FeaturePtr aNewFeature = ModuleBase_Operation::createFeature(false); if (sketch()) { boost::shared_ptr aFeature = boost::dynamic_pointer_cast(sketch()); @@ -251,7 +251,7 @@ boost::shared_ptr PartSet_OperationConstraint::createFeature(c return aNewFeature; } -void PartSet_OperationConstraint::setFeature(boost::shared_ptr theFeature) +void PartSet_OperationConstraint::setFeature(FeaturePtr theFeature) { if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND) return; diff --git a/src/PartSet/PartSet_OperationConstraint.h b/src/PartSet/PartSet_OperationConstraint.h index 0925b4fe0..678964aaf 100644 --- a/src/PartSet/PartSet_OperationConstraint.h +++ b/src/PartSet/PartSet_OperationConstraint.h @@ -31,7 +31,7 @@ public: /// \param theParent the operation parent /// \param theFeature the parent feature PartSet_OperationConstraint(const QString& theId, QObject* theParent, - boost::shared_ptr theSketchFeature); + FeaturePtr theSketchFeature); /// Destructor virtual ~PartSet_OperationConstraint(); @@ -43,13 +43,13 @@ public: /// 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 theFeature, + virtual void init(FeaturePtr theFeature, const std::list& theSelected, const std::list& theHighlighted); /// Returns the operation sketch feature /// \returns the sketch instance - virtual boost::shared_ptr sketch() const; + virtual FeaturePtr sketch() const; /// Gives the current selected objects to be processed by the operation /// \param theEvent the mouse event @@ -86,18 +86,18 @@ protected: /// the sketch feature /// \param theFlushMessage the flag whether the create message should be flushed /// \returns the created feature - virtual boost::shared_ptr 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 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 mySketch; ///< the sketch feature + FeaturePtr mySketch; ///< the sketch feature }; #endif diff --git a/src/PartSet/PartSet_OperationEditLine.cpp b/src/PartSet/PartSet_OperationEditLine.cpp index 7b34c8f8f..af46da90d 100644 --- a/src/PartSet/PartSet_OperationEditLine.cpp +++ b/src/PartSet/PartSet_OperationEditLine.cpp @@ -34,7 +34,7 @@ using namespace std; PartSet_OperationEditLine::PartSet_OperationEditLine(const QString& theId, QObject* theParent, - boost::shared_ptr theFeature) + FeaturePtr theFeature) : PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature), myIsBlockedSelection(false) { } @@ -48,12 +48,12 @@ bool PartSet_OperationEditLine::isGranted(ModuleBase_IOperation* theOperation) c return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type(); } -std::list PartSet_OperationEditLine::getSelectionModes(boost::shared_ptr theFeature) const +std::list PartSet_OperationEditLine::getSelectionModes(FeaturePtr theFeature) const { return PartSet_OperationSketchBase::getSelectionModes(theFeature); } -void PartSet_OperationEditLine::init(boost::shared_ptr theFeature, +void PartSet_OperationEditLine::init(FeaturePtr theFeature, const std::list& theSelected, const std::list& theHighlighted) { @@ -78,7 +78,7 @@ void PartSet_OperationEditLine::init(boost::shared_ptr theFeat myFeatures = theSelected; } -boost::shared_ptr PartSet_OperationEditLine::sketch() const +FeaturePtr PartSet_OperationEditLine::sketch() const { return mySketch; } @@ -89,7 +89,7 @@ void PartSet_OperationEditLine::mousePressed(QMouseEvent* theEvent, Handle(V3d_V { if (myFeatures.size() == 1) { - boost::shared_ptr aFeature; + FeaturePtr aFeature; if (!theHighlighted.empty()) aFeature = theHighlighted.front().feature(); @@ -137,7 +137,7 @@ void PartSet_OperationEditLine::mouseMoved(QMouseEvent* theEvent, Handle(V3d_Vie std::list::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end(); for (; anIt != aLast; anIt++) { - boost::shared_ptr aFeature = (*anIt).feature(); + FeaturePtr aFeature = (*anIt).feature(); if (!aFeature || aFeature == feature()) continue; moveLinePoint(aFeature, aDeltaX, aDeltaY, LINE_ATTR_START); @@ -161,7 +161,7 @@ void PartSet_OperationEditLine::mouseReleased(QMouseEvent* theEvent, Handle(V3d_ commit(); std::list::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); for (; anIt != aLast; anIt++) { - boost::shared_ptr aFeature = (*anIt).feature(); + FeaturePtr aFeature = (*anIt).feature(); if (aFeature) emit featureConstructed(aFeature, FM_Deactivation); } @@ -205,13 +205,13 @@ void PartSet_OperationEditLine::blockSelection(bool isBlocked, const bool isRest } } -boost::shared_ptr 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(); + return FeaturePtr(); } -void PartSet_OperationEditLine::moveLinePoint(boost::shared_ptr theFeature, +void PartSet_OperationEditLine::moveLinePoint(FeaturePtr theFeature, double theDeltaX, double theDeltaY, const std::string& theAttribute) { @@ -231,10 +231,10 @@ void PartSet_OperationEditLine::sendFeatures() { static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_MOVED); - std::list > aFeatures; + std::list aFeatures; std::list::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end(); for (; anIt != aLast; anIt++) { - boost::shared_ptr aFeature = (*anIt).feature(); + FeaturePtr aFeature = (*anIt).feature(); if (!aFeature) continue; diff --git a/src/PartSet/PartSet_OperationEditLine.h b/src/PartSet/PartSet_OperationEditLine.h index fef4c95fc..1e18c1511 100644 --- a/src/PartSet/PartSet_OperationEditLine.h +++ b/src/PartSet/PartSet_OperationEditLine.h @@ -56,7 +56,7 @@ public: /// \param theParent the operation parent /// \param theFeature the parent feature PartSet_OperationEditLine(const QString& theId, QObject* theParent, - boost::shared_ptr theFeature); + FeaturePtr theFeature); /// Destructor virtual ~PartSet_OperationEditLine(); @@ -68,19 +68,19 @@ public: /// Returns the operation local selection mode /// \param theFeature the feature object to get the selection mode /// \return the selection mode - virtual std::list getSelectionModes(boost::shared_ptr theFeature) const; + virtual std::list 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 theFeature, + virtual void init(FeaturePtr theFeature, const std::list& theSelected, const std::list& theHighlighted); /// Returns the operation sketch feature /// \returns the sketch instance - virtual boost::shared_ptr sketch() const; + virtual FeaturePtr sketch() const; /// Processes the mouse pressed in the point /// \param theEvent the mouse event @@ -116,7 +116,7 @@ protected: /// 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 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. @@ -131,14 +131,14 @@ protected: /// \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 theFeature, + void moveLinePoint(FeaturePtr theFeature, double theDeltaX, double theDeltaY, const std::string& theAttribute); /// Sends the features void sendFeatures(); private: - boost::shared_ptr mySketch; ///< the sketch feature + FeaturePtr mySketch; ///< the sketch feature std::list 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 diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index d57b5da4a..039d293b3 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -45,7 +45,7 @@ PartSet_OperationSketch::~PartSet_OperationSketch() { } -std::list PartSet_OperationSketch::getSelectionModes(boost::shared_ptr theFeature) const +std::list PartSet_OperationSketch::getSelectionModes(FeaturePtr theFeature) const { std::list aModes; if (!hasSketchPlane()) @@ -56,14 +56,14 @@ std::list PartSet_OperationSketch::getSelectionModes(boost::shared_ptr theFeature, +void PartSet_OperationSketch::init(FeaturePtr theFeature, const std::list& /*theSelected*/, const std::list& /*theHighlighted*/) { setFeature(theFeature); } -boost::shared_ptr PartSet_OperationSketch::sketch() const +FeaturePtr PartSet_OperationSketch::sketch() const { return feature(); } @@ -88,7 +88,7 @@ void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, Handle_V3d_Vie return; if (theHighlighted.size() == 1) { - boost::shared_ptr aFeature = theHighlighted.front().feature(); + FeaturePtr aFeature = theHighlighted.front().feature(); if (aFeature) restartOperation(PartSet_OperationEditLine::Type(), aFeature); } @@ -136,17 +136,17 @@ void PartSet_OperationSketch::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) return; if (myFeatures.size() != 1) { - boost::shared_ptr 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 > +std::map > PartSet_OperationSketch::subPreview() const { - std::map, boost::shared_ptr > aPreviewMap; + std::map > aPreviewMap; boost::shared_ptr aFeature; @@ -156,8 +156,8 @@ std::map, boost::shared_ptr > boost::shared_ptr aRefList = boost::dynamic_pointer_cast(aData->attribute(SKETCH_ATTR_FEATURES)); - std::list > aFeatures = aRefList->list(); - std::list >::const_iterator anIt = aFeatures.begin(), + std::list aFeatures = aRefList->list(); + std::list::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); for (; anIt != aLast; anIt++) { aFeature = boost::dynamic_pointer_cast(*anIt); diff --git a/src/PartSet/PartSet_OperationSketch.h b/src/PartSet/PartSet_OperationSketch.h index 3f5a1c622..27c0d8641 100644 --- a/src/PartSet/PartSet_OperationSketch.h +++ b/src/PartSet/PartSet_OperationSketch.h @@ -37,18 +37,18 @@ public: /// Returns the operation local selection mode /// \param theFeature the feature object to get the selection mode /// \return the selection mode - virtual std::list getSelectionModes(boost::shared_ptr theFeature) const; + virtual std::list 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 theFeature, + virtual void init(FeaturePtr theFeature, const std::list& theSelected, const std::list& theHighlighted); /// Returns the operation sketch feature /// \returns the sketch instance - virtual boost::shared_ptr sketch() const; + virtual FeaturePtr sketch() const; /// Processes the mouse pressed in the point /// \param theEvent the mouse event @@ -74,7 +74,7 @@ public: /// 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 > + virtual std::map > subPreview() const; /// Virtual method called when operation stopped - committed or aborted. diff --git a/src/PartSet/PartSet_OperationSketchBase.cpp b/src/PartSet/PartSet_OperationSketchBase.cpp index ae751b269..8bb9e3be2 100644 --- a/src/PartSet/PartSet_OperationSketchBase.cpp +++ b/src/PartSet/PartSet_OperationSketchBase.cpp @@ -27,7 +27,7 @@ PartSet_OperationSketchBase::~PartSet_OperationSketchBase() } boost::shared_ptr PartSet_OperationSketchBase::preview( - boost::shared_ptr theFeature) + FeaturePtr theFeature) { boost::shared_ptr aFeature = boost::dynamic_pointer_cast(theFeature); @@ -36,22 +36,22 @@ boost::shared_ptr PartSet_OperationSketchBase::preview( return aFeature->preview(); } -std::map, boost::shared_ptr > +std::map > PartSet_OperationSketchBase::subPreview() const { - return std::map, boost::shared_ptr >(); + return std::map >(); } -std::list PartSet_OperationSketchBase::getSelectionModes(boost::shared_ptr theFeature) const +std::list PartSet_OperationSketchBase::getSelectionModes(FeaturePtr theFeature) const { std::list aModes; aModes.push_back(TopAbs_VERTEX); aModes.push_back(TopAbs_EDGE); return aModes; } -boost::shared_ptr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage) +FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage) { - boost::shared_ptr aFeature = ModuleBase_Operation::createFeature(theFlushMessage); + FeaturePtr aFeature = ModuleBase_Operation::createFeature(theFlushMessage); if (aFeature) emit featureConstructed(aFeature, FM_Activation); return aFeature; @@ -90,7 +90,7 @@ void PartSet_OperationSketchBase::keyReleased(std::string theName, QKeyEvent* th } void PartSet_OperationSketchBase::restartOperation(const std::string& theType, - boost::shared_ptr theFeature) + FeaturePtr theFeature) { emit launchOperation(theType, theFeature); } diff --git a/src/PartSet/PartSet_OperationSketchBase.h b/src/PartSet/PartSet_OperationSketchBase.h index 697208c5a..ff6f06847 100644 --- a/src/PartSet/PartSet_OperationSketchBase.h +++ b/src/PartSet/PartSet_OperationSketchBase.h @@ -43,27 +43,27 @@ public: /// Returns the feature preview shape /// \param theFeature the feature object to obtain the preview - static boost::shared_ptr preview(boost::shared_ptr theFeature); + static boost::shared_ptr 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 > subPreview() const; + virtual std::map > 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 getSelectionModes(boost::shared_ptr theFeature) const; + virtual std::list 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 theFeature, + virtual void init(FeaturePtr theFeature, const std::list& theSelected, const std::list& theHighlighted) {} /// Returns the operation sketch feature /// \returns the sketch instance - virtual boost::shared_ptr sketch() const = 0; + virtual FeaturePtr sketch() const = 0; /// Processes the mouse pressed in the point /// \param theEvent the mouse event @@ -99,13 +99,13 @@ public: /// \param theType a type of an operation started /// theFeature the operation argument void restartOperation(const std::string& theType, - boost::shared_ptr theFeature = boost::shared_ptr()); + 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 theFeature); + void launchOperation(std::string theName, FeaturePtr theFeature); /// signal about the focus activated /// theName the attribute name void focusActivated(const std::string& theAttibuteName); @@ -113,7 +113,7 @@ signals: /// 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 theFeature, + void featureConstructed(FeaturePtr theFeature, int theMode); /// Signal about the features should be selected /// \param theSelected the list of selected presentations @@ -139,7 +139,7 @@ protected: /// the sketch feature /// \param theFlushMessage the flag whether the create message should be flushed /// \returns the created feature - virtual boost::shared_ptr createFeature(const bool theFlushMessage = true); + virtual FeaturePtr createFeature(const bool theFlushMessage = true); }; #endif diff --git a/src/PartSet/PartSet_OperationSketchLine.cpp b/src/PartSet/PartSet_OperationSketchLine.cpp index cd7e1497a..bd24b954a 100644 --- a/src/PartSet/PartSet_OperationSketchLine.cpp +++ b/src/PartSet/PartSet_OperationSketchLine.cpp @@ -45,7 +45,7 @@ using namespace std; PartSet_OperationSketchLine::PartSet_OperationSketchLine(const QString& theId, QObject* theParent, - boost::shared_ptr theFeature) + FeaturePtr theFeature) : PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature), myPointSelectionMode(SM_FirstPoint) { @@ -65,7 +65,7 @@ bool PartSet_OperationSketchLine::isGranted(ModuleBase_IOperation* theOperation) return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type(); } -std::list PartSet_OperationSketchLine::getSelectionModes(boost::shared_ptr theFeature) const +std::list PartSet_OperationSketchLine::getSelectionModes(FeaturePtr theFeature) const { std::list aModes; if (theFeature != feature()) @@ -73,7 +73,7 @@ std::list PartSet_OperationSketchLine::getSelectionModes(boost::shared_ptr< return aModes; } -void PartSet_OperationSketchLine::init(boost::shared_ptr theFeature, +void PartSet_OperationSketchLine::init(FeaturePtr theFeature, const std::list& /*theSelected*/, const std::list& /*theHighlighted*/) { @@ -84,7 +84,7 @@ void PartSet_OperationSketchLine::init(boost::shared_ptr theFe myInitPoint = boost::dynamic_pointer_cast(aData->attribute(LINE_ATTR_END)); } -boost::shared_ptr PartSet_OperationSketchLine::sketch() const +FeaturePtr PartSet_OperationSketchLine::sketch() const { return mySketch; } @@ -127,7 +127,7 @@ void PartSet_OperationSketchLine::mouseReleased(QMouseEvent* theEvent, Handle(V3 } else if (aShape.ShapeType() == TopAbs_EDGE) // the line is selected { - boost::shared_ptr aFeature = aPrs.feature(); + FeaturePtr aFeature = aPrs.feature(); if (aFeature) { double X0, X1, X2, X3; double Y0, Y1, Y2, Y3; @@ -233,7 +233,7 @@ void PartSet_OperationSketchLine::keyReleased(const int theKey) } //else // abort(); - //emit launchOperation(PartSet_OperationSketchLine::Type(), boost::shared_ptr()); + //emit launchOperation(PartSet_OperationSketchLine::Type(), FeaturePtr()); } break; case Qt::Key_Escape: { @@ -275,9 +275,9 @@ void PartSet_OperationSketchLine::afterCommitOperation() emit featureConstructed(feature(), FM_Deactivation); } -boost::shared_ptr PartSet_OperationSketchLine::createFeature(const bool theFlushMessage) +FeaturePtr PartSet_OperationSketchLine::createFeature(const bool theFlushMessage) { - boost::shared_ptr aNewFeature = ModuleBase_Operation::createFeature(false); + FeaturePtr aNewFeature = ModuleBase_Operation::createFeature(false); if (sketch()) { boost::shared_ptr aFeature = boost::dynamic_pointer_cast(sketch()); @@ -304,7 +304,7 @@ void PartSet_OperationSketchLine::createConstraint(boost::shared_ptr thePoint2) { boost::shared_ptr aDoc = document(); - boost::shared_ptr aFeature = aDoc->addFeature(SKETCH_CONSTRAINT_COINCIDENCE_KIND); + FeaturePtr aFeature = aDoc->addFeature(SKETCH_CONSTRAINT_COINCIDENCE_KIND); if (sketch()) { boost::shared_ptr aSketch = @@ -341,7 +341,7 @@ void PartSet_OperationSketchLine::setConstraints(double theX, double theY) break; } - boost::shared_ptr aSkFeature = feature(); + FeaturePtr aSkFeature = feature(); boost::shared_ptr aData = feature()->data(); boost::shared_ptr aPoint = boost::dynamic_pointer_cast @@ -350,18 +350,18 @@ void PartSet_OperationSketchLine::setConstraints(double theX, double theY) boost::shared_ptr aRefList = boost::dynamic_pointer_cast(aData->attribute(SKETCH_ATTR_FEATURES)); - std::list > aFeatures = aRefList->list(); - std::list >::const_iterator anIt = aFeatures.begin(), + std::list aFeatures = aRefList->list(); + std::list::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); for (; anIt != aLast; anIt++) { - boost::shared_ptr aFeature = *anIt; + FeaturePtr aFeature = *anIt; boost::shared_ptr aFPoint = findLinePoint(aFeature, theX, theY); if (aFPoint) createConstraint(aFPoint, aPoint); } } -void PartSet_OperationSketchLine::getLinePoint(boost::shared_ptr theFeature, +void PartSet_OperationSketchLine::getLinePoint(FeaturePtr theFeature, const std::string& theAttribute, double& theX, double& theY) { @@ -375,7 +375,7 @@ void PartSet_OperationSketchLine::getLinePoint(boost::shared_ptr PartSet_OperationSketchLine::findLinePoint( - boost::shared_ptr theFeature, + FeaturePtr theFeature, double theX, double theY) { boost::shared_ptr aPoint2D; @@ -395,7 +395,7 @@ boost::shared_ptr PartSet_OperationSketchLine::findLinePoin return aPoint2D; } -void PartSet_OperationSketchLine::setLinePoint(boost::shared_ptr theFeature, +void PartSet_OperationSketchLine::setLinePoint(FeaturePtr theFeature, double theX, double theY, const std::string& theAttribute) { diff --git a/src/PartSet/PartSet_OperationSketchLine.h b/src/PartSet/PartSet_OperationSketchLine.h index 9dd5dc6cc..153bfbb66 100644 --- a/src/PartSet/PartSet_OperationSketchLine.h +++ b/src/PartSet/PartSet_OperationSketchLine.h @@ -35,7 +35,7 @@ public: /// \param theParent the operation parent /// \param theFeature the parent feature PartSet_OperationSketchLine(const QString& theId, QObject* theParent, - boost::shared_ptr theSketchFeature); + FeaturePtr theSketchFeature); /// Destructor virtual ~PartSet_OperationSketchLine(); @@ -51,18 +51,18 @@ public: /// Returns the operation local selection mode /// \param theFeature the feature object to get the selection mode /// \return the selection mode - virtual std::list getSelectionModes(boost::shared_ptr theFeature) const; + virtual std::list 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 theFeature, + virtual void init(FeaturePtr theFeature, const std::list& theSelected, const std::list& theHighlighted); /// Returns the operation sketch feature /// \returns the sketch instance - virtual boost::shared_ptr sketch() const; + virtual FeaturePtr sketch() const; /// Gives the current selected objects to be processed by the operation /// \param theEvent the mouse event @@ -87,7 +87,7 @@ public: /// \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, double theX, double theY, + static void setLinePoint(FeaturePtr, double theX, double theY, const std::string& theAttribute); protected: @@ -112,7 +112,7 @@ protected: /// the sketch feature /// \param theFlushMessage the flag whether the create message should be flushed /// \returns the created feature - virtual boost::shared_ptr createFeature(const bool theFlushMessage = true); + virtual FeaturePtr createFeature(const bool theFlushMessage = true); /// Creates a constraint on two points /// \param thePoint1 the first point @@ -131,13 +131,13 @@ protected: /// \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 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 findLinePoint(boost::shared_ptr theFeature, + boost::shared_ptr findLinePoint(FeaturePtr theFeature, double theX, double theY); /// \brief Save the point to the line. @@ -155,7 +155,7 @@ protected: void setPointSelectionMode(const PointSelectionMode& theMode, const bool isToEmitSignal = true); private: - boost::shared_ptr mySketch; ///< the sketch feature + FeaturePtr mySketch; ///< the sketch feature boost::shared_ptr myInitPoint; ///< the first line point PointSelectionMode myPointSelectionMode; ///< point selection mode }; diff --git a/src/PartSet/PartSet_Presentation.cpp b/src/PartSet/PartSet_Presentation.cpp index 78d47b58e..28d9ce3d1 100644 --- a/src/PartSet/PartSet_Presentation.cpp +++ b/src/PartSet/PartSet_Presentation.cpp @@ -28,8 +28,8 @@ const Quantity_NameOfColor SKETCH_PLANE_COLOR = Quantity_NOC_CHOCOLATE; /// the const int SKETCH_WIDTH = 4; /// the plane edge width Handle(AIS_InteractiveObject) PartSet_Presentation::createPresentation( - boost::shared_ptr theFeature, - boost::shared_ptr theSketch, + FeaturePtr theFeature, + FeaturePtr theSketch, const TopoDS_Shape& theShape, Handle_AIS_InteractiveObject thePrevPrs) { @@ -52,7 +52,7 @@ Handle(AIS_InteractiveObject) PartSet_Presentation::createPresentation( } Handle(AIS_InteractiveObject) PartSet_Presentation::createFeature( - boost::shared_ptr theFeature, + FeaturePtr theFeature, const TopoDS_Shape& theShape, Handle_AIS_InteractiveObject thePrevPrs) { @@ -78,8 +78,8 @@ Handle(AIS_InteractiveObject) PartSet_Presentation::createFeature( } Handle(AIS_InteractiveObject) PartSet_Presentation::createSketchConstraintLength( - boost::shared_ptr theFeature, - boost::shared_ptr theSketch, + FeaturePtr theFeature, + FeaturePtr theSketch, Handle(AIS_InteractiveObject) thePrevPrs) { if (!theFeature || !theSketch) @@ -97,7 +97,7 @@ Handle(AIS_InteractiveObject) PartSet_Presentation::createSketchConstraintLength boost::dynamic_pointer_cast(aData->attribute(CONSTRAINT_ATTR_ENTITY_A)); if (!anAttr) return thePrevPrs; - boost::shared_ptr aFeature = anAttr->feature(); + FeaturePtr aFeature = anAttr->feature(); if (!aFeature || aFeature->getKind() != SKETCH_LINE_KIND) return thePrevPrs; diff --git a/src/PartSet/PartSet_Presentation.h b/src/PartSet/PartSet_Presentation.h index ffe8ed4db..8e4b2ae6f 100644 --- a/src/PartSet/PartSet_Presentation.h +++ b/src/PartSet/PartSet_Presentation.h @@ -9,9 +9,10 @@ #include +#include + #include -class ModelAPI_Feature; class Handle_AIS_InteractiveObject; /*! @@ -25,19 +26,19 @@ public: /// \param theFeature a feature /// \return the presentation static Handle_AIS_InteractiveObject createPresentation( - boost::shared_ptr theFeature, - boost::shared_ptr theSketch, + FeaturePtr theFeature, + FeaturePtr theSketch, const TopoDS_Shape& theShape, Handle_AIS_InteractiveObject thePrevPrs); protected: static Handle_AIS_InteractiveObject createFeature( - boost::shared_ptr theFeature, + FeaturePtr theFeature, const TopoDS_Shape& theShape, Handle_AIS_InteractiveObject thePrevPrs); static Handle_AIS_InteractiveObject createSketchConstraintLength( - boost::shared_ptr theFeature, - boost::shared_ptr theSketch, + FeaturePtr theFeature, + FeaturePtr theSketch, Handle_AIS_InteractiveObject thePrevPrs); }; diff --git a/src/PartSet/PartSet_TestOCC.cpp b/src/PartSet/PartSet_TestOCC.cpp index d56025223..dc0295020 100644 --- a/src/PartSet/PartSet_TestOCC.cpp +++ b/src/PartSet/PartSet_TestOCC.cpp @@ -18,7 +18,7 @@ #include static double myTestDelta; -static boost::shared_ptr myTestFeature; +static FeaturePtr myTestFeature; #include #include @@ -127,12 +127,12 @@ void PartSet_TestOCC::createTestLine(XGUI_Workshop* theWorkshop) ModuleBase_Operation* anOperation = theWorkshop->operationMgr()->currentOperation(); PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(anOperation); - boost::shared_ptr aSketch; + FeaturePtr aSketch; if (aPreviewOp) { // create a line boost::shared_ptr aDoc = ModelAPI_PluginManager::get()->rootDocument(); - boost::shared_ptr 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(); @@ -195,7 +195,7 @@ void PartSet_TestOCC::changeTestLine(XGUI_Workshop* theWorkshop) // change the line if (!myTestFeature) return; - boost::shared_ptr aFeature = myTestFeature; + FeaturePtr aFeature = myTestFeature; myTestDelta = myTestDelta - 50; double aDelta = myTestDelta; @@ -204,7 +204,7 @@ void PartSet_TestOCC::changeTestLine(XGUI_Workshop* theWorkshop) boost::shared_ptr aPreview = PartSet_OperationSketchLine::preview(aFeature); Handle(AIS_InteractiveObject) aPrevAIS; - boost::shared_ptr aSketch;//NULL + FeaturePtr aSketch;//NULL Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation( aFeature, aSketch, aPreview ? aPreview->impl() : TopoDS_Shape(), diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index 4713f2cda..ae51d7b20 100644 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -57,7 +57,7 @@ gp_Pnt PartSet_Tools::convertClickToPoint(QPoint thePoint, Handle(V3d_View) theV return ResultPoint; } -void PartSet_Tools::convertTo2D(const gp_Pnt& thePoint, boost::shared_ptr theSketch, +void PartSet_Tools::convertTo2D(const gp_Pnt& thePoint, FeaturePtr theSketch, Handle(V3d_View) theView, double& theX, double& theY) { if (!theSketch) @@ -104,7 +104,7 @@ void PartSet_Tools::convertTo2D(const gp_Pnt& thePoint, boost::shared_ptr theSketch, + FeaturePtr theSketch, gp_Pnt& thePoint) { if (!theSketch) @@ -167,19 +167,19 @@ void PartSet_Tools::projectPointOnLine(double theX1, double theY1, double theX2, } } -boost::shared_ptr PartSet_Tools::nearestFeature(QPoint thePoint, +FeaturePtr PartSet_Tools::nearestFeature(QPoint thePoint, Handle_V3d_View theView, - boost::shared_ptr theSketch, + FeaturePtr theSketch, const std::list& theFeatures) { double aX, anY; gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(thePoint, theView); PartSet_Tools::convertTo2D(aPoint, theSketch, theView, aX, anY); - boost::shared_ptr aFeature; + FeaturePtr aFeature; std::list::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end(); - boost::shared_ptr aDeltaFeature; + FeaturePtr aDeltaFeature; double aMinDelta = -1; XGUI_ViewerPrs aPrs; for (; anIt != aLast; anIt++) { @@ -195,7 +195,7 @@ boost::shared_ptr PartSet_Tools::nearestFeature(QPoint thePoin return aDeltaFeature; } -double PartSet_Tools::distanceToPoint(boost::shared_ptr theFeature, +double PartSet_Tools::distanceToPoint(FeaturePtr theFeature, double theX, double theY) { double aDelta = 0; diff --git a/src/PartSet/PartSet_Tools.h b/src/PartSet/PartSet_Tools.h index b0778b5e1..c8fa30660 100644 --- a/src/PartSet/PartSet_Tools.h +++ b/src/PartSet/PartSet_Tools.h @@ -11,12 +11,13 @@ #include +#include + #include #include class Handle_V3d_View; -class ModelAPI_Feature; class XGUI_ViewerPrs; /*! @@ -36,7 +37,7 @@ public: /// \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 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. @@ -45,7 +46,7 @@ public: /// \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 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), @@ -79,15 +80,15 @@ public: /// \param theView a 3D view /// \param theSketch the sketch feature /// \param theFeatures the list of selected presentations - static boost::shared_ptr nearestFeature(QPoint thePoint, Handle_V3d_View theView, - boost::shared_ptr theSketch, + static FeaturePtr nearestFeature(QPoint thePoint, Handle_V3d_View theView, + FeaturePtr theSketch, const std::list& 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 theFeature, + static double distanceToPoint(FeaturePtr theFeature, double theX, double theY); }; diff --git a/src/PartSetPlugin/PartSetPlugin_Plugin.cpp b/src/PartSetPlugin/PartSetPlugin_Plugin.cpp index 76ea7b441..435cc1efc 100644 --- a/src/PartSetPlugin/PartSetPlugin_Plugin.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Plugin.cpp @@ -16,17 +16,17 @@ PartSetPlugin_Plugin::PartSetPlugin_Plugin() ModelAPI_PluginManager::get()->registerPlugin(this); } -boost::shared_ptr PartSetPlugin_Plugin::createFeature(string theFeatureID) +FeaturePtr PartSetPlugin_Plugin::createFeature(string theFeatureID) { if (theFeatureID == "Part") { - return boost::shared_ptr(new PartSetPlugin_Part); + return FeaturePtr(new PartSetPlugin_Part); } if (theFeatureID == "duplicate") { - return boost::shared_ptr(new PartSetPlugin_Duplicate); + return FeaturePtr(new PartSetPlugin_Duplicate); } if (theFeatureID == "remove") { - return boost::shared_ptr(new PartSetPlugin_Remove); + return FeaturePtr(new PartSetPlugin_Remove); } // feature of such kind is not found - return boost::shared_ptr(); + return FeaturePtr(); } diff --git a/src/PartSetPlugin/PartSetPlugin_Plugin.h b/src/PartSetPlugin/PartSetPlugin_Plugin.h index ff577f79a..d1ccd314b 100644 --- a/src/PartSetPlugin/PartSetPlugin_Plugin.h +++ b/src/PartSetPlugin/PartSetPlugin_Plugin.h @@ -8,12 +8,13 @@ #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 createFeature(std::string theFeatureID); + virtual FeaturePtr createFeature(std::string theFeatureID); public: /// Is needed for python wrapping by swig diff --git a/src/PartSetPlugin/PartSetPlugin_Remove.cpp b/src/PartSetPlugin/PartSetPlugin_Remove.cpp index 5e99cb1f9..6c56d01f1 100644 --- a/src/PartSetPlugin/PartSetPlugin_Remove.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Remove.cpp @@ -15,7 +15,7 @@ void PartSetPlugin_Remove::execute() boost::shared_ptr aCurrent; boost::shared_ptr a; for(int a = aRoot->size(getGroup()) - 1; a >= 0; a--) { - boost::shared_ptr aFeature = aRoot->feature(getGroup(), a, true); + FeaturePtr aFeature = aRoot->feature(getGroup(), a, true); if (aFeature->getKind() == "Part") { boost::shared_ptr aPart = boost::static_pointer_cast(aFeature); diff --git a/src/SketchPlugin/SketchPlugin_Arc.h b/src/SketchPlugin/SketchPlugin_Arc.h index 3286cff42..928a76083 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.h +++ b/src/SketchPlugin/SketchPlugin_Arc.h @@ -46,7 +46,7 @@ public: /// 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& theFeature) {}; + const FeaturePtr& theFeature) {}; /// Use plugin manager for features creation SketchPlugin_Arc(); diff --git a/src/SketchPlugin/SketchPlugin_Circle.h b/src/SketchPlugin/SketchPlugin_Circle.h index 3e7b9ac82..10fee4f7b 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.h +++ b/src/SketchPlugin/SketchPlugin_Circle.h @@ -44,7 +44,7 @@ public: /// 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& theFeature) {}; + const FeaturePtr& theFeature) {}; /// Use plugin manager for features creation SketchPlugin_Circle(); diff --git a/src/SketchPlugin/SketchPlugin_Constraint.h b/src/SketchPlugin/SketchPlugin_Constraint.h index dcb0a3c79..b4e8bcca6 100644 --- a/src/SketchPlugin/SketchPlugin_Constraint.h +++ b/src/SketchPlugin/SketchPlugin_Constraint.h @@ -57,7 +57,7 @@ public: * \param theFeature sub-feature */ SKETCHPLUGIN_EXPORT virtual const void addSub( - const boost::shared_ptr& theFeature) {} + const FeaturePtr& theFeature) {} protected: /// \brief Use plugin manager for features creation diff --git a/src/SketchPlugin/SketchPlugin_Feature.cpp b/src/SketchPlugin/SketchPlugin_Feature.cpp index ae771b556..7bda5720b 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.cpp +++ b/src/SketchPlugin/SketchPlugin_Feature.cpp @@ -29,9 +29,9 @@ SketchPlugin_Sketch* SketchPlugin_Feature::sketch() boost::shared_ptr aSketch = boost:: dynamic_pointer_cast(document()->feature("Construction", a, true)); if (aSketch) { - std::list > aList = + std::list aList = aSketch->data()->reflist(SKETCH_ATTR_FEATURES)->list(); - std::list >::iterator aSub = aList.begin(); + std::list::iterator aSub = aList.begin(); for(; aSub != aList.end(); aSub++) { if ((*aSub)->data()->isEqual(data())) { mySketch = aSketch.get(); diff --git a/src/SketchPlugin/SketchPlugin_Feature.h b/src/SketchPlugin/SketchPlugin_Feature.h index db6a6d660..8e59b5489 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.h +++ b/src/SketchPlugin/SketchPlugin_Feature.h @@ -27,7 +27,7 @@ public: /// 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& 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;} diff --git a/src/SketchPlugin/SketchPlugin_Line.h b/src/SketchPlugin/SketchPlugin_Line.h index b22f551b7..6acefd294 100644 --- a/src/SketchPlugin/SketchPlugin_Line.h +++ b/src/SketchPlugin/SketchPlugin_Line.h @@ -45,7 +45,7 @@ public: /// 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& theFeature) {}; + const FeaturePtr& theFeature) {}; /// Use plugin manager for features creation SketchPlugin_Line(); diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index 7f75377f2..14e61b236 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -24,38 +24,38 @@ SketchPlugin_Plugin::SketchPlugin_Plugin() ModelAPI_PluginManager::get()->registerPlugin(this); } -boost::shared_ptr SketchPlugin_Plugin::createFeature(string theFeatureID) +FeaturePtr SketchPlugin_Plugin::createFeature(string theFeatureID) { if (theFeatureID == SKETCH_KIND) { - return boost::shared_ptr(new SketchPlugin_Sketch); + return FeaturePtr(new SketchPlugin_Sketch); } else if (theFeatureID == SKETCH_POINT_KIND) { - return boost::shared_ptr(new SketchPlugin_Point); + return FeaturePtr(new SketchPlugin_Point); } else if (theFeatureID == SKETCH_LINE_KIND) { - return boost::shared_ptr(new SketchPlugin_Line); + return FeaturePtr(new SketchPlugin_Line); } else if (theFeatureID == SKETCH_CIRCLE_KIND) { - return boost::shared_ptr(new SketchPlugin_Circle); + return FeaturePtr(new SketchPlugin_Circle); } else if (theFeatureID == SKETCH_CONSTRAINT_COINCIDENCE_KIND) { - return boost::shared_ptr(new SketchPlugin_ConstraintCoincidence); + return FeaturePtr(new SketchPlugin_ConstraintCoincidence); } else if (theFeatureID == SKETCH_CONSTRAINT_DISTANCE_KIND) { - return boost::shared_ptr(new SketchPlugin_ConstraintDistance); + return FeaturePtr(new SketchPlugin_ConstraintDistance); } else if (theFeatureID == SKETCH_CONSTRAINT_LENGTH_KIND) { - return boost::shared_ptr(new SketchPlugin_ConstraintLength); + return FeaturePtr(new SketchPlugin_ConstraintLength); } else if (theFeatureID == SKETCH_CONSTRAINT_PARALLEL_KIND) { - return boost::shared_ptr(new SketchPlugin_ConstraintParallel); + return FeaturePtr(new SketchPlugin_ConstraintParallel); } else if (theFeatureID == SKETCH_CONSTRAINT_PERPENDICULAR_KIND) { - return boost::shared_ptr(new SketchPlugin_ConstraintPerpendicular); + return FeaturePtr(new SketchPlugin_ConstraintPerpendicular); } else if (theFeatureID == SKETCH_CONSTRAINT_RADIUS_KIND) { - return boost::shared_ptr(new SketchPlugin_ConstraintRadius); + return FeaturePtr(new SketchPlugin_ConstraintRadius); } // feature of such kind is not found - return boost::shared_ptr(); + return FeaturePtr(); } diff --git a/src/SketchPlugin/SketchPlugin_Plugin.h b/src/SketchPlugin/SketchPlugin_Plugin.h index f232b68fa..408ae73cc 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.h +++ b/src/SketchPlugin/SketchPlugin_Plugin.h @@ -8,12 +8,13 @@ #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 createFeature(std::string theFeatureID); + virtual FeaturePtr createFeature(std::string theFeatureID); public: /// Is needed for python wrapping by swig diff --git a/src/SketchPlugin/SketchPlugin_Point.h b/src/SketchPlugin/SketchPlugin_Point.h index e791cce85..8d37e19e1 100644 --- a/src/SketchPlugin/SketchPlugin_Point.h +++ b/src/SketchPlugin/SketchPlugin_Point.h @@ -43,7 +43,7 @@ public: /// 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& theFeature) {}; + const FeaturePtr& theFeature) {}; /// Use plugin manager for features creation SketchPlugin_Point(); diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index 1d97cb2b0..d2c111990 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -50,7 +50,7 @@ const boost::shared_ptr& SketchPlugin_Sketch::preview() return getPreview(); } -const void SketchPlugin_Sketch::addSub(const boost::shared_ptr& theFeature) +const void SketchPlugin_Sketch::addSub(const FeaturePtr& theFeature) { boost::dynamic_pointer_cast(theFeature)->setSketch(this); data()->reflist(SKETCH_ATTR_FEATURES)->append(theFeature); diff --git a/src/SketchPlugin/SketchPlugin_Sketch.h b/src/SketchPlugin/SketchPlugin_Sketch.h index b5a46830a..8337c8d24 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.h +++ b/src/SketchPlugin/SketchPlugin_Sketch.h @@ -51,7 +51,7 @@ public: /// 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& theFeature); + const FeaturePtr& theFeature); /// Converts a 2D sketch space point into point in 3D space SKETCHPLUGIN_EXPORT boost::shared_ptr to3D( diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp index d349e78b9..186e80505 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp @@ -317,10 +317,10 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity( // Purpose: create/update the element defined by the feature affected by any constraint // ============================================================================ Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity( - boost::shared_ptr theEntity) + FeaturePtr theEntity) { // If the entity is already in the group, try to find it - std::map, Slvs_hEntity>::const_iterator + std::map::const_iterator aEntIter = myEntityFeatMap.find(theEntity); // defines that the entity already exists const bool isEntExists = (myEntityFeatMap.find(theEntity) != myEntityFeatMap.end()); @@ -996,13 +996,13 @@ void SketchSolver_ConstraintGroup::removeConstraint(boost::shared_ptr, Slvs_hEntity>::iterator + std::map::iterator anEntFeatIter = myEntityFeatMap.begin(); while (anEntFeatIter != myEntityFeatMap.end()) { if (anEntToRemove.find(anEntFeatIter->second) != anEntToRemove.end()) { - std::map, Slvs_hEntity>::iterator + std::map::iterator aRemovedIter = anEntFeatIter; anEntFeatIter++; myEntityFeatMap.erase(aRemovedIter); diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.h b/src/SketchSolver/SketchSolver_ConstraintGroup.h index 7baeac158..69c1a7c04 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.h +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.h @@ -104,7 +104,7 @@ protected: * \return identifier of changed entity or 0 if entity could not be changed */ Slvs_hEntity changeEntity(boost::shared_ptr theEntity); - Slvs_hEntity changeEntity(boost::shared_ptr theEntity); + Slvs_hEntity changeEntity(FeaturePtr theEntity); /** \brief Adds or updates a normal in the group * @@ -192,7 +192,7 @@ private: myConstraintMap; ///< The map between SketchPlugin and SolveSpace constraints std::map, Slvs_hEntity> myEntityAttrMap; ///< The map between "attribute" parameters of constraints and their equivalent SolveSpace entities - std::map, Slvs_hEntity> + std::map myEntityFeatMap; ///< The map between "feature" parameters of constraints and their equivalent SolveSpace entities // Conincident items diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.cpp b/src/SketchSolver/SketchSolver_ConstraintManager.cpp index dd71f00f1..e91d65a16 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintManager.cpp @@ -64,12 +64,12 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_MOVED)) { const Model_FeatureUpdatedMessage* anUpdateMsg = dynamic_cast(theMessage); - std::set< boost::shared_ptr > 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 >::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 @@ -343,8 +343,8 @@ boost::shared_ptr SketchSolver_ConstraintManager::findWork boost::shared_ptr aWPFeatures = boost::dynamic_pointer_cast(aWP->data()->attribute(SKETCH_ATTR_FEATURES)); - std::list< boost::shared_ptr > aFeaturesList = aWPFeatures->list(); - std::list< boost::shared_ptr >::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 diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 2321f4874..54f3728ed 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -32,17 +32,17 @@ XGUI_Displayer::~XGUI_Displayer() { } -bool XGUI_Displayer::isVisible(boost::shared_ptr theFeature) +bool XGUI_Displayer::isVisible(FeaturePtr theFeature) { return myFeature2AISObjectMap.find(theFeature) != myFeature2AISObjectMap.end(); } -//void XGUI_Displayer::Display(boost::shared_ptr theFeature, +//void XGUI_Displayer::Display(FeaturePtr theFeature, // const bool isUpdateViewer) //{ //} -/*void XGUI_Displayer::Display(boost::shared_ptr theFeature, +/*void XGUI_Displayer::Display(FeaturePtr theFeature, const TopoDS_Shape& theShape, const bool isUpdateViewer) { Handle(AIS_InteractiveContext) aContext = AISContext(); @@ -58,7 +58,7 @@ bool XGUI_Displayer::isVisible(boost::shared_ptr theFeature) std::list XGUI_Displayer::getSelected(const int theShapeTypeToSkip) { - std::set > aPrsFeatures; + std::set aPrsFeatures; std::list aPresentations; Handle(AIS_InteractiveContext) aContext = AISContext(); @@ -69,7 +69,7 @@ std::list XGUI_Displayer::getSelected(const int theShapeTypeToSk if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip) continue; - boost::shared_ptr aFeature = getFeature(anIO); + FeaturePtr aFeature = getFeature(anIO); if (aPrsFeatures.find(aFeature) != aPrsFeatures.end()) continue; Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner(); @@ -81,7 +81,7 @@ std::list XGUI_Displayer::getSelected(const int theShapeTypeToSk std::list XGUI_Displayer::getHighlighted(const int theShapeTypeToSkip) { - std::set > aPrsFeatures; + std::set aPrsFeatures; std::list aPresentations; Handle(AIS_InteractiveContext) aContext = AISContext(); @@ -91,7 +91,7 @@ std::list XGUI_Displayer::getHighlighted(const int theShapeTypeT if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip) continue; - boost::shared_ptr aFeature = getFeature(anIO); + FeaturePtr aFeature = getFeature(anIO); if (aPrsFeatures.find(aFeature) != aPrsFeatures.end()) continue; aPresentations.push_back(XGUI_ViewerPrs(aFeature, aShape, NULL)); @@ -101,7 +101,7 @@ std::list XGUI_Displayer::getHighlighted(const int theShapeTypeT return aPresentations; } -void XGUI_Displayer::erase(boost::shared_ptr theFeature, +void XGUI_Displayer::erase(FeaturePtr theFeature, const bool isUpdateViewer) { if (myFeature2AISObjectMap.find(theFeature) == myFeature2AISObjectMap.end()) @@ -120,7 +120,7 @@ void XGUI_Displayer::erase(boost::shared_ptr theFeature, updateViewer(); } -bool XGUI_Displayer::redisplay(boost::shared_ptr theFeature, +bool XGUI_Displayer::redisplay(FeaturePtr theFeature, Handle(AIS_InteractiveObject) theAIS, const int theSelectionMode, const bool isUpdateViewer) @@ -157,7 +157,7 @@ bool XGUI_Displayer::redisplay(boost::shared_ptr theFeature, return isCreated; } -void XGUI_Displayer::activateInLocalContext(boost::shared_ptr theFeature, +void XGUI_Displayer::activateInLocalContext(FeaturePtr theFeature, const std::list& theModes, const bool isUpdateViewer) { Handle(AIS_InteractiveContext) aContext = AISContext(); @@ -194,7 +194,7 @@ void XGUI_Displayer::stopSelection(const std::list& theFeatures, Handle(AIS_Shape) anAIS; std::list::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end(); - boost::shared_ptr aFeature; + FeaturePtr aFeature; for (; anIt != aLast; anIt++) { aFeature = (*anIt).feature(); if (isVisible(aFeature)) @@ -222,7 +222,7 @@ void XGUI_Displayer::setSelected(const std::list& theFeatures, c Handle(AIS_InteractiveContext) aContext = AISContext(); std::list::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end(); - boost::shared_ptr aFeature; + FeaturePtr aFeature; Handle(AIS_Shape) anAIS; // we need to unhighligth objects manually in the current local context @@ -271,10 +271,10 @@ void XGUI_Displayer::eraseDeletedFeatures(const bool isUpdateViewer) FeatureToAISMap::const_iterator aFIt = myFeature2AISObjectMap.begin(), aFLast = myFeature2AISObjectMap.end(); - std::list> aRemoved; + std::list aRemoved; for (; aFIt != aFLast; aFIt++) { - boost::shared_ptr aFeature = (*aFIt).first; + FeaturePtr aFeature = (*aFIt).first; if (!aFeature || !aFeature->data() || !aFeature->data()->isValid()) { Handle(AIS_InteractiveObject) anAIS = (*aFIt).second; if (!anAIS.IsNull()) { @@ -283,7 +283,7 @@ void XGUI_Displayer::eraseDeletedFeatures(const bool isUpdateViewer) } } } - std::list>::const_iterator anIt = aRemoved.begin(), + std::list::const_iterator anIt = aRemoved.begin(), aLast = aRemoved.end(); for (; anIt != aLast; anIt++) { myFeature2AISObjectMap.erase(myFeature2AISObjectMap.find(*anIt)); @@ -299,7 +299,7 @@ void XGUI_Displayer::closeLocalContexts(const bool isUpdateViewer) } Handle(AIS_InteractiveObject) XGUI_Displayer::getAISObject( - boost::shared_ptr theFeature) const + FeaturePtr theFeature) const { Handle(AIS_InteractiveObject) anIO; if (myFeature2AISObjectMap.find(theFeature) != myFeature2AISObjectMap.end()) @@ -307,9 +307,9 @@ Handle(AIS_InteractiveObject) XGUI_Displayer::getAISObject( return anIO; } -boost::shared_ptr XGUI_Displayer::getFeature(Handle(AIS_InteractiveObject) theIO) const +FeaturePtr XGUI_Displayer::getFeature(Handle(AIS_InteractiveObject) theIO) const { - boost::shared_ptr aFeature; + FeaturePtr aFeature; FeatureToAISMap::const_iterator aFIt = myFeature2AISObjectMap.begin(), aFLast = myFeature2AISObjectMap.end(); for (; aFIt != aFLast && !aFeature; aFIt++) { diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index d0d4789d7..b8389af5d 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -15,6 +15,8 @@ #include #include +#include + #include #include @@ -44,18 +46,18 @@ public: /// Returns the feature visibility state. /// \param theFeature a feature instance - bool isVisible(boost::shared_ptr 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 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 theFeature, const TopoDS_Shape& theShape, + //void Display(FeaturePtr theFeature, const TopoDS_Shape& theShape, // const bool isUpdateViewer = true); /// Returns a list of viewer selected presentations @@ -73,7 +75,7 @@ public: /// \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 theFeature, + bool redisplay(FeaturePtr theFeature, Handle(AIS_InteractiveObject) theAIS, const int theSelectionMode, const bool isUpdateViewer = true); @@ -87,7 +89,7 @@ public: /// \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 theFeature, + void activateInLocalContext(FeaturePtr theFeature, const std::list& theModes, const bool isUpdateViewer = true); /// Stop the current selection and color the given features to the selection color @@ -105,7 +107,7 @@ public: /// 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 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 @@ -125,13 +127,13 @@ public: /// 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 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 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); @@ -142,7 +144,7 @@ protected: protected: XGUI_Workshop* myWorkshop; - typedef std::map, Handle(AIS_InteractiveObject) > FeatureToAISMap; + typedef std::map FeatureToAISMap; FeatureToAISMap myFeature2AISObjectMap; }; diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index f511a5750..ce30a89c1 100644 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -119,7 +119,7 @@ QWidget* XGUI_PropertyPanel::contentWidget() return myCustomWidget; } -void XGUI_PropertyPanel::updateContentWidget(boost::shared_ptr theFeature) +void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature) { foreach(ModuleBase_ModelWidget* eachWidget, myWidgets) { eachWidget->restoreValue(theFeature); diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index d034d7289..67c9857c3 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -30,7 +30,7 @@ public: virtual bool eventFilter(QObject *theObject, QEvent *theEvent); public slots: - void updateContentWidget(boost::shared_ptr 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); diff --git a/src/XGUI/XGUI_Tools.cpp b/src/XGUI/XGUI_Tools.cpp index 339d08369..3148bc274 100644 --- a/src/XGUI/XGUI_Tools.cpp +++ b/src/XGUI/XGUI_Tools.cpp @@ -56,13 +56,13 @@ QRect makeRect(const int x1, const int y1, const int x2, const int y2) } //****************************************************************** -bool isModelObject(boost::shared_ptr theFeature) +bool isModelObject(FeaturePtr theFeature) { return theFeature && !theFeature->data(); } //****************************************************************** -std::string featureInfo(boost::shared_ptr theFeature) +std::string featureInfo(FeaturePtr theFeature) { std::ostringstream aStream; if (theFeature) diff --git a/src/XGUI/XGUI_Tools.h b/src/XGUI/XGUI_Tools.h index d20260f8e..f2f2b9d88 100644 --- a/src/XGUI/XGUI_Tools.h +++ b/src/XGUI/XGUI_Tools.h @@ -5,10 +5,11 @@ #include #include +#include + #include class TopoDS_Shape; -class ModelAPI_Feature; /*! \brief Return directory part of the file path. @@ -64,13 +65,13 @@ namespace XGUI_Tools Returns true if the feature is a model object \param theFeature a feature */ - bool XGUI_EXPORT isModelObject(boost::shared_ptr 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 theFeature); + std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature); } #endif diff --git a/src/XGUI/XGUI_ViewerPrs.cpp b/src/XGUI/XGUI_ViewerPrs.cpp index 50cc05d88..e0958f76f 100644 --- a/src/XGUI/XGUI_ViewerPrs.cpp +++ b/src/XGUI/XGUI_ViewerPrs.cpp @@ -10,7 +10,7 @@ XGUI_ViewerPrs::XGUI_ViewerPrs() { } -XGUI_ViewerPrs::XGUI_ViewerPrs(boost::shared_ptr theFeature, +XGUI_ViewerPrs::XGUI_ViewerPrs(FeaturePtr theFeature, const TopoDS_Shape& theShape, Handle(SelectMgr_EntityOwner) theOwner) : myFeature(theFeature), myShape(theShape), myOwner(theOwner) @@ -21,12 +21,12 @@ XGUI_ViewerPrs::~XGUI_ViewerPrs() { } -void XGUI_ViewerPrs::setFeature(boost::shared_ptr theFeature) +void XGUI_ViewerPrs::setFeature(FeaturePtr theFeature) { myFeature = theFeature; } -boost::shared_ptr XGUI_ViewerPrs::feature() const +FeaturePtr XGUI_ViewerPrs::feature() const { return myFeature; } diff --git a/src/XGUI/XGUI_ViewerPrs.h b/src/XGUI/XGUI_ViewerPrs.h index b0e046b4e..585b65cc3 100644 --- a/src/XGUI/XGUI_ViewerPrs.h +++ b/src/XGUI/XGUI_ViewerPrs.h @@ -11,7 +11,7 @@ #include #include -class ModelAPI_Feature; +#include /**\class XGUI_ViewerPrs * \ingroup GUI @@ -26,7 +26,7 @@ public: /// \param theFeature a model feature /// \param theShape a viewer shape /// \param theOwner a selection owner - XGUI_ViewerPrs(boost::shared_ptr theFeature, + XGUI_ViewerPrs(FeaturePtr theFeature, const TopoDS_Shape& theShape, Handle_SelectMgr_EntityOwner theOwner); /// Destructor @@ -34,11 +34,11 @@ public: /// Sets the feature. /// \param theFeature a feature instance - void setFeature(boost::shared_ptr theFeature); + void setFeature(FeaturePtr theFeature); /// Returns the feature. /// \return a feature instance - boost::shared_ptr feature() const; + FeaturePtr feature() const; /// Returns the presentation owner /// \param the owner @@ -57,7 +57,7 @@ public: const TopoDS_Shape& shape() const; private: - boost::shared_ptr myFeature; /// the feature + FeaturePtr myFeature; /// the feature Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner TopoDS_Shape myShape; /// the shape };