]> Shamusworld >> Repos - architektonas/blobdiff - src/base/entity.cpp
In the middle of chasing down MDI not activating bug, renaming of Graphic to
[architektonas] / src / base / entity.cpp
index b9c42e3f5df5e08c4cd1525bf0acbae0f0ba1628..aa6abb7541369ab109b3bccfe991e0f854c7e47a 100644 (file)
@@ -428,14 +428,14 @@ void Entity::setParent(EntityContainer * p)
  * or the parent's parent graphic or NULL if none of the parents
  * are stored in a graphic.
  */
-Drawing * Entity::getGraphic()
+Drawing * Entity::GetDrawing()
 {
-       if (rtti() == RS2::EntityGraphic)
+       if (rtti() == RS2::EntityDrawing)
                return (Drawing *)this;
        else if (parent == NULL)
                return NULL;
        else
-               return parent->getGraphic();
+               return parent->GetDrawing();
 }
 
 /**
@@ -554,10 +554,10 @@ Vector Entity::getSize() const
  */
 void Entity::addGraphicVariable(const QString & key, double val, int code)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
 
-       if (graphic != NULL)
-               graphic->addVariable(key, val, code);
+       if (drawing)
+               drawing->addVariable(key, val, code);
 }
 
 /**
@@ -568,10 +568,10 @@ void Entity::addGraphicVariable(const QString & key, double val, int code)
  */
 void Entity::addGraphicVariable(const QString & key, int val, int code)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
 
-       if (graphic != NULL)
-               graphic->addVariable(key, val, code);
+       if (drawing)
+               drawing->addVariable(key, val, code);
 }
 
 /**
@@ -582,10 +582,10 @@ void Entity::addGraphicVariable(const QString & key, int val, int code)
  */
 void Entity::addGraphicVariable(const QString & key, const QString & val, int code)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
 
-       if (graphic != NULL)
-               graphic->addVariable(key, val, code);
+       if (drawing)
+               drawing->addVariable(key, val, code);
 }
 
 /**
@@ -599,11 +599,11 @@ void Entity::addGraphicVariable(const QString & key, const QString & val, int co
  */
 double Entity::getGraphicVariableDouble(const QString & key, double def)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
        double ret = def;
 
-       if (graphic != NULL)
-               ret = graphic->getVariableDouble(key, def);
+       if (drawing)
+               ret = drawing->getVariableDouble(key, def);
 
        return ret;
 }
@@ -619,11 +619,11 @@ double Entity::getGraphicVariableDouble(const QString & key, double def)
  */
 int Entity::getGraphicVariableInt(const QString & key, int def)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
        int ret = def;
 
-       if (graphic != NULL)
-               ret = graphic->getVariableInt(key, def);
+       if (drawing)
+               ret = drawing->getVariableInt(key, def);
 
        return ret;
 }
@@ -639,11 +639,11 @@ int Entity::getGraphicVariableInt(const QString & key, int def)
  */
 QString Entity::getGraphicVariableString(const QString & key, const QString & def)
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
        QString ret = def;
 
-       if (graphic != NULL)
-               ret = graphic->getVariableString(key, def);
+       if (drawing)
+               ret = drawing->getVariableString(key, def);
 
        return ret;
 }
@@ -654,11 +654,11 @@ QString Entity::getGraphicVariableString(const QString & key, const QString & de
  */
 RS2::Unit Entity::getGraphicUnit()
 {
-       Drawing * graphic = getGraphic();
+       Drawing * drawing = GetDrawing();
        RS2::Unit ret = RS2::None;
 
-       if (graphic != NULL)
-               ret = graphic->getUnit();
+       if (drawing)
+               ret = drawing->getUnit();
 
        return ret;
 }
@@ -668,8 +668,7 @@ RS2::Unit Entity::getGraphicUnit()
  */
 /*virtual*/ VectorSolutions Entity::getRefPoints()
 {
-       VectorSolutions ret;
-       return ret;
+       return VectorSolutions();
 }
 
 /**
@@ -788,12 +787,8 @@ Layer * Entity::getLayer(bool resolve) const
  */
 void Entity::setLayer(const QString & name)
 {
-       Drawing * graphic = getGraphic();
-
-       if (graphic != NULL)
-               layer = graphic->findLayer(name);
-       else
-               layer = NULL;
+       Drawing * drawing = GetDrawing();
+       layer = (drawing ? drawing->findLayer(name) : NULL);
 }
 
 /**
@@ -811,12 +806,8 @@ void Entity::setLayer(Layer * l)
  */
 void Entity::setLayerToActive()
 {
-       Drawing * graphic = getGraphic();
-
-       if (graphic != NULL)
-               layer = graphic->getActiveLayer();
-       else
-               layer = NULL;
+       Drawing * drawing = GetDrawing();
+       layer = (drawing ? drawing->getActiveLayer() : NULL);
 }
 
 /**
@@ -932,12 +923,12 @@ double Entity::getStyleFactor(GraphicView * view)
                        //styleFactor = getStyleFactor();
                        // the factor caused by the unit:
                        RS2::Unit unit = RS2::None;
-                       Drawing * g = getGraphic();
+                       Drawing * d = GetDrawing();
 
-                       if (g != NULL)
+                       if (d)
                        {
-                               unit = g->getUnit();
-                               //double scale = g->getPaperScale();
+                               unit = d->getUnit();
+                               //double scale = d->getPaperScale();
                                styleFactor = Units::convert(1.0, RS2::Millimeter, unit);
                                // / scale;
                        }
@@ -951,10 +942,10 @@ double Entity::getStyleFactor(GraphicView * view)
 
                if (view->isPrinting() || view->isPrintPreview() || view->isDraftMode() == false)
                {
-                       Drawing * graphic = getGraphic();
+                       Drawing * drawing = GetDrawing();
 
-                       if (graphic != NULL && graphic->getPaperScale() > 1.0e-6)
-                               styleFactor /= graphic->getPaperScale();
+                       if (drawing && drawing->getPaperScale() > 1.0e-6)
+                               styleFactor /= drawing->getPaperScale();
                }
        }