s3db: use css colors
This commit is contained in:
parent
c57b388472
commit
ce38b484f6
@ -8,6 +8,8 @@ import org.oscim.map.Map;
|
|||||||
import org.oscim.renderer.ExtrusionRenderer;
|
import org.oscim.renderer.ExtrusionRenderer;
|
||||||
import org.oscim.renderer.GLViewport;
|
import org.oscim.renderer.GLViewport;
|
||||||
import org.oscim.tiling.TileSource;
|
import org.oscim.tiling.TileSource;
|
||||||
|
import org.oscim.utils.ColorUtil;
|
||||||
|
import org.oscim.utils.ColorsCSS;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -17,6 +19,10 @@ public class S3DBLayer extends TileLayer {
|
|||||||
private final static int MAX_CACHE = 20;
|
private final static int MAX_CACHE = 20;
|
||||||
private final static int SRC_ZOOM = 16;
|
private final static int SRC_ZOOM = 16;
|
||||||
|
|
||||||
|
/* TODO get from theme */
|
||||||
|
private final static double HSV_S = 0.7;
|
||||||
|
private final static double HSV_V = 1.2;
|
||||||
|
|
||||||
private final TileSource mTileSource;
|
private final TileSource mTileSource;
|
||||||
|
|
||||||
public S3DBLayer(Map map, TileSource tileSource) {
|
public S3DBLayer(Map map, TileSource tileSource) {
|
||||||
@ -55,14 +61,17 @@ public class S3DBLayer extends TileLayer {
|
|||||||
|
|
||||||
static int getColor(String color, boolean roof) {
|
static int getColor(String color, boolean roof) {
|
||||||
|
|
||||||
if (color.charAt(0) == '#')
|
if (color.charAt(0) == '#') {
|
||||||
return Color.parseColor(color, Color.CYAN);
|
int c = Color.parseColor(color, Color.CYAN);
|
||||||
|
/* hardcoded colors are way too saturated for my taste */
|
||||||
|
return ColorUtil.modHsv(c, 1.0, 0.4, HSV_V, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (roof) {
|
if (roof) {
|
||||||
if ("brown" == color)
|
if ("brown" == color)
|
||||||
return Color.get(120, 110, 110);
|
return Color.get(120, 110, 110);
|
||||||
if ("red" == color)
|
if ("red" == color)
|
||||||
return Color.get(255, 87, 69);
|
return Color.get(235, 140, 130);
|
||||||
if ("green" == color)
|
if ("green" == color)
|
||||||
return Color.get(150, 200, 130);
|
return Color.get(150, 200, 130);
|
||||||
if ("blue" == color)
|
if ("blue" == color)
|
||||||
@ -82,29 +91,19 @@ public class S3DBLayer extends TileLayer {
|
|||||||
return Color.get(190, 190, 255);
|
return Color.get(190, 190, 255);
|
||||||
if ("yellow" == color)
|
if ("yellow" == color)
|
||||||
return Color.get(255, 255, 175);
|
return Color.get(255, 255, 175);
|
||||||
if ("pink" == color)
|
|
||||||
return Color.get(225, 175, 225);
|
|
||||||
if ("orange" == color)
|
|
||||||
return Color.get(255, 225, 150);
|
|
||||||
if ("brown" == color)
|
|
||||||
return Color.get(170, 130, 80);
|
|
||||||
if ("silver" == color)
|
|
||||||
return Color.get(153, 157, 160);
|
|
||||||
if ("gold" == color)
|
|
||||||
return Color.get(255, 215, 0);
|
|
||||||
if ("darkgray" == color || "darkgrey" == color)
|
if ("darkgray" == color || "darkgrey" == color)
|
||||||
return Color.DKGRAY;
|
return Color.DKGRAY;
|
||||||
if ("lightgray" == color || "lightgrey" == color)
|
if ("lightgray" == color || "lightgrey" == color)
|
||||||
return Color.LTGRAY;
|
return Color.LTGRAY;
|
||||||
if ("lightblue" == color)
|
|
||||||
return Color.get(173, 216, 230);
|
|
||||||
if ("beige" == color)
|
|
||||||
return Color.get(245, 245, 220);
|
|
||||||
if ("darkblue" == color)
|
|
||||||
return Color.get(50, 50, 189);
|
|
||||||
if ("transparent" == color)
|
if ("transparent" == color)
|
||||||
return Color.get(64, 64, 64, 64);
|
return Color.get(64, 64, 64, 64);
|
||||||
|
|
||||||
|
Integer css = ColorsCSS.get(color);
|
||||||
|
|
||||||
|
if (css != null)
|
||||||
|
return ColorUtil.modHsv(css.intValue(), 1.0, HSV_S, HSV_V, true);
|
||||||
|
|
||||||
log.debug("unknown color:{}", color);
|
log.debug("unknown color:{}", color);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -157,6 +156,8 @@ public class S3DBLayer extends TileLayer {
|
|||||||
return Color.get(255, 217, 191);
|
return Color.get(255, 217, 191);
|
||||||
if ("stainless_steel" == material)
|
if ("stainless_steel" == material)
|
||||||
return Color.get(153, 157, 160);
|
return Color.get(153, 157, 160);
|
||||||
|
if ("gold" == material)
|
||||||
|
return 0xFFFFD700;
|
||||||
|
|
||||||
log.debug("unknown material:{}", material);
|
log.debug("unknown material:{}", material);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user