[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
www.undertowsoftware.com • View topic - Drawing a Circle

Drawing a Circle

A forum made available for users of the MapPro OCX SDK to exchange ideas, ask each other questions, etc.

Drawing a Circle

Postby MarkY » Wed May 08, 2013 9:27 am

Since I am asking questions... Is there a way to draw a circle of a certain radius and make it part of the map? In the old days, I used to use the Windows GDI to draw it on the surface map, tied to the onPaintAfter event, so I can get the scaled DC, but it's very awkward. I am thinking there has to be a better way, right? All I want is to specify the center and the radius, that's it. Simple things!
The gene pool has no lifeguard...
User avatar
MarkY
Active User
Active User
 
Posts: 28
Joined: Sat Feb 06, 2010 7:31 pm

Re: Drawing a Circle

Postby Gyrotech » Wed May 08, 2013 10:43 am

There is a simple way to do that by using the mCircle method off the CAD interface. Here is what the manual says (I got this from the pdf version of the manual, emphasis is mine).

------

Xc,Yc - Lon, Lat coordinates (in decimal degrees) of the center of the circle.
Xp,Yp - Lon, Lat coordinates of the first point on the circle circumference.

Note that if Xp=Xc then Yp-Yc is the radius of the circle in degrees, and if Yp=Yc, then Xp-Xc is the radius of the circle in degrees.


------

All you need to do is remember to convert your radius from miles to degrees. And here is where it may be a bit tricky, because...

1 degree of latitude = about 69.11 miles

1 degree of longitude = about 69.11 miles along the equator. But all of the longitudes come together at the poles, so the farther you are from the equator, the fewer miles there are in one degree. So, number of miles in 1 degree of longitude = (69.11) x (cosine of the latitude) at that point. So, you could use the aspect ratio to adjust for that.
User avatar
Gyrotech
Frequent User
Frequent User
 
Posts: 52
Joined: Mon May 03, 2010 11:23 pm

Re: Drawing a Circle

Postby MarkY » Wed May 08, 2013 3:05 pm

It looks straight forward, I guess, but I am not sure what to do with the rest of the info regarding the longitude adjustment. You lost me there :-(

Also, there is another function, ellipse, and I thought I could use that, but it doesn't take a center and the radius as inputs :-(
The gene pool has no lifeguard...
User avatar
MarkY
Active User
Active User
 
Posts: 28
Joined: Sat Feb 06, 2010 7:31 pm

Re: Drawing a Circle

Postby George.Tan » Thu Jun 20, 2013 11:04 am

MarkY wrote:It looks straight forward, I guess, but I am not sure what to do with the rest of the info regarding the longitude adjustment. You lost me there

Me too. I got lost there. I'm probably missing something in the explanation.

MarkY wrote:Also, there is another function, ellipse, and I thought I could use that, but it doesn't take a center and the radius as inputs

I would also think that such a simple function would be a basic feature for a set of CAD routines, as those provided by the DSK. But, I couldn't find one.
User avatar
George.Tan
Active User
Active User
 
Posts: 25
Joined: Sat Mar 31, 2012 11:26 am


Return to MapPro OCX

Who is online

Users browsing this forum: No registered users and 2 guests

cron