Recent

Author Topic: TMapViewer  (Read 103321 times)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8744
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: TMapViewer
« Reply #45 on: December 10, 2014, 04:39:34 pm »
At the present moment there is no package
Should be easy to packagify, if the difference with original package is only at the rendering part. I'll take a look later since I don't have any needs for map ATM.

ti_dic

  • New member
  • *
  • Posts: 8
Re: TMapViewer
« Reply #46 on: December 10, 2014, 05:07:19 pm »
No i rewrited some part from 0 because i'm new in lazarus(i'm more skilled with delphi), and i think it's a good manner to learn.

actually need the patch for issue 27144 for correctly drawing

« Last Edit: December 10, 2014, 05:13:50 pm by ti_dic »

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: TMapViewer
« Reply #47 on: March 18, 2015, 03:55:18 pm »
Nice component, Maciej! Hope you carry on with the development.
Esp. I wonder how to convert the long/lat coordinates into screen values. That means I'm looking for an inverse GetMouseMapLongLat() function. Reason is pretty simple: I'd like to draw into the map. Thanks in advance.
Lazarus 1.7 (SVN) FPC 3.0.0

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: TMapViewer
« Reply #48 on: March 18, 2015, 07:03:36 pm »
Look at GetMouseMapPixel

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: TMapViewer
« Reply #49 on: March 18, 2015, 07:08:08 pm »
I did. But what I want is to convert long/lat (extended) to x/y (integer) depending on zoom level.
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1591
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: TMapViewer
« Reply #50 on: March 18, 2015, 07:56:12 pm »
No i rewrited some part from 0 because i'm new in lazarus(i'm more skilled with delphi), and i think it's a good manner to learn.

actually need the patch for issue 27144 for correctly drawing

That issue should be moved from "Packages" to "LCL" ...

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: TMapViewer
« Reply #51 on: March 18, 2015, 10:35:32 pm »
I did. But what I want is to convert long/lat (extended) to x/y (integer) depending on zoom level.

SetCenterLongLat is close to what you want.

« Last Edit: March 18, 2015, 10:47:23 pm by engkin »

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: TMapViewer
« Reply #52 on: March 30, 2015, 03:34:11 pm »
SetCenterLongLat is close to what you want.
Thanks for the tip. Here is my solution:

Code: [Select]
function TMapViewer.GetLongLatMap(AValue: TRealPoint): TIntPoint;
var
  shift: Extended;
  mx, my: Extended;
  res: Extended;
begin
  shift := 2 * pi * EARTH_RADIUS / 2.0;
  mx := AValue.X * shift / 180.0;
  my := ln( tan((90 - AValue.Y) * pi / 360.0 )) / (pi / 180.0);

  my := my * shift / 180.0;

  res := (2 * pi * EARTH_RADIUS) / (TILE_SIZE * IntPower(FZoom));

  Result.X := abs(Round((mx + shift) / res + FX)) + dx;
  Result.Y := abs(Round((my + shift) / res + FY)) + dy;
end;
dx, dy are the former local values ax, ay assigned in RepaintMap().

Would be nice to have intermediate steps of zoom by stretch drawing tiles. It's a pity that Maciej doesn't continue the project.
« Last Edit: March 30, 2015, 03:38:11 pm by Ocye »
Lazarus 1.7 (SVN) FPC 3.0.0

magleft

  • Full Member
  • ***
  • Posts: 107
Re: TMapViewer
« Reply #53 on: December 25, 2015, 05:34:38 pm »
Hi to all.
I want to use a TMapviewer comptonent but i am confused.
Can anybody send a url to dowloand ?

Thanks a lot
windows 10 64

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: TMapViewer
« Reply #54 on: December 25, 2015, 07:11:57 pm »
Hi to all.
I want to use a TMapviewer comptonent but i am confused.
Can anybody send a url to dowloand ?

Thanks a lot

Maybe this post and/or this post?

magleft

  • Full Member
  • ***
  • Posts: 107
Re: TMapViewer
« Reply #55 on: December 25, 2015, 08:22:35 pm »
Thanks. Finally it's  so simple.
windows 10 64

Hansvb

  • Hero Member
  • *****
  • Posts: 602
Re: TMapViewer
« Reply #56 on: December 26, 2015, 11:41:26 am »
Is tmapviewer still maintained?

WimVan

  • Jr. Member
  • **
  • Posts: 85
Re: TMapViewer
« Reply #57 on: January 05, 2019, 11:24:43 pm »
Can't install the component.  LAZGRBraphic.lpk is missing ...
Useless, that's all I can say for the moment.

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: TMapViewer
« Reply #58 on: January 06, 2019, 12:02:48 am »
Can't install the component.  LAZGRBraphic.lpk is missing ...
Useless, that's all I can say for the moment.

Try the adaption that I put on CCR: https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/lazmapviewer/. I removed the dependence on rgbagraphics, but is has a memory leak. I cannot focus on this component at the moment, and would appreciate any contributions finding this leak in these ugly threads.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: TMapViewer
« Reply #59 on: January 12, 2019, 08:15:48 pm »
Can't install the component.  LAZGRBraphic.lpk is missing ...
Useless, that's all I can say for the moment.

Try the adaption that I put on CCR: https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/lazmapviewer/. I removed the dependence on rgbagraphics, but is has a memory leak. I cannot focus on this component at the moment, and would appreciate any contributions finding this leak in these ugly threads.

I think the code has a few memory leaks.

TLaunchDownloadJob.ExecuteTask in unit mvEngine creates two objects (TEnvTile and TEventJob):
Code: Pascal  [Select][+][-]
  1. procedure TLaunchDownloadJob.ExecuteTask(aTask: integer; FromWaiting: boolean);
  2. ..
  3.   Queue.AddUniqueJob(TEventJob.Create
  4.     (
  5.       @Engine.evDownload,
  6.       TEnvTile.Create(FTiles[iTile], Win),
  7.       false,                                    // owns data
  8.       Engine.GetTileName(FTiles[iTile])
  9.     ),
  10.     Launcher
  11.   );
  12. ..

They do not get freed always, as seen in unit mvJobQueue:
Code: Pascal  [Select][+][-]
  1. function TJobQueue.AddUniqueJob(aJob: TJob; Launcher: TObject): boolean;
  2. ..
  3.       if Length(lst) = 0 then
  4.         Jobs.Add(aJob)  //<--- may get freed
  5.       else
  6. //will not get freed

also seen in unit mvEngine:
Code: Pascal  [Select][+][-]
  1. procedure TMapViewerEngine.evDownload(Data: TObject; Job: TJob);
  2. ..
  3.   if Job.Cancelled then
  4.     Exit; //<--- TEnvTile will not get freed
  5. ..
  6. //If it reaches here "TEnvTile" may get freed inside TileDownloaded.

There maybe other ways/sources that cause leaks.
« Last Edit: January 12, 2019, 08:19:55 pm by engkin »

 

TinyPortal © 2005-2018