KNMapImage (Deprecated)
INFO
This English reference is based on Directions SDK 1.12.12. For the latest version, see the Korean reference.
The static image form Creates the map. The static map offers various functions such as camera curves, markers, paths, graphs, and more.
TIP
The KNMapImage class must be created through KNSDK.
Properties
| Name | Description | Type |
|---|---|---|
isVisibleTraffic | Whether traffic information is displayed on the map (default: NO) | @property (nonatomic, readwrite, assign) BOOL isVisibleTraffic |
isVisibleBuilding | Whether buildings are displayed on the map (default: YES) | @property (nonatomic, readwrite, assign) BOOL isVisibleBuildling |
isVisiblePOI | Whether POI icons are displayed on the map (default: YES) | @property (nonatomic, readwrite, assign) BOOL isVisiblePOI |
coordinate | KATEC coordinates that indicate the location of the map set by moveCamera. | @property (nonatomic, readonly) FloatPoint coordinate |
anchor | Coordinates that indicate where on the screen the map location set through moveCamera is placed. Screen values are expressed as (x-axis, y-axis), where the top-left corner is (0, 0) and the bottom-right corner is (1, 1). Moving right adds +0.1 on the x-axis, and moving down adds +0.1 on the y-axis. | @property (nonatomic, readonly) FloatPoint anchor |
bearing | The direction angle of the map set by moveCamera (unit: degrees) | @property (nonatomic, readonly) float bearing |
zoom | Zoom level of the map set by moveCamera. A larger value zooms in further. | @property (nonatomic, readonly) float zoom |
tilt | Tilt of the map set by moveCamera (unit: degrees) | @property (nonatomic, readonly) float tilt |
mapTheme | Map theme (colors, day/night mode, and so on) | @property (nonatomic, readwrite, assign, nonnull) KNMapTheme* mapTheme |
imageSize | The size of the map image. | @property (nonatomic, readonly, assign, nonnull) CGSize imageSize |
routeTheme | Route theme (route thickness, color, and so on) | @property (nonatomic, readwrite, assign, nonnull) KNMapRouteTheme* routeTheme |
Example code KNMapImage property Usage example
// Show traffic information on the map
self->mapImage.isVisibleTraffic = YES;
BOOL isVisibleTraffic = self->mapImage.isVisibleTraffic;
// Show buildings on the map
self->mapImage.isVisibleBuilding = YES;
BOOL isVisibleBuilding = self->mapImage.isVisibleBuilding;
// Hide point of interest (POI) icons on the map
self->mapImage.isVisiblePOI = NO;
BOOL isVisiblePOI = self->mapImage.isVisiblePOI;
// Current map position in KATEC coordinates
FloatPoint currentCoordinate = self->mapImage.coordinate;
// Screen coordinates where the map position is displayed
FloatPoint anchor = self->mapImage.anchor;
// Bearing of the map
float bearing = self->mapImage.bearing;
// Zoom level of the map
float zoom = self->mapImage.zoom;
// Tilt of the map
float tilt = self->mapImage.tilt;
// Set the map to the daytime driving theme
self->mapImage.mapTheme = [KNMapTheme driveDay];
KNMapTheme* currTheme = self->mapImage.mapTheme;
// Set the image size
CGSize size = self->mapImage.imageSize;
// Set the route to the daytime driving theme
self->mapImage.routeTheme = [KNMapRouteTheme driveDay];
KNMapRouteTheme* routeTheme = self->mapImage.routeTheme;Methods
setRoute
Sets a route on the map.
- (void) setRoute: (KNRoute*) aRouteParameters
| Name | Description |
|---|---|
aRoute | The route. |
setRoutes
Sets a route on the map.
- (void) setRoutes: (NSArray<KNRoute*>*) aRoutesParameters
| Name | Description |
|---|---|
aRoutes | route list |
getRoutes
Returns the list of all routes set on the map.
- (NSArray<KNRoute*>*) getRoutesremoveRoutesAll
Deletes all routes registered on the map.
- (void) removeRoutesAllcullPassedRoute
Using the user's input Location information, the user cuts off the path they've been through, and the starting position of the path is based on KNLocation.
- (void) cullPassedRoute: (KNLocation*) aLocationParameters
| Name | Description |
|---|---|
aLocation | Location information |
addMarker
Adds a marker to the map.
- (void) addMarker: (KNMapMarker*) aMarkerParameters
| Name | Description |
|---|---|
aMarker | Marker |
addMarkers
Adds a marker list to the map.
- (void) addMarkers: (NSArray<KNMapMarker*>*) aMarkersParameters
| Name | Description |
|---|---|
aMarkers | marker list |
removeMarker
Removes a marker from the map.
- (void) removeMarker: (KNMapMarker*) aMarkerParameters
| Name | Description |
|---|---|
aMarker | Marker |
removeMarkersAll
Removes all markers added to the map.
- (void) removeMarkersAllgetMarkers
Returns the list of markers added to the map. Returns an empty list if there are none.
- (NSArray*) getMarkersaddCircle
Adds a circle to the map.
- (void) addCircle: (KNMapCircle*) aCircleParameters
| Name | Description |
|---|---|
aCircle | Circle to add |
removeCircle
Removes a circle from the map.
- (void) removeCircle: (KNMapCircle*) aCircleParameters
| Name | Description |
|---|---|
aCircle | Circle to remove |
removeCirclesAll
Removes all circles added to the map.
- (void) removeCirclesAllgetCircles
Returns the list of circles added to the map. Returns an empty list if there are none.
- (NSArray*) getCirclesaddPolyline
Adds a polyline to the map.
aPolyline addPolyline: (KNMapPolyline*) aPolylineParameters
| Name | Description |
|---|---|
aPolyline | Polyline |
removePolyline
Removes a polyline from the map.
- (void) removePolyline: (KNMapPolyline*) aPolylineParameters
| Name | Description |
|---|---|
aPolyline | Polyline |
removePolylinesAll
Removes all polylines added to the map.
- (void) removePolylinesAllgetPolylines
Returns the list of polylines added to the map. Returns an empty list if there are none.
- (NSArray*) getPolylinesaddPolygon
Adds a polygon to the map.
- (void) addPolygon: (KNMapPolygon*) aPolygonParameters
| Name | Description |
|---|---|
aPolygon | Polygon |
removePolygon
Removes a polygon from the map.
- (void) removePolygon: (KNMapPolygon*) aPolygonParameters
| Name | Description |
|---|---|
aPolygon | Polygon |
removePolygonsAll
Removes all polygons added to the map.
- (void) removePolygonsAllgetPolygons
Returns the list of polygons added to the map. Returns an empty list if there are none.
- (NSArray*) getPolygonsgetScreenRectWithRegion
Returns the screen rectangle (CGRect) that encloses KNMapCoordinateRegion.
- (CGRect) getScreenRectWithRegion: (KNMapCoordinateRegion*) aRegionParameters
| Name | Description |
|---|---|
aRegion | Received coordinate region |
isOverlappedWithScreenRect:region
Returns whether the screen rectangle (CGRect) overlaps KNMapCoordinateRegion.
- (BOOL) isOverlappedWithScreenRect: (CGRect) aScreenRect
region: (KNMapCoordinateRegion*) aRegionParameters
| Name | Description |
|---|---|
aScreenRect | Screen rectangle (CGRect) |
aRegion | Received coordinate region |
isOverlappedWithScreenPoint:region
Returns whether the screen coordinate (CGPoint) overlaps KNMapCoordinateRegion.
- (BOOL) isOverlappedWithScreenPoint: (CGPoint) aScreenPoint
region: (KNMapCoordinateRegion*) aRegionParameters
| Name | Description |
|---|---|
aScreenPoint | Screen coordinate (CGPoint) |
region | Received coordinate region |
moveCamera
Updates the map camera position with the KNMapCameraUpdate settings.
-(void) moveCamera: (KNMapCameraUpdate*) aCameraUpdateParameters
| Name | Description |
|---|---|
aCameraUpdate | KNMapCameraUpdate settings |
generateImage
Creates the map.
-(void) generateImage: (void (^_Nullable)(UIImage * _Nullable image BOOL isSucess)) aCompletionkatecToScreen
Converts KATEC coordinates on the current map to screen coordinates.
Example code — - katecToScreen:
CGPoint screen = [self->mapImage katecToScreen:marker.coordinate];- (CGPoint) katecToScreen: (FloatPoint) aKatecParameters
| Name | Description |
|---|---|
aKatec | KATEC coordinates |
screenToKatec
Converts screen coordinates on the current map to KATEC coordinates.
Example code — - screenToKatec:
FloatPoint katecPos = [self->mapImage screenToKatec:CGPointMake(x, y)];- (FloatPoint) screenToKatec: (CGPoint) aScreenParameters
| Name | Description |
|---|---|
aScreen | screen coordinates |