From 0609639ef3d207236bbb26726fb823644597ed20 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Mon, 11 Feb 2013 13:49:09 +0100 Subject: [PATCH] docs + cleanups --- src/org/oscim/generator/JobTile.java | 7 ++++++ src/org/oscim/overlay/Overlay.java | 2 +- src/org/oscim/renderer/BaseMap.java | 4 ++++ src/org/oscim/renderer/LineRenderer.java | 8 ++++--- src/org/oscim/renderer/MapTile.java | 30 +++++++++++++----------- 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/org/oscim/generator/JobTile.java b/src/org/oscim/generator/JobTile.java index a400774a..b3314009 100644 --- a/src/org/oscim/generator/JobTile.java +++ b/src/org/oscim/generator/JobTile.java @@ -34,6 +34,13 @@ public class JobTile extends Tile { state = STATE_NONE; } + /** + * @return true if tile is loading, has new data or is ready for rendering + * */ + public boolean isActive() { + return state > STATE_NONE && state < STATE_ERROR; + } + public void setLoading() { if (state != STATE_NONE) Log.d(TAG, "wrong state: " + state); diff --git a/src/org/oscim/overlay/Overlay.java b/src/org/oscim/overlay/Overlay.java index 8bc58e05..658c6f04 100644 --- a/src/org/oscim/overlay/Overlay.java +++ b/src/org/oscim/overlay/Overlay.java @@ -75,7 +75,7 @@ public abstract class Overlay implements OverlayConstants { mResourceProxy = null; mScale = 1; // mResourceProxy = new DefaultResourceProxyImpl(ctx); - // mScale = ctx.getResources().getDisplayMetrics().density; + // mScale = ctx.getResources().getDisplayMetrics().density; } public Overlay(final Context ctx) { diff --git a/src/org/oscim/renderer/BaseMap.java b/src/org/oscim/renderer/BaseMap.java index 14a874cb..dcb3a446 100644 --- a/src/org/oscim/renderer/BaseMap.java +++ b/src/org/oscim/renderer/BaseMap.java @@ -28,6 +28,10 @@ import android.opengl.GLES20; import android.opengl.Matrix; /** + * This class is for rendering the Line- and PolygonLayers of visible MapTiles. For + * visible tiles that do not have data available yet its parent in children + * tiles are rendered when available. + * * @author Hannes Janetzek */ public class BaseMap { diff --git a/src/org/oscim/renderer/LineRenderer.java b/src/org/oscim/renderer/LineRenderer.java index b8ef15c4..10c1e271 100644 --- a/src/org/oscim/renderer/LineRenderer.java +++ b/src/org/oscim/renderer/LineRenderer.java @@ -39,7 +39,7 @@ import android.util.Log; */ public final class LineRenderer { - private final static String TAG = "LineRenderer"; + private final static String TAG = LineRenderer.class.getName(); private static final int LINE_VERTICES_DATA_POS_OFFSET = 0; @@ -215,10 +215,12 @@ public final class LineRenderer { } else { if (line.fixed || strokeMaxZoom) { - // invert scaling of extrusion vectors so that line width - // stays the same. + // invert scaling of extrusion vectors so that line + // width stays the same. width = ll.width / s; } else { + // reduce linear scaling of extrusion vectors so that + // line width increases by sqrt(2.2). width = ll.width / lineScale; if (ll.line.min > 0 && ll.width * lineScale < ll.line.min * 2) diff --git a/src/org/oscim/renderer/MapTile.java b/src/org/oscim/renderer/MapTile.java index 37632f50..bbb52f3d 100644 --- a/src/org/oscim/renderer/MapTile.java +++ b/src/org/oscim/renderer/MapTile.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 Hannes Janetzek + * Copyright 2012, 2013 OpenScienceMap * * This program is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General License as published by the Free Software @@ -18,17 +18,14 @@ import org.oscim.generator.JobTile; import org.oscim.renderer.layer.Layers; import org.oscim.renderer.layer.TextItem; +/** + * Extends Tile class for concurrent use in TileManager, + * TileGenerator and GLRenderer threads. + * + * @author Hannes Janetzek + */ public final class MapTile extends JobTile { - /** - * VBO holds all vertex data to draw lines and polygons - * layout: - * 16 bytes fill coordinates, - * n bytes polygon vertices, - * m bytes lines vertices - */ - BufferObject vbo; - /** * Tile data set by TileGenerator. */ @@ -40,6 +37,15 @@ public final class MapTile extends JobTile { */ public boolean isVisible; + /** + * VBO holds all vertex data to draw lines and polygons when + * 'layers' are compiled. layout: + * 16 bytes fill coordinates, + * n bytes polygon vertices, + * m bytes lines vertices + */ + BufferObject vbo; + /** * Pointer to access relatives in QuadTree */ @@ -80,10 +86,6 @@ public final class MapTile extends JobTile { super(tileX, tileY, zoomLevel); } - boolean isActive() { - return state != 0; - } - /** * @return true if tile could be referenced by another thread */