KNMapMarker
INFO
This English reference is based on Directions SDK 1.12.8-hotfix02. For the latest version, see the Korean reference.
Represents a marker at a specific map location. You can use a custom image or the default pin image. Create a KNMapMarker and add it to KNMapView to display it.
Properties
| Name | Description | Type |
|---|---|---|
coordinate | KATEC coordinates where the marker is displayed (default: 0, true north direction based on screen) | var coordinate: FloatPoint |
pixelOffset | Marker image position offset in pixels, expressed as (x-axis, y-axis). The origin is the bottom center of the marker. Positive x moves the image right, and positive y moves it down. (default: origin) | var pixelOffset: IntPoint |
priority | Sets the marker's display priority. A higher number places it above markers with lower priorities. (default: 0, priority range: 0~65535) | var priority: Int |
icon | Sets the marker image. If no custom image is set, the default pin image is used. | var icon: Bitmap? |
isVisible | Whether the marker is visible (default: true) | var isVisible: Boolean |
tag | Tag assigned to the marker (tag)Tags are Int values that can be used to group or distinguish markers (optional) | var tag: Int |
info | Associates a container object that stores related information with the marker (optional) | var info: Any? |
id (readOnly) | Unique marker ID | var id: Int |
useSingleTapped | Whether single-tap events are enabled. Set to NO to disable them. (default: YES) | @property (nonatomic, readwrite, assign) bool useSingleTapped |
useDoubleTapped | Whether double-tap events are enabled. Set to NO to disable them. (default: YES) | @property (nonatomic, readwrite, assign) bool useDoubleTapped |
useLongPressed | Whether long-press events are enabled. Set to NO to disable them. (default: YES) | @property (nonatomic, readwrite, assign) bool useLongPressed |
Constructor
KNMapMarker()
Creates a KNMapMarker object with default values.
kotlin
fun createMarkerWithMapView(): KNMapMarker {
return KNMapMarker()
}KNMapMarker(coordinate: FloatPoint)
Creates a KNMapMarker initialized with the specified KATEC coordinates.
kotlin
fun createMarkerWithMapView(): KNMapMarker {
val pos = WGS84ToKATEC(127.11019081347423,37.3941851228957)
return KNMapMarker(pos)
}Methods
animate
Moves the marker to a new location with an animation.
Example code — animate
kotlin
fun createMarkerToAnimateWithMapView(): KNMapMarker {
val pos = WGS84ToKATEC(127.11019081347423,37.3941851228957)
return KNMapMarker(pos).apply {
val x = rand.nextInt(-50,50)
val y = rand.nextInt(-50,50)
animate(FloatPoint(this.coordinate.x + x, this.coordinate.y + y), 1000L)
}
}kotlin
fun animate( coordinate: FloatPoint,
duration: Long = 500L )Parameters
| Name | Description |
|---|---|
coodinate | KATEC coordinates of the location to move to |
duration | Animation duration(unit: ms) |
setVisibleRange
Sets the zoom-level range in which the marker is visible.
Example code — setVisibleRange
kotlin
fun createMarkerToVisibleRangeWithMapView(visibleIndex: Int): KNMapMarker {
val pos = WGS84ToKATEC(127.11019081347423,37.3941851228957)
val localVisibleRange = listOf(
0.1f to 10f,
10f to 50f,
50f to 100f,
100f to 200f,
200f to 600f,
600f to 1000f,
1000f to 1500f,
1500f to 9999f)
return KNMapMarker(pos).apply {
setVisibleRange(localVisibleRange[visibleIndex].first, localVisibleRange[visibleIndex].second)
}
}kotlin
fun setVisibleRange( minZoom: Float,
maxZoom: Float )Parameters
| Name | Description |
|---|---|
minZoom | Minimum zoom level at which to display the marker |
maxZoom | Maximum zoom level at which to display the marker |