You've already forked lazarus-ccr
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8799 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -623,20 +623,13 @@ function TMapViewerEngine.DegreesToMapPixels(const AWin: TMapWindow;
|
|||||||
ALonLat: TRealPoint): TPoint;
|
ALonLat: TRealPoint): TPoint;
|
||||||
var
|
var
|
||||||
pixelLocation: TPoint;
|
pixelLocation: TPoint;
|
||||||
mapWidth: Int64;
|
|
||||||
begin
|
begin
|
||||||
case AWin.MapProvider.ProjectionType of
|
case AWin.MapProvider.ProjectionType of
|
||||||
ptEPSG3395: pixelLocation := DegreesToPixelsEPSG3395(AWin, ALonLat);
|
ptEPSG3395: pixelLocation := DegreesToPixelsEPSG3395(AWin, ALonLat);
|
||||||
ptEPSG3857: pixelLocation := DegreesToPixelsEPSG3857(AWin, ALonLat);
|
ptEPSG3857: pixelLocation := DegreesToPixelsEPSG3857(AWin, ALonLat);
|
||||||
else pixelLocation := DegreesToPixelsEPSG3857(AWin, ALonLat);
|
else pixelLocation := DegreesToPixelsEPSG3857(AWin, ALonLat);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
mapWidth := ZoomFactor(AWin.Zoom) * TILE_SIZE;
|
|
||||||
Result.X := pixelLocation.x + AWin.X;
|
Result.X := pixelLocation.x + AWin.X;
|
||||||
while (Result.X < 0) do
|
|
||||||
Result.X := Result.X + mapWidth;
|
|
||||||
while (Result.X > AWin.Width) do
|
|
||||||
Result.X := Result.X - mapWidth;
|
|
||||||
Result.Y := pixelLocation.y + AWin.Y;
|
Result.Y := pixelLocation.y + AWin.Y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -721,11 +714,7 @@ var
|
|||||||
begin
|
begin
|
||||||
iMapWidth := round(ZoomFactor(AWin.Zoom)) * TILE_SIZE;
|
iMapWidth := round(ZoomFactor(AWin.Zoom)) * TILE_SIZE;
|
||||||
|
|
||||||
mPoint.X := (APoint.X - AWin.X) mod iMapWidth;
|
mPoint.X := EnsureRange(APoint.X - AWin.X, 0, iMapWidth);
|
||||||
while mPoint.X < 0 do
|
|
||||||
mPoint.X := mPoint.X + iMapWidth;
|
|
||||||
while mPoint.X >= iMapWidth do
|
|
||||||
mPoint.X := mPoint.X - iMapWidth;
|
|
||||||
mPoint.Y := EnsureRange(APoint.Y - AWin.Y, 0, iMapWidth);
|
mPoint.Y := EnsureRange(APoint.Y - AWin.Y, 0, iMapWidth);
|
||||||
|
|
||||||
case aWin.MapProvider.ProjectionType of
|
case aWin.MapProvider.ProjectionType of
|
||||||
@ -1006,22 +995,17 @@ var
|
|||||||
x, y : Integer; //int64;
|
x, y : Integer; //int64;
|
||||||
Tiles: TTileIdArray = nil;
|
Tiles: TTileIdArray = nil;
|
||||||
iTile: Integer;
|
iTile: Integer;
|
||||||
numTiles: Integer;
|
|
||||||
begin
|
begin
|
||||||
if not(Active) then
|
if not(Active) then
|
||||||
Exit;
|
Exit;
|
||||||
Queue.CancelAllJob(self);
|
Queue.CancelAllJob(self);
|
||||||
TilesVis := CalculateVisibleTiles(aWin);
|
TilesVis := CalculateVisibleTiles(aWin);
|
||||||
numTiles := 1 shl aWin.Zoom;
|
|
||||||
SetLength(Tiles, (TilesVis.Bottom - TilesVis.Top + 1) * (TilesVis.Right - TilesVis.Left + 1));
|
SetLength(Tiles, (TilesVis.Bottom - TilesVis.Top + 1) * (TilesVis.Right - TilesVis.Left + 1));
|
||||||
iTile := Low(Tiles);
|
iTile := Low(Tiles);
|
||||||
for y := TilesVis.Top to TilesVis.Bottom do
|
for y := TilesVis.Top to TilesVis.Bottom do
|
||||||
for X := TilesVis.Left to TilesVis.Right do
|
for X := TilesVis.Left to TilesVis.Right do
|
||||||
begin
|
begin
|
||||||
//Tiles[iTile].X := X;
|
Tiles[iTile].X := X;
|
||||||
Tiles[iTile].X := X mod numTiles;
|
|
||||||
if Tiles[iTile].X < 0 then
|
|
||||||
Tiles[iTile].X := Tiles[iTile].X + numTiles;
|
|
||||||
Tiles[iTile].Y := Y;
|
Tiles[iTile].Y := Y;
|
||||||
Tiles[iTile].Z := aWin.Zoom;
|
Tiles[iTile].Z := aWin.Zoom;
|
||||||
if IsValidTile(aWin, Tiles[iTile]) then
|
if IsValidTile(aWin, Tiles[iTile]) then
|
||||||
@ -1257,36 +1241,15 @@ var
|
|||||||
EnvTile: TEnvTile;
|
EnvTile: TEnvTile;
|
||||||
img: TLazIntfImage;
|
img: TLazIntfImage;
|
||||||
X, Y: integer;
|
X, Y: integer;
|
||||||
worldWidth: Integer;
|
|
||||||
numTiles: Integer;
|
|
||||||
baseX: Integer;
|
|
||||||
begin
|
begin
|
||||||
EnvTile := TEnvTile(Data);
|
EnvTile := TEnvTile(Data);
|
||||||
try
|
try
|
||||||
if IsCurrentWin(EnvTile.Win)then
|
if IsCurrentWin(EnvTile.Win)then
|
||||||
begin
|
begin
|
||||||
Cache.GetFromCache(EnvTile.Win.MapProvider, EnvTile.Tile, img);
|
Cache.GetFromCache(EnvTile.Win.MapProvider, EnvTile.Tile, img);
|
||||||
|
X := EnvTile.Win.X + EnvTile.Tile.X * TILE_SIZE; // begin of X
|
||||||
Y := EnvTile.Win.Y + EnvTile.Tile.Y * TILE_SIZE; // begin of Y
|
Y := EnvTile.Win.Y + EnvTile.Tile.Y * TILE_SIZE; // begin of Y
|
||||||
baseX := EnvTile.Win.X + EnvTile.Tile.X * TILE_SIZE; // begin of X
|
DrawTile(EnvTile.Tile, X, Y, img);
|
||||||
numTiles := 1 shl EnvTile.Win.Zoom;
|
|
||||||
worldWidth := numTiles * TILE_SIZE;
|
|
||||||
|
|
||||||
// From the center to the left (western) hemisphere
|
|
||||||
X := baseX;
|
|
||||||
while (X+TILE_SIZE >= 0) do
|
|
||||||
begin
|
|
||||||
DrawTile(EnvTile.Tile, X, Y, img);
|
|
||||||
X := X - worldWidth;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// From the center to the right (eastern) hemisphere
|
|
||||||
X := baseX + worldWidth;
|
|
||||||
while ((X-TILE_SIZE) <= EnvTile.Win.Width) do
|
|
||||||
begin
|
|
||||||
DrawTile(EnvTile.Tile, X, Y, img);
|
|
||||||
X := X + worldWidth;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
FreeAndNil(EnvTile);
|
FreeAndNil(EnvTile);
|
||||||
|
@ -793,8 +793,6 @@ var
|
|||||||
begin
|
begin
|
||||||
Area.TopLeft := Engine.ScreenToLonLat(Point(aLeft, aTop));
|
Area.TopLeft := Engine.ScreenToLonLat(Point(aLeft, aTop));
|
||||||
Area.BottomRight := Engine.ScreenToLonLat(Point(aRight, aBottom));
|
Area.BottomRight := Engine.ScreenToLonLat(Point(aRight, aBottom));
|
||||||
Area.Normalize;
|
|
||||||
|
|
||||||
if GPSItems.Count > 0 then
|
if GPSItems.Count > 0 then
|
||||||
begin
|
begin
|
||||||
lst := GPSItems.GetObjectsInArea(Area);
|
lst := GPSItems.GetObjectsInArea(Area);
|
||||||
@ -1015,25 +1013,13 @@ end;
|
|||||||
function TMapView.GetVisibleArea: TRealArea;
|
function TMapView.GetVisibleArea: TRealArea;
|
||||||
var
|
var
|
||||||
aPt: TPoint;
|
aPt: TPoint;
|
||||||
w, mapWidth: Int64;
|
|
||||||
begin
|
begin
|
||||||
aPt.X := 0;
|
aPt.X := 0;
|
||||||
aPt.Y := 0;
|
aPt.Y := 0;
|
||||||
Result.TopLeft := Engine.ScreenToLonLat(aPt);
|
Result.TopLeft := Engine.ScreenToLonLat(aPt);
|
||||||
|
aPt.X := Width;
|
||||||
mapWidth := ZoomFactor(Engine.Zoom) * TILE_SIZE;
|
aPt.Y := Height;
|
||||||
w := Width;
|
Result.BottomRight := Engine.ScreenToLonLat(aPt);
|
||||||
if w >= mapWidth then
|
|
||||||
begin
|
|
||||||
Result.TopLeft.Lon := -180;
|
|
||||||
Result.BottomRight.Lon := 180;
|
|
||||||
end else
|
|
||||||
begin
|
|
||||||
aPt.X := w;
|
|
||||||
aPt.Y := Height;
|
|
||||||
Result.BottomRight := Engine.ScreenToLonLat(aPt);
|
|
||||||
Result.Normalize;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMapView.ClearBuffer;
|
procedure TMapView.ClearBuffer;
|
||||||
|
@ -47,8 +47,6 @@ Type
|
|||||||
TRealArea = Record
|
TRealArea = Record
|
||||||
TopLeft : TRealPoint;
|
TopLeft : TRealPoint;
|
||||||
BottomRight : TRealPoint;
|
BottomRight : TRealPoint;
|
||||||
procedure Normalize;
|
|
||||||
function Normalized: TRealArea;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -76,19 +74,5 @@ begin
|
|||||||
Self.Lat := RadToDeg(AValue);
|
Self.Lat := RadToDeg(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TRealArea }
|
|
||||||
|
|
||||||
procedure TRealArea.Normalize;
|
|
||||||
begin
|
|
||||||
while BottomRight.Lon < TopLeft.Lon do
|
|
||||||
BottomRight.Lon := BottomRight.Lon + 360.0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TRealArea.Normalized: TRealArea;
|
|
||||||
begin
|
|
||||||
Result := Self;
|
|
||||||
Result.Normalize;
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user