From f573fd52c8d431c4b98810f8597afa8da7112a5d Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Tue, 6 Sep 2016 00:43:11 +0200 Subject: [PATCH] Preparation for touch icons --- OsmAnd-java/src/net/osmand/NativeLibrary.java | 2 ++ OsmAnd-java/src/net/osmand/RenderingContext.java | 10 +++++++++- .../src/net/osmand/util/OpeningHoursParser.java | 5 ++++- .../net/osmand/plus/render/MapRenderRepositories.java | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/NativeLibrary.java b/OsmAnd-java/src/net/osmand/NativeLibrary.java index c2ed078c65..187bafcc08 100644 --- a/OsmAnd-java/src/net/osmand/NativeLibrary.java +++ b/OsmAnd-java/src/net/osmand/NativeLibrary.java @@ -141,6 +141,8 @@ public class NativeLibrary { /**/ protected static native NativeRouteSearchResult loadRoutingData(RouteRegion reg, String regName, int regfp, RouteSubregion subreg, boolean loadObjects); + + protected static native void deleteRenderingContextHandle(long handle); protected static native void deleteRouteSearchResult(long searchResultHandle); diff --git a/OsmAnd-java/src/net/osmand/RenderingContext.java b/OsmAnd-java/src/net/osmand/RenderingContext.java index 7d3de4aa53..9c8b803d5c 100644 --- a/OsmAnd-java/src/net/osmand/RenderingContext.java +++ b/OsmAnd-java/src/net/osmand/RenderingContext.java @@ -27,7 +27,6 @@ public class RenderingContext { public RenderingContext() { } - public double leftX; public double topY; @@ -53,6 +52,7 @@ public class RenderingContext { public int shadowRenderingColor = 0xff969696; public String renderingDebugInfo; public double polygonMinSizeToDisplay; + public long renderingContextHandle; private float density = 1; @@ -75,4 +75,12 @@ public class RenderingContext { protected byte[] getIconRawData(String data) { return null; } + + protected void finalize() throws Throwable { + super.finalize(); + if (renderingContextHandle != 0) { + NativeLibrary.deleteRenderingContextHandle(renderingContextHandle); + renderingContextHandle = 0; + } + } } \ No newline at end of file diff --git a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java index ea90092636..0624fd3ad6 100644 --- a/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java +++ b/OsmAnd-java/src/net/osmand/util/OpeningHoursParser.java @@ -1674,10 +1674,13 @@ public class OpeningHoursParser { // not supported (,) // hours = parseOpenedHours("Mo-Su 07:00-23:00, Fr 08:00-20:00"); - + // Test holidays String hoursString = "mo-fr 11:00-21:00; PH off"; hours = parseOpenedHoursHandleErrors(hoursString); testParsedAndAssembledCorrectly(hoursString, hours); + + // not properly supported + // hours = parseOpenedHours("Mo-Su (sunrise-00:30)-(sunset+00:30)"); } } diff --git a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java index 7439e7064a..edef18238d 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java @@ -107,6 +107,7 @@ public class MapRenderRepositories { private boolean interrupted = false; private int renderedState = 0; // (1 (if basemap) + 2 (if normal map) private RenderingContext currentRenderingContext; + private RenderingContext visibleRenderingContext; private SearchRequest searchRequest; private OsmandSettings prefs; @@ -781,6 +782,7 @@ public class MapRenderRepositories { } String renderingDebugInfo = currentRenderingContext.renderingDebugInfo; currentRenderingContext.ended = true; + visibleRenderingContext = currentRenderingContext; if (checkWhetherInterrupted()) { // revert if it was interrupted // (be smart a bit do not revert if road already drawn)