Reputation: 1
Using Delphi XE3 and GMLib 1.2.4. Should be basic question. How to draw basic non-linked lines between two given points. I currently have GMMap displayed on a WebBrowser and have GMPolyline component. Using known values for both lat-lon pairs. Just need help plotting line between the two. Using this to plot lines of bearing. This is what I have so far:
procedure TMainGMForm.ButtonPlotLineClick(Sender: TObject);
var
CurLat,CurLon,DisLat,DisLon: Double;
P1,P2: TLatLng;
begin
CurLat := StrToFloat(EditLat.Text);
CurLon := StrToFloat(EditLon.Text);
DisLat := StrToFloat(EditLat2.Text);
DisLon := StrToFloat(EditLon2.Text);
P1 := TLatLng.Create(CurLat,CurLon);
Inc(PointIndex);
P2 := TLatLng.Create(DisLat,DisLon);
Inc(PointIndex);
//what goes here to plot a line between these two points?
//
FreeAndNil(P1);
FreeAndNil(P2);
end;
Upvotes: 0
Views: 922
Reputation: 1552
You need to add a TPolyline into your TGMPolyline, something like this
var
Poly: TPolyline;
begin
Poly := TPolyline(GMPolyline1.Add);
and add the two points into the LinePoints array
Poly.AddLinePoint(CurLat, CurLon);
Poly.AddLinePoint(DisLat, Double);
Upvotes: 1