docs + cleanups

This commit is contained in:
Hannes Janetzek 2013-02-11 13:49:09 +01:00
parent c1643850ce
commit 0609639ef3
5 changed files with 33 additions and 18 deletions

View File

@ -34,6 +34,13 @@ public class JobTile extends Tile {
state = STATE_NONE; 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() { public void setLoading() {
if (state != STATE_NONE) if (state != STATE_NONE)
Log.d(TAG, "wrong state: " + state); Log.d(TAG, "wrong state: " + state);

View File

@ -75,7 +75,7 @@ public abstract class Overlay implements OverlayConstants {
mResourceProxy = null; mResourceProxy = null;
mScale = 1; mScale = 1;
// mResourceProxy = new DefaultResourceProxyImpl(ctx); // mResourceProxy = new DefaultResourceProxyImpl(ctx);
// mScale = ctx.getResources().getDisplayMetrics().density; // mScale = ctx.getResources().getDisplayMetrics().density;
} }
public Overlay(final Context ctx) { public Overlay(final Context ctx) {

View File

@ -28,6 +28,10 @@ import android.opengl.GLES20;
import android.opengl.Matrix; 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 * @author Hannes Janetzek
*/ */
public class BaseMap { public class BaseMap {

View File

@ -39,7 +39,7 @@ import android.util.Log;
*/ */
public final class LineRenderer { 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; private static final int LINE_VERTICES_DATA_POS_OFFSET = 0;
@ -215,10 +215,12 @@ public final class LineRenderer {
} else { } else {
if (line.fixed || strokeMaxZoom) { if (line.fixed || strokeMaxZoom) {
// invert scaling of extrusion vectors so that line width // invert scaling of extrusion vectors so that line
// stays the same. // width stays the same.
width = ll.width / s; width = ll.width / s;
} else { } else {
// reduce linear scaling of extrusion vectors so that
// line width increases by sqrt(2.2).
width = ll.width / lineScale; width = ll.width / lineScale;
if (ll.line.min > 0 && ll.width * lineScale < ll.line.min * 2) if (ll.line.min > 0 && ll.width * lineScale < ll.line.min * 2)

View File

@ -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 * 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 * 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.Layers;
import org.oscim.renderer.layer.TextItem; 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 { 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. * Tile data set by TileGenerator.
*/ */
@ -40,6 +37,15 @@ public final class MapTile extends JobTile {
*/ */
public boolean isVisible; 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 * Pointer to access relatives in QuadTree
*/ */
@ -80,10 +86,6 @@ public final class MapTile extends JobTile {
super(tileX, tileY, zoomLevel); super(tileX, tileY, zoomLevel);
} }
boolean isActive() {
return state != 0;
}
/** /**
* @return true if tile could be referenced by another thread * @return true if tile could be referenced by another thread
*/ */