LazMapViewer: Add "reorderplugins" demo. Less hints/warnings in spreadmarker plugin code.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9532 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
acbe80d14b
commit
ce41a9f02c
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="project1"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<RequiredPackages>
|
||||
<Item>
|
||||
<PackageName Value="lazMapViewerPkg"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item>
|
||||
</RequiredPackages>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
@ -0,0 +1,28 @@
|
||||
program project1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}
|
||||
cthreads,
|
||||
{$ENDIF}
|
||||
{$IFDEF HASAMIGA}
|
||||
athreads,
|
||||
{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, Unit1
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource := True;
|
||||
Application.Scaled := True;
|
||||
{$PUSH}{$WARN 5044 OFF}
|
||||
Application.MainFormOnTaskbar := True;
|
||||
{$POP}
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
@ -0,0 +1,97 @@
|
||||
object Form1: TForm1
|
||||
Left = 314
|
||||
Height = 372
|
||||
Top = 130
|
||||
Width = 706
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 372
|
||||
ClientWidth = 706
|
||||
LCLVersion = '4.99.0.0'
|
||||
OnCreate = FormCreate
|
||||
object MapView1: TMapView
|
||||
Left = 224
|
||||
Height = 372
|
||||
Top = 0
|
||||
Width = 482
|
||||
Active = True
|
||||
Align = alClient
|
||||
DownloadEngine = MapView1.BuiltInDLE
|
||||
DrawingEngine = MapView1.BuiltInDE
|
||||
Layers = <>
|
||||
Font.Color = clBlack
|
||||
MapProvider = 'OpenStreetMap Mapnik'
|
||||
PluginManager = MvPluginManager1
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 372
|
||||
Top = 0
|
||||
Width = 224
|
||||
Align = alLeft
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 372
|
||||
ClientWidth = 224
|
||||
TabOrder = 1
|
||||
object Label1: TLabel
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 12
|
||||
Width = 124
|
||||
Caption = 'Select top-most plugin:'
|
||||
end
|
||||
object ComboBox1: TComboBox
|
||||
Left = 16
|
||||
Height = 23
|
||||
Top = 32
|
||||
Width = 192
|
||||
ItemHeight = 15
|
||||
Style = csDropDownList
|
||||
TabOrder = 0
|
||||
OnChange = ComboBox1Change
|
||||
end
|
||||
object ValueListEditor1: TValueListEditor
|
||||
Left = 16
|
||||
Height = 255
|
||||
Top = 72
|
||||
Width = 192
|
||||
FixedCols = 0
|
||||
RowCount = 2
|
||||
TabOrder = 1
|
||||
DisplayOptions = [doColumnTitles, doAutoColResize]
|
||||
TitleCaptions.Strings = (
|
||||
'Index'
|
||||
'Plugin'
|
||||
)
|
||||
ColWidths = (
|
||||
94
|
||||
94
|
||||
)
|
||||
end
|
||||
end
|
||||
object MvPluginManager1: TMvPluginManager
|
||||
Left = 312
|
||||
Top = 120
|
||||
object MvPluginManager1LegalNoticePlugin1: TLegalNoticePlugin
|
||||
BackgroundColor = clWhite
|
||||
Font.Height = -19
|
||||
LegalNotice = 'Test 1'
|
||||
Opacity = 1
|
||||
end
|
||||
object MvPluginManager1LegalNoticePlugin2: TLegalNoticePlugin
|
||||
BackgroundColor = clYellow
|
||||
Font.Color = clRed
|
||||
Font.Height = -19
|
||||
LegalNotice = 'Test 2'
|
||||
Opacity = 1
|
||||
Spacing = 14
|
||||
end
|
||||
object MvPluginManager1LegalNoticePlugin3: TLegalNoticePlugin
|
||||
BackgroundColor = clBlue
|
||||
Font.Color = clWhite
|
||||
Font.Height = -19
|
||||
LegalNotice = 'Test 3'
|
||||
Opacity = 1
|
||||
Spacing = 24
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,94 @@
|
||||
unit Unit1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, ExtCtrls, mvMapViewer, mvPluginCore, mvPlugins, StdCtrls, SysUtils,
|
||||
Forms, Controls, Graphics, Dialogs, ValEdit;
|
||||
|
||||
type
|
||||
TForm1 = class(TForm)
|
||||
ComboBox1: TComboBox;
|
||||
Label1: TLabel;
|
||||
MapView1: TMapView;
|
||||
MvPluginManager1: TMvPluginManager;
|
||||
MvPluginManager1LegalNoticePlugin1: TLegalNoticePlugin;
|
||||
MvPluginManager1LegalNoticePlugin2: TLegalNoticePlugin;
|
||||
MvPluginManager1LegalNoticePlugin3: TLegalNoticePlugin;
|
||||
Panel1: TPanel;
|
||||
ValueListEditor1: TValueListEditor;
|
||||
procedure ComboBox1Change(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
procedure UpdatePluginList;
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
procedure TForm1.ComboBox1Change(Sender: TObject);
|
||||
var
|
||||
i, idx, n: Integer;
|
||||
begin
|
||||
if Combobox1.ItemIndex = -1 then
|
||||
exit;
|
||||
|
||||
n := MvPluginManager1.PlugInList.Count;
|
||||
idx := -1;
|
||||
for i := 0 to n-1 do
|
||||
if (MvPluginManager1.PluginList[i] is TLegalNoticePlugin) and
|
||||
(TLegalNoticePlugin(MvPluginManager1.PluginList[i]).LegalNotice = Combobox1.Items[Combobox1.ItemIndex]) then
|
||||
begin
|
||||
idx := i;
|
||||
break;
|
||||
end;
|
||||
|
||||
if idx = -1 then
|
||||
exit;
|
||||
|
||||
MvPluginManager1.PluginList.Move(idx, n-1);
|
||||
// or:
|
||||
// MvPluginManager1.PluginList[i].Index := n-1;
|
||||
UpdatePluginList;
|
||||
|
||||
MapView1.Invalidate;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Combobox1.Items.Clear;
|
||||
for i := 0 to MvPluginManager1.PluginList.Count-1 do
|
||||
Combobox1.Items.Add(TLegalNoticePlugin(MvPluginManager1.PluginList[i]).LegalNotice);
|
||||
Combobox1.ItemIndex := Combobox1.Items.Count-1;
|
||||
|
||||
UpdatePluginList;
|
||||
end;
|
||||
|
||||
procedure TForm1.UpdatePluginList;
|
||||
var
|
||||
i, n: Integer;
|
||||
txt: String;
|
||||
begin
|
||||
ValueListeditor1.Clear;
|
||||
n := MvPluginManager1.PluginList.Count;
|
||||
for i := n-1 downto 0 do
|
||||
begin
|
||||
txt := IntToStr(i);
|
||||
if i = 0 then txt := txt + ' (bottom)' else if i = n-1 then txt := txt + ' (top)';
|
||||
ValueListEditor1.InsertRow(txt, TLegalNoticePlugin(MvPluginManager1.PluginList[i]).LegalNotice, true);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -121,9 +121,9 @@ type
|
||||
FOptions : TSpreadMarkerOptions;
|
||||
function GetSpreadModeActive(AMapView : TMapView) : Boolean;
|
||||
function GetSpreadMarkerCount(AMapView : TMapView) : Integer;
|
||||
function GetSpreadMarkerOfsCenterX(AMapView : TMapView; AIndex : Integer): Integer;
|
||||
function GetSpreadMarkerOfsCenterY(AMapView : TMapView; AIndex : Integer): Integer;
|
||||
function GetSpreadMarkerOrgPositions(AMapView : TMapView; AIndex : Integer): TRealPoint;
|
||||
function GetSpreadMarkerOfsCenterX(AMapView : TMapView; {%H-}AIndex : Integer): Integer;
|
||||
function GetSpreadMarkerOfsCenterY(AMapView : TMapView; {%H-}AIndex : Integer): Integer;
|
||||
function GetSpreadMarkerOrgPositions(AMapView : TMapView; {%H-}AIndex : Integer): TRealPoint;
|
||||
function GetSpreadMarkers(AMapView : TMapView; AIndex : Integer) : TGPSPoint;
|
||||
procedure SetMarkerSpreadDelayMS(Value : Integer);
|
||||
procedure SetMarkerCollapseDelayMS(Value : Integer);
|
||||
@ -141,16 +141,16 @@ type
|
||||
protected
|
||||
// procedure MouseDown(AMapView: TMapView; Button: TMouseButton; Shift: TShiftState;
|
||||
// X, Y: Integer; var Handled: Boolean); override;
|
||||
procedure MouseMove(AMapView: TMapView; AShift: TShiftState; X,Y: Integer;
|
||||
var Handled: Boolean); override;
|
||||
procedure MouseMove(AMapView: TMapView; {%H-}AShift: TShiftState; X,Y: Integer;
|
||||
var {%H-}Handled: Boolean); override;
|
||||
// procedure MouseUp(AMapView: TMapView; Button: TMouseButton; Shift: TShiftState;
|
||||
// X, Y: Integer; var Handled: Boolean); override;
|
||||
procedure ZoomChange(AMapView: TMapView; var Handled: Boolean); override;
|
||||
procedure ZoomChange(AMapView: TMapView; var {%H-}Handled: Boolean); override;
|
||||
procedure AfterPaint(AMapView: TMapView; var Handled: Boolean); override;
|
||||
procedure AfterDrawObjects(AMapView: TMapView; var Handled: Boolean); override;
|
||||
procedure AfterDrawObjects(AMapView: TMapView; var {%H-}Handled: Boolean); override;
|
||||
procedure GPSItemsModified(AMapView: TMapView; ChangedList: TGPSObjectList;
|
||||
ActualObjs: TGPSObjList; Adding: Boolean;
|
||||
var Handled : Boolean);override;
|
||||
var {%H-}Handled : Boolean);override;
|
||||
|
||||
function CreateMultiMapsPluginData : TMvMultiMapsPluginData;override;
|
||||
|
||||
@ -443,7 +443,7 @@ begin
|
||||
sd := TSpreadMarkerPluginData(MapViewDataItem[AMapView]);
|
||||
if not Assigned(sd) then
|
||||
begin
|
||||
FillChar(ld,SizeOf(ld),0);
|
||||
FillChar(ld{%H-},SizeOf(ld),0);
|
||||
SetMapViewData(AMapView,ld,SizeOf(ld));
|
||||
end;
|
||||
sd := TSpreadMarkerPluginData(MapViewDataItem[AMapView]);
|
||||
@ -494,7 +494,7 @@ begin
|
||||
sd := TSpreadMarkerPluginData(MapViewDataItem[AMapView]);
|
||||
if not Assigned(sd) then
|
||||
begin
|
||||
FillChar(ld,SizeOf(ld),0);
|
||||
FillChar(ld{%H-},SizeOf(ld),0);
|
||||
SetMapViewData(AMapView,ld,SizeOf(ld));
|
||||
end;
|
||||
sd := TSpreadMarkerPluginData(MapViewDataItem[AMapView]);
|
||||
|
Loading…
Reference in New Issue
Block a user