You've already forked lazarus-ccr
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8810 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
object MainForm: TMainForm
|
object MainForm: TMainForm
|
||||||
Left = 332
|
Left = 381
|
||||||
Height = 640
|
Height = 640
|
||||||
Top = 183
|
Top = 187
|
||||||
Width = 883
|
Width = 883
|
||||||
Caption = 'LazMapViewer'
|
Caption = 'LazMapViewer'
|
||||||
ClientHeight = 640
|
ClientHeight = 640
|
||||||
|
@ -638,6 +638,7 @@ 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);
|
||||||
@ -645,6 +646,14 @@ begin
|
|||||||
else pixelLocation := DegreesToPixelsEPSG3857(AWin, ALonLat);
|
else pixelLocation := DegreesToPixelsEPSG3857(AWin, ALonLat);
|
||||||
end;
|
end;
|
||||||
Result.X := pixelLocation.x + AWin.X;
|
Result.X := pixelLocation.x + AWin.X;
|
||||||
|
if FCyclic and CrossesDateline then
|
||||||
|
begin
|
||||||
|
mapWidth := ZoomFactor(AWin.Zoom) * TILE_SIZE;
|
||||||
|
while (Result.X < 0) do
|
||||||
|
Result.X := Result.X + mapWidth;
|
||||||
|
while (Result.X > AWin.Width) do
|
||||||
|
Result.X := Result.X - mapWidth;
|
||||||
|
end;
|
||||||
Result.Y := pixelLocation.y + AWin.Y;
|
Result.Y := pixelLocation.y + AWin.Y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -729,16 +738,16 @@ var
|
|||||||
begin
|
begin
|
||||||
mapWidth := round(ZoomFactor(AWin.Zoom)) * TILE_SIZE;
|
mapWidth := round(ZoomFactor(AWin.Zoom)) * TILE_SIZE;
|
||||||
|
|
||||||
mPoint.Y := EnsureRange(APoint.Y - AWin.Y, 0, mapWidth);
|
|
||||||
mPoint.X := EnsureRange(APoint.X - AWin.X, 0, mapWidth);
|
|
||||||
if FCyclic then
|
if FCyclic then
|
||||||
begin
|
begin
|
||||||
|
mPoint.X := (APoint.X - AWin.X) mod mapWidth;
|
||||||
while mPoint.X < 0 do
|
while mPoint.X < 0 do
|
||||||
mPoint.X := mPoint.X + mapWidth;
|
mPoint.X := mPoint.X + mapWidth;
|
||||||
while mPoint.X >= mapWidth do
|
while mPoint.X >= mapWidth do
|
||||||
mPoint.X := mPoint.X - mapWidth;
|
mPoint.X := mPoint.X - mapWidth;
|
||||||
mPoint.Y := EnsureRange(APoint.Y - AWin.Y, 0, mapWidth);
|
end else
|
||||||
end;
|
mPoint.X := EnsureRange(APoint.X - AWin.X, 0, mapWidth);
|
||||||
|
mPoint.Y := EnsureRange(APoint.Y - AWin.Y, 0, mapWidth);
|
||||||
|
|
||||||
case aWin.MapProvider.ProjectionType of
|
case aWin.MapProvider.ProjectionType of
|
||||||
ptEPSG3857: Result := PixelsToDegreesEPSG3857(mPoint, AWin.Zoom);
|
ptEPSG3857: Result := PixelsToDegreesEPSG3857(mPoint, AWin.Zoom);
|
||||||
|
@ -216,7 +216,7 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
Result.Init(0, 0, 0, 0);
|
Result.Init(0, 0, 0, 0);
|
||||||
if Objs.Count>0 then
|
if Objs.Count > 0 then
|
||||||
begin
|
begin
|
||||||
Result := Objs[0].BoundingBox;
|
Result := Objs[0].BoundingBox;
|
||||||
for i:=1 to pred(Objs.Count) do
|
for i:=1 to pred(Objs.Count) do
|
||||||
|
@ -280,7 +280,7 @@ constructor TDrawObjJob.Create(aViewer: TMapView; aLst: TGPSObjList;
|
|||||||
begin
|
begin
|
||||||
FArea := aArea;
|
FArea := aArea;
|
||||||
FLst := aLst;
|
FLst := aLst;
|
||||||
SetLEngth(FStates,FLst.Count);
|
SetLength(FStates, FLst.Count);
|
||||||
Viewer := aViewer;
|
Viewer := aViewer;
|
||||||
AllRun := false;
|
AllRun := false;
|
||||||
Name := 'DrawObj';
|
Name := 'DrawObj';
|
||||||
@ -603,15 +603,15 @@ end;
|
|||||||
procedure TMapView.OnGPSItemsModified(Sender: TObject; objs: TGPSObjList;
|
procedure TMapView.OnGPSItemsModified(Sender: TObject; objs: TGPSObjList;
|
||||||
Adding: boolean);
|
Adding: boolean);
|
||||||
var
|
var
|
||||||
Area,ObjArea,vArea: TRealArea;
|
Area, objArea, visArea: TRealArea;
|
||||||
begin
|
begin
|
||||||
if Adding and Assigned(Objs) then
|
if Adding and Assigned(Objs) then
|
||||||
begin
|
begin
|
||||||
ObjArea := GetAreaOf(Objs);
|
objArea := GetAreaOf(Objs);
|
||||||
vArea := GetVisibleArea;
|
visArea := GetVisibleArea;
|
||||||
if hasIntersectArea(ObjArea,vArea) then
|
if hasIntersectArea(objArea, visArea) then
|
||||||
begin
|
begin
|
||||||
Area := IntersectArea(ObjArea, vArea);
|
Area := IntersectArea(objArea, visArea);
|
||||||
Engine.Jobqueue.AddJob(TDrawObjJob.Create(self, Objs, Area), Engine);
|
Engine.Jobqueue.AddJob(TDrawObjJob.Create(self, Objs, Area), Engine);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -719,6 +719,7 @@ begin
|
|||||||
if (APt.ExtraData <> nil) and APt.ExtraData.InheritsFrom(TDrawingExtraData) then
|
if (APt.ExtraData <> nil) and APt.ExtraData.InheritsFrom(TDrawingExtraData) then
|
||||||
ptColor := TDrawingExtraData(APt.ExtraData).Color;
|
ptColor := TDrawingExtraData(APt.ExtraData).Color;
|
||||||
DrawingEngine.PenColor := ptColor;
|
DrawingEngine.PenColor := ptColor;
|
||||||
|
DrawingEngine.PenWidth := 3;
|
||||||
DrawingEngine.Line(pt.X, pt.Y - 5, pt.X, pt.Y + 5);
|
DrawingEngine.Line(pt.X, pt.Y - 5, pt.X, pt.Y + 5);
|
||||||
DrawingEngine.Line(pt.X - 5, pt.Y, pt.X + 5, pt.Y);
|
DrawingEngine.Line(pt.X - 5, pt.Y, pt.X + 5, pt.Y);
|
||||||
pt.Y := pt.Y + 5;
|
pt.Y := pt.Y + 5;
|
||||||
@ -734,7 +735,7 @@ begin
|
|||||||
s := ' ' + s + ' ';
|
s := ' ' + s + ' ';
|
||||||
end;
|
end;
|
||||||
extent := DrawingEngine.TextExtent(s);
|
extent := DrawingEngine.TextExtent(s);
|
||||||
DrawingEngine.Textout(pt.X - extent.CX div 2, pt.Y + 5, s);
|
DrawingEngine.TextOut(pt.X - extent.CX div 2, pt.Y + 5, s);
|
||||||
finally
|
finally
|
||||||
GPSItems.Unlock;
|
GPSItems.Unlock;
|
||||||
end;
|
end;
|
||||||
@ -767,6 +768,7 @@ begin
|
|||||||
DrawingEngine.DrawBitmap(Pt.X - FPOIImage.Width div 2, Pt.Y - FPOIImage.Height, FPOIImage, true)
|
DrawingEngine.DrawBitmap(Pt.X - FPOIImage.Width div 2, Pt.Y - FPOIImage.Height, FPOIImage, true)
|
||||||
else begin
|
else begin
|
||||||
DrawingEngine.PenColor := ptColor;
|
DrawingEngine.PenColor := ptColor;
|
||||||
|
DrawingEngine.PenWidth := 3;
|
||||||
DrawingEngine.Line(Pt.X, Pt.Y - 5, Pt.X, Pt.Y + 5);
|
DrawingEngine.Line(Pt.X, Pt.Y - 5, Pt.X, Pt.Y + 5);
|
||||||
DrawingEngine.Line(Pt.X - 5, Pt.Y, Pt.X + 5, Pt.Y);
|
DrawingEngine.Line(Pt.X - 5, Pt.Y, Pt.X + 5, Pt.Y);
|
||||||
Pt.Y := Pt.Y + 5;
|
Pt.Y := Pt.Y + 5;
|
||||||
@ -1025,14 +1027,19 @@ end;
|
|||||||
|
|
||||||
function TMapView.GetVisibleArea: TRealArea;
|
function TMapView.GetVisibleArea: TRealArea;
|
||||||
var
|
var
|
||||||
aPt: TPoint;
|
mapWidth: Int64;
|
||||||
begin
|
begin
|
||||||
aPt.X := 0;
|
Result.TopLeft := Engine.ScreenToLonLat(Point(0, 0));
|
||||||
aPt.Y := 0;
|
Result.BottomRight := Engine.ScreenToLonLat(Point(Width, Height));
|
||||||
Result.TopLeft := Engine.ScreenToLonLat(aPt);
|
if Cyclic then
|
||||||
aPt.X := Width;
|
begin
|
||||||
aPt.Y := Height;
|
mapWidth := ZoomFactor(Engine.Zoom) * TILE_SIZE;
|
||||||
Result.BottomRight := Engine.ScreenToLonLat(aPt);
|
if Width >= mapWidth then
|
||||||
|
begin
|
||||||
|
Result.TopLeft.Lon := -180;
|
||||||
|
Result.BottomRight.Lon := 180;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMapView.ClearBuffer;
|
procedure TMapView.ClearBuffer;
|
||||||
|
Reference in New Issue
Block a user