[OSM-dev] Multipolygon decoding

Michael Zangl openstreetmap at michael.fam-zangl.net
Sun Jan 3 23:21:03 UTC 2016


Josm renders them and only uses it's own Java objects after reading the
XML. There are two rendering phases: Collecting the styles to be
rendered and then painting everything on the screen.

Here are some hints on where to get started:

The generation of styles for a multipolygon is triggered here:
> https://github.com/openstreetmap/josm/blob/7a780ca01e8b2b31fbfa243af1db37d032ba7853/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java#L367

Style collection (finding what needs to be drawn):
> https://github.com/openstreetmap/josm/blob/7a780ca01e8b2b31fbfa243af1db37d032ba7853/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java#L1837

We inherit the style of the surrounding ways from the multipolygon. That
way, multipolygon borders can be rendered like normal ways.
> https://github.com/openstreetmap/josm/blob/7a780ca01e8b2b31fbfa243af1db37d032ba7853/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java#L203

Old (deprecated) polygons inherit their style from the outer lines:
> https://github.com/openstreetmap/josm/blob/7a780ca01e8b2b31fbfa243af1db37d032ba7853/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java#L301

And finally the real rendering of the area (borders are rendered since
their line segments got the style from the multipolygon).
> https://github.com/openstreetmap/josm/blob/7a780ca01e8b2b31fbfa243af1db37d032ba7853/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java#L615


Am 03.01.2016 um 23:24 schrieb Mikoláš Štrajt:
> Hello,
> I am developing my own rendering software and I struggled on decoding 
> multipolygon relations. It seems to be bit tricky. I tried to found some 
> info about it, but all I found is this wiki page: http://wiki.openstreetmap.
> org/wiki/Relation:multipolygon/Algorithm
> Can you point to some example of code decoding multipolygons? I would 
> especially like something that will be written with renderer in mind (ie 
> source code is part of some renderer).
> Note that my software decodes OSM XML file itself, I don't want to use 
> PostGIS as backend.
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev

More information about the dev mailing list