S3DB: allow modify material colors from theme (#690)

This commit is contained in:
Gustl22 2019-03-05 15:57:04 +01:00 committed by Emux
parent 311cc19134
commit 80afa86ae4
No known key found for this signature in database
GPG Key ID: 64ED9980896038C3
3 changed files with 8 additions and 9 deletions

View File

@ -161,7 +161,7 @@ public class S3DBLayer extends BuildingLayer {
if ((v = getTransformedValue(element, Tag.KEY_BUILDING_COLOR)) != null) { if ((v = getTransformedValue(element, Tag.KEY_BUILDING_COLOR)) != null) {
bColor = S3DBUtils.getColor(v, false, false); bColor = S3DBUtils.getColor(v, false, false);
} else if ((v = getTransformedValue(element, Tag.KEY_BUILDING_MATERIAL)) != null) { } else if ((v = getTransformedValue(element, Tag.KEY_BUILDING_MATERIAL)) != null) {
bColor = S3DBUtils.getMaterialColor(v, false); bColor = S3DBUtils.getMaterialColor(v);
} }
} }
@ -265,7 +265,7 @@ public class S3DBLayer extends BuildingLayer {
if (v != null) if (v != null)
roofColor = S3DBUtils.getColor(v, true, false); roofColor = S3DBUtils.getColor(v, true, false);
else if ((v = getTransformedValue(element, Tag.KEY_ROOF_MATERIAL)) != null) else if ((v = getTransformedValue(element, Tag.KEY_ROOF_MATERIAL)) != null)
roofColor = S3DBUtils.getMaterialColor(v, true); roofColor = S3DBUtils.getMaterialColor(v);
} }
boolean roofOrientationAcross = false; boolean roofOrientationAcross = false;

View File

@ -129,7 +129,7 @@ class S3DBTileLoader extends TileLoader {
} }
if (c == 0 && element.tags.containsKey(OSCIM4_KEY_MATERIAL)) { if (c == 0 && element.tags.containsKey(OSCIM4_KEY_MATERIAL)) {
c = S3DBUtils.getMaterialColor(element.tags.getValue(OSCIM4_KEY_MATERIAL), isRoof); c = S3DBUtils.getMaterialColor(element.tags.getValue(OSCIM4_KEY_MATERIAL));
} }
if (c == 0) { if (c == 0) {

View File

@ -1251,15 +1251,14 @@ public final class S3DBUtils {
/** /**
* @param material the material as string (see http://wiki.openstreetmap.org/wiki/Key:material and following pages) * @param material the material as string (see http://wiki.openstreetmap.org/wiki/Key:material and following pages)
* @param roof declare if material is used for roofs
* @return the color as integer (8 bit each a, r, g, b) * @return the color as integer (8 bit each a, r, g, b)
*/ */
public static int getMaterialColor(String material, boolean roof) { public static int getMaterialColor(String material) {
if (roof) { if (material.charAt(0) == '#') {
if ("glass".equals(material)) return Color.parseColor(material, Color.CYAN);
return Color.fade(Color.get(130, 224, 255), 0.9f);
} }
if ("roof_tiles".equals(material)) if ("roof_tiles".equals(material))
return Color.get(216, 167, 111); return Color.get(216, 167, 111);
if ("tile".equals(material)) if ("tile".equals(material))
@ -1280,7 +1279,7 @@ public final class S3DBUtils {
if ("asbestos".equals(material)) if ("asbestos".equals(material))
return Color.get(160, 152, 141); return Color.get(160, 152, 141);
if ("glass".equals(material)) if ("glass".equals(material))
return Color.get(130, 224, 255); return Color.fade(Color.get(130, 224, 255), 0.6f);
if ("slate".equals(material)) if ("slate".equals(material))
return 0xFF605960; return 0xFF605960;
if ("zink".equals(material)) if ("zink".equals(material))