/**
* Constructor.
*/
-RS_Text::RS_Text(RS_EntityContainer * parent, const RS_TextData & d): RS_EntityContainer(parent), data(d)
+Text::Text(EntityContainer * parent, const TextData & d): EntityContainer(parent), data(d)
{
usedTextHeight = 0.0;
usedTextWidth = 0.0;
setText(data.text);
}
-/*virtual*/ RS_Text::~RS_Text()
+/*virtual*/ Text::~Text()
{
}
-/*virtual*/ RS_Entity * RS_Text::clone()
+/*virtual*/ Entity * Text::clone()
{
- RS_Text * t = new RS_Text(*this);
+ Text * t = new Text(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// t->entities.setAutoDelete(entities.autoDelete());
t->initId();
}
/** @return RS2::EntityText */
-/*virtual*/ RS2::EntityType RS_Text::rtti() const
+/*virtual*/ RS2::EntityType Text::rtti() const
{
return RS2::EntityText;
}
/** @return Copy of data that defines the text. */
-RS_TextData RS_Text::getData() const
+TextData Text::getData() const
{
return data;
}
/**
* @return Number of lines in this text entity.
*/
-int RS_Text::getNumberOfLines()
+int Text::getNumberOfLines()
{
int c = 1;
* text or it's data, position, alignment, .. changes.
* This method also updates the usedTextWidth / usedTextHeight property.
*/
-void RS_Text::update()
+void Text::update()
{
#if 0
-printf("RS_Text::update(): ");
+printf("Text::update(): ");
#endif
- RS_DEBUG->print("RS_Text::update");
+ DEBUG->print("Text::update");
clear();
#if 0
#if 0
printf("data.style=\"%s\", ", data.style.toAscii().data());
#endif
- RS_Font * font = RS_FONTLIST->requestFont(data.style);
+ Font * font = FONTLIST->requestFont(data.style);
#if 0
printf("font=%08X\n", (unsigned int)font);
// Every single text line gets stored in this entity container
// so we can move the whole line around easely:
- RS_EntityContainer * oneLine = new RS_EntityContainer(this);
+ EntityContainer * oneLine = new EntityContainer(this);
// First every text line is created with
// alignement: top left
case 0x0A:
// line feed:
updateAddLine(oneLine, lineCounter++);
- oneLine = new RS_EntityContainer(this);
+ oneLine = new EntityContainer(this);
letterPos = Vector(0.0, -9.0);
break;
{
case 'P':
updateAddLine(oneLine, lineCounter++);
- oneLine = new RS_EntityContainer(this);
+ oneLine = new EntityContainer(this);
letterPos = Vector(0.0, -9.0);
break;
}
// add texts:
- RS_Text * upper = new RS_Text(oneLine,
- RS_TextData(letterPos + Vector(0.0, 9.0), 4.0, 100.0,
+ Text * upper = new Text(oneLine,
+ TextData(letterPos + Vector(0.0, 9.0), 4.0, 100.0,
RS2::VAlignTop, RS2::HAlignLeft, RS2::LeftToRight,
RS2::Exact, 1.0, up, data.style, 0.0, RS2::Update));
upper->setLayer(NULL);
- upper->setPen(RS_Pen(RS2::FlagInvalid));
+ upper->setPen(Pen(RS2::FlagInvalid));
oneLine->addEntity(upper);
- RS_Text * lower = new RS_Text(oneLine,
- RS_TextData(letterPos+Vector(0.0, 4.0), 4.0, 100.0,
+ Text * lower = new Text(oneLine,
+ TextData(letterPos+Vector(0.0, 4.0), 4.0, 100.0,
RS2::VAlignTop, RS2::HAlignLeft, RS2::LeftToRight,
RS2::Exact, 1.0, dw, data.style, 0.0, RS2::Update));
lower->setLayer(NULL);
- lower->setPen(RS_Pen(RS2::FlagInvalid));
+ lower->setPen(Pen(RS2::FlagInvalid));
oneLine->addEntity(lower);
// move cursor:
//We ain't getting here:
/*
About to draw TEXT entity... TEXT="107.25"
-RS_Dimension::updateCreateDimensionLine()...
+Dimension::updateCreateDimensionLine()...
--> 107.25
-RS_Text::update(): isUndone=false, font=094C1020
+Text::update(): isUndone=false, font=094C1020
--> default: pos=0, char=0031
--> default: pos=1, char=0030
--> default: pos=2, char=0037
--> default: pos=5, char=0035
*/
//printf(" char=%s\n", QString(data.text.at(i)).toAscii().data());
- RS_DEBUG->print("RS_Text::update: insert a letter at pos: %f/%f", letterPos.x, letterPos.y);
- RS_InsertData d(QString(data.text.at(i)), letterPos, Vector(1.0, 1.0),
+ DEBUG->print("Text::update: insert a letter at pos: %f/%f", letterPos.x, letterPos.y);
+ InsertData d(QString(data.text.at(i)), letterPos, Vector(1.0, 1.0),
0.0, 1, 1, Vector(0.0, 0.0), font->getLetterList(), RS2::NoUpdate);
- RS_Insert * letter = new RS_Insert(this, d);
- letter->setPen(RS_Pen(RS2::FlagInvalid));
+ Insert * letter = new Insert(this, d);
+ letter->setPen(Pen(RS2::FlagInvalid));
letter->setLayer(NULL);
letter->update();
letter->forcedCalculateBorders();
usedTextHeight -= data.height * data.lineSpacingFactor * 1.6 - data.height;
forcedCalculateBorders();
- RS_DEBUG->print("RS_Text::update: OK");
+ DEBUG->print("Text::update: OK");
}
/**
* @param textLine The text line.
* @param lineCounter Line number.
*/
-void RS_Text::updateAddLine(RS_EntityContainer* textLine, int lineCounter)
+void Text::updateAddLine(EntityContainer* textLine, int lineCounter)
{
- RS_DEBUG->print("RS_Text::updateAddLine: width: %f", textLine->getSize().x);
+ DEBUG->print("Text::updateAddLine: width: %f", textLine->getSize().x);
//textLine->forcedCalculateBorders();
- //RS_DEBUG->print("RS_Text::updateAddLine: width 2: %f", textLine->getSize().x);
+ //DEBUG->print("Text::updateAddLine: width 2: %f", textLine->getSize().x);
// Move to correct line position:
textLine->move(Vector(0.0, -9.0 * lineCounter * data.lineSpacingFactor * 1.6));
textLine->forcedCalculateBorders();
Vector textSize = textLine->getSize();
- RS_DEBUG->print("RS_Text::updateAddLine: width 2: %f", textSize.x);
+ DEBUG->print("Text::updateAddLine: width 2: %f", textSize.x);
// Horizontal Align:
switch (data.halign)
{
case RS2::HAlignCenter:
- RS_DEBUG->print("RS_Text::updateAddLine: move by: %f", -textSize.x / 2.0);
+ DEBUG->print("Text::updateAddLine: move by: %f", -textSize.x / 2.0);
textLine->move(Vector(-textSize.x / 2.0, 0.0));
break;
// Move:
textLine->move(data.insertionPoint);
- textLine->setPen(RS_Pen(RS2::FlagInvalid));
+ textLine->setPen(Pen(RS2::FlagInvalid));
textLine->setLayer(NULL);
textLine->forcedCalculateBorders();
addEntity(textLine);
}
-Vector RS_Text::getInsertionPoint()
+Vector Text::getInsertionPoint()
{
return data.insertionPoint;
}
-double RS_Text::getHeight()
+double Text::getHeight()
{
return data.height;
}
-void RS_Text::setHeight(double h)
+void Text::setHeight(double h)
{
data.height = h;
}
-double RS_Text::getWidth()
+double Text::getWidth()
{
return data.width;
}
*
* @param a 1: top left ... 9: bottom right
*/
-void RS_Text::setAlignment(int a)
+void Text::setAlignment(int a)
{
switch (a % 3)
{
*
* @return 1: top left ... 9: bottom right
*/
-int RS_Text::getAlignment()
+int Text::getAlignment()
{
if (data.valign == RS2::VAlignTop)
{
return 1;
}
-RS2::VAlign RS_Text::getVAlign()
+RS2::VAlign Text::getVAlign()
{
return data.valign;
}
-void RS_Text::setVAlign(RS2::VAlign va)
+void Text::setVAlign(RS2::VAlign va)
{
data.valign = va;
}
-RS2::HAlign RS_Text::getHAlign()
+RS2::HAlign Text::getHAlign()
{
return data.halign;
}
-void RS_Text::setHAlign(RS2::HAlign ha)
+void Text::setHAlign(RS2::HAlign ha)
{
data.halign = ha;
}
-RS2::TextDrawingDirection RS_Text::getDrawingDirection()
+RS2::TextDrawingDirection Text::getDrawingDirection()
{
return data.drawingDirection;
}
-RS2::TextLineSpacingStyle RS_Text::getLineSpacingStyle()
+RS2::TextLineSpacingStyle Text::getLineSpacingStyle()
{
return data.lineSpacingStyle;
}
-void RS_Text::setLineSpacingFactor(double f)
+void Text::setLineSpacingFactor(double f)
{
data.lineSpacingFactor = f;
}
-double RS_Text::getLineSpacingFactor()
+double Text::getLineSpacingFactor()
{
return data.lineSpacingFactor;
}
* Sets a new text. The entities representing the
* text are updated.
*/
-void RS_Text::setText(const QString & t)
+void Text::setText(const QString & t)
{
data.text = t;
}
}
-QString RS_Text::getText()
+QString Text::getText()
{
return data.text;
}
-void RS_Text::setStyle(const QString & s)
+void Text::setStyle(const QString & s)
{
data.style = s;
}
-QString RS_Text::getStyle()
+QString Text::getStyle()
{
return data.style;
}
-void RS_Text::setAngle(double a)
+void Text::setAngle(double a)
{
data.angle = a;
}
-double RS_Text::getAngle()
+double Text::getAngle()
{
return data.angle;
}
-double RS_Text::getUsedTextWidth()
+double Text::getUsedTextWidth()
{
return usedTextWidth;
}
-double RS_Text::getUsedTextHeight()
+double Text::getUsedTextHeight()
{
return usedTextHeight;
}
-/*virtual*/ double RS_Text::getLength()
+/*virtual*/ double Text::getLength()
{
return -1.0;
}
-VectorSolutions RS_Text::getRefPoints()
+VectorSolutions Text::getRefPoints()
{
VectorSolutions ret(data.insertionPoint);
return ret;
}
-Vector RS_Text::getNearestRef(const Vector & coord, double * dist)
+Vector Text::getNearestRef(const Vector & coord, double * dist)
{
- return RS_Entity::getNearestRef(coord, dist);
+ return Entity::getNearestRef(coord, dist);
}
-void RS_Text::move(Vector offset)
+void Text::move(Vector offset)
{
data.insertionPoint.move(offset);
update();
}
-void RS_Text::rotate(Vector center, double angle)
+void Text::rotate(Vector center, double angle)
{
data.insertionPoint.rotate(center, angle);
- data.angle = RS_Math::correctAngle(data.angle + angle);
+ data.angle = Math::correctAngle(data.angle + angle);
update();
}
-void RS_Text::scale(Vector center, Vector factor)
+void Text::scale(Vector center, Vector factor)
{
data.insertionPoint.scale(center, factor);
data.width *= factor.x;
update();
}
-void RS_Text::mirror(Vector axisPoint1, Vector axisPoint2)
+void Text::mirror(Vector axisPoint1, Vector axisPoint2)
{
data.insertionPoint.mirror(axisPoint1, axisPoint2);
//double ang = axisPoint1.angleTo(axisPoint2);
- bool readable = RS_Math::isAngleReadable(data.angle);
+ bool readable = Math::isAngleReadable(data.angle);
Vector vec;
vec.setPolar(1.0, data.angle);
data.angle = vec.angle();
bool corr;
- data.angle = RS_Math::makeAngleReadable(data.angle, readable, &corr);
+ data.angle = Math::makeAngleReadable(data.angle, readable, &corr);
if (corr)
{
update();
}
-bool RS_Text::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/)
+bool Text::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/)
{
return false;
}
* Implementations must stretch the given range of the entity
* by the given offset.
*/
-void RS_Text::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void Text::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
{
if (getMin().isInWindow(firstCorner, secondCorner)
&& getMax().isInWindow(firstCorner, secondCorner))
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Text & p)
+std::ostream & operator<<(std::ostream & os, const Text & p)
{
os << " Text: " << p.getData() << "\n";
return os;