X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FModelAPI_Feature.h;h=c266b505ea1a194910a7ab7a020a72b448717532;hb=67e9407be59cbfa36082e09f077f9da274c25bfe;hp=9108074238789c34775271e033bdd8ed2bc9712b;hpb=542c9d721fbef80eb2040ef248fdd431cad2e631;p=modules%2Fshaper.git diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h index 910807423..c266b505e 100644 --- a/src/ModelAPI/ModelAPI_Feature.h +++ b/src/ModelAPI/ModelAPI_Feature.h @@ -5,13 +5,27 @@ #ifndef ModelAPI_Feature_H_ #define ModelAPI_Feature_H_ -#include "ModelAPI_Object.h" -#include "ModelAPI_PluginManager.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include #include +#include +#include + class ModelAPI_Data; class ModelAPI_Document; class ModelAPI_Result; @@ -36,6 +50,12 @@ class ModelAPI_Feature : public ModelAPI_Object return MY_GROUP; } + /// Returns document this feature belongs to + virtual boost::shared_ptr document() const + { + return ModelAPI_Object::document(); + } + /// Returns the group identifier of this result virtual std::string groupName() { @@ -52,11 +72,19 @@ class ModelAPI_Feature : public ModelAPI_Object MODELAPI_EXPORT const std::list >& results(); /// returns the first result in the list or NULL reference MODELAPI_EXPORT boost::shared_ptr firstResult(); + /// returns the last result in the list or NULL reference + MODELAPI_EXPORT boost::shared_ptr lastResult(); /// sets the alone result MODELAPI_EXPORT void setResult(const boost::shared_ptr& theResult); /// sets the result by index (zero based), results before this must be set before MODELAPI_EXPORT void setResult(const boost::shared_ptr& theResult, const int theIndex); + /// removes the result from the feature + MODELAPI_EXPORT void removeResult(const boost::shared_ptr& theResult); + /// removes all results from the feature + MODELAPI_EXPORT void eraseResults(); + /// removes all fields from this feature: results, data, etc + MODELAPI_EXPORT virtual void erase(); /// Returns true if result is persistent (stored in document) and on undo-redo, save-open /// it is not needed to recompute it. @@ -78,9 +106,73 @@ class ModelAPI_Feature : public ModelAPI_Object MODELAPI_EXPORT static boost::shared_ptr feature(ObjectPtr theObject); + // + // Helper methods, aliases for data()->method() + // ----------------------------------------------------------------------------------------------- + inline std::string name() + { + return data()->name(); + } + + inline boost::shared_ptr boolean(const std::string& theID) + { + return data()->boolean(theID); + } + + inline boost::shared_ptr document(const std::string& theID) + { + return data()->document(theID); + } + + inline boost::shared_ptr real(const std::string& theID) + { + return data()->real(theID); + } + + inline boost::shared_ptr integer(const std::string& theID) + { + return data()->integer(theID); + } + + inline boost::shared_ptr refattr(const std::string& theID) + { + return data()->refattr(theID); + } + + inline boost::shared_ptr reference(const std::string& theID) + { + return data()->reference(theID); + } + + inline boost::shared_ptr reflist(const std::string& theID) + { + return data()->reflist(theID); + } + + inline boost::shared_ptr selection(const std::string& theID) + { + return data()->selection(theID); + } + + inline boost::shared_ptr selectionList(const std::string& theID) + { + return data()->selectionList(theID); + } + + inline boost::shared_ptr string(const std::string& theID) + { + return data()->string(theID); + } + + inline boost::shared_ptr attribute(const std::string& theID) + { + return data()->attribute(theID); + } + // ----------------------------------------------------------------------------------------------- }; //! Pointer on feature object typedef boost::shared_ptr FeaturePtr; #endif +