RMMapContents

@interface RMMapContents : NSObject

The cartographic and data components of a map.  Do not retain.

There is exactly one RMMapContents instance for each RMMapView instance.

warning:Do not retain an RMMapContents instance.  Instead, ask the RMMapView for its contents when you need it.  It is an error for an RMMapContents instance to exist without a view, and if you retain the RMMapContents, it can’t go away when the RMMapView is released.

At some point, it’s likely that RMMapContents and RMMapView will be merged into one class.

Summary
RMMapContentsThe cartographic and data components of a map.
Properties
projectedBounds视图内地理范围 origin:表示地图左下角的地理坐标,size:表示地图的横向和纵向地理坐标范围
zoom{float} 缩放级别,其值必须在tileSource的缩放级别范围内,即其值必须不小0且不大于最大缩放级别数。
scaleDenominator{double} 比例尺的分母值,其比例尺形如1/24000, 1/50000, 1/2000000。
Constructor
initWithView用于初始化RMMapContents
initWithView用于初始化RMMapContents
initWithView用于初始化RMMapContents
initWithView用于初始化RMMapContents
initWithView用于初始化RMMapContents
Functions
addTileSource添加叠加图层
addTileSource添加叠加图层
removeTileSource移除叠加图层 底图不能被移除。
removeTileSource移除叠加图层 底图不能被移除。
setHidden隐藏图层
setHidden隐藏图层
setOpacity设置图层的透明度
setOpacity设置图层的透明度
moveToProjectedPoint用于重置地图的中心点
latLongToProjectedPoint将经纬度坐标转换为投影坐标
pixelToProjectedPoint将像素坐标转换为当前地图的地理坐标
projectedPointToLatLong将投影坐标转换为经纬度坐标
zoomWithLatLngBoundsNorthEast:SouthWest将地图缩放至指定经纬度范围内
refreshMap刷新瓦片地图
setLayerID:forTileSource:控制tileSource图层的可见性
setLayerID:forTileSourceAtIndex:控制索引为index的tileSource中各个图层的可见性
setDisplayFilter:forTileSource:设置过滤条件,控制图层内部对象显示
setDisplayFilter:forTileSourceAtIndex:设置过滤条件,控制图层内部对象显示
setTempLayerID:forTileSource:用于控制临时图层的子图层的显示或隐藏
latitudeLongitudeBoundingBoxFor返回包含整个屏幕的最小边界框
latitudeLongitudeBoundingBoxFor返回包含所指定矩形的最小边界框。
removeAllCachedImages删除tileSource缓存机制所缓存的所有图片。

Properties

projectedBounds

视图内地理范围 origin:表示地图左下角的地理坐标,size:表示地图的横向和纵向地理坐标范围

Returns

{RMProjectedRect}

zoom

{float} 缩放级别,其值必须在tileSource的缩放级别范围内,即其值必须不小0且不大于最大缩放级别数。

scaleDenominator

{double} 比例尺的分母值,其比例尺形如1/24000, 1/50000, 1/2000000。

Constructor

initWithView

用于初始化RMMapContents

Parameters

view{UIView} mapView。

initWithView

用于初始化RMMapContents

Parameters

view{UIView} mapView。
screenScale{float} 设备的屏幕分辨率的属性值

initWithView

用于初始化RMMapContents

Parameters

view{UIView} mapView。
tilesource{id<RMTileSource>} 地图服务,底图。

initWithView

用于初始化RMMapContents

Parameters

view{UIView} mapView。
tilesource{id<RMTileSource>} 地图服务,底图。
screenScale{float} 设备的屏幕分辨率的属性值

initWithView

用于初始化RMMapContents

Parameters

view{UIView} mapView。
tilesource{id<RMTileSource>} 地图服务,底图。
centerLatLon{CLLocationCoordinate2D} 地图的中心点
zoomLevel{float} 地图初始化时的缩放级别
maxZoomLevel{float} 最大缩放级别
minZoomLevel{float} 最小缩放级别
backgroundImage{UIImage *}
screenScale{float} 设备的屏幕分辨率的属性值

Functions

addTileSource

- (void)addTileSource:(id <RMTileSource>)newTileSource

添加叠加图层

Parameters

newTileSource{id RMTileSource} 地图服务,叠加图层

addTileSource

- (void)addTileSource:(id<RMTileSource>)newTileSource atIndex:(NSUInteger)index

添加叠加图层

Parameters

newTileSource{id RMTileSource} 地图服务,叠加图层
index{NSUInteger} 图层的索引值

removeTileSource

- (void)removeTileSource:(id <RMTileSource>)tileSource

移除叠加图层 底图不能被移除。

Parameters

tileSource{id RMTileSource} 地图服务,所移除的图层

removeTileSource

- (void)removeTileSourceAtIndex:(NSUInteger)index

移除叠加图层 底图不能被移除。

Parameters

tileSource{id RMTileSource} 地图服务,所需移除的图层
index{NSUInteger} 图层的索引值

setHidden

- (void)setHidden:(BOOL)isHidden forTileSource:(id <RMTileSource>)tileSource

隐藏图层

Parameters

tileSource{id RMTileSource} 地图服务,所需隐藏的图层

setHidden

- (void)setHidden:(BOOL)isHidden forTileSourceAtIndex:(NSUInteger)index

隐藏图层

Parameters

tileSource{id RMTileSource} 地图服务,所需隐藏的图层
index{NSUInteger} 图层的索引值

setOpacity

- (void)setOpacity:(float)opacity forTileSource:(id <RMTileSource>)tileSource

设置图层的透明度

Parameters

