From fb1e3d841fa2eb6d7525c34575ba2ef848b20921 Mon Sep 17 00:00:00 2001 From: spo Date: Tue, 14 Jun 2016 13:10:32 +0300 Subject: [PATCH] Add fillAttribute(double...) and fillAttribute(const char*,) and use it in SketchAPI_Circle --- src/ModelHighAPI/ModelHighAPI_Tools.cpp | 11 +++++++++++ src/ModelHighAPI/ModelHighAPI_Tools.h | 7 +++++++ src/SketchAPI/SketchAPI_Circle.cpp | 4 ++-- src/SketchAPI/SketchAPI_Circle.h | 2 -- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/ModelHighAPI/ModelHighAPI_Tools.cpp b/src/ModelHighAPI/ModelHighAPI_Tools.cpp index dc74b7ae1..9a6c10e97 100644 --- a/src/ModelHighAPI/ModelHighAPI_Tools.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Tools.cpp @@ -73,6 +73,11 @@ void fillAttribute(const ModelHighAPI_Double & theValue, { theValue.fillAttribute(theAttribute); } +void fillAttribute(double theValue, + const std::shared_ptr & theAttribute) +{ + theAttribute->setValue(theValue); +} //-------------------------------------------------------------------------------------- void fillAttribute(const ModelHighAPI_Integer & theValue, @@ -110,4 +115,10 @@ void fillAttribute(const std::string & theValue, { theAttribute->setValue(theValue); } +void fillAttribute(const char * theValue, + const std::shared_ptr & theAttribute) +{ + theAttribute->setValue(theValue); +} + //-------------------------------------------------------------------------------------- diff --git a/src/ModelHighAPI/ModelHighAPI_Tools.h b/src/ModelHighAPI/ModelHighAPI_Tools.h index 17d7f0523..a0e44c693 100644 --- a/src/ModelHighAPI/ModelHighAPI_Tools.h +++ b/src/ModelHighAPI/ModelHighAPI_Tools.h @@ -65,6 +65,10 @@ MODELHIGHAPI_EXPORT void fillAttribute(const ModelHighAPI_Double & theValue, const std::shared_ptr & theAttribute); +MODELHIGHAPI_EXPORT +void fillAttribute(double theValue, + const std::shared_ptr & theAttribute); + MODELHIGHAPI_EXPORT void fillAttribute(const ModelHighAPI_Integer & theValue, const std::shared_ptr & theAttribute); @@ -84,6 +88,9 @@ void fillAttribute(const std::list & theValue, MODELHIGHAPI_EXPORT void fillAttribute(const std::string & theValue, const std::shared_ptr & theAttribute); +MODELHIGHAPI_EXPORT +void fillAttribute(const char * theValue, + const std::shared_ptr & theAttribute); //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/SketchAPI/SketchAPI_Circle.cpp b/src/SketchAPI/SketchAPI_Circle.cpp index e05e76708..d8a07f13b 100644 --- a/src/SketchAPI/SketchAPI_Circle.cpp +++ b/src/SketchAPI/SketchAPI_Circle.cpp @@ -97,7 +97,7 @@ void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, double theCenterY { fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType); fillAttribute(center(), theCenterX, theCenterY); - fillAttribute(ModelHighAPI_Double(theRadius), myradius); + fillAttribute(theRadius, myradius); execute(); } @@ -108,7 +108,7 @@ void SketchAPI_Circle::setByCenterAndRadius(const std::shared_ptr { fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType); fillAttribute(theCenter, mycenter); - fillAttribute(ModelHighAPI_Double(theRadius), myradius); + fillAttribute(theRadius, myradius); execute(); } diff --git a/src/SketchAPI/SketchAPI_Circle.h b/src/SketchAPI/SketchAPI_Circle.h index 70af08f01..b4332c675 100644 --- a/src/SketchAPI/SketchAPI_Circle.h +++ b/src/SketchAPI/SketchAPI_Circle.h @@ -10,8 +10,6 @@ #include "SketchAPI.h" #include "SketchAPI_SketchEntity.h" -#include - #include class ModelHighAPI_Selection; -- 2.39.2