pushpins with delphi

ian
06-18-2003, 09:33 AM
I'm very new to mappoint so please forgive me if this has been answered before. i want to display the results of a databse query on a map. the language is delphi. here is my code.

var vGuid : TGuid;
curLat, CurLong, CurScore:real;
objLocTst:location;
ObjPin:Pushpin;
i:integer;
begin
i:=0;
OleContainer.CreateObject('MapPoint.Map.NA.9', False);
OleContainer.DoVerb(1);
OleContainer.OleObjectInterface.GetUserClassID(vGu id);
FMap := IDispatch(OleContainer.OleObject) as _Map;
FMap.DataSets.AddPushpinSet('70 plus');

with DM.ADOQ do
begin
First;
// while not Eof do
for i:=0 to 100 do //just do a subset for debugging
begin
CurLong := DM.ADOQ.FieldByName('longitude_x').AsFloat; //longitude
CurLat := DM.ADOQ.FieldByName('latitude_y').AsFloat;//latitude
CurScore := DM.ADOQ.FieldByName('homogeneity_score').Value; //what needs to be plotted as a function of lat, long
objLocTst := FMap.GetLocation(curLat, CurLong,1) ;
objPin := FMap.AddPushpin(objLocTst, floattostr(CurScore));
objPin.BalloonState := geoDisplayNone ;
objPin.Cut ;

Next;

end;
end;

// FMap.
end;


this runs fine but i never get anything displayed. i think i'm missing something fundamental. can anyone help? thanks

Anonymous
06-19-2003, 05:16 AM
Seems you´re deleting your pushpins with ObjPin.Cut

Greetings, Jack.

ian
06-19-2003, 12:15 PM
yes, i caught that later on. thank you. how would i go about adding a second dataset to this? i want to be able to overlay pushpins of different colours, each one corresponding to the results of a different database query. i think i'm missing the link between a dataset and a pushpin..

 
Web mp2kmag.com
mapforums.com