X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Tools.cpp;h=bbe2969817513dd4a31bf352e794950d47a9a247;hb=8f060aedd5949990421a96e3b4086f43efa13d24;hp=a9aa9d90c9227f17193f72ea945b42141ec2fd42;hpb=868158fe6d39b25e60ac528295b1c908821e4af5;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Tools.cpp b/src/SketchPlugin/SketchPlugin_Tools.cpp index a9aa9d90c..bbe296981 100644 --- a/src/SketchPlugin/SketchPlugin_Tools.cpp +++ b/src/SketchPlugin/SketchPlugin_Tools.cpp @@ -33,17 +33,17 @@ void clearExpressions(AttributePoint2DPtr theAttribute) void clearExpressions(AttributePtr theAttribute) { // Double - AttributeDoublePtr anAttributeDouble = + AttributeDoublePtr anAttributeDouble = std::dynamic_pointer_cast(theAttribute); if (anAttributeDouble.get()) clearExpressions(anAttributeDouble); // Point - AttributePointPtr anAttributePoint = + AttributePointPtr anAttributePoint = std::dynamic_pointer_cast(theAttribute); if (anAttributePoint.get()) clearExpressions(anAttributePoint); // Point2D - AttributePoint2DPtr anAttributePoint2D = + AttributePoint2DPtr anAttributePoint2D = std::dynamic_pointer_cast(theAttribute); if (anAttributePoint2D.get()) clearExpressions(anAttributePoint2D); @@ -54,7 +54,7 @@ void clearExpressions(FeaturePtr theFeature) if (!theFeature.get()) return; - std::list anAttributes = theFeature->data()->attributes(std::string()); + std::list anAttributes = theFeature->data()->attributes(std::string()); std::list::iterator anAttributeIt = anAttributes.begin(); for (; anAttributeIt != anAttributes.end(); ++anAttributeIt) { clearExpressions(*anAttributeIt); @@ -63,8 +63,8 @@ void clearExpressions(FeaturePtr theFeature) std::shared_ptr getCoincidencePoint(const FeaturePtr theStartCoin) { - std::shared_ptr aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), - SketchPlugin_Constraint::ENTITY_A()); + std::shared_ptr aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), + SketchPlugin_Constraint::ENTITY_A()); if (aPnt.get() == NULL) aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), SketchPlugin_Constraint::ENTITY_B()); return aPnt; @@ -101,57 +101,4 @@ void findCoincidences(const FeaturePtr theStartCoin, } } -void updateMultiAttribute(const AttributePtr& theFirstAngleAttribute, - const AttributePtr& theSecondAngleAttribute, - const int& theValue, - const bool toMultiply) -{ - if (theValue == 0 || !theFirstAngleAttribute->isInitialized()) - return; - - AttributeDoublePtr aDoubleFirstAttr = std::dynamic_pointer_cast( - theFirstAngleAttribute); - double aValue = aDoubleFirstAttr->value(); - - AttributeDoublePtr aDoubleSecondAttr = std::dynamic_pointer_cast( - theSecondAngleAttribute); - if (toMultiply) - aDoubleSecondAttr->setValue(aValue*theValue); - else - aDoubleSecondAttr->setValue(aValue/theValue); -} - -void updateMultiAttribute(const AttributePtr& theFirstAttribute, - const AttributePtr& theSecondAttribute, - const AttributePtr& theModifiedAttribute, - const int& theValue, - const bool toMultiply) -{ - if (theValue == 0 || !theFirstAttribute->isInitialized() - || !theSecondAttribute->isInitialized()) - return; - - std::shared_ptr aFirstPoint = - std::dynamic_pointer_cast(theFirstAttribute); - std::shared_ptr aSecondPoint = - std::dynamic_pointer_cast(theSecondAttribute); - std::shared_ptr aModifiedPoint = - std::dynamic_pointer_cast(theModifiedAttribute); - - if (!aFirstPoint.get() || !aSecondPoint.get() || !aModifiedPoint.get()) - return; - - if (aFirstPoint->pnt()->isEqual(aSecondPoint->pnt())) - aModifiedPoint->setValue(aFirstPoint->pnt()); - else { - double aDx = aSecondPoint->x() - aFirstPoint->x(); - double aDy = aSecondPoint->y() - aFirstPoint->y(); - - double aX = toMultiply ? aDx * theValue : aDx / theValue; - double anY = toMultiply ? aDy * theValue : aDy / theValue; - - aModifiedPoint->setValue(aFirstPoint->x() + aX, aFirstPoint->y() + anY); - } -} - } // namespace SketchPlugin_Tools