KNMapCoordinateRegion
INFO
This English reference is based on Directions SDK 1.12.8-hotfix02. For the latest version, see the Korean reference.
Each member variable that makes up KNMapCoordinateRegion defines the area to be displayed on the map, and you can retrieve the area containing the specified location, such as a path, marker, or specific area. Using this class, you can combine the areas of route objects and marker objects registered on the map into one and display them on one screen.
Constructor
KNMapCoordinateRegion()
Creates a KNMapCoordinateRegion object with default values.
Example code — KNMapCoordinateRegion()
fun createKNCoordinateregion(): KNMapCoordinateRegion {
return KNMapCoordinateRegion()
}
fun inRegionZone() {
mapView.getScreenRect(KNMapCoordinateRegion())
}KNMapCoordinateRegion.initWithMinMax
Receives the minimum and maximum coordinate values of the KATEC area and creates a KNMapCoordinateRegion object. The min and max values added later can be combined with the values input through the mergeWithMinMax function. Returns a region instance with min/max values.
Example code — KNMapCoordinateRegion.initWithMinMax
fun createWithMinMaxKNCoordinateregion(min: FloatPoint, max:FloatPoint): KNMapCoordinateRegion {
return KNMapCoordinateRegion.initWithMinMax(min, max)
}
fun fitToWithRegion(isAnimate: Boolean, withUseLocation: Boolean) {
val coordinate = WGS84ToKATEC(127.11019081347423,37.3941851228957)
val min = FloatPoint(coordinate.x - 100f, coordinate.y - 100f)
val max = FloatPoint(coordinate.x + 100f, coordinate.y + 100f)
if (isAnimate) {
mapView.animateCamera(
KNMapCameraUpdate.fitTo(createWithMinMaxKNCoordinateregion(min, max)),
500L,
withUseLocation)
} else {
mapView.moveCamera(
KNMapCameraUpdate.fitTo(createWithMinMaxKNCoordinateregion(min, max)),
withUseLocation)
}
}fun initWithMinMax( min: FloatPoint,
max: FloatPoint ): KNMapCoordinateRegionParameters
| Name | Description |
|---|---|
min | Minimum value of the region |
max | Maximum value of the region |
KNMapCoordinateRegion.initWithRoute
Receives a route list and creates a KNMapCoordinateRegion object. Afterwards, the entered path can be added to this list through the mergeWithRoute function. Returns a region instance with a route list.
Example code — KNMapCoordinateRegion.initWithRoute
fun createWithRouteKNCoordinateregion(routes:List): KNMapCoordinateRegion {
return KNMapCoordinateRegion.initWithRoute(routes)
}
fun collisionRectWithRegion(routes: List) {
val coordinate = WGS84ToKATEC(127.11019081347423,37.3941851228957)
val screenPoint = mapView.katecToScreen(coordinate)
mapView.isOverlappedWithScreenRect(
RectF(screenPoint.x - 50f, screenPoint.y - 50f, screenPoint.x + 50f, screenPoint.y + 50f),
createWithRouteKNCoordinateregion(routes)
)
}fun initWithRoute( routes: List <KNRoute> ): KNMapCoordinateRegionParameters
| Name | Description |
|---|---|
routes | route list |
KNMapCoordinateRegion.initWithMarkers
Creates a KNMapCoordinateRegion from a marker list. Additional markers can be added with mergeWithMarkers. Returns a region containing the markers.
Example code — KNMapCoordinateRegion.initWithMarkers
fun createWithMarkersKNCoordinateregion(markers:List): KNMapCoordinateRegion {
return KNMapCoordinateRegion.initWithMarkers(markers)
}
fun collisionTouchPointWithRegion(touchPoint: FloatPoint, markers: List) {
val coordinate = WGS84ToKATEC(127.11019081347423,37.3941851228957)
var selectMarker: KNMapMarker? = null
for (marker in markers) {
if (mapView.isOverlappedWithScreenPoint(
touchPoint,
createWithMarkersKNCoordinateregion(listOf(marker)))) {
selectMarker = marker
break
}
}
}fun initWithMarkers( markers: List <KNMapMarker> ): KNMapCoordinateRegionParameters
| Name | Description |
|---|---|
markers | marker list |
Methods
initWithMinMax
Receives the minimum and maximum coordinate values of the KATEC area and creates a KNMapCoordinateRegion object. The min and max values added later can be combined with the values input through the mergeWithMinMax function. Returns a region instance with min/max values.
Example code — initWithMinMax:
fun createWithMinMaxKNCoordinateregion(min: FloatPoint, max:FloatPoint): KNMapCoordinateRegion {
return KNMapCoordinateRegion().initWithMinMax(min, max)
}
fun fitToWithRegion(isAnimate: Boolean, withUseLocation: Boolean) {
val coordinate = WGS84ToKATEC(127.11019081347423,37.3941851228957)
val min = FloatPoint(coordinate.x - 100f, coordinate.y - 100f)
val max = FloatPoint(coordinate.x + 100f, coordinate.y + 100f)
if (isAnimate) {
mapView.animateCamera(
KNMapCameraUpdate.fitTo(createWithMinMaxKNCoordinateregion(min, max)),
500L,
withUseLocation)
} else {
mapView.moveCamera(
KNMapCameraUpdate.fitTo(createWithMinMaxKNCoordinateregion(min, max)),
withUseLocation)
}
}fun initWithMinMax( min: FloatPoint,
max: FloatPoint ): KNMapCoordinateRegionParameters
| Name | Description |
|---|---|
min | Minimum value of the region |
max | Maximum value of the region |
initWithRoute
Receives a route list and creates a KNMapCoordinateRegion object. Afterwards, the entered path can be added to this list through the mergeWithRoute function. Returns a region instance with a route list.
Example code — initWithRoute:
fun createWithRouteKNCoordinateregion(routes:List): KNMapCoordinateRegion {
return KNMapCoordinateRegion().initWithRoute(routes)
}
fun collisionRectWithRegion(routes: List) {
val coordinate = WGS84ToKATEC(127.11019081347423,37.3941851228957)
val screenPoint = mapView.katecToScreen(coordinate)
mapView.isOverlappedWithScreenRect(
RectF(screenPoint.x - 50f, screenPoint.y - 50f, screenPoint.x + 50f, screenPoint.y + 50f),
createWithRouteKNCoordinateregion(routes)
)
}fun initWithRoute( routes: List <KNRoute> ): KNMapCoordinateRegionParameters
| Name | Description |
|---|---|
routes | route list |
initWithMarkers
Creates a KNMapCoordinateRegion from a marker list. Additional markers can be added with mergeWithMarkers. Returns a region containing the markers.
Example code — initWithMarkers:
fun createWithMarkersKNCoordinateregion(markers:List): KNMapCoordinateRegion {
return KNMapCoordinateRegion().initWithMarkers(markers)
}
fun collisionTouchPointWithRegion(touchPoint: FloatPoint, markers: List) {
val coordinate = WGS84ToKATEC(127.11019081347423,37.3941851228957)
var selectMarker: KNMapMarker? = null
for (marker in markers) {
if (mapView.isOverlappedWithScreenPoint(
touchPoint,
createWithMarkersKNCoordinateregion(listOf(marker)))) {
selectMarker = marker
break
}
}
}fun initWithMarkers( markers: List <KNMapMarker> ): KNMapCoordinateRegionParameters
| Name | Description |
|---|---|
markers | marker list |
mergeWithMinMax
Compare the minimum and maximum coordinate values of KNMapCoordinateRegion with the minimum and maximum values of the argument and update the values with the data with the minimum and maximum values, respectively. Returns a region instance with min/max values.
TIP
min, max are based on KATEC coordinates.
fun mergeWithMinMaxKNCoordinateregion(min: FloatPoint, max: FloatPoint): KNMapCoordinateRegion {
return KNMapCoordinateRegion().mergeWithMinMax(min, max)
}Parameters
| Name | Description |
|---|---|
min | Minimum value of the region |
max | Maximum value of the region |
mergeWithRoutes
Adds the specified routes to the KNMapCoordinateRegion.
fun mergeWithRoutesKNCoordinateregion(routes:List): KNMapCoordinateRegion {
return KNMapCoordinateRegion().mergeWithRoutes(routes)
}Parameters
| Name | Description |
|---|---|
routes | route list |
mergeWithMarkers
Adds the specified markers to the KNMapCoordinateRegion.
fun mergeWithMarkersKNCoordinateregion(markers:List): KNMapCoordinateRegion {
return KNMapCoordinateRegion().mergeWithMarkers(markers)
}Parameters
| Name | Description |
|---|---|
markers | marker list |
mergeWithRegion
Combines all elements of KNMapCoordinateRegion and the elements of region as input.
fun mergeWithRegionKNCoordinateregion(region: KNMapCoordinateRegion): KNMapCoordinateRegion {
return KNMapCoordinateRegion().mergeWithRegion(region)
}Parameters
| Name | Description |
|---|---|
region | Region in KNMapCoordinateRegion |