{ //std::cout<<"|"<<mX<<" "<<mY;
//preparing label to be displayed
if(mLabelIndex==0) {
labelString.clear();
labelString.setNum(mNo);
}
else if(mLabelIndex==1) {
QgsPoint p
=toMapCoords
(QPoint(mX,mY
));
qWarning("Hello");
labelString
=QString("X%1 Y%1").
arg(p.
x()+mapCenterX
).
arg(p.
y()+mapCenterY
);
qWarning("Bye");
}
if(mId==0) /
{ p.save();
p.setBrush(brush);
p.
drawEllipse(QRect(mX
-3+mapCenterX,mY
-3+mapCenterY,
16,
16));
p.drawLine(mX+mapCenterX, mY+mapCenterY, mX+mapCenterX, mY-10+mapCenterY);
if(mShowLabel)
p.
drawText(QPoint(mX
+5+mapCenterX, mY
+5+mapCenterY
) , labelString
);
p.restore();
}
else if (mId==1)
{ brush.setColor(Qt::red);
p.save();
p.setBrush(brush);
p.
drawEllipse(QRect(mX
-3+mapCenterX, mY
-3+mapCenterY,
1 6,
16));
p.drawLine(mX+mapCenterX, mY+mapCenterY, mX+mapCenterX, mY-10+mapCenterY);
if(mShowLabel)
p.
drawText(QPoint(mX
+5+mapCenterX, mY
+5+mapCenterY
), labelString
);
p.restore();
}
else if(mId==2)
{ brush.setColor(Qt::yellow);
p.save();
p.setBrush(brush);
p.
drawEllipse(QRect(mX
-3+mapCenterX, mY
-3+mapCenterY,
6,
6));
p.drawLine(mX+mapCenterX, mY+mapCenterY,mX+mapCenterX, mY-25+mapCenterY);
if(mShowLabel)
p.
drawText(QPoint(mX
+5+mapCenterX,mY
+5+mapCenterY
),labelString
);
p.restore();
}
//updateCanvas();
}
virtual void drawShape(QPainter &p)
{ //std::cout<<"|"<<mX<<" "<<mY;
//preparing label to be displayed
QString labelString;
if(mLabelIndex==0) {
labelString.clear();
labelString.setNum(mNo);
}
else if(mLabelIndex==1) {
QgsPoint p=toMapCoords(QPoint(mX,mY));
qWarning("Hello");
labelString=QString("X%1 Y%1").arg(p.x()+mapCenterX).arg(p.y()+mapCenterY);
qWarning("Bye");
}
QBrush brush(Qt::blue);
if(mId==0) /
{ p.save();
p.setBrush(brush);
p.drawEllipse(QRect(mX-3+mapCenterX,mY-3+mapCenterY,16,16));
p.drawLine(mX+mapCenterX, mY+mapCenterY, mX+mapCenterX, mY-10+mapCenterY);
if(mShowLabel)
p.drawText(QPoint(mX+5+mapCenterX, mY+5+mapCenterY) , labelString);
p.restore();
}
else if (mId==1)
{ brush.setColor(Qt::red);
p.save();
p.setBrush(brush);
p.drawEllipse(QRect(mX-3+mapCenterX, mY-3+mapCenterY,1 6,16));
p.drawLine(mX+mapCenterX, mY+mapCenterY, mX+mapCenterX, mY-10+mapCenterY);
if(mShowLabel)
p.drawText(QPoint(mX+5+mapCenterX, mY+5+mapCenterY), labelString);
p.restore();
}
else if(mId==2)
{ brush.setColor(Qt::yellow);
p.save();
p.setBrush(brush);
p.drawEllipse(QRect(mX-3+mapCenterX, mY-3+mapCenterY,6,6));
p.drawLine(mX+mapCenterX, mY+mapCenterY,mX+mapCenterX, mY-25+mapCenterY);
if(mShowLabel)
p.drawText(QPoint(mX+5+mapCenterX,mY+5+mapCenterY),labelString);
p.restore();
}
//updateCanvas();
}
To copy to clipboard, switch view to plain text mode
Bookmarks