X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_ConstraintDistancePrs.cpp;h=8dc195a94693f0f3d01c0a3b695152cf1625fda7;hb=1415276ab954e686026d88c8cf65812d16134f48;hp=6bd7510c9b29c1d4841b0dc500a9ba7c1807d10d;hpb=59b3db4a19c10138bf23f01f0c5ca7a28a3b8949;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_ConstraintDistancePrs.cpp b/src/PartSet/PartSet_ConstraintDistancePrs.cpp index 6bd7510c9..8dc195a94 100644 --- a/src/PartSet/PartSet_ConstraintDistancePrs.cpp +++ b/src/PartSet/PartSet_ConstraintDistancePrs.cpp @@ -87,25 +87,11 @@ PartSet_SelectionMode PartSet_ConstraintDistancePrs::setPoint(double theX, doubl switch (theMode) { case SM_LastPoint: { - boost::shared_ptr aPoint_A = getFeaturePoint(feature(), - CONSTRAINT_ATTR_ENTITY_A); - boost::shared_ptr aPoint_B = getFeaturePoint(feature(), - CONSTRAINT_ATTR_ENTITY_B); - - boost::shared_ptr aPoint = boost::shared_ptr - (new GeomAPI_Pnt2d(theX, theY)); - boost::shared_ptr aFeatureLin = boost::shared_ptr - (new GeomAPI_Lin2d(aPoint_A->x(), aPoint_A->y(), - aPoint_B->x(), aPoint_B->y())); - boost::shared_ptr aResult = aFeatureLin->project(aPoint); - double aDistance = aPoint->distance(aResult); - - if (!aFeatureLin->isRight(aPoint)) - aDistance = -aDistance; - - AttributeDoublePtr aFlyoutAttr = boost::dynamic_pointer_cast - (feature()->data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE)); - aFlyoutAttr->setValue(aDistance); + boost::shared_ptr aFlyOutAttr = + boost::dynamic_pointer_cast(feature()->data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT)); + aFlyOutAttr->setValue(boost::shared_ptr(new GeomAPI_Pnt2d(theX, theY))); + + boost::shared_ptr aFlyOutPnt = aFlyOutAttr->pnt(); aMode = SM_DonePoint; } @@ -116,73 +102,6 @@ PartSet_SelectionMode PartSet_ConstraintDistancePrs::setPoint(double theX, doubl return aMode; } -Handle(AIS_InteractiveObject) PartSet_ConstraintDistancePrs::createPresentation(FeaturePtr theFeature, - FeaturePtr theSketch, - Handle(AIS_InteractiveObject) thePreviuos) -{ - Handle(AIS_InteractiveObject) anAIS = thePreviuos; - if (!theFeature || !theSketch) - return anAIS; - boost::shared_ptr aGPlane = PartSet_Tools::sketchPlane(theSketch); - gp_Pln aPlane = aGPlane->impl(); - - boost::shared_ptr aPoint_A = getFeaturePoint(theFeature, CONSTRAINT_ATTR_ENTITY_A); - boost::shared_ptr aPoint_B = getFeaturePoint(theFeature, CONSTRAINT_ATTR_ENTITY_B); - if (!aPoint_A || !aPoint_B) - return anAIS; - - boost::shared_ptr aData = theFeature->data(); - boost::shared_ptr aFlyoutAttr = - boost::dynamic_pointer_cast(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE)); - double aFlyout = aFlyoutAttr->value(); - - boost::shared_ptr aValueAttr = - boost::dynamic_pointer_cast(aData->attribute(CONSTRAINT_ATTR_VALUE)); - double aValue = aValueAttr->value(); - - gp_Pnt aPoint1, aPoint2; - PartSet_Tools::convertTo3D(aPoint_A->x(), aPoint_A->y(), theSketch, aPoint1); - PartSet_Tools::convertTo3D(aPoint_B->x(), aPoint_B->y(), theSketch, aPoint2); - - //Build dimension here - gp_Pnt aP1 = aPoint1; - gp_Pnt aP2 = aPoint2; - if (aFlyout < 0) { - aP1 = aPoint2; - aP2 = aPoint1; - } - - if (anAIS.IsNull()) - { - Handle(AIS_LengthDimension) aDimAIS = new AIS_LengthDimension(aP1, aP2, aPlane); - aDimAIS->SetCustomValue(aValue); - - Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect(); - anAspect->MakeArrows3d (Standard_False); - anAspect->MakeText3d(false); - anAspect->TextAspect()->SetHeight(CONSTRAINT_TEXT_HEIGHT); - anAspect->MakeTextShaded(false); - aDimAIS->DimensionAspect()->MakeUnitsDisplayed(false); - aDimAIS->SetDimensionAspect (anAspect); - aDimAIS->SetFlyout(aFlyout); - aDimAIS->SetSelToleranceForText2d(CONSTRAINT_TEXT_SELECTION_TOLERANCE); - - anAIS = aDimAIS; - } - else { - // update presentation - Handle(AIS_LengthDimension) aDimAIS = Handle(AIS_LengthDimension)::DownCast(anAIS); - if (!aDimAIS.IsNull()) { - aDimAIS->SetMeasuredGeometry(aPoint1, aPoint2, aPlane); - aDimAIS->SetCustomValue(aValue); - aDimAIS->SetFlyout(aFlyout); - - aDimAIS->Redisplay(Standard_True); - } - } - return anAIS; -} - boost::shared_ptr PartSet_ConstraintDistancePrs::getFeaturePoint (FeaturePtr theFeature, const std::string& theAttribute) @@ -206,13 +125,6 @@ PartSet_SelectionMode PartSet_ConstraintDistancePrs::getNextMode(const std::stri return SM_FirstPoint; } -boost::shared_ptr PartSet_ConstraintDistancePrs::findPoint(FeaturePtr theFeature, - double theX, double theY) -{ - boost::shared_ptr aPoint2D; - return aPoint2D; -} - boost::shared_ptr PartSet_ConstraintDistancePrs::featurePoint (const PartSet_SelectionMode& theMode) {