X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fentity.cpp;fp=src%2Fbase%2Fentity.cpp;h=aa6abb7541369ab109b3bccfe991e0f854c7e47a;hb=a18a12fc3bcb18e5c7ca5494d7f97fb8b93f90a2;hp=b9c42e3f5df5e08c4cd1525bf0acbae0f0ba1628;hpb=5adb444f3e523d3fd028617ced72d1ea6661db21;p=architektonas diff --git a/src/base/entity.cpp b/src/base/entity.cpp index b9c42e3..aa6abb7 100644 --- a/src/base/entity.cpp +++ b/src/base/entity.cpp @@ -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(); } }