diff --git a/vtm-desktop/src/org/oscim/awt/AwtGraphics.java b/vtm-desktop/src/org/oscim/awt/AwtGraphics.java index e1276dc1..971f8894 100644 --- a/vtm-desktop/src/org/oscim/awt/AwtGraphics.java +++ b/vtm-desktop/src/org/oscim/awt/AwtGraphics.java @@ -31,17 +31,20 @@ import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; +import java.util.Locale; public class AwtGraphics extends CanvasAdapter { public static void init() { CanvasAdapter.init(new AwtGraphics()); - String os = System.getProperty("os.name").toLowerCase(); - - if(os.contains("win")) CanvasAdapter.platform = Platform.WINDOWS; - else if(os.contains("mac")) CanvasAdapter.platform = Platform.MAC_OS; - else CanvasAdapter.platform = Platform.LINUX; + String os = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); + if (os.contains("win")) + CanvasAdapter.platform = Platform.WINDOWS; + else if (os.contains("mac")) + CanvasAdapter.platform = Platform.MACOS; + else + CanvasAdapter.platform = Platform.LINUX; } public static BufferedImage getBitmap(Bitmap bitmap) { diff --git a/vtm-desktop/src/org/oscim/gdx/GdxMapApp.java b/vtm-desktop/src/org/oscim/gdx/GdxMapApp.java index 9f892534..77b1456b 100644 --- a/vtm-desktop/src/org/oscim/gdx/GdxMapApp.java +++ b/vtm-desktop/src/org/oscim/gdx/GdxMapApp.java @@ -1,6 +1,6 @@ /* * Copyright 2013 Hannes Janetzek - * Copyright 2016 devemux86 + * Copyright 2016-2017 devemux86 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * @@ -41,7 +41,6 @@ public class GdxMapApp extends GdxMap { AwtGraphics.init(); GdxAssets.init("assets/"); GLAdapter.init(new LwjglGL20()); - GLAdapter.GDX_DESKTOP_QUIRKS = true; } public static void main(String[] args) { diff --git a/vtm-web-app/src/org/oscim/web/client/GwtMap.java b/vtm-web-app/src/org/oscim/web/client/GwtMap.java index bc1c3285..837d2584 100644 --- a/vtm-web-app/src/org/oscim/web/client/GwtMap.java +++ b/vtm-web-app/src/org/oscim/web/client/GwtMap.java @@ -1,6 +1,7 @@ /* * Copyright 2013 Hannes Janetzek * Copyright 2016 Izumi Kawashima + * Copyright 2017 devemux86 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * @@ -66,7 +67,6 @@ class GwtMap extends GdxMap { log.debug("GLAdapter.init"); GLAdapter.init((GL) Gdx.graphics.getGL20()); - GLAdapter.GDX_WEBGL_QUIRKS = true; MapRenderer.setBackgroundColor(0xffffff); //Gdx.app.setLogLevel(Application.LOG_DEBUG); diff --git a/vtm-web-js/src/org/oscim/web/client/GwtMap.java b/vtm-web-js/src/org/oscim/web/client/GwtMap.java index c4939f60..338d3b69 100644 --- a/vtm-web-js/src/org/oscim/web/client/GwtMap.java +++ b/vtm-web-js/src/org/oscim/web/client/GwtMap.java @@ -1,5 +1,6 @@ /* * Copyright 2013 Hannes Janetzek + * Copyright 2017 devemux86 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * @@ -43,7 +44,6 @@ public class GwtMap extends GdxMap { GdxAssets.init(""); CanvasAdapter.textScale = 0.7f; GLAdapter.init((GL) Gdx.graphics.getGL20()); - GLAdapter.GDX_WEBGL_QUIRKS = true; MapRenderer.setBackgroundColor(0xffffff); JsMap.init(mMap); diff --git a/vtm-web/src/org/oscim/gdx/client/GwtGdxGraphics.java b/vtm-web/src/org/oscim/gdx/client/GwtGdxGraphics.java index 65c69ba9..69824073 100644 --- a/vtm-web/src/org/oscim/gdx/client/GwtGdxGraphics.java +++ b/vtm-web/src/org/oscim/gdx/client/GwtGdxGraphics.java @@ -84,6 +84,6 @@ public class GwtGdxGraphics extends CanvasAdapter { public static void init() { CanvasAdapter.init(new GwtGdxGraphics()); - CanvasAdapter.platform = Platform.WEB; + CanvasAdapter.platform = Platform.WEBGL; } } diff --git a/vtm/src/org/oscim/backend/GLAdapter.java b/vtm/src/org/oscim/backend/GLAdapter.java index 72312003..46e4ad04 100644 --- a/vtm/src/org/oscim/backend/GLAdapter.java +++ b/vtm/src/org/oscim/backend/GLAdapter.java @@ -1,6 +1,6 @@ /* * Copyright 2013 Hannes Janetzek - * Copyright 2016 devemux86 + * Copyright 2016-2017 devemux86 * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * @@ -17,6 +17,8 @@ */ package org.oscim.backend; +import org.oscim.layers.tile.buildings.BuildingLayer; + public class GLAdapter { public final static boolean debug = false; @@ -43,6 +45,12 @@ public class GLAdapter { public static void init(GL gl20) { gl = gl20; - GDX_DESKTOP_QUIRKS = CanvasAdapter.platform.GDX_DESKTOP_QUIRKS; + + GDX_DESKTOP_QUIRKS = CanvasAdapter.platform.isDesktop(); + GDX_WEBGL_QUIRKS = (CanvasAdapter.platform == Platform.WEBGL); + + // Buildings translucency does not work on macOS, see #61 + if (CanvasAdapter.platform == Platform.MACOS) + BuildingLayer.TRANSLUCENT = false; } } diff --git a/vtm/src/org/oscim/backend/Platform.java b/vtm/src/org/oscim/backend/Platform.java index b9163c0f..baf6d715 100644 --- a/vtm/src/org/oscim/backend/Platform.java +++ b/vtm/src/org/oscim/backend/Platform.java @@ -1,5 +1,6 @@ /* * Copyright 2017 Longri + * Copyright 2017 devemux86 * * This program is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software @@ -14,33 +15,26 @@ */ package org.oscim.backend; - public enum Platform { - ANDROID(false, false), - IOS(true, false), - MAC_OS(true, true), - LINUX(false, true), - WINDOWS(false, true), - WEB(false, false), - UNKNOWN(false, false); - - Platform(boolean buildingLayerTranslucent, boolean desktopQuirks) { - this.BUILDING_LAYER_TRANSLUCENT = buildingLayerTranslucent; - this.GDX_DESKTOP_QUIRKS = desktopQuirks; - } - - - public boolean BUILDING_LAYER_TRANSLUCENT; - - public boolean GDX_DESKTOP_QUIRKS; + ANDROID, + IOS, + LINUX, + MACOS, + UNKNOWN, + WEBGL, + WINDOWS; /** - * Returns true when This is WINDOWS, LINUX or MAC_OS other, false - * - * @return boolean + * @return true if on desktop (Windows, macOS, Linux) */ - public boolean isAnyDesktop() { - return this == LINUX || this == WINDOWS || this == MAC_OS; + public boolean isDesktop() { + switch (this) { + case LINUX: + case MACOS: + case WINDOWS: + return true; + } + return false; } }