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
|
||||
Left = 332
|
||||
Left = 381
|
||||
Height = 640
|
||||
Top = 183
|
||||
Top = 187
|
||||
Width = 883
|
||||
Caption = 'LazMapViewer'
|
||||
ClientHeight = 640
|
||||
|
@ -638,6 +638,7 @@ function TMapViewerEngine.DegreesToMapPixels(const AWin: TMapWindow;
|
||||
ALonLat: TRealPoint): TPoint;
|
||||
var
|
||||
pixelLocation: TPoint;
|
||||
mapWidth: Int64;
|
||||
begin
|
||||
case AWin.MapProvider.ProjectionType of
|
||||
ptEPSG3395: pixelLocation := DegreesToPixelsEPSG3395(AWin, ALonLat);
|
||||
@ -645,6 +646,14 @@ begin
|
||||
else pixelLocation := DegreesToPixelsEPSG3857(AWin, ALonLat);
|
||||
end;
|
||||
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;
|
||||
end;
|
||||
|
||||
@ -729,16 +738,16 @@ var
|
||||
begin
|
||||
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
|
||||
begin
|
||||
mPoint.X := (APoint.X - AWin.X) mod mapWidth;
|
||||
while mPoint.X < 0 do
|
||||
mPoint.X := mPoint.X + mapWidth;
|
||||
while mPoint.X >= mapWidth do
|
||||
mPoint.X := mPoint.X - mapWidth;
|
||||
end else
|
||||
mPoint.X := EnsureRange(APoint.X - AWin.X, 0, mapWidth);
|
||||
mPoint.Y := EnsureRange(APoint.Y - AWin.Y, 0, mapWidth);
|
||||
end;
|
||||
|
||||
case aWin.MapProvider.ProjectionType of
|
||||
ptEPSG3857: Result := PixelsToDegreesEPSG3857(mPoint, AWin.Zoom);
|
||||
|
@ -216,7 +216,7 @@ var
|
||||
i: integer;
|
||||
begin
|
||||
Result.Init(0, 0, 0, 0);
|
||||
if Objs.Count>0 then
|
||||
if Objs.Count > 0 then
|
||||
begin
|
||||
Result := Objs[0].BoundingBox;
|
||||
for i:=1 to pred(Objs.Count) do
|
||||
|
@ -280,7 +280,7 @@ constructor TDrawObjJob.Create(aViewer: TMapView; aLst: TGPSObjList;
|
||||
begin
|
||||
FArea := aArea;
|
||||
FLst := aLst;
|
||||
SetLEngth(FStates,FLst.Count);
|
||||
SetLength(FStates, FLst.Count);
|
||||
Viewer := aViewer;
|
||||
AllRun := false;
|
||||
Name := 'DrawObj';
|
||||
@ -603,15 +603,15 @@ end;
|
||||
procedure TMapView.OnGPSItemsModified(Sender: TObject; objs: TGPSObjList;
|
||||
Adding: boolean);
|
||||
var
|
||||
Area,ObjArea,vArea: TRealArea;
|
||||
Area, objArea, visArea: TRealArea;
|
||||
begin
|
||||
if Adding and Assigned(Objs) then
|
||||
begin
|
||||
ObjArea := GetAreaOf(Objs);
|
||||
vArea := GetVisibleArea;
|
||||
if hasIntersectArea(ObjArea,vArea) then
|
||||
objArea := GetAreaOf(Objs);
|
||||
visArea := GetVisibleArea;
|
||||
if hasIntersectArea(objArea, visArea) then
|
||||
begin
|
||||
Area := IntersectArea(ObjArea, vArea);
|
||||
Area := IntersectArea(objArea, visArea);
|
||||
Engine.Jobqueue.AddJob(TDrawObjJob.Create(self, Objs, Area), Engine);
|
||||
end
|
||||
else
|
||||
@ -719,6 +719,7 @@ begin
|
||||
if (APt.ExtraData <> nil) and APt.ExtraData.InheritsFrom(TDrawingExtraData) then
|
||||
ptColor := TDrawingExtraData(APt.ExtraData).Color;
|
||||
DrawingEngine.PenColor := ptColor;
|
||||
DrawingEngine.PenWidth := 3;
|
||||
DrawingEngine.Line(pt.X, pt.Y - 5, pt.X, pt.Y + 5);
|
||||
DrawingEngine.Line(pt.X - 5, pt.Y, pt.X + 5, pt.Y);
|
||||
pt.Y := pt.Y + 5;
|
||||
@ -734,7 +735,7 @@ begin
|
||||
s := ' ' + s + ' ';
|
||||
end;
|
||||
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
|
||||
GPSItems.Unlock;
|
||||
end;
|
||||
@ -767,6 +768,7 @@ begin
|
||||
DrawingEngine.DrawBitmap(Pt.X - FPOIImage.Width div 2, Pt.Y - FPOIImage.Height, FPOIImage, true)
|
||||
else begin
|
||||
DrawingEngine.PenColor := ptColor;
|
||||
DrawingEngine.PenWidth := 3;
|
||||
DrawingEngine.Line(Pt.X, Pt.Y - 5, Pt.X, Pt.Y + 5);
|
||||
DrawingEngine.Line(Pt.X - 5, Pt.Y, Pt.X + 5, Pt.Y);
|
||||
Pt.Y := Pt.Y + 5;
|
||||
@ -1025,14 +1027,19 @@ end;
|
||||
|
||||
function TMapView.GetVisibleArea: TRealArea;
|
||||
var
|
||||
aPt: TPoint;
|
||||
mapWidth: Int64;
|
||||
begin
|
||||
aPt.X := 0;
|
||||
aPt.Y := 0;
|
||||
Result.TopLeft := Engine.ScreenToLonLat(aPt);
|
||||
aPt.X := Width;
|
||||
aPt.Y := Height;
|
||||
Result.BottomRight := Engine.ScreenToLonLat(aPt);
|
||||
Result.TopLeft := Engine.ScreenToLonLat(Point(0, 0));
|
||||
Result.BottomRight := Engine.ScreenToLonLat(Point(Width, Height));
|
||||
if Cyclic then
|
||||
begin
|
||||
mapWidth := ZoomFactor(Engine.Zoom) * TILE_SIZE;
|
||||
if Width >= mapWidth then
|
||||
begin
|
||||
Result.TopLeft.Lon := -180;
|
||||
Result.BottomRight.Lon := 180;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMapView.ClearBuffer;
|
||||
|
Reference in New Issue
Block a user