From: sbh Date: Mon, 13 Apr 2015 09:33:54 +0000 (+0300) Subject: Fix of errors under Linux X-Git-Tag: V_1.1.0~38^2~5^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3f110833db247531898b6bc6ab59a07dbbd21829;p=modules%2Fshaper.git Fix of errors under Linux --- diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp index 591536e01..4522b07a8 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp @@ -156,21 +156,21 @@ double SketchPlugin_ConstraintDistance::calculateCurrentDistance() const std::shared_ptr aPointB = SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B()); - if (aPointA && aPointB) { // both points + if (aPointA.get() && aPointB.get()) { // both points aDistance = aPointA->pnt()->distance(aPointB->pnt()); } else { - if (!aPointA && aPointB) { //Line and point - FeaturePtr aLineFeature = - SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A()); - std::shared_ptr aLine = std::dynamic_pointer_cast(aLineFeature); - if (aLine) { + FeaturePtr aLineFeature; + std::shared_ptr aLine; + if (!aPointA.get() && aPointB.get()) { //Line and point + aLineFeature = SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A()); + aLine = std::dynamic_pointer_cast(aLineFeature); + if (aLine.get()) { aDistance = aLine->distanceToPoint(aPointB->pnt()); } - } else if (aPointA && !aPointB) { // Point and line - FeaturePtr aLineFeasture = - SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B()); - std::shared_ptr aLine = std::dynamic_pointer_cast(aLineFeasture); - if (aLine) { + } else if (aPointA.get() && !aPointB.get()) { // Point and line + aLineFeature = SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B()); + aLine = std::dynamic_pointer_cast(aLineFeature); + if (aLine.get()) { aDistance = aLine->distanceToPoint(aPointA->pnt()); } } @@ -178,7 +178,8 @@ double SketchPlugin_ConstraintDistance::calculateCurrentDistance() const return aDistance; } -void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID) { +void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID) +{ if (theID == SketchPlugin_Constraint::ENTITY_A() || theID == SketchPlugin_Constraint::ENTITY_B()) {