iOS高德地图SDK(3D) V11.2.0001

Classes | Typedefs | Enumerations | Functions | Variables
MAGeometry.h File Reference
`#import "MAConfig.h"`
`#import <CoreGraphics/CoreGraphics.h>`
`#import <CoreLocation/CoreLocation.h>`
`#import <UIKit/UIKit.h>`

Go to the source code of this file.

## Classes
struct | MACoordinateBounds
struct | MACoordinateSpan
struct | MACoordinateRegion
struct | MAMapPoint
struct | MAMapSize
struct | MAMapRect
category | NSValue(NSValueMAGeometryExtensions)

## Typedefs
typedef struct MACoordinateBounds | MACoordinateBounds
typedef struct MACoordinateSpan | MACoordinateSpan
typedef struct MACoordinateRegion | MACoordinateRegion
typedef struct MAMapPoint | MAMapPoint
typedef struct MAMapSize | MAMapSize
typedef struct MAMapRect | MAMapRect
typedef double | MAZoomScale
typedef void(^ | AMapTileProjectionBlock) (int offsetX, int offsetY, int minX, int maxX, int minY, int maxY)
| 获取墨卡托投影切块回调block，如果是无效的映射，则返回(-1, -1, 0, 0, 0, 0) Get the Mercator projection tile callback block, if it is an invalid mapping, return (-1, -1, 0, 0, 0, 0); More...

## Enumerations
enum | MAMapRectCorner : NSUInteger { MAMapRectCornerTopLeft = 1 << 0 , MAMapRectCornerTopRight = 1 << 1 , MAMapRectCornerBottomLeft = 1 << 2 , MAMapRectCornerBottomRight = 1 << 3 , MAMapRectCornerAllCorners = ~0UL }
enum | MACoordinateType : NSUInteger { MACoordinateTypeBaidu = 0 , MACoordinateTypeMapBar , MACoordinateTypeMapABC , MACoordinateTypeSoSoMap , MACoordinateTypeAliYun , MACoordinateTypeGoogle , MACoordinateTypeGPS }

