View Single Post

  #8 (permalink)  
Old 01-16-2005
Wilfried Wilfried is offline
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi,

I had a moment of free time so I did a little experiment, as I did not knew the answer for your problem eather. It seems that pushpins are always added to a "default" dataset. I assume it is always the first one in the collection. This is what I tryed:

Code:
            uint Count = 10;
            Location Loc;
            Pushpin PP;
            Double Lat = 50;
            Double Lon = -3;
            Double Alt = 1000;

            while (Count-- > 0) {
                Lon += 0.5;
                Loc  = MP.ActiveMap.GetLocation(Lat, Lon, Alt);
                PP   = MP.ActiveMap.AddPushpin(Loc, "Kieken");
                PP.Symbol = 1;
            }
            MP.ActiveMap.DataSets.ZoomTo();
The ZoomTo works here ! This proves there is a dataset of the Pushpins. If there is one then we can access it. ps: dont mind the puspin's name, I always do silly things naming Lest just try something stupid and see where we coming. We draw a circle, select it ans see if we can get a recordset out of a dataset.

Code:
            Loc = MP.ActiveMap.GetLocation(Lat, Lon, Alt);
            Shape s = MP.ActiveMap.Shapes.AddShape(GeoAutoShapeType.geoShapeRadius, Loc, 100, 100);
            s.Line.Weight = 0;
            s.Select();
            object o = 1;
            Recordset rs = MP.ActiveMap.DataSets.get_Item(ref o).QueryShape(s);
            rs.MoveFirst();
            while (!rs.EOF) {
                Console.WriteLine(rs.Pushpin.Name.ToString());
                rs.MoveNext();
            }
And look here only the records in the shape are returned. I think this is what you need Note that the first dataset is 1 and not 0 in the index. This is with Mappoint whole time, it start indexing at 1.
Reply With Quote