map_features.xml is currently 3742 lines. That's quite horrible.

I've added support for includes, so we can split it into several files. It works like this:

        [...beginning of map_features.xml...]
        <include file="map_features/roads.xml" />
        [...rest of map_features.xml]

and then in roads.xml:

        <featureGroup>
                <feature name="Motorway">
                        <category>roads</category>
                        <line/>
                        <tag k="highway" v="motorway"/>
                        <inputSet ref="majorRoad"/>
                        <inputSet ref="common"/>
                </feature>
                <feature name="Trunk">
                        <category>roads</category>
                        <line/>
                        <tag k="highway" v="trunk"/>
                        <inputSet ref="majorRoad"/>
                        <inputSet ref="common"/>
                </feature>
                [...and so on...]
        </featureGroup>

Some stuff to note:

- It's internally assembled into one big XML file before parsing. So you can happily refer from an include file to inputSets within the main file.

- The include file must be a well-formed XML document. In other words: a single root node. I suggest that the root node is <featureGroup>, containing a bunch of <feature>s, and that <inputSet>s and <category>s stay in mapfeatures.xml (because they need to be children of <mapFeatures>.

- All filepaths are resolved from the SWF's base path, _not_ the XML file's path. So if you include "map_features/roads.xml", and that then tries to include a further file, you'll still need to specify "map_features/minor_roads.xml"

- resources/ is getting overcrowded and it'd make sense to put all but the root map_features.xml into a map_features/ directory.

For anyone who's interested, http://trac.openstreetmap.org/browser/applications/editors/potlatch2/net/systemeD/halcyon/NestedXMLLoader.as is the code. Looks simple but took me hours largely due to closure scoping issues. :(

cheers
Richard

_______________________________________________
Potlatch-dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/potlatch-dev

Reply via email to