Coder Social home page Coder Social logo

Faster polygon rendering about mapsui HOT 6 CLOSED

mapsui avatar mapsui commented on May 23, 2024
Faster polygon rendering

from mapsui.

Comments (6)

smremde avatar smremde commented on May 23, 2024

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

from mapsui.

pauldendulk avatar pauldendulk commented on May 23, 2024

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.

from mapsui.

pauldendulk avatar pauldendulk commented on May 23, 2024

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.

from mapsui.

smremde avatar smremde commented on May 23, 2024

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.

from mapsui.

pauldendulk avatar pauldendulk commented on May 23, 2024

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.

from mapsui.

pauldendulk avatar pauldendulk commented on May 23, 2024

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.

from mapsui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.