| | rorgmanche 08-31-2005, 08:29 AM Hi,
I have import some data from a txt file and i display them on the map with shadedcircles. I would like to know if it is possible to get the parameters of a shadedcircle (lat, lon, color, and others) when i click or dblclick on it ? Wilfried 08-31-2005, 12:32 PM Hi,
You can put an event handler in SelectionChange. If you select the circle it will fire. There you can check out what it selected and calculate the position, radius etc... rorgmanche 09-01-2005, 04:29 AM Hi, thanks for your response.
I have used the "CalcPos" function from Gilles Kohl, there is a problem. I explain:
I used the code below:
Private Sub AxMappointControl1_SelectionChange
Dim Selection As MapPoint.Location
Loc = oMap.Selection
CalcPos(oMap, Loc, Lat, Lon)
Altitude = oMap.Altitude
Loc2 = oMap.GetLocation(lat, lon, Altitude)
oPushPin = oMap.AddPushpin(Loc2, "Point route")
oPushPin.Symbol = 82
EndSub
I use Loc2 to verify the lat/long calculation, putting a pushpin. Normally the pushpin should be on my shadedcircle but it doesn't. I have the impression that the pushpin is installed at the near point of my selected shadedcircle !!
However, when i select a point on the map like a city, the pushpin is putting exactly on the selection. Wilfried 09-02-2005, 06:22 AM Hi,
I use same code to find the center of a drawed circle. Just verifyed again by placing a pushpin on the point if the circle gets selected, and it is placed right in hte center of it. Can you eventually try the same code with a normal circle to see if the shading has something to do with it ? rorgmanche 09-02-2005, 08:50 AM Hi,
I think there is a problem getting the actually selected point on the map. I t seems that i always get the same coordonnates ! (CalcPos always returns the same lat / lon
Dim oPushPin As MapPoint.Pushpin
Dim Loc, Loc2 As MapPoint.Location
Dim lat, lon, Altitude As Double
Loc = oMap.Location
CalcPos(oMap, Loc, lat, lon)
Altitude = oMap.Altitude
Loc2 = oMap.GetLocation(lat, lon, Altitude)
oPushPin = oMap.AddPushpin(Loc2, "Point route")
oPushPin.Symbol = 82
It seems you are right. The selection doesn't seem to be made. If i display data with pushpin it is the same problem !
How can i get the selected location ?
Rorgmanche Wilfried 09-03-2005, 02:45 AM Hi,
Before we continue, can you check if you have Altitude to a low value ? I always set it to 1 to be sure to have accurate results. But I'm so uses to it that I do this always, even en situations where it is probably not needed. Please try first. Wilfried 09-03-2005, 02:54 AM Hi,
Your code seems ok to me. This is how I did the test:
private void MP_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEve nt e)
{
Map map = MP.ActiveMap;
Shape s = map.Selection as Shape;
if (s != null) {
double lat, lon;
Location loc = s.Location;
pos.CalcPos(loc, out lat, out lon);
map.AddPushpin(loc, "");
}
If this event handler is installed and I dcaw a circle the immediatly pushpin is diplayed and it is exacly in the center point of the circle.
the CalcPos is also based on the same articlle. How large is the deviation you get ? Can you also try to do it very zoomed in and on a whell lknown latitude / longitude to see of your calcPos function does not do a rounding error or so ? rorgmanche 09-06-2005, 11:00 AM Indeed Altitude is not = 1. rorgmanche 09-08-2005, 07:44 AM hi,
I have put the following line code in the "SelectionChange" routine (the first instruction):
oMap.Altitude = 1
but it is always the same. However, when i select any point on a route the routine is ok. I think it is not possible to select a shaddedcircle... I am desperate.
thanks for your reply,
Rorgmanche | |