X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FModel%2FModel_Data.cpp;h=b78b1c70746fba86e8a6c329ef350c9dfa17cc21;hb=50a8df0c6a66da8067b16155e5ae39f8f26a7ebc;hp=7995c85fde2b441764e25ddc9332c1f3f19ac640;hpb=918e097c6c3f8e02abf72c74f7a117c3b5adab61;p=modules%2Fshaper.git diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index 7995c85fd..b78b1c707 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -77,7 +77,7 @@ static const int kFlagDisplayed = 1; static const int kFlagDeleted = 2; // TDataStd_Integer - 0 if the name of the object is generated automatically, // otherwise the name is defined by user -Standard_GUID kUSER_DEFINED_NAME("9c694d18-a83c-4a56-bc9b-8020628a8244"); +static const Standard_GUID kUSER_DEFINED_NAME("9c694d18-a83c-4a56-bc9b-8020628a8244"); // invalid data const static std::shared_ptr kInvalid(new Model_Data()); @@ -85,6 +85,9 @@ const static std::shared_ptr kInvalid(new Model_Data()); static const Standard_GUID kGroupAttributeGroupID("df64ea4c-fc42-4bf8-ad7e-08f7a54bf1b8"); static const Standard_GUID kGroupAttributeID("ebdcb22a-e045-455b-9a7f-cfd38d68e185"); +// id of attribute to store the version of the feature +static const Standard_GUID kVERSION_ID("61cdb78a-1ba7-4942-976f-63bea7f4a2b1"); + Model_Data::Model_Data() : mySendAttributeUpdated(true), myWasChangedButBlocked(false) { @@ -158,6 +161,24 @@ bool Model_Data::hasUserDefinedName() const return shapeLab().IsAttribute(kUSER_DEFINED_NAME); } +std::string Model_Data::version() +{ + Handle(TDataStd_Name) aVersionAttr; + std::string aVersion; + if (shapeLab().FindAttribute(kVERSION_ID, aVersionAttr)) + aVersion = TCollection_AsciiString(aVersionAttr->Get()).ToCString(); + return aVersion; +} + +void Model_Data::setVersion(const std::string& theVersion) +{ + Handle(TDataStd_Name) aVersionAttr; + std::string aVersion; + if (!shapeLab().FindAttribute(kVERSION_ID, aVersionAttr)) + aVersionAttr = TDataStd_Name::Set(shapeLab(), kVERSION_ID, TCollection_ExtendedString()); + aVersionAttr->Set(theVersion.c_str()); +} + AttributePtr Model_Data::addAttribute( const std::string& theID, const std::string theAttrType, const int theIndex) {