X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Data.h;h=f3fd1c384e8dfa7c6704e0f3f9cf357e64bfa60a;hb=e13838f2afec561f5eb8c26cebf31fa67dcde81d;hp=05068cd6543c0dd1bbe7fffe578b9244b276066c;hpb=a7f44a41bdf29e7bd978ff3b8c8bd514d1223be7;p=modules%2Fshaper.git diff --git a/src/Model/Model_Data.h b/src/Model/Model_Data.h index 05068cd65..f3fd1c384 100644 --- a/src/Model/Model_Data.h +++ b/src/Model/Model_Data.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: Model_Data.hxx // Created: 21 Mar 2014 // Author: Mikhail PONIKAROV @@ -15,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +50,8 @@ class Model_Data : public ModelAPI_Data /// List of attributes referenced to owner (updated only during the transaction change) std::set myRefsToMe; + /// flag that may block the "attribute updated" sending + bool mySendAttributeUpdated; Model_Data(); @@ -96,6 +101,10 @@ class Model_Data : public ModelAPI_Data /// Returns the attribute that contains real value with double precision MODEL_EXPORT virtual std::shared_ptr string(const std::string& theID); + /// Returns the attribute that contains integer values array + MODEL_EXPORT virtual std::shared_ptr + intArray(const std::string& theID); + /// Returns the generic attribute by identifier /// \param theID identifier of the attribute MODEL_EXPORT virtual std::shared_ptr attribute(const std::string& theID); @@ -125,11 +134,15 @@ class Model_Data : public ModelAPI_Data /// for each attribute of the object /// \param theID identifier of the attribute that can be referenced by this ID later /// \param theAttrType type of the created attribute (received from the type method) - MODEL_EXPORT virtual void addAttribute(const std::string& theID, const std::string theAttrType); + /// \returns the just created attribute + MODEL_EXPORT virtual AttributePtr + addAttribute(const std::string& theID, const std::string theAttrType); /// Useful method for "set" methods of the attributes: sends an UPDATE event and /// makes attribute initialized MODEL_EXPORT virtual void sendAttributeUpdated(ModelAPI_Attribute* theAttr); + /// Blocks sending "attribute updated" if theBlock is true + MODEL_EXPORT virtual void blockSendAttributeUpdated(const bool theBlock); /// Puts feature to the document data sub-structure MODEL_EXPORT void setLabel(TDF_Label theLab); @@ -155,17 +168,31 @@ class Model_Data : public ModelAPI_Data /// Returns the identifier of feature-owner, unique in this document MODEL_EXPORT virtual int featureId() const; - // returns all objects referenced to this + /// returns all objects referenced to this MODEL_EXPORT virtual const std::set& refsToMe() {return myRefsToMe;} + /// returns all references by attributes of this data + /// \param theRefs returned list of pairs: id of referenced attribute and list of referenced objects + MODEL_EXPORT virtual void referencesToObjects( + std::list > >& theRefs); + + /// Copies all atributes content into theTarget data + MODEL_EXPORT virtual void copyTo(std::shared_ptr theTarget); + private: - // removes all information about back references + /// Removes all information about back references void eraseBackReferences(); - // adds a back reference (with identifier which attribute references to this object - void addBackReference(FeaturePtr theFeature, std::string theAttrID); - // returns all references by attributes of this data - // \param the returned list of pairs: id of referenced attribute and list of referenced objects - void referencesToObjects(std::list > >& theRefs); + /// Adds a back reference (with identifier which attribute references to this object + /// It does not change the consealment flag of the data object result + /// \param theFeature feature referenced to this + /// \param theAttrID identifier of the attribute that is references from theFeature to this + void removeBackReference(FeaturePtr theFeature, std::string theAttrID); + /// Adds a back reference (with identifier which attribute references to this object + /// \param theFeature feature referenced to this + /// \param theAttrID identifier of the attribute that is references from theFeature to this + /// \param theApplyConcealment applies consealment flag changes + void addBackReference(FeaturePtr theFeature, std::string theAttrID, + const bool theApplyConcealment = true); }; #endif