高德地图SDK(导航)  V7.7.0
MAOverlayRenderer Class Reference

该类是地图覆盖物Renderer的基类, 提供绘制overlay的接口但并无实际的实现(render相关方法只能在重写后的glRender方法中使用) More...

#import <MAOverlayRenderer.h>

Inheritance diagram for MAOverlayRenderer:
MACustomBuildingOverlayRenderer MAGroundOverlayRenderer MAHeatMapVectorOverlayRender MAMultiPointOverlayRenderer MAOverlayPathRenderer MAParticleOverlayRenderer MATileOverlayRenderer MAArcRenderer MACircleRenderer MAPolygonRenderer MAPolylineRenderer MAMultiColoredPolylineRenderer MAMultiTexturePolylineRenderer

Instance Methods

(instancetype) - initWithOverlay:
 初始化并返回一个Overlay Renderer More...
 
(float *) - getViewMatrix
 获取当前地图view矩阵,数组长度为16,无需外界释放. 需要添加至地图后,才能获取有效矩阵数据,否则返回NULL More...
 
(float *) - getProjectionMatrix
 获取当前地图projection矩阵,数组长度为16,无需外界释放. 需要添加至地图后,才能获取有效矩阵数据,否则返回NULL More...
 
(MAMapPoint- getOffsetPoint
 获取当前地图中心点偏移,用以把地图坐标转换为gl坐标。需要添加到地图获取才有效。(since 5.1.0) More...
 
(CGFloat) - getMapZoomLevel
 获取当前地图缩放级别,需要添加到地图获取才有效。(since 5.1.0) More...
 
(CGPoint) - glPointForMapPoint:
 将MAMapPoint转换为opengles可以直接使用的坐标 More...
 
(CGPoint *) - glPointsForMapPoints:count:
 批量将MAMapPoint转换为opengles可以直接使用的坐标 More...
 
(CGFloat) - glWidthForWindowWidth:
 将屏幕尺寸转换为OpenGLES尺寸 More...
 
(void) - renderLinesWithPoints:pointCount:strokeColor:lineWidth:looped:
 使用OpenGLES 绘制线 More...
 
(void) - renderLinesWithPoints:pointCount:strokeColor:lineWidth:looped:LineJoinType:LineCapType:lineDash:
 使用OpenGLES 绘制线 More...
 
(void) - renderTexturedLinesWithPoints:pointCount:lineWidth:textureID:looped:
 使用OpenGLES 按指定纹理绘制线 More...
 
(void) - renderTexturedLinesWithPoints:pointCount:lineWidth:textureIDs:drawStyleIndexes:looped:
 使用OpenGLES 绘制多纹理线 More...
 
(void) - renderLinesWithPoints:pointCount:strokeColors:drawStyleIndexes:isGradient:lineWidth:looped:LineJoinType:LineCapType:lineDash:
 使用OpenGLES 绘制多段颜色线 More...
 
(void) - renderRegionWithPoints:pointCount:fillColor:usingTriangleFan:
 使用OpenGLES 绘制区域 More...
 
(void) - renderStrokedRegionWithPoints:pointCount:fillColor:strokeColor:strokeLineWidth:strokeLineJoinType:strokeLineDash:usingTriangleFan:
 使用OpenGLES 绘制区域(带轮廓线)
注意:strokeLineWidth为0 或 strokeColor为nil 时不绘制轮廓线。 More...
 
(void) - renderTextureStrokedRegionWithPoints:pointCount:fillColor:strokeTineWidth:strokeTextureID:usingTriangleFan:
 使用OpenGLES 绘制区域(带纹理轮廓线)
注意:strokeLineWidth为0 或 strokeTexture为0 时不绘制轮廓线。 More...
 
(void) - renderIconWithTextureID:points:
 使用OpenGLES 绘制图片 More...
 
(void) - renderIconWithTextureID:points:modulateColor:
 使用OpenGLES 绘制图片 More...
 
(void) - glRender
 绘制函数(子类需要重载来实现) More...
 
(GLuint) - loadStrokeTextureImage:
 加载纹理图片,纹理ID存储在成员strokeTextureID中。纹理图片为nil时,清空原有纹理 More...
 
(GLuint) - loadTexture:
 加载纹理图片(since 5.1.0) More...
 
(void) - deleteTexture:
 删除纹理(since 5.1.0) More...
 
(void) - setNeedsUpdate
 当关联overlay对象有更新时,调用此接口刷新. since 5.0.0 More...
 

Protected Attributes

GLuint _strokeTextureID
 
CGSize _strokeTextureSize
 
BOOL _needsUpdate
 
BOOL _needsLoadStrokeTexture
 

Properties

id< MAOverlayRenderDelegate > rendererDelegate
 由地图添加时,不要手动设置。如果不是使用mapview进行添加,则需要手动设置。(since 5.1.0) More...
 
id< MAOverlayoverlay
 关联的overlay对象 More...
 
UIImage * strokeImage
 用于生成笔触纹理id的图片(支持非PowerOfTwo图片; 如果您需要减轻绘制产生的锯齿,您可以参考AMap.bundle中的traffic_texture_blue.png的方式,在image两边增加部分透明像素.)。(since 5.3.0) More...
 
GLuint strokeTextureID
 笔触纹理id, 修改纹理id参考, 如果strokeImage未指定、尚未加载或加载失败返回0 More...
 
CGFloat alpha
 透明度[0,1],默认为1. 使用MAOverlayRenderer类提供的渲染接口会自动应用此属性。(since 5.1.0) More...
 
CGFloat contentScale
 overlay渲染的scale。(since 5.1.0) More...
 

Detailed Description

该类是地图覆盖物Renderer的基类, 提供绘制overlay的接口但并无实际的实现(render相关方法只能在重写后的glRender方法中使用)

Method Documentation

◆ deleteTexture:

- (void) deleteTexture: (GLuint)  textureId

删除纹理(since 5.1.0)

Parameters
textureId纹理ID

◆ getMapZoomLevel

- (CGFloat) getMapZoomLevel

获取当前地图缩放级别,需要添加到地图获取才有效。(since 5.1.0)

Returns
缩放级别

◆ getOffsetPoint

- (MAMapPoint) getOffsetPoint

获取当前地图中心点偏移,用以把地图坐标转换为gl坐标。需要添加到地图获取才有效。(since 5.1.0)

Returns
偏移

◆ getProjectionMatrix

- (float *) getProjectionMatrix

获取当前地图projection矩阵,数组长度为16,无需外界释放. 需要添加至地图后,才能获取有效矩阵数据,否则返回NULL

Returns
矩阵数组

◆ getViewMatrix

- (float *) getViewMatrix

获取当前地图view矩阵,数组长度为16,无需外界释放. 需要添加至地图后,才能获取有效矩阵数据,否则返回NULL

Returns
矩阵数组

◆ glPointForMapPoint:

- (CGPoint) glPointForMapPoint: (MAMapPoint mapPoint

将MAMapPoint转换为opengles可以直接使用的坐标

Parameters
mapPointMAMapPoint坐标
Returns
直接支持的坐标

◆ glPointsForMapPoints:count:

- (CGPoint *) glPointsForMapPoints: (MAMapPoint *)  mapPoints
count: (NSUInteger)  count 

批量将MAMapPoint转换为opengles可以直接使用的坐标

Parameters
mapPointsMAMapPoint坐标数据指针
count个数
Returns
直接支持的坐标数据指针(需要调用者手动释放)

◆ glRender

- (void) glRender

绘制函数(子类需要重载来实现)

◆ glWidthForWindowWidth:

- (CGFloat) glWidthForWindowWidth: (CGFloat)  windowWidth

将屏幕尺寸转换为OpenGLES尺寸

Parameters
windowWidth屏幕尺寸
Returns
OpenGLES尺寸

◆ initWithOverlay:

- (instancetype) initWithOverlay: (id< MAOverlay >)  overlay

初始化并返回一个Overlay Renderer

Parameters
overlay关联的overlay对象
Returns
初始化成功则返回overlay view,否则返回nil

◆ loadStrokeTextureImage:

- (GLuint) loadStrokeTextureImage: (UIImage *)  textureImage

加载纹理图片,纹理ID存储在成员strokeTextureID中。纹理图片为nil时,清空原有纹理

Parameters
textureImage纹理图片(需满足:长宽相等,且宽度值为2的次幂)。若为nil,则清空原有纹理
Returns
openGL纹理ID, 若纹理加载失败返回0

◆ loadTexture:

- (GLuint) loadTexture: (UIImage *)  textureImage

加载纹理图片(since 5.1.0)

Parameters
textureImage纹理图片(需满足:长宽相等,且宽度值为2的次幂)
Returns
openGL纹理ID, 若纹理加载失败返回0

◆ renderIconWithTextureID:points:

- (void) renderIconWithTextureID: (GLuint)  textureID
points: (CGPoint *)  points 

使用OpenGLES 绘制图片

Parameters
textureIDOpenGLES纹理ID
pointsOpenGLES坐标系点指针,纹理矩形的四个顶点坐标,其第一个坐标为图片左上角,依次顺时针传入其他顶点 ,参考- (CGPoint)glPointForMapPoint:mapPoint, - (CGPoint *)glPointsForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count

◆ renderIconWithTextureID:points:modulateColor:

- (void) renderIconWithTextureID: (GLuint)  textureID
points: (CGPoint *)  points
modulateColor: (UIColor *)  modulateColor 

使用OpenGLES 绘制图片

Parameters
textureIDOpenGLES纹理ID
pointsOpenGLES坐标系点指针,纹理矩形的四个顶点坐标,其第一个坐标为图片左上角,依次顺时针传入其他顶点 ,参考- (CGPoint)glPointForMapPoint:mapPoint, - (CGPoint *)glPointsForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count
modulateColor调节颜色值, 最终颜色 = 纹理色 * modulateColor. 如只需要调节alpha的话就设置为[red=1, green=1, blue=1, alpha=0.5]

◆ renderLinesWithPoints:pointCount:strokeColor:lineWidth:looped:

- (void) renderLinesWithPoints: (CGPoint *)  points
pointCount: (NSUInteger)  pointCount
strokeColor: (UIColor *)  strokeColor
lineWidth: (CGFloat)  lineWidth
looped: (BOOL)  looped 

使用OpenGLES 绘制线

Parameters
pointsOpenGLES坐标系点指针, 参考- (CGPoint)glPointForMapPoint:mapPoint, - (CGPoint *)glPointsForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count
pointCount点个数
strokeColor线颜色
lineWidthOpenGLES支持线宽尺寸, 参考 - (CGFloat)glWidthForWindowWidth:windowWidth
looped是否闭合, 如polyline会设置NO, polygon会设置YES

◆ renderLinesWithPoints:pointCount:strokeColor:lineWidth:looped:LineJoinType:LineCapType:lineDash:

- (void) renderLinesWithPoints: (CGPoint *)  points
pointCount: (NSUInteger)  pointCount
strokeColor: (UIColor *)  strokeColor
lineWidth: (CGFloat)  lineWidth
looped: (BOOL)  looped
LineJoinType: (MALineJoinType lineJoinType
LineCapType: (MALineCapType lineCapType
lineDash: (MALineDashType lineDash 

使用OpenGLES 绘制线

Parameters
pointsOpenGLES坐标系点指针, 参考- (CGPoint)glPointForMapPoint:mapPoint, - (CGPoint *)glPointsForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count
pointCount点个数
strokeColor线颜色
lineWidthOpenGLES支持线宽尺寸, 参考 - (CGFloat)glWidthForWindowWidth:windowWidth
looped是否闭合, 如polyline会设置NO, polygon会设置YES
lineJoinType线连接点样式
lineCapType线端点样式
lineDash虚线类型

◆ renderLinesWithPoints:pointCount:strokeColors:drawStyleIndexes:isGradient:lineWidth:looped:LineJoinType:LineCapType:lineDash:

- (void) renderLinesWithPoints: (CGPoint *)  points
pointCount: (NSUInteger)  pointCount
strokeColors: (NSArray *)  strokeColors
drawStyleIndexes: (NSArray *)  drawStyleIndexes
isGradient: (BOOL)  isGradient
lineWidth: (CGFloat)  lineWidth
looped: (BOOL)  looped
LineJoinType: (MALineJoinType lineJoinType
LineCapType: (MALineCapType lineCapType
lineDash: (MALineDashType lineDash 

使用OpenGLES 绘制多段颜色线

Parameters
pointsOpenGLES坐标系点指针, 参考- (CGPoint)glPointForMapPoint:mapPoint, - (CGPoint *)glPointsForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count
pointCount点个数
strokeColors各段指定的颜色
drawStyleIndexes颜色索引数组,成员为NSNumber,且为非负数,负数按0处理
isGradient颜色是否渐变
lineWidth线OpenGLES支持线宽尺寸, 参考 - (CGFloat)glWidthForWindowWidth:windowWidth
looped是否闭合, 如polyline会设置NO, polygon会设置YES
lineJoinType线连接点样式
lineCapType线端点样式
lineDash虚线类型

◆ renderRegionWithPoints:pointCount:fillColor:usingTriangleFan:

- (void) renderRegionWithPoints: (CGPoint *)  points
pointCount: (NSUInteger)  pointCount
fillColor: (UIColor *)  fillColor
usingTriangleFan: (BOOL)  usingTriangleFan 

使用OpenGLES 绘制区域

Parameters
pointsOpenGLES坐标系点指针, 参考- (CGPoint)glPointForMapPoint:mapPoint, - (CGPoint *)glPointsForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count
pointCount点个数
fillColor填充颜色
usingTriangleFan若必为凸多边形输入YES,可能为凹多边形输入NO

◆ renderStrokedRegionWithPoints:pointCount:fillColor:strokeColor:strokeLineWidth:strokeLineJoinType:strokeLineDash:usingTriangleFan:

- (void) renderStrokedRegionWithPoints: (CGPoint *)  points
pointCount: (NSUInteger)  pointCount
fillColor: (UIColor *)  fillColor
strokeColor: (UIColor *)  strokeColor
strokeLineWidth: (CGFloat)  strokeLineWidth
strokeLineJoinType: (MALineJoinType strokeLineJoinType
strokeLineDash: (MALineDashType strokeLineDash
usingTriangleFan: (BOOL)  usingTriangleFan 

使用OpenGLES 绘制区域(带轮廓线)
注意:strokeLineWidth为0 或 strokeColor为nil 时不绘制轮廓线。

Parameters
pointsOpenGLES坐标系点指针, 参考- (CGPoint)glPointForMapPoint:mapPoint, - (CGPoint *)glPointsForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count
pointCount点个数
fillColor填充颜色
strokeColor轮廓线颜色
strokeLineWidth轮廓线宽。OpenGLES支持线宽尺寸, 参考 - (CGFloat)glWidthForWindowWidth:windowWidth
strokeLineJoinType轮廓线连接点样式
strokeLineDash轮廓虚线类型
usingTriangleFan若必为凸多边形输入YES,可能为凹多边形输入NO

◆ renderTexturedLinesWithPoints:pointCount:lineWidth:textureID:looped:

- (void) renderTexturedLinesWithPoints: (CGPoint *)  points
pointCount: (NSUInteger)  pointCount
lineWidth: (CGFloat)  lineWidth
textureID: (GLuint)  textureID
looped: (BOOL)  looped 

使用OpenGLES 按指定纹理绘制线

Parameters
pointsOpenGLES坐标系点指针, 参考- (CGPoint)glPointForMapPoint:mapPoint, - (CGPoint *)glPointsForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count
pointCount点个数
lineWidth线OpenGLES支持线宽尺寸, 参考 - (CGFloat)glWidthForWindowWidth:windowWidth
textureID指定的纹理
looped是否闭合, 如polyline会设置NO, polygon会设置YES

◆ renderTexturedLinesWithPoints:pointCount:lineWidth:textureIDs:drawStyleIndexes:looped:

- (void) renderTexturedLinesWithPoints: (CGPoint *)  points
pointCount: (NSUInteger)  pointCount
lineWidth: (CGFloat)  lineWidth
textureIDs: (NSArray *)  textureIDs
drawStyleIndexes: (NSArray *)  drawStyleIndexes
looped: (BOOL)  looped 

使用OpenGLES 绘制多纹理线

Parameters
pointsOpenGLES坐标系点指针, 参考- (CGPoint)glPointForMapPoint:mapPoint, - (CGPoint *)glPointsForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count
pointCount点个数
lineWidth线OpenGLES支持线宽尺寸, 参考 - (CGFloat)glWidthForWindowWidth:windowWidth
textureIDs各段指定的纹理 使用- (BOOL)loadStrokeTextureImages:(NSArray *)textureImages;加载,在strokeTextureIDs属性中获取
drawStyleIndexes纹理索引数组,成员为NSNumber,且为非负数,负数按0处理
looped是否闭合, 如polyline会设置NO, polygon会设置YES

◆ renderTextureStrokedRegionWithPoints:pointCount:fillColor:strokeTineWidth:strokeTextureID:usingTriangleFan:

- (void) renderTextureStrokedRegionWithPoints: (CGPoint *)  points
pointCount: (NSUInteger)  pointCount
fillColor: (UIColor *)  fillColor
strokeTineWidth: (CGFloat)  strokeLineWidth
strokeTextureID: (GLuint)  strokeTexture
usingTriangleFan: (BOOL)  usingTriangleFan 

使用OpenGLES 绘制区域(带纹理轮廓线)
注意:strokeLineWidth为0 或 strokeTexture为0 时不绘制轮廓线。

Parameters
pointsOpenGLES坐标系点指针, 参考- (CGPoint)glPointForMapPoint:mapPoint, - (CGPoint *)glPointsForMapPoints:(MAMapPoint *)mapPoints count:(NSUInteger)count
pointCount点个数
fillColor填充颜色
strokeLineWidth轮廓线宽。OpenGLES支持线宽尺寸, 参考 - (CGFloat)glWidthForWindowWidth:windowWidth
strokeTexture轮廓线纹理。使用- (void)loadStrokeTextureImage:textureImage;加载
usingTriangleFan若必为凸多边形输入YES,可能为凹多边形输入NO

◆ setNeedsUpdate

- (void) setNeedsUpdate

当关联overlay对象有更新时,调用此接口刷新. since 5.0.0

Member Data Documentation

◆ _needsLoadStrokeTexture

- (BOOL) _needsLoadStrokeTexture
protected

◆ _needsUpdate

- (BOOL) _needsUpdate
protected

◆ _strokeTextureID

- (GLuint) _strokeTextureID
protected

◆ _strokeTextureSize

- (CGSize) _strokeTextureSize
protected

Property Documentation

◆ alpha

- (CGFloat) alpha
readwritenonatomicassign

透明度[0,1],默认为1. 使用MAOverlayRenderer类提供的渲染接口会自动应用此属性。(since 5.1.0)

◆ contentScale

- (CGFloat) contentScale
readnonatomicassign

overlay渲染的scale。(since 5.1.0)

◆ overlay

- (id<MAOverlay>) overlay
readnonatomicretain

关联的overlay对象

◆ rendererDelegate

- (id<MAOverlayRenderDelegate>) rendererDelegate
readwritenonatomicweak

由地图添加时,不要手动设置。如果不是使用mapview进行添加,则需要手动设置。(since 5.1.0)

◆ strokeImage

- (UIImage*) strokeImage
readwritenonatomicstrong

用于生成笔触纹理id的图片(支持非PowerOfTwo图片; 如果您需要减轻绘制产生的锯齿,您可以参考AMap.bundle中的traffic_texture_blue.png的方式,在image两边增加部分透明像素.)。(since 5.3.0)

◆ strokeTextureID

- (GLuint) strokeTextureID
readnonatomicassign

笔触纹理id, 修改纹理id参考, 如果strokeImage未指定、尚未加载或加载失败返回0


The documentation for this class was generated from the following file:
© 2017 高德信息技术有限公司 版权所有,保留所有权利。