-// 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
#include <GeomDataAPI_Point.h>
#include <GeomDataAPI_Point2D.h>
+#include <GeomDataAPI_Point2DArray.h>
#include <GeomData_Point.h>
#include <GeomData_Point2D.h>
+#include <GeomData_Point2DArray.h>
#include <GeomData_Dir.h>
#include <Events_Loop.h>
#include <Events_InfoMessage.h>
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<ModelAPI_Data> 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)
{
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)
{
}
anAttribute->myIsInitialized = anAllInitialized;
anAttr = anAttribute;
+ } else if (theAttrType == GeomData_Point2DArray::typeId()) {
+ anAttr = new GeomData_Point2DArray(anAttrLab);
}
+
if (anAttr) {
aResult = std::shared_ptr<ModelAPI_Attribute>(anAttr);
myAttrs[theID] = std::pair<AttributePtr, int>(aResult, anAttrIndex);
} else {
// trim: need to redisplay or set color in the python script
if (myObject && (theAttr->attributeType() == "Point2D" || theAttr->id() == "Color" ||
- theAttr->id() == "Transparency" || theAttr->id() == "Deflection")) {
+ theAttr->id() == "Transparency" || theAttr->id() == "Deflection" ||
+ theAttr->id() == "Iso_lines" || theAttr->id() == "Show_Iso_lines")) {
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent);
}