LazMapViewer: Rename TPluginManager.Item[] to .Items[]. Add properties .Count, .MapViewCount and .MapViews[].

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9563 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2025-01-04 21:12:05 +00:00
parent 4c30141e1a
commit 853503a11f
2 changed files with 46 additions and 25 deletions

View File

@ -289,9 +289,9 @@ begin
exit; exit;
inc(FLocked); inc(FLocked);
try try
for i := 0 to PluginManager.MapList.Count-1 do for i := 0 to PluginManager.MapViewCount-1 do
begin begin
map := TMapView(PluginManager.MapList[i]); map := PluginManager.MapViews[i];
if AMapView <> map then if AMapView <> map then
map.Center := AMapView.Center; map.Center := AMapView.Center;
end; end;
@ -310,9 +310,9 @@ begin
exit; exit;
inc(FLocked); inc(FLocked);
try try
for i := 0 to PluginManager.MapList.Count-1 do for i := 0 to PluginManager.MapViewCount-1 do
begin begin
map := TMapView(PluginManager.MapList[i]); map := PluginManager.MapViews[i];
if AMapView <> map then if AMapView <> map then
begin begin
zoomToCrs := map.ZoomToCursor; zoomToCrs := map.ZoomToCursor;

View File

@ -216,7 +216,10 @@ type
private private
FPluginList: TMvPluginList; FPluginList: TMvPluginList;
FMapList: TFPList; FMapList: TFPList;
function GetItem(AIndex: Integer): TMvCustomPlugin; function GetCount: Integer;
function GetItems(AIndex: Integer): TMvCustomPlugin;
function GetMapViewCount: Integer;
function GetMapViews(AIndex: Integer): TMapView;
protected protected
procedure AddMapView(AMapView: TMapView); override; procedure AddMapView(AMapView: TMapView); override;
function HandlePlugin(APlugin: TMvCustomPlugin; AMapView: TMapView): Boolean; function HandlePlugin(APlugin: TMvCustomPlugin; AMapView: TMapView): Boolean;
@ -255,8 +258,11 @@ type
destructor Destroy; override; destructor Destroy; override;
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
procedure SetChildOrder(Child: TComponent; Order: Integer); override; procedure SetChildOrder(Child: TComponent; Order: Integer); override;
property Item[AIndex: Integer]: TMvCustomPlugin read GetItem; default; property Count: Integer read GetCount;
property MapList: TFPList read FMapList; property Items[AIndex: Integer]: TMvCustomPlugin read GetItems; default;
property MapViews[AIndex: Integer]: TMapView read GetMapViews;
property MapViewCount: Integer read GetMapViewCount;
// property MapList: TFPList read FMapList;
published published
property PluginList: TMvPluginList read FPluginList; property PluginList: TMvPluginList read FPluginList;
end; end;
@ -888,7 +894,7 @@ begin
Result := False; Result := False;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.AfterDrawObjects(AMapView, Result); plugin.AfterDrawObjects(AMapView, Result);
end; end;
@ -902,7 +908,7 @@ begin
Result := False; Result := False;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.AfterPaint(AMapView, Result); plugin.AfterPaint(AMapView, Result);
end; end;
@ -916,7 +922,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.BeforeDrawObjects(AMapView, Result); plugin.BeforeDrawObjects(AMapView, Result);
end; end;
@ -930,7 +936,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.CenterMove(AMapView, Result); plugin.CenterMove(AMapView, Result);
end; end;
@ -945,7 +951,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.CenterMoving(AMapView, NewCenter, Allow, Result); plugin.CenterMoving(AMapView, NewCenter, Allow, Result);
end; end;
@ -960,7 +966,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.DrawGPSPoint(AMapView, ADrawingEngine, APoint, Result); plugin.DrawGPSPoint(AMapView, ADrawingEngine, APoint, Result);
end; end;
@ -975,7 +981,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.DrawMissingTile(AMapView, ADrawingEngine, ATileID, ARect, Result); plugin.DrawMissingTile(AMapView, ADrawingEngine, ATileID, ARect, Result);
end; end;
@ -988,17 +994,32 @@ var
begin begin
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if plugin.Owner = Root then if plugin.Owner = Root then
Proc(plugin); Proc(plugin);
end; end;
end; end;
function TMvPluginManager.GetItem(AIndex: Integer): TMvCustomPlugin; function TMvPluginManager.GetCount: Integer;
begin
Result := FPluginList.Count;
end;
function TMvPluginManager.GetItems(AIndex: Integer): TMvCustomPlugin;
begin begin
Result := TMvCustomPlugin(FPluginList.Items[AIndex]); Result := TMvCustomPlugin(FPluginList.Items[AIndex]);
end; end;
function TMvPluginManager.GetMapViewCount: Integer;
begin
Result := FMapList.Count;
end;
function TMvPluginManager.GetMapViews(AIndex: Integer): TMapView;
begin
Result := TMapView(FMapList[AIndex]);
end;
function TMvPluginManager.GPSItemsModified(AMapView: TMapView; function TMvPluginManager.GPSItemsModified(AMapView: TMapView;
ModifiedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean): Boolean; ModifiedList: TGPSObjectList; ActualObjs: TGPSObjList; Adding: Boolean): Boolean;
var var
@ -1008,7 +1029,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.GPSItemsModified(AMapView, ModifiedList, ActualObjs, Adding, Result); plugin.GPSItemsModified(AMapView, ModifiedList, ActualObjs, Adding, Result);
end; end;
@ -1037,7 +1058,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.MouseDown(AMapView, AButton, AShift, X, Y, Result); plugin.MouseDown(AMapView, AButton, AShift, X, Y, Result);
end; end;
@ -1051,7 +1072,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.MouseEnter(AMapView, Result); plugin.MouseEnter(AMapView, Result);
end; end;
@ -1065,7 +1086,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.MouseLeave(AMapView, Result); plugin.MouseLeave(AMapView, Result);
end; end;
@ -1080,7 +1101,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.MouseMove(AMapView, AShift, X, Y, Result); plugin.MouseMove(AMapView, AShift, X, Y, Result);
end; end;
@ -1095,7 +1116,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.MouseUp(AMapView, AButton, AShift, X, Y, Result); plugin.MouseUp(AMapView, AButton, AShift, X, Y, Result);
end; end;
@ -1110,7 +1131,7 @@ begin
Result := False; Result := False;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.MouseWheel(AMapView, AShift, AWheelDelta, AMousePos, Result); plugin.MouseWheel(AMapView, AShift, AWheelDelta, AMousePos, Result);
end; end;
@ -1160,7 +1181,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.ZoomChange(AMapView, Result); plugin.ZoomChange(AMapView, Result);
end; end;
@ -1175,7 +1196,7 @@ begin
Result := false; Result := false;
for i := 0 to FPluginList.Count-1 do for i := 0 to FPluginList.Count-1 do
begin begin
plugin := Item[i]; plugin := Items[i];
if HandlePlugin(plugin, AMapView) then if HandlePlugin(plugin, AMapView) then
plugin.ZoomChanging(AMapView, NewZoom, Allow, Result); plugin.ZoomChanging(AMapView, NewZoom, Allow, Result);
end; end;