From: nds Date: Fri, 16 May 2014 15:16:01 +0000 (+0400) Subject: refs #30 - Sketch base GUI: create, draw lines X-Git-Tag: V_0.2~51 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c5041810e7075f325dca0c33d27d8537381c00ab;p=modules%2Fshaper.git refs #30 - Sketch base GUI: create, draw lines It is necessary to check the feature type before the data() method called, because there can be the feature, which do not contains the asked attribute(e.g. constraint). --- diff --git a/src/PartSet/PartSet_OperationEditLine.cpp b/src/PartSet/PartSet_OperationEditLine.cpp index 5486ffff0..c9fbbfd86 100644 --- a/src/PartSet/PartSet_OperationEditLine.cpp +++ b/src/PartSet/PartSet_OperationEditLine.cpp @@ -145,7 +145,7 @@ void PartSet_OperationEditLine::moveLinePoint(boost::shared_ptrgetKind() != "SketchLine") return; boost::shared_ptr aData = theFeature->data(); diff --git a/src/PartSet/PartSet_OperationSketchLine.cpp b/src/PartSet/PartSet_OperationSketchLine.cpp index 5fb594a32..a4e09b856 100644 --- a/src/PartSet/PartSet_OperationSketchLine.cpp +++ b/src/PartSet/PartSet_OperationSketchLine.cpp @@ -68,7 +68,7 @@ std::list PartSet_OperationSketchLine::getSelectionModes(boost::shared_ptr< void PartSet_OperationSketchLine::init(boost::shared_ptr theFeature, const std::list& /*thePresentations*/) { - if (!theFeature) + if (!theFeature || theFeature->getKind() != "SketchLine") return; // use the last point of the previous feature as the first of the new one boost::shared_ptr aData = theFeature->data(); @@ -284,7 +284,7 @@ void PartSet_OperationSketchLine::getLinePoint(boost::shared_ptrgetKind() != "SketchLine") return; boost::shared_ptr aData = theFeature->data(); boost::shared_ptr aPoint = @@ -298,10 +298,10 @@ boost::shared_ptr PartSet_OperationSketchLine::findLinePoin double theX, double theY) { boost::shared_ptr aPoint2D; - if (!theFeature) + if (!theFeature || theFeature->getKind() != "SketchLine") return aPoint2D; boost::shared_ptr aData = theFeature->data(); - + boost::shared_ptr aPoint = boost::dynamic_pointer_cast(aData->attribute(LINE_ATTR_START)); if (fabs(aPoint->x() - theX) < Precision::Confusion() && fabs(aPoint->y() - theY) < Precision::Confusion() )