KNMapCoordinateRegion
INFO
This English reference is based on Directions SDK 1.12.12. For the latest version, see the Korean reference.
Defines an area to display on the map. Use it to obtain an area containing specified routes, Markers, or locations, or to combine multiple route and Marker areas on one screen.
Example code — KNMapCoordinateRegion
NSArray* markers = [mapView getMarkers];
NSArray* routes = [mapView getRoutes];
KNMapCoordinateRegion* region = [KNMapCoordinateRegion region];
// Set the marker area
[region mergeWithMarkers:markers];
// Set the marker and route area
[region mergeWithRoutes:routes)];
// Set a specific rectangular area on the map
CGRect originalRect = screenRect;
// Set the padding
UIEdgeInsets insets = UIEdgeInsetsMake(5, 5, -5, -5);
CGRect fittingScreenRect = UIEdgeInsetsInsetRect(originalRect, insets);
// Fit the marker and route area to the screen
KNMapCameraUpdate* cameraUpdate = [[KNMapCameraUpdate tiltTo:45.0] fitToFittingRect:fittingScreenRect region:region];
// Apply the camera update to the map view
[mapView moveCamera:cameraUpdate withUserLocation:true];Constructor
+ region
Creates a KNMapCoordinateRegion object with default values.
+ (KNMapCoordinateRegion*) region+ regionWithMin:max
Creates a KNMapCoordinateRegion object from minimum and maximum KATEC coordinates. You can merge additional aMin and aMax values by calling mergeWithMinMax. Returns a region instance containing the resulting minimum and maximum values.
+ (KNMapCoordinateRegion*) regionWithMin: (FloatPoint) aMin
max: (FloatPoint) aMaxParameters
| Name | Description |
|---|---|
aMin | Minimum value of the region |
aMax | Maximum value of the region |
+ regionWithRoutes
Creates a KNMapCoordinateRegion object from a route list. Call mergeWithRoute to add routes to the list. Returns a region instance containing the route list.
+ (KNMapCoordinateRegion*) regionWithRoutes: (NSArray*) aRoutesParameters
| Name | Description |
|---|---|
aRoutes | route list |
+ regionWithMarkers
Creates a KNMapCoordinateRegion object from a Marker list. Call mergeWithMarkers to add Markers to the list. Returns a region instance containing the Marker list.
+ (KNMapCoordinateRegion*) regionWithMarkers: (NSArray*) aMarkersParameters
| Name | Description |
|---|---|
aMarkers | marker list |
Methods
mergeWithMin:max
Compares the region minimum and maximum coordinates with the input values, then updates each coordinate with the outermost value. Returns the updated region instance.
TIP
aMin and aMax use KATEC coordinates.
- (void) mergeWithMin: (FloatPoint) aMin
max: (FloatPoint) aMaxParameters
| Name | Description |
|---|---|
aMin | Minimum value of the region |
aMax | Maximum value of the region |
mergeWithRoutes
Adds the specified route list to the KNMapCoordinateRegion route list.
- (void) mergeWithRoutes: (NSArray*) aRoutesParameters
| Name | Description |
|---|---|
aRoutes | route list |
mergeWithMarkers
Adds the specified Marker list to the KNMapCoordinateRegion Marker list.
- (void) mergeWithMarkers: (NSArray*) aMarkersParameters
| Name | Description |
|---|---|
aMarkers | marker list |
mergeWithRegion
Merges all elements of the specified region into this KNMapCoordinateRegion.
- (void) mergeWithRegion: (KNMapCoordinateRegion*) aRegionParameters
| Name | Description |
|---|---|
aRegion | Region to merge with KNMapCoordinateRegion |