
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9607 8e941d3f-bd1b-0410-a28a-d453659cc2b4
71 lines
1.9 KiB
ObjectPascal
71 lines
1.9 KiB
ObjectPascal
unit Main;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
|
mvMapViewer, mvPluginCommon, uAreaSelectionPlugin, mvTypes;
|
|
|
|
type
|
|
|
|
{ TForm1 }
|
|
|
|
TForm1 = class(TForm)
|
|
Label1: TLabel;
|
|
lblSelArea: TLabel;
|
|
MapView1: TMapView;
|
|
MvPluginManager1: TMvPluginManager;
|
|
Panel1: TPanel;
|
|
procedure FormCreate(Sender: TObject);
|
|
private
|
|
FAreaSelectionPlugin : TAreaSelectionPlugin;
|
|
procedure OnSelectedAreaChanged(Sender : TObject);
|
|
procedure OnSelectedAreaChanging(Sender : TObject; ANewArea : TRealArea; var Allow : Boolean);
|
|
|
|
public
|
|
|
|
end;
|
|
|
|
var
|
|
Form1: TForm1;
|
|
|
|
implementation
|
|
|
|
{$R *.lfm}
|
|
|
|
{ TForm1 }
|
|
procedure TForm1.FormCreate(Sender: TObject);
|
|
begin
|
|
MapView1.Active := true;
|
|
FAreaSelectionPlugin := TAreaSelectionPlugin.Create(MvPluginManager1);
|
|
FAreaSelectionPlugin.MapView := MapView1;
|
|
FAreaSelectionPlugin.OnSelectedAreaChanged:= @OnSelectedAreaChanged;
|
|
FAreaSelectionPlugin.OnSelectedAreaChanging:= @OnSelectedAreaChanging;
|
|
end;
|
|
|
|
procedure TForm1.OnSelectedAreaChanged(Sender: TObject);
|
|
begin
|
|
lblSelArea.Caption := Format('Left %1.2f, Top %1.2f, Right %1.2f, Bottom %1.2f',[
|
|
FAreaSelectionPlugin.SelectedArea.TopLeft.Lon,
|
|
FAreaSelectionPlugin.SelectedArea.TopLeft.Lat,
|
|
FAreaSelectionPlugin.SelectedArea.BottomRight.Lon,
|
|
FAreaSelectionPlugin.SelectedArea.BottomRight.Lat
|
|
]);
|
|
end;
|
|
|
|
procedure TForm1.OnSelectedAreaChanging(Sender: TObject; ANewArea: TRealArea;
|
|
var Allow: Boolean);
|
|
begin
|
|
lblSelArea.Caption := Format('Left %1.2f, Top %1.2f, Right %1.2f, Bottom %1.2f',[
|
|
ANewArea.TopLeft.Lon,
|
|
ANewArea.TopLeft.Lat,
|
|
ANewArea.BottomRight.Lon,
|
|
ANewArea.BottomRight.Lat
|
|
]);
|
|
end;
|
|
|
|
end.
|
|
|