Hi,
There is no ready-made method to accomplish this. You can use the
GeoDataCoordinates::moveByBearing(angle, angleLength) method to create a
circle: This allows for calculating the coordinates of a polygon that
approximates a circle. Then use GeoPainter::drawPolygon(GeoDataLinearRing)
. We are actually doing this inside our measure tool plugin.
See src/plugins/render/measure/MeasureToolPlugin.cpp , line 317-327 . We
are iterating over coordinates there in order to draw a circular pie shape.
For a full circle you'd just have to iterate over the full 360° instead:
GeoDataLinearRing ring;
[...]
while ( iterBearing < currentBearing ) {
ring << currentCoordinates.moveByBearing( iterBearing, angleLength );;
iterBearing += 0.1;
}
[...]
painter->drawPolygon( ring );
If you have questions don't hesitate to ask.
-----Original-Nachricht-----
Betreff: [Marble-devel] How to draw ellipse with GeoPainter at
GeoDataCoordinate(center) and specific radius in km not pixel?!
Datum: 2016-04-19T13:19:05+0200
Von: "Farzad Karamouz" <[email protected]>
An: "[email protected]" <[email protected]>
Hi,
I want to draw an ellipse in specific point width specific radius (km). For
example:
GeoDataCoordinate center(lat, lon, alt, GeoDataCoordinates::Degree);
qreal width = 100; // Unit is KM not Pixel
qreal height = 100; // Unit is KM not Pixel
painter->drawEllipse(center, width, height, false);
how can i do this?!
or
how can i convert km to pixel to use in drawEllipse() ?!
_______________________________________________
Marble-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/marble-devel