我已经研究过MegaDemo代码,但找不到通过代码创建Polygon的方法。有人可以帮我解决这个问题。
我试过了
GMPolygon1.Add.AddLinePoint(5.54491313409736, 100.162353515625);
GMPolygon1.Add.AddLinePoint(5.34805212812321, 100.483703613281);
GMPolygon1.Add.AddLinePoint(5.23318714302897, 100.1953125);
没有显示多边形,我还需要使其可编辑并捕获可编辑的坐标。 某些方向很受欢迎。
答案 0 :(得分:1)
试试这个
procedure TForm1.Button1Click(Sender: TObject);
begin
with GMPolygon1.Add do
begin
AddLinePoint(5.54491313409736, 100.162353515625);
AddLinePoint(5.34805212812321, 100.483703613281);
AddLinePoint(5.23318714302897, 100.1953125);
Editable := True;
end;
end;
procedure TForm1.GMMap1AfterPageLoaded(Sender: TObject; First: Boolean);
begin
if first then GMMap1.DoMap;
end;
procedure TForm1.GMPolygon1PathChange(Sender: TObject; Index: Integer;
LinkedComponent: TLinkedComponent);
begin
ShowMessage('Path change!!');
end;