Recent

Author Topic: Very rough version of a shape file viewer.  (Read 1509 times)

Xenno

  • Full Member
  • ***
  • Posts: 160
    • BS Programs
Re: Very rough version of a shape file viewer.
« Reply #15 on: June 28, 2026, 07:29:08 am »
Hi, Hansvb

That's awesome. I'll be expecting the result. I'm sure you'll find multithreading is fun especially to fight against ANR flag.

Anyway, below is a screenshot of my version that displays GeoJSONs (multi-layer). I don't use PaintBox cause I don't think I would be able to achieve.
Lazarus 4.6, Windows 10, https://www.youtube.com/@bsprograms
If I want to share, I give. If I want money, I sell. I don't set traps.

Hansvb

  • Hero Member
  • *****
  • Posts: 936
Re: Very rough version of a shape file viewer.
« Reply #16 on: June 28, 2026, 09:17:00 am »
Hi Xenno,

In my last experiment I left tpaintbox and use bgrabitmap. With that I can draw donuts in polygons in both Windows and Linux. With the paintbox I could only draw donuts properly with a specific windows function. What do you draw on when you don't use a paintbox? Tcanvas?

I'm still a bit stuck with the speed of drawing in combination with zooming. I simplify the polygons to their bounding box when using pan and zoom but it doesn't feel that fast yet. It is workable, but it must be possible to do better.

I can put my current code here but it is still very much in the experimental phase. When I have the first parts working a bit I will start clean based on cdbc's mvp framework.

Your viewer looks good. Nice work.


Xenno

  • Full Member
  • ***
  • Posts: 160
    • BS Programs
Re: Very rough version of a shape file viewer.
« Reply #17 on: June 28, 2026, 10:28:42 am »
Hi, Hansvb

In that viewer, I let the TMapViewer do all the jobs. For GeoJSON, I just map file as TMapLayer and features as TMapArea or TMapTrack or TMapPointOfInterest according to their geometry types. The mapping process is done in separated thread.

Since I only have dial-up (phone thetering), the only bottleneck is when it needs to refresh map tiles from internet. Other than that I think TMapViewer draws very fast eventhough I only use its default drawing engine. For my laptop i5 M520 RAM 4GB, I notice TMapViewer still delivers acceptable performance viewing, zooming, scrolling, etc. map with 5 layers. I admit I activate DoubleBuffered for the panel where TMapViewer placed, though. This is the first time I have to use double buffer.

Thank you for your kindness about that app look. It is just a simple app with out-of-the-box Lazarus's components.
Lazarus 4.6, Windows 10, https://www.youtube.com/@bsprograms
If I want to share, I give. If I want money, I sell. I don't set traps.

 

TinyPortal © 2005-2018