diff --git a/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/project1.lpi b/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/project1.lpi index 7974fd8bb..0b4727301 100644 --- a/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/project1.lpi +++ b/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/project1.lpi @@ -111,7 +111,7 @@ - + diff --git a/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/project1.lpr b/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/project1.lpr index ec793aa82..15c09ea87 100644 --- a/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/project1.lpr +++ b/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/project1.lpr @@ -19,7 +19,7 @@ begin RequireDerivedFormResource:=True; Application.Scaled:=True; Application.Initialize; - Application.CreateForm(TForm1, Form1); + Application.CreateForm(TMainForm, MainForm); Application.Run; end. diff --git a/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/unit1.lfm b/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/unit1.lfm index c00a17349..c12f97560 100644 --- a/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/unit1.lfm +++ b/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/unit1.lfm @@ -1,35 +1,34 @@ -object Form1: TForm1 +object MainForm: TMainForm Left = 324 Height = 473 Top = 118 Width = 669 - Caption = 'Form1' + Caption = 'Draggable Marker Demo' ClientHeight = 473 ClientWidth = 669 LCLVersion = '4.99.0.0' OnCreate = FormCreate - object MapView1: TMapView + object MapView: TMapView Left = 0 Height = 473 Top = 0 Width = 669 - Active = True Align = alClient - DownloadEngine = MapView1.BuiltInDLE - DrawingEngine = MapView1.BuiltInDE + DownloadEngine = MapView.BuiltInDLE + DrawingEngine = MapView.BuiltInDE Layers = <> Font.Color = clBlack MapProvider = 'OpenStreetMap Mapnik' - PluginManager = MvPluginManager1 + PluginManager = PluginManager end - object MvPluginManager1: TMvPluginManager + object PluginManager: TMvPluginManager Left = 427 Top = 141 - object MvPluginManager1LegalNoticePlugin2: TLegalNoticePlugin - LegalNotice = 'Copyright' + object LegalNoticePlugin: TLegalNoticePlugin + LegalNotice = '(c) OpenStreetMap and contributors' LegalNoticeURL = 'https://www.openstreetmap.org' end - object MvPluginManager1DraggableMarkerPlugin2: TDraggableMarkerPlugin + object DraggableMarkerPlugin: TDraggableMarkerPlugin end end end diff --git a/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/unit1.pas b/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/unit1.pas index 10b48e20c..a9d45fec3 100644 --- a/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/unit1.pas +++ b/components/lazmapviewer/examples/plugin_demos/dragmarker_demo/unit1.pas @@ -11,13 +11,15 @@ uses type - { TForm1 } + { TMainForm } - TForm1 = class(TForm) - MapView1: TMapView; - MvPluginManager1: TMvPluginManager; + TMainForm = class(TForm) + MapView: TMapView; + PluginManager: TMvPluginManager; MvPluginManager1DraggableMarkerPlugin1: TDraggableMarkerPlugin; MvPluginManager1LegalNoticePlugin1: TLegalNoticePlugin; + DraggableMarkerPlugin: TDraggableMarkerPlugin; + LegalNoticePlugin: TLegalNoticePlugin; procedure FormCreate(Sender: TObject); private @@ -26,15 +28,16 @@ type end; var - Form1: TForm1; + MainForm: TMainForm; implementation {$R *.lfm} -{ TForm1 } +{ TMainForm } + +procedure TMainForm.FormCreate(Sender: TObject); -procedure TForm1.FormCreate(Sender: TObject); procedure AddTraditionalMarker(const ALon, ALat : Double; ACaption : String); var gpsPt: TGpsPointOfInterest; @@ -43,7 +46,7 @@ procedure TForm1.FormCreate(Sender: TObject); try gpsPt.Name := ACaption; gpsPt.ImageIndex := 0; - MapView1.GPSItems.Add(gpsPt, 100); + MapView.GPSItems.Add(gpsPt, 100); gpsPt := Nil; finally if Assigned(gpsPt) then @@ -52,6 +55,8 @@ procedure TForm1.FormCreate(Sender: TObject); end; begin + MapView.Active := true; + AddTraditionalMarker(0.0, 51.4825766,'Greenwich'); AddTraditionalMarker(2.2945500,48.8582300,'Tour d´Eiffel, Paris'); AddTraditionalMarker(-79.3884000,43.6439500,'CN Tower, Toronto'); diff --git a/components/lazmapviewer/examples/plugin_demos/grid_demo/GridPlugin_Demo.lpi b/components/lazmapviewer/examples/plugin_demos/grid_demo/GridPlugin_Demo.lpi index 374efb429..a9723226a 100644 --- a/components/lazmapviewer/examples/plugin_demos/grid_demo/GridPlugin_Demo.lpi +++ b/components/lazmapviewer/examples/plugin_demos/grid_demo/GridPlugin_Demo.lpi @@ -45,7 +45,7 @@ - + diff --git a/components/lazmapviewer/examples/plugin_demos/grid_demo/GridPlugin_Demo.lpr b/components/lazmapviewer/examples/plugin_demos/grid_demo/GridPlugin_Demo.lpr index 874ffaf09..842811f76 100644 --- a/components/lazmapviewer/examples/plugin_demos/grid_demo/GridPlugin_Demo.lpr +++ b/components/lazmapviewer/examples/plugin_demos/grid_demo/GridPlugin_Demo.lpr @@ -21,7 +21,7 @@ begin Application.MainFormOnTaskbar := True; {$POP} Application.Initialize; - Application.CreateForm(TForm1, Form1); + Application.CreateForm(TMainForm, MainForm); Application.Run; end. diff --git a/components/lazmapviewer/examples/plugin_demos/grid_demo/main.lfm b/components/lazmapviewer/examples/plugin_demos/grid_demo/main.lfm index b72886de5..6ea46f228 100644 --- a/components/lazmapviewer/examples/plugin_demos/grid_demo/main.lfm +++ b/components/lazmapviewer/examples/plugin_demos/grid_demo/main.lfm @@ -1,4 +1,4 @@ -object Form1: TForm1 +object MainForm: TMainForm Left = 314 Height = 524 Top = 130 diff --git a/components/lazmapviewer/examples/plugin_demos/grid_demo/main.pas b/components/lazmapviewer/examples/plugin_demos/grid_demo/main.pas index dce291c14..22bace69c 100644 --- a/components/lazmapviewer/examples/plugin_demos/grid_demo/main.pas +++ b/components/lazmapviewer/examples/plugin_demos/grid_demo/main.pas @@ -10,7 +10,7 @@ uses mvMapViewer, mvTypes, mvEngine, mvPluginCore, mvMapGridPlugin; type - TForm1 = class(TForm) + TMainForm = class(TForm) cbCyclic: TCheckBox; cbEnabled: TCheckBox; cbLeft: TCheckBox; @@ -55,13 +55,13 @@ type end; var - Form1: TForm1; + MainForm: TMainForm; implementation {$R *.lfm} -procedure TForm1.FormCreate(Sender: TObject); +procedure TMainForm.FormCreate(Sender: TObject); begin Randomize; MapView.Active := true; @@ -74,7 +74,7 @@ begin tbOpacity.Position := round(FMapGridPlugin.BackgroundOpacity * 100); end; -procedure TForm1.AddOrDeletePointOfInterest(X, Y: Integer); +procedure TMainForm.AddOrDeletePointOfInterest(X, Y: Integer); const DELTA = 5; // Tolerance of the HitTest var @@ -118,32 +118,32 @@ begin end; end; -procedure TForm1.cbCyclicChange(Sender: TObject); +procedure TMainForm.cbCyclicChange(Sender: TObject); begin MapView.Cyclic := cbCyclic.Checked; end; -procedure TForm1.cbEnabledChange(Sender: TObject); +procedure TMainForm.cbEnabledChange(Sender: TObject); begin FMapGridPlugin.Enabled := cbEnabled.Checked; end; -procedure TForm1.clbBackgroundColorColorChanged(Sender: TObject); +procedure TMainForm.clbBackgroundColorColorChanged(Sender: TObject); begin FMapGridPlugin.BackgroundColor := clbBackgroundColor.ButtonColor; end; -procedure TForm1.clbLabelTextColorColorChanged(Sender: TObject); +procedure TMainForm.clbLabelTextColorColorChanged(Sender: TObject); begin FMapGridPlugin.Font.Color := clbLabelTextColor.ButtonColor; end; -procedure TForm1.clbPenColorColorChanged(Sender: TObject); +procedure TMainForm.clbPenColorColorChanged(Sender: TObject); begin FMapGridPlugin.Pen.Color := clbPenColor.ButtonColor; end; -procedure TForm1.cmbIncrementChange(Sender: TObject); +procedure TMainForm.cmbIncrementChange(Sender: TObject); var s: String; multiplier: Double; @@ -176,7 +176,7 @@ begin end; end; -procedure TForm1.LabelPositionChange(Sender: TObject); +procedure TMainForm.LabelPositionChange(Sender: TObject); begin with FMapGridPlugin do begin @@ -202,19 +202,19 @@ begin end; end; -procedure TForm1.MapViewMouseUp(Sender: TObject; Button: TMouseButton; Shift: +procedure TMainForm.MapViewMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if (Button = mbRight) and (Shift = []) then AddOrDeletePointOfInterest(X, Y); end; -procedure TForm1.seLabelDistanceChange(Sender: TObject); +procedure TMainForm.seLabelDistanceChange(Sender: TObject); begin FMapGridPlugin.LabelDistance := seLabelDistance.Value; end; -procedure TForm1.tbOpacityChange(Sender: TObject); +procedure TMainForm.tbOpacityChange(Sender: TObject); begin FMapGridPlugin.BackgroundOpacity := tbOpacity.Position / 100; end; diff --git a/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/project1.lpi b/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/project1.lpi index 44895b279..582f05bcc 100644 --- a/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/project1.lpi +++ b/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/project1.lpi @@ -43,7 +43,7 @@ - + diff --git a/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/project1.lpr b/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/project1.lpr index a8854e3c8..ebac5d8d1 100644 --- a/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/project1.lpr +++ b/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/project1.lpr @@ -22,7 +22,7 @@ begin Application.MainFormOnTaskbar := True; {$POP} Application.Initialize; - Application.CreateForm(TForm1, Form1); + Application.CreateForm(TMainForm, MainForm); Application.Run; end. diff --git a/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/unit1.lfm b/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/unit1.lfm index 348b6fa46..983cfcfe9 100644 --- a/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/unit1.lfm +++ b/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/unit1.lfm @@ -1,63 +1,76 @@ -object Form1: TForm1 +object MainForm: TMainForm Left = 314 Height = 487 Top = 130 - Width = 977 + Width = 943 Caption = 'Legal Notice Plugin Demo' ClientHeight = 487 - ClientWidth = 977 + ClientWidth = 943 LCLVersion = '4.99.0.0' OnCreate = FormCreate - object Panel1: TPanel - Left = 0 - Height = 70 - Top = 417 - Width = 977 + object ParamsPanel: TPanel + Left = 8 + Height = 54 + Top = 425 + Width = 927 Align = alBottom + AutoSize = True + BorderSpacing.Around = 8 BevelOuter = bvNone - ClientHeight = 70 - ClientWidth = 977 + ClientHeight = 54 + ClientWidth = 927 TabOrder = 0 - object Edit1: TEdit - AnchorSideRight.Side = asrBottom - Left = 96 + object edLegalNotice: TEdit + AnchorSideLeft.Control = lblLegalNotice + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = ParamsPanel + AnchorSideRight.Control = cmbPosition + Left = 75 Height = 23 - Top = 6 - Width = 640 + Top = 0 + Width = 601 Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 8 + BorderSpacing.Right = 4 TabOrder = 0 - Text = 'Edit1' - OnChange = Edit1Change + Text = 'edLegalNotice' + OnChange = edLegalNoticeChange end - object Label1: TLabel - AnchorSideTop.Control = Edit1 + object lblLegalNotice: TLabel + AnchorSideLeft.Control = ParamsPanel + AnchorSideTop.Control = edLegalNotice AnchorSideTop.Side = asrCenter - Left = 13 + Left = 0 Height = 15 - Top = 10 + Top = 4 Width = 67 Caption = 'Legal notice:' end - object Button1: TButton + object btnSaveToImage: TButton + AnchorSideTop.Control = ParamsPanel + AnchorSideRight.Control = ParamsPanel AnchorSideRight.Side = asrBottom - Left = 868 + Left = 800 Height = 25 - Top = 6 - Width = 100 + Top = 0 + Width = 127 Anchors = [akTop, akRight] AutoSize = True - Caption = 'Save to image' + Caption = 'Save map to image' TabOrder = 1 - OnClick = Button1Click + OnClick = btnSaveToImageClick end - object ComboBox1: TComboBox - AnchorSideTop.Control = Edit1 + object cmbPosition: TComboBox + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = edLegalNotice AnchorSideTop.Side = asrCenter - Left = 744 + AnchorSideRight.Control = btnSaveToImage + Left = 680 Height = 23 - Top = 6 + Top = 0 Width = 116 Anchors = [akTop, akRight] + BorderSpacing.Right = 4 ItemHeight = 15 ItemIndex = 3 Items.Strings = ( @@ -69,50 +82,62 @@ object Form1: TForm1 Style = csDropDownList TabOrder = 2 Text = 'bottom/right' - OnChange = ComboBox1Change + OnChange = cmbPositionChange end - object CheckBox1: TCheckBox - Left = 96 + object cbShowMapCenter: TCheckBox + AnchorSideLeft.Control = edLegalNotice + AnchorSideTop.Control = seOpacity + AnchorSideTop.Side = asrCenter + Left = 75 Height = 19 - Top = 36 + Top = 33 Width = 110 Caption = 'Show map center' Checked = True State = cbChecked TabOrder = 3 - OnChange = CheckBox1Change + OnChange = cbShowMapCenterChange end - object CheckBox2: TCheckBox - Left = 224 + object cbShowLegalNotice: TCheckBox + AnchorSideLeft.Control = cbShowMapCenter + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = seOpacity + AnchorSideTop.Side = asrCenter + Left = 209 Height = 19 - Top = 36 + Top = 33 Width = 111 + BorderSpacing.Left = 24 Caption = 'Show legal notice' Checked = True State = cbChecked TabOrder = 4 - OnChange = CheckBox2Change + OnChange = cbShowLegalNoticeChange end - object Label2: TLabel - AnchorSideTop.Control = CheckBox1 + object lblOpacity: TLabel + AnchorSideLeft.Control = cbShowLegalNotice + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = cbShowMapCenter AnchorSideTop.Side = asrCenter - Left = 387 + Left = 352 Height = 15 - Top = 38 + Top = 35 Width = 124 + BorderSpacing.Left = 32 Caption = 'Legal note opacity: (%):' end - object SpinEdit1: TSpinEdit - AnchorSideLeft.Control = Label2 + object seOpacity: TSpinEdit + AnchorSideLeft.Control = lblOpacity AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = Label2 - AnchorSideTop.Side = asrCenter - Left = 519 + AnchorSideTop.Control = edLegalNotice + AnchorSideTop.Side = asrBottom + Left = 484 Height = 23 - Top = 34 + Top = 31 Width = 69 Alignment = taRightJustify BorderSpacing.Left = 8 + BorderSpacing.Top = 8 Increment = 5 MaxValue = 100 TabOrder = 5 @@ -124,8 +149,8 @@ object Form1: TForm1 AnchorSideLeft.Control = Owner AnchorSideLeft.Side = asrCenter AnchorSideTop.Control = Owner - AnchorSideBottom.Control = Panel1 - Left = 486 + AnchorSideBottom.Control = ParamsPanel + Left = 469 Height = 417 Top = 0 Width = 4 @@ -136,11 +161,11 @@ object Form1: TForm1 AnchorSideLeft.Control = Owner AnchorSideTop.Control = Owner AnchorSideRight.Control = Bevel1 - AnchorSideBottom.Control = Panel1 + AnchorSideBottom.Control = ParamsPanel Left = 0 Height = 417 Top = 0 - Width = 486 + Width = 469 Anchors = [akTop, akLeft, akRight, akBottom] BevelOuter = bvNone TabOrder = 1 @@ -151,11 +176,11 @@ object Form1: TForm1 AnchorSideTop.Control = Owner AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = Panel1 - Left = 490 + AnchorSideBottom.Control = ParamsPanel + Left = 473 Height = 417 Top = 0 - Width = 487 + Width = 470 Anchors = [akTop, akLeft, akRight, akBottom] BevelOuter = bvNone TabOrder = 2 diff --git a/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/unit1.pas b/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/unit1.pas index 476897e9b..8b4e9c548 100644 --- a/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/unit1.pas +++ b/components/lazmapviewer/examples/plugin_demos/legalnotice_demo/unit1.pas @@ -11,24 +11,24 @@ uses mvMapViewer, mvPluginCore, mvPlugins; type - TForm1 = class(TForm) + TMainForm = class(TForm) Bevel1: TBevel; - Button1: TButton; - CheckBox1: TCheckBox; - CheckBox2: TCheckBox; - ComboBox1: TComboBox; - Edit1: TEdit; - SpinEdit1: TSpinEdit; - Label1: TLabel; - Label2: TLabel; - Panel1: TPanel; + btnSaveToImage: TButton; + cbShowMapCenter: TCheckBox; + cbShowLegalNotice: TCheckBox; + cmbPosition: TComboBox; + edLegalNotice: TEdit; + seOpacity: TSpinEdit; + lblLegalNotice: TLabel; + lblOpacity: TLabel; + ParamsPanel: TPanel; Panel2: TPanel; Panel3: TPanel; - procedure Button1Click(Sender: TObject); - procedure CheckBox1Change(Sender: TObject); - procedure CheckBox2Change(Sender: TObject); - procedure ComboBox1Change(Sender: TObject); - procedure Edit1Change(Sender: TObject); + procedure btnSaveToImageClick(Sender: TObject); + procedure cbShowMapCenterChange(Sender: TObject); + procedure cbShowLegalNoticeChange(Sender: TObject); + procedure cmbPositionChange(Sender: TObject); + procedure edLegalNoticeChange(Sender: TObject); procedure FloatSpinEdit1Change(Sender: TObject); procedure FormCreate(Sender: TObject); private @@ -40,15 +40,15 @@ type end; var - Form1: TForm1; + MainForm: TMainForm; implementation {$R *.lfm} -{ TForm1 } +{ TMainForm } -procedure TForm1.FormCreate(Sender: TObject); +procedure TMainForm.FormCreate(Sender: TObject); begin FPluginManager := TMvPluginManager.Create(Self); @@ -84,8 +84,8 @@ begin BackgroundColor := clWhite; MapView := FMapView1; - Edit1.Text := LegalNotice; - SpinEdit1.Value := round(Opacity * 100); + edLegalNotice.Text := LegalNotice; + seOpacity.Value := round(Opacity * 100); end; with TLegalNoticePlugin.Create(FPluginManager) do @@ -109,39 +109,39 @@ begin with TLinkedMapsPlugin.Create(FPluginManager) do ; end; -procedure TForm1.Edit1Change(Sender: TObject); +procedure TMainForm.edLegalNoticeChange(Sender: TObject); begin - (FPluginManager.Item[0] as TLegalNoticePlugin).LegalNotice := Edit1.Text; + (FPluginManager.Item[0] as TLegalNoticePlugin).LegalNotice := edLegalNotice.Text; end; -procedure TForm1.FloatSpinEdit1Change(Sender: TObject); +procedure TMainForm.FloatSpinEdit1Change(Sender: TObject); begin - (FPluginManager.Item[0] as TLegalNoticePlugin).Opacity := SpinEdit1.Value / 100; + (FPluginManager.Item[0] as TLegalNoticePlugin).Opacity := seOpacity.Value / 100; if FPluginManager.PluginList.Count > 1 then - (FPluginManager.Item[1] as TLegalNoticePlugin).Opacity := SpinEdit1.Value / 100; + (FPluginManager.Item[1] as TLegalNoticePlugin).Opacity := seOpacity.Value / 100; end; -procedure TForm1.Button1Click(Sender: TObject); +procedure TMainForm.btnSaveToImageClick(Sender: TObject); begin FMapView1.SaveToFile(TPortableNetworkGraphic, 'map1.png'); FMapView2.SaveToFile(TPortableNetworkGraphic, 'map2.png'); end; -procedure TForm1.CheckBox1Change(Sender: TObject); +procedure TMainForm.cbShowMapCenterChange(Sender: TObject); begin - (FPluginManager.Item[2] as TCenterMarkerPlugin).Enabled := Checkbox1.Checked; + (FPluginManager.Item[2] as TCenterMarkerPlugin).Enabled := cbShowMapCenter.Checked; end; -procedure TForm1.CheckBox2Change(Sender: TObject); +procedure TMainForm.cbShowLegalNoticeChange(Sender: TObject); begin - (FPluginManager.Item[0] as TLegalNoticePlugin).Enabled := Checkbox2.Checked; - (FPluginManager.Item[1] as TLegalNoticePlugin).Enabled := Checkbox2.Checked; + (FPluginManager.Item[0] as TLegalNoticePlugin).Enabled := cbShowLegalNotice.Checked; + (FPluginManager.Item[1] as TLegalNoticePlugin).Enabled := cbShowLegalNotice.Checked; end; -procedure TForm1.ComboBox1Change(Sender: TObject); +procedure TMainForm.cmbPositionChange(Sender: TObject); begin - (FPluginManager.Item[0] as TLegalNoticePlugin).Position := TLegalNoticePosition(Combobox1.ItemIndex); - (FPluginManager.Item[1] as TLegalNoticePlugin).Position := TLegalNoticePosition(Combobox1.ItemIndex); + (FPluginManager.Item[0] as TLegalNoticePlugin).Position := TLegalNoticePosition(cmbPosition.ItemIndex); + (FPluginManager.Item[1] as TLegalNoticePlugin).Position := TLegalNoticePosition(cmbPosition.ItemIndex); end; end. diff --git a/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/linkedmaps_demo.lpi b/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/linkedmaps_demo.lpi index 120f0c918..cd6c16feb 100644 --- a/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/linkedmaps_demo.lpi +++ b/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/linkedmaps_demo.lpi @@ -40,7 +40,7 @@ - + diff --git a/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/linkedmaps_demo.lpr b/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/linkedmaps_demo.lpr index b9c23142f..40e9d0334 100644 --- a/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/linkedmaps_demo.lpr +++ b/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/linkedmaps_demo.lpr @@ -22,7 +22,7 @@ begin Application.MainFormOnTaskbar := True; {$POP} Application.Initialize; - Application.CreateForm(TForm1, Form1); + Application.CreateForm(TMainForm, MainForm); Application.Run; end. diff --git a/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/main.lfm b/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/main.lfm index 260ef7790..538fe32e2 100644 --- a/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/main.lfm +++ b/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/main.lfm @@ -1,4 +1,4 @@ -object Form1: TForm1 +object MainForm: TMainForm Left = 314 Height = 406 Top = 130 @@ -13,73 +13,40 @@ object Form1: TForm1 ClientWidth = 1109 LCLVersion = '4.99.0.0' OnCreate = FormCreate - object Panel1: TPanel - AnchorSideBottom.Control = Owner - AnchorSideBottom.Side = asrBottom - Left = 4 - Height = 398 - Top = 4 - Width = 548 - BorderSpacing.Left = 4 - BorderSpacing.Top = 4 - BorderSpacing.Bottom = 4 - Caption = 'Panel1' - ClientHeight = 398 - ClientWidth = 548 - TabOrder = 0 - object MapView1: TMapView - Left = 1 - Height = 396 - Top = 1 - Width = 546 - Align = alClient - Cyclic = True - DownloadEngine = MapView1.BuiltInDLE - DrawingEngine = MapView1.BuiltInDE - Layers = <> - Font.Color = clBlack - MapProvider = 'OpenStreetMap Mapnik' - PluginManager = MvPluginManager1 - UseThreads = True - ZoomToCursor = False - end + object MapView1: TMapView + Left = 0 + Height = 406 + Top = 0 + Width = 552 + Cyclic = True + DownloadEngine = MapView1.BuiltInDLE + DrawingEngine = MapView1.BuiltInDE + Layers = <> + Font.Color = clBlack + MapProvider = 'OpenStreetMap Mapnik' + PluginManager = PluginManager + UseThreads = True + ZoomToCursor = False end - object Panel2: TPanel - AnchorSideLeft.Side = asrBottom - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Side = asrBottom + object MapView2: TMapView Left = 556 - Height = 398 - Top = 4 - Width = 549 - BorderSpacing.Top = 4 - BorderSpacing.Right = 4 - BorderSpacing.Bottom = 4 - Caption = 'Panel2' - ClientHeight = 398 - ClientWidth = 549 - TabOrder = 1 - object MapView2: TMapView - Left = 1 - Height = 396 - Top = 1 - Width = 547 - Align = alClient - Cyclic = True - DownloadEngine = MapView2.BuiltInDLE - DrawingEngine = MapView2.BuiltInDE - Layers = <> - Font.Color = clBlack - MapProvider = 'Maps For Free' - PluginManager = MvPluginManager1 - UseThreads = True - ZoomToCursor = False - end + Height = 406 + Top = 0 + Width = 553 + Cyclic = True + DownloadEngine = MapView2.BuiltInDLE + DrawingEngine = MapView2.BuiltInDE + Layers = <> + Font.Color = clBlack + MapProvider = 'Maps For Free' + PluginManager = PluginManager + UseThreads = True + ZoomToCursor = False end - object MvPluginManager1: TMvPluginManager - Left = 432 - Top = 152 - object MvPluginManager1LinkedMapsPlugin1: TLinkedMapsPlugin + object PluginManager: TMvPluginManager + Left = 424 + Top = 144 + object LinkedMapsPlugin: TLinkedMapsPlugin end end end diff --git a/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/main.pas b/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/main.pas index 000c981b6..4f9bfc792 100644 --- a/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/main.pas +++ b/components/lazmapviewer/examples/plugin_demos/linkedmaps_demo/main.pas @@ -9,13 +9,11 @@ uses Controls, Graphics; type - TForm1 = class(TForm) + TMainForm = class(TForm) MapView1: TMapView; MapView2: TMapView; - MvPluginManager1: TMvPluginManager; - MvPluginManager1LinkedMapsPlugin1: TLinkedMapsPlugin; - Panel1: TPanel; - Panel2: TPanel; + PluginManager: TMvPluginManager; + LinkedMapsPlugin: TLinkedMapsPlugin; procedure FormCreate(Sender: TObject); private @@ -24,13 +22,13 @@ type end; var - Form1: TForm1; + MainForm: TMainForm; implementation {$R *.lfm} -procedure TForm1.FormCreate(Sender: TObject); +procedure TMainForm.FormCreate(Sender: TObject); begin MapView1.Active := true; MapView2.Active := true; diff --git a/components/lazmapviewer/examples/plugin_demos/scale_demo/main.lfm b/components/lazmapviewer/examples/plugin_demos/scale_demo/main.lfm index c25ae52af..20f682168 100644 --- a/components/lazmapviewer/examples/plugin_demos/scale_demo/main.lfm +++ b/components/lazmapviewer/examples/plugin_demos/scale_demo/main.lfm @@ -1,4 +1,4 @@ -object Form1: TForm1 +object MainForm: TMainForm Left = 390 Height = 467 Top = 139 @@ -8,15 +8,14 @@ object Form1: TForm1 ClientWidth = 936 LCLVersion = '4.99.0.0' OnCreate = FormCreate - object MapView1: TMapView + object MapView: TMapView Left = 328 Height = 467 Top = 0 Width = 608 - Active = True Align = alClient - DownloadEngine = MapView1.BuiltInDLE - DrawingEngine = MapView1.BuiltInDE + DownloadEngine = MapView.BuiltInDLE + DrawingEngine = MapView.BuiltInDE Layers = < item PointsOfInterest = <> @@ -27,12 +26,12 @@ object Form1: TForm1 MapProvider = 'Open Topo Map' MapCenter.Longitude = 10 MapCenter.Latitude = 50 - PluginManager = MvPluginManager1 + PluginManager = PluginManager UseThreads = True Zoom = 8 - OnZoomChange = MapView1ZoomChange + OnZoomChange = MapViewZoomChange end - object Panel1: TPanel + object ParamsPanel: TPanel Left = 8 Height = 451 Top = 8 @@ -45,8 +44,8 @@ object Form1: TForm1 ClientWidth = 312 TabOrder = 1 object cbScaleVisible: TCheckBox - AnchorSideLeft.Control = Panel1 - AnchorSideTop.Control = Panel1 + AnchorSideLeft.Control = ParamsPanel + AnchorSideTop.Control = ParamsPanel Left = 0 Height = 19 Top = 0 @@ -58,10 +57,10 @@ object Form1: TForm1 OnChange = cbScaleVisibleChange end object rgScaleAlign: TRadioGroup - AnchorSideLeft.Control = Panel1 + AnchorSideLeft.Control = ParamsPanel AnchorSideTop.Control = cbScaleVisible AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Panel1 + AnchorSideRight.Control = ParamsPanel AnchorSideRight.Side = asrBottom Left = 0 Height = 97 @@ -101,10 +100,10 @@ object Form1: TForm1 OnClick = rgScaleAlignClick end object rgLengthUnits: TRadioGroup - AnchorSideLeft.Control = Panel1 + AnchorSideLeft.Control = ParamsPanel AnchorSideTop.Control = rgScaleAlign AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Panel1 + AnchorSideRight.Control = ParamsPanel AnchorSideRight.Side = asrBottom Left = 0 Height = 51 @@ -135,10 +134,10 @@ object Form1: TForm1 OnClick = rgLengthUnitsClick end object gbZoomMin: TGroupBox - AnchorSideLeft.Control = Panel1 + AnchorSideLeft.Control = ParamsPanel AnchorSideTop.Control = rgLengthUnits AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Panel1 + AnchorSideRight.Control = ParamsPanel AnchorSideRight.Side = asrBottom Left = 0 Height = 105 @@ -149,7 +148,7 @@ object Form1: TForm1 ClientHeight = 85 ClientWidth = 308 TabOrder = 3 - object Label1: TLabel + object lblZoomMinInfo: TLabel AnchorSideLeft.Control = gbZoomMin AnchorSideTop.Control = seZoomMin AnchorSideTop.Side = asrBottom @@ -194,7 +193,7 @@ object Form1: TForm1 end end end - object MvPluginManager1: TMvPluginManager + object PluginManager: TMvPluginManager Left = 429 Top = 105 end diff --git a/components/lazmapviewer/examples/plugin_demos/scale_demo/main.pas b/components/lazmapviewer/examples/plugin_demos/scale_demo/main.pas index 63493bc06..7a6b6ca72 100644 --- a/components/lazmapviewer/examples/plugin_demos/scale_demo/main.pas +++ b/components/lazmapviewer/examples/plugin_demos/scale_demo/main.pas @@ -11,22 +11,22 @@ uses type - { TForm1 } + { TMainForm } - TForm1 = class(TForm) + TMainForm = class(TForm) cbScaleVisible: TCheckBox; gbZoomMin: TGroupBox; - Label1: TLabel; + lblZoomMinInfo: TLabel; lblCurrentZoom: TLabel; - MapView1: TMapView; - MvPluginManager1: TMvPluginManager; - Panel1: TPanel; + MapView: TMapView; + PluginManager: TMvPluginManager; + ParamsPanel: TPanel; rgLengthUnits: TRadioGroup; rgScaleAlign: TRadioGroup; seZoomMin: TSpinEdit; procedure cbScaleVisibleChange(Sender: TObject); procedure FormCreate(Sender: TObject); - procedure MapView1ZoomChange(Sender: TObject); + procedure MapViewZoomChange(Sender: TObject); procedure rgLengthUnitsClick(Sender: TObject); procedure rgScaleAlignClick(Sender: TObject); procedure seZoomMinChange(Sender: TObject); @@ -39,22 +39,23 @@ type end; var - Form1: TForm1; + MainForm: TMainForm; implementation {$R *.lfm} -{ TForm1 } +{ TMainForm } -procedure TForm1.FormCreate(Sender: TObject); +procedure TMainForm.FormCreate(Sender: TObject); var P: TMapProvider; zoomMin, zoomMax: Integer; begin - FScalePlugin := TMapScalePlugin.Create(MvPluginManager1); + MapView.Active := true; + FScalePlugin := TMapScalePlugin.Create(PluginManager); - P := MapView1.Engine.MapProviderByName(MapView1.MapProvider); + P := MapView.Engine.MapProviderByName(MapView.MapProvider); P.GetZoomInfos(zoomMin, zoomMax); seZoomMin.MaxValue := zoomMax; seZoomMin.MinValue := zoomMin; @@ -63,22 +64,22 @@ begin UpdateZoomInfo; end; -procedure TForm1.MapView1ZoomChange(Sender: TObject); +procedure TMainForm.MapViewZoomChange(Sender: TObject); begin UpdateZoomInfo; end; -procedure TForm1.cbScaleVisibleChange(Sender: TObject); +procedure TMainForm.cbScaleVisibleChange(Sender: TObject); begin FScalePlugin.Enabled := cbScaleVisible.Checked; end; -procedure TForm1.rgLengthUnitsClick(Sender: TObject); +procedure TMainForm.rgLengthUnitsClick(Sender: TObject); begin FScalePlugin.Imperial := rgLengthUnits.ItemIndex = 1; end; -procedure TForm1.rgScaleAlignClick(Sender: TObject); +procedure TMainForm.rgScaleAlignClick(Sender: TObject); var alignSet: TScaleAlignSet; begin @@ -97,14 +98,14 @@ begin FScalePlugin.AlignSet := alignSet; end; -procedure TForm1.seZoomMinChange(Sender: TObject); +procedure TMainForm.seZoomMinChange(Sender: TObject); begin FScalePlugin.ZoomMin := seZoomMin.Value; end; -procedure TForm1.UpdateZoomInfo; +procedure TMainForm.UpdateZoomInfo; begin - lblCurrentZoom.Caption := Format('Current zoom level %d', [MapView1.Zoom]); + lblCurrentZoom.Caption := Format('Current zoom level %d', [MapView.Zoom]); end; diff --git a/components/lazmapviewer/examples/plugin_demos/scale_demo/mapscale_demo.lpi b/components/lazmapviewer/examples/plugin_demos/scale_demo/mapscale_demo.lpi index da01d045e..d7f4effd9 100644 --- a/components/lazmapviewer/examples/plugin_demos/scale_demo/mapscale_demo.lpi +++ b/components/lazmapviewer/examples/plugin_demos/scale_demo/mapscale_demo.lpi @@ -39,7 +39,7 @@ - + diff --git a/components/lazmapviewer/examples/plugin_demos/scale_demo/mapscale_demo.lpr b/components/lazmapviewer/examples/plugin_demos/scale_demo/mapscale_demo.lpr index 0f5e2dcaf..e913b0b30 100644 --- a/components/lazmapviewer/examples/plugin_demos/scale_demo/mapscale_demo.lpr +++ b/components/lazmapviewer/examples/plugin_demos/scale_demo/mapscale_demo.lpr @@ -22,7 +22,7 @@ begin Application.MainFormOnTaskbar := True; {$POP} Application.Initialize; - Application.CreateForm(TForm1, Form1); + Application.CreateForm(TMainForm, MainForm); Application.Run; end. diff --git a/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/project1.lpi b/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/project1.lpi index 7974fd8bb..67a680b2f 100644 --- a/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/project1.lpi +++ b/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/project1.lpi @@ -12,7 +12,6 @@ - @@ -111,7 +110,7 @@ - + diff --git a/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/project1.lpr b/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/project1.lpr index ec793aa82..15c09ea87 100644 --- a/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/project1.lpr +++ b/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/project1.lpr @@ -19,7 +19,7 @@ begin RequireDerivedFormResource:=True; Application.Scaled:=True; Application.Initialize; - Application.CreateForm(TForm1, Form1); + Application.CreateForm(TMainForm, MainForm); Application.Run; end. diff --git a/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/unit1.lfm b/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/unit1.lfm index c199b4860..1045b50c2 100644 --- a/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/unit1.lfm +++ b/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/unit1.lfm @@ -1,14 +1,14 @@ -object Form1: TForm1 +object MainForm: TMainForm Left = 324 Height = 473 Top = 118 Width = 669 - Caption = 'Form1' + Caption = 'Spread Marker Demo' ClientHeight = 473 ClientWidth = 669 + LCLVersion = '4.99.0.0' OnCreate = FormCreate - LCLVersion = '3.4.0.0' - object MapView1: TMapView + object MapView: TMapView Left = 0 Height = 473 Top = 0 @@ -16,22 +16,22 @@ object Form1: TForm1 Active = True Align = alClient Cyclic = True - DownloadEngine = MapView1.BuiltInDLE - DrawingEngine = MapView1.BuiltInDE + DownloadEngine = MapView.BuiltInDLE + DrawingEngine = MapView.BuiltInDE Layers = <> Font.Color = clBlack MapProvider = 'OpenStreetMap Mapnik' - PluginManager = MvPluginManager1 + PluginManager = PluginManager end - object MvPluginManager1: TMvPluginManager + object PluginManager: TMvPluginManager Left = 408 Top = 104 - object MvPluginManager1DraggableMarkerPlugin1: TDraggableMarkerPlugin + object DraggableMarkerPlugin: TDraggableMarkerPlugin end - object MvPluginManager1UserDefinedPlugin1: TUserDefinedPlugin - OnMouseDown = MvPluginManager1UserDefinedPlugin1MouseDown + object UserDefinedPlugin: TUserDefinedPlugin + OnMouseDown = UserDefinedPluginMouseDown end - object MvPluginManager1SpreadMarkerPlugin1: TSpreadMarkerPlugin + object SpreadMarkerPlugin: TSpreadMarkerPlugin SpreadByPixel = 16 MarkerCatchSize = 6 MarkerSpreadDelayMS = 150 diff --git a/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/unit1.pas b/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/unit1.pas index ae44fbb48..f7fed8bef 100644 --- a/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/unit1.pas +++ b/components/lazmapviewer/examples/plugin_demos/spreadmarker_demo/unit1.pas @@ -11,21 +11,20 @@ uses type - { TForm1 } + { TMainForm } - TForm1 = class(TForm) - MapView1: TMapView; - MvPluginManager1: TMvPluginManager; - MvPluginManager1DraggableMarkerPlugin1: TDraggableMarkerPlugin; + TMainForm = class(TForm) + MapView: TMapView; + PluginManager: TMvPluginManager; + DraggableMarkerPlugin: TDraggableMarkerPlugin; MvPluginManager1DraggableMarkerPlugin2: TDraggableMarkerPlugin; MvPluginManager1LegalNoticePlugin1: TLegalNoticePlugin; MvPluginManager1LegalNoticePlugin2: TLegalNoticePlugin; - MvPluginManager1SpreadMarkerPlugin1: TSpreadMarkerPlugin; - MvPluginManager1UserDefinedPlugin1: TUserDefinedPlugin; + SpreadMarkerPlugin: TSpreadMarkerPlugin; + UserDefinedPlugin: TUserDefinedPlugin; procedure FormCreate(Sender: TObject); - procedure MvPluginManager1UserDefinedPlugin1MouseDown(Sender: TObject; - AMapView: TMapView; Button: TMouseButton; Shift: TShiftState; X, - Y: Integer; var Handled: Boolean); + procedure UserDefinedPluginMouseDown(Sender: TObject; AMapView: TMapView; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer; var Handled: Boolean); private public @@ -33,15 +32,16 @@ type end; var - Form1: TForm1; + MainForm: TMainForm; implementation {$R *.lfm} -{ TForm1 } +{ TMainForm } + +procedure TMainForm.FormCreate(Sender: TObject); -procedure TForm1.FormCreate(Sender: TObject); procedure AddTraditionalMarker(const ALon, ALat : Double; ACaption : String); var gpsPt: TGpsPointOfInterest; @@ -50,16 +50,18 @@ procedure TForm1.FormCreate(Sender: TObject); try gpsPt.Name := ACaption; gpsPt.ImageIndex := 0; - MapView1.GPSItems.Add(gpsPt, 100); + MapView.GPSItems.Add(gpsPt, 100); gpsPt := Nil; finally if Assigned(gpsPt) then gpsPt.Free; end; end; + var i : Integer; begin + MapView.Active := true; AddTraditionalMarker(0.0, 51.4825766,'Greenwich'); AddTraditionalMarker(2.2945500,48.8582300,'Tour d´Eiffel, Paris'); AddTraditionalMarker(-79.3884000,43.6439500,'CN Tower, Toronto'); @@ -74,13 +76,14 @@ begin AddTraditionalMarker(0.0,0.0,'Test '+IntToStr(i)); end; end; + { MvPluginManager1UserDefinedPlugin1MouseDown is used to delete some markers where the SpreadMarker-Plugin is in the SpreadMode. The deletion of the markers will be messaged to the SpreadMarker-plugin, so that the stored information of the spreaded markers are updated and no access violations on invalid memory occours. You can debug this in the deletion or EndUpdate Method. } -procedure TForm1.MvPluginManager1UserDefinedPlugin1MouseDown(Sender: TObject; +procedure TMainForm.UserDefinedPluginMouseDown(Sender: TObject; AMapView: TMapView; Button: TMouseButton; Shift: TShiftState; X, Y: Integer; var Handled: Boolean); var @@ -90,10 +93,10 @@ var i : Integer; begin if Button <> mbLeft then Exit; - if (not Handled) and MvPluginManager1SpreadMarkerPlugin1.SpreadModeActive[AMapView] then + if (not Handled) and SpreadMarkerPlugin.SpreadModeActive[AMapView] then begin Handled := True; // Reserve this event for us, prohibit the dragging of the map - lstcnt := MapView1.GPSItems.Count; + lstcnt := MapView.GPSItems.Count; delcnt := Random(5)+1; if delcnt > lstcnt then delcnt := lstcnt; @@ -101,21 +104,21 @@ begin if delcnt = 1 then begin ndx := Random(lstcnt); - MapView1.GPSItems.Delete(MapView1.GPSItems.Items[ndx]); + MapView.GPSItems.Delete(MapView.GPSItems.Items[ndx]); end else begin - MapView1.GPSItems.BeginUpdate; + MapView.GPSItems.BeginUpdate; try for i := 0 to delcnt-1 do begin if lstcnt <= 0 then Break; ndx := Random(lstcnt); - MapView1.GPSItems.Delete(MapView1.GPSItems.Items[ndx]); + MapView.GPSItems.Delete(MapView.GPSItems.Items[ndx]); Dec(lstcnt); end; finally - MapView1.GPSItems.EndUpdate; + MapView.GPSItems.EndUpdate; end; end; end; diff --git a/components/lazmapviewer/examples/plugin_demos/userdefined_demo/project1.lpi b/components/lazmapviewer/examples/plugin_demos/userdefined_demo/project1.lpi index 1146ddde0..a23703b38 100644 --- a/components/lazmapviewer/examples/plugin_demos/userdefined_demo/project1.lpi +++ b/components/lazmapviewer/examples/plugin_demos/userdefined_demo/project1.lpi @@ -12,7 +12,6 @@ - @@ -40,7 +39,7 @@ - + diff --git a/components/lazmapviewer/examples/plugin_demos/userdefined_demo/project1.lpr b/components/lazmapviewer/examples/plugin_demos/userdefined_demo/project1.lpr index 2e6b56c87..1942020a8 100644 --- a/components/lazmapviewer/examples/plugin_demos/userdefined_demo/project1.lpr +++ b/components/lazmapviewer/examples/plugin_demos/userdefined_demo/project1.lpr @@ -19,7 +19,7 @@ begin RequireDerivedFormResource:=True; Application.Scaled := True; Application.Initialize; - Application.CreateForm(TForm1, Form1); + Application.CreateForm(TMainForm, MainForm); Application.Run; end. diff --git a/components/lazmapviewer/examples/plugin_demos/userdefined_demo/unit1.lfm b/components/lazmapviewer/examples/plugin_demos/userdefined_demo/unit1.lfm index b7aa72f5f..8a64ded26 100644 --- a/components/lazmapviewer/examples/plugin_demos/userdefined_demo/unit1.lfm +++ b/components/lazmapviewer/examples/plugin_demos/userdefined_demo/unit1.lfm @@ -1,28 +1,27 @@ -object Form1: TForm1 +object MainForm: TMainForm Left = 324 Height = 307 Top = 119 Width = 451 - Caption = 'Form1' + Caption = 'User-defined Plugin Demo' ClientHeight = 307 ClientWidth = 451 LCLVersion = '4.99.0.0' OnCreate = FormCreate - object MapView1: TMapView + object MapView: TMapView Left = 0 Height = 257 Top = 0 Width = 451 - Active = True Align = alClient - DownloadEngine = MapView1.BuiltInDLE - DrawingEngine = MapView1.BuiltInDE + DownloadEngine = MapView.BuiltInDLE + DrawingEngine = MapView.BuiltInDE Layers = <> Font.Color = clBlack MapProvider = 'OpenStreetMap Mapnik' - PluginManager = MvPluginManager1 + PluginManager = PluginManager end - object Panel1: TPanel + object InfoPanel: TPanel Left = 0 Height = 50 Top = 257 @@ -31,25 +30,29 @@ object Form1: TForm1 ClientHeight = 50 ClientWidth = 451 TabOrder = 1 - object Label1: TLabel + object lblMessageLabel: TLabel + AnchorSideTop.Control = InfoPanel + AnchorSideTop.Side = asrCenter Left = 16 Height = 15 - Top = 16 + Top = 18 Width = 146 Caption = 'UserdefinedPlugin Message' end object lblUserdefinedPluginMessage: TLabel - AnchorSideLeft.Control = Label1 + AnchorSideLeft.Control = lblMessageLabel AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = InfoPanel + AnchorSideTop.Side = asrCenter Left = 170 Height = 15 - Top = 16 + Top = 18 Width = 38 BorderSpacing.Left = 8 Caption = ' (none)' end end - object MvPluginManager1: TMvPluginManager + object PluginManager: TMvPluginManager Left = 262 Top = 31 end diff --git a/components/lazmapviewer/examples/plugin_demos/userdefined_demo/unit1.pas b/components/lazmapviewer/examples/plugin_demos/userdefined_demo/unit1.pas index ff9195ac0..b4c3e3d18 100644 --- a/components/lazmapviewer/examples/plugin_demos/userdefined_demo/unit1.pas +++ b/components/lazmapviewer/examples/plugin_demos/userdefined_demo/unit1.pas @@ -10,14 +10,14 @@ uses type - { TForm1 } + { TMainForm } - TForm1 = class(TForm) - Label1: TLabel; + TMainForm = class(TForm) + lblMessageLabel: TLabel; lblUserdefinedPluginMessage: TLabel; - MapView1: TMapView; - MvPluginManager1: TMvPluginManager; - Panel1: TPanel; + MapView: TMapView; + PluginManager: TMvPluginManager; + InfoPanel: TPanel; procedure FormCreate(Sender: TObject); private procedure UserdefinedPluginMouseUp(Sender: TObject; AMapView: TMapView; Button: TMouseButton; @@ -29,31 +29,33 @@ type end; var - Form1: TForm1; + MainForm: TMainForm; implementation {$R *.lfm} -{ TForm1 } +{ TMainForm } -procedure TForm1.FormCreate(Sender: TObject); +procedure TMainForm.FormCreate(Sender: TObject); var udp : TUserDefinedPlugin; begin - udp := TUserdefinedPlugin.Create(MvPluginManager1); + MapView.Active := true; + + udp := TUserdefinedPlugin.Create(PluginManager); udp.OnMouseUp := @UserdefinedPluginMouseUp; udp.OnMouseDown := @UserdefinedPluginMouseDown; end; -procedure TForm1.UserdefinedPluginMouseUp(Sender: TObject; AMapView: TMapView; +procedure TMainForm.UserdefinedPluginMouseUp(Sender: TObject; AMapView: TMapView; Button: TMouseButton; Shift: TShiftState; X, Y: Integer; var Handled: Boolean ); begin lblUserdefinedPluginMessage.Caption := Format('MouseUp X:%d Y:%d',[X,Y]); end; -procedure TForm1.UserdefinedPluginMouseDown(Sender: TObject; AMapView: TMapView; +procedure TMainForm.UserdefinedPluginMouseDown(Sender: TObject; AMapView: TMapView; Button: TMouseButton; Shift: TShiftState; X, Y: Integer; var Handled: Boolean ); begin diff --git a/components/lazmapviewer/source/mvmapviewer.pas b/components/lazmapviewer/source/mvmapviewer.pas index 1cc764d25..b3d6154e0 100644 --- a/components/lazmapviewer/source/mvmapviewer.pas +++ b/components/lazmapviewer/source/mvmapviewer.pas @@ -444,29 +444,21 @@ type AShift: TShiftState; X, Y: Integer; AMapEvent: TMouseEvent); procedure DefaultNotifyEventHandler(AMapView: TMapView; AMapEvent: TNotifyEvent); - procedure AfterDrawObjects(AMapView: TMapView; AMapEvent: TNotifyEvent; - out Handled : Boolean); virtual; - procedure AfterPaint(AMapView: TMapView; AMapEvent: TNotifyEvent; - out Handled : Boolean); virtual; - procedure BeforeDrawObjects(AMapView: TMapView; AMapEvent: TNotifyEvent; - out Handled : Boolean); virtual; - procedure CenterMove(AMapView: TMapView; AMapEvent: TNotifyEvent); virtual; - procedure MouseDown(AMapView: TMapView; AButton: TMouseButton; - AShift: TShiftState; X, Y: Integer; AMapEvent: TMouseEvent; - out Handled : Boolean); virtual; - procedure MouseEnter(AMapView: TMapView; AMapEvent: TNotifyEvent; - out Handled : Boolean); virtual; - procedure MouseLeave(AMapView: TMapView; AMapEvent: TNotifyEvent; - out Handled : Boolean); virtual; - procedure MouseMove(AMapView: TMapView; AShift: TShiftState; X,Y: Integer; - AMapEvent: TMouseMoveEvent; out Handled : Boolean); virtual; - procedure MouseUp(AMapView: TMapView; AButton: TMouseButton; - AShift: TShiftState; X, Y: Integer; AMapEvent: TMouseEvent; - out Handled : Boolean); virtual; - procedure ZoomChange(AMapView: TMapView; AMapEvent: TNotifyEvent); virtual; - procedure GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList; - ActualObjs: TGPSObjList; Adding: Boolean; - out Handled : Boolean);virtual; + function AfterDrawObjects(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; virtual; + function AfterPaint(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; virtual; + function BeforeDrawObjects(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; virtual; + function CenterMove(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; virtual; + function MouseDown(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState; + X, Y: Integer; AMapEvent: TMouseEvent): Boolean; virtual; + function MouseEnter(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; virtual; + function MouseLeave(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; virtual; + function MouseMove(AMapView: TMapView; AShift: TShiftState; X,Y: Integer; + AMapEvent: TMouseMoveEvent): Boolean; virtual; + function MouseUp(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState; + X, Y: Integer; AMapEvent: TMouseEvent): Boolean; virtual; + function ZoomChange(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; virtual; + function GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList; + ActualObjs: TGPSObjList; Adding: Boolean): Boolean; virtual; public end; @@ -2555,7 +2547,7 @@ begin finally OnMouseDown := savedOnMouseDown; end; - GetPluginManager.MouseDown(Self, Button, Shift, X, Y, OnMouseDown, lHandled); + lHandled := GetPluginManager.MouseDown(Self, Button, Shift, X, Y, OnMouseDown); if EditingEnabled then begin @@ -2584,7 +2576,6 @@ procedure TMapView.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var savedOnMouseUp: TMouseEvent; - lHandled : Boolean; begin savedOnMouseUp := OnMouseUp; try @@ -2593,7 +2584,7 @@ begin finally OnMouseUp := savedOnMouseUp; end; - GetPluginManager.MouseUp(Self, Button, Shift, X, Y, OnMouseUp, lHandled); + GetPluginManager.MouseUp(Self, Button, Shift, X, Y, OnMouseUp); if IsActive then if Button = mbLeft then @@ -2650,7 +2641,7 @@ begin finally OnMouseMove := savedOnMouseMove; end; - GetPluginManager.MouseMove(Self, Shift, X, Y, OnMouseMove, lHandled); + lHandled := GetPluginManager.MouseMove(Self, Shift, X, Y, OnMouseMove); if IsActive then begin Engine.MouseMove(self,Shift,X,Y); @@ -2664,17 +2655,13 @@ begin end; procedure TMapView.MouseEnter; -var - lHandled : Boolean; begin - GetPluginManager.MouseEnter(Self, OnMouseEnter,lHandled); + GetPluginManager.MouseEnter(Self, OnMouseEnter); end; procedure TMapView.MouseLeave; -var - lHandled : Boolean; begin - GetPluginManager.MouseLeave(Self, OnMouseLeave,lHandled); + GetPluginManager.MouseLeave(Self, OnMouseLeave); end; procedure TMapView.Notification(AComponent: TComponent; Operation: TOperation); @@ -2717,9 +2704,6 @@ begin end; procedure TMapView.Paint; -var - lHandled : Boolean; - const FREE_DRAG = 0; //(TILE_SIZE * TILE_SIZE) div 4; @@ -2750,15 +2734,15 @@ const if Cyclic then W := Min(1 shl Zoom * TileSize.CX, W); - GetPluginManager.BeforeDrawObjects(Self, FBeforeDrawObjectsEvent,lHandled); + GetPluginManager.BeforeDrawObjects(Self, FBeforeDrawObjectsEvent); DrawObjects(Default(TTileId), 0, 0, W - 1, ClientHeight); - GetPluginManager.AfterDrawObjects(Self, FAfterDrawObjectsEvent,lHandled); + GetPluginManager.AfterDrawObjects(Self, FAfterDrawObjectsEvent); DrawingEngine.PaintToCanvas(Canvas); if DebugTiles then DrawCenter; - GetPluginManager.AfterPaint(Self, FAfterPaintEvent,lHandled); + GetPluginManager.AfterPaint(Self, FAfterPaintEvent); end; procedure DragDraw; @@ -2794,9 +2778,8 @@ procedure TMapView.OnGPSItemsModified(Sender: TObject; objs: TGPSObjList; Adding: boolean); var {%H-}Area, objArea, visArea: TRealArea; - lHandled : Boolean; begin - GetPluginManager.GPSItemsModified(Self,TGPSObjectList(Sender),objs,Adding,lHandled); + GetPluginManager.GPSItemsModified(Self, TGPSObjectList(Sender), objs, Adding); if Adding and Assigned(Objs) then begin objArea := GetAreaOf(Objs); @@ -4378,30 +4361,33 @@ end; { Just executes the handler assigned to the OnAfterDrawObjects event of the mapview. The descendant plugin manager will have to iterate over all plugins - used by it. } -procedure TMvCustomPluginManager.AfterDrawObjects(AMapView: TMapView; - AMapEvent: TNotifyEvent; out Handled: Boolean); + used by it. It will have to set the function result to true of onlf the + plugin has "handled" the event. } +function TMvCustomPluginManager.AfterDrawObjects(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; begin - Handled := False; + Result := False; DefaultNotifyEventHandler(AMapView, AMapEvent); end; -procedure TMvCustomPluginManager.AfterPaint(AMapView: TMapView; - AMapEvent: TNotifyEvent; out Handled: Boolean); +function TMvCustomPluginManager.AfterPaint(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; begin + Result := False; DefaultNotifyEventHandler(AMapView, AMapEvent); end; -procedure TMvCustomPluginManager.BeforeDrawObjects(AMapView: TMapView; - AMapEvent: TNotifyEvent; out Handled: Boolean); +function TMvCustomPluginManager.BeforeDrawObjects(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; begin - Handled := False; + Result := False; DefaultNotifyEventHandler(AMapView, AMapEvent); end; -procedure TMvCustomPluginManager.CenterMove(AMapView: TMapView; - AMapEvent: TNotifyEvent); +function TMvCustomPluginManager.CenterMove(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; begin + Result := False; DefaultNotifyEventHandler(AMapView, AMapEvent); end; @@ -4419,42 +4405,47 @@ begin AMapEvent(AMapView); end; -procedure TMvCustomPluginManager.MouseDown(AMapView: TMapView; - AButton: TMouseButton; AShift: TShiftState; X, Y: Integer; - AMapEvent: TMouseEvent; out Handled: Boolean); +function TMvCustomPluginManager.GPSItemsModified(AMapView: TMapView; + ModifiedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean): Boolean; begin - Handled := False; + Result := false; +end; + +function TMvCustomPluginManager.MouseDown(AMapView: TMapView; + AButton: TMouseButton; AShift: TShiftState; X, Y: Integer; + AMapEvent: TMouseEvent): Boolean; +begin + Result := False; DefaultMouseEvent(AMapView, AButton, AShift, X, Y, AMapEvent); end; -procedure TMvCustomPluginManager.MouseEnter(AMapView: TMapView; - AMapEvent: TNotifyEvent; out Handled: Boolean); +function TMvCustomPluginManager.MouseEnter(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; begin - Handled := False; + Result := False; DefaultNotifyEventHandler(AMapView, AMapEvent); end; -procedure TMvCustomPluginManager.MouseLeave(AMapView: TMapView; - AMapEvent: TNotifyEvent; out Handled: Boolean); +function TMvCustomPluginManager.MouseLeave(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; begin - Handled := False; + Result := False; DefaultNotifyEventHandler(AMapView, AMapEvent); end; -procedure TMvCustomPluginManager.MouseMove(AMapView: TMapView; - AShift: TShiftState; X, Y: Integer; AMapEvent: TMouseMoveEvent; out - Handled: Boolean); +function TMvCustomPluginManager.MouseMove(AMapView: TMapView; + AShift: TShiftState; X, Y: Integer; AMapEvent: TMouseMoveEvent): Boolean; begin - Handled := False; + Result := False; if Assigned(AMapEvent) then AMapEvent(AMapView, AShift, X, Y); end; -procedure TMvCustomPluginManager.MouseUp(AMapView: TMapView; +function TMvCustomPluginManager.MouseUp(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState; X, Y: Integer; - AMapEvent: TMouseEvent; out Handled: Boolean); + AMapEvent: TMouseEvent): Boolean; begin - Handled := False; + Result := False; DefaultMouseEvent(AMapView, AButton, AShift, X, Y, AMapEvent); end; @@ -4463,17 +4454,11 @@ begin // end; -procedure TMvCustomPluginManager.ZoomChange(AMapView: TMapView; AMapEvent: TNotifyEvent); +function TMvCustomPluginManager.ZoomChange(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; begin + Result := false; DefaultNotifyEventHandler(AMapView, AMapEvent); end; -procedure TMvCustomPluginManager.GPSItemsModified(AMapView: TMapView; - ModifiedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean; out - Handled: Boolean); -begin - // -end; - end. diff --git a/components/lazmapviewer/source/mvplugincore.pas b/components/lazmapviewer/source/mvplugincore.pas index e5a206eb7..c002b21e9 100644 --- a/components/lazmapviewer/source/mvplugincore.pas +++ b/components/lazmapviewer/source/mvplugincore.pas @@ -60,8 +60,6 @@ type procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure ZoomChange(AMapView: TMapView; var Handled: Boolean); virtual; // procedure ZoomChanging(AMapView: TMapView; NewZoom: Integer; var Allow, Handled: Boolean); virtual; - { GPSItemsModified is called if one of the GPSList of the MapView changed their content. - ActualObjs contains the affected objs, but may nil } procedure Update; virtual; protected property MapView: TMapView read FMapView write SetMapView; @@ -151,30 +149,22 @@ type procedure SetName(const AValue: TComponentName); override; protected // Dispatching events to be handled by the plugins - procedure AfterDrawObjects(AMapView: TMapView; AMapEvent: TNotifyEvent; - out Handled : Boolean); override; - procedure AfterPaint(AMapView: TMapView; AMapEvent: TNotifyEvent; - out Handled : Boolean); override; - procedure BeforeDrawObjects(AMapView: TMapView; AMapEvent: TNotifyEvent; - out Handled : Boolean); override; - procedure CenterMove(AMapView: TMapView; AMapEvent: TNotifyEvent); override; - procedure MouseDown(AMapView: TMapView; AButton: TMouseButton; - AShift: TShiftState; X, Y: Integer; AMapEvent: TMouseEvent; - out Handled : Boolean); override; - procedure MouseEnter(AMapView: TMapView; AMapEvent: TNotifyEvent; - out Handled : Boolean); override; - procedure MouseLeave(AMapView: TMapView; AMapEvent: TNotifyEvent; - out Handled : Boolean); override; - procedure MouseMove(AMapView: TMapView; AShift: TShiftState; X,Y: Integer; - AMapEvent: TMouseMoveEvent; out Handled : Boolean); override; - procedure MouseUp(AMapView: TMapView; AButton: TMouseButton; - AShift: TShiftState; X, Y: Integer; AMapEvent: TMouseEvent; - out Handled : Boolean); override; - procedure ZoomChange(AMapView: TMapView; AMapEvent: TNotifyEvent); override; + function AfterDrawObjects(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; override; + function AfterPaint(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; override; + function BeforeDrawObjects(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; override; + function CenterMove(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; override; + function GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList; + ActualObjs: TGPSObjList; Adding: Boolean): Boolean; override; + function MouseDown(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState; + X, Y: Integer; AMapEvent: TMouseEvent): Boolean; override; + function MouseEnter(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; override; + function MouseLeave(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; override; + function MouseMove(AMapView: TMapView; AShift: TShiftState; X,Y: Integer; + AMapEvent: TMouseMoveEvent): Boolean; override; + function MouseUp(AMapView: TMapView; AButton: TMouseButton; AShift: TShiftState; + X, Y: Integer; AMapEvent: TMouseEvent): Boolean; override; + function ZoomChange(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; override; // procedure ZoomChanging(AMapView: TMapView; NewZoom: Integer; var Allow: Boolean; AMapEvent); override; - procedure GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList; - ActualObjs: TGPSObjList; Adding: Boolean; - out Handled : Boolean);override; public constructor Create(AOwner: TComponent); override; @@ -281,6 +271,8 @@ begin Result := FPluginManager; end; +{ GPSItemsModified is called if one of the GPSList of the MapView changed their content. + ActualObjs contains the affected objs, but may nil } procedure TMvCustomPlugin.GPSItemsModified(AMapView: TMapView; ModifiedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean; var Handled: Boolean); @@ -573,72 +565,68 @@ begin FMapList.Add(AMapView); end; -procedure TMvPluginManager.AfterDrawObjects(AMapView: TMapView; - AMapEvent: TNotifyEvent; out Handled: Boolean); +function TMvPluginManager.AfterDrawObjects(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; var i: Integer; plugin: TMvCustomPlugin; - lHandled : Boolean; begin - Handled := False; + Result := False; for i := 0 to FPluginList.Count-1 do begin plugin := Item[i]; if HandlePlugin(plugin, AMapView) then - plugin.AfterDrawObjects(AMapView, Handled); + plugin.AfterDrawObjects(AMapView, Result); end; - inherited AfterDrawObjects(AMapView, AMapEvent, lHandled); + inherited AfterDrawObjects(AMapView, AMapEvent); end; -procedure TMvPluginManager.AfterPaint(AMapView: TMapView; - AMapEvent: TNotifyEvent; out Handled: Boolean); +function TMvPluginManager.AfterPaint(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; var i: Integer; plugin: TMvCustomPlugin; - lHandled : Boolean; begin - Handled := False; + Result := False; for i := 0 to FPluginList.Count-1 do begin plugin := Item[i]; if HandlePlugin(plugin, AMapView) then - plugin.AfterPaint(AMapView, Handled); + plugin.AfterPaint(AMapView, Result); end; - inherited AfterPaint(AMapView, AMapEvent, lHandled); + inherited AfterPaint(AMapView, AMapEvent); end; -procedure TMvPluginManager.BeforeDrawObjects(AMapView: TMapView; - AMapEvent: TNotifyEvent; out Handled: Boolean); +function TMvPluginManager.BeforeDrawObjects(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; var i: Integer; plugin: TMvCustomPlugin; - lHandled : Boolean; begin - handled := false; + Result := false; for i := 0 to FPluginList.Count-1 do begin plugin := Item[i]; if HandlePlugin(plugin, AMapView) then - plugin.BeforeDrawObjects(AMapView, Handled); + plugin.BeforeDrawObjects(AMapView, Result); end; - inherited BeforeDrawObjects(AMapView, AMapEvent, lHandled); + inherited BeforeDrawObjects(AMapView, AMapEvent); end; -procedure TMvPluginManager.CenterMove(AMapView: TMapView; AMapEvent: TNotifyEvent); +function TMvPluginManager.CenterMove(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; var i: Integer; - handled: Boolean; plugin: TMvCustomPlugin; begin - handled := false; + Result := false; for i := 0 to FPluginList.Count-1 do begin plugin := Item[i]; if HandlePlugin(plugin, AMapView) then - plugin.CenterMove(AMapView, handled); + plugin.CenterMove(AMapView, Result); end; - if not handled then - inherited CenterMove(AMapView, AMapEvent); + inherited CenterMove(AMapView, AMapEvent); end; procedure TMvPluginManager.GetChildren(Proc: TGetChildProc; Root: TComponent); @@ -659,6 +647,22 @@ begin Result := TMvCustomPlugin(FPluginList.Items[AIndex]); end; +function TMvPluginManager.GPSItemsModified(AMapView: TMapView; + ModifiedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean): Boolean; +var + i: Integer; + plugin: TMvCustomPlugin; +begin + Result := false; + for i := 0 to FPluginList.Count-1 do + begin + plugin := Item[i]; + if HandlePlugin(plugin, AMapView) then + plugin.GPSItemsModified(AMapView, ModifiedList, ActualObjs, Adding, Result); + end; + inherited GPSItemsModified(AMapView, ModifiedList, ActualObjs, Adding); +end; + function TMvPluginManager.HandlePlugin(APlugin: TMvCustomPlugin; AMapView: TMapView): Boolean; begin Result := APlugin.Enabled and ((APlugin.MapView = AMapView) or (APlugin.MapView = nil)); @@ -672,91 +676,84 @@ begin TMapView(FMapList[i]).Invalidate; end; -procedure TMvPluginManager.MouseDown(AMapView: TMapView; AButton: TMouseButton; - AShift: TShiftState; X, Y: Integer; AMapEvent: TMouseEvent; out - Handled: Boolean); +function TMvPluginManager.MouseDown(AMapView: TMapView; AButton: TMouseButton; + AShift: TShiftState; X, Y: Integer; AMapEvent: TMouseEvent): Boolean; var i: Integer; plugin: TMvCustomPlugin; - lHandled : Boolean; begin - Handled := false; + Result := false; for i := 0 to FPluginList.Count-1 do begin plugin := Item[i]; if HandlePlugin(plugin, AMapView) then - plugin.MouseDown(AMapView, AButton, AShift, X, Y, Handled); + plugin.MouseDown(AMapView, AButton, AShift, X, Y, Result); end; - inherited MouseDown(AMapView, AButton, AShift, X, Y, AMapEvent, lHandled); + inherited MouseDown(AMapView, AButton, AShift, X, Y, AMapEvent); end; -procedure TMvPluginManager.MouseEnter(AMapView: TMapView; - AMapEvent: TNotifyEvent; out Handled: Boolean); +function TMvPluginManager.MouseEnter(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; var i: Integer; plugin: TMvCustomPlugin; - lHandled : Boolean; begin - Handled := false; + Result := false; for i := 0 to FPluginList.Count-1 do begin plugin := Item[i]; if HandlePlugin(plugin, AMapView) then - plugin.MouseEnter(AMapView, handled); + plugin.MouseEnter(AMapView, Result); end; - inherited MouseEnter(AMapView, AMapEvent, lHandled); + inherited MouseEnter(AMapView, AMapEvent); end; -procedure TMvPluginManager.MouseLeave(AMapView: TMapView; - AMapEvent: TNotifyEvent; out Handled: Boolean); +function TMvPluginManager.MouseLeave(AMapView: TMapView; + AMapEvent: TNotifyEvent): Boolean; var i: Integer; plugin: TMvCustomPlugin; - lHandled : Boolean; begin - handled := false; + Result := false; for i := 0 to FPluginList.Count-1 do begin plugin := Item[i]; if HandlePlugin(plugin, AMapView) then - plugin.MouseLeave(AMapView, Handled); + plugin.MouseLeave(AMapView, Result); end; - inherited MouseLeave(AMapView, AMapEvent, lHandled); + inherited MouseLeave(AMapView, AMapEvent); end; -procedure TMvPluginManager.MouseMove(AMapView: TMapView; AShift: TShiftState; - X, Y: Integer; AMapEvent: TMouseMoveEvent; out Handled: Boolean); +function TMvPluginManager.MouseMove(AMapView: TMapView; AShift: TShiftState; + X, Y: Integer; AMapEvent: TMouseMoveEvent): Boolean; var i: Integer; plugin: TMvCustomPlugin; - lHandled : Boolean; begin - Handled := false; + Result := false; for i := 0 to FPluginList.Count-1 do begin plugin := Item[i]; if HandlePlugin(plugin, AMapView) then - plugin.MouseMove(AMapView, AShift, X, Y, Handled); + plugin.MouseMove(AMapView, AShift, X, Y, Result); end; - inherited MouseMove(AMapView, AShift, X, Y, AMapEvent, lHandled); + inherited MouseMove(AMapView, AShift, X, Y, AMapEvent); end; -procedure TMvPluginManager.MouseUp(AMapView: TMapView; AButton: TMouseButton; - AShift: TShiftState; X, Y: Integer; AMapEvent: TMouseEvent; out - Handled: Boolean); +function TMvPluginManager.MouseUp(AMapView: TMapView; AButton: TMouseButton; + AShift: TShiftState; X, Y: Integer; AMapEvent: TMouseEvent): Boolean; var i: Integer; plugin: TMvCustomPlugin; - lHandled : Boolean; begin - Handled := false; + Result := false; for i := 0 to FPluginList.Count-1 do begin plugin := Item[i]; if HandlePlugin(plugin, AMapView) then - plugin.MouseUp(AMapView, AButton, AShift, X, Y, Handled); + plugin.MouseUp(AMapView, AButton, AShift, X, Y, Result); end; - inherited MouseUp(AMapView, AButton, AShift, X, Y, AMapEvent, lHandled); + inherited MouseUp(AMapView, AButton, AShift, X, Y, AMapEvent); end; procedure TMvPluginManager.Notification(AComponent: TComponent; Operation: TOperation); @@ -795,40 +792,21 @@ begin PluginList.ChangeNamePrefix(oldName, AValue); end; -procedure TMvPluginManager.ZoomChange(AMapView: TMapView; AMapEvent: TNotifyEvent); +function TMvPluginManager.ZoomChange(AMapView: TMapView; AMapEvent: TNotifyEvent): Boolean; var i: Integer; - handled: Boolean; plugin: TMvCustomPlugin; begin - handled := false; + Result := false; for i := 0 to FPluginList.Count-1 do begin plugin := Item[i]; if HandlePlugin(plugin, AMapView) then - plugin.ZoomChange(AMapView, handled); + plugin.ZoomChange(AMapView, Result); end; inherited ZoomChange(AMapView, AMapEvent); end; -procedure TMvPluginManager.GPSItemsModified(AMapView: TMapView; - ModifiedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean; - out Handled: Boolean); -var - i: Integer; - lHandled: Boolean; - plugin: TMvCustomPlugin; -begin - lHandled := false; - for i := 0 to FPluginList.Count-1 do - begin - plugin := Item[i]; - if HandlePlugin(plugin, AMapView) then - plugin.GPSItemsModified(AMapView,ModifiedList,ActualObjs,Adding, Handled{%H-}); - end; - inherited GPSItemsModified(AMapView,ModifiedList,ActualObjs,Adding, lHandled); -end; - (* procedure TMvPluginManager.ZoomChanging(AMapView: TMapView; NewZoom: Integer; var Allow: Boolean; AMapEvent: TNotifyEvent);