## Functions
MACoordinateRegion | MACoordinateRegionMakeWithDistance (CLLocationCoordinate2D centerCoordinate, CLLocationDistance latitudinalMeters, CLLocationDistance longitudinalMeters)
| 生成一个新的MACoordinateRegion Generate a new MACoordinateRegion More...
MAMapPoint | MAMapPointForCoordinate (CLLocationCoordinate2D coordinate)
| 经纬度坐标转平面投影坐标 Convert latitude and longitude coordinates to planar projection coordinates More...
CLLocationCoordinate2D | MACoordinateForMapPoint (MAMapPoint mapPoint)
| 平面投影坐标转经纬度坐标 Convert planar projection coordinates to latitude and longitude coordinates More...
MACoordinateRegion | MACoordinateRegionForMapRect (MAMapRect rect)
| 平面投影矩形转region Planar projection rectangle to region More...
MAMapRect | MAMapRectForCoordinateRegion (MACoordinateRegion region)
| region转平面投影矩形 Region to planar projection rectangle More...
CLLocationDistance | MAMetersPerMapPointAtLatitude (CLLocationDegrees latitude)
| 单位投影的距离 Unit projection distance More...
double | MAMapPointsPerMeterAtLatitude (CLLocationDegrees latitude)
| 1米对应的投影 Projection corresponding to 1 meter More...
CLLocationDistance | MAMetersBetweenMapPoints (MAMapPoint a, MAMapPoint b)
| 投影两点之间的距离 Distance between two projection points More...
double | MAAreaBetweenCoordinates (CLLocationCoordinate2D northEast, CLLocationCoordinate2D southWest)
| 经纬度间的面积(单位 平方米) Area between latitude and longitude (unit: square meters) More...
MAMapRect | MAMapRectInset (MAMapRect rect, double dx, double dy)
| 获取Inset后的MAMapRect Get the MAMapRect after Inset More...
MAMapRect | MAMapRectUnion (MAMapRect rect1, MAMapRect rect2)
| 合并两个MAMapRect Merge two MAMapRects More...
BOOL | MAMapSizeContainsSize (MAMapSize size1, MAMapSize size2)
| 判断size1是否包含size2 Determine if size1 contains size2 More...
BOOL | MAMapRectContainsPoint (MAMapRect rect, MAMapPoint point)
| 判断点是否在矩形内 Determine if the point is inside the rectangle More...
BOOL | MAMapRectIntersectsRect (MAMapRect rect1, MAMapRect rect2)
| 判断两矩形是否相交 Determine if two rectangles intersect More...
BOOL | MAMapRectContainsRect (MAMapRect rect1, MAMapRect rect2)
| 判断矩形rect1是否包含矩形rect2 Determine if rectangle rect1 contains rectangle rect2 More...
BOOL | MACircleContainsPoint (MAMapPoint point, MAMapPoint center, double radius)
| 判断点是否在圆内 Determine if a point is inside a circle More...
BOOL | MACircleContainsCoordinate (CLLocationCoordinate2D point, CLLocationCoordinate2D center, double radius)
| 判断经纬度点是否在圆内 Determine if a latitude and longitude point is within a circle More...
MAMapPoint | MAGetNearestMapPointFromPolyline (MAMapPoint point, MAMapPoint *polyline, NSUInteger count)
| 获取某坐标点距线上最近的坐标点 Get the nearest point on a line from a coordinate point More...
BOOL | MAPolygonContainsPoint (MAMapPoint point, MAMapPoint *polygon, NSUInteger count)
| 判断点是否在多边形内 Determine if a point is inside a polygon More...
BOOL | MAPolygonContainsCoordinate (CLLocationCoordinate2D point, CLLocationCoordinate2D *polygon, NSUInteger count)
| 判断经纬度点是否在多边形内 Determine if a latitude and longitude point is inside a polygon More...
MAMapPoint | MAGetNearestMapPointFromLine (MAMapPoint lineStart, MAMapPoint lineEnd, MAMapPoint point)
| 取在lineStart和lineEnd组成的线段上距离point距离最近的点 Take the point on the line segment formed by lineStart and lineEnd that is closest to point More...
void | MAGetTileProjectionFromBounds (MACoordinateBounds bounds, int levelOfDetails, AMapTileProjectionBlock tileProjection)
| 根据所给经纬度区域获取墨卡托投影切块信息 Obtain Mercator projection tile information based on the given latitude and longitude area More...
double | MAAreaForPolygon (CLLocationCoordinate2D *coordinates, int count)
| 计算多边形面积，点与点之间按顺序尾部相连, 第一个点与最后一个点相连 Calculate the area of a polygon, where points are connected sequentially from tail to head, and the first point is connected to the last point More...
CLLocationCoordinate2D | MACoordinateConvert (CLLocationCoordinate2D coordinate, MACoordinateType type) __attribute((deprecated("Deprecated
| 转换目标经纬度为高德坐标系 Convert target coordinates to AutoNavi coordinate system More...
CLLocationDirection | MAGetDirectionFromCoords (CLLocationCoordinate2D fromCoord, CLLocationCoordinate2D toCoord)
| 获取矢量坐标方向 Get vector coordinate direction More...
CLLocationDirection | MAGetDirectionFromPoints (MAMapPoint fromPoint, MAMapPoint toPoint)
| 获取矢量坐标方向 Get vector coordinate direction More...
double | MAGetDistanceFromPointToLine (MAMapPoint point, MAMapPoint lineBegin, MAMapPoint lineEnd)
| 获取点到线的垂直距离 Get perpendicular distance from point to line More...
BOOL | MAPolylineHitTest (MAMapPoint *linePoints, NSUInteger count, MAMapPoint tappedPoint, CGFloat lineWidth)
| 判断线是否被点击选中 Determine if the line is clicked and selected More...

## Variables
const MAMapSize | MAMapSizeWorld
const MAMapRect | MAMapRectWorld
const MAMapRect | MAMapRectNull
| (MAMapRect){{INFINITY, INFINITY}, {0, 0}}; More...
const MAMapRect | MAMapRectZero
| (MAMapRect){{0, 0}, {0, 0}} More...
CLLocationCoordinate2D use the coordinate conversion interface in | AMapFoundation

## Typedef Documentation

## ◆ AMapTileProjectionBlock

typedef void(^ AMapTileProjectionBlock) (int offsetX, int offsetY, int minX, int maxX, int minY, int maxY)

获取墨卡托投影切块回调block，如果是无效的映射，则返回(-1, -1, 0, 0, 0, 0) Get the Mercator projection tile callback block, if it is an invalid mapping, return (-1, -1, 0, 0, 0, 0);

Parameters

  offsetX | 左上点距离所属tile的位移X, 单位像素 The displacement X of the top-left point from the tile it belongs to, in pixels
  offsetY | 左上点距离所属tile的位移Y, 单位像素 The displacement Y of the top-left point from the tile it belongs to, in pixels
  minX | 覆盖tile的最小x Minimum x of the covered tile
  maxX | 覆盖tile的最大x Maximum x of the covered tile
  minY | 覆盖tile的最小y Minimum y of the covered tile
  maxY | 覆盖tile的最大y Maximum y of the covered tile

## ◆ MACoordinateBounds

typedef struct MACoordinateBounds MACoordinateBounds

东北、西南两个点定义的四边形经纬度范围 Latitude and longitude range of the quadrilateral defined by the northeast and southwest points

## ◆ MACoordinateRegion

typedef struct MACoordinateRegion MACoordinateRegion

中心点、跨度范围定义的四边形经纬度范围 Quadrilateral latitude and longitude range defined by center point and span

## ◆ MACoordinateSpan

typedef struct MACoordinateSpan MACoordinateSpan

经度、纬度定义的经纬度跨度范围 Latitude and longitude span range defined by longitude and latitude

## ◆ MAMapPoint

typedef struct MAMapPoint MAMapPoint

平面投影坐标结构定义 Plane projection coordinate structure definition

## ◆ MAMapRect

typedef struct MAMapRect MAMapRect

平面投影矩形结构定义 Planar projection rectangle structure definition

## ◆ MAMapSize

typedef struct MAMapSize MAMapSize

平面投影大小结构定义 Plane projection size structure definition

## ◆ MAZoomScale

typedef double MAZoomScale

比例关系:MAZoomScale = Screen Point / MAMapPoint, 当MAZoomScale = 1时, 1 screen point = 1 MAMapPoint, 当MAZoomScale = 0.5时, 1 screen point = 2 MAMapPoints Proportional relationship: MAZoomScale = Screen Point / MAMapPoint, when MAZoomScale = 1, 1 screen point = 1 MAMapPoint, when MAZoomScale = 0.5, 1 screen point = 2 MAMapPoints

## Enumeration Type Documentation

## ◆ MACoordinateType

enum MACoordinateType : NSUInteger

坐标系类型枚举 Coordinate system type enumeration

Enumerator
MACoordinateTypeBaidu | Baidu.
MACoordinateTypeMapBar | MapBar.
MACoordinateTypeMapABC | MapABC.
MACoordinateTypeSoSoMap | SoSoMap.
MACoordinateTypeAliYun | AliYun.
MACoordinateTypeGoogle | Google.
MACoordinateTypeGPS | GPS.

## ◆ MAMapRectCorner

enum MAMapRectCorner : NSUInteger

Enumerator
MAMapRectCornerTopLeft |
MAMapRectCornerTopRight |
MAMapRectCornerBottomLeft |
MAMapRectCornerBottomRight |
MAMapRectCornerAllCorners |

## Function Documentation

## ◆ MAAreaBetweenCoordinates()

double MAAreaBetweenCoordinates | ( | CLLocationCoordinate2D | northEast,
|  | CLLocationCoordinate2D | southWest
| ) |  |

经纬度间的面积(单位 平方米) Area between latitude and longitude (unit: square meters)

Parameters

  northEast | 东北经纬度 Northeast latitude and longitude
  southWest | 西南经纬度 Southwest latitude and longitude

Returns
  面积 Area

## ◆ MAAreaForPolygon()

double MAAreaForPolygon | ( | CLLocationCoordinate2D * | coordinates,
|  | int | count
| ) |  |

计算多边形面积，点与点之间按顺序尾部相连, 第一个点与最后一个点相连 Calculate the area of a polygon, where points are connected sequentially from tail to head, and the first point is connected to the last point

Parameters

  coordinates | 指定的经纬度坐标点数组，C数组，调用者负责内存管理 The specified array of latitude and longitude coordinate points, a C array, memory management is the responsibility of the caller
  count | 坐标点的个数 The number of coordinate points

Returns
  多边形的面积 The area of the polygon

## ◆ MACircleContainsCoordinate()

BOOL MACircleContainsCoordinate | ( | CLLocationCoordinate2D | point,
|  | CLLocationCoordinate2D | center,
|  | double | radius
| ) |  |

判断经纬度点是否在圆内 Determine if a latitude and longitude point is within a circle

Parameters

  point | 经纬度 Latitude and longitude
  center | 圆的中心经纬度 Center latitude and longitude of the circle
  radius | 圆的半径，单位米 Radius of the circle, in meters

Returns
  判断结果 Judgment result

## ◆ MACircleContainsPoint()

BOOL MACircleContainsPoint | ( | MAMapPoint | point,
|  | MAMapPoint | center,
|  | double | radius
| ) |  |

判断点是否在圆内 Determine if a point is inside a circle

Parameters

  point | 点 Point
  center | 圆的中心点 Center point of the circle
  radius | 圆的半径，单位米 Radius of the circle, in meters

Returns
  判断结果 Judgment result

## ◆ MACoordinateConvert()

CLLocationCoordinate2D MACoordinateConvert | ( | CLLocationCoordinate2D | coordinate,
|  | MACoordinateType | type
| ) |  |

转换目标经纬度为高德坐标系 Convert target coordinates to AutoNavi coordinate system

Parameters

  coordinate | 待转换的经纬度 Coordinates to be converted
  type | 坐标系类型 Coordinate system type

Returns
  高德坐标系经纬度 AutoNavi coordinate system coordinates

## ◆ MACoordinateForMapPoint()

CLLocationCoordinate2D MACoordinateForMapPoint | ( | MAMapPoint | mapPoint | ) |

平面投影坐标转经纬度坐标 Convert planar projection coordinates to latitude and longitude coordinates

Parameters

  mapPoint | 要转化的平面投影坐标 Planar projection coordinates to be converted

Returns
  经纬度坐标 Latitude and longitude coordinates

## ◆ MACoordinateRegionForMapRect()

MACoordinateRegion MACoordinateRegionForMapRect | ( | MAMapRect | rect | ) |

平面投影矩形转region Planar projection rectangle to region

Parameters

  rect | 要转化的平面投影矩形 Planar projection rectangle to be converted

Returns
  region

## ◆ MACoordinateRegionMakeWithDistance()

MACoordinateRegion MACoordinateRegionMakeWithDistance | ( | CLLocationCoordinate2D | centerCoordinate,
|  | CLLocationDistance | latitudinalMeters,
|  | CLLocationDistance | longitudinalMeters
| ) |  |

生成一个新的MACoordinateRegion Generate a new MACoordinateRegion

Parameters

  centerCoordinate | 中心点坐标 center coordinate
  latitudinalMeters | 垂直跨度(单位 米) vertical span (in meters)
  longitudinalMeters | 水平跨度(单位 米) horizontal span (in meters)

Returns
  新的MACoordinateRegion new MACoordinateRegion

## ◆ MAGetDirectionFromCoords()

CLLocationDirection MAGetDirectionFromCoords | ( | CLLocationCoordinate2D | fromCoord,
|  | CLLocationCoordinate2D | toCoord
| ) |  |

获取矢量坐标方向 Get vector coordinate direction

Parameters

  fromCoord | 矢量坐标起点 Vector coordinate start point
  toCoord | 矢量坐标终点 Vector coordinate end point

Returns
  方向，详情参考系统 CLLocationDirection Direction, refer to system CLLocationDirection for details

## ◆ MAGetDirectionFromPoints()

CLLocationDirection MAGetDirectionFromPoints | ( | MAMapPoint | fromPoint,
|  | MAMapPoint | toPoint
| ) |  |

获取矢量坐标方向 Get vector coordinate direction

Parameters

  fromPoint | 矢量坐标起点 Vector coordinate start point
  toPoint | 矢量坐标终点 Vector coordinate end point

Returns
  方向，详情参考系统 CLLocationDirection Direction, refer to system CLLocationDirection for details

## ◆ MAGetDistanceFromPointToLine()

double MAGetDistanceFromPointToLine | ( | MAMapPoint | point,
|  | MAMapPoint | lineBegin,
|  | MAMapPoint | lineEnd
| ) |  |

获取点到线的垂直距离 Get perpendicular distance from point to line

Parameters

  point | 起点 Start point
  lineBegin | 线的起点 Start point of the line
  lineEnd | 线的终点 End point of the line

Returns
  距离，单位米 Distance in meters

## ◆ MAGetNearestMapPointFromLine()

MAMapPoint MAGetNearestMapPointFromLine | ( | MAMapPoint | lineStart,
|  | MAMapPoint | lineEnd,
|  | MAMapPoint | point
| ) |  |

取在lineStart和lineEnd组成的线段上距离point距离最近的点 Take the point on the line segment formed by lineStart and lineEnd that is closest to point

Parameters

  lineStart | 线段起点 Line segment starting point
  lineEnd | 线段终点 Line segment ending point
  point | 测试点 Test point

Returns
  距离point最近的点坐标 Coordinates of the point closest to point

## ◆ MAGetNearestMapPointFromPolyline()

MAMapPoint MAGetNearestMapPointFromPolyline | ( | MAMapPoint | point,
|  | MAMapPoint * | polyline,
|  | NSUInteger | count
| ) |  |

获取某坐标点距线上最近的坐标点 Get the nearest point on a line from a coordinate point

Parameters

  point | 点 Point
  polyline | 线 Line
  count | 线里点的数量 Number of points in the line

Returns
  某点到线上最近的点 Nearest point on the line from a point

## ◆ MAGetTileProjectionFromBounds()

void MAGetTileProjectionFromBounds | ( | MACoordinateBounds | bounds,
|  | int | levelOfDetails,
|  | AMapTileProjectionBlock | tileProjection
| ) |  |

根据所给经纬度区域获取墨卡托投影切块信息 Obtain Mercator projection tile information based on the given latitude and longitude area

Parameters

  bounds | 经纬度区域 Latitude and longitude area
  levelOfDetails | 对应缩放级别, 取值0-20 Corresponding zoom level, value range 0-20
  tileProjection | 返回的切块信息block Returned tile information block

## ◆ MAMapPointForCoordinate()

MAMapPoint MAMapPointForCoordinate | ( | CLLocationCoordinate2D | coordinate | ) |

经纬度坐标转平面投影坐标 Convert latitude and longitude coordinates to planar projection coordinates

Parameters

  coordinate | 要转化的经纬度坐标 Latitude and longitude coordinates to be converted

Returns
  平面投影坐标 Planar projection coordinates

## ◆ MAMapPointsPerMeterAtLatitude()

double MAMapPointsPerMeterAtLatitude | ( | CLLocationDegrees | latitude | ) |

1米对应的投影 Projection corresponding to 1 meter

Parameters

  latitude | 经纬度 Latitude and longitude

Returns
  1米对应的投影 Projection corresponding to 1 meter

## ◆ MAMapRectContainsPoint()

BOOL MAMapRectContainsPoint | ( | MAMapRect | rect,
|  | MAMapPoint | point
| ) |  |

判断点是否在矩形内 Determine if the point is inside the rectangle

Parameters

  rect | 矩形rect Rectangle rect
  point | 点 Point

Returns
  判断结果 Judgment result

## ◆ MAMapRectContainsRect()

BOOL MAMapRectContainsRect | ( | MAMapRect | rect1,
|  | MAMapRect | rect2
| ) |  |

判断矩形rect1是否包含矩形rect2 Determine if rectangle rect1 contains rectangle rect2

Parameters

  rect1 | rect1
  rect2 | rect2

Returns
  判断结果 Judgment result

## ◆ MAMapRectForCoordinateRegion()

MAMapRect MAMapRectForCoordinateRegion | ( | MACoordinateRegion | region | ) |

region转平面投影矩形 Region to planar projection rectangle

Parameters

  region | region 要转化的region Region to be converted

Returns
  平面投影矩形 Planar projection rectangle

## ◆ MAMapRectInset()

MAMapRect MAMapRectInset | ( | MAMapRect | rect,
|  | double | dx,
|  | double | dy
| ) |  |

获取Inset后的MAMapRect Get the MAMapRect after Inset

Parameters

  rect | rect
  dx | x点 Point x
  dy | y点 Point y

Returns
  MAMapRect

## ◆ MAMapRectIntersectsRect()

BOOL MAMapRectIntersectsRect | ( | MAMapRect | rect1,
|  | MAMapRect | rect2
| ) |  |

判断两矩形是否相交 Determine if two rectangles intersect

Parameters

  rect1 | rect1
  rect2 | rect2

Returns
  判断结果 Judgment result

## ◆ MAMapRectUnion()

MAMapRect MAMapRectUnion | ( | MAMapRect | rect1,
|  | MAMapRect | rect2
| ) |  |

合并两个MAMapRect Merge two MAMapRects

Parameters

  rect1 | rect1
  rect2 | rect2

Returns
  合并后的rect Merged rect

## ◆ MAMapSizeContainsSize()

BOOL MAMapSizeContainsSize | ( | MAMapSize | size1,
|  | MAMapSize | size2
| ) |  |

判断size1是否包含size2 Determine if size1 contains size2

Parameters

  size1 | size1
  size2 | size2

Returns
  判断结果 Judgment result

## ◆ MAMetersBetweenMapPoints()

CLLocationDistance MAMetersBetweenMapPoints | ( | MAMapPoint | a,
|  | MAMapPoint | b
| ) |  |

投影两点之间的距离 Distance between two projection points

Parameters

  a | a点 Point a
  b | b点 Point b

Returns
  距离 Distance

## ◆ MAMetersPerMapPointAtLatitude()

CLLocationDistance MAMetersPerMapPointAtLatitude | ( | CLLocationDegrees | latitude | ) |

单位投影的距离 Unit projection distance

Parameters

  latitude | 经纬度 Latitude and longitude

Returns
  距离 Distance

## ◆ MAPolygonContainsCoordinate()

BOOL MAPolygonContainsCoordinate | ( | CLLocationCoordinate2D | point,
|  | CLLocationCoordinate2D * | polygon,
|  | NSUInteger | count
| ) |  |

判断经纬度点是否在多边形内 Determine if a latitude and longitude point is inside a polygon

Parameters

  point | 经纬度点 Latitude and longitude point
  polygon | 多边形 Polygon
  count | 多边形点的数量 Number of polygon points

Returns
  判断结果 Judgment result

## ◆ MAPolygonContainsPoint()

BOOL MAPolygonContainsPoint | ( | MAMapPoint | point,
|  | MAMapPoint * | polygon,
|  | NSUInteger | count
| ) |  |

判断点是否在多边形内 Determine if a point is inside a polygon

Parameters

  point | 点 Point
  polygon | 多边形 Polygon
  count | 多边形点的数量 Number of polygon points

Returns
  判断结果 Judgment result

## ◆ MAPolylineHitTest()

BOOL MAPolylineHitTest | ( | MAMapPoint * | linePoints,
|  | NSUInteger | count,
|  | MAMapPoint | tappedPoint,
|  | CGFloat | lineWidth
| ) |  |

判断线是否被点击选中 Determine if the line is clicked and selected

Parameters

  linePoints | 构成线的点 Points that form the line
  count | 点的个数 Number of points
  tappedPoint | 点击点 Click point
  lineWidth | 线宽，单位：MAMapPoint点 Line width, unit: MAMapPoint

Returns
  是否选中 Whether selected

## Variable Documentation

## ◆ AMapFoundation

CLLocationCoordinate2D use the coordinate conversion interface in AMapFoundation

## ◆ MAMapRectNull

const MAMapRect MAMapRectNull
| extern

(MAMapRect){{INFINITY, INFINITY}, {0, 0}};

## ◆ MAMapRectWorld

const MAMapRect MAMapRectWorld
| extern

世界范围四边形 World extent quadrilateral

## ◆ MAMapRectZero

const MAMapRect MAMapRectZero
| extern

(MAMapRect){{0, 0}, {0, 0}}

## ◆ MAMapSizeWorld

const MAMapSize MAMapSizeWorld
| extern

世界范围大小 World extent size

© 2017 高德信息技术有限公司 版权所有，保留所有权利。