0

我查看了 MegaDemo 代码,但找不到通过代码创建多边形的方法。有人可以帮助我这是如何完成的。

我努力了

GMPolygon1.Add.AddLinePoint(5.54491313409736, 100.162353515625);
GMPolygon1.Add.AddLinePoint(5.34805212812321, 100.483703613281);
GMPolygon1.Add.AddLinePoint(5.23318714302897, 100.1953125);

没有显示多边形,我还需要使其可编辑并捕获可编辑的坐标。一些方向非常感谢。

4

1 回答 1

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;
于 2013-12-06T06:39:23.937 回答