Poistioning and Rotation for QGIVAnnotation
This commit is contained in:
@@ -59,12 +59,13 @@ QGCustomText::QGCustomText()
|
||||
|
||||
void QGCustomText::centerAt(QPointF centerPos)
|
||||
{
|
||||
QRectF box = boundingRect();
|
||||
double width = box.width();
|
||||
double height = box.height();
|
||||
double newX = centerPos.x() - width/2.;
|
||||
double newY = centerPos.y() - height/2.;
|
||||
setPos(newX,newY);
|
||||
centerAt(centerPos.x(),centerPos.y());
|
||||
// QRectF box = boundingRect();
|
||||
// double width = box.width();
|
||||
// double height = box.height();
|
||||
// double newX = centerPos.x() - width/2.;
|
||||
// double newY = centerPos.y() - height/2.;
|
||||
// setPos(newX,newY);
|
||||
}
|
||||
|
||||
void QGCustomText::centerAt(double cX, double cY)
|
||||
|
||||
@@ -162,6 +162,15 @@ void QGIViewAnnotation::drawAnnotation()
|
||||
m_textItem->setTextWidth(Rez::guiX(viewAnno->MaxWidth.getValue()));
|
||||
QString qs = QString::fromUtf8(ss.str().c_str());
|
||||
m_textItem->setHtml(qs);
|
||||
m_textItem->setPos(0.,0.);
|
||||
m_textItem->centerAt(0.,0.);
|
||||
}
|
||||
|
||||
void QGIViewAnnotation::rotateView(void)
|
||||
{
|
||||
QRectF r = m_textItem->boundingRect();
|
||||
m_textItem->setTransformOriginPoint(r.center());
|
||||
double rot = getViewObject()->Rotation.getValue();
|
||||
m_textItem->setRotation(-rot);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
void setViewAnnoFeature(TechDraw::DrawViewAnnotation *obj);
|
||||
|
||||
virtual void draw() override;
|
||||
virtual void rotateView(void) override;
|
||||
|
||||
protected:
|
||||
void drawAnnotation();
|
||||
|
||||
Reference in New Issue
Block a user