How to draw a rectangle with text in it?

VC_Man
12-06-2006, 08:24 AM
Language: VC++
Using: Mappoint 2006
Project: Embedded MappointCtrl in client-app


Hello hardcore programmers :bluewink:,


I want to let the user draw a rectangle as a kind of a zone. My app needs to convert the anglepoints of the rectangle into a gps-position. This is easely done by calling the XYtoLocation() method.

But the problem is, if I want to draw a rectangle by hand, than I need drawing toolbar. That is what I want to prevent. There is another way to get this around, but not good enough. I can use the GetSelectedArea() method and convert the retrieved coordinates into Latitude and Longitude. But when I want to draw a recangle using the AddShape() methode, than for a rectangle the Width and the Height (MUST) have to be in km/miles. While I just have it in pixels or latitudes/longitudes, so I need to convert the pixels in km's wich depends on the altitude also.

So my question is, how can I solve this?

Is there an easy way (maybe there is a useful mappoint function), or do I have to find out what kind of messages I need to send to mappoint for simulating a pushed 'draw rectangle'-button?

Wilfried
12-07-2006, 11:44 AM
Hi,

You can use Distance method to calculate the distance to the several Location objects.

As 3th option you could do the drawing yourself as the user drag with the mouse or so, but you need to do same calculations as with the selectedarea.

VC_Man
12-12-2006, 04:54 AM
Hi Wilfried,

Thank you very much for your reply, I'm sorry I didn't react on your response earlier, but I've totaly forgotten, because I solved the problem.

When I encounterd this problem I didn't thaught to calculate the distance between locations, I wasn't even aware of the existence of the method to calculate distance between two locations. Anyway, like you said, the solution is calculating the distance in km.

Thank you Wilfried.

 
Web mp2kmag.com
mapforums.com