KNMapPolyline
INFO
This English reference is based on Directions SDK 1.12.12. For the latest version, see the Korean reference.
Creates a Polyline to display on the map. You can configure its color, width, and line style. A Polyline connects KATEC coordinate vertices. To add it to the map, create a KNMapPolyline object and register it with KNMapView.
TIP
Marker priority is always higher than that of other Overlay objects, such as Circle and Polygon. Therefore, a Marker appears on the top layer when objects overlap.
Properties
| Name | Description | Type |
|---|---|---|
lineColor | The color of the polyline (default: black) | @property (nonatomic, assign, nonnull) UIColor* lineColor |
lineWidth | The thickness of the polyline. (default: 2, thickness setting range: 1 to 5) | @property (nonatomic, assign) float lineWidth |
lineDashType | Line type of the polyline. You can set a solid, dotted, dashed, dash-dotted, or dash-double-dotted line. (default: KNLineDashType_Solid) | @property (nonatomic, assign) KNLineDashType lineDashType |
priority | Display priority of the polyline. A higher number is displayed on top. (default: 0, priority range: 0~65535) | @property (nonatomic, readwrite, assign) NSInteger priority |
isVisible | Whether the polyline is visible. (default: YES) | @property (nonatomic, assign) BOOL isVisible |
tag | Tag assigned to the polyline (tag).The tag takes an Integer value and can be used to classify the polyline by category or to identify it separately. (optional) | @property (nonatomic, assign) NSInteger tag |
TIP
Marker priority is always higher than that of other Overlay objects, such as Circle, Polygon, and Polyline. Therefore, a Marker appears on the top layer when objects overlap.
Example code — KNMapPolyline Example code for using the property
// Set the polyline color
polyline.lineColor = [UIColor blueColors];
UIColor* = polyline.lineColor;
// Set the polyline width
polyLine.lineWidth = newValue;
float lineWidth = polyline.strokeWidth;
// Set the polyline type
polyline.lineDashType = KNLineDashType_Solid;
KNLineDashType dashType = polyline.lineDashType;
// Set the display priority of the polyline
polyline.priority = newValue;
NSInteger priority = polyline.priority;
// Set whether to show the polyline
polyline.isVisible = newValue;
BOOL visible = polyline.isVisible;
// Set the tag for the polyline
polyline.tag = newValue;
NSInteger tag = polyline.tag;Constructor
+ polyline
Creates a KNMapPolyline object.
+ (KNMapPolyline* _Nonnull)polyline+ polylineWithPoints:countPoints
Creates a KNMapPolyline object from KATEC coordinates.
+ (KNMapPolyline* _Nonnull)polylineWithPoints:(FloatPoint* _Nonnull)aPoints countPoints : (int)aCountPoints;Example code — + polylineWithPoints:countPoints:
float length = 20.0;
FloatPoint pos = mapView.coordinateCenter;
FloatPoint p01 = FloatPointMake(pos.x, pos.y + 10);
FloatPoint p02 = FloatPointMake(pos.x - 10, pos.y + 10);
FloatPoint p03 = FloatPointMake(pos.x - 10, pos.y);
KNMapPolyline* polygon = [[KNMapPolyline alloc] polylineWithPoints:points countPoints:3];
mapPolyline.lineColor = [UIColor redColor];
mapPolyline.lineDashType = KNLineDashType_Solid;
mapPolyline.lineWidth = STROKE_WIDTH;
mapPolyline.isVisible = YES;
mapPolyline.priority = PRIORITY;
mapPolyline.tag = POLYLINE_01;
[self->mapView addPolyline:mapPolyline];Methods
addPoint
Adds a KATEC coordinate vertex and connects it to the current last vertex.
- (void) addPoint: (FloatPoint) aPointParameters
| Name | Description |
|---|---|
aPoint | Line vertex |
addPoints:countPoints
Adds multiple KATEC coordinate vertices and connects them to the current last vertex.
- (void) addPoints: (FloatPoint* _Nonnull) aPoints
countPoints: (int) aCountPointsParameters
| Name | Description |
|---|---|
aPoints | List of line vertices |