1 // Name : SketchAPI_Translation.cpp
5 // 16/06/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "SketchAPI_Translation.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelHighAPI_Dumper.h>
11 #include <ModelHighAPI_Tools.h>
12 //--------------------------------------------------------------------------------------
13 SketchAPI_Translation::SketchAPI_Translation(
14 const std::shared_ptr<ModelAPI_Feature> & theFeature)
15 : ModelHighAPI_Interface(theFeature)
20 SketchAPI_Translation::SketchAPI_Translation(
21 const std::shared_ptr<ModelAPI_Feature> & theFeature,
22 const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
23 const ModelHighAPI_RefAttr & thePoint1,
24 const ModelHighAPI_RefAttr & thePoint2,
25 const ModelHighAPI_Integer & theNumberOfObjects,
27 : ModelHighAPI_Interface(theFeature)
30 fillAttribute(theObjects, translationList());
31 fillAttribute(thePoint1, startPoint());
32 fillAttribute(thePoint2, endPoint());
33 fillAttribute(theNumberOfObjects, numberOfObjects());
34 fillAttribute(theFullValue ? "FullValue" : "SingleValue", valueType());
40 SketchAPI_Translation::~SketchAPI_Translation()
45 //--------------------------------------------------------------------------------------
47 void SketchAPI_Translation::dump(ModelHighAPI_Dumper& theDumper) const
49 FeaturePtr aBase = feature();
50 const std::string& aSketchName = theDumper.parentName(aBase);
52 AttributeRefListPtr aTransObjects = translationList();
53 AttributeRefAttrPtr aStart = startPoint();
54 AttributeRefAttrPtr aEnd = endPoint();
55 AttributeIntegerPtr aNbCopies = numberOfObjects();
56 bool isFullValue = valueType()->value() != "SingleValue";
58 theDumper << aBase << " = " << aSketchName << ".addTranslation("
59 << aTransObjects << ", " << aStart << ", " << aEnd << ", " << aNbCopies;
61 theDumper << ", " << isFullValue;
62 theDumper << ")" << std::endl;