X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketcherPrs%2FSketcherPrs_Tools.cpp;h=156e1265954e78e745b83ebd8b2c4cb8f8c02db8;hb=50a8df0c6a66da8067b16155e5ae39f8f26a7ebc;hp=4e9522fd1f94caec8056f5c4faf59cbd7d613d58;hpb=d588149317acbc2bd8e6ceb00f8e82e806571775;p=modules%2Fshaper.git diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index 4e9522fd1..156e12659 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -51,6 +51,18 @@ namespace SketcherPrs_Tools { +static ParameterStyle MyStyle = ParameterValue; + +void setParameterStyle(ParameterStyle theStyle) +{ + MyStyle = theStyle; +} + +ParameterStyle parameterStyle() +{ + return MyStyle; +} + AttributePtr getAttribute(ModelAPI_Feature* theFeature, const std::string& theAttrName) { AttributePtr anAttribute; @@ -94,8 +106,12 @@ std::shared_ptr getShape(ObjectPtr theObject) std::shared_ptr getPoint(ModelAPI_Feature* theFeature, const std::string& theAttribute) { - std::shared_ptr aPointAttr = ModelGeomAlgo_Point2D::getPointOfRefAttr( + std::shared_ptr aPointAttr = + std::dynamic_pointer_cast(theFeature->attribute(theAttribute)); + if (!aPointAttr.get() || !aPointAttr->isInitialized()) { + aPointAttr = ModelGeomAlgo_Point2D::getPointOfRefAttr( theFeature, theAttribute, SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); + } if (aPointAttr.get() != NULL) return aPointAttr->pnt(); return std::shared_ptr(); @@ -365,17 +381,6 @@ std::shared_ptr getAnchorPoint(const ModelAPI_Feature* theConstrain return thePlane->to3D(aFlyoutPnt->x(), aFlyoutPnt->y()); } -void sendExpressionShownEvent(const bool& theState) -{ - static Events_ID anId = SketcherPrs_ParameterStyleMessage::eventId(); - std::shared_ptr aMessage = std::shared_ptr - (new SketcherPrs_ParameterStyleMessage(anId, 0)); - aMessage->setStyle(theState ? SketcherPrs_ParameterStyleMessage::ParameterText - : SketcherPrs_ParameterStyleMessage::ParameterValue); - Events_Loop::loop()->send(aMessage); - Events_Loop::loop()->flush(anId); -} - void sendEmptyPresentationError(ModelAPI_Feature* theFeature, const std::string theError) { Events_InfoMessage("SketcherPrs_Tools",