: SketchPlugin_SketchEntity()
{}
+void SketchPlugin_Line::initAttributes()
+{
+ SketchPlugin_SketchEntity::initAttributes();
+ /// new attributes should be added to end of the feature in order to provide
+ /// correct attribute values in previous saved studies
+ data()->addAttribute(LENGTH_ID(), ModelAPI_AttributeDouble::typeId());
+}
+
void SketchPlugin_Line::initDerivedClassAttributes()
{
data()->addAttribute(START_ID(), GeomDataAPI_Point2D::typeId());
data()->addAttribute(END_ID(), GeomDataAPI_Point2D::typeId());
data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId());
-#ifndef LINE_LENGHT_BLOCKED
- data()->addAttribute(LENGTH_ID(), ModelAPI_AttributeDouble::typeId());
-#endif
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID());
}
void SketchPlugin_Line::updateLenghtValue()
{
-#ifndef LINE_LENGHT_BLOCKED
std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(START_ID()));
std::shared_ptr<GeomDataAPI_Point2D> anEndAttr = std::dynamic_pointer_cast<
double aDistance = aStartAttr->pnt()->distance(anEndAttr->pnt());
data()->real(LENGTH_ID())->setValue(aDistance);
}
-#endif
}