1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_Tools.cpp
4 // Created: 07 July 2015
5 // Author: Sergey POKHODENKO
7 #include "SketchPlugin_Tools.h"
9 #include <GeomDataAPI_Point.h>
10 #include <GeomDataAPI_Point2D.h>
11 #include <ModelAPI_AttributeDouble.h>
13 void clearExpressions(AttributeDoublePtr theAttribute)
15 theAttribute->setText(std::string());
18 void clearExpressions(AttributePointPtr theAttribute)
20 theAttribute->setText(std::string(), std::string(), std::string());
23 void clearExpressions(AttributePoint2DPtr theAttribute)
25 theAttribute->setText(std::string(), std::string());
28 void clearExpressions(AttributePtr theAttribute)
31 AttributeDoublePtr anAttributeDouble =
32 std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
33 if (anAttributeDouble.get())
34 clearExpressions(anAttributeDouble);
36 AttributePointPtr anAttributePoint =
37 std::dynamic_pointer_cast<GeomDataAPI_Point>(theAttribute);
38 if (anAttributePoint.get())
39 clearExpressions(anAttributePoint);
41 AttributePoint2DPtr anAttributePoint2D =
42 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
43 if (anAttributePoint2D.get())
44 clearExpressions(anAttributePoint2D);
47 void clearExpressions(FeaturePtr theFeature)
49 if (!theFeature.get())
52 std::list<AttributePtr> anAttributes = theFeature->data()->attributes(std::string());
53 std::list<AttributePtr>::iterator anAttributeIt = anAttributes.begin();
54 for (; anAttributeIt != anAttributes.end(); ++anAttributeIt) {
55 clearExpressions(*anAttributeIt);