From: spo Date: Tue, 7 Jul 2015 12:50:36 +0000 (+0300) Subject: Issue #718 - Translation with parameters - wrong coordinates -- Add SketchPlugin_Tool... X-Git-Tag: V_1.3.0~86 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0ffeed30c08a4c0cdb19e8b20ed1b46c88559fad;p=modules%2Fshaper.git Issue #718 - Translation with parameters - wrong coordinates -- Add SketchPlugin_Tools.cpp/h --- diff --git a/src/SketchPlugin/SketchPlugin_Tools.cpp b/src/SketchPlugin/SketchPlugin_Tools.cpp new file mode 100644 index 000000000..134e00ddf --- /dev/null +++ b/src/SketchPlugin/SketchPlugin_Tools.cpp @@ -0,0 +1,57 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: SketchPlugin_Tools.cpp +// Created: 07 July 2015 +// Author: Sergey POKHODENKO + +#include "SketchPlugin_Tools.h" + +#include +#include +#include + +void clearExpressions(AttributeDoublePtr theAttribute) +{ + theAttribute->setText(std::string()); +} + +void clearExpressions(AttributePointPtr theAttribute) +{ + theAttribute->setText(std::string(), std::string(), std::string()); +} + +void clearExpressions(AttributePoint2DPtr theAttribute) +{ + theAttribute->setText(std::string(), std::string()); +} + +void clearExpressions(AttributePtr theAttribute) +{ + // Double + AttributeDoublePtr anAttributeDouble = + std::dynamic_pointer_cast(theAttribute); + if (anAttributeDouble.get()) + clearExpressions(anAttributeDouble); + // Point + AttributePointPtr anAttributePoint = + std::dynamic_pointer_cast(theAttribute); + if (anAttributePoint.get()) + clearExpressions(anAttributePoint); + // Point2D + AttributePoint2DPtr anAttributePoint2D = + std::dynamic_pointer_cast(theAttribute); + if (anAttributePoint2D.get()) + clearExpressions(anAttributePoint2D); +} + +void clearExpressions(FeaturePtr theFeature) +{ + if (!theFeature.get()) + return; + + std::list anAttributes = theFeature->data()->attributes(std::string()); + std::list::iterator anAttributeIt = anAttributes.begin(); + for (; anAttributeIt != anAttributes.end(); ++anAttributeIt) { + clearExpressions(*anAttributeIt); + } +} diff --git a/src/SketchPlugin/SketchPlugin_Tools.h b/src/SketchPlugin/SketchPlugin_Tools.h new file mode 100644 index 000000000..a574db78a --- /dev/null +++ b/src/SketchPlugin/SketchPlugin_Tools.h @@ -0,0 +1,15 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: SketchPlugin_Tools.h +// Created: 07 July 2015 +// Author: Sergey POKHODENKO + +#ifndef SKETCHPLUGIN_TOOLS_H_ +#define SKETCHPLUGIN_TOOLS_H_ + +#include + +/// Clears text expressions for all attributes of the feature +void clearExpressions(FeaturePtr theFeature); + +#endif // SKETCHPLUGIN_TOOLS_H_ \ No newline at end of file diff --git a/src/SketchPlugin_Tools.cpp b/src/SketchPlugin_Tools.cpp deleted file mode 100644 index 134e00ddf..000000000 --- a/src/SketchPlugin_Tools.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchPlugin_Tools.cpp -// Created: 07 July 2015 -// Author: Sergey POKHODENKO - -#include "SketchPlugin_Tools.h" - -#include -#include -#include - -void clearExpressions(AttributeDoublePtr theAttribute) -{ - theAttribute->setText(std::string()); -} - -void clearExpressions(AttributePointPtr theAttribute) -{ - theAttribute->setText(std::string(), std::string(), std::string()); -} - -void clearExpressions(AttributePoint2DPtr theAttribute) -{ - theAttribute->setText(std::string(), std::string()); -} - -void clearExpressions(AttributePtr theAttribute) -{ - // Double - AttributeDoublePtr anAttributeDouble = - std::dynamic_pointer_cast(theAttribute); - if (anAttributeDouble.get()) - clearExpressions(anAttributeDouble); - // Point - AttributePointPtr anAttributePoint = - std::dynamic_pointer_cast(theAttribute); - if (anAttributePoint.get()) - clearExpressions(anAttributePoint); - // Point2D - AttributePoint2DPtr anAttributePoint2D = - std::dynamic_pointer_cast(theAttribute); - if (anAttributePoint2D.get()) - clearExpressions(anAttributePoint2D); -} - -void clearExpressions(FeaturePtr theFeature) -{ - if (!theFeature.get()) - return; - - std::list anAttributes = theFeature->data()->attributes(std::string()); - std::list::iterator anAttributeIt = anAttributes.begin(); - for (; anAttributeIt != anAttributes.end(); ++anAttributeIt) { - clearExpressions(*anAttributeIt); - } -} diff --git a/src/SketchPlugin_Tools.h b/src/SketchPlugin_Tools.h deleted file mode 100644 index a574db78a..000000000 --- a/src/SketchPlugin_Tools.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchPlugin_Tools.h -// Created: 07 July 2015 -// Author: Sergey POKHODENKO - -#ifndef SKETCHPLUGIN_TOOLS_H_ -#define SKETCHPLUGIN_TOOLS_H_ - -#include - -/// Clears text expressions for all attributes of the feature -void clearExpressions(FeaturePtr theFeature); - -#endif // SKETCHPLUGIN_TOOLS_H_ \ No newline at end of file