public class Map extends java.lang.Object implements IRequestRender
Modifier and Type | Class and Description |
---|---|
static class |
Map.OVERLAYS |
class |
Map.Tile |
Modifier and Type | Field and Description |
---|---|
protected boolean |
canRotate |
protected boolean |
canRotateCamera |
protected boolean |
canTilt |
static short |
CLEAR_TEXTURE_MODE_ALL |
static short |
CLEAR_TEXTURE_MODE_NONE |
static short |
CLEAR_TEXTURE_MODE_ONLY_TARGET |
static short |
CLEAR_TILE_MODE_ALL |
static short |
CLICK_ON_MAP |
static short |
CLICK_ON_PIN |
static int |
DEBUG_MODE |
static int |
DEBUG_MODE_NONE |
static int |
DEBUG_MODE_PERFORMANCE |
static java.lang.String |
DEFAULT_ADDRESS_URL |
static java.lang.String |
DEFAULT_API_KEY_CHECKER_URL |
static java.lang.String |
DEFAULT_CAMERA_EVENT_ICON |
static java.lang.String |
DEFAULT_CAMERA_URL |
static java.lang.String |
DEFAULT_EVENT_URL |
static java.lang.String |
DEFAULT_TAG_ICON_URL |
static java.lang.String |
DEFAULT_TAG_SERVER |
static short |
DOUBLE_CLICK_ON_MAP |
protected boolean |
enableTouch |
static short |
FIX_OBJECT_RENDER_MODE_RECT |
static short |
FIX_OBJECT_RENDER_MODE_TRI |
protected static java.lang.Object |
forceSingleBackgroundThread |
boolean |
forceUseCache |
java.util.HashMap<java.lang.String,Bitmap> |
iconCacheDict |
protected boolean |
isZooming |
static java.lang.String |
LONGCLICK_BUNDLE_LAT |
static java.lang.String |
LONGCLICK_BUNDLE_LON |
static java.lang.String |
LONGCLICK_BUNDLE_TILENUMBER |
static java.lang.String |
LONGCLICK_BUNDLE_ZOOMLEVEL |
static int |
MAX_TILT |
static int |
MAX_ZOOM_LEVEL |
static int |
MIN_ZOOM_LEVEL |
protected short |
mode |
static short |
MODE_COMPASS |
static short |
MODE_NORMAL |
static short |
MODE_TRACK_USER |
static short |
MODE_UPDATING_LOCATION |
static int |
ONE_SEC |
protected float |
rotate |
protected float |
scale |
static float |
SCALE_BAR_FADE_FAST |
static float |
SCALE_BAR_FADE_SLOW |
protected static java.util.concurrent.Semaphore |
semaphoreForNetwork |
protected static java.util.concurrent.Semaphore |
semaphoreManualRender |
protected float |
tilt |
protected static boolean |
VALID_LINE_WEIGHT_ORDER |
protected static boolean |
VALID_PIN_WEIGHT_ORDER |
protected float |
xTranslate |
protected float |
yTranslate |
protected int |
zoomLevel |
protected float |
zoomStep |
Constructor and Description |
---|
Map(Context context,
int defaultZommLevel,
ISetRenderMode setRenderModeListener,
ZoomControlListener zoomControlListener) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
_zoomIn(boolean requestRender) |
protected boolean |
_zoomOut(boolean requestRender) |
void |
add3DModel(float[] vertices,
int verticesCount,
float[] verticesTexture,
Bitmap texture,
MapLocation location) |
void |
add3DModel(float[] vertices,
int verticesCount,
float[] verticesTexture,
Bitmap texture,
MapLocation location,
float[] color) |
void |
add3DModel(float[] vertices,
int verticesCount,
float[] verticesTexture,
Bitmap texture,
MapLocation location,
float[] color,
boolean isRandomColor) |
void |
addFixObject(float[] vertices,
int[] verticesCount,
short renderMode) |
void |
addLayer(Layer layer) |
void |
addLine(Line line) |
boolean |
addTag(java.lang.String tagName) |
boolean |
addTag(java.lang.String tagName,
int minZoom,
int maxZoom) |
void |
bound(java.util.List<IMarker> markerList) |
MapLocation |
bound(java.util.List<IMarker> markerList,
boolean doMoveAnimation,
boolean doZoomAnimation,
boolean onlyReturnValue,
boolean fixCenter) |
protected void |
calculateOffset() |
void |
calculateScaleBarDimension(boolean forceRerender) |
void |
cancelAnimation() |
void |
cancelGetCurrentLocation() |
boolean |
canZoomIn() |
boolean |
canZoomOut() |
void |
clearCache(boolean executeInBackground) |
void |
clearCache(boolean executeInBackground,
java.lang.String specificLayerName)
Delete map cache on device's storage
|
void |
clearLine() |
void |
clearMapCache(short mode) |
void |
clearMapCache(short mode,
java.lang.String targetLayerID)
Delete map cache on memory with specific mode
|
void |
clearPin() |
protected void |
clickOnMap(MotionEvent e) |
protected void |
disableCompass() |
protected boolean |
doubleClickMap(MotionEvent e) |
protected void |
draw(float[] mvpMatrix) |
protected void |
enableCompass() |
boolean |
freezePin()
Pause rendering pin in order to add a lot of pin in short period time.
|
void |
getAddress(IAddressListener listener) |
void |
getAddress(MapLocation location,
IAddressListener listener) |
Layer[] |
getAllLayer() |
Line[] |
getAllLines() |
Pin[] |
getAllPin() |
Layer |
getBase() |
ICacheListener |
getCacheListener() |
void |
getCacheSize()
Get cache size on device storage.
|
IClickListener |
getClickListener() |
long |
getCountTileInTileDict()
Get number of tile currently in tile dictionary
|
boolean |
getCurrentLocation()
Get user's current location.
|
double |
getCx() |
double |
getCy() |
Line[] |
getLinesByTag(java.lang.String regex) |
boolean |
getLineVisibility() |
MapLocation |
getLocation()
Get map's current location
|
ILocationListener |
getLocationListener() |
Bitmap |
getMapBackground() |
int |
getMapHeight() |
protected com.longdo.api.Map.MapPin |
getMapPinByPin(Pin p) |
int |
getMapWidth() |
IMessageListener |
getMessageListener() |
short |
getMode() |
protected float |
getPanX() |
protected float |
getPanY() |
Pin[] |
getPinByTag(java.lang.String regex) |
boolean |
getPinVisibility() |
float |
getRotate() |
float |
getScale() |
float[] |
getScaleBarColor() |
float |
getScaleBarLineWidth() |
float |
getScaleBarPaddingX() |
float |
getScaleBarPaddingY() |
int |
getScaleBarTextSize() |
int |
getScreenOffsetX() |
int |
getScreenOffsetY() |
IStatusListener |
getStatusListener() |
java.util.List<java.lang.String> |
getTag() |
float |
getTilt() |
static java.lang.String |
getVersion() |
int |
getZoom() |
IZoomListener |
getZoomListener() |
boolean |
isalwaysRenderLayerBeforeBase() |
boolean |
isCanRotate() |
boolean |
isCanRotateCamera() |
boolean |
isCanTilt() |
boolean |
isDisableTouchWhenMoving() |
boolean |
isDoPreShowCache() |
boolean |
isDoTileAnimation() |
boolean |
isDrawCrossSign() |
boolean |
isDrawerChild() |
boolean |
isDrawScaleBar() |
boolean |
isEnableTouch() |
protected boolean |
isIgnoreTouch() |
boolean |
isNeverAllowParentInterceptTouchEvent() |
protected boolean |
isNoAnimation() |
boolean |
isScaleBarTextBold() |
protected boolean |
isShowPopup(Pin p) |
static double |
latToLocationY(double lat) |
static long |
locationToTileNumber(double cx,
double cy,
int zoomLevel)
Convert cx, cy and zoom level to tile number
|
static long |
locationToTileNumber(MapLocation location,
int zoomLevel)
Convert
MapLocation to tile number |
static double |
locationXToLon(double valX) |
static double |
locationYToLat(double locationY) |
protected void |
longClickOnMap(MotionEvent e) |
static double |
longitudeLength(double lat) |
static double |
lonToLocationX(double lon) |
static PointF |
mapLocationToTranslate(MapLocation location)
Convert
MapLocation to OpenGL translate value |
static double |
mercLat2Norm(double norm) |
static double |
mercNorm2Lat(double cY) |
void |
onAccuracyChanged(Sensor sensor,
int accuracy) |
void |
onSensorChanged(SensorEvent event) |
void |
overLaysLoad(Map.OVERLAYS component,
IPinListener listener,
int minZoom,
int maxZoom) |
void |
overLaysUnload(Map.OVERLAYS component) |
protected void |
pan(float x,
float y,
boolean isUserAction) |
void |
pushPin(Pin pin) |
void |
readGeoJson(java.lang.String geoJson) |
boolean |
removeLayer(java.lang.String layerId) |
boolean |
removeLine(Line line) |
boolean |
removePin(Pin toBeRemovedPin) |
boolean |
removeTag(java.lang.String tagName) |
protected void |
requestContinuously() |
void |
requestRender(java.lang.String reason) |
void |
requestRender(java.lang.String reason,
boolean force) |
void |
rotate(float a,
boolean animation) |
protected void |
scale(float newScale) |
void |
setalwaysRenderLayerBeforeBase(boolean alwaysRenderLayerBeforeBase) |
void |
setBase(Layer layer) |
void |
setCacheListener(ICacheListener cacheListener) |
void |
setCanRotate(boolean canRotate) |
void |
setCanRotateCamera(boolean canRotateCamera) |
void |
setCanTilt(boolean canTilt) |
void |
setClickListener(IClickListener clickListener) |
void |
setCrossSignColor(float[] color)
Cross sign is a red '+' sign in the middle of a map.
|
protected void |
setCurrentLocationValue(MapLocation currentLocationValue,
Location location) |
void |
setDisableTouchWhenMoving(boolean disableTouchWhenMoving) |
void |
setDoPreShowCache(boolean doPreShowCache) |
void |
setDoTileAnimation(boolean doTileAnimation)
Whether tile appearing should be with animation or not.
|
void |
setDrawCrossSign(boolean drawCrossSign) |
void |
setDrawerChild(boolean isDrawerChild)
Set to true if parent of this map is a
DrawerLayout , false otherwise |
void |
setDrawScaleBar(boolean isDrawScaleBar) |
void |
setDrawScaleBar(boolean isDrawScaleBar,
boolean isFade,
float fadeStep) |
void |
setEnableTouch(boolean enableTouch) |
void |
setLineVisibility(boolean show) |
void |
setListener(IMapListener listener) |
void |
setLocation(MapLocation location) |
long |
setLocation(MapLocation location,
boolean doAnimate) |
long |
setLocation(MapLocation location,
boolean doAnimate,
boolean isUserAction) |
void |
setLocationListener(ILocationListener locationListener) |
void |
setMapBackground(Bitmap mapBackground) |
void |
setMapHeight(int mapHeight) |
void |
setMapWidth(int mapWidth) |
int |
setMaxZoom(int maxZoomLevel) |
void |
setMessageListener(IMessageListener messageListener) |
int |
setMinZoom(int minZoomLevel) |
void |
setMode(short mode) |
void |
setNeverAllowParentInterceptTouchEvent(boolean neverAllow) |
void |
setPinVisibility(boolean show) |
void |
setScaleBarColor(float[] color) |
void |
setScaleBarColor(int color) |
void |
setScaleBarLineWidth(float scaleBarLineWidth) |
void |
setScaleBarPaddingX(float scaleBarPaddingX) |
void |
setScaleBarPaddingY(float scaleBarPaddingY) |
void |
setScaleBarTextBold(boolean scaleBarTextBold) |
void |
setScaleBarTextSize(int scaleBarTextSize) |
void |
setScreenOffsetX(int screenOffsetX)
To add offset to map's width in order to pre-load and pre-render tile before it is shown on the screen.
|
void |
setScreenOffsetY(int screenOffsetY)
To add offset to map's height in order to pre-load and pre-render tile before it is shown on the screen.
|
void |
setScreenOffsetY(int screenOffsetY,
boolean isFromUser) |
void |
setStatusListener(IStatusListener statusListener) |
void |
setTagListener(IPinListener tagListener) |
void |
setTilt(float tilt) |
boolean |
setZoom(int newZoomLevel) |
boolean |
setZoom(int newZoomLevel,
boolean doAnimation)
Set new zoom level.
|
void |
setZoomListener(IZoomListener zoomListener) |
protected void |
showPopup(Pin p,
boolean showPopup) |
void |
unFreezePin()
Continue rendering pin
|
boolean |
zoomIn() |
boolean |
zoomIn(boolean doAnimation) |
boolean |
zoomOut() |
boolean |
zoomOut(boolean doAnimation) |
public static final int DEBUG_MODE_NONE
public static final int DEBUG_MODE_PERFORMANCE
public static int DEBUG_MODE
public static int ONE_SEC
public static final short FIX_OBJECT_RENDER_MODE_RECT
public static final short FIX_OBJECT_RENDER_MODE_TRI
public static int MAX_TILT
public static final int MAX_ZOOM_LEVEL
public static final int MIN_ZOOM_LEVEL
public static final java.lang.String DEFAULT_API_KEY_CHECKER_URL
public static final java.lang.String DEFAULT_TAG_SERVER
public static final java.lang.String DEFAULT_TAG_ICON_URL
public static final java.lang.String DEFAULT_CAMERA_URL
public static final java.lang.String DEFAULT_EVENT_URL
public static final java.lang.String DEFAULT_CAMERA_EVENT_ICON
public static final java.lang.String DEFAULT_ADDRESS_URL
public static final short CLEAR_TEXTURE_MODE_NONE
public static final short CLEAR_TEXTURE_MODE_ALL
public static final short CLEAR_TEXTURE_MODE_ONLY_TARGET
public static final short CLEAR_TILE_MODE_ALL
public static final short CLICK_ON_MAP
public static final short CLICK_ON_PIN
public static final short DOUBLE_CLICK_ON_MAP
public static final java.lang.String LONGCLICK_BUNDLE_LAT
public static final java.lang.String LONGCLICK_BUNDLE_LON
public static final java.lang.String LONGCLICK_BUNDLE_ZOOMLEVEL
public static final java.lang.String LONGCLICK_BUNDLE_TILENUMBER
public static final short MODE_NORMAL
public static final short MODE_TRACK_USER
public static final short MODE_UPDATING_LOCATION
public static final short MODE_COMPASS
public static final float SCALE_BAR_FADE_SLOW
public static final float SCALE_BAR_FADE_FAST
protected int zoomLevel
protected float xTranslate
protected float yTranslate
protected float scale
protected float zoomStep
public boolean forceUseCache
protected boolean isZooming
protected short mode
protected float rotate
protected float tilt
protected boolean canRotateCamera
protected boolean canRotate
protected boolean canTilt
protected static boolean VALID_PIN_WEIGHT_ORDER
protected static boolean VALID_LINE_WEIGHT_ORDER
protected boolean enableTouch
protected static final java.util.concurrent.Semaphore semaphoreForNetwork
protected static final java.lang.Object forceSingleBackgroundThread
protected static final java.util.concurrent.Semaphore semaphoreManualRender
public java.util.HashMap<java.lang.String,Bitmap> iconCacheDict
public Map(Context context, int defaultZommLevel, ISetRenderMode setRenderModeListener, ZoomControlListener zoomControlListener)
public static double mercLat2Norm(double norm)
public static double mercNorm2Lat(double cY)
public static double locationYToLat(double locationY)
public static double latToLocationY(double lat)
public static double locationXToLon(double valX)
public static double lonToLocationX(double lon)
public static double longitudeLength(double lat)
protected void draw(float[] mvpMatrix)
public void clearMapCache(short mode)
public void clearMapCache(short mode, java.lang.String targetLayerID)
mode
- obtain from Map
's static field with prefix CLEAR_targetLayerID
- public void clearCache(boolean executeInBackground)
public void clearCache(boolean executeInBackground, java.lang.String specificLayerName)
executeInBackground
- if true, operation will be executed in BackgroundTile
thread, false otherwise.public void getCacheSize()
ICacheListener.onFinishCheckCacheSize(long)
will be called.public void setCrossSignColor(float[] color)
color
- in r, g, b, a formatpublic void calculateScaleBarDimension(boolean forceRerender)
public float getScaleBarPaddingY()
public void setScaleBarPaddingY(float scaleBarPaddingY)
public float getScaleBarPaddingX()
public void setScaleBarPaddingX(float scaleBarPaddingX)
public void setScaleBarColor(int color)
public void setScaleBarColor(float[] color)
public float[] getScaleBarColor()
public float getScaleBarLineWidth()
public void setScaleBarLineWidth(float scaleBarLineWidth)
public boolean isScaleBarTextBold()
public void setScaleBarTextBold(boolean scaleBarTextBold)
public int getScaleBarTextSize()
public void setScaleBarTextSize(int scaleBarTextSize)
protected void clickOnMap(MotionEvent e)
protected void longClickOnMap(MotionEvent e)
protected boolean doubleClickMap(MotionEvent e)
public static PointF mapLocationToTranslate(MapLocation location)
MapLocation
to OpenGL translate valuepublic static long locationToTileNumber(MapLocation location, int zoomLevel)
MapLocation
to tile numberpublic static long locationToTileNumber(double cx, double cy, int zoomLevel)
protected void calculateOffset()
protected void pan(float x, float y, boolean isUserAction)
protected void scale(float newScale)
public void rotate(float a, boolean animation)
public float getRotate()
protected float getPanX()
protected float getPanY()
public double getCx()
public double getCy()
public float getScale()
public boolean setZoom(int newZoomLevel)
public boolean setZoom(int newZoomLevel, boolean doAnimation)
public boolean zoomIn()
public boolean zoomOut()
public boolean zoomIn(boolean doAnimation)
public boolean zoomOut(boolean doAnimation)
protected boolean _zoomIn(boolean requestRender)
protected boolean _zoomOut(boolean requestRender)
public boolean canZoomIn()
public boolean canZoomOut()
public int getZoom()
public IZoomListener getZoomListener()
public void setZoomListener(IZoomListener zoomListener)
public int getMapHeight()
public void setMapHeight(int mapHeight)
public int getMapWidth()
public void setMapWidth(int mapWidth)
public int setMaxZoom(int maxZoomLevel)
public int setMinZoom(int minZoomLevel)
public MapLocation getLocation()
public void cancelGetCurrentLocation()
public boolean getCurrentLocation()
ILocationListener.onGetCurrentLocation(MapLocation, Location)
will be called.protected void setCurrentLocationValue(MapLocation currentLocationValue, Location location)
public long setLocation(MapLocation location, boolean doAnimate)
public long setLocation(MapLocation location, boolean doAnimate, boolean isUserAction)
public void setLocation(MapLocation location)
public Line[] getLinesByTag(java.lang.String regex)
public Line[] getAllLines()
public void addLine(Line line)
public boolean removeLine(Line line)
public void clearLine()
public void setLineVisibility(boolean show)
public boolean getLineVisibility()
public void pushPin(Pin pin)
public boolean freezePin()
public void unFreezePin()
public void clearPin()
public boolean removePin(Pin toBeRemovedPin)
public Pin[] getPinByTag(java.lang.String regex)
public Pin[] getAllPin()
public void bound(java.util.List<IMarker> markerList)
public MapLocation bound(java.util.List<IMarker> markerList, boolean doMoveAnimation, boolean doZoomAnimation, boolean onlyReturnValue, boolean fixCenter)
public void setPinVisibility(boolean show)
public boolean getPinVisibility()
protected com.longdo.api.Map.MapPin getMapPinByPin(Pin p)
protected void showPopup(Pin p, boolean showPopup)
protected boolean isShowPopup(Pin p)
public Layer getBase()
public void setBase(Layer layer)
public void addLayer(Layer layer)
public boolean removeLayer(java.lang.String layerId)
public Layer[] getAllLayer()
public boolean isalwaysRenderLayerBeforeBase()
public void setalwaysRenderLayerBeforeBase(boolean alwaysRenderLayerBeforeBase)
protected boolean isNoAnimation()
protected void requestContinuously()
public void requestRender(java.lang.String reason)
requestRender
in interface IRequestRender
public void requestRender(java.lang.String reason, boolean force)
protected void enableCompass()
protected void disableCompass()
public void onAccuracyChanged(Sensor sensor, int accuracy)
public void onSensorChanged(SensorEvent event)
public void addFixObject(float[] vertices, int[] verticesCount, short renderMode)
public void add3DModel(float[] vertices, int verticesCount, float[] verticesTexture, Bitmap texture, MapLocation location)
public void add3DModel(float[] vertices, int verticesCount, float[] verticesTexture, Bitmap texture, MapLocation location, float[] color)
public void add3DModel(float[] vertices, int verticesCount, float[] verticesTexture, Bitmap texture, MapLocation location, float[] color, boolean isRandomColor)
public void setTagListener(IPinListener tagListener)
public boolean addTag(java.lang.String tagName)
public boolean addTag(java.lang.String tagName, int minZoom, int maxZoom)
public boolean removeTag(java.lang.String tagName)
public java.util.List<java.lang.String> getTag()
public void getAddress(MapLocation location, IAddressListener listener)
public void getAddress(IAddressListener listener)
public long getCountTileInTileDict()
public void setListener(IMapListener listener)
public IClickListener getClickListener()
public void setClickListener(IClickListener clickListener)
public ILocationListener getLocationListener()
public void setLocationListener(ILocationListener locationListener)
public ICacheListener getCacheListener()
public void setCacheListener(ICacheListener cacheListener)
public IStatusListener getStatusListener()
public void setStatusListener(IStatusListener statusListener)
public boolean isDoTileAnimation()
public void setDoTileAnimation(boolean doTileAnimation)
doTileAnimation
- protected boolean isIgnoreTouch()
public short getMode()
public void setMode(short mode)
public Bitmap getMapBackground()
public void setMapBackground(Bitmap mapBackground)
public int getScreenOffsetX()
public void setScreenOffsetX(int screenOffsetX)
screenOffsetX
- in pxpublic int getScreenOffsetY()
public void setScreenOffsetY(int screenOffsetY)
screenOffsetY
- in pxpublic void setScreenOffsetY(int screenOffsetY, boolean isFromUser)
public boolean isDrawerChild()
public void setDrawerChild(boolean isDrawerChild)
DrawerLayout
, false otherwisepublic boolean isDrawScaleBar()
public void setDrawScaleBar(boolean isDrawScaleBar)
public void setDrawScaleBar(boolean isDrawScaleBar, boolean isFade, float fadeStep)
public boolean isDoPreShowCache()
public void setDoPreShowCache(boolean doPreShowCache)
public boolean isDrawCrossSign()
public void setDrawCrossSign(boolean drawCrossSign)
public boolean isCanRotateCamera()
public void setCanRotateCamera(boolean canRotateCamera)
public boolean isCanRotate()
public void setCanRotate(boolean canRotate)
public float getTilt()
public void setTilt(float tilt)
public boolean isCanTilt()
public void setCanTilt(boolean canTilt)
public void cancelAnimation()
public IMessageListener getMessageListener()
public void setMessageListener(IMessageListener messageListener)
public void readGeoJson(java.lang.String geoJson) throws JSONException
JSONException
public boolean isDisableTouchWhenMoving()
public void setDisableTouchWhenMoving(boolean disableTouchWhenMoving)
public void overLaysLoad(Map.OVERLAYS component, IPinListener listener, int minZoom, int maxZoom)
public void overLaysUnload(Map.OVERLAYS component)
public void setNeverAllowParentInterceptTouchEvent(boolean neverAllow)
public boolean isNeverAllowParentInterceptTouchEvent()
public boolean isEnableTouch()
public void setEnableTouch(boolean enableTouch)
public static java.lang.String getVersion()