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
|
||||
TabOrder = 7
|
||||
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
|
||||
object GeoNames: TMVGeoNames
|
||||
|
@ -32,6 +32,7 @@ type
|
||||
CbDebugTiles: TCheckBox;
|
||||
cbPOITextBgColor: TColorBox;
|
||||
CbZoomToCursor: TCheckBox;
|
||||
cbCyclicView: TCheckBox;
|
||||
FontDialog: TFontDialog;
|
||||
GbCenterCoords: TGroupBox;
|
||||
GbScreenSize: TGroupBox;
|
||||
@ -74,6 +75,7 @@ type
|
||||
procedure BtnGPSPointsClick(Sender: TObject);
|
||||
procedure BtnSaveToFileClick(Sender: TObject);
|
||||
procedure BtnPOITextFontClick(Sender: TObject);
|
||||
procedure cbCyclicViewChange(Sender: TObject);
|
||||
procedure CbDebugTilesChange(Sender: TObject);
|
||||
procedure CbDoubleBufferChange(Sender: TObject);
|
||||
procedure CbFoundLocationsDrawItem(Control: TWinControl; Index: Integer;
|
||||
@ -328,6 +330,11 @@ begin
|
||||
MapView.Font.Assign(FontDialog.Font);
|
||||
end;
|
||||
|
||||
procedure TMainForm.cbCyclicViewChange(Sender: TObject);
|
||||
begin
|
||||
MapView.Cyclic := cbCyclicView.Checked;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CbDebugTilesChange(Sender: TObject);
|
||||
begin
|
||||
MapView.DebugTiles := CbDebugTiles.Checked;
|
||||
|
@ -378,7 +378,6 @@ end;
|
||||
procedure TMainForm.CbCyclicChange(Sender: TObject);
|
||||
begin
|
||||
MapView.Cyclic := CbCyclic.Checked;
|
||||
MapView.Redraw;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ClearFoundLocations;
|
||||
@ -394,16 +393,27 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormCreate(Sender: TObject);
|
||||
var
|
||||
fn: String;
|
||||
begin
|
||||
// FMapMarker := CreateMapMarker(32, clRed, clBlack);
|
||||
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
|
||||
// FMapMarker := CreateMapMarker(32, clRed, clBlack);
|
||||
POIImage := TPortableNetworkGraphic.Create;
|
||||
POIImage.PixelFormat := pf32bit;
|
||||
POIImage.LoadFromFile('mapmarker.png');
|
||||
POIImage.LoadFromFile(fn);
|
||||
end;
|
||||
|
||||
ForceDirectories(HOMEDIR + 'cache/');
|
||||
MapView.CachePath := HOMEDIR + 'cache/';
|
||||
MapView.GetMapProviders(CbProviders.Items);
|
||||
CbProviders.ItemIndex := CbProviders.Items.Indexof(MapView.MapProvider);
|
||||
CbProviders.ItemIndex := CbProviders.Items.IndexOf(MapView.MapProvider);
|
||||
MapView.DoubleBuffered := true;
|
||||
MapView.Zoom := 1;
|
||||
CbZoomToCursor.Checked := MapView.ZoomToCursor;
|
||||
|
@ -490,10 +490,17 @@ end;
|
||||
function TMapViewerEngine.CrossesDateline: Boolean;
|
||||
var
|
||||
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
|
||||
visArea.TopLeft := ScreenToLonLat(Point(0, 0));
|
||||
visArea.BottomRight := ScreenToLonLat(Point(Width, Height));
|
||||
Result := (visArea.TopLeft.Lon > 0) and (visArea.BottomRight.Lon < 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMapViewerEngine.DblClick(Sender: TObject);
|
||||
|
@ -407,6 +407,7 @@ end;
|
||||
procedure TMapView.SetCyclic(AValue: Boolean);
|
||||
begin
|
||||
Engine.Cyclic := AValue;
|
||||
Engine.Redraw;
|
||||
end;
|
||||
|
||||
procedure TMapView.SetDebugTiles(AValue: Boolean);
|
||||
|
Reference in New Issue
Block a user