CartoType iOS API 8.10-3-g0075538f6
for development in Swift and Objective C for iOS and Mac OS
Instance Methods | List of all members
CartoTypeLegend Class Reference

#import <CartoTypeLegend.h>

Inheritance diagram for CartoTypeLegend:

Instance Methods

(id) - initWithFramework:
 
(id) - initWithFramework:andStyle:
 
(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
 

Detailed Description

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.

Method Documentation

◆ addMapObjectLine:layer:freatureInfo:stringAttrib:label:

- (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.

◆ addScaleLine

- (void) addScaleLine

Adds a scale bar line, using the current font family, font size, alignment, text color and minimum line height.

◆ addTextLine:

- (void) addTextLine: (NSString *)  aText

Adds a line of text, using the current font family, font size, text color and minimum line height.

◆ clear

- (void) clear

Deletes all legend lines (map objects, text lines and scale bars).

◆ dealloc

- (void) dealloc

Destroys the object.

◆ hasTurnInstruction

- (bool) hasTurnInstruction

Returns true if any of the lines of this legend object is a turn instruction.

◆ initWithFramework:

- (id) initWithFramework: (CartoTypeFramework *)  aFramework

Initializes a CartoTypeLegend with a CartoTypeFramework object, using the same fonts and style sheet as aFramework.

◆ initWithFramework:andStyle:

- (id) initWithFramework: (CartoTypeFramework *)  aFramework
andStyle: (uint32_t)  aStyle 

Initializes a CartoTypeLegend with a CartoTypeFramework object, using the same fonts and style sheet as aFramework, and a standard style.

◆ legend

- (void *) legend

Gets a pointer to the C++ CLegend object: internal use only.

◆ setAlignment:

- (void) setAlignment: (CartoTypeAlign aAlignment

Sets the alignment for labels and scale bars.

◆ setBackgroundColor:

- (void) setBackgroundColor: (CartoTypeColor aColor

Sets the background color. Transparent colors are allowed.

◆ setBorderColor:strokeWidth:radius:unit:

- (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.

◆ setDiagramColor:

- (void) setDiagramColor: (CartoTypeColor aDiagramColor

Sets the diagram color, used for scale bars and turn diagrams, for subsequently added lines.

◆ setExtraStyleSheet:

- (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.

◆ setFontFamily:

- (void) setFontFamily: (NSString *)  aFontFamily

Sets the font family for subsequently added lines.

◆ setFontSize:unit:

- (void) setFontSize: (double)  aFontSize
unit: (NSString *)  aUnit 

Sets the font size for subsequently added lines.

◆ setLabelWrapWidth:unit:

- (void) setLabelWrapWidth: (double)  aWrapWidth
unit: (NSString *)  aUnit 

Sets the label wrap width for subsequently added lines. Values of zero or less prevent wrapping.

◆ setMainStyleSheet:

- (void) setMainStyleSheet: (NSString *)  aData

Sets the main style sheet, replacing the style sheet copied from the Framework parameter to the Legend constructor.

◆ setMarginWidth:unit:

- (void) setMarginWidth: (double)  aMarginWidth
unit: (NSString *)  aUnit 

Sets the margin width for the whole legend.

◆ setMinLineHeight:unit:

- (void) setMinLineHeight: (double)  aLineHeight
unit: (NSString *)  aUnit 

Sets the minimum line height for subsequently added lines.

◆ setPolygonRotation:

- (void) setPolygonRotation: (double)  aDegrees

Sets the amount in degrees by which rectangles drawn for polygon legend lines are rotated, for subsequently added lines.

◆ setTextColor:

- (void) setTextColor: (CartoTypeColor aTextColor

Sets the text color for subsequently added lines.

◆ setTurnInstruction:

- (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.

◆ turnInstruction

- (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.


The documentation for this class was generated from the following file: