From 0edd45c3399c408340a033c8521ed2e3440e8375 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 31 Mar 2016 15:09:38 +0300 Subject: [PATCH] Issue #805 In the sketch presentation, show both the parameter and its value: providing for lenght dimension constraint --- src/Events/Events_Loop.cpp | 47 +++++++++++++++ src/Events/Events_Loop.h | 4 ++ src/PartSet/PartSet_Module.cpp | 36 +++++++---- src/PartSet/PartSet_Module.h | 9 +++ src/PartSet/PartSet_SketcherMgr.cpp | 60 ++++++++++++++----- src/PartSet/PartSet_SketcherMgr.h | 14 ++++- src/PartSet/PartSet_Tools.cpp | 15 +++++ src/PartSet/PartSet_Tools.h | 7 +++ src/PartSet/PartSet_WidgetSketchLabel.cpp | 1 + .../SketcherPrs_LengthDimension.cpp | 36 ++++++++++- src/SketcherPrs/SketcherPrs_LengthDimension.h | 16 ++++- src/SketcherPrs/SketcherPrs_Tools.cpp | 26 ++++++++ src/SketcherPrs/SketcherPrs_Tools.h | 50 ++++++++++++++++ 13 files changed, 292 insertions(+), 29 deletions(-) diff --git a/src/Events/Events_Loop.cpp b/src/Events/Events_Loop.cpp index d2d96de53..b96974189 100644 --- a/src/Events/Events_Loop.cpp +++ b/src/Events/Events_Loop.cpp @@ -113,6 +113,53 @@ void Events_Loop::registerListener(Events_Listener* theListener, const Events_ID aListeners.push_back(theListener); } +void Events_Loop::removeListener(Events_Listener* theListener) +{ + // remove the listener in myListeners map + std::map > >::const_reverse_iterator + anIt = myListeners.rbegin(); + while(anIt != myListeners.rend()) { + std::map > aLMap = anIt->second; + std::map >::const_reverse_iterator aLIt = aLMap.rbegin(); + while (aLIt != aLMap.rend()) { + std::list aListeners = aLIt->second; + std::list::const_reverse_iterator aLsIt = aListeners.rbegin(); + for (; aLsIt != aListeners.rend(); aLsIt++) { + if (*aLsIt == theListener) { + aListeners.remove(theListener); + aLMap[aLIt->first] = aListeners; + myListeners[anIt->first] = aLMap; + break; + } + } + if (aListeners.empty()) { + aLMap.erase(aLIt->first); + myListeners[anIt->first] = aLMap; + if (aLMap.empty()) + break; // avoid incrementation of the iterator if the the container is empty + } + aLIt++; + } + if (anIt->second.empty()) { + myListeners.erase(anIt->first); + if (myListeners.empty()) + break; // avoid incrementation of the iterator if the the container is empty + } + anIt++; + } + + // remove the listener in myImmediateListeners map + std::map::const_reverse_iterator anImIt = myImmediateListeners.rbegin(); + while(anImIt != myImmediateListeners.rend()) { + if (anImIt->second == theListener) { + myImmediateListeners.erase(anImIt->first); + if (myImmediateListeners.empty()) + break; // avoid incrementation of the iterator if the the container is empty + } + anImIt++; + } +} + void Events_Loop::flush(const Events_ID& theID) { if (!myFlushActive) diff --git a/src/Events/Events_Loop.h b/src/Events/Events_Loop.h index 66ed3070d..c1c5f2977 100644 --- a/src/Events/Events_Loop.h +++ b/src/Events/Events_Loop.h @@ -63,6 +63,10 @@ class Events_Loop EVENTS_EXPORT void registerListener(Events_Listener* theListener, const Events_ID theID, void* theSender = 0, bool theImmediate = false); + //! Remove the listener from internal maps if it was registered there + //! \param theListener a listener + EVENTS_EXPORT void removeListener(Events_Listener* theListener); + //! Initializes sending of a group-message by the given ID EVENTS_EXPORT void flush(const Events_ID& theID); diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index d38ee8de6..c230c9793 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -145,6 +145,7 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) myHasConstraintShown[PartSet_Tools::Geometrical] = true; myHasConstraintShown[PartSet_Tools::Dimensional] = true; + myHasConstraintShown[PartSet_Tools::Dimensional] = false; Config_PropManager::registerProp("Visualization", "operation_parameter_color", "Reference shape wireframe color in operation", Config_Prop::Color, @@ -401,7 +402,7 @@ void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation) aLast = myHasConstraintShown.end(); for (; anIt != aLast; anIt++) { myHasConstraintShown[anIt.key()]; - mySketchMgr->onShowConstraintsToggle(anIt.key(), anIt.value()); + mySketchMgr->updateBySketchParameters(anIt.key(), anIt.value()); } } @@ -790,23 +791,35 @@ void PartSet_Module::onFeatureTriggered() ModuleBase_IModule::onFeatureTriggered(); } +void PartSet_Module::editFeature(FeaturePtr theFeature) +{ + storeConstraintsState(theFeature->getKind()); + ModuleBase_IModule::editFeature(theFeature); +} + void PartSet_Module::launchOperation(const QString& theCmdId) +{ + storeConstraintsState(theCmdId.toStdString()); + ModuleBase_IModule::launchOperation(theCmdId); +} + +void PartSet_Module::storeConstraintsState(const std::string& theFeatureKind) { if (myWorkshop->currentOperation() && myWorkshop->currentOperation()->id().toStdString() == SketchPlugin_Sketch::ID()) { - const QMap& aShownStates = - mySketchMgr->showConstraintStates(); - myHasConstraintShown = aShownStates; + const QMap& aShownStates = + mySketchMgr->showConstraintStates(); + myHasConstraintShown = aShownStates; } - if (PartSet_SketcherMgr::constraintsIdList().contains(theCmdId)) { + if (PartSet_SketcherMgr::constraintsIdList().contains(theFeatureKind.c_str())) { // Show constraints if a constraint was anOperation - mySketchMgr->onShowConstraintsToggle(PartSet_Tools::Geometrical, true); - mySketchMgr->onShowConstraintsToggle(PartSet_Tools::Dimensional, true); + mySketchMgr->updateBySketchParameters(PartSet_Tools::Geometrical, true); + mySketchMgr->updateBySketchParameters(PartSet_Tools::Dimensional, true); + mySketchMgr->updateBySketchParameters(PartSet_Tools::Expressions, + myHasConstraintShown[PartSet_Tools::Expressions]); } - ModuleBase_IModule::launchOperation(theCmdId); } - void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS) { Handle(AIS_InteractiveObject) anAIS = theAIS->impl(); @@ -911,7 +924,7 @@ bool PartSet_Module::customisePresentation(ResultPtr theResult, AISObjectPtr the ObjectPtr anObject = aDisplayer->getObject(thePrs); if (anObject.get()) { bool isConflicting = myOverconstraintListener->isConflictingObject(anObject); - // customize sketcy symbol presentation + // customize sketch symbol presentation if (thePrs.get()) { Handle(AIS_InteractiveObject) anAISIO = thePrs->impl(); if (!anAISIO.IsNull()) { @@ -939,6 +952,9 @@ bool PartSet_Module::customisePresentation(ResultPtr theResult, AISObjectPtr the aCustomized = true; } } + + // customize dimentional constrains + sketchMgr()->customizePresentation(anObject); } return aCustomized; diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index cb7d86131..8a54eff21 100755 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -91,6 +91,10 @@ public: virtual bool createWidgets(ModuleBase_Operation* theOperation, QList& theWidgets) const; + /// Launching of a edit operation on the feature + /// \param theFeature feature for editing + virtual void editFeature(FeaturePtr theFeature); + /// Creates an operation and send it to loop /// \param theCmdId the operation name virtual void launchOperation(const QString& theCmdId); @@ -322,6 +326,11 @@ protected slots: void onChoiceChanged(ModuleBase_ModelWidget* theWidget, int theIndex); protected: + /// Sets the constraints states in internal map. If the feature kind is a dimensional constraint + /// other dimensions are shown. + /// \param theFeatureKindId a feature kind + void storeConstraintsState(const std::string& theFeatureKindId); + /// Register validators for this module virtual void registerValidators(); diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 236124f63..1817bc3aa 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -189,6 +189,7 @@ PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module* theModule) myIsConstraintsShown[PartSet_Tools::Geometrical] = true; myIsConstraintsShown[PartSet_Tools::Dimensional] = true; + myIsConstraintsShown[PartSet_Tools::Expressions] = false; } PartSet_SketcherMgr::~PartSet_SketcherMgr() @@ -898,6 +899,7 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) myIsMouseOverWindow = false; myIsConstraintsShown[PartSet_Tools::Geometrical] = true; myIsConstraintsShown[PartSet_Tools::Dimensional] = true; + myIsConstraintsShown[PartSet_Tools::Expressions] = false; XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); @@ -1536,6 +1538,15 @@ void PartSet_SketcherMgr::widgetStateChanged(int thePreviousState) } } +void PartSet_SketcherMgr::customizePresentation(const ObjectPtr& theObject) +{ + ModuleBase_OperationFeature* aFOperation = dynamic_cast + (getCurrentOperation()); + if (aFOperation && (PartSet_SketcherMgr::isSketchOperation(aFOperation) || + PartSet_SketcherMgr::isNestedSketchOperation(aFOperation))) + SketcherPrs_Tools::sendExpressionShownEvent(myIsConstraintsShown[PartSet_Tools::Expressions]); +} + ModuleBase_Operation* PartSet_SketcherMgr::getCurrentOperation() const { return myModule->workshop()->currentOperation(); @@ -1643,24 +1654,45 @@ void PartSet_SketcherMgr::restoreSelection() void PartSet_SketcherMgr::onShowConstraintsToggle(int theType, bool theState) { PartSet_Tools::ConstraintVisibleState aType = (PartSet_Tools::ConstraintVisibleState)theType; - if (myIsConstraintsShown.contains(aType) && myIsConstraintsShown[aType] == theState) - return; - if (myCurrentSketch.get() == NULL) - return; - myIsConstraintsShown[aType] = theState; + updateBySketchParameters(aType, theState); +} - ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); +void PartSet_SketcherMgr::updateBySketchParameters( + const PartSet_Tools::ConstraintVisibleState& theType, + bool theState) +{ + if (myCurrentSketch.get() == NULL) + return; - for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) { - FeaturePtr aSubFeature = myCurrentSketch->subFeature(i); - bool aProcessed = false; - bool aConstraintDisplayed = canDisplayConstraint(aSubFeature, aType, aProcessed); - if (aProcessed) - aSubFeature->setDisplayed(aConstraintDisplayed); + bool aPrevState = myIsConstraintsShown[theType]; + myIsConstraintsShown[theType] = theState; + + switch (theType) { + case PartSet_Tools::Geometrical: + case PartSet_Tools::Dimensional: { + if (aPrevState != theState) { + ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); + XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); + for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) { + FeaturePtr aSubFeature = myCurrentSketch->subFeature(i); + bool aProcessed = false; + bool aConstraintDisplayed = canDisplayConstraint(aSubFeature, theType, aProcessed); + if (aProcessed) + aSubFeature->setDisplayed(aConstraintDisplayed); + } + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + } + } + break; + case PartSet_Tools::Expressions: { + /// call all sketch features redisplay, the expression state will be corrected in customize + /// of distance presentation + Events_ID anEventId = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); + PartSet_Tools::sendSubFeaturesEvent(myCurrentSketch, anEventId); + } + break; } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); } XGUI_Workshop* PartSet_SketcherMgr::workshop() const diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index a7118e899..aa99353aa 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -247,14 +247,24 @@ public: /// \param thePreviousState the previous widget value state void widgetStateChanged(int thePreviousState); + /// If the current operation is a dimention one, the style of dimension visualization is send for + /// the current object + /// \param theObject an object to be customized + void customizePresentation(const ObjectPtr& theObject); + + /// Update sketch presentations according to the the state + /// \param theType a type of sketch visualization style + /// \param theState a boolean state + void updateBySketchParameters(const PartSet_Tools::ConstraintVisibleState& theType, + bool theState); + public slots: /// Process sketch plane selected event void onPlaneSelected(const std::shared_ptr& thePln); +private slots: /// Toggle show constraints void onShowConstraintsToggle(int theType, bool theState); - -private slots: /// Process the enter mouse to the view port. If the current operation is a create of /// a nested sketch feature, it updates internal flags to display the feature on mouse move void onEnterViewPort(); diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index 1b2ed450a..27921bf5e 100755 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -890,3 +890,18 @@ AttributePtr PartSet_Tools::findAttributeBy2dPoint(ObjectPtr theObj, } return anAttribute; } + +void PartSet_Tools::sendSubFeaturesEvent(const CompositeFeaturePtr& theComposite, + const Events_ID theEventId) +{ + if (!theComposite.get()) + return; + + static Events_Loop* aLoop = Events_Loop::loop(); + for (int i = 0; i < theComposite->numberOfSubs(); i++) { + FeaturePtr aSubFeature = theComposite->subFeature(i); + static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); + aECreator->sendUpdated(aSubFeature, theEventId); + } + Events_Loop::loop()->flush(theEventId); +} diff --git a/src/PartSet/PartSet_Tools.h b/src/PartSet/PartSet_Tools.h index 316d484a4..e4b034f3c 100755 --- a/src/PartSet/PartSet_Tools.h +++ b/src/PartSet/PartSet_Tools.h @@ -19,6 +19,8 @@ #include #include +#include + #include #include @@ -47,6 +49,7 @@ public: { Geometrical = 0, // all constrains excepting dimensional Dimensional, // lenght, distance, radius and angle constraints + Expressions, // parameter text should be shown in dimensional constraint Any // both, geometrical and dimensional, types of constraints }; @@ -249,6 +252,10 @@ public: * \param theStartCoin the coincedence feature */ static std::shared_ptr getCoincedencePoint(FeaturePtr theStartCoin); + + /// Sends redisplay event for all sub-features of the composite. Flush it. + static void sendSubFeaturesEvent(const CompositeFeaturePtr& theComposite, + const Events_ID theId); }; #endif diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index d424aa7e7..76a50444c 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -104,6 +104,7 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel(QWidget* theParent, QMap aStates; aStates[PartSet_Tools::Geometrical] = tr("Show geometrical constraints"); aStates[PartSet_Tools::Dimensional] = tr("Show dimensional constraints"); + aStates[PartSet_Tools::Expressions] = tr("Show existing expressions"); QMap::const_iterator anIt = aStates.begin(), aLast = aStates.end(); diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp index b6df9e517..0ec0382e4 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp @@ -14,7 +14,10 @@ #include #include +#include + #include +#include #include #include @@ -51,6 +54,27 @@ SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(ModelAPI_Feature* theCo SetSelToleranceForText2d(SketcherPrs_Tools::getTextHeight()); SetDimensionAspect(myAspect); + + Events_Loop* aLoop = Events_Loop::loop(); + const Events_ID kDocCreatedEvent = + SketcherPrs_ParameterStyleMessage::eventId(); + aLoop->registerListener(this, kDocCreatedEvent, NULL, false); +} + +SketcherPrs_LengthDimension::~SketcherPrs_LengthDimension() +{ + Events_Loop* aLoop = Events_Loop::loop(); + aLoop->removeListener(this); +} + +void SketcherPrs_LengthDimension::processEvent(const std::shared_ptr& theMessage) +{ + const Events_ID kParameterStyleEvent = SketcherPrs_ParameterStyleMessage::eventId(); + if (theMessage->eventID() == kParameterStyleEvent) { + std::shared_ptr aMessage = std::dynamic_pointer_cast< + SketcherPrs_ParameterStyleMessage>(theMessage); + myStyle = aMessage->style(); + } } bool SketcherPrs_LengthDimension::IsReadyToDisplay(ModelAPI_Feature* theConstraint, @@ -102,8 +126,16 @@ void SketcherPrs_LengthDimension::Compute(const Handle(PrsMgr_PresentationManage myAspect->TextAspect()->SetVerticalJustification(Graphic3d_VTA_CENTER); AttributeDoublePtr aValue = myConstraint->data()->real(SketchPlugin_Constraint::VALUE()); - SketcherPrs_Tools::setDisplaySpecialSymbol(this, aValue->usedParameters().size() > 0); - + bool aHasParameters = aValue->usedParameters().size() > 0; + if (aHasParameters) { + bool isParameterValueStyle = myStyle == SketcherPrs_ParameterStyleMessage::ParameterValue; + SketcherPrs_Tools::setDisplaySpecialSymbol(this, isParameterValueStyle); + SketcherPrs_Tools::setDisplayParameter(this, aValue->text(), !isParameterValueStyle); + } + else { + SketcherPrs_Tools::setDisplaySpecialSymbol(this, false); + SketcherPrs_Tools::setDisplayParameter(this, aValue->text(), false); + } AIS_LengthDimension::Compute(thePresentationManager, thePresentation, theMode); } diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.h b/src/SketcherPrs/SketcherPrs_LengthDimension.h index cfd5d4881..c0716bc58 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.h +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.h @@ -13,6 +13,10 @@ #include #include +#include + +#include + DEFINE_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension) @@ -21,7 +25,7 @@ DEFINE_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension) * A class for representation of linear dimension constraint. * It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features. */ -class SketcherPrs_LengthDimension : public AIS_LengthDimension +class SketcherPrs_LengthDimension : public AIS_LengthDimension, public Events_Listener { public: /// Constructor @@ -30,8 +34,15 @@ public: Standard_EXPORT SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane); + /// Destructor + Standard_EXPORT ~SketcherPrs_LengthDimension(); + DEFINE_STANDARD_RTTI(SketcherPrs_LengthDimension) + /// Process the ModelAPI_DocumentCreatedMessage to fulfill a document + /// from the message with origin and planes + virtual void processEvent(const std::shared_ptr& theMessage); + /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation /// \param theConstraint a constraint feature /// \param thePlane a coordinate plane of current sketch @@ -59,6 +70,9 @@ private: std::shared_ptr myPlane; Handle(Prs3d_DimensionAspect) myAspect; + + /// Style how the parameter of dimension should be visualized + SketcherPrs_ParameterStyleMessage::ParameterStyle myStyle; }; #endif \ No newline at end of file diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index d481dcbe7..922916847 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -293,4 +293,30 @@ void setDisplaySpecialSymbol(AIS_Dimension* theDimension, const bool& theToDispl } } +void setDisplayParameter(AIS_Dimension* theDimension, const std::string& theParameter, + const bool& theToDisplay) +{ + if (theToDisplay) { + theDimension->DimensionAspect()->MakeUnitsDisplayed(true); + theDimension->SetDisplayUnits(TCollection_AsciiString(theParameter.c_str())); + theDimension->DimensionAspect()->SetValueStringFormat(""); + } + else { + theDimension->DimensionAspect()->MakeUnitsDisplayed(false); + theDimension->SetDisplayUnits(TCollection_AsciiString()); // THE_UNDEFINED_UNITS in AIS_Dimension + theDimension->DimensionAspect()->SetValueStringFormat("%g"); + } +} + +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); +} + }; diff --git a/src/SketcherPrs/SketcherPrs_Tools.h b/src/SketcherPrs/SketcherPrs_Tools.h index f6f8c3ac7..b41d8b498 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.h +++ b/src/SketcherPrs/SketcherPrs_Tools.h @@ -16,11 +16,44 @@ #include #include +#include +#include + class GeomDataAPI_Point2D; class AIS_Dimension; //#define MyTextHeight 20 +/// Message that document (Part, PartSet) was created +class SketcherPrs_ParameterStyleMessage : public Events_Message +{ +public: + enum ParameterStyle { + ParameterValue, /// using symbol with the parameter value + ParameterText /// using parameter text + }; + +public: + /// Creates an empty message + SKETCHERPRS_EXPORT SketcherPrs_ParameterStyleMessage(const Events_ID theID, + const void* theSender = 0) + : Events_Message(theID, theSender) {} + /// The virtual destructor + SKETCHERPRS_EXPORT virtual ~SketcherPrs_ParameterStyleMessage() {} + /// Static. Returns EventID of the message. + SKETCHERPRS_EXPORT static Events_ID eventId() + { + static const char * MY_EVENT_PARAMETER_STYLE_ID("ParameterStyle"); + return Events_Loop::eventByName(MY_EVENT_PARAMETER_STYLE_ID); + } + /// Returns a document stored in the message + SKETCHERPRS_EXPORT ParameterStyle style() const { return myStyle; } + /// Sets a document to the message + SKETCHERPRS_EXPORT void setStyle(ParameterStyle theStyle) { myStyle = theStyle; } +private: + ParameterStyle myStyle; /// style of the parameter visualization +}; + namespace SketcherPrs_Tools { /// Enumeration with modes for activation of selection custom presentations @@ -48,6 +81,9 @@ namespace SketcherPrs_Tools { ANGLE_BACKWARD ///< Angle from the second line to the first line }; + /// Event ID about expression visual state has been changed, the symbol with a digit + /// or parameter text is shown + /// Returns attribute object referenced by feature /// \param theFeature a feature /// \param theAttrName an attribute name @@ -124,6 +160,20 @@ namespace SketcherPrs_Tools { /// \param theToDisplay a boolean value SKETCHERPRS_EXPORT void setDisplaySpecialSymbol(AIS_Dimension* theDimension, const bool& theToDisplay); + + /// Display the parameter value instead of dimention digit + /// \param theDimension a dimension constraint + /// \param theParameter a parameter value + /// \param theToDisplay a boolean value + SKETCHERPRS_EXPORT void setDisplayParameter(AIS_Dimension* theDimension, + const std::string& theParameter, + const bool& theToDisplay); + + /// Sends event about expression visualization type is changed for dimension presentations + /// Sends event to redisplay all sub-features of composite feature + /// \param theState a new state + SKETCHERPRS_EXPORT void sendExpressionShownEvent(const bool& theState); + }; #endif -- 2.39.2