Constructor 링크 복사
카텍(KATEC) 좌표의 정점을 전달하고 KNMapPolygon
객체를 생성합니다. 이 때, 정점은 시계 방향 순서로 이루어져야 합니다.
KNMapPolygon(points: List<FloatPoint>, fillColor: Int, strokeColor: Int, strokeWidth: Float, strokeDashType: KNLineDashType, priority: Int)
KNMapPolygon(points: List<FloatPoint>, fillColor: Int, strokeColor: Int, strokeWidth: Float, strokeDashType: KNLineDashType, priority: Int)
코드가 숨겨졌습니다.
마커의 우선순위는 다른 오브젝트(원, 폴리곤 등)보다 항상 높습니다. 따라서, 마커와 같은 값을 가져 위치가 겹치더라도 마커를 최상위 레이어에 표시합니다.
표 1
Properties
Name | Description | Type |
---|---|---|
fillColor | 폴리곤의 면 색상 | var fillColor: Int |
strokeColor | 폴리곤의 외곽선 색상 | var strokeColor: Int |
strokeWidth | 폴리곤의 외곽선 두께 (기본값: 2, 외곽선 두께 설정 범위: 1~5) | var strokeWidth: Float |
strokeDashType | 폴리곤의 외곽선 종류. 실선, 점선, 파선, 1점 쇄선, 2점 쇄선 등을 설정할 수 있음. (기본값: KNLineDashType_Solid ) | var strokeDashType: KNLineDashType |
priority | 폴리곤을 표시할 우선순위. 숫자가 높을수록 상위로 표시됨. (기본값: 0, 우선순위 설정 범위: 0~65535) | var priority: Int |
isVisible | 폴리곤의 표시 여부 (기본값: true ) | var isVisible: Boolean |
tag | 폴리곤에 설정할 태그(tag). 태그는 Int 값을 가지며 카테고리 분류나 별도의 구분을 하고 싶을 때 사용할 수 있음. (선택 사항) | var tag: Int |
id (readOnly) | 폴리곤의 고유 아이디 값 | var id: Int |
예시 코드
KNMapPolygon
fun createPolygonWithMapView(): KNMapPolygon {
val center = WGS84ToKATEC(127.11019081347423,37.3941851228957)
val pos = (KNSDK.sharedGpsManager()?.lastValidGpsData?.pos) ?: FloatPoint(321397.72f, 532790.94f)
val polygonVertex = arrayListOf<FloatPoint>()
polygonVertex.add(FloatPoint(pos.x - 100f, pos.y - 100f))
polygonVertex.add(FloatPoint(pos.x + 100f, pos.y - 100f))
polygonVertex.add(FloatPoint(pos.x + 100f, pos.y + 100f))
polygonVertex.add(FloatPoint(pos.x - 100f, pos.y + 100f))
return KNMapPolygon(polygonVertex,
fillColor = Color.BLUE,
strokeColor = Color.YELLOW,
strokeWidth = 3f,
strokeDashType = KNLineDashType.KNLineDashType_Dotted,
priority = 1)
}
fun createPolygonWithMapView(): KNMapPolygon {
val center = WGS84ToKATEC(127.11019081347423,37.3941851228957)
val pos = (KNSDK.sharedGpsManager()?.lastValidGpsData?.pos) ?: FloatPoint(321397.72f, 532790.94f)
val polygonVertex = arrayListOf<FloatPoint>()
polygonVertex.add(FloatPoint(pos.x - 100f, pos.y - 100f))
polygonVertex.add(FloatPoint(pos.x + 100f, pos.y - 100f))
polygonVertex.add(FloatPoint(pos.x + 100f, pos.y + 100f))
polygonVertex.add(FloatPoint(pos.x - 100f, pos.y + 100f))
return KNMapPolygon(polygonVertex,
fillColor = Color.BLUE,
strokeColor = Color.YELLOW,
strokeWidth = 3f,
strokeDashType = KNLineDashType.KNLineDashType_Dotted,
priority = 1)
}
코드가 숨겨졌습니다.
함수 링크 복사
폴리곤 내부에 구멍을 추가합니다. 이 때, 카텍(KATEC) 좌표의 정점을 연결하여 구성되며 정점들의 입력 순서는 시계 방향으로 설정됩니다. 정점들은 리스트 형태로 제공됩니다.
fun addHole( | holePosition: | MutableList<MutableList<FloatPoint>> | ) |
예시 코드
addHole
fun createPolygonHoleWithMapView(): KNMapPolygon {
val center = WGS84ToKATEC(127.11019081347423,37.3941851228957)
val pos = (KNSDK.sharedGpsManager()?.lastValidGpsData?.pos) ?: FloatPoint(321397.72f, 532790.94f)
val polygonVertex = arrayListOf<FloatPoint>()
polygonVertex.add(FloatPoint(pos.x - 100f, pos.y - 100f))
polygonVertex.add(FloatPoint(pos.x + 100f, pos.y - 100f))
polygonVertex.add(FloatPoint(pos.x + 100f, pos.y + 100f))
polygonVertex.add(FloatPoint(pos.x - 100f, pos.y + 100f))
return KNMapPolygon(polygonVertex,
fillColor = Color.BLUE,
strokeColor = Color.YELLOW,
strokeWidth = 3f,
strokeDashType = KNLineDashType.KNLineDashType_Dotted,
priority = 1).apply {
val holeVertex = arrayListOf<FloatPoint>()
holeVertex.add(FloatPoint(pos.x - 50f, pos.y - 50f))
holeVertex.add(FloatPoint(pos.x + 50f, pos.y - 50f))
holeVertex.add(FloatPoint(pos.x + 50f, pos.y + 50f))
holeVertex.add(FloatPoint(pos.x - 50f, pos.y + 50f))
addHole(mutableListOf(holeVertex))
}
}
fun createPolygonHoleWithMapView(): KNMapPolygon {
val center = WGS84ToKATEC(127.11019081347423,37.3941851228957)
val pos = (KNSDK.sharedGpsManager()?.lastValidGpsData?.pos) ?: FloatPoint(321397.72f, 532790.94f)
val polygonVertex = arrayListOf<FloatPoint>()
polygonVertex.add(FloatPoint(pos.x - 100f, pos.y - 100f))
polygonVertex.add(FloatPoint(pos.x + 100f, pos.y - 100f))
polygonVertex.add(FloatPoint(pos.x + 100f, pos.y + 100f))
polygonVertex.add(FloatPoint(pos.x - 100f, pos.y + 100f))
return KNMapPolygon(polygonVertex,
fillColor = Color.BLUE,
strokeColor = Color.YELLOW,
strokeWidth = 3f,
strokeDashType = KNLineDashType.KNLineDashType_Dotted,
priority = 1).apply {
val holeVertex = arrayListOf<FloatPoint>()
holeVertex.add(FloatPoint(pos.x - 50f, pos.y - 50f))
holeVertex.add(FloatPoint(pos.x + 50f, pos.y - 50f))
holeVertex.add(FloatPoint(pos.x + 50f, pos.y + 50f))
holeVertex.add(FloatPoint(pos.x - 50f, pos.y + 50f))
addHole(mutableListOf(holeVertex))
}
}
코드가 숨겨졌습니다.
- holePosition
- 각 구멍의 정점 리스트