* 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();
}
/**
*/
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);
}
/**
*/
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);
}
/**
*/
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);
}
/**
*/
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;
}
*/
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;
}
*/
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;
}
*/
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;
}
*/
/*virtual*/ VectorSolutions Entity::getRefPoints()
{
- VectorSolutions ret;
- return ret;
+ return VectorSolutions();
}
/**
*/
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);
}
/**
*/
void Entity::setLayerToActive()
{
- Drawing * graphic = getGraphic();
-
- if (graphic != NULL)
- layer = graphic->getActiveLayer();
- else
- layer = NULL;
+ Drawing * drawing = GetDrawing();
+ layer = (drawing ? drawing->getActiveLayer() : NULL);
}
/**
//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;
}
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();
}
}