From fe1d67fd65f165a201a074927829c2ad6e965629 Mon Sep 17 00:00:00 2001 From: Michael Georg Hansen Date: Fri, 19 Dec 2014 22:03:20 +0100 Subject: [PATCH] Simplify access to projection properties. Directly access the properties where possible. --- src/Mod/Drawing/Gui/Command.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/Mod/Drawing/Gui/Command.cpp b/src/Mod/Drawing/Gui/Command.cpp index d22550759..6f50e33ec 100644 --- a/src/Mod/Drawing/Gui/Command.cpp +++ b/src/Mod/Drawing/Gui/Command.cpp @@ -293,22 +293,14 @@ void CmdDrawingNewView::activated(int iMsg) if (!selectedProjections.empty()) { const Drawing::FeatureView* const myView = dynamic_cast(selectedProjections.front()); - const App::PropertyFloat* const propX = dynamic_cast(myView->getPropertyByName("X")); - if (propX) { - newX = propX->getValue(); - } - const App::PropertyFloat* const propY = dynamic_cast(myView->getPropertyByName("Y")); - if (propY) { - newY = propY->getValue(); - } - const App::PropertyFloat* const propScale = dynamic_cast(myView->getPropertyByName("Scale")); - if (propScale) { - newScale = propScale->getValue(); - } - const App::PropertyFloat* const propRotation = dynamic_cast(myView->getPropertyByName("Rotation")); - if (propRotation) { - newRotation = propRotation->getValue(); - } + newX = myView->X.getValue(); + newY = myView->Y.getValue(); + newScale = myView->Scale.getValue(); + newRotation = myView->Rotation.getValue(); + + // The "Direction" property does not belong to Drawing::FeatureView, but to one of the + // many child classes that are projecting objects into the drawing. Therefore, we get the + // property by name. const App::PropertyVector* const propDirection = dynamic_cast(myView->getPropertyByName("Direction")); if (propDirection) { newDirection = propDirection->getValue();