opacity{float} 图层的透明度,其中在[0,1]区间内,默认为1,即不透明。
tileSource{id RMTileSource} 地图服务,所设置透明度的图层

setOpacity

- (void)setOpacity:(CGFloat)opacity forTileSourceAtIndex:(NSUInteger)index

设置图层的透明度

Parameters

opacity{float} 图层的透明度,其中在[0,1]区间内,默认为1,即不透明。
index{NSUInteger} 所设置透明度的图层的索引值

moveToProjectedPoint

- (void)moveToProjectedPoint: (RMProjectedPoint)aPoint

用于重置地图的中心点

Parameters

aPoint{RMProjectedPoint}

latLongToProjectedPoint

- (RMProjectedPoint)latLongToProjectedPoint:(CLLocationCoordinate2D)latlong

将经纬度坐标转换为投影坐标

Parameters

latlong{CLLocationCoordinate2D} 所需转换的经纬度坐标

Returns

{RMProjectedPoint}

pixelToProjectedPoint

- (RMProjectedPoint)pixelToProjectedPoint:(CGPoint)aPixel

将像素坐标转换为当前地图的地理坐标

Parameters

aPixel{CGPoint} 所需转换的像素坐标

Returns

{RMProjectedPoint}

projectedPointToLatLong

- (
   CLLocationCoordinate2D
)projectedPointToLatLong:(RMProjectedPoint)projectedPoint

将投影坐标转换为经纬度坐标

Parameters

projectedPoint{RMProjectedPoint} 所需转换的投影坐标

Returns

{CLLocationCoordinate2D}

zoomWithLatLngBoundsNorthEast:SouthWest

将地图缩放至指定经纬度范围内

Parameters

ne{CLLocationCoordinate2D} 缩放后显示范围东北点经纬度坐标
sw{CLLocationCoordinate2D} 缩放后显示范围西南点经纬度坐标

refreshMap

- (void)refreshMap

刷新瓦片地图

setLayerID:forTileSource:

控制tileSource图层的可见性

Parameters

layerID{NSString} 图层在tileSource中的索引,如[1,2,3]-表示tileSource中的索引为1,2,3的图层可见
tileSource{id RMTileSource} 需要控制的tileSource

setLayerID:forTileSourceAtIndex:

控制索引为index的tileSource中各个图层的可见性

Parameters

layerID{NSString} 图层在tileSource中的索引,如[1,2,3]-表示tileSource中的索引为1,2,3的图层可见
index{NSUInteger} tileSource在mapContents中的索引

setDisplayFilter:forTileSource:

设置过滤条件,控制图层内部对象显示

Parameters

displayFilter{NSDictionary} 图层显示过滤条件
forTileSource{id<RMTileSource>} 需要控制的tileSource

setDisplayFilter:forTileSourceAtIndex:

设置过滤条件,控制图层内部对象显示

Parameters

displayFilter{NSDictionary} 图层显示过滤条件
index{NSUInteger} tileSource在mapContents中的索引

setTempLayerID:forTileSource:

用于控制临时图层的子图层的显示或隐藏

Parameters

layerID{NSString} 图层在tileSource中的索引,如[1,2,3]-表示tileSource中的索引为1,2,3的图层可见
tileSource{id<RMTileSource>} 需要控制的tileSource

latitudeLongitudeBoundingBoxFor

- (RMSphericalTrapezium) latitudeLongitudeBoundingBoxForScreen

返回包含整个屏幕的最小边界框

Returns

{RMSphericalTrapezium}

latitudeLongitudeBoundingBoxFor

- (RMSphericalTrapezium) latitudeLongitudeBoundingBoxFor:(CGRect) rect

返回包含所指定矩形的最小边界框。

Parameters

rect{CGRect}

Returns

{RMSphericalTrapezium}

removeAllCachedImages

-(void)removeAllCachedImages

删除tileSource缓存机制所缓存的所有图片。

可能会有一些图片保存在用户的分享URL缓存中,而所有RMTileSource都是通过NSURLRequest加载tile images ,所以如果用户需要清理这些缓存,可以通过 以下的方式:

//code

[[NSURLCache sharedURLCache] removeAllCachedResponses];

//endcode

@interface RMMapContents : NSObject
The cartographic and data components of a map.
- (void)addTileSource:(id <RMTileSource>)newTileSource
添加叠加图层
- (void)removeTileSource:(id <RMTileSource>)tileSource
移除叠加图层 底图不能被移除。
- (void)setHidden:(BOOL)isHidden forTileSource:(id <RMTileSource>)tileSource
隐藏图层
- (void)setOpacity:(float)opacity forTileSource:(id <RMTileSource>)tileSource
设置图层的透明度
- (void)moveToProjectedPoint: (RMProjectedPoint)aPoint
用于重置地图的中心点
- (RMProjectedPoint)latLongToProjectedPoint:(CLLocationCoordinate2D)latlong
将经纬度坐标转换为投影坐标
- (RMProjectedPoint)pixelToProjectedPoint:(CGPoint)aPixel
将像素坐标转换为当前地图的地理坐标
- (
   CLLocationCoordinate2D
)projectedPointToLatLong:(RMProjectedPoint)projectedPoint
将投影坐标转换为经纬度坐标
- (void)refreshMap
刷新瓦片地图
- (RMSphericalTrapezium) latitudeLongitudeBoundingBoxForScreen
返回包含整个屏幕的最小边界框
-(void)removeAllCachedImages
删除tileSource缓存机制所缓存的所有图片。
{struct} location and size, in projected meters, paralleling CGRect
@protocol RMTileSource <NSObject> @property (
   nonatomic,
   assign
) RMTileImageSet * imagesOnScreen
Close