KNMapView
INFO
This English reference is based on Directions SDK 1.12.8-hotfix02. For the latest version, see the Korean reference.
A View class that displays a map and provides map configuration features, including camera positioning, markers, routes, and shapes.
Properties
| Name | Description | Type |
|---|---|---|
isVisibleTraffic | Whether traffic information is displayed on the map [Color Information] Gray: Impassable or Unknown Blue: Smooth Yellow: Slow traffic Orange: Slow Red: Congestion (default: false) | var isVisibleTraffic: Boolean |
isVisibleBuilding | Whether buildings are displayed on the map (default: true) | var isVisibleBuilding: Boolean |
coordinate (readOnly) | KATEC coordinates of the map position set by moveCamera. Changes to this read-only value are not applied. | var coordinate: FloatPoint |
anchor (readOnly) | Screen coordinates of the map position set by moveCamera. Values range from (0, 0) at the upper-left corner to (1, 1) at the lower-right corner. Changes to this read-only value are not applied. | var anchor: FloatPoint |
bearing (readOnly) | Bearing set by moveCamera | var bearing: Float |
zoom (readOnly) | Zoom level set by moveCamera | var zoom: Float |
tilt (readOnly) | Tilt set by moveCamera | var tilt: Float |
mapTheme | Map theme (colors, day/night mode, and so on) | var mapTheme: KNMapTheme? |
mapViewEventListener | Registers a listener for camera operations such as panning, zooming, tilting, and rotating, and for touch events such as single and double taps | var mapViewEventListener: KNMapViewEventListener? |
knMarkerEventListener | Registers a marker event listener on the map view | var knMarkerEventListener: KNMarkerEventListener? |
useTiltGesture | Whether to use the map's tilt behavior. If the value is false, the tilt does not change even if you move vertically with two fingers on the map.(default: true) | var useTiltGesture: Boolean |
useZoomGesture | Whether to use the zoom behavior of the map. If the value is false, the size of the map does not change even if you pinch or spread two fingers on the map.(default: true) | var useZoomGesture: Boolean |
useBearingGesture | Whether to use clockwise/counterclockwise rotation motion. If the value is false, the screen tilt does not change even if you move clockwise/counterclockwise with two fingers on the map.(default: true) | var useBearingGesture: Boolean |
usePanningGesture | Whether to use a panning motion that quickly moves the map in one direction. If the value is false, panning does not work even if you quickly move your finger on the map.(default: true) | var usePanningGesture: Boolean |
userLocation | KATEC coordinates that display the user's location using current GPS information | var userLocation: KNMapUserLocation? |
parkingLotProperties | Provides parking lot and floor information, and configures the parking lot ID, visibility, and floor | var parkingLotProperties: KNMapParkingLotProperties? = null |
poiProperties | Configures POI visibility and registers KNMapPOIEventListener to receive POI event callbacks | var poiProperties: KNMapPOIProperties? = null |
routeProperties | Configures route color and line width and registers KNMapRouteEventListener to receive route event callbacks | var routeProperties: KNMapRouteProperties? = null |
isVisiblePOI (Deprecated) | Whether POI icons are displayed on the map (default: true) | var isVisiblePOI: Boolean |
routeTheme (Deprecated) | Route theme, including line width and color | var routeTheme: KNMapRouteTheme? |
Constructor
TIP
Class KNMapView must be created via KNSDK.
KNSDK.bindingMapView
Bind the renderer to KNMapView. The provided renderer uses Opengles 2.0 or Opengles 3.0 depending on the device environment.
KNSDK.bindingMapView(mapView: KNMapView, theme: KNMapTheme, completion: ((KNError?) → Unit)?)Example code — KNSDK.bindingMapView
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}Methods
setRoute
Sets a route on the map.
Example code — setRoute
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun routeWithMapView(route: KNRoute) {
bindMapView {
if (it == null) return@bindMapView
}
mapView.setRoute(route)
}fun setRoute( route: KNRoute )Parameters
| Name | Description |
|---|---|
route | path |
setRoutes
Receives a route list and Sets a route on the map.
Example code — setRoutes
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun routeListWithMapView(routes: List) {
bindMapView {
if (it == null) return@bindMapView
}
mapView.setRoutes(routes)
}fun setRoutes( routes: List<KNRoute> )Parameters
| Name | Description |
|---|---|
routes | route list |
getRoutes()
Returns the list of all routes set on the map.
Example code — getRoutes():
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun getRouteWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.getRoutes()
}fun getRoutes(): List<KNRoute>removeRoutesAll()
Deletes all routes registered on the map.
TIP
If you are simply replacing an old path with a new path, you do not need to call this function.
Example code — removeRoutesAll()
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun removeRouteAllWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.removeRoutesAll()
}fun removeRoutesAll()setZoomRange
Limit the range by setting the minimum and maximum zoom levels for the map. The range can be from 0.1 to 9999.0 depending on server settings; settings outside this range will be ignored.
Example code — setZoomRange
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun setZoomRangeWithMapView(min: Float, max: Float) {
bindMapView {
if (it == null) return@bindMapView
}
mapView.setZoomRange(min, max)
}fun setZoomRange( min: Float,
max: Float )Parameters
| Name | Description |
|---|---|
min | Zoom level minimum (0.1) |
max | Zoom level maximum (9999.0) |
cullPassedRoute
Cut the portion of the route taken by the user using the entered location information of the user. If isAnimate is enabled (true), the path will be truncated gradually at 500 ms. If isAnimate is disabled (false), the path will be truncated immediately. The starting position of the path is relative to KNLocation.
Example code — cullPassedRoute
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun cullingRouteWithMapView(location: KNLocation, isAnimate: Boolean) {
bindMapView {
if (it == null) return@bindMapView
}
mapView.cullPassedRoute(location, isAnimate)
}fun cullPassedRoute( guideLocation: KNLocation,
isAnimate: Boolean )Parameters
| Name | Description |
|---|---|
guideLocation | Location information |
isAnimate | Whether to use animation to cut the path |
addMarker
Adds a marker to the map.
Example code — addMarker
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun addMarkerWithMapView(marker: KNMapMarker) {
bindMapView {
if (it == null) return@bindMapView
}
bindingMapView()?.addMarker(marker)
}fun addMarker( marker: KNMapMarker )Parameters
| Name | Description |
|---|---|
marker | Marker to add |
addMarkers
Adds a marker list to the map.
Example code — addMarkers
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun addMarkerListWithMapView(markers: List) {
bindMapView {
if (it == null) return@bindMapView
}
bindingMapView()?.addMarkers(markers)
}fun addMarkers( markers: List<KNMapMarker> )Parameters
| Name | Description |
|---|---|
markers | Markers to add |
removeMarker
Removes a marker from the map.
Example code — removeMarker
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun removeMarkerWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.getMarkers().filter { it.tag == 24 }.firstOrNull()?.apply {
mapview.removeMarker(this)
}
}fun removeMarker( marker: KNMapMarker )Parameters
| Name | Description |
|---|---|
marker | Marker to remove |
removeMarkersAll()
Removes all markers added to the map.
Example code — removeMarkersAll()
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun removeMarkersAllWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.removeMarkersAll()
}fun removeMarkersAll()getMarkers()
Returns the list of markers added to the map. Returns an empty list if there are none.
Example code — getRoutes():
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun getMarkerListWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
bindingMapView()?.getMarkers()
}fun getMarkers(): List<KNMapMarker>addCircle
Adds a circle to the map.
Example code — addCircle
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun addCircleWithMapView(circle: KNMapCircle) {
bindMapView {
if (it == null) return@bindMapView
}
bindingMapView()?.addCircle(circle)
}fun addCircle( circle: KNMapCircle )Parameters
| Name | Description |
|---|---|
circle | won |
removeCircle
Removes a circle from the map.
Example code — removeCircle
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun removeCircleWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.getCircles().filter { it.tag == 14 }.firstOrNull()?.apply {
mapview.removeCircle(this)
}
}fun removeCircle( circle: KNMapCircle )Parameters
| Name | Description |
|---|---|
circle | won |
removeCirclesAll()
Removes all circles added to the map.
Example code — removeCirclesAll()
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun removeCirclesAllWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.removeCirclesAll()
}fun removeCirclesAll()getCircles()
Returns the list of circles added to the map. Returns an empty list if there are none.
Example code — getCircles():
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun getCircleListWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
bindingMapView()?.getCircles()
}fun getCircles(): List<KNMapCircle>addPolyline
Adds a polyline to the map.
Example code — addPolyline
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun addPolylineWithMapView(polyline: KNMapPolyline) {
bindMapView {
if (it == null) return@bindMapView
}
bindingMapView()?.addPolyline(polyline)
}fun addPolyline( polyline: KNMapPolyline )Parameters
| Name | Description |
|---|---|
polyline | Polyline |
removePolyline
Removes a polyline from the map.
Example code — removePolyline
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun removePolylineWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.getPolylines().filter { it.tag == 4 }.firstOrNull()?.apply {
mapview.removePolyline(this)
}
}fun removePolyline( polyline: KNMapPolyline )Parameters
| Name | Description |
|---|---|
polyline | Polyline |
removePolylinesAll()
Removes all polylines added to the map.
Example code — removePolylinesAll()
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun removePolylinesAllWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.removePolylinesAll()
}fun removePolylinesAll()getPolylines()
Returns the list of polylines added to the map. Returns an empty list if there are none.
Example code — getPolylines():
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun getPolylineListWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
bindingMapView()?.getPolyline()
}fun getPolylines(): List<KNMapPolyline>addPolygon
Adds a polygon to the map.
Example code — addPolygon
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun addPolygonWithMapView(polygon: KNMapPolygon) {
bindMapView {
if (it == null) return@bindMapView
}
bindingMapView()?.addPolygon(polygon)
}fun addPolygon( polygon: KNMapPolygon )Parameters
| Name | Description |
|---|---|
polygon | Polygon to add |
removePolygon
Removes a polygon from the map.
Example code — removePolygon
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun removePolygonWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.getPolygons().filter { it.tag == 4 }.firstOrNull()?.apply {
mapview.removePolygon(this)
}
}fun removePolygon( polygon: KNMapPolygon )Parameters
| Name | Description |
|---|---|
polygon | Polygon to remove |
removePolygonsAll()
Removes all polygons added to the map.
Example code — removePolygonsAll()
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun removePolygonsAllWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.removePolygonsAll()
}fun removePolygonsAll()getPolygons()
Returns the list of polygons added to the map. Returns an empty list if there are none.
Example code — getPolygons():
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun getPolygonListWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
bindingMapView()?.getPolygons()
}fun getPolygons(): List<KNMapPolygon>getScreenRect
Returns the screen rectangle (RectF) that encloses the KNMapCoordinateRegion.
Example code — getScreenRect:
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun regionRectWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.apply {
val region = KNMapCoordinateRegion.initWithRoute(getRoutes())
region.mergeWithMarkers(getMarkers())
// Can be negative if the calculated area extends beyond the current screen.
val screenRectF = getScreenRect(region)
}
}fun getScreenRect( region: KNMapCoordinateRegion ): RectFParameters
| Name | Description |
|---|---|
region | received coordinate region |
isOverlappedWithScreenRect
Returns whether the screen rectangle (RectF) intersects the KNMapCoordinateRegion.
Example code — isOverlappedWithScreenRect:
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun areaCollisionWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.apply {
val region = KNMapCoordinateRegion.initWithRoute(getRoutes())
region.mergeWithMarkers(getMarkers())
val center = WGS84ToKATEC(127.11019081347423,37.3941851228957)
val screenPoint = katecToScreen(center)
val screeRectF = RectF(screenPoint.x - 50f, screenPoint.y - 50f, screenPoint.x + 50f, screenPoint.y + 50f)
val collision = isOverlappedWithScreenRect(screeRectF, region)
}
}fun isOverlappedWithScreenRect( screenRect: RectF,
region: KNMapCoordinateRegion ): BooleanParameters
| Name | Description |
|---|---|
screenRect | Screen rectangle (RectF) |
region | received coordinate region |
isOverlappedWithScreenPoint
Returns whether the screen coordinates (FloatPoint) overlap with KNMapCoordinateRegion.
Example code — isOverlappedWithScreenPoint:
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun pointCollisionWithMapView() {
bindMapView {
if (it == null) return@bindMapView
}
mapView.apply {
val region = KNMapCoordinateRegion.initWithRoute(getRoutes())
region.mergeWithMarkers(getMarkers())
val center = WGS84ToKATEC(127.11019081347423,37.3941851228957)
val screenPoint = katecToScreen(center)
val collision = isOverlappedWithScreenPoint(screePoint, region)
}
}fun isOverlappedWithScreenPoint( screenPoint: FloatPoint,
region: KNMapCoordinateRegion ): BooleanParameters
| Name | Description |
|---|---|
screenPoint | Screen coordinates (FloatPoint) |
region | received coordinate region |
moveCamera
Updates the map camera position with the KNMapCameraUpdate settings.
Example code — moveCamera
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun moveMap(withUserLocation: Boolean) {
bindMapView {
if (it == null) return@bindMapView
}
mapView.moveCamera(KNMapCameraUpdate.targetTo(FloatPoint(321408f, 532832f)), withUserLocation)
}fun moveCamera( cameraUpdate: KNMapCameraUpdate,
withUserLocation: Boolean )Parameters
| Name | Description |
|---|---|
cameraUpdate | KNMapCameraUpdate settings |
withUserLocation | Whether to synchronize user location |
animateCamera
The current map location, zoom, and angle are changed using the information set in KNMapCameraUpdate for the time entered in duration. (unit: ms)
Example code — animateCamera
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun moveMap(withUserLocation: Boolean) {
bindMapView {
if (it == null) return@bindMapView
}
mapView.animateCamera(KNMapCameraUpdate.targetTo(FloatPoint(321408f, 532832f)),1000L, withUserLocation)
}fun animateCamera( cameraUpdate: KNMapCameraUpdate,
duration: Long,
withUserLocation: Boolean )Parameters
| Name | Description |
|---|---|
cameraUpdate | KNMapCameraUpdate settings |
duraton | Animation duration(unit: ms) |
withUserLocation | Whether to synchronize user location |
katecToScreen
Converts the input KATEC coordinates to screen coordinates and returns them.
Example code — katecToScreen:
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun katecToScreenWithMapView(katec: FloatPoint) {
bindMapView {
if (it == null) return@bindMapView
}
mapView.katecToScreen(katec)
}fun katecToScreen( katec: FloatPoint ): FloatPointParameters
| Name | Description |
|---|---|
katec | KATEC coordinates |
screenToKatec
Converts the input screen coordinates to KATEC coordinates and returns them.
Example code — screenToKatec:
fun bindMapView(completion: ((KNError?) -> Unit)?) {
KNSDK.bindingMapView(
mapView,
KNMapTheme.driveDay()) { error ->
completion?.invoke(error)
if (error != null) {
Toast.makeText(context, "맵 초기화 작업이 실패하였습니다. \n[${error.code}] : ${error.msg}",Toast.LENGTH_LONG).show()
return@bindingMapView
}
}
}
fun screenToKatecWithMapView(screen: FloatPoint) {
bindMapView {
if (it == null) return@bindMapView
}
mapView.screenToKatec(screen)
}fun screenToKatec( screen: FloatPoint ): FloatPointParameters
| Name | Description |
|---|---|
screen | screen coordinates |
addSegmentPolyline
Adds color-coded lines to the map.
open override fun addSegmentPolyline( segmentPolyline: KNMapSegmentPolyline )Parameters
| Name | Description |
|---|---|
segmentPolyline | Color separation line |
removeSegmentPolyline
Remove color separation lines from the map.
open override fun removeSegmentPolyline( segmentPolyline: KNMapSegmentPolyline )Parameters
| Name | Description |
|---|---|
segmentPolyline | Color separation line |
removeSegmentPolylinesAll
Removes all color separation lines added to the map.
open override fun removeSegmentPolylinesAll()getSegmentPolylines
Returns a list of color-coded lines added to the map. If there are no color separation lines added, an empty list is returned.
open override fun getSegmentPolylines(): List<KNMapSegmentPolyline>