formatting

This commit is contained in:
Hannes Janetzek 2013-02-04 20:14:58 +01:00
parent 303e0cb4ce
commit f2b7a9fdf8
72 changed files with 403 additions and 240 deletions

View File

@ -2,7 +2,7 @@
* Copyright 2010, 2011, 2012 mapsforge.org * Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2012 osmdroid authors: Nicolas Gramlich, Theodore Hong * Copyright 2012 osmdroid authors: Nicolas Gramlich, Theodore Hong
* Copyright 2012 Hannes Janetzek * Copyright 2012 Hannes Janetzek
* *
* 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 Public License as published by the Free Software * terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version. * Foundation, either version 3 of the License, or (at your option) any later version.

View File

@ -70,12 +70,14 @@ public class MapPosition {
// (float) (MercatorProjection.latitudeToPixelY(in.getLatitude(), zoomLevel) - y); // (float) (MercatorProjection.latitudeToPixelY(in.getLatitude(), zoomLevel) - y);
// } // }
/** @param geoPoint /**
* @param geoPoint
* the map position. * the map position.
* @param zoomLevel * @param zoomLevel
* the zoom level. * the zoom level.
* @param scale * @param scale
* ... */ * ...
*/
public MapPosition(GeoPoint geoPoint, byte zoomLevel, float scale) { public MapPosition(GeoPoint geoPoint, byte zoomLevel, float scale) {
this.zoomLevel = zoomLevel; this.zoomLevel = zoomLevel;
this.scale = scale; this.scale = scale;

View File

@ -49,6 +49,7 @@ public final class MercatorProjection {
/** /**
* Calculates the distance on the ground that is represented by a single * Calculates the distance on the ground that is represented by a single
* pixel on the map. * pixel on the map.
*
* @param latitude * @param latitude
* the latitude coordinate at which the resolution should be * the latitude coordinate at which the resolution should be
* calculated. * calculated.
@ -64,6 +65,7 @@ public final class MercatorProjection {
/** /**
* Converts a latitude coordinate (in degrees) to a pixel Y coordinate at a * Converts a latitude coordinate (in degrees) to a pixel Y coordinate at a
* certain zoom level. * certain zoom level.
*
* @param latitude * @param latitude
* the latitude coordinate that should be converted. * the latitude coordinate that should be converted.
* @param zoomLevel * @param zoomLevel
@ -84,6 +86,7 @@ public final class MercatorProjection {
/** /**
* Projects a longitude coordinate (in degrees) to the range [0.0,1.0] * Projects a longitude coordinate (in degrees) to the range [0.0,1.0]
*
* @param latitude * @param latitude
* the latitude coordinate that should be converted. * the latitude coordinate that should be converted.
* @return the position . * @return the position .
@ -96,6 +99,7 @@ public final class MercatorProjection {
/** /**
* Converts a latitude coordinate (in degrees) to a tile Y number at a * Converts a latitude coordinate (in degrees) to a tile Y number at a
* certain zoom level. * certain zoom level.
*
* @param latitude * @param latitude
* the latitude coordinate that should be converted. * the latitude coordinate that should be converted.
* @param zoomLevel * @param zoomLevel
@ -138,6 +142,7 @@ public final class MercatorProjection {
/** /**
* Converts a longitude coordinate (in degrees) to a pixel X coordinate at a * Converts a longitude coordinate (in degrees) to a pixel X coordinate at a
* certain zoom level. * certain zoom level.
*
* @param longitude * @param longitude
* the longitude coordinate that should be converted. * the longitude coordinate that should be converted.
* @param zoomLevel * @param zoomLevel
@ -155,6 +160,7 @@ public final class MercatorProjection {
/** /**
* Projects a longitude coordinate (in degrees) to the range [0.0,1.0] * Projects a longitude coordinate (in degrees) to the range [0.0,1.0]
*
* @param longitude * @param longitude
* the longitude coordinate that should be converted. * the longitude coordinate that should be converted.
* @return the position . * @return the position .
@ -166,6 +172,7 @@ public final class MercatorProjection {
/** /**
* Converts a longitude coordinate (in degrees) to the tile X number at a * Converts a longitude coordinate (in degrees) to the tile X number at a
* certain zoom level. * certain zoom level.
*
* @param longitude * @param longitude
* the longitude coordinate that should be converted. * the longitude coordinate that should be converted.
* @param zoomLevel * @param zoomLevel
@ -179,6 +186,7 @@ public final class MercatorProjection {
/** /**
* Converts a pixel X coordinate at a certain zoom level to a longitude * Converts a pixel X coordinate at a certain zoom level to a longitude
* coordinate. * coordinate.
*
* @param pixelX * @param pixelX
* the pixel X coordinate that should be converted. * the pixel X coordinate that should be converted.
* @param zoomLevel * @param zoomLevel
@ -191,6 +199,7 @@ public final class MercatorProjection {
/** /**
* Converts a pixel X coordinate to the tile X number. * Converts a pixel X coordinate to the tile X number.
*
* @param pixelX * @param pixelX
* the pixel X coordinate that should be converted. * the pixel X coordinate that should be converted.
* @param zoomLevel * @param zoomLevel
@ -205,6 +214,7 @@ public final class MercatorProjection {
/** /**
* Converts a pixel Y coordinate at a certain zoom level to a latitude * Converts a pixel Y coordinate at a certain zoom level to a latitude
* coordinate. * coordinate.
*
* @param pixelY * @param pixelY
* the pixel Y coordinate that should be converted. * the pixel Y coordinate that should be converted.
* @param zoomLevel * @param zoomLevel
@ -218,6 +228,7 @@ public final class MercatorProjection {
/** /**
* Converts a pixel Y coordinate to the tile Y number. * Converts a pixel Y coordinate to the tile Y number.
*
* @param pixelY * @param pixelY
* the pixel Y coordinate that should be converted. * the pixel Y coordinate that should be converted.
* @param zoomLevel * @param zoomLevel
@ -232,6 +243,7 @@ public final class MercatorProjection {
/** /**
* Converts a tile X number at a certain zoom level to a longitude * Converts a tile X number at a certain zoom level to a longitude
* coordinate. * coordinate.
*
* @param tileX * @param tileX
* the tile X number that should be converted. * the tile X number that should be converted.
* @param zoomLevel * @param zoomLevel
@ -245,6 +257,7 @@ public final class MercatorProjection {
/** /**
* Converts a tile Y number at a certain zoom level to a latitude * Converts a tile Y number at a certain zoom level to a latitude
* coordinate. * coordinate.
*
* @param tileY * @param tileY
* the tile Y number that should be converted. * the tile Y number that should be converted.
* @param zoomLevel * @param zoomLevel

View File

@ -16,11 +16,11 @@
package org.oscim.core; package org.oscim.core;
/** /**
* *
*/ */
public class WebMercator { public class WebMercator {
/** /**
* *
*/ */
public static final String NAME = "SphericalMercator"; public static final String NAME = "SphericalMercator";
@ -85,7 +85,7 @@ public class WebMercator {
/** /**
* from http://pauldendulk.com/2011/04/projecting-from-wgs84-to.html * from http://pauldendulk.com/2011/04/projecting-from-wgs84-to.html
* *
* @param lon * @param lon
* ... * ...
* @param lat * @param lat
@ -106,7 +106,7 @@ public class WebMercator {
/** /**
* from http://pauldendulk.com/2011/04/projecting-from-wgs84-to.html * from http://pauldendulk.com/2011/04/projecting-from-wgs84-to.html
* *
* @param x * @param x
* ... * ...
* @param y * @param y

View File

@ -25,6 +25,7 @@ public interface IMapDatabase {
/** /**
* Starts a database query with the given parameters. * Starts a database query with the given parameters.
*
* @param tile * @param tile
* the tile to read. * the tile to read.
* @param mapDatabaseCallback * @param mapDatabaseCallback
@ -48,6 +49,7 @@ public interface IMapDatabase {
/** /**
* Opens MapDatabase * Opens MapDatabase
*
* @param options * @param options
* the options. * the options.
* @return a OpenResult containing an error message in case of a failure. * @return a OpenResult containing an error message in case of a failure.

View File

@ -19,11 +19,14 @@ import org.oscim.database.mapfile.MapDatabase;
/** /**
* Callback methods which can be triggered from the {@link MapDatabase}. * Callback methods which can be triggered from the {@link MapDatabase}.
* ____
* NOTE: All parameters passed belong to the caller! i.e. dont hold
* references to any arrays after callback function returns.
*/ */
public interface IMapDatabaseCallback { public interface IMapDatabaseCallback {
/** /**
* Renders a single point of interest node (POI). * Renders a single point of interest node (POI).
* *
* @param layer * @param layer
* the layer of the node. * the layer of the node.
* @param tags * @param tags
@ -42,17 +45,18 @@ public interface IMapDatabaseCallback {
/** /**
* Renders a single way or area (closed way). * Renders a single way or area (closed way).
* *
* @param layer * @param layer
* the layer of the way. * the osm layer of the way.
* @param tags * @param tags
* the tags of the way. * the tags of the way.
* @param wayNodes * @param wayNodes
* the geographical coordinates of the way nodes in the order longitude/latitude. * the geographical coordinates of the way nodes in the order
* longitude/latitude or x/y depending on the projection.
* @param wayLength * @param wayLength
* length of way data in wayNodes * length of way data in wayNodes
* @param closed * @param closed
* way is closed (means need to add endpoint == startpoint) * wheter the way is an polygon.
* @param prio TODO * @param prio TODO
*/ */
void renderWay(byte layer, Tag[] tags, float[] wayNodes, short[] wayLength, void renderWay(byte layer, Tag[] tags, float[] wayNodes, short[] wayLength,
@ -60,12 +64,13 @@ public interface IMapDatabaseCallback {
/** /**
* TBD: check if way will be rendered before decoding * TBD: check if way will be rendered before decoding
* *
* @param tags * @param tags
* ... * ...
* @param closed * @param closed
* ... * ...
* @return true if the way will be rendered (i.e. found match in RenderTheme) * @return true if the way will be rendered (i.e. found match in
* RenderTheme)
*/ */
boolean checkWay(Tag[] tags, boolean closed); boolean checkWay(Tag[] tags, boolean closed);

View File

@ -17,7 +17,7 @@ package org.oscim.database;
import android.util.AttributeSet; import android.util.AttributeSet;
/** /**
* *
* *
*/ */
public final class MapDatabaseFactory { public final class MapDatabaseFactory {
@ -25,7 +25,8 @@ public final class MapDatabaseFactory {
/** /**
* @param attributeSet * @param attributeSet
* A collection of attributes which includes the desired MapDatabase. * A collection of attributes which includes the desired
* MapDatabase.
* @return a new MapDatabase instance. * @return a new MapDatabase instance.
*/ */
public static IMapDatabase createMapDatabase(AttributeSet attributeSet) { public static IMapDatabase createMapDatabase(AttributeSet attributeSet) {

View File

@ -20,7 +20,7 @@ import org.oscim.database.mapfile.MapDatabase;
/** /**
* Contains the immutable metadata of a map file. * Contains the immutable metadata of a map file.
* *
* @see MapDatabase#getMapInfo() * @see MapDatabase#getMapInfo()
*/ */
public class MapInfo { public class MapInfo {
@ -80,7 +80,8 @@ public class MapInfo {
public final Byte startZoomLevel; public final Byte startZoomLevel;
/** /**
* Zoomlevels provided by this Database, if null then any zoomlevel can be queried. * Zoomlevels provided by this Database, if null then any zoomlevel can be
* queried.
*/ */
public final int[] zoomLevel; public final int[] zoomLevel;

View File

@ -14,9 +14,9 @@
*/ */
package org.oscim.database; package org.oscim.database;
/** /**
* A FileOpenResult is a simple DTO which is returned by IMapDatabase#openFile(File). * A FileOpenResult is a simple DTO which is returned by
* IMapDatabase#openFile(File).
*/ */
public class OpenResult { public class OpenResult {
/** /**
@ -41,7 +41,7 @@ public class OpenResult {
} }
/** /**
* *
*/ */
public OpenResult() { public OpenResult() {
this.success = true; this.success = true;

View File

@ -22,7 +22,7 @@ final class Deserializer {
* Converts five bytes of a byte array to an unsigned long. * Converts five bytes of a byte array to an unsigned long.
* <p> * <p>
* The byte order is big-endian. * The byte order is big-endian.
* *
* @param buffer * @param buffer
* the byte array. * the byte array.
* @param offset * @param offset
@ -30,7 +30,8 @@ final class Deserializer {
* @return the long value. * @return the long value.
*/ */
static long getFiveBytesLong(byte[] buffer, int offset) { static long getFiveBytesLong(byte[] buffer, int offset) {
return (buffer[offset] & 0xffL) << 32 | (buffer[offset + 1] & 0xffL) << 24 | (buffer[offset + 2] & 0xffL) << 16 return (buffer[offset] & 0xffL) << 32 | (buffer[offset + 1] & 0xffL) << 24
| (buffer[offset + 2] & 0xffL) << 16
| (buffer[offset + 3] & 0xffL) << 8 | (buffer[offset + 4] & 0xffL); | (buffer[offset + 3] & 0xffL) << 8 | (buffer[offset + 4] & 0xffL);
} }
@ -38,7 +39,7 @@ final class Deserializer {
* Converts four bytes of a byte array to a signed int. * Converts four bytes of a byte array to a signed int.
* <p> * <p>
* The byte order is big-endian. * The byte order is big-endian.
* *
* @param buffer * @param buffer
* the byte array. * the byte array.
* @param offset * @param offset
@ -46,7 +47,8 @@ final class Deserializer {
* @return the int value. * @return the int value.
*/ */
static int getInt(byte[] buffer, int offset) { static int getInt(byte[] buffer, int offset) {
return buffer[offset] << 24 | (buffer[offset + 1] & 0xff) << 16 | (buffer[offset + 2] & 0xff) << 8 return buffer[offset] << 24 | (buffer[offset + 1] & 0xff) << 16
| (buffer[offset + 2] & 0xff) << 8
| (buffer[offset + 3] & 0xff); | (buffer[offset + 3] & 0xff);
} }
@ -54,7 +56,7 @@ final class Deserializer {
* Converts eight bytes of a byte array to a signed long. * Converts eight bytes of a byte array to a signed long.
* <p> * <p>
* The byte order is big-endian. * The byte order is big-endian.
* *
* @param buffer * @param buffer
* the byte array. * the byte array.
* @param offset * @param offset
@ -62,16 +64,18 @@ final class Deserializer {
* @return the long value. * @return the long value.
*/ */
static long getLong(byte[] buffer, int offset) { static long getLong(byte[] buffer, int offset) {
return (buffer[offset] & 0xffL) << 56 | (buffer[offset + 1] & 0xffL) << 48 | (buffer[offset + 2] & 0xffL) << 40 return (buffer[offset] & 0xffL) << 56 | (buffer[offset + 1] & 0xffL) << 48
| (buffer[offset + 2] & 0xffL) << 40
| (buffer[offset + 3] & 0xffL) << 32 | (buffer[offset + 4] & 0xffL) << 24 | (buffer[offset + 3] & 0xffL) << 32 | (buffer[offset + 4] & 0xffL) << 24
| (buffer[offset + 5] & 0xffL) << 16 | (buffer[offset + 6] & 0xffL) << 8 | (buffer[offset + 7] & 0xffL); | (buffer[offset + 5] & 0xffL) << 16 | (buffer[offset + 6] & 0xffL) << 8
| (buffer[offset + 7] & 0xffL);
} }
/** /**
* Converts two bytes of a byte array to a signed int. * Converts two bytes of a byte array to a signed int.
* <p> * <p>
* The byte order is big-endian. * The byte order is big-endian.
* *
* @param buffer * @param buffer
* the byte array. * the byte array.
* @param offset * @param offset

View File

@ -37,7 +37,8 @@ class IndexCache {
/** /**
* Maximum size in bytes of one index block. * Maximum size in bytes of one index block.
*/ */
private static final int SIZE_OF_INDEX_BLOCK = INDEX_ENTRIES_PER_BLOCK * SubFileParameter.BYTES_PER_INDEX_ENTRY; private static final int SIZE_OF_INDEX_BLOCK = INDEX_ENTRIES_PER_BLOCK
* SubFileParameter.BYTES_PER_INDEX_ENTRY;
private final Map<IndexCacheEntryKey, byte[]> map; private final Map<IndexCacheEntryKey, byte[]> map;
private final RandomAccessFile randomAccessFile; private final RandomAccessFile randomAccessFile;
@ -63,11 +64,13 @@ class IndexCache {
} }
/** /**
* Returns the index entry of a block in the given map file. If the required index entry is not cached, it will be * Returns the index entry of a block in the given map file. If the required
* index entry is not cached, it will be
* read from the map file index and put in the cache. * read from the map file index and put in the cache.
* *
* @param subFileParameter * @param subFileParameter
* the parameters of the map file for which the index entry is needed. * the parameters of the map file for which the index entry is
* needed.
* @param blockNumber * @param blockNumber
* the number of the block in the map file. * the number of the block in the map file.
* @return the index entry or -1 if the block number is invalid. * @return the index entry or -1 if the block number is invalid.
@ -83,13 +86,15 @@ class IndexCache {
long indexBlockNumber = blockNumber / INDEX_ENTRIES_PER_BLOCK; long indexBlockNumber = blockNumber / INDEX_ENTRIES_PER_BLOCK;
// create the cache entry key for this request // create the cache entry key for this request
IndexCacheEntryKey indexCacheEntryKey = new IndexCacheEntryKey(subFileParameter, indexBlockNumber); IndexCacheEntryKey indexCacheEntryKey = new IndexCacheEntryKey(subFileParameter,
indexBlockNumber);
// check for cached index block // check for cached index block
byte[] indexBlock = this.map.get(indexCacheEntryKey); byte[] indexBlock = this.map.get(indexCacheEntryKey);
if (indexBlock == null) { if (indexBlock == null) {
// cache miss, seek to the correct index block in the file and read it // cache miss, seek to the correct index block in the file and read it
long indexBlockPosition = subFileParameter.indexStartAddress + indexBlockNumber * SIZE_OF_INDEX_BLOCK; long indexBlockPosition = subFileParameter.indexStartAddress + indexBlockNumber
* SIZE_OF_INDEX_BLOCK;
int remainingIndexSize = (int) (subFileParameter.indexEndAddress - indexBlockPosition); int remainingIndexSize = (int) (subFileParameter.indexEndAddress - indexBlockPosition);
int indexBlockSize = Math.min(SIZE_OF_INDEX_BLOCK, remainingIndexSize); int indexBlockSize = Math.min(SIZE_OF_INDEX_BLOCK, remainingIndexSize);

View File

@ -26,7 +26,7 @@ class IndexCacheEntryKey {
/** /**
* Creates an immutable key to be stored in a map. * Creates an immutable key to be stored in a map.
* *
* @param subFileParameter * @param subFileParameter
* the parameters of the map file. * the parameters of the map file.
* @param indexBlockNumber * @param indexBlockNumber
@ -48,7 +48,8 @@ class IndexCacheEntryKey {
IndexCacheEntryKey other = (IndexCacheEntryKey) obj; IndexCacheEntryKey other = (IndexCacheEntryKey) obj;
if (this.subFileParameter == null && other.subFileParameter != null) { if (this.subFileParameter == null && other.subFileParameter != null) {
return false; return false;
} else if (this.subFileParameter != null && !this.subFileParameter.equals(other.subFileParameter)) { } else if (this.subFileParameter != null
&& !this.subFileParameter.equals(other.subFileParameter)) {
return false; return false;
} else if (this.indexBlockNumber != other.indexBlockNumber) { } else if (this.indexBlockNumber != other.indexBlockNumber) {
return false; return false;
@ -66,7 +67,8 @@ class IndexCacheEntryKey {
*/ */
private int calculateHashCode() { private int calculateHashCode() {
int result = 7; int result = 7;
result = 31 * result + ((this.subFileParameter == null) ? 0 : this.subFileParameter.hashCode()); result = 31 * result
+ ((this.subFileParameter == null) ? 0 : this.subFileParameter.hashCode());
result = 31 * result + (int) (this.indexBlockNumber ^ (this.indexBlockNumber >>> 32)); result = 31 * result + (int) (this.indexBlockNumber ^ (this.indexBlockNumber >>> 32));
return result; return result;
} }

View File

@ -38,7 +38,7 @@ import android.os.Environment;
* A class for reading binary map files. * A class for reading binary map files.
* <p> * <p>
* This class is not thread-safe. Each thread should use its own instance. * This class is not thread-safe. Each thread should use its own instance.
* *
* @see <a * @see <a
* href="http://code.google.com/p/mapsforge/wiki/SpecificationBinaryMapFile">Specification</a> * href="http://code.google.com/p/mapsforge/wiki/SpecificationBinaryMapFile">Specification</a>
*/ */
@ -387,7 +387,7 @@ public class MapDatabase implements IMapDatabase {
/** /**
* Processes a single block and executes the callback functions on all map * Processes a single block and executes the callback functions on all map
* elements. * elements.
* *
* @param queryParameters * @param queryParameters
* the parameters of the current query. * the parameters of the current query.
* @param subFileParameter * @param subFileParameter
@ -567,7 +567,7 @@ public class MapDatabase implements IMapDatabase {
/** /**
* Processes the block signature, if present. * Processes the block signature, if present.
* *
* @return true if the block signature could be processed successfully, * @return true if the block signature could be processed successfully,
* false otherwise. * false otherwise.
*/ */
@ -585,7 +585,7 @@ public class MapDatabase implements IMapDatabase {
/** /**
* Processes the given number of POIs. * Processes the given number of POIs.
* *
* @param mapDatabaseCallback * @param mapDatabaseCallback
* the callback which handles the extracted POIs. * the callback which handles the extracted POIs.
* @param numberOfPois * @param numberOfPois
@ -801,7 +801,7 @@ public class MapDatabase implements IMapDatabase {
/** /**
* Processes the given number of ways. * Processes the given number of ways.
* *
* @param queryParameters * @param queryParameters
* the parameters of the current query. * the parameters of the current query.
* @param mapDatabaseCallback * @param mapDatabaseCallback

View File

@ -43,7 +43,7 @@ public class ReadBuffer {
/** /**
* Returns one signed byte from the read buffer. * Returns one signed byte from the read buffer.
* *
* @return the byte value. * @return the byte value.
*/ */
public byte readByte() { public byte readByte() {
@ -51,9 +51,11 @@ public class ReadBuffer {
} }
/** /**
* Reads the given amount of bytes from the file into the read buffer and resets the internal buffer position. If * Reads the given amount of bytes from the file into the read buffer and
* the capacity of the read buffer is too small, a larger one is created automatically. * resets the internal buffer position. If
* * the capacity of the read buffer is too small, a larger one is created
* automatically.
*
* @param length * @param length
* the amount of bytes to read from the file. * the amount of bytes to read from the file.
* @return true if the whole data was read successfully, false otherwise. * @return true if the whole data was read successfully, false otherwise.
@ -82,7 +84,7 @@ public class ReadBuffer {
* Converts four bytes from the read buffer to a signed int. * Converts four bytes from the read buffer to a signed int.
* <p> * <p>
* The byte order is big-endian. * The byte order is big-endian.
* *
* @return the int value. * @return the int value.
*/ */
public int readInt() { public int readInt() {
@ -100,7 +102,7 @@ public class ReadBuffer {
* Converts eight bytes from the read buffer to a signed long. * Converts eight bytes from the read buffer to a signed long.
* <p> * <p>
* The byte order is big-endian. * The byte order is big-endian.
* *
* @return the long value. * @return the long value.
*/ */
public long readLong() { public long readLong() {
@ -123,7 +125,7 @@ public class ReadBuffer {
* Converts two bytes from the read buffer to a signed int. * Converts two bytes from the read buffer to a signed int.
* <p> * <p>
* The byte order is big-endian. * The byte order is big-endian.
* *
* @return the int value. * @return the int value.
*/ */
public int readShort() { public int readShort() {
@ -134,9 +136,10 @@ public class ReadBuffer {
/** /**
* Converts a variable amount of bytes from the read buffer to a signed int. * Converts a variable amount of bytes from the read buffer to a signed int.
* <p> * <p>
* The first bit is for continuation info, the other six (last byte) or seven (all other bytes) bits are for data. * The first bit is for continuation info, the other six (last byte) or
* The second bit in the last byte indicates the sign of the number. * seven (all other bytes) bits are for data. The second bit in the last
* * byte indicates the sign of the number.
*
* @return the value. * @return the value.
*/ */
public int readSignedInt() { public int readSignedInt() {
@ -192,11 +195,13 @@ public class ReadBuffer {
} }
/** /**
* Converts a variable amount of bytes from the read buffer to a signed int array. * Converts a variable amount of bytes from the read buffer to a signed int
* array.
* <p> * <p>
* The first bit is for continuation info, the other six (last byte) or seven (all other bytes) bits are for data. * The first bit is for continuation info, the other six (last byte) or
* The second bit in the last byte indicates the sign of the number. * seven (all other bytes) bits are for data. The second bit in the last
* * byte indicates the sign of the number.
*
* @param values * @param values
* result values * result values
* @param length * @param length
@ -322,10 +327,12 @@ public class ReadBuffer {
// } // }
/** /**
* Converts a variable amount of bytes from the read buffer to an unsigned int. * Converts a variable amount of bytes from the read buffer to an unsigned
* int.
* <p> * <p>
* The first bit is for continuation info, the other seven bits are for data. * The first bit is for continuation info, the other seven bits are for
* * data.
*
* @return the int value. * @return the int value.
*/ */
public int readUnsignedInt() { public int readUnsignedInt() {
@ -368,7 +375,7 @@ public class ReadBuffer {
/** /**
* Decodes a variable amount of bytes from the read buffer to a string. * Decodes a variable amount of bytes from the read buffer to a string.
* *
* @return the UTF-8 decoded string (may be null). * @return the UTF-8 decoded string (may be null).
*/ */
public String readUTF8EncodedString() { public String readUTF8EncodedString() {
@ -387,7 +394,7 @@ public class ReadBuffer {
/** /**
* Decodes the given amount of bytes from the read buffer to a string. * Decodes the given amount of bytes from the read buffer to a string.
* *
* @param stringLength * @param stringLength
* the length of the string in bytes. * the length of the string in bytes.
* @return the UTF-8 decoded string (may be null). * @return the UTF-8 decoded string (may be null).
@ -396,7 +403,8 @@ public class ReadBuffer {
if (stringLength > 0 && mBufferPosition + stringLength <= mBufferData.length) { if (stringLength > 0 && mBufferPosition + stringLength <= mBufferData.length) {
mBufferPosition += stringLength; mBufferPosition += stringLength;
try { try {
return new String(mBufferData, mBufferPosition - stringLength, stringLength, CHARSET_UTF8); return new String(mBufferData, mBufferPosition - stringLength, stringLength,
CHARSET_UTF8);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }
@ -407,7 +415,7 @@ public class ReadBuffer {
/** /**
* Decodes a variable amount of bytes from the read buffer to a string. * Decodes a variable amount of bytes from the read buffer to a string.
* *
* @param position * @param position
* buffer offset position of string * buffer offset position of string
* @return the UTF-8 decoded string (may be null). * @return the UTF-8 decoded string (may be null).
@ -436,7 +444,7 @@ public class ReadBuffer {
/** /**
* Sets the buffer position to the given offset. * Sets the buffer position to the given offset.
* *
* @param bufferPosition * @param bufferPosition
* the buffer position. * the buffer position.
*/ */
@ -446,7 +454,7 @@ public class ReadBuffer {
/** /**
* Skips the given number of bytes in the read buffer. * Skips the given number of bytes in the read buffer.
* *
* @param bytes * @param bytes
* the number of bytes to skip. * the number of bytes to skip.
*/ */

View File

@ -80,7 +80,7 @@ public class MapFileHeader {
/** /**
* Reads and validates the header block from the map file. * Reads and validates the header block from the map file.
* *
* @param readBuffer * @param readBuffer
* the ReadBuffer for the file data. * the ReadBuffer for the file data.
* @param fileSize * @param fileSize

View File

@ -19,7 +19,7 @@ import org.oscim.database.mapfile.MapDatabase;
/** /**
* Contains the immutable metadata of a map file. * Contains the immutable metadata of a map file.
* *
* @see MapDatabase#getMapInfo() * @see MapDatabase#getMapInfo()
*/ */
public class MapFileInfo extends org.oscim.database.MapInfo { public class MapFileInfo extends org.oscim.database.MapInfo {

View File

@ -59,7 +59,8 @@ final class OptionalFields {
*/ */
private static final int START_ZOOM_LEVEL_MAX = 22; private static final int START_ZOOM_LEVEL_MAX = 22;
static OpenResult readOptionalFields(ReadBuffer readBuffer, MapFileInfoBuilder mapFileInfoBuilder) { static OpenResult readOptionalFields(ReadBuffer readBuffer,
MapFileInfoBuilder mapFileInfoBuilder) {
OptionalFields optionalFields = new OptionalFields(readBuffer.readByte()); OptionalFields optionalFields = new OptionalFields(readBuffer.readByte());
mapFileInfoBuilder.optionalFields = optionalFields; mapFileInfoBuilder.optionalFields = optionalFields;
@ -106,13 +107,15 @@ final class OptionalFields {
if (this.hasStartPosition) { if (this.hasStartPosition) {
// get and check the start position latitude (4 byte) // get and check the start position latitude (4 byte)
int mapStartLatitude = readBuffer.readInt(); int mapStartLatitude = readBuffer.readInt();
if (mapStartLatitude < RequiredFields.LATITUDE_MIN || mapStartLatitude > RequiredFields.LATITUDE_MAX) { if (mapStartLatitude < RequiredFields.LATITUDE_MIN
|| mapStartLatitude > RequiredFields.LATITUDE_MAX) {
return new OpenResult("invalid map start latitude: " + mapStartLatitude); return new OpenResult("invalid map start latitude: " + mapStartLatitude);
} }
// get and check the start position longitude (4 byte) // get and check the start position longitude (4 byte)
int mapStartLongitude = readBuffer.readInt(); int mapStartLongitude = readBuffer.readInt();
if (mapStartLongitude < RequiredFields.LONGITUDE_MIN || mapStartLongitude > RequiredFields.LONGITUDE_MAX) { if (mapStartLongitude < RequiredFields.LONGITUDE_MIN
|| mapStartLongitude > RequiredFields.LONGITUDE_MAX) {
return new OpenResult("invalid map start longitude: " + mapStartLongitude); return new OpenResult("invalid map start longitude: " + mapStartLongitude);
} }

View File

@ -104,11 +104,13 @@ final class RequiredFields {
return new OpenResult("invalid longitude range: " + minLongitude + SPACE + maxLongitude); return new OpenResult("invalid longitude range: " + minLongitude + SPACE + maxLongitude);
} }
mapFileInfoBuilder.boundingBox = new BoundingBox(minLatitude, minLongitude, maxLatitude, maxLongitude); mapFileInfoBuilder.boundingBox = new BoundingBox(minLatitude, minLongitude, maxLatitude,
maxLongitude);
return OpenResult.SUCCESS; return OpenResult.SUCCESS;
} }
static OpenResult readFileSize(ReadBuffer readBuffer, long fileSize, MapFileInfoBuilder mapFileInfoBuilder) { static OpenResult readFileSize(ReadBuffer readBuffer, long fileSize,
MapFileInfoBuilder mapFileInfoBuilder) {
// get and check the file size (8 bytes) // get and check the file size (8 bytes)
long headerFileSize = readBuffer.readLong(); long headerFileSize = readBuffer.readLong();
if (headerFileSize != fileSize) { if (headerFileSize != fileSize) {
@ -174,7 +176,8 @@ final class RequiredFields {
return OpenResult.SUCCESS; return OpenResult.SUCCESS;
} }
static OpenResult readProjectionName(ReadBuffer readBuffer, MapFileInfoBuilder mapFileInfoBuilder) { static OpenResult readProjectionName(ReadBuffer readBuffer,
MapFileInfoBuilder mapFileInfoBuilder) {
// get and check the projection name // get and check the projection name
String projectionName = readBuffer.readUTF8EncodedString(); String projectionName = readBuffer.readUTF8EncodedString();
if (!MERCATOR.equals(projectionName)) { if (!MERCATOR.equals(projectionName)) {

View File

@ -120,14 +120,18 @@ public class SubFileParameter {
this.hashCodeValue = calculateHashCode(); this.hashCodeValue = calculateHashCode();
// calculate the XY numbers of the boundary tiles in this sub-file // calculate the XY numbers of the boundary tiles in this sub-file
this.boundaryTileBottom = MercatorProjection.latitudeToTileY(subFileParameterBuilder.boundingBox.minLatitudeE6 this.boundaryTileBottom = MercatorProjection.latitudeToTileY(
/ COORDINATES_DIVISOR, this.baseZoomLevel); subFileParameterBuilder.boundingBox.minLatitudeE6
this.boundaryTileLeft = MercatorProjection.longitudeToTileX(subFileParameterBuilder.boundingBox.minLongitudeE6 / COORDINATES_DIVISOR, this.baseZoomLevel);
/ COORDINATES_DIVISOR, this.baseZoomLevel); this.boundaryTileLeft = MercatorProjection.longitudeToTileX(
this.boundaryTileTop = MercatorProjection.latitudeToTileY(subFileParameterBuilder.boundingBox.maxLatitudeE6 subFileParameterBuilder.boundingBox.minLongitudeE6
/ COORDINATES_DIVISOR, this.baseZoomLevel); / COORDINATES_DIVISOR, this.baseZoomLevel);
this.boundaryTileRight = MercatorProjection.longitudeToTileX(subFileParameterBuilder.boundingBox.maxLongitudeE6 this.boundaryTileTop = MercatorProjection.latitudeToTileY(
/ COORDINATES_DIVISOR, this.baseZoomLevel); subFileParameterBuilder.boundingBox.maxLatitudeE6
/ COORDINATES_DIVISOR, this.baseZoomLevel);
this.boundaryTileRight = MercatorProjection.longitudeToTileX(
subFileParameterBuilder.boundingBox.maxLongitudeE6
/ COORDINATES_DIVISOR, this.baseZoomLevel);
// calculate the horizontal and vertical amount of blocks in this sub-file // calculate the horizontal and vertical amount of blocks in this sub-file
this.blocksWidth = this.boundaryTileRight - this.boundaryTileLeft + 1; this.blocksWidth = this.boundaryTileRight - this.boundaryTileLeft + 1;

View File

@ -48,7 +48,7 @@ import android.os.SystemClock;
import android.util.Log; import android.util.Log;
/** /**
* *
* *
*/ */
public class MapDatabase implements IMapDatabase { public class MapDatabase implements IMapDatabase {
@ -312,7 +312,7 @@ public class MapDatabase implements IMapDatabase {
private Tag[][] mElementTags; private Tag[][] mElementTags;
private void initDecorder() { private void initDecorder() {
// reusable tag set // reusable tag set
Tag[][] tags = new Tag[10][]; Tag[][] tags = new Tag[10][];
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
tags[i] = new Tag[i + 1]; tags[i] = new Tag[i + 1];

View File

@ -51,7 +51,7 @@ import android.os.SystemClock;
import android.util.Log; import android.util.Log;
/** /**
* *
* *
*/ */
public class MapDatabase implements IMapDatabase { public class MapDatabase implements IMapDatabase {
@ -1239,8 +1239,10 @@ public class MapDatabase implements IMapDatabase {
mCacheFile = null; mCacheFile = null;
} }
/* All code below is taken from or based on Google's Protocol Buffers /*
* implementation: */ * All code below is taken from or based on Google's Protocol Buffers
* implementation:
*/
// Protocol Buffers - Google's data interchange format // Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved. // Copyright 2008 Google Inc. All rights reserved.

View File

@ -1,26 +1,26 @@
/* /*
* Geometry.java * Geometry.java
* *
* PostGIS extension for PostgreSQL JDBC driver - geometry model * PostGIS extension for PostgreSQL JDBC driver - geometry model
* *
* (C) 2004 Paul Ramsey, pramsey@refractions.net * (C) 2004 Paul Ramsey, pramsey@refractions.net
* *
* (C) 2005 Markus Schaber, markus.schaber@logix-tt.com * (C) 2005 Markus Schaber, markus.schaber@logix-tt.com
* *
* This library is free software; you can redistribute it and/or modify it under * This library 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 * the terms of the GNU Lesser General License as published by the Free
* Software Foundation, either version 2.1 of the License. * Software Foundation, either version 2.1 of the License.
* *
* This library is distributed in the hope that it will be useful, but WITHOUT * This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General License for more * FOR A PARTICULAR PURPOSE. See the GNU Lesser General License for more
* details. * details.
* *
* You should have received a copy of the GNU Lesser General License * You should have received a copy of the GNU Lesser General License
* along with this library; if not, write to the Free Software Foundation, Inc., * along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at
* http://www.gnu.org. * http://www.gnu.org.
* *
* $Id: Geometry.java 9324 2012-02-27 22:08:12Z pramsey $ * $Id: Geometry.java 9324 2012-02-27 22:08:12Z pramsey $
*/ */
@ -82,7 +82,7 @@ abstract class Geometry implements Serializable {
/** /**
* The Text representations of the geometry types * The Text representations of the geometry types
* *
* @param type * @param type
* ... * ...
* @return ... * @return ...
@ -107,7 +107,8 @@ abstract class Geometry implements Serializable {
boolean haveMeasure = false; boolean haveMeasure = false;
/** /**
* The OGIS geometry type of this feature. this is final as it never changes, it is bound to the subclass of the * The OGIS geometry type of this feature. this is final as it never
* changes, it is bound to the subclass of the
* instance. * instance.
*/ */
final int type; final int type;
@ -124,7 +125,7 @@ abstract class Geometry implements Serializable {
/** /**
* Parse a SRID value, anything <= 0 is unknown * Parse a SRID value, anything <= 0 is unknown
* *
* @param srid * @param srid
* ... * ...
* @return ... * @return ...
@ -139,7 +140,7 @@ abstract class Geometry implements Serializable {
/** /**
* Constructor for subclasses * Constructor for subclasses
* *
* @param type * @param type
* has to be given by all subclasses. * has to be given by all subclasses.
*/ */
@ -165,8 +166,9 @@ abstract class Geometry implements Serializable {
} }
/** /**
* geometry specific equals implementation - only defined for non-null values * geometry specific equals implementation - only defined for non-null
* * values
*
* @param other * @param other
* ... * ...
* @return ... * @return ...
@ -180,9 +182,10 @@ abstract class Geometry implements Serializable {
} }
/** /**
* Whether test coordinates for geometry - subclass specific code Implementors can assume that dimensin, type, srid * Whether test coordinates for geometry - subclass specific code
* Implementors can assume that dimensin, type, srid
* and haveMeasure are equal, other != null and other is the same subclass. * and haveMeasure are equal, other != null and other is the same subclass.
* *
* @param other * @param other
* ... * ...
* @return ... * @return ...
@ -191,14 +194,14 @@ abstract class Geometry implements Serializable {
/** /**
* Return the number of Points of the geometry * Return the number of Points of the geometry
* *
* @return ... * @return ...
*/ */
abstract int numPoints(); abstract int numPoints();
/** /**
* Get the nth Point of the geometry * Get the nth Point of the geometry
* *
* @param n * @param n
* the index of the point, from 0 to numPoints()-1; * the index of the point, from 0 to numPoints()-1;
* @throws ArrayIndexOutOfBoundsException * @throws ArrayIndexOutOfBoundsException
@ -219,7 +222,7 @@ abstract class Geometry implements Serializable {
/** /**
* The OGIS geometry type number of this geometry. * The OGIS geometry type number of this geometry.
* *
* @return ... * @return ...
*/ */
int getType() { int getType() {
@ -228,7 +231,7 @@ abstract class Geometry implements Serializable {
/** /**
* Return the Type as String * Return the Type as String
* *
* @return ... * @return ...
*/ */
String getTypeString() { String getTypeString() {
@ -237,7 +240,7 @@ abstract class Geometry implements Serializable {
/** /**
* Returns whether we have a measure * Returns whether we have a measure
* *
* @return .... * @return ....
*/ */
boolean isMeasured() { boolean isMeasured() {
@ -245,9 +248,10 @@ abstract class Geometry implements Serializable {
} }
/** /**
* Queries the number of geometric dimensions of this geometry. This does not include measures, as opposed to the * Queries the number of geometric dimensions of this geometry. This does
* not include measures, as opposed to the
* server. * server.
* *
* @return The dimensionality (eg, 2D or 3D) of this geometry. * @return The dimensionality (eg, 2D or 3D) of this geometry.
*/ */
int getDimension() { int getDimension() {
@ -256,7 +260,7 @@ abstract class Geometry implements Serializable {
/** /**
* The OGIS geometry type number of this geometry. * The OGIS geometry type number of this geometry.
* *
* @return ... * @return ...
*/ */
int getSrid() { int getSrid() {
@ -264,8 +268,9 @@ abstract class Geometry implements Serializable {
} }
/** /**
* Recursively sets the srid on this geometry and all contained subgeometries * Recursively sets the srid on this geometry and all contained
* * subgeometries
*
* @param srid * @param srid
* ... * ...
*/ */
@ -286,8 +291,9 @@ abstract class Geometry implements Serializable {
} }
/** /**
* Render the WKT version of this Geometry (without SRID) into the given StringBuffer. * Render the WKT version of this Geometry (without SRID) into the given
* * StringBuffer.
*
* @param sb * @param sb
* ... * ...
* @param putM * @param putM
@ -306,8 +312,9 @@ abstract class Geometry implements Serializable {
} }
/** /**
* Render the WKT without the type name, but including the brackets into the StringBuffer * Render the WKT without the type name, but including the brackets into the
* * StringBuffer
*
* @param sb * @param sb
* ... * ...
*/ */
@ -318,8 +325,9 @@ abstract class Geometry implements Serializable {
} }
/** /**
* Render the "inner" part of the WKT (inside the brackets) into the StringBuffer. * Render the "inner" part of the WKT (inside the brackets) into the
* * StringBuffer.
*
* @param SB * @param SB
* ... * ...
*/ */
@ -327,7 +335,7 @@ abstract class Geometry implements Serializable {
/** /**
* backwards compatibility method * backwards compatibility method
* *
* @return ... * @return ...
*/ */
String getValue() { String getValue() {
@ -337,12 +345,16 @@ abstract class Geometry implements Serializable {
} }
/** /**
* Do some internal consistency checks on the geometry. Currently, all Geometries must have a valid dimension (2 or * Do some internal consistency checks on the geometry. Currently, all
* 3) and a valid type. 2-dimensional Points must have Z=0.0, as well as non-measured Points must have m=0.0. * Geometries must have a valid dimension (2 or
* Composed geometries must have all equal SRID, dimensionality and measures, as well as that they do not contain * 3) and a valid type. 2-dimensional Points must have Z=0.0, as well as
* NULL or inconsistent subgeometries. BinaryParser and WKTParser should only generate consistent geometries. * non-measured Points must have m=0.0.
* Composed geometries must have all equal SRID, dimensionality and
* measures, as well as that they do not contain
* NULL or inconsistent subgeometries. BinaryParser and WKTParser should
* only generate consistent geometries.
* BinaryWriter may produce invalid results on inconsistent geometries. * BinaryWriter may produce invalid results on inconsistent geometries.
* *
* @return true if all checks are passed. * @return true if all checks are passed.
*/ */
boolean checkConsistency() { boolean checkConsistency() {
@ -351,7 +363,7 @@ abstract class Geometry implements Serializable {
/** /**
* Splits the SRID=4711; part of a EWKT rep if present and sets the srid. * Splits the SRID=4711; part of a EWKT rep if present and sets the srid.
* *
* @param value * @param value
* ... * ...
* @return value without the SRID=4711; part * @return value without the SRID=4711; part

View File

@ -39,7 +39,7 @@ import org.postgresql.PGConnection;
import android.util.Log; import android.util.Log;
/** /**
* *
* *
*/ */
public class MapDatabase implements IMapDatabase { public class MapDatabase implements IMapDatabase {
@ -248,9 +248,10 @@ public class MapDatabase implements IMapDatabase {
} }
/** /**
* Parse a binary encoded geometry. Is synchronized to protect offset counter. (Unfortunately, Java does not have * Parse a binary encoded geometry. Is synchronized to protect offset
* counter. (Unfortunately, Java does not have
* neither call by reference nor multiple return values.) * neither call by reference nor multiple return values.)
* *
* @param value * @param value
* ... * ...
* @return ... * @return ...
@ -328,7 +329,7 @@ public class MapDatabase implements IMapDatabase {
/** /**
* Parse an Array of "full" Geometries * Parse an Array of "full" Geometries
* *
* @param data * @param data
* ... * ...
* @param count * @param count

View File

@ -1,7 +1,7 @@
/* /*
* This file has been copied from the following location: * This file has been copied from the following location:
* http://archives.postgresql.org/pgsql-jdbc/2009-12/msg00037.php * http://archives.postgresql.org/pgsql-jdbc/2009-12/msg00037.php
* *
* PostgreSQL code is typically under a BSD licence. * PostgreSQL code is typically under a BSD licence.
* http://jdbc.postgresql.org/license.html * http://jdbc.postgresql.org/license.html
*/ */
@ -51,7 +51,7 @@ public class PGHStore extends PGobject implements Map<String, String>
/** /**
* Initialize a hstore with a given string representation * Initialize a hstore with a given string representation
* *
* @param value * @param value
* String representated hstore * String representated hstore
* @throws SQLException * @throws SQLException
@ -96,7 +96,7 @@ public class PGHStore extends PGobject implements Map<String, String>
/** /**
* Returns the stored information as a string * Returns the stored information as a string
* *
* @return String represented hstore * @return String represented hstore
*/ */
@Override @Override
@ -144,7 +144,7 @@ public class PGHStore extends PGobject implements Map<String, String>
/** /**
* Returns whether an object is equal to this one or not * Returns whether an object is equal to this one or not
* *
* @param obj * @param obj
* Object to compare with * Object to compare with
* @return true if the two hstores are identical * @return true if the two hstores are identical

View File

@ -1,24 +1,24 @@
/* /*
* ValueGetter.java * ValueGetter.java
* *
* PostGIS extension for PostgreSQL JDBC driver - Binary Parser * PostGIS extension for PostgreSQL JDBC driver - Binary Parser
* *
* (C) 2005 Markus Schaber, markus.schaber@logix-tt.com * (C) 2005 Markus Schaber, markus.schaber@logix-tt.com
* *
* This library is free software; you can redistribute it and/or modify it under * This library 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 * the terms of the GNU Lesser General License as published by the Free
* Software Foundation, either version 2.1 of the License. * Software Foundation, either version 2.1 of the License.
* *
* This library is distributed in the hope that it will be useful, but WITHOUT * This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General License for more * FOR A PARTICULAR PURPOSE. See the GNU Lesser General License for more
* details. * details.
* *
* You should have received a copy of the GNU Lesser General License * You should have received a copy of the GNU Lesser General License
* along with this library; if not, write to the Free Software Foundation, Inc., * along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at
* http://www.gnu.org. * http://www.gnu.org.
* *
* $Id: ValueGetter.java 9324 2012-02-27 22:08:12Z pramsey $ * $Id: ValueGetter.java 9324 2012-02-27 22:08:12Z pramsey $
*/ */
@ -37,7 +37,7 @@ abstract class ValueGetter {
/** /**
* Get a byte, should be equal for all endians * Get a byte, should be equal for all endians
* *
* @return ... * @return ...
*/ */
byte getByte() { byte getByte() {
@ -58,7 +58,7 @@ abstract class ValueGetter {
/** /**
* Get a 32-Bit integer * Get a 32-Bit integer
* *
* @param index * @param index
* ... * ...
* @return ... * @return ...
@ -66,8 +66,9 @@ abstract class ValueGetter {
protected abstract int getInt(int index); protected abstract int getInt(int index);
/** /**
* Get a long value. This is not needed directly, but as a nice side-effect from GetDouble. * Get a long value. This is not needed directly, but as a nice side-effect
* * from GetDouble.
*
* @param index * @param index
* ... * ...
* @return ... * @return ...
@ -76,7 +77,7 @@ abstract class ValueGetter {
/** /**
* Get a double. * Get a double.
* *
* @return ... * @return ...
*/ */
double getDouble() { double getDouble() {
@ -101,9 +102,12 @@ abstract class ValueGetter {
protected long getLong(int index) { protected long getLong(int index) {
return ((long) (data[index] & 0xFF) << 56) | ((long) (data[index + 1] & 0xFF) << 48) return ((long) (data[index] & 0xFF) << 56) | ((long) (data[index + 1] & 0xFF) << 48)
| ((long) (data[index + 2] & 0xFF) << 40) | ((long) (data[index + 3] & 0xFF) << 32) | ((long) (data[index + 2] & 0xFF) << 40)
| ((long) (data[index + 4] & 0xFF) << 24) | ((long) (data[index + 5] & 0xFF) << 16) | ((long) (data[index + 3] & 0xFF) << 32)
| ((long) (data[index + 6] & 0xFF) << 8) | ((long) (data[index + 7] & 0xFF) << 0); | ((long) (data[index + 4] & 0xFF) << 24)
| ((long) (data[index + 5] & 0xFF) << 16)
| ((long) (data[index + 6] & 0xFF) << 8)
| ((long) (data[index + 7] & 0xFF) << 0);
} }
} }
@ -122,9 +126,12 @@ abstract class ValueGetter {
@Override @Override
protected long getLong(int index) { protected long getLong(int index) {
return ((long) (data[index + 7] & 0xFF) << 56) | ((long) (data[index + 6] & 0xFF) << 48) return ((long) (data[index + 7] & 0xFF) << 56)
| ((long) (data[index + 5] & 0xFF) << 40) | ((long) (data[index + 4] & 0xFF) << 32) | ((long) (data[index + 6] & 0xFF) << 48)
| ((long) (data[index + 3] & 0xFF) << 24) | ((long) (data[index + 2] & 0xFF) << 16) | ((long) (data[index + 5] & 0xFF) << 40)
| ((long) (data[index + 4] & 0xFF) << 32)
| ((long) (data[index + 3] & 0xFF) << 24)
| ((long) (data[index + 2] & 0xFF) << 16)
| ((long) (data[index + 1] & 0xFF) << 8) | ((long) (data[index] & 0xFF) << 0); | ((long) (data[index + 1] & 0xFF) << 8) | ((long) (data[index] & 0xFF) << 0);
} }

View File

@ -14,7 +14,6 @@
*/ */
package org.oscim.database.test; package org.oscim.database.test;
import org.oscim.core.BoundingBox; import org.oscim.core.BoundingBox;
import org.oscim.core.Tag; import org.oscim.core.Tag;
import org.oscim.core.Tile; import org.oscim.core.Tile;
@ -27,7 +26,7 @@ import org.oscim.database.QueryResult;
import org.oscim.generator.JobTile; import org.oscim.generator.JobTile;
/** /**
* *
* *
*/ */
public class MapDatabase implements IMapDatabase { public class MapDatabase implements IMapDatabase {

View File

@ -1,6 +1,6 @@
/* /*
* Copyright 2010, 2011, 2012 mapsforge.org * Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2012, 2013 OpenScienceMap * 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 Public License as published by the Free Software * terms of the GNU Lesser General Public License as published by the Free Software

View File

@ -210,6 +210,7 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
/** /**
* Sets the scale stroke factor for the given zoom level. * Sets the scale stroke factor for the given zoom level.
*
* @param zoomLevel * @param zoomLevel
* the zoom level for which the scale stroke factor should be * the zoom level for which the scale stroke factor should be
* set. * set.

View File

@ -33,6 +33,7 @@ public class DefaultResourceProxyImpl implements ResourceProxy, MapViewConstants
/** /**
* Constructor. * Constructor.
*
* @param pContext * @param pContext
* Used to get the display metrics that are used for scaling the * Used to get the display metrics that are used for scaling the
* bitmaps returned by {@@link getBitmap}. Can be null, * bitmaps returned by {@@link getBitmap}. Can be null,

View File

@ -188,6 +188,7 @@ public class ItemizedIconOverlay<Item extends OverlayItem> extends ItemizedOverl
* When a content sensitive action is performed the content item needs to be * When a content sensitive action is performed the content item needs to be
* identified. This method does that and then performs the assigned task on * identified. This method does that and then performs the assigned task on
* that item. * that item.
*
* @param event * @param event
* ... * ...
* @param mapView * @param mapView
@ -256,6 +257,7 @@ public class ItemizedIconOverlay<Item extends OverlayItem> extends ItemizedOverl
* When the item is touched one of these methods may be invoked depending on * When the item is touched one of these methods may be invoked depending on
* the type of touch. Each of them returns true if the event was completely * the type of touch. Each of them returns true if the event was completely
* handled. * handled.
*
* @param <T> * @param <T>
* .... * ....
*/ */

View File

@ -39,6 +39,7 @@ import android.opengl.Matrix;
* lowest index is drawn as last and therefore the 'topmost' marker. It also * lowest index is drawn as last and therefore the 'topmost' marker. It also
* gets checked for onTap first. This class is generic, because you then you get * gets checked for onTap first. This class is generic, because you then you get
* your custom item-class passed back in onTap(). * your custom item-class passed back in onTap().
*
* @param <Item> * @param <Item>
* ... * ...
*/ */
@ -220,6 +221,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
/** /**
* Method by which subclasses create the actual Items. This will only be * Method by which subclasses create the actual Items. This will only be
* called from populate() we'll cache them for later use. * called from populate() we'll cache them for later use.
*
* @param i * @param i
* ... * ...
* @return ... * @return ...
@ -228,6 +230,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
/** /**
* The number of items in this overlay. * The number of items in this overlay.
*
* @return ... * @return ...
*/ */
public abstract int size(); public abstract int size();
@ -265,7 +268,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
InternalItem pool = mItems; InternalItem pool = mItems;
mItems = null; mItems = null;
// flip order to draw in backward cycle, so the items // flip order to draw in backward cycle, so the items
// with the least index are on the front. // with the least index are on the front.
for (int a = 0; a < size; a++) { for (int a = 0; a < size; a++) {
InternalItem it; InternalItem it;
@ -293,6 +296,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
/** /**
* Returns the Item at the given index. * Returns the Item at the given index.
*
* @param position * @param position
* the position of the item to return * the position of the item to return
* @return the Item of the given index. * @return the Item of the given index.
@ -321,6 +325,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
* Override to modify the way an item is hit tested. The hit point is * Override to modify the way an item is hit tested. The hit point is
* relative to the marker's bounds. The default implementation just checks * relative to the marker's bounds. The default implementation just checks
* to see if the hit point is within the touchable bounds of the marker. * to see if the hit point is within the touchable bounds of the marker.
*
* @param item * @param item
* the item to hit test * the item to hit test
* @param marker * @param marker
@ -340,6 +345,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
/** /**
* Set whether or not to draw the focused item. The default is to draw it, * Set whether or not to draw the focused item. The default is to draw it,
* but some clients may prefer to draw the focused item themselves. * but some clients may prefer to draw the focused item themselves.
*
* @param drawFocusedItem * @param drawFocusedItem
* ... * ...
*/ */
@ -354,6 +360,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
* move the map, so if the Item isn't already centered, the user may get * move the map, so if the Item isn't already centered, the user may get
* confused. If the Item is not found, this is a no-op. You can also pass * confused. If the Item is not found, this is a no-op. You can also pass
* null to remove focus. * null to remove focus.
*
* @param item * @param item
* ... * ...
*/ */
@ -373,6 +380,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
* Adjusts a drawable's bounds so that (0,0) is a pixel in the location * Adjusts a drawable's bounds so that (0,0) is a pixel in the location
* described by the hotspot parameter. Useful for "pin"-like graphics. For * described by the hotspot parameter. Useful for "pin"-like graphics. For
* convenience, returns the same drawable that was passed in. * convenience, returns the same drawable that was passed in.
*
* @param marker * @param marker
* the drawable to adjust * the drawable to adjust
* @param hotspot * @param hotspot
@ -441,7 +449,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
// * <br/> // * <br/>
// * The focused item is always drawn last, which puts it visually on top of // * The focused item is always drawn last, which puts it visually on top of
// * the other items.<br/> // * the other items.<br/>
// * // *
// * @param canvas // * @param canvas
// * the Canvas upon which to draw. Note that this may already have // * the Canvas upon which to draw. Note that this may already have
// * a transformation applied, so be sure to leave it the way you // * a transformation applied, so be sure to leave it the way you
@ -478,7 +486,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
// /** // /**
// * Draws an item located at the provided screen coordinates to the canvas. // * Draws an item located at the provided screen coordinates to the canvas.
// * // *
// * @param canvas // * @param canvas
// * what the item is drawn upon // * what the item is drawn upon
// * @param item // * @param item

View File

@ -19,6 +19,7 @@ package org.oscim.overlay;
/** /**
* This class contains constants used by the map view. * This class contains constants used by the map view.
*
* @author Nicolas Gramlich * @author Nicolas Gramlich
*/ */
public interface MapViewConstants { public interface MapViewConstants {

View File

@ -36,6 +36,7 @@ import android.view.MotionEvent;
* {@link android.view.GestureDetector.SimpleOnGestureListener} and * {@link android.view.GestureDetector.SimpleOnGestureListener} and
* GestureDetector.OnGestureListener. The difference is there is an additional * GestureDetector.OnGestureListener. The difference is there is an additional
* argument for the item. * argument for the item.
*
* @author Nicolas Gramlich * @author Nicolas Gramlich
*/ */
public abstract class Overlay implements OverlayConstants { public abstract class Overlay implements OverlayConstants {
@ -94,6 +95,7 @@ public abstract class Overlay implements OverlayConstants {
/** /**
* Sets whether the Overlay is marked to be enabled. This setting does * Sets whether the Overlay is marked to be enabled. This setting does
* nothing by default, but should be checked before calling draw(). * nothing by default, but should be checked before calling draw().
*
* @param pEnabled * @param pEnabled
* ... * ...
*/ */
@ -104,6 +106,7 @@ public abstract class Overlay implements OverlayConstants {
/** /**
* Specifies if the Overlay is marked to be enabled. This should be checked * Specifies if the Overlay is marked to be enabled. This should be checked
* before calling draw(). * before calling draw().
*
* @return true if the Overlay is marked enabled, false otherwise * @return true if the Overlay is marked enabled, false otherwise
*/ */
public boolean isEnabled() { public boolean isEnabled() {
@ -115,6 +118,7 @@ public abstract class Overlay implements OverlayConstants {
* IDs cannot be fixed at compile time. Overlays should use this method to * IDs cannot be fixed at compile time. Overlays should use this method to
* obtain and store a menu id for each menu item at construction time. This * obtain and store a menu id for each menu item at construction time. This
* will ensure that two overlays don't use the same id. * will ensure that two overlays don't use the same id.
*
* @return an integer suitable to be used as a menu identifier * @return an integer suitable to be used as a menu identifier
*/ */
protected final static int getSafeMenuId() { protected final static int getSafeMenuId() {
@ -125,6 +129,7 @@ public abstract class Overlay implements OverlayConstants {
* Similar to <see cref="getSafeMenuId" />, except this reserves a sequence * Similar to <see cref="getSafeMenuId" />, except this reserves a sequence
* of IDs of length <param name="count" />. The returned number is the * of IDs of length <param name="count" />. The returned number is the
* starting index of that sequential list. * starting index of that sequential list.
*
* @param count * @param count
* .... * ....
* @return an integer suitable to be used as a menu identifier * @return an integer suitable to be used as a menu identifier
@ -142,7 +147,7 @@ public abstract class Overlay implements OverlayConstants {
// * with shadow=true, to lay down the shadow layer, and then again on all // * with shadow=true, to lay down the shadow layer, and then again on all
// * overlays with shadow=false. Callers should check isEnabled() before // * overlays with shadow=false. Callers should check isEnabled() before
// * calling draw(). By default, draws nothing. // * calling draw(). By default, draws nothing.
// * // *
// * @param c // * @param c
// * ... // * ...
// * @param osmv // * @param osmv
@ -159,6 +164,7 @@ public abstract class Overlay implements OverlayConstants {
/** /**
* Override to perform clean up of resources before shutdown. By default * Override to perform clean up of resources before shutdown. By default
* does nothing. * does nothing.
*
* @param mapView * @param mapView
* ... * ...
*/ */
@ -170,6 +176,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param keyCode * @param keyCode
* ... * ...
* @param event * @param event
@ -187,6 +194,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param keyCode * @param keyCode
* ... * ...
* @param event * @param event
@ -205,6 +213,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param e * @param e
* ... * ...
* @param mapView * @param mapView
@ -220,6 +229,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param e * @param e
* ... * ...
* @param mapView * @param mapView
@ -237,6 +247,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param e * @param e
* ... * ...
* @param mapView * @param mapView
@ -252,6 +263,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param e * @param e
* ... * ...
* @param mapView * @param mapView
@ -267,6 +279,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param e * @param e
* ... * ...
* @param mapView * @param mapView
@ -284,6 +297,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param e * @param e
* ... * ...
* @param mapView * @param mapView
@ -299,6 +313,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param pEvent1 * @param pEvent1
* ... * ...
* @param pEvent2 * @param pEvent2
@ -321,6 +336,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param e * @param e
* ... * ...
* @param mapView * @param mapView
@ -336,6 +352,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param pEvent1 * @param pEvent1
* ... * ...
* @param pEvent2 * @param pEvent2
@ -368,6 +385,7 @@ public abstract class Overlay implements OverlayConstants {
* Event, return <code>true</code>, otherwise return <code>false</code>. If * Event, return <code>true</code>, otherwise return <code>false</code>. If
* you returned <code>true</code> none of the following Overlays or the * you returned <code>true</code> none of the following Overlays or the
* underlying {@link MapView} has the chance to handle this event. * underlying {@link MapView} has the chance to handle this event.
*
* @param e * @param e
* ... * ...
* @param mapView * @param mapView
@ -392,7 +410,7 @@ public abstract class Overlay implements OverlayConstants {
// * coordinates. You can find appropriate coordinates from latitude/longitude // * coordinates. You can find appropriate coordinates from latitude/longitude
// * using the MapView.getProjection() method on the MapView passed to you in // * using the MapView.getProjection() method on the MapView passed to you in
// * draw(Canvas, MapView, boolean). // * draw(Canvas, MapView, boolean).
// * // *
// * @param canvas // * @param canvas
// * ... // * ...
// * @param drawable // * @param drawable
@ -428,6 +446,7 @@ public abstract class Overlay implements OverlayConstants {
/** /**
* Checks to see if the given x and y are close enough to an item * Checks to see if the given x and y are close enough to an item
* resulting in snapping the current action (e.g. zoom) to the item. * resulting in snapping the current action (e.g. zoom) to the item.
*
* @param x * @param x
* The x in screen coordinates. * The x in screen coordinates.
* @param y * @param y

View File

@ -24,6 +24,7 @@ import android.graphics.drawable.Drawable;
/** /**
* Immutable class describing a GeoPoint with a Title and a Description. * Immutable class describing a GeoPoint with a Title and a Description.
*
* @author Nicolas Gramlich * @author Nicolas Gramlich
* @author Theodore Hong * @author Theodore Hong
* @author Fred Eisele * @author Fred Eisele
@ -102,7 +103,8 @@ public class OverlayItem {
return mGeoPoint; return mGeoPoint;
} }
/* (copied from Google API docs) Returns the marker that should be used when /*
* (copied from Google API docs) Returns the marker that should be used when
* drawing this item on the map. A null value means that the default marker * drawing this item on the map. A null value means that the default marker
* should be drawn. Different markers can be returned for different states. * should be drawn. Different markers can be returned for different states.
* The different markers can have different bounds. The default behavior is * The different markers can have different bounds. The default behavior is
@ -110,7 +112,8 @@ public class OverlayItem {
* overlay item's marker, if it exists, and then return it. * overlay item's marker, if it exists, and then return it.
* @param stateBitset The current state. * @param stateBitset The current state.
* @return The marker for the current state, or null if the default marker * @return The marker for the current state, or null if the default marker
* for the overlay should be used. */ * for the overlay should be used.
*/
public Drawable getMarker(final int stateBitset) { public Drawable getMarker(final int stateBitset) {
// marker not specified // marker not specified
if (mMarker == null) { if (mMarker == null) {
@ -141,12 +144,14 @@ public class OverlayItem {
// =========================================================== // ===========================================================
// Methods // Methods
// =========================================================== // ===========================================================
/* (copied from the Google API docs) Sets the state of a drawable to match a /*
* (copied from the Google API docs) Sets the state of a drawable to match a
* given state bitset. This is done by converting the state bitset bits * given state bitset. This is done by converting the state bitset bits
* into * into
* a state set of R.attr.state_pressed, R.attr.state_selected and * a state set of R.attr.state_pressed, R.attr.state_selected and
* R.attr.state_focused attributes, and then calling {@link * R.attr.state_focused attributes, and then calling {@link
* Drawable.setState(int[])}. */ * Drawable.setState(int[])}.
*/
public static void setState(final Drawable drawable, final int stateBitset) { public static void setState(final Drawable drawable, final int stateBitset) {
final int[] states = new int[3]; final int[] states = new int[3];
int index = 0; int index = 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012, osmdroid: Viesturs Zarins, Martin Pearman * Copyright 2012, osmdroid: Viesturs Zarins, Martin Pearman
* Copyright 2012, Hannes Janetzek * Copyright 2012, Hannes Janetzek
* *
* 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
@ -192,6 +192,7 @@ public class PathOverlay extends Overlay {
/** /**
* Draw a great circle. Calculate a point for every 100km along the path. * Draw a great circle. Calculate a point for every 100km along the path.
*
* @param startPoint * @param startPoint
* start point of the great circle * start point of the great circle
* @param endPoint * @param endPoint
@ -212,6 +213,7 @@ public class PathOverlay extends Overlay {
/** /**
* Draw a great circle. * Draw a great circle.
*
* @param startPoint * @param startPoint
* start point of the great circle * start point of the great circle
* @param endPoint * @param endPoint

View File

@ -53,6 +53,7 @@ public interface ResourceProxy {
/** /**
* Use a string resource as a format definition, and format using the * Use a string resource as a format definition, and format using the
* supplied format arguments. * supplied format arguments.
*
* @param pResId * @param pResId
* ... * ...
* @param formatArgs * @param formatArgs
@ -65,6 +66,7 @@ public interface ResourceProxy {
/** /**
* Get a bitmap as a {@link Drawable} * Get a bitmap as a {@link Drawable}
*
* @param pResId * @param pResId
* ... * ...
* @return ... * @return ...
@ -73,6 +75,7 @@ public interface ResourceProxy {
/** /**
* Gets the density from the current screen's DisplayMetrics * Gets the density from the current screen's DisplayMetrics
*
* @return the screen's density * @return the screen's density
*/ */
float getDisplayMetricsDensity(); float getDisplayMetricsDensity();

View File

@ -80,7 +80,7 @@ public class GLRenderer implements GLSurfaceView.Renderer {
private static float[] mTileCoords = new float[8]; private static float[] mTileCoords = new float[8];
private static float[] mDebugCoords = new float[8]; private static float[] mDebugCoords = new float[8];
//private //private
static float[] mClearColor = null; static float[] mClearColor = null;
private static boolean mUpdateColor = false; private static boolean mUpdateColor = false;

View File

@ -135,8 +135,8 @@ public final class LineRenderer {
glUniformMatrix4fv(hLineMatrix[mode], 1, false, matrix, 0); glUniformMatrix4fv(hLineMatrix[mode], 1, false, matrix, 0);
// line scale factor for non fixed lines: within a zoom- // line scale factor for non fixed lines: within a zoom-
// level lines would be scaled by the factor 2 via projection. // level lines would be scaled by the factor 2 via projection.
// though lines should only scale by sqrt(2). this is achieved // though lines should only scale by sqrt(2). this is achieved
// by inverting scaling of extrusion vector with: width/sqrt(s). // by inverting scaling of extrusion vector with: width/sqrt(s).
// within one zoom-level: 1 <= s <= 2 // within one zoom-level: 1 <= s <= 2
float s = scale / div; float s = scale / div;
@ -280,7 +280,7 @@ public final class LineRenderer {
+ "varying vec2 v_mode;" + "varying vec2 v_mode;"
+ "void main() {" + "void main() {"
//+ " float len;" //+ " float len;"
// some say one should not use conditionals // some say one should not use conditionals
// (FIXME currently required as overlay line renderers dont load the texture) // (FIXME currently required as overlay line renderers dont load the texture)
//+ " if (u_mode == 0)" //+ " if (u_mode == 0)"
//+ " len = abs(v_st.s);" //+ " len = abs(v_st.s);"
@ -289,7 +289,7 @@ public final class LineRenderer {
// one trick to avoid branching, need to check performance // one trick to avoid branching, need to check performance
+ " float len = max(v_mode[0] * abs(v_st.s), v_mode[1] * texture2D(tex, v_st).a);" + " float len = max(v_mode[0] * abs(v_st.s), v_mode[1] * texture2D(tex, v_st).a);"
// interpolate alpha between: 0.0 < 1.0 - len < u_wscale // interpolate alpha between: 0.0 < 1.0 - len < u_wscale
// where wscale is 'filter width' / 'line width' and 0 <= len <= sqrt(2) // where wscale is 'filter width' / 'line width' and 0 <= len <= sqrt(2)
+ " gl_FragColor = u_color * smoothstep(0.0, u_wscale, 1.0 - len);" + " gl_FragColor = u_color * smoothstep(0.0, u_wscale, 1.0 - len);"
//+ " gl_FragColor = u_color * min(1.0, (1.0 - len) / u_wscale);" //+ " gl_FragColor = u_color * min(1.0, (1.0 - len) / u_wscale);"
+ "}"; + "}";
@ -316,7 +316,7 @@ public final class LineRenderer {
+ " fuzz = max(st_width.s, st_width.t);" + " fuzz = max(st_width.s, st_width.t);"
+ " }" + " }"
//+ " gl_FragColor = u_color * smoothstep(0.0, fuzz + u_wscale, 1.0 - len);" //+ " gl_FragColor = u_color * smoothstep(0.0, fuzz + u_wscale, 1.0 - len);"
// smoothstep is too sharp, guess one could increase extrusion with z.. // smoothstep is too sharp, guess one could increase extrusion with z..
// this looks ok: // this looks ok:
//+ " gl_FragColor = u_color * min(1.0, (1.0 - len) / (u_wscale + fuzz));" //+ " gl_FragColor = u_color * min(1.0, (1.0 - len) / (u_wscale + fuzz));"
// can be faster according to nvidia docs 'Optimize OpenGL ES 2.0 Performace' // can be faster according to nvidia docs 'Optimize OpenGL ES 2.0 Performace'

View File

@ -130,7 +130,7 @@ public final class PolygonRenderer {
glUniform4fv(hPolygonColor, 1, a.color, 0); glUniform4fv(hPolygonColor, 1, a.color, 0);
} }
// set stencil buffer mask used to draw this layer // set stencil buffer mask used to draw this layer
// also check that clip bit is set to avoid overdraw // also check that clip bit is set to avoid overdraw
// of other tiles // of other tiles
glStencilFunc(GL_EQUAL, 0xff, CLIP_BIT | 1 << c); glStencilFunc(GL_EQUAL, 0xff, CLIP_BIT | 1 << c);
@ -146,6 +146,7 @@ public final class PolygonRenderer {
/** /**
* draw polygon layers (unil layer.next is not polygon layer) * draw polygon layers (unil layer.next is not polygon layer)
* using stencil buffer method * using stencil buffer method
*
* @param pos * @param pos
* used to fade layers accorind to 'fade' * used to fade layers accorind to 'fade'
* in layer.area. * in layer.area.
@ -234,6 +235,7 @@ public final class PolygonRenderer {
/** /**
* Draw a tile filling rectangle to set stencil- and depth buffer * Draw a tile filling rectangle to set stencil- and depth buffer
* appropriately * appropriately
*
* @param first in the first run the clip region is set based on * @param first in the first run the clip region is set based on
* depth buffer and depth buffer is updated * depth buffer and depth buffer is updated
*/ */
@ -305,8 +307,10 @@ public final class PolygonRenderer {
glUniformMatrix4fv(hPolygonMatrix, 1, false, matrix, 0); glUniformMatrix4fv(hPolygonMatrix, 1, false, matrix, 0);
} }
/* clear stencilbuffer (tile region) by drawing /*
* a quad with func 'always' and op 'zero' */ * clear stencilbuffer (tile region) by drawing
* a quad with func 'always' and op 'zero'
*/
// disable drawing to framebuffer (will be re-enabled in fill) // disable drawing to framebuffer (will be re-enabled in fill)
glColorMask(false, false, false, false); glColorMask(false, false, false, false);

View File

@ -160,8 +160,10 @@ public abstract class ScanBox {
} }
} }
/* ported from Polymaps: Layer.js Copyright (c) 2010, SimpleGeo and Stamen /*
* Design */ * ported from Polymaps: Layer.js Copyright (c) 2010, SimpleGeo and Stamen
* Design
*/
// // scan-line conversion // // scan-line conversion
// function edge(a, b) { // function edge(a, b) {

View File

@ -8,7 +8,7 @@
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License along with * You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>. * this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -43,7 +43,7 @@ import android.util.Log;
public class TileManager { public class TileManager {
static final String TAG = TileManager.class.getSimpleName(); static final String TAG = TileManager.class.getSimpleName();
// TODO this should depend on the number of // TODO this should depend on the number of
// tiles that could be displayed // tiles that could be displayed
private static final int MAX_TILES_IN_QUEUE = 50; private static final int MAX_TILES_IN_QUEUE = 50;
@ -152,6 +152,7 @@ public class TileManager {
* Update list of visible tiles and passes them to TileManager, when not * Update list of visible tiles and passes them to TileManager, when not
* available tiles are created and added to JobQueue (mapView.addJobs) for * available tiles are created and added to JobQueue (mapView.addJobs) for
* loading by TileGenerator class * loading by TileGenerator class
*
* @param clear * @param clear
* whether to clear and reload all tiles * whether to clear and reload all tiles
*/ */
@ -174,7 +175,7 @@ public class TileManager {
for (int i = 0; i < mTilesSize; i++) for (int i = 0; i < mTilesSize; i++)
clearTile(mTiles[i]); clearTile(mTiles[i]);
} else { } else {
// mInitialized is set when surface changed // mInitialized is set when surface changed
// and VBOs might be lost // and VBOs might be lost
VertexPool.init(); VertexPool.init();
} }
@ -292,6 +293,7 @@ public class TileManager {
/** /**
* set mNewTiles for the visible tiles and pass it to GLRenderer, add jobs * set mNewTiles for the visible tiles and pass it to GLRenderer, add jobs
* for not yet loaded tiles * for not yet loaded tiles
*
* @param mapPosition * @param mapPosition
* the current MapPosition * the current MapPosition
* @param zdir * @param zdir
@ -303,7 +305,7 @@ public class TileManager {
// one could also append new tiles and sort in JobQueue // one could also append new tiles and sort in JobQueue
// but this has the nice side-effect that MapWorkers dont // but this has the nice side-effect that MapWorkers dont
// start with old jobs while new jobs are calculated, which // start with old jobs while new jobs are calculated, which
// should increase the chance that they are free when new // should increase the chance that they are free when new
// jobs come in. // jobs come in.
mMapView.addJobs(null); mMapView.addJobs(null);
@ -523,9 +525,9 @@ public class TileManager {
Log.d(TAG, "limitCache: tile still locked " + t + " " + t.distance); Log.d(TAG, "limitCache: tile still locked " + t + " " + t.distance);
//mTiles.add(t); //mTiles.add(t);
} else if (t.state == STATE_LOADING) { } else if (t.state == STATE_LOADING) {
// NOTE: when set loading to false the tile could be // NOTE: when set loading to false the tile could be
// added to load queue again while still processed in // added to load queue again while still processed in
// TileGenerator => need tile.cancel flag. // TileGenerator => need tile.cancel flag.
// t.isLoading = false; // t.isLoading = false;
//mTiles.add(t); //mTiles.add(t);
Log.d(TAG, "limitCache: cancel loading " + t + " " + t.distance); Log.d(TAG, "limitCache: cancel loading " + t + " " + t.distance);
@ -556,6 +558,7 @@ public class TileManager {
/** /**
* called from MapWorker Thread when tile is loaded by TileGenerator * called from MapWorker Thread when tile is loaded by TileGenerator
*
* @param jobTile * @param jobTile
* Tile ready for upload to GL * Tile ready for upload to GL
* @return ... caller does not care * @return ... caller does not care
@ -579,7 +582,7 @@ public class TileManager {
tile.state = STATE_NEW_DATA; tile.state = STATE_NEW_DATA;
// locked means the tile is visible or referenced by // locked means the tile is visible or referenced by
// a tile that might be visible. // a tile that might be visible.
if (tile.isLocked()) if (tile.isLocked())
mMapView.render(); mMapView.render();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012, 2013 OpenScienceMap * 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 Public License as published by the Free Software * terms of the GNU Lesser General Public License as published by the Free Software
@ -37,7 +37,7 @@ public abstract class Layer {
// in case of line and polygon layer: // in case of line and polygon layer:
// - number of VERTICES offset for this layertype in VBO // - number of VERTICES offset for this layertype in VBO
// otherwise: // otherwise:
// - offset in byte in VBO // - offset in byte in VBO
public int offset; public int offset;

View File

@ -57,6 +57,7 @@ public final class LineLayer extends Layer {
/** /**
* line extrusion is based on code from GLMap * line extrusion is based on code from GLMap
* (https://github.com/olofsj/GLMap/) * (https://github.com/olofsj/GLMap/)
*
* @param points * @param points
* array of points as x,y pairs * array of points as x,y pairs
* @param index * @param index

View File

@ -48,7 +48,7 @@ public final class SymbolLayer extends TextureLayer {
for (SymbolItem it = symbols; it != null; it = it.next) { for (SymbolItem it = symbols; it != null; it = it.next) {
if (it.bitmap == item.bitmap) { if (it.bitmap == item.bitmap) {
// insert after same bitmap // insert after same bitmap
item.next = it.next; item.next = it.next;
it.next = item; it.next = item;
return; return;

View File

@ -51,7 +51,7 @@ public class TextItem {
// in.next = ti.next; // in.next = ti.next;
// ti.next = in; // ti.next = in;
// } // }
// //
// TextItem t = ti; // TextItem t = ti;
// while (t.next != null) // while (t.next != null)
// t = t.next; // t = t.next;
@ -68,7 +68,7 @@ public class TextItem {
while (ti != null) { while (ti != null) {
TextItem next = ti.next; TextItem next = ti.next;
// drop references // drop references
ti.string = null; ti.string = null;
ti.text = null; ti.text = null;
ti.n1 = null; ti.n1 = null;
@ -83,7 +83,7 @@ public class TextItem {
TextItem next = ti.next; TextItem next = ti.next;
ti.next = pool; ti.next = pool;
// drop references // drop references
ti.string = null; ti.string = null;
ti.text = null; ti.text = null;
ti.n1 = null; ti.n1 = null;

View File

@ -91,7 +91,7 @@ public final class TextLayer extends TextureLayer {
it = it.next; it = it.next;
// unify duplicate string :) // unify duplicate string :)
// Note: this is required for 'packing test' in prepare to work! // Note: this is required for 'packing test' in prepare to work!
if (item.string != it.string && item.string.equals(it.string)) if (item.string != it.string && item.string.equals(it.string))
item.string = it.string; item.string = it.string;

View File

@ -20,7 +20,7 @@ public class VertexPoolItem {
public int used; public int used;
public VertexPoolItem next; public VertexPoolItem next;
// must be multiple of // must be multiple of
// 4 (LineLayer/PolygonLayer), // 4 (LineLayer/PolygonLayer),
// 6 (TexLineLayer) // 6 (TexLineLayer)
// 24 (TextureLayer) // 24 (TextureLayer)

View File

@ -156,7 +156,7 @@ public class BuildingOverlay extends RenderOverlay {
mCurVertices.used = v; mCurVertices.used = v;
// fill ZigZagQuadIndices(tm) // fill ZigZagQuadIndices(tm)
for (int j = 0; j < 2; j++) { for (int j = 0; j < 2; j++) {
short[] indices = mCurIndices[j].vertices; short[] indices = mCurIndices[j].vertices;
int cnt = mCurIndices[j].used; int cnt = mCurIndices[j].used;

View File

@ -28,7 +28,7 @@ import android.opengl.Matrix;
/* /*
* This is an example how to integrate custom OpenGL drawing routines as map overlay * This is an example how to integrate custom OpenGL drawing routines as map overlay
* *
* based on chapter 2 from: * based on chapter 2 from:
* https://github.com/dalinaum/opengl-es-book-samples/tree/master/Android * https://github.com/dalinaum/opengl-es-book-samples/tree/master/Android
* */ * */

View File

@ -227,7 +227,7 @@ public class ExtrusionOverlay extends RenderOverlay {
GLState.useProgram(extrusionProgram[shaderMode]); GLState.useProgram(extrusionProgram[shaderMode]);
GLState.enableVertexArrays(uExtVertexPosition, -1); GLState.enableVertexArrays(uExtVertexPosition, -1);
if (pos.scale < 2) { if (pos.scale < 2) {
// chances are high that one moves through a building // chances are high that one moves through a building
// with scale > 2 also draw back sides in this case. // with scale > 2 also draw back sides in this case.
GLES20.glEnable(GLES20.GL_CULL_FACE); GLES20.glEnable(GLES20.GL_CULL_FACE);
GLES20.glCullFace(GLES20.GL_FRONT); GLES20.glCullFace(GLES20.GL_FRONT);
@ -296,7 +296,7 @@ public class ExtrusionOverlay extends RenderOverlay {
GLES20.glDrawElements(GLES20.GL_TRIANGLES, el.mIndiceCnt[1], GLES20.glDrawElements(GLES20.GL_TRIANGLES, el.mIndiceCnt[1],
GLES20.GL_UNSIGNED_SHORT, el.mIndiceCnt[0] * 2); GLES20.GL_UNSIGNED_SHORT, el.mIndiceCnt[0] * 2);
// drawing gl_lines with the same coordinates does not result in // drawing gl_lines with the same coordinates does not result in
// same depth values as polygons, so add offset and draw gl_lequal: // same depth values as polygons, so add offset and draw gl_lequal:
GLES20.glDepthFunc(GLES20.GL_LEQUAL); GLES20.glDepthFunc(GLES20.GL_LEQUAL);
GlUtils.addOffsetM(mv, 100); GlUtils.addOffsetM(mv, 100);
@ -346,7 +346,7 @@ public class ExtrusionOverlay extends RenderOverlay {
_a * ((_g + _l + 1) / 255), _a * ((_g + _l + 1) / 255),
_a * ((_b + _l) / 255), _a * ((_b + _l) / 255),
_a, _a,
// sligthly differ adjacent side // sligthly differ adjacent side
// faces to improve contrast // faces to improve contrast
_a * ((_r - _s) / 255 + 0.01f), _a * ((_r - _s) / 255 + 0.01f),
_a * ((_g - _s) / 255 + 0.01f), _a * ((_g - _s) / 255 + 0.01f),
@ -385,7 +385,7 @@ public class ExtrusionOverlay extends RenderOverlay {
+ " float z = (0.96 + gl_Position.z * 0.04);" + " float z = (0.96 + gl_Position.z * 0.04);"
+ " if (u_mode == 1){" + " if (u_mode == 1){"
// sides 1 - use 0xff00 // sides 1 - use 0xff00
// scale direction to -0.5<>0.5 // scale direction to -0.5<>0.5
+ " float dir = abs(a_light.y / ff - 0.5);" + " float dir = abs(a_light.y / ff - 0.5);"
+ " color = u_color[1] * z;" + " color = u_color[1] * z;"
+ " color.rgb *= (0.7 + dir * 0.4);" + " color.rgb *= (0.7 + dir * 0.4);"
@ -420,7 +420,7 @@ public class ExtrusionOverlay extends RenderOverlay {
// decrease contrast with distance // decrease contrast with distance
+ " if (u_mode == 1){" + " if (u_mode == 1){"
// sides 1 - use 0xff00 // sides 1 - use 0xff00
// scale direction to -0.5<>0.5 // scale direction to -0.5<>0.5
//+ " float dir = abs(a_light.y / ff - 0.5);" //+ " float dir = abs(a_light.y / ff - 0.5);"
+ " float dir = a_light.y / ff;" + " float dir = a_light.y / ff;"
+ " float z = (0.98 + gl_Position.z * 0.02);" + " float z = (0.98 + gl_Position.z * 0.02);"

View File

@ -45,6 +45,7 @@ public abstract class RenderOverlay {
* called 1. by GLRenderer. Set 'newData' true when 'compile()' should be * called 1. by GLRenderer. Set 'newData' true when 'compile()' should be
* called * called
* before next 'render()' * before next 'render()'
*
* @param curPos TODO * @param curPos TODO
* @param positionChanged * @param positionChanged
* true when MapPosition has changed * true when MapPosition has changed
@ -61,6 +62,7 @@ public abstract class RenderOverlay {
/** /**
* called 3. draw overlay * called 3. draw overlay
*
* @param pos * @param pos
* current MapPosition * current MapPosition
* @param mv * @param mv
@ -73,6 +75,7 @@ public abstract class RenderOverlay {
/** /**
* Utility: set matrix relative to the difference of current MapPosition * Utility: set matrix relative to the difference of current MapPosition
* and the last updated Overlay MapPosition * and the last updated Overlay MapPosition
*
* @param curPos ... * @param curPos ...
* @param matrix ... * @param matrix ...
*/ */
@ -106,6 +109,7 @@ public abstract class RenderOverlay {
/** /**
* Utility: update mMapPosition * Utility: update mMapPosition
*
* @return true if position has changed * @return true if position has changed
*/ */
protected boolean updateMapPosition() { protected boolean updateMapPosition() {

View File

@ -125,7 +125,7 @@ public class TextOverlay extends BasicOverlay {
lp.x1, lp.y1, lp.x2, lp.y2); lp.x1, lp.y1, lp.x2, lp.y2);
if (intersect != 0) { if (intersect != 0) {
//Log.d(TAG, "overlap " + lp.string + " <> " + ti.string //Log.d(TAG, "overlap " + lp.string + " <> " + ti.string
//+ " at " + ti.x + ":" + ti.y); //+ " at " + ti.x + ":" + ti.y);
if ((lp.n1 != null && lp.n1 == ti.n2) || if ((lp.n1 != null && lp.n1 == ti.n2) ||

View File

@ -21,9 +21,9 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
/** /**
* An ExternalRenderTheme allows for customizing the rendering style of the map via an XML file. * An ExternalRenderTheme allows for customizing the rendering style of the map
* via an XML file.
*/ */
public class ExternalRenderTheme implements Theme { public class ExternalRenderTheme implements Theme {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -101,7 +101,8 @@ public class ExternalRenderTheme implements Theme {
mHashCodeValue = calculateHashCode(); mHashCodeValue = calculateHashCode();
} }
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { private void readObject(ObjectInputStream objectInputStream) throws IOException,
ClassNotFoundException {
objectInputStream.defaultReadObject(); objectInputStream.defaultReadObject();
calculateTransientValues(); calculateTransientValues();
} }

View File

@ -27,7 +27,7 @@ import android.graphics.Paint;
public interface IRenderCallback { public interface IRenderCallback {
/** /**
* Renders an area with the given parameters. * Renders an area with the given parameters.
* *
* @param area * @param area
* ... * ...
* @param level * @param level
@ -37,7 +37,7 @@ public interface IRenderCallback {
/** /**
* Renders an area symbol with the given bitmap. * Renders an area symbol with the given bitmap.
* *
* @param symbol * @param symbol
* the symbol to be rendered. * the symbol to be rendered.
*/ */
@ -45,7 +45,7 @@ public interface IRenderCallback {
/** /**
* Renders a point of interest circle with the given parameters. * Renders a point of interest circle with the given parameters.
* *
* @param radius * @param radius
* the radius of the circle. * the radius of the circle.
* @param fill * @param fill
@ -57,7 +57,7 @@ public interface IRenderCallback {
/** /**
* Renders a point of interest symbol with the given bitmap. * Renders a point of interest symbol with the given bitmap.
* *
* @param symbol * @param symbol
* the symbol to be rendered. * the symbol to be rendered.
*/ */
@ -65,7 +65,7 @@ public interface IRenderCallback {
/** /**
* Renders a way with the given parameters. * Renders a way with the given parameters.
* *
* @param line * @param line
* ... * ...
* @param level * @param level
@ -75,7 +75,7 @@ public interface IRenderCallback {
/** /**
* Renders a way with the given symbol along the way path. * Renders a way with the given symbol along the way path.
* *
* @param symbol * @param symbol
* the symbol to be rendered. * the symbol to be rendered.
* @param alignCenter * @param alignCenter
@ -87,7 +87,7 @@ public interface IRenderCallback {
/** /**
* Renders a way with the given text along the way path. * Renders a way with the given text along the way path.
* *
* @param text * @param text
* ... * ...
*/ */
@ -95,7 +95,7 @@ public interface IRenderCallback {
/** /**
* Renders an area caption with the given text. * Renders an area caption with the given text.
* *
* @param text * @param text
* the text to be rendered. * the text to be rendered.
*/ */
@ -103,7 +103,7 @@ public interface IRenderCallback {
/** /**
* Renders a point of interest caption with the given text. * Renders a point of interest caption with the given text.
* *
* @param text * @param text
* the text to be rendered. * the text to be rendered.
*/ */

View File

@ -202,7 +202,7 @@ public class RenderTheme {
} }
if (ri == null) { if (ri == null) {
// cache miss // cache miss
List<RenderInstruction> matches = mNodeInstructionList; List<RenderInstruction> matches = mNodeInstructionList;
matches.clear(); matches.clear();
for (int i = 0, n = mRulesList.size(); i < n; ++i) for (int i = 0, n = mRulesList.size(); i < n; ++i)
@ -276,6 +276,7 @@ public class RenderTheme {
/** /**
* Matches a way with the given parameters against this RenderTheme. * Matches a way with the given parameters against this RenderTheme.
*
* @param renderCallback * @param renderCallback
* the callback implementation which will be executed on each * the callback implementation which will be executed on each
* match. * match.
@ -442,6 +443,7 @@ public class RenderTheme {
/** /**
* Scales the stroke width of this RenderTheme by the given factor. * Scales the stroke width of this RenderTheme by the given factor.
*
* @param scaleFactor * @param scaleFactor
* the factor by which the stroke width should be scaled. * the factor by which the stroke width should be scaled.
*/ */
@ -453,6 +455,7 @@ public class RenderTheme {
/** /**
* Scales the text size of this RenderTheme by the given factor. * Scales the text size of this RenderTheme by the given factor.
*
* @param scaleFactor * @param scaleFactor
* the factor by which the text size should be scaled. * the factor by which the text size should be scaled.
*/ */

View File

@ -89,7 +89,7 @@ public class RenderThemeHandler extends DefaultHandler {
/** /**
* Logs the given information about an unknown XML attribute. * Logs the given information about an unknown XML attribute.
* *
* @param element * @param element
* the XML element name. * the XML element name.
* @param name * @param name

View File

@ -21,7 +21,8 @@ enum FontFamily {
/** /**
* @return the typeface object of this FontFamily. * @return the typeface object of this FontFamily.
* @see <a href="http://developer.android.com/reference/android/graphics/Typeface.html">Typeface</a> * @see <a
* href="http://developer.android.com/reference/android/graphics/Typeface.html">Typeface</a>
*/ */
Typeface toTypeface() { Typeface toTypeface() {
switch (this) { switch (this) {

View File

@ -19,7 +19,8 @@ enum FontStyle {
/** /**
* @return the constant int value of this FontStyle. * @return the constant int value of this FontStyle.
* @see <a href="http://developer.android.com/reference/android/graphics/Typeface.html">Typeface</a> * @see <a
* href="http://developer.android.com/reference/android/graphics/Typeface.html">Typeface</a>
*/ */
int toInt() { int toInt() {
switch (this) { switch (this) {

View File

@ -47,7 +47,7 @@ public abstract class RenderInstruction {
/** /**
* Scales the stroke width of this RenderInstruction by the given factor. * Scales the stroke width of this RenderInstruction by the given factor.
* *
* @param scaleFactor * @param scaleFactor
* the factor by which the stroke width should be scaled. * the factor by which the stroke width should be scaled.
*/ */
@ -56,7 +56,7 @@ public abstract class RenderInstruction {
/** /**
* Scales the text size of this RenderInstruction by the given factor. * Scales the text size of this RenderInstruction by the given factor.
* *
* @param scaleFactor * @param scaleFactor
* the factor by which the text size should be scaled. * the factor by which the text size should be scaled.
*/ */

View File

@ -27,7 +27,8 @@ public final class AndroidUtils {
private static final String[] EMULATOR_NAMES = { "google_sdk", "sdk" }; private static final String[] EMULATOR_NAMES = { "google_sdk", "sdk" };
/** /**
* @return true if the application is running on the Android emulator, false otherwise. * @return true if the application is running on the Android emulator, false
* otherwise.
*/ */
public static boolean applicationRunsOnAndroidEmulator() { public static boolean applicationRunsOnAndroidEmulator() {
for (int i = 0, n = EMULATOR_NAMES.length; i < n; ++i) { for (int i = 0, n = EMULATOR_NAMES.length; i < n; ++i) {

View File

@ -17,7 +17,7 @@ package org.oscim.utils;
public class FastMath { public class FastMath {
/** /**
* from http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog * from http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
* *
* @param v * @param v
* ... * ...
* @return ... * @return ...

View File

@ -23,6 +23,7 @@ public final class GeometryUtils {
/** /**
* Calculates the center of the minimum bounding rectangle for the given * Calculates the center of the minimum bounding rectangle for the given
* coordinates. * coordinates.
*
* @param coordinates * @param coordinates
* the coordinates for which calculation should be done. * the coordinates for which calculation should be done.
* @return the center coordinates of the minimum bounding rectangle. * @return the center coordinates of the minimum bounding rectangle.
@ -192,7 +193,7 @@ public final class GeometryUtils {
return 2; //XSEC_COINCIDENT; return 2; //XSEC_COINCIDENT;
// lines are parallel // lines are parallel
return 3; //XSEC_PARALLEL; return 3; //XSEC_PARALLEL;
} }
double ua = ua_numr / denr; double ua = ua_numr / denr;

View File

@ -8,14 +8,14 @@ import android.opengl.GLSurfaceView;
import android.util.Log; import android.util.Log;
/** /**
* *
* *
*/ */
public class GlConfigChooser implements GLSurfaceView.EGLConfigChooser { public class GlConfigChooser implements GLSurfaceView.EGLConfigChooser {
static private final String TAG = "ConfigChooser"; static private final String TAG = "ConfigChooser";
/** /**
* *
*/ */
public static int stencilSize = 0; public static int stencilSize = 0;
@ -126,7 +126,8 @@ public class GlConfigChooser implements GLSurfaceView.EGLConfigChooser {
int s = findConfigAttrib(egl, display, config, EGL10.EGL_STENCIL_SIZE, 0); int s = findConfigAttrib(egl, display, config, EGL10.EGL_STENCIL_SIZE, 0);
/* /*
* EGL_CONFIG_CAVEAT value #define EGL_NONE 0x3038 #define EGL_SLOW_CONFIG 0x3050 #define * EGL_CONFIG_CAVEAT value #define EGL_NONE 0x3038 #define
* EGL_SLOW_CONFIG 0x3050 #define
* EGL_NON_CONFORMANT_CONFIG 0x3051 * EGL_NON_CONFORMANT_CONFIG 0x3051
*/ */

View File

@ -18,9 +18,11 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
/** /**
* An LRUCache with a fixed size and an access-order policy. Old mappings are automatically removed from the cache when * An LRUCache with a fixed size and an access-order policy. Old mappings are
* new mappings are added. This implementation uses an {@link LinkedHashMap} internally. * automatically removed from the cache when
* * new mappings are added. This implementation uses an {@link LinkedHashMap}
* internally.
*
* @param <K> * @param <K>
* the type of the map key, see {@link Map}. * the type of the map key, see {@link Map}.
* @param <V> * @param <V>

View File

@ -88,7 +88,7 @@ public class LineClipper {
} }
// CohenSutherland clipping algorithm clips a line from // CohenSutherland clipping algorithm clips a line from
// P0 = (x0, y0) to P1 = (x1, y1) against a rectangle with // P0 = (x0, y0) to P1 = (x1, y1) against a rectangle with
// diagonal from (xmin, ymin) to (xmax, ymax). // diagonal from (xmin, ymin) to (xmax, ymax).
private static boolean clip(int x0, int y0, int x1, int y1, private static boolean clip(int x0, int y0, int x1, int y1,
int xmin, int ymin, int xmax, int ymax, int outcode0, int outcode1) { int xmin, int ymin, int xmax, int ymax, int outcode0, int outcode1) {

View File

@ -111,7 +111,8 @@ public abstract class PausableThread extends Thread {
} }
/** /**
* Called once when this thread continues to work after a pause. The default implementation is empty. * Called once when this thread continues to work after a pause. The default
* implementation is empty.
*/ */
protected void afterPause() { protected void afterPause() {
// do nothing // do nothing
@ -122,7 +123,8 @@ public abstract class PausableThread extends Thread {
} }
/** /**
* Called once at the end of the {@link #run()} method. The default implementation is empty. * Called once at the end of the {@link #run()} method. The default
* implementation is empty.
*/ */
protected void afterRun() { protected void afterRun() {
// do nothing // do nothing
@ -130,7 +132,7 @@ public abstract class PausableThread extends Thread {
/** /**
* Called when this thread is not paused and should do its work. * Called when this thread is not paused and should do its work.
* *
* @throws InterruptedException * @throws InterruptedException
* if the thread has been interrupted. * if the thread has been interrupted.
*/ */
@ -142,7 +144,8 @@ public abstract class PausableThread extends Thread {
protected abstract String getThreadName(); protected abstract String getThreadName();
/** /**
* @return the priority of this thread. The default value is {@link Thread#NORM_PRIORITY}. * @return the priority of this thread. The default value is
* {@link Thread#NORM_PRIORITY}.
*/ */
protected int getThreadPriority() { protected int getThreadPriority() {
return Thread.NORM_PRIORITY; return Thread.NORM_PRIORITY;

View File

@ -100,6 +100,7 @@ public abstract class MapActivity extends Activity {
/** /**
* This method is called once by each MapView during its setup process. * This method is called once by each MapView during its setup process.
*
* @param mapView * @param mapView
* the calling MapView. * the calling MapView.
*/ */

View File

@ -27,7 +27,8 @@ import android.graphics.Paint;
import android.graphics.Typeface; import android.graphics.Typeface;
/** /**
* A MapScaleBar displays the ratio of a distance on the map to the corresponding distance on the ground. * A MapScaleBar displays the ratio of a distance on the map to the
* corresponding distance on the ground.
*/ */
public class MapScaleBar { public class MapScaleBar {
/** /**
@ -128,7 +129,8 @@ public class MapScaleBar {
/** /**
* @param imperialUnits * @param imperialUnits
* true if imperial units should be used rather than metric units. * true if imperial units should be used rather than metric
* units.
*/ */
public void setImperialUnits(boolean imperialUnits) { public void setImperialUnits(boolean imperialUnits) {
mImperialUnits = imperialUnits; mImperialUnits = imperialUnits;
@ -145,7 +147,7 @@ public class MapScaleBar {
/** /**
* Overrides the specified text field with the given string. * Overrides the specified text field with the given string.
* *
* @param textField * @param textField
* the text field to override. * the text field to override.
* @param value * @param value
@ -188,7 +190,7 @@ public class MapScaleBar {
/** /**
* Redraws the map scale bitmap with the given parameters. * Redraws the map scale bitmap with the given parameters.
* *
* @param scaleBarLength * @param scaleBarLength
* the length of the map scale bar in pixels. * the length of the map scale bar in pixels.
* @param mapScaleValue * @param mapScaleValue

View File

@ -273,6 +273,7 @@ public class MapView extends RelativeLayout {
/** /**
* Calculates all necessary tiles and adds jobs accordingly. * Calculates all necessary tiles and adds jobs accordingly.
*
* @param changedPos TODO * @param changedPos TODO
*/ */
public void redrawMap(boolean changedPos) { public void redrawMap(boolean changedPos) {
@ -344,6 +345,7 @@ public class MapView extends RelativeLayout {
/** /**
* Sets the MapDatabase for this MapView. * Sets the MapDatabase for this MapView.
*
* @param options * @param options
* the new MapDatabase options. * the new MapDatabase options.
* @return ... * @return ...
@ -395,6 +397,7 @@ public class MapView extends RelativeLayout {
/** /**
* Sets the internal theme which is used for rendering the map. * Sets the internal theme which is used for rendering the map.
*
* @param internalRenderTheme * @param internalRenderTheme
* the internal rendering theme. * the internal rendering theme.
* @return ... * @return ...
@ -419,6 +422,7 @@ public class MapView extends RelativeLayout {
/** /**
* Sets the theme file which is used for rendering the map. * Sets the theme file which is used for rendering the map.
*
* @param renderThemePath * @param renderThemePath
* the path to the XML file which defines the rendering theme. * the path to the XML file which defines the rendering theme.
* @throws IllegalArgumentException * @throws IllegalArgumentException
@ -572,6 +576,7 @@ public class MapView extends RelativeLayout {
/** /**
* Sets the center and zoom level of this MapView and triggers a redraw. * Sets the center and zoom level of this MapView and triggers a redraw.
*
* @param mapPosition * @param mapPosition
* the new map position of this MapView. * the new map position of this MapView.
*/ */
@ -585,6 +590,7 @@ public class MapView extends RelativeLayout {
/** /**
* Sets the center of the MapView and triggers a redraw. * Sets the center of the MapView and triggers a redraw.
*
* @param geoPoint * @param geoPoint
* the new center point of the map. * the new center point of the map.
*/ */
@ -604,6 +610,7 @@ public class MapView extends RelativeLayout {
/** /**
* add jobs and remember MapWorkers that stuff needs to be done * add jobs and remember MapWorkers that stuff needs to be done
*
* @param jobs * @param jobs
* tile jobs * tile jobs
*/ */
@ -644,6 +651,7 @@ public class MapView extends RelativeLayout {
* You can add/remove/reorder your Overlays using the List of * You can add/remove/reorder your Overlays using the List of
* {@link Overlay}. The first (index 0) Overlay gets drawn first, the one * {@link Overlay}. The first (index 0) Overlay gets drawn first, the one
* with the highest as the last one. * with the highest as the last one.
*
* @return ... * @return ...
*/ */
public List<Overlay> getOverlays() { public List<Overlay> getOverlays() {

View File

@ -164,12 +164,12 @@ public class MapViewPosition {
// get the z-value of the map-plane for a point on screen // get the z-value of the map-plane for a point on screen
private float getZ(float y) { private float getZ(float y) {
// calculate the intersection of a ray from // calculate the intersection of a ray from
// camera origin and the map plane // camera origin and the map plane
// origin is moved by VIEW_DISTANCE // origin is moved by VIEW_DISTANCE
double cx = VIEW_DISTANCE; double cx = VIEW_DISTANCE;
// 'height' of the ray // 'height' of the ray
double ry = y * (mHeight / mWidth) * 0.5f; double ry = y * (mHeight / mWidth) * 0.5f;
// tilt of the plane (center is kept on x = 0) // tilt of the plane (center is kept on x = 0)
@ -247,6 +247,7 @@ public class MapViewPosition {
/** /**
* ... * ...
*
* @return BoundingBox containing view * @return BoundingBox containing view
*/ */
public synchronized BoundingBox getViewBox() { public synchronized BoundingBox getViewBox() {
@ -298,6 +299,7 @@ public class MapViewPosition {
/** /**
* for x,y in screen coordinates get the point on the map in map-tile * for x,y in screen coordinates get the point on the map in map-tile
* coordinates * coordinates
*
* @param x ... * @param x ...
* @param y ... * @param y ...
* @param reuse ... * @param reuse ...
@ -320,6 +322,7 @@ public class MapViewPosition {
/** /**
* get the GeoPoint for x,y in screen coordinates * get the GeoPoint for x,y in screen coordinates
*
* @param x screen pixel x * @param x screen pixel x
* @param y screen pixel y * @param y screen pixel y
* @return the corresponding GeoPoint * @return the corresponding GeoPoint
@ -344,6 +347,7 @@ public class MapViewPosition {
/** /**
* get the screen pixel for a GeoPoint * get the screen pixel for a GeoPoint
*
* @param geoPoint ... * @param geoPoint ...
* @param reuse ... * @param reuse ...
* @return ... * @return ...
@ -456,6 +460,7 @@ public class MapViewPosition {
/** /**
* Moves this MapViewPosition by the given amount of pixels. * Moves this MapViewPosition by the given amount of pixels.
*
* @param mx the amount of pixels to move the map horizontally. * @param mx the amount of pixels to move the map horizontally.
* @param my the amount of pixels to move the map vertically. * @param my the amount of pixels to move the map vertically.
*/ */
@ -492,6 +497,7 @@ public class MapViewPosition {
/** /**
* - * -
*
* @param scale ... * @param scale ...
* @param pivotX ... * @param pivotX ...
* @param pivotY ... * @param pivotY ...
@ -537,6 +543,7 @@ public class MapViewPosition {
/** /**
* rotate map around pivot cx,cy * rotate map around pivot cx,cy
*
* @param angle ... * @param angle ...
* @param cx ... * @param cx ...
* @param cy ... * @param cy ...

View File

@ -139,7 +139,7 @@ public class MapZoomControls {
/** /**
* Zooms in or out by the given amount of zoom levels. * Zooms in or out by the given amount of zoom levels.
* *
* @param zoomLevelDiff * @param zoomLevelDiff
* the difference to the current zoom level. * the difference to the current zoom level.
* @return true if the zoom level was changed, false otherwise. * @return true if the zoom level was changed, false otherwise.
@ -208,7 +208,7 @@ public class MapZoomControls {
* are {@link Gravity#TOP}, {@link Gravity#CENTER_VERTICAL}, * are {@link Gravity#TOP}, {@link Gravity#CENTER_VERTICAL},
* {@link Gravity#BOTTOM}, {@link Gravity#LEFT}, * {@link Gravity#BOTTOM}, {@link Gravity#LEFT},
* {@link Gravity#CENTER_HORIZONTAL} and {@link Gravity#RIGHT}. * {@link Gravity#CENTER_HORIZONTAL} and {@link Gravity#RIGHT}.
* *
* @param zoomControlsGravity * @param zoomControlsGravity
* a combination of {@link Gravity} constants describing the * a combination of {@link Gravity} constants describing the
* desired placement. * desired placement.
@ -227,7 +227,7 @@ public class MapZoomControls {
* current {@link TileGenerator}. For example, downloading map tiles may * current {@link TileGenerator}. For example, downloading map tiles may
* only be possible up to a certain zoom level. Setting a higher maximum * only be possible up to a certain zoom level. Setting a higher maximum
* zoom level has no effect in this case. * zoom level has no effect in this case.
* *
* @param zoomLevelMax * @param zoomLevelMax
* the maximum zoom level. * the maximum zoom level.
* @throws IllegalArgumentException * @throws IllegalArgumentException
@ -243,7 +243,7 @@ public class MapZoomControls {
/** /**
* Sets the minimum zoom level of the map. * Sets the minimum zoom level of the map.
* *
* @param zoomLevelMin * @param zoomLevelMin
* the minimum zoom level. * the minimum zoom level.
* @throws IllegalArgumentException * @throws IllegalArgumentException

View File

@ -52,6 +52,7 @@ public class TriangleJNI {
/** /**
* !!! NOT for general use!!! - this is specifically for ExtrusionLayer * !!! NOT for general use!!! - this is specifically for ExtrusionLayer
* . * .
*
* @param points points to use: array of x,y coordinates * @param points points to use: array of x,y coordinates
* @param numRings number of rings in polygon == outer(1) + inner rings * @param numRings number of rings in polygon == outer(1) + inner rings
* @param io input: 1. number of all points, 2.. number of points in rings - * @param io input: 1. number of all points, 2.. number of points in rings -