Tag transform: simplify naming, #420
This commit is contained in:
parent
6af46cf8cc
commit
12070cee74
@ -303,10 +303,10 @@
|
||||
|
||||
<!-- tag-transform element -->
|
||||
<xs:complexType name="tag-transform">
|
||||
<xs:attribute name="k" type="xs:string" use="required" />
|
||||
<xs:attribute name="v" type="xs:string" use="optional" />
|
||||
<xs:attribute name="k-match" type="xs:string" use="required" />
|
||||
<xs:attribute name="v-match" type="xs:string" use="optional" />
|
||||
<xs:attribute name="match-k" type="xs:string" use="required" />
|
||||
<xs:attribute name="match-v" type="xs:string" use="optional" />
|
||||
<xs:attribute name="output-k" type="xs:string" use="required" />
|
||||
<xs:attribute name="output-v" type="xs:string" use="optional" />
|
||||
</xs:complexType>
|
||||
|
||||
<!-- rendertheme element -->
|
||||
|
@ -3,16 +3,16 @@
|
||||
version="1" xmlns="http://opensciencemap.org/rendertheme"
|
||||
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
|
||||
|
||||
<!--<tag-transform k="kind" v="building" k-match="building" v-match="yes" />-->
|
||||
<!--<tag-transform k="kind" v="building_part" k-match="building:part" v-match="yes" />-->
|
||||
<tag-transform k="root_id" k-match="ref" />
|
||||
<!--<tag-transform match-k="building" match-v="yes" output-k="kind" output-v="building" />-->
|
||||
<!--<tag-transform match-k="building:part" match-v="yes" output-k="kind" output-v="building_part" />-->
|
||||
<tag-transform match-k="ref" output-k="root_id" />
|
||||
|
||||
<tag-transform k="roof_color" k-match="roof:colour" />
|
||||
<tag-transform k="roof_direction" k-match="roof:direction" />
|
||||
<tag-transform k="roof_height" k-match="roof:height" />
|
||||
<tag-transform k="roof_material" k-match="roof:material" />
|
||||
<tag-transform k="roof_orientation" k-match="roof:orientation" />
|
||||
<tag-transform k="roof_shape" k-match="roof:shape" />
|
||||
<tag-transform match-k="roof:colour" output-k="roof_color" />
|
||||
<tag-transform match-k="roof:direction" output-k="roof_direction" />
|
||||
<tag-transform match-k="roof:height" output-k="roof_height" />
|
||||
<tag-transform match-k="roof:material" output-k="roof_material" />
|
||||
<tag-transform match-k="roof:orientation" output-k="roof_orientation" />
|
||||
<tag-transform match-k="roof:shape" output-k="roof_shape" />
|
||||
|
||||
<!-- base style for fixed width lines -->
|
||||
<style-line cap="butt" fix="true" id="fix" width="1.0" />
|
||||
|
@ -3,10 +3,10 @@
|
||||
version="1" xmlns="http://opensciencemap.org/rendertheme"
|
||||
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
|
||||
|
||||
<tag-transform k="render_height" k-match="height" />
|
||||
<tag-transform k="render_min_height" k-match="min_height" />
|
||||
<!--<tag-transform k="layer" v="building" k-match="building" v-match="yes" />-->
|
||||
<!--<tag-transform k="layer" v="building:part" k-match="building:part" v-match="yes" />-->
|
||||
<tag-transform match-k="height" output-k="render_height" />
|
||||
<tag-transform match-k="min_height" output-k="render_min_height" />
|
||||
<!--<tag-transform match-k="building" match-v="yes" output-k="layer" output-v="building" />-->
|
||||
<!--<tag-transform match-k="building:part" match-v="yes" output-k="layer" output-v="building:part" />-->
|
||||
|
||||
<!--###### TEXT styles ######-->
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2019 devemux86
|
||||
* Copyright 2016-2017 Longri
|
||||
* Copyright 2016 Andrey Novikov
|
||||
* Copyright 2018 Gustl22
|
||||
@ -1268,40 +1268,40 @@ public class XmlThemeBuilder extends DefaultHandler {
|
||||
}
|
||||
|
||||
private void tagTransform(String localName, Attributes attributes) {
|
||||
String k, v, matchKey, matchValue;
|
||||
k = v = matchKey = matchValue = null;
|
||||
String matchKey, matchValue, outputKey, outputValue;
|
||||
matchKey = matchValue = outputKey = outputValue = null;
|
||||
|
||||
for (int i = 0; i < attributes.getLength(); i++) {
|
||||
String name = attributes.getLocalName(i);
|
||||
String value = attributes.getValue(i);
|
||||
|
||||
switch (name) {
|
||||
case "k":
|
||||
k = value;
|
||||
break;
|
||||
case "v":
|
||||
v = value;
|
||||
break;
|
||||
case "k-match":
|
||||
case "match-k":
|
||||
matchKey = value;
|
||||
break;
|
||||
case "v-match":
|
||||
case "match-v":
|
||||
matchValue = value;
|
||||
break;
|
||||
case "output-k":
|
||||
outputKey = value;
|
||||
break;
|
||||
case "output-v":
|
||||
outputValue = value;
|
||||
break;
|
||||
default:
|
||||
logUnknownAttribute(localName, name, value, i);
|
||||
}
|
||||
}
|
||||
|
||||
if (k == null || k.isEmpty() || matchKey == null || matchKey.isEmpty()) {
|
||||
if (matchKey == null || matchKey.isEmpty() || outputKey == null || outputKey.isEmpty()) {
|
||||
log.debug("empty key in element " + localName);
|
||||
return;
|
||||
}
|
||||
|
||||
if (v == null && matchValue == null) {
|
||||
mTransformKeyMap.put(matchKey, k);
|
||||
if (matchValue == null && outputValue == null) {
|
||||
mTransformKeyMap.put(matchKey, outputKey);
|
||||
} else {
|
||||
mTransformTagMap.put(new Tag(matchKey, matchValue), new Tag(k, v));
|
||||
mTransformTagMap.put(new Tag(matchKey, matchValue), new Tag(outputKey, outputValue));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user