You've already forked lazarus-ccr
LazMapViewer: Fix issue with marker disappearing at small zoom when the window is wider than the full map. Patch by Ekkehard Domning. Prevent POIImage exception in the fulldemo_with_addons. Show "Cyclic view" checkbox in fulldemo.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8815 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -840,6 +840,21 @@ object MainForm: TMainForm
|
|||||||
State = cbChecked
|
State = cbChecked
|
||||||
TabOrder = 7
|
TabOrder = 7
|
||||||
end
|
end
|
||||||
|
object cbCyclicView: TCheckBox
|
||||||
|
AnchorSideLeft.Control = CbZoomToCursor
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = CbZoomToCursor
|
||||||
|
Left = 130
|
||||||
|
Height = 19
|
||||||
|
Top = 56
|
||||||
|
Width = 77
|
||||||
|
BorderSpacing.Left = 24
|
||||||
|
Caption = 'Cyclic view'
|
||||||
|
Checked = True
|
||||||
|
OnChange = cbCyclicViewChange
|
||||||
|
State = cbChecked
|
||||||
|
TabOrder = 8
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object GeoNames: TMVGeoNames
|
object GeoNames: TMVGeoNames
|
||||||
|
@ -32,6 +32,7 @@ type
|
|||||||
CbDebugTiles: TCheckBox;
|
CbDebugTiles: TCheckBox;
|
||||||
cbPOITextBgColor: TColorBox;
|
cbPOITextBgColor: TColorBox;
|
||||||
CbZoomToCursor: TCheckBox;
|
CbZoomToCursor: TCheckBox;
|
||||||
|
cbCyclicView: TCheckBox;
|
||||||
FontDialog: TFontDialog;
|
FontDialog: TFontDialog;
|
||||||
GbCenterCoords: TGroupBox;
|
GbCenterCoords: TGroupBox;
|
||||||
GbScreenSize: TGroupBox;
|
GbScreenSize: TGroupBox;
|
||||||
@ -74,6 +75,7 @@ type
|
|||||||
procedure BtnGPSPointsClick(Sender: TObject);
|
procedure BtnGPSPointsClick(Sender: TObject);
|
||||||
procedure BtnSaveToFileClick(Sender: TObject);
|
procedure BtnSaveToFileClick(Sender: TObject);
|
||||||
procedure BtnPOITextFontClick(Sender: TObject);
|
procedure BtnPOITextFontClick(Sender: TObject);
|
||||||
|
procedure cbCyclicViewChange(Sender: TObject);
|
||||||
procedure CbDebugTilesChange(Sender: TObject);
|
procedure CbDebugTilesChange(Sender: TObject);
|
||||||
procedure CbDoubleBufferChange(Sender: TObject);
|
procedure CbDoubleBufferChange(Sender: TObject);
|
||||||
procedure CbFoundLocationsDrawItem(Control: TWinControl; Index: Integer;
|
procedure CbFoundLocationsDrawItem(Control: TWinControl; Index: Integer;
|
||||||
@ -328,6 +330,11 @@ begin
|
|||||||
MapView.Font.Assign(FontDialog.Font);
|
MapView.Font.Assign(FontDialog.Font);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.cbCyclicViewChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
MapView.Cyclic := cbCyclicView.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.CbDebugTilesChange(Sender: TObject);
|
procedure TMainForm.CbDebugTilesChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
MapView.DebugTiles := CbDebugTiles.Checked;
|
MapView.DebugTiles := CbDebugTiles.Checked;
|
||||||
|
@ -378,7 +378,6 @@ end;
|
|||||||
procedure TMainForm.CbCyclicChange(Sender: TObject);
|
procedure TMainForm.CbCyclicChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
MapView.Cyclic := CbCyclic.Checked;
|
MapView.Cyclic := CbCyclic.Checked;
|
||||||
MapView.Redraw;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.ClearFoundLocations;
|
procedure TMainForm.ClearFoundLocations;
|
||||||
@ -394,16 +393,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.FormCreate(Sender: TObject);
|
procedure TMainForm.FormCreate(Sender: TObject);
|
||||||
|
var
|
||||||
|
fn: String;
|
||||||
|
begin
|
||||||
|
cInputQueryEditSizePercents := 0;
|
||||||
|
|
||||||
|
fn := Application.Location + 'mapmarker.png';
|
||||||
|
if not FileExists(fn) then
|
||||||
|
MessageDlg('Copy the file "mapmarker.png" from the source folder to the folder with the executable.',
|
||||||
|
mtError, [mbOK], 0)
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
// FMapMarker := CreateMapMarker(32, clRed, clBlack);
|
// FMapMarker := CreateMapMarker(32, clRed, clBlack);
|
||||||
POIImage := TPortableNetworkGraphic.Create;
|
POIImage := TPortableNetworkGraphic.Create;
|
||||||
POIImage.PixelFormat := pf32bit;
|
POIImage.PixelFormat := pf32bit;
|
||||||
POIImage.LoadFromFile('mapmarker.png');
|
POIImage.LoadFromFile(fn);
|
||||||
|
end;
|
||||||
|
|
||||||
ForceDirectories(HOMEDIR + 'cache/');
|
ForceDirectories(HOMEDIR + 'cache/');
|
||||||
MapView.CachePath := HOMEDIR + 'cache/';
|
MapView.CachePath := HOMEDIR + 'cache/';
|
||||||
MapView.GetMapProviders(CbProviders.Items);
|
MapView.GetMapProviders(CbProviders.Items);
|
||||||
CbProviders.ItemIndex := CbProviders.Items.Indexof(MapView.MapProvider);
|
CbProviders.ItemIndex := CbProviders.Items.IndexOf(MapView.MapProvider);
|
||||||
MapView.DoubleBuffered := true;
|
MapView.DoubleBuffered := true;
|
||||||
MapView.Zoom := 1;
|
MapView.Zoom := 1;
|
||||||
CbZoomToCursor.Checked := MapView.ZoomToCursor;
|
CbZoomToCursor.Checked := MapView.ZoomToCursor;
|
||||||
|
@ -490,11 +490,18 @@ end;
|
|||||||
function TMapViewerEngine.CrossesDateline: Boolean;
|
function TMapViewerEngine.CrossesDateline: Boolean;
|
||||||
var
|
var
|
||||||
visArea: TRealArea;
|
visArea: TRealArea;
|
||||||
|
mapWidth: Int64;
|
||||||
|
begin
|
||||||
|
// Catch the case, that the screen is wider than the whole world
|
||||||
|
mapWidth := ZoomFactor(MapWin.Zoom) * TILE_SIZE;
|
||||||
|
Result := (MapWin.Width > mapWidth);
|
||||||
|
if not Result then
|
||||||
begin
|
begin
|
||||||
visArea.TopLeft := ScreenToLonLat(Point(0, 0));
|
visArea.TopLeft := ScreenToLonLat(Point(0, 0));
|
||||||
visArea.BottomRight := ScreenToLonLat(Point(Width, Height));
|
visArea.BottomRight := ScreenToLonLat(Point(Width, Height));
|
||||||
Result := (visArea.TopLeft.Lon > 0) and (visArea.BottomRight.Lon < 0);
|
Result := (visArea.TopLeft.Lon > 0) and (visArea.BottomRight.Lon < 0);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMapViewerEngine.DblClick(Sender: TObject);
|
procedure TMapViewerEngine.DblClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
|
@ -407,6 +407,7 @@ end;
|
|||||||
procedure TMapView.SetCyclic(AValue: Boolean);
|
procedure TMapView.SetCyclic(AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
Engine.Cyclic := AValue;
|
Engine.Cyclic := AValue;
|
||||||
|
Engine.Redraw;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMapView.SetDebugTiles(AValue: Boolean);
|
procedure TMapView.SetDebugTiles(AValue: Boolean);
|
||||||
|
Reference in New Issue
Block a user