Skip to content

Commit 31ab0a7

Browse files
authored
Render themes: add header element "map-background-outside" (#1262)
1 parent 004e2d7 commit 31ab0a7

File tree

21 files changed

+57
-30
lines changed

21 files changed

+57
-30
lines changed

docs/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Next version
44

5+
- Render themes: `map-background-outside` [#1262](https://github.com/mapsforge/vtm/pull/1262)
56
- `ThemeCallback.getColor` method [#1251](https://github.com/mapsforge/vtm/pull/1251)
67
- Map theme improvements
78
- Minor improvements and bug fixes

docs/Rendertheme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,14 @@ At the moment, the following rendering instructions are available:
7676

7777
The following header elements can be used:
7878
- `map-background`: a color value to set the color of a blank tile. This should not be used to set the color of the sea or land. Default is `#FFFFFF`.
79+
- `map-background-outside`: a color value to set the color of the background of a map outside the map area. Effectively everything outside the map area will be overwritten by this color. For transparent layers, the color value will be ignored, but the outside area will be erased to transparent.
7980
- `base-stroke-width`: set the basic width of strokes. Default is `1`.
8081
- `base-text-scale`: set the overall text scale. Default is `1`.
8182

8283
```xml
8384
<?xml version="1.0" encoding="UTF-8"?>
8485
<rendertheme xmlns="http://opensciencemap.org/rendertheme" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
85-
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd" version="1" map-background="#FFFCFA">
86+
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd" version="1" map-background="#FFFCFA" map-background-outside="#DDDDDD">
8687
8788
</rendertheme>
8889
```

resources/rendertheme.xsd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@
354354
</xs:sequence>
355355
<xs:attribute name="version" type="xs:positiveInteger" use="required" />
356356
<xs:attribute name="map-background" default="#ffffff" type="tns:color" use="optional" />
357+
<xs:attribute name="map-background-outside" default="#ffffff" type="tns:color"
358+
use="optional" />
357359
<xs:attribute name="base-stroke-width" default="1" type="tns:nonNegativeFloat"
358360
use="optional" />
359361
<xs:attribute name="base-text-scale" default="1" type="tns:nonNegativeFloat"

vtm-playground/src/org/oscim/test/DebugTheme.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public int getMapBackground() {
3838
return 0;
3939
}
4040

41+
@Override
42+
public int getMapBackgroundOutside() {
43+
return 0;
44+
}
45+
4146
@Override
4247
public boolean isMapsforgeTheme() {
4348
return false;

vtm-playground/src/org/oscim/test/ThemeBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class ThemeBuilder {
2222

2323
protected int mLevels = 0;
2424
protected int mMapBackground = 0xffffffff;
25+
protected int mMapBackgroundOutside = 0xffffffff;
2526
protected float mBaseTextSize = 1;
2627

2728
protected RuleBuilder mCurrentRule;
@@ -33,7 +34,7 @@ public RenderTheme build() {
3334
for (int i = 0, n = rules.length; i < n; i++)
3435
rules[i] = mRulesList.get(i).onComplete(layer);
3536

36-
RenderTheme theme = new RenderTheme(mMapBackground, mBaseTextSize, rules, mLevels);
37+
RenderTheme theme = new RenderTheme(mMapBackground, mMapBackgroundOutside, mBaseTextSize, rules, mLevels);
3738

3839
mRulesList.clear();
3940
mRuleStack.clear();

vtm-themes/resources/assets/vtm/biker.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<rendertheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" map-background="#e8eae1"
3-
version="1" xmlns="http://opensciencemap.org/rendertheme"
3+
map-background-outside="#DDDDDD" version="1" xmlns="http://opensciencemap.org/rendertheme"
44
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
55

66
<!-- This is the 2nd generation OpenGL/VTM "Biker" theme -->

vtm-themes/resources/assets/vtm/dark.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<rendertheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" map-background="#262626"
3-
version="1" xmlns="http://opensciencemap.org/rendertheme"
3+
map-background-outside="#222222" version="1" xmlns="http://opensciencemap.org/rendertheme"
44
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
55

66
<!-- This is the 2nd generation OpenGL/VTM "dark" theme based on the Biker map theme -->

vtm-themes/resources/assets/vtm/default.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<rendertheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" map-background="#fffcfa"
3-
version="1" xmlns="http://opensciencemap.org/rendertheme"
3+
map-background-outside="#DDDDDD" version="1" xmlns="http://opensciencemap.org/rendertheme"
44
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
55

66
<!--###### TRANSFORM tags ######-->

vtm-themes/resources/assets/vtm/indigo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<rendertheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" map-background="#0d1a26"
3-
version="1" xmlns="http://opensciencemap.org/rendertheme"
3+
map-background-outside="#222222" version="1" xmlns="http://opensciencemap.org/rendertheme"
44
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
55

66
<!-- This is the OpenGL/VTM "Indigo" theme based on the Biker map theme -->

vtm-themes/resources/assets/vtm/mapzen.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<rendertheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" map-background="#fffcfa"
3-
version="1" xmlns="http://opensciencemap.org/rendertheme"
3+
map-background-outside="#DDDDDD" version="1" xmlns="http://opensciencemap.org/rendertheme"
44
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
55

66
<!--<tag-transform k="kind" v="building" k-lib="building" v-lib="yes" />-->

0 commit comments

Comments
 (0)