CartoType iOS API 8.8-13-g03c6f7017
for development in Swift and Objective C for iOS and Mac OS
|
#import <CartoTypeLegend.h>
Instance Methods | |
(id) | - initWithFramework: |
(void) | - dealloc |
(void) | - clear |
(void) | - addMapObjectLine:layer:freatureInfo:stringAttrib:label: |
(void) | - addTextLine: |
(void) | - addScaleLine: |
(void) | - setMainStyleSheet: |
(void) | - setExtraStyleSheet: |
(void) | - setBackgroundColor: |
(void) | - setBorderColor:strokeWidth:radius:unit: |
(void) | - setMarginWidth:unit: |
(void) | - setMinLineHeight:unit: |
(void) | - setLabelWrapWidth:unit: |
(void) | - setFontFamily: |
(void) | - setFontSize:unit: |
(void) | - setTextColor: |
(void) | - setDiagramColor: |
(void) | - setAlignment: |
(void) | - setPolygonRotation: |
(bool) | - hasTurnInstruction |
(void) | - setTurnInstruction: |
(NSString *) | - turnInstruction |
(void *) | - legend |
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) addMapObjectLine: | (CartoTypeMapObjectType) | aType | |
layer: | (NSString *) | aLayer | |
freatureInfo: | (CartoTypeFeatureInfo *) | aFeatureInfo | |
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.
- (bool) hasTurnInstruction |
Returns true if any of the lines of this legend object is a turn instruction.
- (id) initWithFramework: | (CartoTypeFramework *) | aFramework |
Initializes a CartoTypeLegend with a CartoTypeFramework object, using the same fonts and style sheet as aFramework.
- (void *) legend |
Gets a pointer to the C++ CLegend object: internal use only.
- (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) setDiagramColor: | (CartoTypeColor) | aDiagramColor |
Sets the diagram color, used for scale bars and turn diagrams, for subsequently added lines.
- (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) setLabelWrapWidth: | (double) | aWrapWidth | |
unit: | (NSString *) | aUnit | |
Sets the label wrap width for subsequently added lines. Values of zero or less prevent wrapping.
- (void) setMainStyleSheet: | (NSString *) | aData |
Sets the main style sheet, replacing the style sheet copied from the Framework parameter to the Legend constructor.
- (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) setPolygonRotation: | (double) | aDegrees |
Sets the amount in degrees by which rectangles drawn for polygon legend lines are rotated, for subsequently added lines.
- (void) setTextColor: | (CartoTypeColor) | aTextColor |
Sets the text color for subsequently added lines.
- (void) setTurnInstruction: | (NSString *) | aText |
Sets the instruction to be displayed for the current turn, overriding automatically generated instructions. To revert to automatically generated instructions, call this function with empty text.
- (NSString *) turnInstruction |
Returns the instruction to be displayed for the current turn, overriding automatically generated instructions. Returns the empty string if automatically generated instructions are used and there is no overriding instruction.