LazMapViewer: Minor improvements and clean-up. Rename TMapView.POIOpacity to .POITextBgOpacity.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9721 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2025-04-05 22:45:14 +00:00
parent 6d7bfb694a
commit 5dc6af3267
4 changed files with 35 additions and 32 deletions

View File

@ -1,7 +1,7 @@
object MainForm: TMainForm
Left = 375
Left = 590
Height = 586
Top = 177
Top = 184
Width = 750
Caption = 'LazMapViewer'
ClientHeight = 586
@ -26,6 +26,7 @@ object MainForm: TMainForm
Layers = <>
Font.Color = clBlack
MapProvider = 'OpenStreetMap Standard'
ParentFont = False
POIImages = POIImages
TabOrder = 0
ZoomToCursor = False
@ -40,9 +41,9 @@ object MainForm: TMainForm
Height = 586
Top = 0
Width = 275
ActivePage = PgData
ActivePage = PgConfig
Align = alRight
TabIndex = 0
TabIndex = 2
TabOrder = 1
object PgData: TTabSheet
Caption = 'Data'
@ -632,7 +633,7 @@ object MainForm: TMainForm
MinSize = 8
MaxSize = 166
Title.Caption = 'Provider'
Width = 154
Width = 166
end>
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll, goRowHighlight]
RowCount = 11
@ -643,7 +644,7 @@ object MainForm: TMainForm
ColWidths = (
30
54
154
166
)
Cells = (
11

View File

@ -29,7 +29,7 @@ Some providers submitted by
// OSM Sputnik is no longer available. Keeping it here for reference only...
// AddMapProvider('OpenStreetMap Sputnik', ptEPSG3857, 'https://%serv%.tilessputnik.ru/tiles/kmt2/%z%/%x%/%y%.png', 0, 19, 3, @GetSvrLetter);
AddMapProvider('OpenStreetMap.fr Hot', ptEPSG3857, 'https://%serv%.tile.openstreetmap.fr/hot/%z%/%x%/%y%.png', 0, 18, 3, @GetSvrLetter);
AddMapProvider('Open Topo Map', ptEPSG3857, 'http://%serv%.tile.opentopomap.org/%z%/%x%/%y%.png', 0, 19, 3, @GetSvrLetter);
AddMapProvider('Open Topo Map', ptEPSG3857, 'http://%serv%.tile.opentopomap.org/%z%/%x%/%y%.png', 0, 14, 3, @GetSvrLetter);
AddMapProvider('OpenStreetMap.fr Cycle Map', ptEPSG3857, 'https://dev.%serv%.tile.openstreetmap.fr/cyclosm/%z%/%x%/%y%.png', 0, 18, 3, @GetSvrLetter);
AddMapProvider('OSM Refuges', ptEPSG3857, 'https://maps.refuges.info/hiking/%z%/%x%/%y%.png', 0, 19, 4, nil);
AddMapProvider('OpenRailwayMap Standard', ptEPSG3857, 'https://%serv%.tiles.openrailwaymap.org/standard/%z%/%x%/%y%.png', 0, 19, 3, @GetSvrLetter); // Creative-Commons license Attribution-ShareAlike 2.0 (CC-BY-SA 2.0) (https://wiki.openstreetmap.org/wiki/OpenRailwayMap/API)

View File

@ -535,6 +535,9 @@ type
{ TMapView }
TMapView = class(TCustomControl)
private
const
DEFAULT_POI_TEXT_BACKGROUND_OPACITY = 0.55;
private
FCacheLocation: TCacheLocation;
FCachePath, FCacheFullPath: String;
@ -552,8 +555,8 @@ type
FSavedOnModifiedEvents: array of TModifiedEvent;
FOptions: TMapViewOptions;
FPOIImage: TCustomBitmap;
FPOIOpacity: Single;
FPOITextBgColor: TColor;
FPOITextBgOpacity: Single;
FDebugTiles: Boolean;
FDefaultTrackColor: TColor;
FDefaultTrackWidth: Integer;
@ -598,11 +601,7 @@ type
function GetInactiveColor: TColor;
function GetLayers: TMapLayers;
function GetMapProvider: String;
// function GetOnCenterMove: TNotifyEvent;
// function GetOnCenterMoving: TCenterMovingEvent;
function GetOnChange: TNotifyEvent;
// function GetOnZoomChange: TNotifyEvent;
// function GetOnZoomChanging: TZoomChangingEvent;
function GetUseThreads: boolean;
function GetZoom: integer;
function GetZoomToCursor: Boolean;
@ -610,7 +609,7 @@ type
function IsCacheMemMaxItemCountStored : Boolean;
function IsCachePathStored: Boolean;
function IsLayersStored: Boolean;
function IsPOIOpacityStored: Boolean;
function IsPOITextBgOpacityStored: Boolean;
procedure SetActive(AValue: boolean);
procedure SetCacheLocation(AValue: TCacheLocation);
procedure SetCacheMaxAge(AValue: Integer);
@ -628,18 +627,14 @@ type
procedure SetInactiveColor(AValue: TColor);
procedure SetLayers(const ALayers: TMapLayers);
procedure SetMapProvider(AValue: String);
// procedure SetOnCenterMove(AValue: TNotifyEvent);
// procedure SetOnCenterMoving(AValue: TCenterMovingEvent);
procedure SetOnChange(AValue: TNotifyEvent);
// procedure SetOnZoomChange(AValue: TNotifyEvent);
// procedure SetOnZoomChanging(AValue: TZoomChangingEvent);
procedure SetOptions(AValue: TMapViewOptions);
procedure SetPluginManager(AValue: TMvCustomPluginManager);
procedure SetPOIImage(const AValue: TCustomBitmap);
procedure SetPOIImages(const AValue: TCustomImageList);
procedure SetPOIImagesWidth(AValue: Integer);
procedure SetPOIOpacity(AValue: Single);
procedure SetPOITextBgColor(AValue: TColor);
procedure SetPOITextBgOpacity(AValue: Single);
procedure SetTransparentMap(AValue: Boolean);
procedure SetUseThreads(AValue: Boolean);
procedure SetZoom(AValue: integer);
@ -781,8 +776,8 @@ type
property POIImage: TCustomBitmap read FPOIImage write SetPOIImage;
property POIImages: TCustomImageList read FPOIImages write SetPOIImages;
property POIImagesWidth: Integer read FPOIImagesWidth write SetPOIImagesWidth default 0;
property POIOpacity: Single read FPOIOpacity write SetPOIOpacity stored IsPOIOpacityStored;
property POITextBgColor: TColor read FPOITextBgColor write SetPOITextBgColor default clNone;
property POITextBgOpacity: Single read FPOITextBgOpacity write SetPOITextBgOpacity stored IsPOITextBgOpacityStored;
property PopupMenu;
property TabOrder;
property TabStop;
@ -2666,9 +2661,9 @@ begin
Result := True;
end;
function TMapView.IsPOIOpacityStored: Boolean;
function TMapView.IsPOITextBgOpacityStored: Boolean;
begin
Result := FPOIOpacity <> 0.5;
Result := FPOITextBgOpacity <> DEFAULT_POI_TEXT_BACKGROUND_OPACITY;
end;
procedure TMapView.SetCacheOnDisk(AValue: boolean);
@ -2899,14 +2894,6 @@ begin
Invalidate;
end;
procedure TMapView.SetPOIOpacity(AValue: Single);
begin
if FPOIOpacity = AValue then
exit;
FPOIOpacity := AValue;
Invalidate;
end;
procedure TMapView.SetPOITextBgColor(AValue: TColor);
begin
if FPOITextBgColor = AValue then exit;
@ -2914,6 +2901,14 @@ begin
Invalidate;
end;
procedure TMapView.SetPOITextBgOpacity(AValue: Single);
begin
if FPOITextBgOpacity = AValue then
exit;
FPOITextBgOpacity := AValue;
Invalidate;
end;
procedure TMapView.SetTransparentMap(AValue: Boolean);
begin
if FTransparentMap = AValue then
@ -3508,7 +3503,7 @@ var
end;
// Draw the point text
DrawingEngine.Opacity := FPOIOpacity;
DrawingEngine.Opacity := FPOITextBgOpacity;
DrawingEngine.BrushColor := FPOITextBgColor;
if FPOITextBgColor = clNone then
DrawingEngine.BrushStyle := bsClear
@ -3837,7 +3832,7 @@ begin
FPOIImage := TPortableNetworkGraphic.Create; //TBitmap.Create;
FPOIImage.OnChange := @UpdateImage;
FPOITextBgColor := clNone;
FPOIOpacity := 0.5;
FPOITextBgOpacity := DEFAULT_POI_TEXT_BACKGROUND_OPACITY;
FCenter := TMapCenter.Create(Self);
FCenter.Longitude := 0.0;

View File

@ -129,7 +129,7 @@ uses
const
sNONE = '(none)';
sEDITMapView = 'Edit MapView Points';
sEDITMapView = 'Edit MapView Points...';
sLayerEditor = 'Layer Editor...';
{ TMapTrackPointsPropertyEditor }
@ -142,6 +142,7 @@ begin
);
end;
{ TMapViewComponentEditor }
constructor TMapViewComponentEditor.Create(AComponent: TComponent;
@ -291,6 +292,7 @@ begin
Result := LayersPropertyEditForm;
end;
{ TPointElevationPropertyEditor }
function TPointElevationPropertyEditor.GetValue: string;
@ -307,6 +309,7 @@ begin
else inherited SetValue(NewValue);
end;
{ TLatLonDMSPropertyEditor }
procedure TLatLonDMSPropertyEditor.EnsureRange(var AValue: Double);
@ -363,6 +366,7 @@ begin
Result := LatToStr(GetFloatValue, True);
end;
{ TLonDMSPropertyEditor }
procedure TLonDMSPropertyEditor.GetRange(out AMin, AMax: Double);
@ -379,6 +383,7 @@ begin
Result := LonToStr(GetFloatValue, True);
end;
{ TPointDateTimePropertyEditor }
function TPointDateTimePropertyEditor.GetValue: string;
@ -395,6 +400,7 @@ begin
else inherited SetValue(NewValue);
end;
{ TPointOfInterestImageIndexPropertyEditor }
function TPointOfInterestImageIndexPropertyEditor.GetImageList: TCustomImageList;
@ -409,6 +415,7 @@ begin
end;
end;
{ TMapProviderPropertyEditor }
function TMapProviderPropertyEditor.GetAttributes: TPropertyAttributes;