Render themes: add tessellation option in area style, closes #37

This commit is contained in:
Emux
2016-06-25 16:26:03 +03:00
parent d97511e1e1
commit 9b7d893fd5
4 changed files with 19 additions and 2 deletions

View File

@@ -98,6 +98,7 @@
<xs:attribute name="fade" type="xs:integer" use="optional" default="-1" /> <xs:attribute name="fade" type="xs:integer" use="optional" default="-1" />
<xs:attribute name="blend" type="xs:integer" use="optional" default="-1" /> <xs:attribute name="blend" type="xs:integer" use="optional" default="-1" />
<xs:attribute name="blend-fill" type="tns:color" use="optional" default="#000000" /> <xs:attribute name="blend-fill" type="tns:color" use="optional" default="#000000" />
<xs:attribute name="mesh" type="xs:boolean" use="optional" default="false" />
</xs:complexType> </xs:complexType>
<xs:complexType name="caption"> <xs:complexType name="caption">

View File

@@ -285,7 +285,7 @@ public class VectorTileLoader extends TileLoader implements RenderStyle.Callback
int nLevel = mCurBucket + level; int nLevel = mCurBucket + level;
if (USE_MESH_POLY) { if (USE_MESH_POLY || area.mesh) {
MeshBucket mb = mBuckets.getMeshBucket(nLevel); MeshBucket mb = mBuckets.getMeshBucket(nLevel);
mb.area = area; mb.area = area;
mb.addMesh(mElement); mb.addMesh(mElement);

View File

@@ -525,6 +525,9 @@ public class XmlThemeBuilder extends DefaultHandler {
else if ("blend-fill".equals(name)) else if ("blend-fill".equals(name))
b.blendColor(value); b.blendColor(value);
else if ("mesh".equals(name))
b.mesh(Boolean.parseBoolean(value));
else else
logUnknownAttribute(elementName, name, value, i); logUnknownAttribute(elementName, name, value, i);
} }

View File

@@ -1,5 +1,6 @@
/* /*
* Copyright 2014 Hannes Janetzek * Copyright 2014 Hannes Janetzek
* Copyright 2016 devemux86
* *
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
* *
@@ -55,6 +56,9 @@ public class AreaStyle extends RenderStyle {
public final int strokeColor; public final int strokeColor;
public final float strokeWidth; public final float strokeWidth;
/** Tessellation */
public final boolean mesh;
public AreaStyle(int color) { public AreaStyle(int color) {
this(0, color); this(0, color);
} }
@@ -69,6 +73,7 @@ public class AreaStyle extends RenderStyle {
this.texture = null; this.texture = null;
this.strokeColor = color; this.strokeColor = color;
this.strokeWidth = 1; this.strokeWidth = 1;
this.mesh = false;
} }
public AreaStyle(AreaBuilder<?> b) { public AreaStyle(AreaBuilder<?> b) {
@@ -79,9 +84,9 @@ public class AreaStyle extends RenderStyle {
this.blendScale = b.blendScale; this.blendScale = b.blendScale;
this.color = b.fillColor; this.color = b.fillColor;
this.texture = b.texture; this.texture = b.texture;
this.strokeColor = b.strokeColor; this.strokeColor = b.strokeColor;
this.strokeWidth = b.strokeWidth; this.strokeWidth = b.strokeWidth;
this.mesh = b.mesh;
} }
@Override @Override
@@ -136,6 +141,7 @@ public class AreaStyle extends RenderStyle {
public int fadeScale; public int fadeScale;
public int blendColor; public int blendColor;
public int blendScale; public int blendScale;
public boolean mesh;
public TextureItem texture; public TextureItem texture;
@@ -155,6 +161,7 @@ public class AreaStyle extends RenderStyle {
this.texture = area.texture; this.texture = area.texture;
this.strokeColor = area.strokeColor; this.strokeColor = area.strokeColor;
this.strokeWidth = area.strokeWidth; this.strokeWidth = area.strokeWidth;
this.mesh = area.mesh;
return self(); return self();
} }
@@ -184,6 +191,11 @@ public class AreaStyle extends RenderStyle {
return self(); return self();
} }
public T mesh(boolean mesh) {
this.mesh = mesh;
return self();
}
public T reset() { public T reset() {
fillColor = Color.WHITE; fillColor = Color.WHITE;
strokeColor = Color.BLACK; strokeColor = Color.BLACK;
@@ -193,6 +205,7 @@ public class AreaStyle extends RenderStyle {
blendColor = Color.TRANSPARENT; blendColor = Color.TRANSPARENT;
style = null; style = null;
texture = null; texture = null;
mesh = false;
return self(); return self();
} }