Howto real time rendering with Java

From OpenStreetMap Wiki
Revision as of 06:47, 2 May 2015 by Xxzme (talk | contribs) (Category:Unsorted Technical guide)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

To render the map in real time using java there are multiple existing applications and libraries you may look at:

traveling salesman

For multiple implementations of rendering osm-data to a Java Graphics2D-object, look at the IPaintVisitor-interface in Traveling-Salesman's LibOSM.

There are currently 4 rendering engines to choose from:

  • ODRPaintVisitor - paints very nice maps
  • SimplePaintVisitor - is trivial and easy to understand
  • TilePaintVisitor - downloads and caches tile-images from the network
  • SmoothTilePainter - same but downloads asynchronously

To render you can optain a MemoryDataSet from a FileLoader like in the following example.

JOSM

To look at how josm paints the map for editing, you may look at the OsmDataLayer-class that uses the SimplePaintvisitor-class.