X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketcherPrs%2FSketcherPrs_Tools.cpp;h=cdf0a2391fe6df19f42dac01a7a32f4da9681f2d;hb=747178d21dce4fb034ff0e84c1280406ab64d566;hp=8b32e6944878444f03ae9722d5a7931c91f30645;hpb=190904ad404bab6bd70b2c86ac1ea12f94abec21;p=modules%2Fshaper.git diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index 8b32e6944..cdf0a2391 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; @@ -83,6 +95,11 @@ ObjectPtr getResult(ModelAPI_Feature* theFeature, const std::string& theAttrName std::shared_ptr getShape(ObjectPtr theObject) { ResultConstructionPtr aRes = std::dynamic_pointer_cast(theObject); + if (!aRes.get()) { + FeaturePtr aFeature = std::dynamic_pointer_cast(theObject); + if (aFeature.get()) + aRes = std::dynamic_pointer_cast(aFeature->lastResult()); + } if (aRes.get() != NULL && aRes->data()->isValid()) { /// essential check as it is called in openGl thread return aRes->shape(); @@ -210,11 +227,12 @@ std::list getFreePoints(const CompositeFeaturePtr& theSketch) bool aIsFree = true; for(int aKind = 0; aIsFree && aKind < 2; aKind++) { // 0 for feature, 1 for result ObjectPtr aReferenced = aCurrent; - if (aKind == 1) + if (aKind == 1) { if (!aCurrent->results().empty()) aReferenced = aCurrent->firstResult(); else break; + } const std::set& aRefs = aReferenced->data()->refsToMe(); std::set::iterator aRIt = aRefs.begin(); for (; aRIt != aRefs.end(); ++aRIt) { @@ -369,17 +387,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",