From 318397f164871a2de94a33a5802a3e4fe8981756 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 24 Aug 2015 12:17:45 +0300 Subject: [PATCH] Avoid extra methods. --- .../SketchPlugin_ConstraintDistance.cpp | 15 +++------------ .../SketchPlugin_ConstraintDistance.h | 6 +----- .../SketchPlugin_ConstraintLength.cpp | 15 +++------------ src/SketchPlugin/SketchPlugin_ConstraintLength.h | 6 +----- 4 files changed, 8 insertions(+), 34 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp index a119433d3..6b1dd6bec 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp @@ -134,6 +134,9 @@ AISObjectPtr SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevi if (!anAIS) { anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this, sketch()->coordinatePlane()); } + std::vector aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color", + SKETCH_DIMENSION_COLOR); + anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]); return anAIS; } @@ -284,15 +287,3 @@ void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID) } } -bool SketchPlugin_ConstraintDistance::customisePresentation(ResultPtr theResult, - AISObjectPtr thePrs, - std::shared_ptr theDefaultPrs) -{ - bool isCustomized = false; - std::vector aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color", - SKETCH_DIMENSION_COLOR); - isCustomized = thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]); - - return isCustomized; -} - diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h index a1e315d2b..e1d8a71ab 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h @@ -27,7 +27,7 @@ class GeomDataAPI_Point2D; * This constraint has three attributes: * SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() */ -class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase, public GeomAPI_ICustomPrs +class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase { public: /// Distance constraint kind @@ -70,10 +70,6 @@ class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase, publ /// Returns the current distance between the feature attributes double calculateCurrentDistance(); - /// Customize presentation of the feature - virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, - std::shared_ptr theDefaultPrs); - /// \brief Use plugin manager for features creation SketchPlugin_ConstraintDistance(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp index dfdca6488..575c0f10a 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp @@ -128,6 +128,9 @@ AISObjectPtr SketchPlugin_ConstraintLength::getAISObject(AISObjectPtr thePreviou if (!anAIS) { anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this, sketch()->coordinatePlane()); } + std::vector aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color", + SKETCH_DIMENSION_COLOR); + anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]); return anAIS; } @@ -205,15 +208,3 @@ void SketchPlugin_ConstraintLength::attributeChanged(const std::string& theID) { myFlyoutUpdate = false; } } - -bool SketchPlugin_ConstraintLength::customisePresentation(ResultPtr theResult, - AISObjectPtr thePrs, - std::shared_ptr theDefaultPrs) -{ - bool isCustomized = false; - std::vector aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color", - SKETCH_DIMENSION_COLOR); - isCustomized = thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]); - - return isCustomized; -} diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.h b/src/SketchPlugin/SketchPlugin_ConstraintLength.h index d6098af22..dd16d1a3a 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.h @@ -25,7 +25,7 @@ class GeomDataAPI_Point2D; * SketchPlugin_Constraint::VALUE() (length) and SketchPlugin_Constraint::ENTITY_A() (segment), * SketchPlugin_Constraint::FLYOUT_VALUE_PNT() (distance of a constraints handle) */ -class SketchPlugin_ConstraintLength : public SketchPlugin_ConstraintBase, public GeomAPI_ICustomPrs +class SketchPlugin_ConstraintLength : public SketchPlugin_ConstraintBase { public: /// Length constraint kind @@ -64,10 +64,6 @@ class SketchPlugin_ConstraintLength : public SketchPlugin_ConstraintBase, public /// \param theID identifier of changed attribute SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); - /// Customize presentation of the feature - virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, - std::shared_ptr theDefaultPrs); - /// \brief Use plugin manager for features creation SketchPlugin_ConstraintLength(); -- 2.39.2