Add initial version of microG maps theme

This commit is contained in:
Marvin W 2016-09-24 22:07:54 +02:00
parent b732ef8b29
commit 27ec511f5f
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
10 changed files with 495 additions and 8 deletions

2
extern/vtm vendored

@ -1 +1 @@
Subproject commit b18dae5bef355c922e7ec9497c6ddbbe48061514
Subproject commit ec4f12b576906b01d8bf2f1033c8014b6affeb8b

View File

@ -31,7 +31,7 @@ dependencies {
compile project(':vtm-android')
compile project(':vtm-extras')
compile project(':vtm-jts')
compile project(':vtm-themes')
compile project(':vtm-microg-theme')
}
String getMyVersionName() {

View File

@ -170,7 +170,8 @@ public class BackendMap implements ItemizedLayer.OnItemGestureListener<MarkerIte
public synchronized void remove(Markup markup) {
if (markup instanceof MarkerItemMarkup) {
markupMap.remove(markup.getId());
mapView.items().removeItem(mapView.items().getByUid(markup.getId()));
MarkerItem toRemove = getByUid(markup.getId());
if (toRemove != null) mapView.items().removeItem(toRemove);
} else if (markup instanceof DrawableMarkup) {
drawableMarkups.remove(markup);
updateDrawableLayer();
@ -179,10 +180,19 @@ public class BackendMap implements ItemizedLayer.OnItemGestureListener<MarkerIte
redraw();
}
private MarkerItem getByUid(String uid) {
for (MarkerItem markerItem : mapView.items().getItemList()) {
if (markerItem.getUid().equals(uid)) {
return markerItem;
}
}
return null;
}
public synchronized void update(Markup markup) {
if (markup == null) return;
if (markup instanceof MarkerItemMarkup) {
MarkerItem item = mapView.items().getByUid(markup.getId());
MarkerItem item = getByUid(markup.getId());
if (item != null) {
mapView.items().removeItem(item);
}

View File

@ -38,7 +38,7 @@ import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
import org.oscim.map.Layers;
import org.oscim.theme.VtmThemes;
import org.oscim.theme.MicrogThemes;
import org.oscim.tiling.ITileCache;
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
@ -157,6 +157,6 @@ public class BackendMapView extends MapView {
layers.add(buildings = new BuildingLayer(map(), baseLayer));
layers.add(items = new ItemizedLayer<MarkerItem>(map(), new MarkerSymbol(
new AndroidBitmap(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.nop)), 0.5F, 1)));
map().setTheme(VtmThemes.DEFAULT);
map().setTheme(MicrogThemes.DEFAULT);
}
}

View File

@ -26,6 +26,6 @@ include ':vtm'
include ':vtm-android'
include ':vtm-extras'
include ':vtm-jts'
include ':vtm-themes'
include ':vtm-microg-theme'
include ':remote-droid-guard-lib'

View File

@ -0,0 +1,11 @@
apply plugin: 'java'
apply plugin: 'maven'
dependencies {
compile project(':vtm')
}
sourceSets {
main.java.srcDirs = ['src']
main.resources.srcDirs = ['resources']
}

View File

@ -0,0 +1,422 @@
<?xml version="1.0" encoding="UTF-8"?>
<rendertheme base-text-scale="1.25" map-background="#F0EDE5"
version="1" xmlns="http://opensciencemap.org/rendertheme"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
<style-line cap="butt" fix="true" id="fix" width="1.0"/>
<style-text fill="#AA333333" id="road:z12" k="name" priority="2" size="14" stroke="#eeeeee"
stroke-width="2.0"/>
<style-text fill="#AA333333" id="road:z13" k="name" priority="3" size="14" stroke="#eeeeee"
stroke-width="2.0"/>
<style-text fill="#AA333333" id="road:z14" k="name" priority="4" size="14" stroke="#eeeeee"
stroke-width="2.0"/>
<style-text fill="#AA333333" id="road:z16" k="name" priority="6" size="14" stroke="#eeeeee"
stroke-width="2.0"/>
<style-area fill="#33AA0000" id="debug" stroke="#FF0000" stroke-width="1"/>
<style-line id="debug" stroke="#00FF00"/>
<style-line id="building" stroke="#dcdcdc" use="fix" width="1.0"/>
<style-line id="sub-building" stipple="10" stipple-stroke="#00000000" stipple-width="1.0"
use="building"/>
<style-area fill="#fff2f2f2" id="building" mesh="true"/>
<style-line cap="square" id="road-fix" use="fix"/>
<style-line id="tertiary:z12" stroke="#ffffff" use="fix" width="1.0"/>
<style-line id="secondary:z12" stroke="#ffffff" use="fix" width="1.0"/>
<style-line id="primary:z12" stroke="#ffebaf" use="fix" width="1.0"/>
<style-line id="motorway_link:z12" stroke="#fde7c4" use="fix" width="1.0"/>
<style-line id="motorway:z12" stroke="#fed89d" use="fix" width="1.5"/>
<style-line id="walkway:z18" stroke="#ffffff" width="0.3"/>
<style-line id="pedestrian:z18" stroke="#ffffff" width="0.7"/>
<style-line id="residential:z18" stroke="#ffffff" width="1.0"/>
<style-line id="tertiary:z18" stroke="#ffffff" width="1.2"/>
<style-line id="secondary:z18" stroke="#ffffff" width="1.4"/>
<style-line id="primary:z18" stroke="#ffebaf" width="1.6"/>
<style-line id="motorway_link:z18" stroke="#fde7c4" width="1.1"/>
<style-line id="motorway:z18" stroke="#fed89d" width="2.0"/>
<style-line id="waterstream:z18" stroke="#A3CCFF" width="0.2"/>
<style-area fill="#CBE6A3" id="green"/>
<style-area blend="10" blend-fill="#D6E9B9" fill="#D4E4C9" id="lightgreen"/>
<style-area blend="10" blend-fill="#DDE6D5" fill="#D4E4C9" id="graygreen"/>
<style-area blend="10" blend-fill="#DAE8D1" fill="#D4E4C9" id="sportgreen"/>
<style-area blend="14" blend-fill="#EAEAEA" fill="#F0E0C8" id="city"/>
<style-area fill="#F9EDF1" id="medical"/>
<style-area fill="#E4E4DF" id="education"/>
<style-area fill="#EAEAEA" id="residential"/>
<m closed="yes" k="landuse" v="residential">
<area use="residential"/>
</m>
<m closed="yes" k="leisure" v="playing_fields|pitch|sports_centre|stadium">
<area use="sportgreen"/>
</m>
<m closed="yes" k="landuse" v="forest">
<area use="lightgreen"/>
</m>
<m closed="yes" k="leisure" v="park|garden">
<area use="green"/>
</m>
<m closed="yes" k="leisure" v="golf_course|miniature_golf">
<area use="graygreen"/>
</m>
<m closed="yes" k="landuse" v="cemetery">
<area use="lightgreen"/>
</m>
<m closed="yes" k="amenity" v="grave_yard">
<area use="lightgreen"/>
</m>
<m closed="yes" k="landuse" v="retail" zoom-max="18">
<area use="city"/>
</m>
<m closed="yes" k="amenity" v="marketplace">
<area use="city"/>
</m>
<m closed="yes" k="highway" v="pedestrian">
<area use="city"/>
</m>
<m closed="yes" k="amenity" v="college|university|school|kindergarten">
<area use="education"/>
</m>
<m closed="yes" k="amenity" v="hospital|clinic">
<area use="medical"/>
</m>
<m closed="no" k="boundary" v="administrative">
<m k="admin_level" v="1|2">
<line fix="true" stroke="#555555" width="2.0"/>
</m>
<m k="admin_level" v="3|4" zoom-min="7">
<line fix="true" stipple="20" stipple-stroke="#00888888" stroke="#88888888"
width="1.5"/>
</m>
</m>
<m k="waterway">
<m k="waterway" v="stream">
<line use="waterstream:z18"/>
</m>
</m>
<m closed="yes" k="natural" v="water">
<area fill="#A3CCFF"/>
</m>
<m e="way">
<outline-layer fix="true" id="motorway:z12" stroke="#7ac87800" width="1.2"/>
<outline-layer fix="true" id="motorway_link:z12" stroke="#47fea200" width="0.8"/>
<outline-layer fix="true" id="primary:z12" stroke="#65ca9f00" width="1.4"/>
<outline-layer fix="true" id="motorway:z18" stroke="#7ac87800" width="1.8"/>
<outline-layer fix="true" id="motorway_link:z18" stroke="#47fea200" width="1.2"/>
<outline-layer fix="true" id="primary:z18" stroke="#65ca9f00" width="2.1"/>
<!--<outline-layer id="primary" stroke="#aa7f7700" width="0.1"/>-->
<m k="highway">
<m k="area" v="~|no|false">
<m k="tunnel" v="yes|true">
<m k="highway" v="path|cycleway|footway|track|steps">
<line stipple="1" stipple-stroke="#00000000" use="walkway:z18"/>
</m>
<m k="highway" v="trunk_link|motorway_link">
<m zoom-max="13">
<line outline="motorway_link:z12" stroke="#80fdf0db"
use="motorway_link:z12"/>
</m>
<m zoom-min="13">
<line outline="motorway_link:z18" stroke="#80fdf0db"
use="motorway_link:z18"/>
</m>
</m>
<m k="highway" v="pedestrian">
<line fade="13" stroke="#80ffffff" use="pedestrian:z18"/>
</m>
<m k="highway" v="residential|road|living_street|unclassified">
<line fade="13" stroke="#80ffffff" use="residential:z18"/>
</m>
<m k="highway" v="tertiary|secondary_link">
<line stroke="#80ffffff" use="tertiary:z12"/>
<line stroke="#80ffffff" use="tertiary:z18"/>
</m>
<m k="highway" v="secondary|primary_link">
<line stroke="#80ffffff" use="secondary:z12"/>
<line stroke="#80ffffff" use="secondary:z18"/>
</m>
<m k="highway" v="primary">
<m zoom-max="13">
<line outline="primary:z12" stroke="#80fffaea" use="primary:z12"/>
</m>
<m zoom-min="13">
<line outline="primary:z18" stroke="#80fffaea" use="primary:z18"/>
</m>
</m>
<m k="highway" v="motorway|trunk">
<m zoom-max="13">
<line outline="motorway:z12" stroke="#80fef0db" use="motorway:z12"/>
</m>
<m zoom-min="13">
<line outline="motorway:z12" stroke="#80fef0db" use="motorway:z18"/>
</m>
<outline outline="motorway"/>
</m>
</m>
<m k="tunnel|bridge" v="~|no">
<m k="highway" v="path|cycleway|footway|track|steps">
<line use="walkway:z18"/>
<text use="road:z16"/>
</m>
<m k="highway" v="trunk_link|motorway_link">
<m zoom-max="13">
<line outline="motorway_link:z12" use="motorway_link:z12"/>
</m>
<m zoom-min="13">
<line outline="motorway_link:z18" use="motorway_link:z18"/>
</m>
</m>
<m k="highway" v="residential|road|living_street|pedestrian|unclassified">
<m k="highway" v="pedestrian">
<line fade="13" use="pedestrian:z18"/>
</m>
<m k="highway" v="-|pedestrian">
<line fade="13" use="residential:z18"/>
</m>
<m zoom-min="14">
<text use="road:z14"/>
</m>
</m>
<m k="highway" v="tertiary|secondary_link">
<line use="tertiary:z12"/>
<line use="tertiary:z18"/>
<m zoom-min="13">
<text use="road:z13"/>
</m>
</m>
<m k="highway" v="secondary|primary_link">
<line use="secondary:z12"/>
<line use="secondary:z18"/>
<m zoom-min="12">
<text use="road:z12"/>
</m>
</m>
<m k="highway" v="primary">
<m zoom-max="13">
<line outline="primary:z12" use="primary:z12"/>
</m>
<m zoom-min="13">
<line outline="primary:z18" use="primary:z18"/>
</m>
<m zoom-min="12">
<text use="road:z12"/>
</m>
</m>
<m k="highway" v="motorway|trunk">
<m zoom-max="13">
<line outline="motorway:z12" use="motorway:z12"/>
</m>
<m zoom-min="13">
<line outline="motorway:z18" use="motorway:z18"/>
</m>
<outline outline="motorway"/>
</m>
</m>
<m k="bridge">
<outline-layer id="bridge" stroke="#88202020" width="0.08"/>
<m k="bridge" v="-|no|false">
<m k="area" v="~|no|false">
<m v="track|footway|path|cycleway|steps">
<line cap="butt" outline="bridge" use="walkway:z18"/>
</m>
<m select="first">
<m v="footway|cycleway|track|path|bridleway">
<line use="walkway:z18"/>
</m>
<!--<m v="construction">
<line cap="square" outline="bridge" use="construction" />
</m>
<m v="service">
<line cap="square" outline="bridge" use="highway-service" />
</m>-->
</m>
<m select="first">
<m v="byway|pedestrian">
<line outline="bridge" use="pedestrian:z18"/>
<text use="road:z16"/>
</m>
<m v="residential|road|unclassified|living_street">
<line outline="bridge" use="residential:z18"/>
<text use="road:z14"/>
</m>
</m>
<m select="first">
<m v="tertiary|secondary_link">
<line cap="square" outline="bridge" use="tertiary:z18"/>
<text use="road:z13"/>
</m>
<m v="trunk_link|motorway_link">
<m zoom-max="13">
<line cap="square" outline="bridge"
use="motorway_link:z12"/>
</m>
<m zoom-min="13">
<line cap="square" outline="bridge"
use="motorway_link:z18"/>
</m>
</m>
<m v="secondary|primary_link">
<line cap="square" outline="bridge" use="secondary:z18"/>
<text use="road:z12"/>
</m>
<m v="primary">
<m zoom-max="13">
<line cap="square" outline="bridge" use="primary:z12"/>
</m>
<m zoom-min="13">
<line cap="square" outline="bridge" use="primary:z18"/>
</m>
</m>
<m v="motorway|trunk">
<m zoom-max="13">
<line cap="square" outline="bridge" use="motorway:z12"/>
</m>
<m zoom-min="13">
<line cap="square" outline="bridge" use="motorway:z18"/>
</m>
</m>
</m>
</m>
<m k="area" select="first" v="yes|true">
<m v="footway" zoom-min="15">
<area fill="#fefefe"/>
<line cap="butt" stroke="#c0c0c0" width="0.15"/>
</m>
<m v="pedestrian|service|unclassified|residential|road|living_street"
zoom-min="13">
<area fill="#eeffffff"/>
<line cap="butt" fix="true" stroke="#c0c0c0" width="1.0"/>
</m>
</m>
</m>
</m>
</m>
</m>
</m>
<m k="railway" v="tram|light_rail|subway|narrow_gauge|rail">
<m k="tunnel" v="~|no">
<line stipple="20" stipple-stroke="#AAAAAA" stipple-width="0.1" stroke="#CCCCCC"
use="fix"/>
</m>
<m k="tunnel" v="yes">
<line stipple="20" stipple-stroke="#AAAAAA" stipple-width="1.0" stroke="#00000000"
use="fix"/>
</m>
</m>
<m k="highway|railway|public_transport" v="platform">
<m k="tunnel" v="~|no">
<line use="building"/>
<area use="building"/>
</m>
<m k="tunnel" v="yes">
<line use="sub-building"/>
</m>
</m>
<m k="building">
<m k="indoor|tunnel" v="yes">
<line use="sub-building"/>
</m>
<m k="indoor|tunnel" v="~|no">
<line use="building"/>
<m closed="yes">
<area use="building"/>
</m>
<extrusion line-color="#ffdcdcdc" side-color="#66dcdcdc" top-color="#f2f2f2"/>
<caption style="bold" fill="#4040ff" k="name" priority="9" size="14"
stroke="#ffffff" stroke-width="2.0"/>
<caption style="bold" fill="#606060" k="addr:housenumber" priority="10" size="10"
stroke="#ffffff" stroke-width="2.0"/>
</m>
</m>
<m e="node" select="first">
<m k="place">
<m v="suburb" zoom-max="16" zoom-min="9">
<caption fill="#8B7F5F" k="name" priority="4" size="17"
stroke="#ffffff" stroke-width="2.0"/>
</m>
<m v="village" zoom-max="15" zoom-min="9">
<caption fill="#8B7F5F" k="name" priority="3" size="17" stroke="#ffffff"
stroke-width="2.0"/>
</m>
<m v="island" zoom-min="10">
<caption style="bold" fill="#000000" k="name" priority="1" size="20"
stroke="#ffffff" stroke-width="2.0"/>
</m>
<m v="town">
<m zoom-max="15" zoom-min="13">
<caption fill="#8B7F5F" k="name" priority="1" size="23" stroke="#ffffff"
stroke-width="2.0"/>
</m>
<m zoom-max="13" zoom-min="9">
<caption fill="#615942" k="name" priority="1" size="19"
stroke="#ffffff" stroke-width="2.0"/>
</m>
<m zoom-max="9">
<caption dy="14" fill="#000000" k="name" priority="1" size="16"
stroke="#ffffff" stroke-width="2.0"
symbol="assets:symbols/dot_white.svg"/>
</m>
</m>
<m v="city">
<m zoom-max="15" zoom-min="13">
<caption fill="#615942" k="name" priority="1" size="24" stroke="#ffffff"
stroke-width="2.0"/>
</m>
<m zoom-max="13" zoom-min="9">
<caption fill="#000000" k="name" priority="1" size="24"
stroke="#ffffff" stroke-width="2.0"/>
</m>
<m zoom-max="9">
<caption dy="14" fill="#000000" k="name" priority="1" size="19"
stroke="#ffffff" stroke-width="2.0"
symbol="assets:symbols/dot_white.svg"/>
</m>
</m>
<m v="country" zoom-max="9">
<caption style="bold" fill="#000000" k="name" priority="0" size="20"
stroke="#ffffff" stroke-width="2.0"/>
</m>
</m>
<m k="addr:housenumber" zoom-min="18">
<caption style="bold" fill="#606060" k="addr:housenumber" size="10" stroke="#ffffff"
stroke-width="2.0"/>
</m>
</m>
</rendertheme>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.0" width="580" height="580">
<metadata id="metadata1976"/>
<defs id="defs4">
<marker viewBox="0 0 10 10" refY="5" refX="10" orient="auto" markerWidth="4" markerUnits="strokeWidth" markerHeight="3" id="ArrowStart">
<path id="path2111" d="M 10 0 L 0 5 L 10 10 z"/>
</marker>
<marker viewBox="0 0 10 10" refY="5" orient="auto" markerWidth="4" markerUnits="strokeWidth" markerHeight="3" id="ArrowEnd">
<path id="path2108" d="M 0 0 L 10 5 L 0 10 z"/>
</marker>
</defs>
<circle id="path4175" cx="290" cy="290" r="91.4" fill="#fff" stroke="#000" stroke-linejoin="bevel" stroke-linecap="square" stroke-width="36"/>
</svg>

After

Width:  |  Height:  |  Size: 867 B

View File

@ -0,0 +1,32 @@
package org.oscim.theme;
import org.oscim.backend.AssetAdapter;
import java.io.InputStream;
public enum MicrogThemes implements ThemeFile {
DEFAULT("styles/microg.xml");
// TODO: night theme
private final String mPath;
MicrogThemes(String path) {
mPath = path;
}
@Override
public XmlRenderThemeMenuCallback getMenuCallback() {
return null;
}
@Override
public String getRelativePathPrefix() {
return "";
}
@Override
public InputStream getRenderThemeAsStream() {
return AssetAdapter.readFileAsStream(mPath);
}
}

View File

@ -1 +0,0 @@
extern/vtm/vtm-themes