From: nds Date: Tue, 24 Jun 2014 15:39:37 +0000 (+0400) Subject: Merge branch 'master' of newgeom:newgeom X-Git-Tag: V_0.4.4~251 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=96c062912cdd3eff24d2d28ab75769f26e0d84cd;p=modules%2Fshaper.git Merge branch 'master' of newgeom:newgeom Conflicts: src/PartSet/PartSet_OperationFeatureCreate.cpp --- 96c062912cdd3eff24d2d28ab75769f26e0d84cd diff --cc src/PartSet/PartSet_OperationFeatureCreate.cpp index 5da96ccb9,2e864b576..43b841bca --- a/src/PartSet/PartSet_OperationFeatureCreate.cpp +++ b/src/PartSet/PartSet_OperationFeatureCreate.cpp @@@ -59,11 -59,11 +59,11 @@@ PartSet_OperationFeatureCreate::~PartSe bool PartSet_OperationFeatureCreate::canProcessKind(const std::string& theId) { return theId == SKETCH_LINE_KIND || theId == SKETCH_POINT_KIND || - theId == SKETCH_CIRCLE_KIND /*|| - theId == SKETCH_ARC_KIND*/ || + theId == SKETCH_CIRCLE_KIND || + theId == SKETCH_ARC_KIND || - theId == SKETCH_CONSTRAINT_DISTANCE_KIND /*|| + theId == SKETCH_CONSTRAINT_DISTANCE_KIND || theId == SKETCH_CONSTRAINT_LENGTH_KIND || - theId == SKETCH_CONSTRAINT_RADIUS_KIND || + theId == SKETCH_CONSTRAINT_RADIUS_KIND /*|| theId == SKETCH_CONSTRAINT_PARALLEL_KIND || theId == SKETCH_CONSTRAINT_PERPENDICULAR_KIND*/; } diff --cc src/SketchPlugin/SketchPlugin_ConstraintLength.cpp index 7f54f7947,6e48926c6..b911ea9a4 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp @@@ -26,7 -23,7 +26,6 @@@ SketchPlugin_ConstraintLength::SketchPl void SketchPlugin_ConstraintLength::initAttributes() { data()->addAttribute(CONSTRAINT_ATTR_VALUE, ModelAPI_AttributeDouble::type()); - //data()->addAttribute(CONSTRAINT_ATTR_FLYOUT_VALUE, ModelAPI_AttributeDouble::type()); - data()->addAttribute(CONSTRAINT_ATTR_FLYOUT_VALUE, ModelAPI_AttributeDouble::type()); data()->addAttribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT, GeomDataAPI_Point2D::type()); data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type()); } @@@ -71,29 -48,10 +70,26 @@@ Handle(AIS_InteractiveObject) SketchPlu if (!aFeature || aFeature->getKind() != SKETCH_LINE_KIND) return thePrevious; - //boost::shared_ptr aFlyoutAttr = - // boost::dynamic_pointer_cast(data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE)); - //double aFlyout = aFlyoutAttr->value(); - boost::shared_ptr aFlyoutAttr = - boost::dynamic_pointer_cast(data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE)); - double aFlyout = aFlyoutAttr->value(); - + // fly out calculation + boost::shared_ptr aFlyOutAttr = + boost::dynamic_pointer_cast(data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT)); + boost::shared_ptr aFlyOutPnt = aFlyOutAttr->pnt(); + + boost::shared_ptr aStartPoint = + boost::dynamic_pointer_cast(aFeature->data()->attribute(LINE_ATTR_START)); + boost::shared_ptr anEndPoint = + boost::dynamic_pointer_cast(aFeature->data()->attribute(LINE_ATTR_END)); + + boost::shared_ptr aFeatureLin = boost::shared_ptr + (new GeomAPI_Lin2d(aStartPoint->x(), aStartPoint->y(), + anEndPoint->x(), anEndPoint->y())); + boost::shared_ptr aProjectedPoint = aFeatureLin->project(aFlyOutPnt); + double aDistance = aFlyOutPnt->distance(aProjectedPoint); + if (!aFeatureLin->isRight(aFlyOutPnt)) + aDistance = -aDistance; + double aFlyout = aDistance; + + // value boost::shared_ptr aValueAttr = boost::dynamic_pointer_cast(data()->attribute(CONSTRAINT_ATTR_VALUE)); double aValue = aValueAttr->value(); diff --cc src/SketchPlugin/SketchPlugin_ConstraintLength.h index 52012c419,52012c419..85675da3b --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.h @@@ -19,7 -19,7 +19,7 @@@ const std::string SKETCH_CONSTRAINT_LEN * * These constraint has two attributes: * CONSTRAINT_ATTR_VALUE (length) and CONSTRAINT_ATTR_ENTITY_A (segment), -- * CONSTRAINT_ATTR_FLYOUT_VALUE (distance of a constraints handle) ++ * CONSTRAINT_ATTR_FLYOUT_VALUE_PNT (distance of a constraints handle) */ class SketchPlugin_ConstraintLength: public SketchPlugin_Constraint {