iOS swift-高德地图,覆盖物测试

var yhyoverlays: Array!

var polygon:MAPolygon!


//围栏模块

func initPolygon() {

yhyoverlays = Array()

var coords = [CLLocationCoordinate2DMake(30.338412,120.121065),

CLLocationCoordinate2DMake(30.337555,120.110703),

CLLocationCoordinate2DMake(30.332353,120.112292),

CLLocationCoordinate2DMake(30.331365,120.122846)]

//        CLLocationCoordinate2DMake(30.336551,120.121843),

var coords1 = [CLLocationCoordinate2DMake(30.338231,120.108271),

CLLocationCoordinate2DMake(30.338082,120.115051),

CLLocationCoordinate2DMake(30.333995,120.12313),

CLLocationCoordinate2DMake(30.334786,120.109816)]

var coordss = [coords,coords1]

//        let circle: MACircle = MACircle(center: CLLocationCoordinate2D(latitude: 30.335366, longitude: 120.118474), radius: 200)

//        overlays.append(circle)

let circle: MACircle = MACircle(center: CLLocationCoordinate2D(latitude: 30.336064, longitude: 120.118363), radius: 30)

yhyoverlays.append(circle)

polygon = MAPolygon.init(coordinates: &coords, count: UInt(coords1.count))

//        gdMapView.add(polygon)

///绘制overlay的层级

//MAOverlayLevelAboveRoads = 0, ///< 在地图底图标注和兴趣点图标之下绘制overlay

//MAOverlayLevelAboveLabels ///< 在地图底图标注和兴趣点图标之上绘制overlay

gdMapView.add(polygon, level: MAOverlayLevel.aboveLabels)

}

你可能感兴趣的:(iOS swift-高德地图,覆盖物测试)