CartoType iOS API 7.8.2, 2022-03-25
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:
 
(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
 

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

◆ addMapObjectLineOfType:layer:osmType:intAttrib:stringAttrib:label:

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

◆ addScaleLine:

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

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

◆ getLegend

- (void *) getLegend

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

◆ initWithFramework:

- (id) initWithFramework: (CartoTypeFramework *)  aFramework

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

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

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

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

◆ setTextColor:

- (void) setTextColor: (CartoTypeColor aTextColor

Sets the text color for subsequently added lines.


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