Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster polygon rendering #3

Closed
pauldendulk opened this issue May 7, 2014 · 6 comments
Closed

Faster polygon rendering #3

pauldendulk opened this issue May 7, 2014 · 6 comments
Assignees

Comments

@pauldendulk
Copy link
Member

The multi polygon has about 2870 nodes. Rendering is very slow and the UI (panning, zooming) stops working. Platform Mapsui Windows 8 Store App.

@pauldendulk pauldendulk self-assigned this May 7, 2014
@smremde
Copy link
Contributor

smremde commented Oct 14, 2014

@pauldendulk Is it possible, for large geometry datasets, to use the GDI rendering interface and a TileLayer ?

@pauldendulk
Copy link
Member Author

Yes, something like that could be possible. The Mapsui.Sample.Wpf project has a Shapefile sample that uses the RasterizingLayer. This uses the DefaultRenderer (in this case Mapsui.Rendering.Xaml) to create bitmaps from the shapefile vectors. You could create your own RasterizingTileLayer that works similarly. You could create a specific renderer instead of the default renderer.

Some notes:

  • The GDI renderer is not used in any of the projects that I work on and I am not sure if it works properly atm.
  • Threading might be an issue. Rendering on a background thread is often problematic. You might need to invoke it on the UI thread.
  • I don't see much future for GDI. I see a trend towards more hardware accelerated rendering. For Xamarin I now focus on OpenGL (through OpenTK) for Windows I would like to use DirectX (through SharpDX).
  • The current OpenGL renderer has no implementation for IRenderer.RenderToBitmapStream :(
  • A RasterizingTileLayer wil need a TileSchema. This could be created on the fly. Take the map extent. Calculate the square that contains that extent. Take that as the top tile. Split is in fours going down a number of levels.

@pauldendulk
Copy link
Member Author

I just committed an update to ShapeFileSample to fix the Mapsui.Samples.WinForms sample. This uses GDI rendering.

Also I did a quick test with GDI rendering in the RasterizingLayer. In Mapsui.Samples.Wpf.Window1.xaml.cs.ShapeFileClick I added this as first line:

       DefaultRendererFactory.Create = () => new Rendering.Gdi.GdiMapRenderer();

And added a reference to Mapsui.Rendering.Gdi. To my surprise this just worked :). Performance was actually not that much faster. The main benefit of your suggestion is the rasterization. Which platform you use for rasterization is less important, but it helps if it's fast.

@smremde
Copy link
Contributor

smremde commented Oct 15, 2014

A RasterizingTileLayer would only be advantageous if you can query your data spatially or cache tiles.

Which platform you use for rasterization is less important, but it helps if it's fast.

Yes, I hadn't looked closely at your library and I hadn't seen the RasterizingLayer!

Threading might be an issue. Rendering on a background thread is often problematic. You might need to invoke it on the UI thread.

GDI rendering would not have this issue.

@pauldendulk
Copy link
Member Author

A RasterizingTileLayer would only be advantageous if you can query your data spatially or cache tiles.
True, but I see spatially querying data (fetching just the data you need for the tile) as a separate issue. Others report this problem here: https://mapsui.codeplex.com/discussions/554838. Basically the problem in this case is the implementation of the ShapefileProvider. The IProvider.GetFeaturesInView has a BoundingBox parameter which could be used to fetch just that box from disk or database.

@pauldendulk
Copy link
Member Author

I am closing this issue. I added some more specific issues: #16, #17 and #18.

There are no plans to improve the performance of the WPF polygon rendering itself. If needed the RasterizingLayer can be used.

pauldendulk pushed a commit that referenced this issue Mar 2, 2017
pauldendulk pushed a commit that referenced this issue May 24, 2020
Removed body off double function ZoomTo()
inforithmics added a commit that referenced this issue Jun 1, 2022
use Sdk="Microsoft.NET.Sdk" and some conditional settings to better s…
pauldendulk pushed a commit that referenced this issue Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants