CartoType iOS API 7.8.2, 2022-03-25
for development in Swift and Objective C for iOS and Mac OS
|
#import <CartoTypeLegend.h>
Instance Methods | |
(id) | - initWithFramework: |
(void) | - dealloc |
(void) | - clear |
(void) | - addMapObjectLineOfType:layer:osmType:intAttrib:stringAttrib:label: |
(void) | - addTextLine: |
(void) | - addScaleLine: |
(void) | - setExtraStyleSheet: |
(void) | - setBackgroundColor: |
(void) | - setBorderColor:strokeWidth:radius:unit: |
(void) | - setMarginWidth:unit: |
(void) | - setMinLineHeight:unit: |
(void) | - setFontFamily: |
(void) | - setFontSize:unit: |
(void) | - setTextColor: |
(void) | - setAlignment: |
(void *) | - getLegend |
The CartoTypeLegend class specifies legends or map keys showing sample map objects, with optional text lines and a scale.
Dimensions are specified with units, which may be "pt" (point), "pc" (pica), "cm" (centimetre), "mm" (millimetre), "in" (inch), or "px" (pixel). An empty or unrecognised unit is taken as "px".
To use a legend on a map, create a Legend object and pass it to the setLegend method of CartoTypeFramework.
- (void) addMapObjectLineOfType: | (CartoTypeMapObjectType) | aType | |
layer: | (NSString *) | aLayer | |
osmType: | (NSString *) | aOsmType | |
intAttrib: | (int32_t) | aIntAttrib | |
stringAttrib: | (NSString *) | aStringAttrib | |
label: | (NSString *) | aLabel | |
Adds a line containing a map object, with an optional label to the left of it. If the parameter aOsmType is a type code made from three lower-case letters in the range a...z, it is converted to an integer type code which is ORed with aIntAttrib.
- (void) addScaleLine: | (bool) | aMetricUnits |
Adds a scale bar line, using the current font family, font size, alignment, text color and minimum line height. If aMetricUnits is true kilometers and meters are used, otherwise miles and yards.
- (void) addTextLine: | (NSString *) | aText |
Adds a line of text, using the current font family, font size, text color and minimum line height.
- (void) clear |
Deletes all legend lines (map objects, text lines and scale bars).
- (void) dealloc |
Destroys the object.
- (void *) getLegend |
Gets a pointer to the C++ CLegend object: internal use only.
- (id) initWithFramework: | (CartoTypeFramework *) | aFramework |
Initializes a CartoTypeLegend with a CartoTypeFramework object, using the same fonts and style sheet as aFramework.
- (void) setAlignment: | (CartoTypeAlign) | aAlignment |
Sets the alignment for labels and scale bars.
- (void) setBackgroundColor: | (CartoTypeColor) | aColor |
Sets the background color. Transparent colors are allowed.
- (void) setBorderColor: | (CartoTypeColor) | aColor | |
strokeWidth: | (double) | aStrokeWidth | |
radius: | (double) | aRadius | |
unit: | (NSString *) | aUnit | |
Sets the border color and corner radius for the whole legend. Transparent border colors are allowed.
- (void) setExtraStyleSheet: | (NSString *) | aData |
Sets the extra style sheet.
The purpose of this function is to allow a caller such as a style sheet editor to create a style sheet containing a single layer, or a small number of layers, and draw a legend for that layer only.
- (void) setFontFamily: | (NSString *) | aFontFamily |
Sets the font family for subsequently added lines.
- (void) setFontSize: | (double) | aFontSize | |
unit: | (NSString *) | aUnit | |
Sets the font size for subsequently added lines.
- (void) setMarginWidth: | (double) | aMarginWidth | |
unit: | (NSString *) | aUnit | |
Sets the margin width for the whole legend.
- (void) setMinLineHeight: | (double) | aLineHeight | |
unit: | (NSString *) | aUnit | |
Sets the minimum line height for subsequently added lines.
- (void) setTextColor: | (CartoTypeColor) | aTextColor |
Sets the text color for subsequently added lines.