public class LayerView extends AbstractTileLayerView
图层视图,作为地图视图的子项添加到 MapView
中显示。
图层视图用于显示 SuperMap iServer Java 6R 的 REST 地图服务提供的地图图层。必设属性为地图的 url。
addToNetworkDownload, context, crs, curMapUrl, dpi, isGCSLayer, isLayerInited, layerBounds, layerCacheFileName, layerName, mapView, projection, resolutions, tileCount, totalTileCount, visible, visibleScales, zoomLevel
构造器和说明 |
---|
LayerView(Context context)
构造函数。
|
LayerView(Context context, AttributeSet attrs)
构造函数。
|
LayerView(Context context, AttributeSet attrs, int defStyle)
构造函数。
|
LayerView(Context context, java.lang.String mapUrl)
构造函数。
|
LayerView(Context context, java.lang.String mapUrl, int epsgCode)
构造函数。
|
限定符和类型 | 方法和说明 |
---|---|
void |
clearCache(boolean clearServerCache)
清除本地缓存以及根据 clearServerCache 的值判断是否清除服务器中的缓存,只有在必要的时候设置clearServerCache为true来清除服务器缓存,因为会影响服务器的缓存。
|
void |
destroy()
销毁当前 LayerView 对象,退出前调用。
|
java.lang.String |
getLayersID()
获取子图层的id,用于构建专题图图层
|
double[] |
getResolutions()
获取图层的分辨率数组。
|
double[] |
getScales()
获取图层显示时的固定比例尺数组。
|
java.lang.String |
getURL()
获取MapView中当前图层编码后的 url 地址。
|
protected void |
initResolutionsAndScales(boolean isInitResolutions, boolean isInitScales)
初始化resolutions和scales,该初始化依赖于dpi的初始化,如果图层设置了固定比例尺,必须保证初始化resolutions,因为需要依赖resolutions来出图。
|
void |
initTileContext(Tile tile)
初始化tile瓦片
|
boolean |
isCacheEnabled()
获取是否使用服务器端缓存。
|
boolean |
isTransparent()
获取图层瓦片是否透明。
|
protected void |
onFocusChanged(boolean hasFocus, int direction, Rect unused)
改变地图的焦点。
|
protected void |
onLayout(boolean changed, int l, int t, int r, int b)
分配所有的子元素的大小和位置。
|
void |
setBounds(double left, double bottom, double right, double top)
设置地图地理范围。
|
void |
setCacheEnabled(boolean cacheEnabled)
设置是否使用服务器端缓存。
|
void |
setCRS(CoordinateReferenceSystem crs)
设置当前图层的坐标参考系。
|
void |
setLayersID(java.lang.String layersID)
设置子图层的id,用于构建专题图图层及临时图层等。
|
void |
setResolutions(double[] resolutions)
设置图层的分辨率数组。
|
void |
setScales(double[] visibleScales)
设置图层显示时的固定比例尺数组。
|
void |
setTransparent(boolean isTransparent)
设置图层瓦片是否透明。
|
void |
setURL(java.lang.String mapUrl)
设置当前地图的 url,注意 url 不能进行任何编码。
|
void |
startClearCacheTimer(int minute)
启动定时清除缓存定时器,仅清除客户端缓存,不清除服务器端的缓存。
|
void |
startClearCacheTimer(int minute, boolean clearServerCache)
启动定时清除缓存定时器,并根据 clearServerCache 的值判断是否定时清除服务器端的缓存。
|
void |
stopClearCacheTimer()
停止和销毁清除缓存的定时器。
|
asyncGetTilesFromCache, buildTile, getBounds, getCRS, getMapView, getResolutionIndex, getTileCacher, getZoomLevel, initProjection, isGCSLayer, isInitialized, isVisible, onDraw, setLayerCacheFileName, setOpaqueRate, setVisible, validateZoomLevel
public LayerView(Context context)
构造函数。
context
- Activity的上下文。public LayerView(Context context, AttributeSet attrs)
构造函数。
context
- Activity的上下文。attrs
- 属性信息。public LayerView(Context context, AttributeSet attrs, int defStyle)
构造函数。
context
- Activity的上下文。attrs
- 属性信息。defStyle
- 风格标识。public LayerView(Context context, java.lang.String mapUrl)
构造函数。
context
- Activity的上下文。mapUrl
- 地图服务的 url。public LayerView(Context context, java.lang.String mapUrl, int epsgCode)
构造函数。
context
- Activity的上下文。mapUrl
- 地图服务的 url。epsgCode
- 设置动态投影的目标投影坐标系的 epsgCode。public void setURL(java.lang.String mapUrl)
设置当前地图的 url,注意 url 不能进行任何编码。
setURL
在类中 AbstractTileLayerView
mapUrl
- 地图服务的 url。public void setCRS(CoordinateReferenceSystem crs)
设置当前图层的坐标参考系。
setCRS
在类中 AbstractTileLayerView
crs
- 要显示的坐标参考系对象。public void setBounds(double left, double bottom, double right, double top)
设置地图地理范围。
设置地图地理范围后出图时将按照用户设置的范围进行出图,而不去请求服务器上的地图参数。
left
- 出图范围左侧坐标。bottom
- 出图范围底部坐标。right
- 出图范围右侧坐标。top
- 出图范围顶部坐标。public boolean isCacheEnabled()
获取是否使用服务器端缓存。
public void setCacheEnabled(boolean cacheEnabled)
设置是否使用服务器端缓存。
cacheEnabled
- 是否使用服务器缓存。public java.lang.String getURL()
getURL
在类中 AbstractTileLayerView
public void startClearCacheTimer(int minute)
启动定时清除缓存定时器,仅清除客户端缓存,不清除服务器端的缓存。
minute
- 清除缓存的时间间隔,单位为分钟。public void startClearCacheTimer(int minute, boolean clearServerCache)
启动定时清除缓存定时器,并根据 clearServerCache 的值判断是否定时清除服务器端的缓存。
minute
- 清除缓存的时间间隔,单位为分钟。clearServerCache
- 是否定时清除服务器端的缓存。public void stopClearCacheTimer()
停止和销毁清除缓存的定时器。
public void clearCache(boolean clearServerCache)
清除本地缓存以及根据 clearServerCache 的值判断是否清除服务器中的缓存,只有在必要的时候设置clearServerCache为true来清除服务器缓存,因为会影响服务器的缓存。
clearCache
在类中 AbstractTileLayerView
clearServerCache
- 是否定时清除服务器中的缓存。public void setScales(double[] visibleScales)
设置图层显示时的固定比例尺数组。
此设置的固定比例尺优先于地图本身的固定比例尺。若不设置,则以地图本身设置的固定比例尺为准;若地图无固定比例尺,则按照缩放级别进行地图的缩放。
visibleScales
- 图层显示时的固定比例尺数组。public double[] getScales()
AbstractTileLayerView
获取图层显示时的固定比例尺数组。
getScales
在类中 AbstractTileLayerView
public java.lang.String getLayersID()
获取子图层的id,用于构建专题图图层
public void setLayersID(java.lang.String layersID)
设置子图层的id,用于构建专题图图层及临时图层等。 获取进行切片的地图图层 ID,即指定进行地图切片的图层,可以是临时图层集,也可以是当前地图中图层的组合。如果此参数缺省则对全部图层进行切片。
layersID 可以是临时图层创建时 templayers 的 ID,如 layersID=382139acf0,也可以是当前地图中的某些图层的 ID 编号。 其中,当前地图图层 ID 的定义规则如下: 1. 各级图层按照图层顺序自上而下从0开始编号; 2. 冒号(:)前为顶级图层; 3. 英文句号(.)表示其他各级图层间的从属关系; 4. 英文逗号(,)表示图层间的分隔。
例如: 其中,当前地图图层 ID 的定义规则如下: 1. [0:0,1,2.0]表示顶级图层0下面的子图层:0、1及其下属所有子图层,和2下的子图层0; 2. [1:1.2,2]表示顶级级图层1下面的子图层:1下的子图层2,和图层2及其下属所有子图层; 3. 两个示例合并在一起则是:[0:0,1,2.0,1:1.2,2] 此外,[0,1,2,3]表示顶级图层0下面的图层0、1、2、3及所有子图层,[0:,1:,2:]表示顶级图层0、1、2及其所有子图层。
layersID
-protected void initResolutionsAndScales(boolean isInitResolutions, boolean isInitScales)
初始化resolutions和scales,该初始化依赖于dpi的初始化,如果图层设置了固定比例尺,必须保证初始化resolutions,因为需要依赖resolutions来出图。
isInitResolutions
- 分辨率是否初始化。isInitScales
- 比例尺是否初始化。public void setResolutions(double[] resolutions)
设置图层的分辨率数组。
resolutions
- 图层的分辨率数组。public double[] getResolutions()
获取图层的分辨率数组。
getResolutions
在类中 AbstractTileLayerView
public boolean isTransparent()
获取图层瓦片是否透明。
public void setTransparent(boolean isTransparent)
设置图层瓦片是否透明。
isTransparent
- 图层瓦片是否透明。protected void onLayout(boolean changed, int l, int t, int r, int b)
protected void onFocusChanged(boolean hasFocus, int direction, Rect unused)
public void destroy()
销毁当前 LayerView 对象,退出前调用。
destroy
在类中 AbstractTileLayerView
public void initTileContext(Tile tile)
初始化tile瓦片
initTileContext
在类中 AbstractTileLayerView
tile
-