formatting
This commit is contained in:
parent
303e0cb4ce
commit
f2b7a9fdf8
@ -2,7 +2,7 @@
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2012 osmdroid authors: Nicolas Gramlich, Theodore Hong
|
||||
* Copyright 2012 Hannes Janetzek
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
@ -70,12 +70,14 @@ public class MapPosition {
|
||||
// (float) (MercatorProjection.latitudeToPixelY(in.getLatitude(), zoomLevel) - y);
|
||||
// }
|
||||
|
||||
/** @param geoPoint
|
||||
/**
|
||||
* @param geoPoint
|
||||
* the map position.
|
||||
* @param zoomLevel
|
||||
* the zoom level.
|
||||
* @param scale
|
||||
* ... */
|
||||
* ...
|
||||
*/
|
||||
public MapPosition(GeoPoint geoPoint, byte zoomLevel, float scale) {
|
||||
this.zoomLevel = zoomLevel;
|
||||
this.scale = scale;
|
||||
|
@ -49,6 +49,7 @@ public final class MercatorProjection {
|
||||
/**
|
||||
* Calculates the distance on the ground that is represented by a single
|
||||
* pixel on the map.
|
||||
*
|
||||
* @param latitude
|
||||
* the latitude coordinate at which the resolution should be
|
||||
* calculated.
|
||||
@ -64,6 +65,7 @@ public final class MercatorProjection {
|
||||
/**
|
||||
* Converts a latitude coordinate (in degrees) to a pixel Y coordinate at a
|
||||
* certain zoom level.
|
||||
*
|
||||
* @param latitude
|
||||
* the latitude coordinate that should be converted.
|
||||
* @param zoomLevel
|
||||
@ -84,6 +86,7 @@ public final class MercatorProjection {
|
||||
|
||||
/**
|
||||
* Projects a longitude coordinate (in degrees) to the range [0.0,1.0]
|
||||
*
|
||||
* @param latitude
|
||||
* the latitude coordinate that should be converted.
|
||||
* @return the position .
|
||||
@ -96,6 +99,7 @@ public final class MercatorProjection {
|
||||
/**
|
||||
* Converts a latitude coordinate (in degrees) to a tile Y number at a
|
||||
* certain zoom level.
|
||||
*
|
||||
* @param latitude
|
||||
* the latitude coordinate that should be converted.
|
||||
* @param zoomLevel
|
||||
@ -138,6 +142,7 @@ public final class MercatorProjection {
|
||||
/**
|
||||
* Converts a longitude coordinate (in degrees) to a pixel X coordinate at a
|
||||
* certain zoom level.
|
||||
*
|
||||
* @param longitude
|
||||
* the longitude coordinate that should be converted.
|
||||
* @param zoomLevel
|
||||
@ -155,6 +160,7 @@ public final class MercatorProjection {
|
||||
|
||||
/**
|
||||
* Projects a longitude coordinate (in degrees) to the range [0.0,1.0]
|
||||
*
|
||||
* @param longitude
|
||||
* the longitude coordinate that should be converted.
|
||||
* @return the position .
|
||||
@ -166,6 +172,7 @@ public final class MercatorProjection {
|
||||
/**
|
||||
* Converts a longitude coordinate (in degrees) to the tile X number at a
|
||||
* certain zoom level.
|
||||
*
|
||||
* @param longitude
|
||||
* the longitude coordinate that should be converted.
|
||||
* @param zoomLevel
|
||||
@ -179,6 +186,7 @@ public final class MercatorProjection {
|
||||
/**
|
||||
* Converts a pixel X coordinate at a certain zoom level to a longitude
|
||||
* coordinate.
|
||||
*
|
||||
* @param pixelX
|
||||
* the pixel X coordinate that should be converted.
|
||||
* @param zoomLevel
|
||||
@ -191,6 +199,7 @@ public final class MercatorProjection {
|
||||
|
||||
/**
|
||||
* Converts a pixel X coordinate to the tile X number.
|
||||
*
|
||||
* @param pixelX
|
||||
* the pixel X coordinate that should be converted.
|
||||
* @param zoomLevel
|
||||
@ -205,6 +214,7 @@ public final class MercatorProjection {
|
||||
/**
|
||||
* Converts a pixel Y coordinate at a certain zoom level to a latitude
|
||||
* coordinate.
|
||||
*
|
||||
* @param pixelY
|
||||
* the pixel Y coordinate that should be converted.
|
||||
* @param zoomLevel
|
||||
@ -218,6 +228,7 @@ public final class MercatorProjection {
|
||||
|
||||
/**
|
||||
* Converts a pixel Y coordinate to the tile Y number.
|
||||
*
|
||||
* @param pixelY
|
||||
* the pixel Y coordinate that should be converted.
|
||||
* @param zoomLevel
|
||||
@ -232,6 +243,7 @@ public final class MercatorProjection {
|
||||
/**
|
||||
* Converts a tile X number at a certain zoom level to a longitude
|
||||
* coordinate.
|
||||
*
|
||||
* @param tileX
|
||||
* the tile X number that should be converted.
|
||||
* @param zoomLevel
|
||||
@ -245,6 +257,7 @@ public final class MercatorProjection {
|
||||
/**
|
||||
* Converts a tile Y number at a certain zoom level to a latitude
|
||||
* coordinate.
|
||||
*
|
||||
* @param tileY
|
||||
* the tile Y number that should be converted.
|
||||
* @param zoomLevel
|
||||
|
@ -16,11 +16,11 @@
|
||||
package org.oscim.core;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class WebMercator {
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public static final String NAME = "SphericalMercator";
|
||||
|
||||
@ -85,7 +85,7 @@ public class WebMercator {
|
||||
|
||||
/**
|
||||
* from http://pauldendulk.com/2011/04/projecting-from-wgs84-to.html
|
||||
*
|
||||
*
|
||||
* @param lon
|
||||
* ...
|
||||
* @param lat
|
||||
@ -106,7 +106,7 @@ public class WebMercator {
|
||||
|
||||
/**
|
||||
* from http://pauldendulk.com/2011/04/projecting-from-wgs84-to.html
|
||||
*
|
||||
*
|
||||
* @param x
|
||||
* ...
|
||||
* @param y
|
||||
|
@ -25,6 +25,7 @@ public interface IMapDatabase {
|
||||
|
||||
/**
|
||||
* Starts a database query with the given parameters.
|
||||
*
|
||||
* @param tile
|
||||
* the tile to read.
|
||||
* @param mapDatabaseCallback
|
||||
@ -48,6 +49,7 @@ public interface IMapDatabase {
|
||||
|
||||
/**
|
||||
* Opens MapDatabase
|
||||
*
|
||||
* @param options
|
||||
* the options.
|
||||
* @return a OpenResult containing an error message in case of a failure.
|
||||
|
@ -19,11 +19,14 @@ import org.oscim.database.mapfile.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 {
|
||||
/**
|
||||
* Renders a single point of interest node (POI).
|
||||
*
|
||||
*
|
||||
* @param layer
|
||||
* the layer of the node.
|
||||
* @param tags
|
||||
@ -42,17 +45,18 @@ public interface IMapDatabaseCallback {
|
||||
|
||||
/**
|
||||
* Renders a single way or area (closed way).
|
||||
*
|
||||
*
|
||||
* @param layer
|
||||
* the layer of the way.
|
||||
* the osm layer of the way.
|
||||
* @param tags
|
||||
* the tags of the way.
|
||||
* @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
|
||||
* length of way data in wayNodes
|
||||
* @param closed
|
||||
* way is closed (means need to add endpoint == startpoint)
|
||||
* wheter the way is an polygon.
|
||||
* @param prio TODO
|
||||
*/
|
||||
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
|
||||
*
|
||||
*
|
||||
* @param tags
|
||||
* ...
|
||||
* @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);
|
||||
|
||||
|
@ -17,7 +17,7 @@ package org.oscim.database;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class MapDatabaseFactory {
|
||||
@ -25,7 +25,8 @@ public final class MapDatabaseFactory {
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
public static IMapDatabase createMapDatabase(AttributeSet attributeSet) {
|
||||
|
@ -20,7 +20,7 @@ import org.oscim.database.mapfile.MapDatabase;
|
||||
|
||||
/**
|
||||
* Contains the immutable metadata of a map file.
|
||||
*
|
||||
*
|
||||
* @see MapDatabase#getMapInfo()
|
||||
*/
|
||||
public class MapInfo {
|
||||
@ -80,7 +80,8 @@ public class MapInfo {
|
||||
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;
|
||||
|
||||
|
@ -14,9 +14,9 @@
|
||||
*/
|
||||
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 {
|
||||
/**
|
||||
@ -41,7 +41,7 @@ public class OpenResult {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public OpenResult() {
|
||||
this.success = true;
|
||||
|
@ -22,7 +22,7 @@ final class Deserializer {
|
||||
* Converts five bytes of a byte array to an unsigned long.
|
||||
* <p>
|
||||
* The byte order is big-endian.
|
||||
*
|
||||
*
|
||||
* @param buffer
|
||||
* the byte array.
|
||||
* @param offset
|
||||
@ -30,7 +30,8 @@ final class Deserializer {
|
||||
* @return the long value.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -38,7 +39,7 @@ final class Deserializer {
|
||||
* Converts four bytes of a byte array to a signed int.
|
||||
* <p>
|
||||
* The byte order is big-endian.
|
||||
*
|
||||
*
|
||||
* @param buffer
|
||||
* the byte array.
|
||||
* @param offset
|
||||
@ -46,7 +47,8 @@ final class Deserializer {
|
||||
* @return the int value.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -54,7 +56,7 @@ final class Deserializer {
|
||||
* Converts eight bytes of a byte array to a signed long.
|
||||
* <p>
|
||||
* The byte order is big-endian.
|
||||
*
|
||||
*
|
||||
* @param buffer
|
||||
* the byte array.
|
||||
* @param offset
|
||||
@ -62,16 +64,18 @@ final class Deserializer {
|
||||
* @return the long value.
|
||||
*/
|
||||
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 + 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.
|
||||
* <p>
|
||||
* The byte order is big-endian.
|
||||
*
|
||||
*
|
||||
* @param buffer
|
||||
* the byte array.
|
||||
* @param offset
|
||||
|
@ -37,7 +37,8 @@ class IndexCache {
|
||||
/**
|
||||
* 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 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.
|
||||
*
|
||||
*
|
||||
* @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
|
||||
* the number of the block in the map file.
|
||||
* @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;
|
||||
|
||||
// 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
|
||||
byte[] indexBlock = this.map.get(indexCacheEntryKey);
|
||||
if (indexBlock == null) {
|
||||
// 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 indexBlockSize = Math.min(SIZE_OF_INDEX_BLOCK, remainingIndexSize);
|
||||
|
@ -26,7 +26,7 @@ class IndexCacheEntryKey {
|
||||
|
||||
/**
|
||||
* Creates an immutable key to be stored in a map.
|
||||
*
|
||||
*
|
||||
* @param subFileParameter
|
||||
* the parameters of the map file.
|
||||
* @param indexBlockNumber
|
||||
@ -48,7 +48,8 @@ class IndexCacheEntryKey {
|
||||
IndexCacheEntryKey other = (IndexCacheEntryKey) obj;
|
||||
if (this.subFileParameter == null && other.subFileParameter != null) {
|
||||
return false;
|
||||
} else if (this.subFileParameter != null && !this.subFileParameter.equals(other.subFileParameter)) {
|
||||
} else if (this.subFileParameter != null
|
||||
&& !this.subFileParameter.equals(other.subFileParameter)) {
|
||||
return false;
|
||||
} else if (this.indexBlockNumber != other.indexBlockNumber) {
|
||||
return false;
|
||||
@ -66,7 +67,8 @@ class IndexCacheEntryKey {
|
||||
*/
|
||||
private int calculateHashCode() {
|
||||
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));
|
||||
return result;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import android.os.Environment;
|
||||
* A class for reading binary map files.
|
||||
* <p>
|
||||
* This class is not thread-safe. Each thread should use its own instance.
|
||||
*
|
||||
*
|
||||
* @see <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
|
||||
* elements.
|
||||
*
|
||||
*
|
||||
* @param queryParameters
|
||||
* the parameters of the current query.
|
||||
* @param subFileParameter
|
||||
@ -567,7 +567,7 @@ public class MapDatabase implements IMapDatabase {
|
||||
|
||||
/**
|
||||
* Processes the block signature, if present.
|
||||
*
|
||||
*
|
||||
* @return true if the block signature could be processed successfully,
|
||||
* false otherwise.
|
||||
*/
|
||||
@ -585,7 +585,7 @@ public class MapDatabase implements IMapDatabase {
|
||||
|
||||
/**
|
||||
* Processes the given number of POIs.
|
||||
*
|
||||
*
|
||||
* @param mapDatabaseCallback
|
||||
* the callback which handles the extracted POIs.
|
||||
* @param numberOfPois
|
||||
@ -801,7 +801,7 @@ public class MapDatabase implements IMapDatabase {
|
||||
|
||||
/**
|
||||
* Processes the given number of ways.
|
||||
*
|
||||
*
|
||||
* @param queryParameters
|
||||
* the parameters of the current query.
|
||||
* @param mapDatabaseCallback
|
||||
|
@ -43,7 +43,7 @@ public class ReadBuffer {
|
||||
|
||||
/**
|
||||
* Returns one signed byte from the read buffer.
|
||||
*
|
||||
*
|
||||
* @return the byte value.
|
||||
*/
|
||||
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
|
||||
* the capacity of the read buffer is too small, a larger one is created automatically.
|
||||
*
|
||||
* Reads the given amount of bytes from the file into the read buffer and
|
||||
* resets the internal buffer position. If
|
||||
* the capacity of the read buffer is too small, a larger one is created
|
||||
* automatically.
|
||||
*
|
||||
* @param length
|
||||
* the amount of bytes to read from the file.
|
||||
* @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.
|
||||
* <p>
|
||||
* The byte order is big-endian.
|
||||
*
|
||||
*
|
||||
* @return the int value.
|
||||
*/
|
||||
public int readInt() {
|
||||
@ -100,7 +102,7 @@ public class ReadBuffer {
|
||||
* Converts eight bytes from the read buffer to a signed long.
|
||||
* <p>
|
||||
* The byte order is big-endian.
|
||||
*
|
||||
*
|
||||
* @return the long value.
|
||||
*/
|
||||
public long readLong() {
|
||||
@ -123,7 +125,7 @@ public class ReadBuffer {
|
||||
* Converts two bytes from the read buffer to a signed int.
|
||||
* <p>
|
||||
* The byte order is big-endian.
|
||||
*
|
||||
*
|
||||
* @return the int value.
|
||||
*/
|
||||
public int readShort() {
|
||||
@ -134,9 +136,10 @@ public class ReadBuffer {
|
||||
/**
|
||||
* Converts a variable amount of bytes from the read buffer to a signed int.
|
||||
* <p>
|
||||
* The first bit is for continuation info, the other six (last byte) or seven (all other bytes) bits are for data.
|
||||
* The second bit in the last byte indicates the sign of the number.
|
||||
*
|
||||
* The first bit is for continuation info, the other six (last byte) or
|
||||
* seven (all other bytes) bits are for data. The second bit in the last
|
||||
* byte indicates the sign of the number.
|
||||
*
|
||||
* @return the value.
|
||||
*/
|
||||
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>
|
||||
* The first bit is for continuation info, the other six (last byte) or seven (all other bytes) bits are for data.
|
||||
* The second bit in the last byte indicates the sign of the number.
|
||||
*
|
||||
* The first bit is for continuation info, the other six (last byte) or
|
||||
* seven (all other bytes) bits are for data. The second bit in the last
|
||||
* byte indicates the sign of the number.
|
||||
*
|
||||
* @param values
|
||||
* result values
|
||||
* @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>
|
||||
* 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.
|
||||
*/
|
||||
public int readUnsignedInt() {
|
||||
@ -368,7 +375,7 @@ public class ReadBuffer {
|
||||
|
||||
/**
|
||||
* Decodes a variable amount of bytes from the read buffer to a string.
|
||||
*
|
||||
*
|
||||
* @return the UTF-8 decoded string (may be null).
|
||||
*/
|
||||
public String readUTF8EncodedString() {
|
||||
@ -387,7 +394,7 @@ public class ReadBuffer {
|
||||
|
||||
/**
|
||||
* Decodes the given amount of bytes from the read buffer to a string.
|
||||
*
|
||||
*
|
||||
* @param stringLength
|
||||
* the length of the string in bytes.
|
||||
* @return the UTF-8 decoded string (may be null).
|
||||
@ -396,7 +403,8 @@ public class ReadBuffer {
|
||||
if (stringLength > 0 && mBufferPosition + stringLength <= mBufferData.length) {
|
||||
mBufferPosition += stringLength;
|
||||
try {
|
||||
return new String(mBufferData, mBufferPosition - stringLength, stringLength, CHARSET_UTF8);
|
||||
return new String(mBufferData, mBufferPosition - stringLength, stringLength,
|
||||
CHARSET_UTF8);
|
||||
} catch (UnsupportedEncodingException 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.
|
||||
*
|
||||
*
|
||||
* @param position
|
||||
* buffer offset position of string
|
||||
* @return the UTF-8 decoded string (may be null).
|
||||
@ -436,7 +444,7 @@ public class ReadBuffer {
|
||||
|
||||
/**
|
||||
* Sets the buffer position to the given offset.
|
||||
*
|
||||
*
|
||||
* @param bufferPosition
|
||||
* the buffer position.
|
||||
*/
|
||||
@ -446,7 +454,7 @@ public class ReadBuffer {
|
||||
|
||||
/**
|
||||
* Skips the given number of bytes in the read buffer.
|
||||
*
|
||||
*
|
||||
* @param bytes
|
||||
* the number of bytes to skip.
|
||||
*/
|
||||
|
@ -80,7 +80,7 @@ public class MapFileHeader {
|
||||
|
||||
/**
|
||||
* Reads and validates the header block from the map file.
|
||||
*
|
||||
*
|
||||
* @param readBuffer
|
||||
* the ReadBuffer for the file data.
|
||||
* @param fileSize
|
||||
|
@ -19,7 +19,7 @@ import org.oscim.database.mapfile.MapDatabase;
|
||||
|
||||
/**
|
||||
* Contains the immutable metadata of a map file.
|
||||
*
|
||||
*
|
||||
* @see MapDatabase#getMapInfo()
|
||||
*/
|
||||
public class MapFileInfo extends org.oscim.database.MapInfo {
|
||||
|
@ -59,7 +59,8 @@ final class OptionalFields {
|
||||
*/
|
||||
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());
|
||||
mapFileInfoBuilder.optionalFields = optionalFields;
|
||||
|
||||
@ -106,13 +107,15 @@ final class OptionalFields {
|
||||
if (this.hasStartPosition) {
|
||||
// get and check the start position latitude (4 byte)
|
||||
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);
|
||||
}
|
||||
|
||||
// get and check the start position longitude (4 byte)
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -104,11 +104,13 @@ final class RequiredFields {
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
long headerFileSize = readBuffer.readLong();
|
||||
if (headerFileSize != fileSize) {
|
||||
@ -174,7 +176,8 @@ final class RequiredFields {
|
||||
return OpenResult.SUCCESS;
|
||||
}
|
||||
|
||||
static OpenResult readProjectionName(ReadBuffer readBuffer, MapFileInfoBuilder mapFileInfoBuilder) {
|
||||
static OpenResult readProjectionName(ReadBuffer readBuffer,
|
||||
MapFileInfoBuilder mapFileInfoBuilder) {
|
||||
// get and check the projection name
|
||||
String projectionName = readBuffer.readUTF8EncodedString();
|
||||
if (!MERCATOR.equals(projectionName)) {
|
||||
|
@ -120,14 +120,18 @@ public class SubFileParameter {
|
||||
this.hashCodeValue = calculateHashCode();
|
||||
|
||||
// calculate the XY numbers of the boundary tiles in this sub-file
|
||||
this.boundaryTileBottom = MercatorProjection.latitudeToTileY(subFileParameterBuilder.boundingBox.minLatitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileLeft = MercatorProjection.longitudeToTileX(subFileParameterBuilder.boundingBox.minLongitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileTop = MercatorProjection.latitudeToTileY(subFileParameterBuilder.boundingBox.maxLatitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileRight = MercatorProjection.longitudeToTileX(subFileParameterBuilder.boundingBox.maxLongitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileBottom = MercatorProjection.latitudeToTileY(
|
||||
subFileParameterBuilder.boundingBox.minLatitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileLeft = MercatorProjection.longitudeToTileX(
|
||||
subFileParameterBuilder.boundingBox.minLongitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileTop = MercatorProjection.latitudeToTileY(
|
||||
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
|
||||
this.blocksWidth = this.boundaryTileRight - this.boundaryTileLeft + 1;
|
||||
|
@ -48,7 +48,7 @@ import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class MapDatabase implements IMapDatabase {
|
||||
@ -312,7 +312,7 @@ public class MapDatabase implements IMapDatabase {
|
||||
private Tag[][] mElementTags;
|
||||
|
||||
private void initDecorder() {
|
||||
// reusable tag set
|
||||
// reusable tag set
|
||||
Tag[][] tags = new Tag[10][];
|
||||
for (int i = 0; i < 10; i++)
|
||||
tags[i] = new Tag[i + 1];
|
||||
|
@ -51,7 +51,7 @@ import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class MapDatabase implements IMapDatabase {
|
||||
@ -1239,8 +1239,10 @@ public class MapDatabase implements IMapDatabase {
|
||||
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
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
|
@ -1,26 +1,26 @@
|
||||
/*
|
||||
* Geometry.java
|
||||
*
|
||||
*
|
||||
* PostGIS extension for PostgreSQL JDBC driver - geometry model
|
||||
*
|
||||
*
|
||||
* (C) 2004 Paul Ramsey, pramsey@refractions.net
|
||||
*
|
||||
*
|
||||
* (C) 2005 Markus Schaber, markus.schaber@logix-tt.com
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* Software Foundation, either version 2.1 of the License.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General License for more
|
||||
* details.
|
||||
*
|
||||
*
|
||||
* 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.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at
|
||||
* http://www.gnu.org.
|
||||
*
|
||||
*
|
||||
* $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
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* ...
|
||||
* @return ...
|
||||
@ -107,7 +107,8 @@ abstract class Geometry implements Serializable {
|
||||
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.
|
||||
*/
|
||||
final int type;
|
||||
@ -124,7 +125,7 @@ abstract class Geometry implements Serializable {
|
||||
|
||||
/**
|
||||
* Parse a SRID value, anything <= 0 is unknown
|
||||
*
|
||||
*
|
||||
* @param srid
|
||||
* ...
|
||||
* @return ...
|
||||
@ -139,7 +140,7 @@ abstract class Geometry implements Serializable {
|
||||
|
||||
/**
|
||||
* Constructor for subclasses
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* 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
|
||||
* ...
|
||||
* @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.
|
||||
*
|
||||
*
|
||||
* @param other
|
||||
* ...
|
||||
* @return ...
|
||||
@ -191,14 +194,14 @@ abstract class Geometry implements Serializable {
|
||||
|
||||
/**
|
||||
* Return the number of Points of the geometry
|
||||
*
|
||||
*
|
||||
* @return ...
|
||||
*/
|
||||
abstract int numPoints();
|
||||
|
||||
/**
|
||||
* Get the nth Point of the geometry
|
||||
*
|
||||
*
|
||||
* @param n
|
||||
* the index of the point, from 0 to numPoints()-1;
|
||||
* @throws ArrayIndexOutOfBoundsException
|
||||
@ -219,7 +222,7 @@ abstract class Geometry implements Serializable {
|
||||
|
||||
/**
|
||||
* The OGIS geometry type number of this geometry.
|
||||
*
|
||||
*
|
||||
* @return ...
|
||||
*/
|
||||
int getType() {
|
||||
@ -228,7 +231,7 @@ abstract class Geometry implements Serializable {
|
||||
|
||||
/**
|
||||
* Return the Type as String
|
||||
*
|
||||
*
|
||||
* @return ...
|
||||
*/
|
||||
String getTypeString() {
|
||||
@ -237,7 +240,7 @@ abstract class Geometry implements Serializable {
|
||||
|
||||
/**
|
||||
* Returns whether we have a measure
|
||||
*
|
||||
*
|
||||
* @return ....
|
||||
*/
|
||||
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.
|
||||
*
|
||||
*
|
||||
* @return The dimensionality (eg, 2D or 3D) of this geometry.
|
||||
*/
|
||||
int getDimension() {
|
||||
@ -256,7 +260,7 @@ abstract class Geometry implements Serializable {
|
||||
|
||||
/**
|
||||
* The OGIS geometry type number of this geometry.
|
||||
*
|
||||
*
|
||||
* @return ...
|
||||
*/
|
||||
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
|
||||
* ...
|
||||
*/
|
||||
@ -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 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
|
||||
* ...
|
||||
*/
|
||||
@ -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
|
||||
* ...
|
||||
*/
|
||||
@ -327,7 +335,7 @@ abstract class Geometry implements Serializable {
|
||||
|
||||
/**
|
||||
* backwards compatibility method
|
||||
*
|
||||
*
|
||||
* @return ...
|
||||
*/
|
||||
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
|
||||
* 3) and a valid type. 2-dimensional Points must have Z=0.0, as well as 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.
|
||||
* Do some internal consistency checks on the geometry. Currently, all
|
||||
* Geometries must have a valid dimension (2 or
|
||||
* 3) and a valid type. 2-dimensional Points must have Z=0.0, as well as
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* @return true if all checks are passed.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
*
|
||||
* @param value
|
||||
* ...
|
||||
* @return value without the SRID=4711; part
|
||||
|
@ -39,7 +39,7 @@ import org.postgresql.PGConnection;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
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.)
|
||||
*
|
||||
*
|
||||
* @param value
|
||||
* ...
|
||||
* @return ...
|
||||
@ -328,7 +329,7 @@ public class MapDatabase implements IMapDatabase {
|
||||
|
||||
/**
|
||||
* Parse an Array of "full" Geometries
|
||||
*
|
||||
*
|
||||
* @param data
|
||||
* ...
|
||||
* @param count
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file has been copied from the following location:
|
||||
* http://archives.postgresql.org/pgsql-jdbc/2009-12/msg00037.php
|
||||
*
|
||||
*
|
||||
* PostgreSQL code is typically under a BSD licence.
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* @param value
|
||||
* String representated hstore
|
||||
* @throws SQLException
|
||||
@ -96,7 +96,7 @@ public class PGHStore extends PGobject implements Map<String, String>
|
||||
|
||||
/**
|
||||
* Returns the stored information as a string
|
||||
*
|
||||
*
|
||||
* @return String represented hstore
|
||||
*/
|
||||
@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
|
||||
*
|
||||
*
|
||||
* @param obj
|
||||
* Object to compare with
|
||||
* @return true if the two hstores are identical
|
||||
|
@ -1,24 +1,24 @@
|
||||
/*
|
||||
* ValueGetter.java
|
||||
*
|
||||
*
|
||||
* PostGIS extension for PostgreSQL JDBC driver - Binary Parser
|
||||
*
|
||||
*
|
||||
* (C) 2005 Markus Schaber, markus.schaber@logix-tt.com
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* Software Foundation, either version 2.1 of the License.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General License for more
|
||||
* details.
|
||||
*
|
||||
*
|
||||
* 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.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at
|
||||
* http://www.gnu.org.
|
||||
*
|
||||
*
|
||||
* $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
|
||||
*
|
||||
*
|
||||
* @return ...
|
||||
*/
|
||||
byte getByte() {
|
||||
@ -58,7 +58,7 @@ abstract class ValueGetter {
|
||||
|
||||
/**
|
||||
* Get a 32-Bit integer
|
||||
*
|
||||
*
|
||||
* @param index
|
||||
* ...
|
||||
* @return ...
|
||||
@ -66,8 +66,9 @@ abstract class ValueGetter {
|
||||
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
|
||||
* ...
|
||||
* @return ...
|
||||
@ -76,7 +77,7 @@ abstract class ValueGetter {
|
||||
|
||||
/**
|
||||
* Get a double.
|
||||
*
|
||||
*
|
||||
* @return ...
|
||||
*/
|
||||
double getDouble() {
|
||||
@ -101,9 +102,12 @@ abstract class ValueGetter {
|
||||
protected long getLong(int index) {
|
||||
|
||||
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 + 4] & 0xFF) << 24) | ((long) (data[index + 5] & 0xFF) << 16)
|
||||
| ((long) (data[index + 6] & 0xFF) << 8) | ((long) (data[index + 7] & 0xFF) << 0);
|
||||
| ((long) (data[index + 2] & 0xFF) << 40)
|
||||
| ((long) (data[index + 3] & 0xFF) << 32)
|
||||
| ((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
|
||||
protected long getLong(int index) {
|
||||
return ((long) (data[index + 7] & 0xFF) << 56) | ((long) (data[index + 6] & 0xFF) << 48)
|
||||
| ((long) (data[index + 5] & 0xFF) << 40) | ((long) (data[index + 4] & 0xFF) << 32)
|
||||
| ((long) (data[index + 3] & 0xFF) << 24) | ((long) (data[index + 2] & 0xFF) << 16)
|
||||
return ((long) (data[index + 7] & 0xFF) << 56)
|
||||
| ((long) (data[index + 6] & 0xFF) << 48)
|
||||
| ((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);
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
*/
|
||||
package org.oscim.database.test;
|
||||
|
||||
|
||||
import org.oscim.core.BoundingBox;
|
||||
import org.oscim.core.Tag;
|
||||
import org.oscim.core.Tile;
|
||||
@ -27,7 +26,7 @@ import org.oscim.database.QueryResult;
|
||||
import org.oscim.generator.JobTile;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class MapDatabase implements IMapDatabase {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
|
@ -210,6 +210,7 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
|
||||
|
||||
/**
|
||||
* Sets the scale stroke factor for the given zoom level.
|
||||
*
|
||||
* @param zoomLevel
|
||||
* the zoom level for which the scale stroke factor should be
|
||||
* set.
|
||||
|
@ -33,6 +33,7 @@ public class DefaultResourceProxyImpl implements ResourceProxy, MapViewConstants
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param pContext
|
||||
* Used to get the display metrics that are used for scaling the
|
||||
* bitmaps returned by {@@link getBitmap}. Can be null,
|
||||
|
@ -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
|
||||
* identified. This method does that and then performs the assigned task on
|
||||
* that item.
|
||||
*
|
||||
* @param event
|
||||
* ...
|
||||
* @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
|
||||
* the type of touch. Each of them returns true if the event was completely
|
||||
* handled.
|
||||
*
|
||||
* @param <T>
|
||||
* ....
|
||||
*/
|
||||
|
@ -39,6 +39,7 @@ import android.opengl.Matrix;
|
||||
* 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
|
||||
* your custom item-class passed back in onTap().
|
||||
*
|
||||
* @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
|
||||
* called from populate() we'll cache them for later use.
|
||||
*
|
||||
* @param i
|
||||
* ...
|
||||
* @return ...
|
||||
@ -228,6 +230,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
|
||||
|
||||
/**
|
||||
* The number of items in this overlay.
|
||||
*
|
||||
* @return ...
|
||||
*/
|
||||
public abstract int size();
|
||||
@ -265,7 +268,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
|
||||
InternalItem pool = mItems;
|
||||
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.
|
||||
for (int a = 0; a < size; a++) {
|
||||
InternalItem it;
|
||||
@ -293,6 +296,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
|
||||
|
||||
/**
|
||||
* Returns the Item at the given index.
|
||||
*
|
||||
* @param position
|
||||
* the position of the item to return
|
||||
* @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
|
||||
* 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.
|
||||
*
|
||||
* @param item
|
||||
* the item to hit test
|
||||
* @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,
|
||||
* but some clients may prefer to draw the focused item themselves.
|
||||
*
|
||||
* @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
|
||||
* confused. If the Item is not found, this is a no-op. You can also pass
|
||||
* null to remove focus.
|
||||
*
|
||||
* @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
|
||||
* described by the hotspot parameter. Useful for "pin"-like graphics. For
|
||||
* convenience, returns the same drawable that was passed in.
|
||||
*
|
||||
* @param marker
|
||||
* the drawable to adjust
|
||||
* @param hotspot
|
||||
@ -441,7 +449,7 @@ public abstract class ItemizedOverlay<Item extends OverlayItem> extends Overlay
|
||||
// * <br/>
|
||||
// * The focused item is always drawn last, which puts it visually on top of
|
||||
// * the other items.<br/>
|
||||
// *
|
||||
// *
|
||||
// * @param canvas
|
||||
// * the Canvas upon which to draw. Note that this may already have
|
||||
// * 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.
|
||||
// *
|
||||
// *
|
||||
// * @param canvas
|
||||
// * what the item is drawn upon
|
||||
// * @param item
|
||||
|
@ -19,6 +19,7 @@ package org.oscim.overlay;
|
||||
|
||||
/**
|
||||
* This class contains constants used by the map view.
|
||||
*
|
||||
* @author Nicolas Gramlich
|
||||
*/
|
||||
public interface MapViewConstants {
|
||||
|
@ -36,6 +36,7 @@ import android.view.MotionEvent;
|
||||
* {@link android.view.GestureDetector.SimpleOnGestureListener} and
|
||||
* GestureDetector.OnGestureListener. The difference is there is an additional
|
||||
* argument for the item.
|
||||
*
|
||||
* @author Nicolas Gramlich
|
||||
*/
|
||||
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
|
||||
* nothing by default, but should be checked before calling draw().
|
||||
*
|
||||
* @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
|
||||
* before calling draw().
|
||||
*
|
||||
* @return true if the Overlay is marked enabled, false otherwise
|
||||
*/
|
||||
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
|
||||
* 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.
|
||||
*
|
||||
* @return an integer suitable to be used as a menu identifier
|
||||
*/
|
||||
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
|
||||
* of IDs of length <param name="count" />. The returned number is the
|
||||
* starting index of that sequential list.
|
||||
*
|
||||
* @param count
|
||||
* ....
|
||||
* @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
|
||||
// * overlays with shadow=false. Callers should check isEnabled() before
|
||||
// * calling draw(). By default, draws nothing.
|
||||
// *
|
||||
// *
|
||||
// * @param c
|
||||
// * ...
|
||||
// * @param osmv
|
||||
@ -159,6 +164,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
/**
|
||||
* Override to perform clean up of resources before shutdown. By default
|
||||
* does nothing.
|
||||
*
|
||||
* @param mapView
|
||||
* ...
|
||||
*/
|
||||
@ -170,6 +176,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param keyCode
|
||||
* ...
|
||||
* @param event
|
||||
@ -187,6 +194,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param keyCode
|
||||
* ...
|
||||
* @param event
|
||||
@ -205,6 +213,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param e
|
||||
* ...
|
||||
* @param mapView
|
||||
@ -220,6 +229,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param e
|
||||
* ...
|
||||
* @param mapView
|
||||
@ -237,6 +247,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param e
|
||||
* ...
|
||||
* @param mapView
|
||||
@ -252,6 +263,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param e
|
||||
* ...
|
||||
* @param mapView
|
||||
@ -267,6 +279,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param e
|
||||
* ...
|
||||
* @param mapView
|
||||
@ -284,6 +297,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param e
|
||||
* ...
|
||||
* @param mapView
|
||||
@ -299,6 +313,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param pEvent1
|
||||
* ...
|
||||
* @param pEvent2
|
||||
@ -321,6 +336,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param e
|
||||
* ...
|
||||
* @param mapView
|
||||
@ -336,6 +352,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param pEvent1
|
||||
* ...
|
||||
* @param pEvent2
|
||||
@ -368,6 +385,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
* Event, return <code>true</code>, otherwise return <code>false</code>. If
|
||||
* you returned <code>true</code> none of the following Overlays or the
|
||||
* underlying {@link MapView} has the chance to handle this event.
|
||||
*
|
||||
* @param e
|
||||
* ...
|
||||
* @param mapView
|
||||
@ -392,7 +410,7 @@ public abstract class Overlay implements OverlayConstants {
|
||||
// * coordinates. You can find appropriate coordinates from latitude/longitude
|
||||
// * using the MapView.getProjection() method on the MapView passed to you in
|
||||
// * draw(Canvas, MapView, boolean).
|
||||
// *
|
||||
// *
|
||||
// * @param canvas
|
||||
// * ...
|
||||
// * @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
|
||||
* resulting in snapping the current action (e.g. zoom) to the item.
|
||||
*
|
||||
* @param x
|
||||
* The x in screen coordinates.
|
||||
* @param y
|
||||
|
@ -24,6 +24,7 @@ import android.graphics.drawable.Drawable;
|
||||
|
||||
/**
|
||||
* Immutable class describing a GeoPoint with a Title and a Description.
|
||||
*
|
||||
* @author Nicolas Gramlich
|
||||
* @author Theodore Hong
|
||||
* @author Fred Eisele
|
||||
@ -102,7 +103,8 @@ public class OverlayItem {
|
||||
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
|
||||
* should be drawn. Different markers can be returned for different states.
|
||||
* 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.
|
||||
* @param stateBitset The current state.
|
||||
* @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) {
|
||||
// marker not specified
|
||||
if (mMarker == null) {
|
||||
@ -141,12 +144,14 @@ public class OverlayItem {
|
||||
// ===========================================================
|
||||
// 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
|
||||
* into
|
||||
* a state set of R.attr.state_pressed, R.attr.state_selected and
|
||||
* 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) {
|
||||
final int[] states = new int[3];
|
||||
int index = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012, osmdroid: Viesturs Zarins, Martin Pearman
|
||||
* Copyright 2012, osmdroid: Viesturs Zarins, Martin Pearman
|
||||
* Copyright 2012, Hannes Janetzek
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @param startPoint
|
||||
* start point of the great circle
|
||||
* @param endPoint
|
||||
@ -212,6 +213,7 @@ public class PathOverlay extends Overlay {
|
||||
|
||||
/**
|
||||
* Draw a great circle.
|
||||
*
|
||||
* @param startPoint
|
||||
* start point of the great circle
|
||||
* @param endPoint
|
||||
|
@ -53,6 +53,7 @@ public interface ResourceProxy {
|
||||
/**
|
||||
* Use a string resource as a format definition, and format using the
|
||||
* supplied format arguments.
|
||||
*
|
||||
* @param pResId
|
||||
* ...
|
||||
* @param formatArgs
|
||||
@ -65,6 +66,7 @@ public interface ResourceProxy {
|
||||
|
||||
/**
|
||||
* Get a bitmap as a {@link Drawable}
|
||||
*
|
||||
* @param pResId
|
||||
* ...
|
||||
* @return ...
|
||||
@ -73,6 +75,7 @@ public interface ResourceProxy {
|
||||
|
||||
/**
|
||||
* Gets the density from the current screen's DisplayMetrics
|
||||
*
|
||||
* @return the screen's density
|
||||
*/
|
||||
float getDisplayMetricsDensity();
|
||||
|
@ -80,7 +80,7 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
||||
private static float[] mTileCoords = new float[8];
|
||||
private static float[] mDebugCoords = new float[8];
|
||||
|
||||
//private
|
||||
//private
|
||||
static float[] mClearColor = null;
|
||||
private static boolean mUpdateColor = false;
|
||||
|
||||
|
@ -135,8 +135,8 @@ public final class LineRenderer {
|
||||
glUniformMatrix4fv(hLineMatrix[mode], 1, false, matrix, 0);
|
||||
|
||||
// line scale factor for non fixed lines: within a zoom-
|
||||
// level lines would be scaled by the factor 2 via projection.
|
||||
// though lines should only scale by sqrt(2). this is achieved
|
||||
// level lines would be scaled by the factor 2 via projection.
|
||||
// though lines should only scale by sqrt(2). this is achieved
|
||||
// by inverting scaling of extrusion vector with: width/sqrt(s).
|
||||
// within one zoom-level: 1 <= s <= 2
|
||||
float s = scale / div;
|
||||
@ -280,7 +280,7 @@ public final class LineRenderer {
|
||||
+ "varying vec2 v_mode;"
|
||||
+ "void main() {"
|
||||
//+ " 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)
|
||||
//+ " if (u_mode == 0)"
|
||||
//+ " len = abs(v_st.s);"
|
||||
@ -289,7 +289,7 @@ public final class LineRenderer {
|
||||
// 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);"
|
||||
// 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 * min(1.0, (1.0 - len) / u_wscale);"
|
||||
+ "}";
|
||||
@ -316,7 +316,7 @@ public final class LineRenderer {
|
||||
+ " fuzz = max(st_width.s, st_width.t);"
|
||||
+ " }"
|
||||
//+ " 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:
|
||||
//+ " 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'
|
||||
|
@ -130,7 +130,7 @@ public final class PolygonRenderer {
|
||||
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
|
||||
// of other tiles
|
||||
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)
|
||||
* using stencil buffer method
|
||||
*
|
||||
* @param pos
|
||||
* used to fade layers accorind to 'fade'
|
||||
* in layer.area.
|
||||
@ -234,6 +235,7 @@ public final class PolygonRenderer {
|
||||
/**
|
||||
* Draw a tile filling rectangle to set stencil- and depth buffer
|
||||
* appropriately
|
||||
*
|
||||
* @param first in the first run the clip region is set based on
|
||||
* depth buffer and depth buffer is updated
|
||||
*/
|
||||
@ -305,8 +307,10 @@ public final class PolygonRenderer {
|
||||
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)
|
||||
glColorMask(false, false, false, false);
|
||||
|
@ -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
|
||||
// function edge(a, b) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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
|
||||
* 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
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -43,7 +43,7 @@ import android.util.Log;
|
||||
public class TileManager {
|
||||
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
|
||||
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
|
||||
* available tiles are created and added to JobQueue (mapView.addJobs) for
|
||||
* loading by TileGenerator class
|
||||
*
|
||||
* @param clear
|
||||
* whether to clear and reload all tiles
|
||||
*/
|
||||
@ -174,7 +175,7 @@ public class TileManager {
|
||||
for (int i = 0; i < mTilesSize; i++)
|
||||
clearTile(mTiles[i]);
|
||||
} else {
|
||||
// mInitialized is set when surface changed
|
||||
// mInitialized is set when surface changed
|
||||
// and VBOs might be lost
|
||||
VertexPool.init();
|
||||
}
|
||||
@ -292,6 +293,7 @@ public class TileManager {
|
||||
/**
|
||||
* set mNewTiles for the visible tiles and pass it to GLRenderer, add jobs
|
||||
* for not yet loaded tiles
|
||||
*
|
||||
* @param mapPosition
|
||||
* the current MapPosition
|
||||
* @param zdir
|
||||
@ -303,7 +305,7 @@ public class TileManager {
|
||||
// one could also append new tiles and sort in JobQueue
|
||||
// but this has the nice side-effect that MapWorkers dont
|
||||
// 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.
|
||||
mMapView.addJobs(null);
|
||||
|
||||
@ -523,9 +525,9 @@ public class TileManager {
|
||||
Log.d(TAG, "limitCache: tile still locked " + t + " " + t.distance);
|
||||
//mTiles.add(t);
|
||||
} else if (t.state == STATE_LOADING) {
|
||||
// NOTE: when set loading to false the tile could be
|
||||
// added to load queue again while still processed in
|
||||
// TileGenerator => need tile.cancel flag.
|
||||
// NOTE: when set loading to false the tile could be
|
||||
// added to load queue again while still processed in
|
||||
// TileGenerator => need tile.cancel flag.
|
||||
// t.isLoading = false;
|
||||
//mTiles.add(t);
|
||||
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
|
||||
*
|
||||
* @param jobTile
|
||||
* Tile ready for upload to GL
|
||||
* @return ... caller does not care
|
||||
@ -579,7 +582,7 @@ public class TileManager {
|
||||
|
||||
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.
|
||||
if (tile.isLocked())
|
||||
mMapView.render();
|
||||
|
@ -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
|
||||
* 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:
|
||||
// - number of VERTICES offset for this layertype in VBO
|
||||
// otherwise:
|
||||
// otherwise:
|
||||
// - offset in byte in VBO
|
||||
public int offset;
|
||||
|
||||
|
@ -57,6 +57,7 @@ public final class LineLayer extends Layer {
|
||||
/**
|
||||
* line extrusion is based on code from GLMap
|
||||
* (https://github.com/olofsj/GLMap/)
|
||||
*
|
||||
* @param points
|
||||
* array of points as x,y pairs
|
||||
* @param index
|
||||
|
@ -48,7 +48,7 @@ public final class SymbolLayer extends TextureLayer {
|
||||
|
||||
for (SymbolItem it = symbols; it != null; it = it.next) {
|
||||
if (it.bitmap == item.bitmap) {
|
||||
// insert after same bitmap
|
||||
// insert after same bitmap
|
||||
item.next = it.next;
|
||||
it.next = item;
|
||||
return;
|
||||
|
@ -51,7 +51,7 @@ public class TextItem {
|
||||
// in.next = ti.next;
|
||||
// ti.next = in;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// TextItem t = ti;
|
||||
// while (t.next != null)
|
||||
// t = t.next;
|
||||
@ -68,7 +68,7 @@ public class TextItem {
|
||||
while (ti != null) {
|
||||
TextItem next = ti.next;
|
||||
|
||||
// drop references
|
||||
// drop references
|
||||
ti.string = null;
|
||||
ti.text = null;
|
||||
ti.n1 = null;
|
||||
@ -83,7 +83,7 @@ public class TextItem {
|
||||
TextItem next = ti.next;
|
||||
ti.next = pool;
|
||||
|
||||
// drop references
|
||||
// drop references
|
||||
ti.string = null;
|
||||
ti.text = null;
|
||||
ti.n1 = null;
|
||||
|
@ -91,7 +91,7 @@ public final class TextLayer extends TextureLayer {
|
||||
it = it.next;
|
||||
|
||||
// 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))
|
||||
item.string = it.string;
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class VertexPoolItem {
|
||||
public int used;
|
||||
public VertexPoolItem next;
|
||||
|
||||
// must be multiple of
|
||||
// must be multiple of
|
||||
// 4 (LineLayer/PolygonLayer),
|
||||
// 6 (TexLineLayer)
|
||||
// 24 (TextureLayer)
|
||||
|
@ -156,7 +156,7 @@ public class BuildingOverlay extends RenderOverlay {
|
||||
|
||||
mCurVertices.used = v;
|
||||
|
||||
// fill ZigZagQuadIndices(tm)
|
||||
// fill ZigZagQuadIndices(tm)
|
||||
for (int j = 0; j < 2; j++) {
|
||||
short[] indices = mCurIndices[j].vertices;
|
||||
int cnt = mCurIndices[j].used;
|
||||
|
@ -28,7 +28,7 @@ import android.opengl.Matrix;
|
||||
|
||||
/*
|
||||
* This is an example how to integrate custom OpenGL drawing routines as map overlay
|
||||
*
|
||||
*
|
||||
* based on chapter 2 from:
|
||||
* https://github.com/dalinaum/opengl-es-book-samples/tree/master/Android
|
||||
* */
|
||||
|
@ -227,7 +227,7 @@ public class ExtrusionOverlay extends RenderOverlay {
|
||||
GLState.useProgram(extrusionProgram[shaderMode]);
|
||||
GLState.enableVertexArrays(uExtVertexPosition, -1);
|
||||
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.
|
||||
GLES20.glEnable(GLES20.GL_CULL_FACE);
|
||||
GLES20.glCullFace(GLES20.GL_FRONT);
|
||||
@ -296,7 +296,7 @@ public class ExtrusionOverlay extends RenderOverlay {
|
||||
GLES20.glDrawElements(GLES20.GL_TRIANGLES, el.mIndiceCnt[1],
|
||||
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:
|
||||
GLES20.glDepthFunc(GLES20.GL_LEQUAL);
|
||||
GlUtils.addOffsetM(mv, 100);
|
||||
@ -346,7 +346,7 @@ public class ExtrusionOverlay extends RenderOverlay {
|
||||
_a * ((_g + _l + 1) / 255),
|
||||
_a * ((_b + _l) / 255),
|
||||
_a,
|
||||
// sligthly differ adjacent side
|
||||
// sligthly differ adjacent side
|
||||
// faces to improve contrast
|
||||
_a * ((_r - _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);"
|
||||
+ " if (u_mode == 1){"
|
||||
// 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);"
|
||||
+ " color = u_color[1] * z;"
|
||||
+ " color.rgb *= (0.7 + dir * 0.4);"
|
||||
@ -420,7 +420,7 @@ public class ExtrusionOverlay extends RenderOverlay {
|
||||
// decrease contrast with distance
|
||||
+ " if (u_mode == 1){"
|
||||
// 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 = a_light.y / ff;"
|
||||
+ " float z = (0.98 + gl_Position.z * 0.02);"
|
||||
|
@ -45,6 +45,7 @@ public abstract class RenderOverlay {
|
||||
* called 1. by GLRenderer. Set 'newData' true when 'compile()' should be
|
||||
* called
|
||||
* before next 'render()'
|
||||
*
|
||||
* @param curPos TODO
|
||||
* @param positionChanged
|
||||
* true when MapPosition has changed
|
||||
@ -61,6 +62,7 @@ public abstract class RenderOverlay {
|
||||
|
||||
/**
|
||||
* called 3. draw overlay
|
||||
*
|
||||
* @param pos
|
||||
* current MapPosition
|
||||
* @param mv
|
||||
@ -73,6 +75,7 @@ public abstract class RenderOverlay {
|
||||
/**
|
||||
* Utility: set matrix relative to the difference of current MapPosition
|
||||
* and the last updated Overlay MapPosition
|
||||
*
|
||||
* @param curPos ...
|
||||
* @param matrix ...
|
||||
*/
|
||||
@ -106,6 +109,7 @@ public abstract class RenderOverlay {
|
||||
|
||||
/**
|
||||
* Utility: update mMapPosition
|
||||
*
|
||||
* @return true if position has changed
|
||||
*/
|
||||
protected boolean updateMapPosition() {
|
||||
|
@ -125,7 +125,7 @@ public class TextOverlay extends BasicOverlay {
|
||||
lp.x1, lp.y1, lp.x2, lp.y2);
|
||||
|
||||
if (intersect != 0) {
|
||||
//Log.d(TAG, "overlap " + lp.string + " <> " + ti.string
|
||||
//Log.d(TAG, "overlap " + lp.string + " <> " + ti.string
|
||||
//+ " at " + ti.x + ":" + ti.y);
|
||||
|
||||
if ((lp.n1 != null && lp.n1 == ti.n2) ||
|
||||
|
@ -21,9 +21,9 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
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 {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -101,7 +101,8 @@ public class ExternalRenderTheme implements Theme {
|
||||
mHashCodeValue = calculateHashCode();
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
||||
private void readObject(ObjectInputStream objectInputStream) throws IOException,
|
||||
ClassNotFoundException {
|
||||
objectInputStream.defaultReadObject();
|
||||
calculateTransientValues();
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import android.graphics.Paint;
|
||||
public interface IRenderCallback {
|
||||
/**
|
||||
* Renders an area with the given parameters.
|
||||
*
|
||||
*
|
||||
* @param area
|
||||
* ...
|
||||
* @param level
|
||||
@ -37,7 +37,7 @@ public interface IRenderCallback {
|
||||
|
||||
/**
|
||||
* Renders an area symbol with the given bitmap.
|
||||
*
|
||||
*
|
||||
* @param symbol
|
||||
* the symbol to be rendered.
|
||||
*/
|
||||
@ -45,7 +45,7 @@ public interface IRenderCallback {
|
||||
|
||||
/**
|
||||
* Renders a point of interest circle with the given parameters.
|
||||
*
|
||||
*
|
||||
* @param radius
|
||||
* the radius of the circle.
|
||||
* @param fill
|
||||
@ -57,7 +57,7 @@ public interface IRenderCallback {
|
||||
|
||||
/**
|
||||
* Renders a point of interest symbol with the given bitmap.
|
||||
*
|
||||
*
|
||||
* @param symbol
|
||||
* the symbol to be rendered.
|
||||
*/
|
||||
@ -65,7 +65,7 @@ public interface IRenderCallback {
|
||||
|
||||
/**
|
||||
* Renders a way with the given parameters.
|
||||
*
|
||||
*
|
||||
* @param line
|
||||
* ...
|
||||
* @param level
|
||||
@ -75,7 +75,7 @@ public interface IRenderCallback {
|
||||
|
||||
/**
|
||||
* Renders a way with the given symbol along the way path.
|
||||
*
|
||||
*
|
||||
* @param symbol
|
||||
* the symbol to be rendered.
|
||||
* @param alignCenter
|
||||
@ -87,7 +87,7 @@ public interface IRenderCallback {
|
||||
|
||||
/**
|
||||
* Renders a way with the given text along the way path.
|
||||
*
|
||||
*
|
||||
* @param text
|
||||
* ...
|
||||
*/
|
||||
@ -95,7 +95,7 @@ public interface IRenderCallback {
|
||||
|
||||
/**
|
||||
* Renders an area caption with the given text.
|
||||
*
|
||||
*
|
||||
* @param text
|
||||
* the text to be rendered.
|
||||
*/
|
||||
@ -103,7 +103,7 @@ public interface IRenderCallback {
|
||||
|
||||
/**
|
||||
* Renders a point of interest caption with the given text.
|
||||
*
|
||||
*
|
||||
* @param text
|
||||
* the text to be rendered.
|
||||
*/
|
||||
|
@ -202,7 +202,7 @@ public class RenderTheme {
|
||||
}
|
||||
|
||||
if (ri == null) {
|
||||
// cache miss
|
||||
// cache miss
|
||||
List<RenderInstruction> matches = mNodeInstructionList;
|
||||
matches.clear();
|
||||
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.
|
||||
*
|
||||
* @param renderCallback
|
||||
* the callback implementation which will be executed on each
|
||||
* match.
|
||||
@ -442,6 +443,7 @@ public class RenderTheme {
|
||||
|
||||
/**
|
||||
* Scales the stroke width of this RenderTheme by the given factor.
|
||||
*
|
||||
* @param scaleFactor
|
||||
* 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.
|
||||
*
|
||||
* @param scaleFactor
|
||||
* the factor by which the text size should be scaled.
|
||||
*/
|
||||
|
@ -89,7 +89,7 @@ public class RenderThemeHandler extends DefaultHandler {
|
||||
|
||||
/**
|
||||
* Logs the given information about an unknown XML attribute.
|
||||
*
|
||||
*
|
||||
* @param element
|
||||
* the XML element name.
|
||||
* @param name
|
||||
|
@ -21,7 +21,8 @@ enum 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() {
|
||||
switch (this) {
|
||||
|
@ -19,7 +19,8 @@ enum 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() {
|
||||
switch (this) {
|
||||
|
@ -47,7 +47,7 @@ public abstract class RenderInstruction {
|
||||
|
||||
/**
|
||||
* Scales the stroke width of this RenderInstruction by the given factor.
|
||||
*
|
||||
*
|
||||
* @param scaleFactor
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* @param scaleFactor
|
||||
* the factor by which the text size should be scaled.
|
||||
*/
|
||||
|
@ -27,7 +27,8 @@ public final class AndroidUtils {
|
||||
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() {
|
||||
for (int i = 0, n = EMULATOR_NAMES.length; i < n; ++i) {
|
||||
|
@ -17,7 +17,7 @@ package org.oscim.utils;
|
||||
public class FastMath {
|
||||
/**
|
||||
* from http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
|
||||
*
|
||||
*
|
||||
* @param v
|
||||
* ...
|
||||
* @return ...
|
||||
|
@ -23,6 +23,7 @@ public final class GeometryUtils {
|
||||
/**
|
||||
* Calculates the center of the minimum bounding rectangle for the given
|
||||
* coordinates.
|
||||
*
|
||||
* @param coordinates
|
||||
* the coordinates for which calculation should be done.
|
||||
* @return the center coordinates of the minimum bounding rectangle.
|
||||
@ -192,7 +193,7 @@ public final class GeometryUtils {
|
||||
return 2; //XSEC_COINCIDENT;
|
||||
|
||||
// lines are parallel
|
||||
return 3; //XSEC_PARALLEL;
|
||||
return 3; //XSEC_PARALLEL;
|
||||
}
|
||||
|
||||
double ua = ua_numr / denr;
|
||||
|
@ -8,14 +8,14 @@ import android.opengl.GLSurfaceView;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class GlConfigChooser implements GLSurfaceView.EGLConfigChooser {
|
||||
static private final String TAG = "ConfigChooser";
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
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);
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
@ -18,9 +18,11 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An LRUCache with a fixed size and an access-order policy. Old mappings are automatically removed from the cache when
|
||||
* new mappings are added. This implementation uses an {@link LinkedHashMap} internally.
|
||||
*
|
||||
* An LRUCache with a fixed size and an access-order policy. Old mappings are
|
||||
* automatically removed from the cache when
|
||||
* new mappings are added. This implementation uses an {@link LinkedHashMap}
|
||||
* internally.
|
||||
*
|
||||
* @param <K>
|
||||
* the type of the map key, see {@link Map}.
|
||||
* @param <V>
|
||||
|
@ -88,7 +88,7 @@ public class LineClipper {
|
||||
}
|
||||
|
||||
// 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).
|
||||
private static boolean clip(int x0, int y0, int x1, int y1,
|
||||
int xmin, int ymin, int xmax, int ymax, int outcode0, int outcode1) {
|
||||
|
@ -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() {
|
||||
// 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() {
|
||||
// do nothing
|
||||
@ -130,7 +132,7 @@ public abstract class PausableThread extends Thread {
|
||||
|
||||
/**
|
||||
* Called when this thread is not paused and should do its work.
|
||||
*
|
||||
*
|
||||
* @throws InterruptedException
|
||||
* if the thread has been interrupted.
|
||||
*/
|
||||
@ -142,7 +144,8 @@ public abstract class PausableThread extends Thread {
|
||||
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() {
|
||||
return Thread.NORM_PRIORITY;
|
||||
|
@ -100,6 +100,7 @@ public abstract class MapActivity extends Activity {
|
||||
|
||||
/**
|
||||
* This method is called once by each MapView during its setup process.
|
||||
*
|
||||
* @param mapView
|
||||
* the calling MapView.
|
||||
*/
|
||||
|
@ -27,7 +27,8 @@ import android.graphics.Paint;
|
||||
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 {
|
||||
/**
|
||||
@ -128,7 +129,8 @@ public class MapScaleBar {
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
mImperialUnits = imperialUnits;
|
||||
@ -145,7 +147,7 @@ public class MapScaleBar {
|
||||
|
||||
/**
|
||||
* Overrides the specified text field with the given string.
|
||||
*
|
||||
*
|
||||
* @param textField
|
||||
* the text field to override.
|
||||
* @param value
|
||||
@ -188,7 +190,7 @@ public class MapScaleBar {
|
||||
|
||||
/**
|
||||
* Redraws the map scale bitmap with the given parameters.
|
||||
*
|
||||
*
|
||||
* @param scaleBarLength
|
||||
* the length of the map scale bar in pixels.
|
||||
* @param mapScaleValue
|
||||
|
@ -273,6 +273,7 @@ public class MapView extends RelativeLayout {
|
||||
|
||||
/**
|
||||
* Calculates all necessary tiles and adds jobs accordingly.
|
||||
*
|
||||
* @param changedPos TODO
|
||||
*/
|
||||
public void redrawMap(boolean changedPos) {
|
||||
@ -344,6 +345,7 @@ public class MapView extends RelativeLayout {
|
||||
|
||||
/**
|
||||
* Sets the MapDatabase for this MapView.
|
||||
*
|
||||
* @param options
|
||||
* the new MapDatabase options.
|
||||
* @return ...
|
||||
@ -395,6 +397,7 @@ public class MapView extends RelativeLayout {
|
||||
|
||||
/**
|
||||
* Sets the internal theme which is used for rendering the map.
|
||||
*
|
||||
* @param internalRenderTheme
|
||||
* the internal rendering theme.
|
||||
* @return ...
|
||||
@ -419,6 +422,7 @@ public class MapView extends RelativeLayout {
|
||||
|
||||
/**
|
||||
* Sets the theme file which is used for rendering the map.
|
||||
*
|
||||
* @param renderThemePath
|
||||
* the path to the XML file which defines the rendering theme.
|
||||
* @throws IllegalArgumentException
|
||||
@ -572,6 +576,7 @@ public class MapView extends RelativeLayout {
|
||||
|
||||
/**
|
||||
* Sets the center and zoom level of this MapView and triggers a redraw.
|
||||
*
|
||||
* @param mapPosition
|
||||
* 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.
|
||||
*
|
||||
* @param geoPoint
|
||||
* 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
|
||||
*
|
||||
* @param jobs
|
||||
* tile jobs
|
||||
*/
|
||||
@ -644,6 +651,7 @@ public class MapView extends RelativeLayout {
|
||||
* You can add/remove/reorder your Overlays using the List of
|
||||
* {@link Overlay}. The first (index 0) Overlay gets drawn first, the one
|
||||
* with the highest as the last one.
|
||||
*
|
||||
* @return ...
|
||||
*/
|
||||
public List<Overlay> getOverlays() {
|
||||
|
@ -164,12 +164,12 @@ public class MapViewPosition {
|
||||
|
||||
// get the z-value of the map-plane for a point on screen
|
||||
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
|
||||
|
||||
// origin is moved by VIEW_DISTANCE
|
||||
double cx = VIEW_DISTANCE;
|
||||
// 'height' of the ray
|
||||
// 'height' of the ray
|
||||
double ry = y * (mHeight / mWidth) * 0.5f;
|
||||
|
||||
// tilt of the plane (center is kept on x = 0)
|
||||
@ -247,6 +247,7 @@ public class MapViewPosition {
|
||||
|
||||
/**
|
||||
* ...
|
||||
*
|
||||
* @return BoundingBox containing view
|
||||
*/
|
||||
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
|
||||
* coordinates
|
||||
*
|
||||
* @param x ...
|
||||
* @param y ...
|
||||
* @param reuse ...
|
||||
@ -320,6 +322,7 @@ public class MapViewPosition {
|
||||
|
||||
/**
|
||||
* get the GeoPoint for x,y in screen coordinates
|
||||
*
|
||||
* @param x screen pixel x
|
||||
* @param y screen pixel y
|
||||
* @return the corresponding GeoPoint
|
||||
@ -344,6 +347,7 @@ public class MapViewPosition {
|
||||
|
||||
/**
|
||||
* get the screen pixel for a GeoPoint
|
||||
*
|
||||
* @param geoPoint ...
|
||||
* @param reuse ...
|
||||
* @return ...
|
||||
@ -456,6 +460,7 @@ public class MapViewPosition {
|
||||
|
||||
/**
|
||||
* Moves this MapViewPosition by the given amount of pixels.
|
||||
*
|
||||
* @param mx the amount of pixels to move the map horizontally.
|
||||
* @param my the amount of pixels to move the map vertically.
|
||||
*/
|
||||
@ -492,6 +497,7 @@ public class MapViewPosition {
|
||||
|
||||
/**
|
||||
* -
|
||||
*
|
||||
* @param scale ...
|
||||
* @param pivotX ...
|
||||
* @param pivotY ...
|
||||
@ -537,6 +543,7 @@ public class MapViewPosition {
|
||||
|
||||
/**
|
||||
* rotate map around pivot cx,cy
|
||||
*
|
||||
* @param angle ...
|
||||
* @param cx ...
|
||||
* @param cy ...
|
||||
|
@ -139,7 +139,7 @@ public class MapZoomControls {
|
||||
|
||||
/**
|
||||
* Zooms in or out by the given amount of zoom levels.
|
||||
*
|
||||
*
|
||||
* @param zoomLevelDiff
|
||||
* the difference to the current zoom level.
|
||||
* @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},
|
||||
* {@link Gravity#BOTTOM}, {@link Gravity#LEFT},
|
||||
* {@link Gravity#CENTER_HORIZONTAL} and {@link Gravity#RIGHT}.
|
||||
*
|
||||
*
|
||||
* @param zoomControlsGravity
|
||||
* a combination of {@link Gravity} constants describing the
|
||||
* desired placement.
|
||||
@ -227,7 +227,7 @@ public class MapZoomControls {
|
||||
* current {@link TileGenerator}. For example, downloading map tiles may
|
||||
* only be possible up to a certain zoom level. Setting a higher maximum
|
||||
* zoom level has no effect in this case.
|
||||
*
|
||||
*
|
||||
* @param zoomLevelMax
|
||||
* the maximum zoom level.
|
||||
* @throws IllegalArgumentException
|
||||
@ -243,7 +243,7 @@ public class MapZoomControls {
|
||||
|
||||
/**
|
||||
* Sets the minimum zoom level of the map.
|
||||
*
|
||||
*
|
||||
* @param zoomLevelMin
|
||||
* the minimum zoom level.
|
||||
* @throws IllegalArgumentException
|
||||
|
@ -52,6 +52,7 @@ public class TriangleJNI {
|
||||
/**
|
||||
* !!! NOT for general use!!! - this is specifically for ExtrusionLayer
|
||||
* .
|
||||
*
|
||||
* @param points points to use: array of x,y coordinates
|
||||
* @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 -
|
||||
|
Loading…
x
Reference in New Issue
Block a user