X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FModelAPI_Feature.h;h=c266b505ea1a194910a7ab7a020a72b448717532;hb=f626fe578ad8bf82242d71b583e96f846e628596;hp=2c252429df3943d7e9530b33a8945a6bd7f58975;hpb=428673f6b49a1997bf97ebbe5e00501c76439c20;p=modules%2Fshaper.git diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h index 2c252429d..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_Session.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,6 +72,8 @@ 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 @@ -61,6 +83,8 @@ class ModelAPI_Feature : public ModelAPI_Object 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. @@ -82,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 +