- std::shared_ptr<GeomAPI_Pnt> aPoint1, aPoint2;
- std::shared_ptr<GeomDataAPI_Point2D> aStartPoint, anEndPoint;
- if (!getPoints(aPoint1, aPoint2, aStartPoint, anEndPoint))
- return thePrevious; // not possible to show length because points are not defined
-
- std::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
- std::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = std::dynamic_pointer_cast<
- GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
- std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = std::shared_ptr<GeomAPI_Pnt>();
- if (aFlyOutAttr->isInitialized()) {
- aFlyoutPnt = sketch()->to3D(aFlyOutAttr->x(), aFlyOutAttr->y());
- } else {
- std::shared_ptr<GeomAPI_Lin2d> aLine =
- std::shared_ptr<GeomAPI_Lin2d>(new GeomAPI_Lin2d(aStartPoint->pnt(), anEndPoint->pnt()));
- double aDist = aPoint1->distance(aPoint2)/5.;
- std::shared_ptr<GeomAPI_Pnt2d> aFPnt = aLine->shiftedLocation(aDist);
- aFlyOutAttr->setValue(aFPnt);
- aFlyoutPnt = sketch()->to3D(aFPnt->x(), aFPnt->y());
- }
- // value calculation
- // TODO: has to be calculated on definition of reference object
- double aDistance = aPoint1->distance(aPoint2);
- std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
- ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
- double aValue = aDistance;
- if (aValueAttr->isInitialized())
- aValue = aValueAttr->value();
- else
- aValueAttr->setValue(aValue);
- // End TODO