<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title></title></head><body><p style="margin: 0px;"><span style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;text-decoration:none"> </span></p>
<p style="margin: 0px;"><span style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;text-decoration:none">Hi,</span></p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"><span style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;text-decoration:none">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. </span></p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"><span style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;text-decoration:none">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:</span></p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"><span style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;text-decoration:none">GeoDataLinearRing ring;<br /></span></p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px 5px 0px 0px;"><span style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;text-decoration:none">[...]</span></p>
<p style="margin: 0px;"><span style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;text-decoration:none"><br />while ( iterBearing < currentBearing ) {<br /> ring << currentCoordinates.moveByBearing( iterBearing, angleLength );;<br /> iterBearing += 0.1;<br />}<br /><br /></span></p>
<p style="margin: 0px 5px 0px 0px;"><span style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;text-decoration:none">[...]</span></p>
<p style="margin: 0px 5px 0px 0px;"> </p>
<p style="margin: 0px;"><span style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;text-decoration:none">painter->drawPolygon( ring );<br /></span></p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"><span style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;text-decoration:none">If you have questions don't hesitate to ask.</span></p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"><span style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;text-decoration:none"> </span></p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;">-----Original-Nachricht-----</p>
<p style="margin: 0px;">Betreff: [Marble-devel] How to draw ellipse with GeoPainter at GeoDataCoordinate(center) and specific radius in km not pixel?!</p>
<p style="margin: 0px;">Datum: 2016-04-19T13:19:05+0200</p>
<p style="margin: 0px;">Von: "Farzad Karamouz" <farzadkaramouz@gmail.com></p>
<p style="margin: 0px;">An: "marble-devel@kde.org" <marble-devel@kde.org></p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"> </p>
<div>
<div dir="ltr">Hi,
<div>I want to draw an ellipse in specific point width specific radius (km). For example:</div>
<div> </div>
<div>GeoDataCoordinate center(lat, lon, alt, GeoDataCoordinates::Degree);</div>
<div>qreal width = 100; // Unit is KM not Pixel</div>
<div>qreal height = 100; // Unit is KM not Pixel</div>
<div>painter->drawEllipse(center, width, height, false);</div>
<div> </div>
<div>how can i do this?! </div>
<div>or </div>
<div>how can i convert km to pixel to use in drawEllipse() ?!</div>
</div>
</div></body></html>