CartoType Android API 8.8-7-gb35e4dc71
for Java development on Android
Public Member Functions | List of all members
com.cartotype.Legend Class Reference

Public Member Functions

 Legend (Framework aFramework)
 
native void clear ()
 
void addMapObjectLine (int aObjectType, String aLayer, FeatureInfo aFeatureInfo, String aStringAttrib, String aLabel)
 
native void addTextLine (String aText)
 
native void addScaleLine (boolean aMetricUnits)
 
native void setMainStyleSheet (byte[] aData)
 
native void setExtraStyleSheet (byte[] aData)
 
native void setBackgroundColor (int aColor)
 
native void setBorder (int aColor, double aStrokeWidth, double aRadius, String aUnit)
 
native void setMarginWidth (double aMarginWidth, String aUnit)
 
native void setMinLineHeight (double aLineHeight, String aUnit)
 
native void setLabelWrapWidth (double aWrapWidth, String aUnit)
 
native void setFontFamily (String aFontFamily)
 
native void setFontSize (double aFontSize, String aUnit)
 
native void setTextColor (int aTextColor)
 
native void setDiagramColor (int aDiagramColor)
 
void setAlignment (Align aAlignment)
 
native void setPolygonRotation (double aDegrees)
 
native boolean hasTurnInstruction ()
 
native void setTurnInstruction (String aText)
 
native String turnInstruction ()
 

Detailed Description

The Legend 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 Framework.setLegend().

Constructor & Destructor Documentation

◆ Legend()

com.cartotype.Legend.Legend ( Framework  aFramework)

Creates a Legend object with the same fonts and style sheet as aFramework.

Member Function Documentation

◆ addMapObjectLine()

void com.cartotype.Legend.addMapObjectLine ( int  aObjectType,
String  aLayer,
FeatureInfo  aFeatureInfo,
String  aStringAttrib,
String  aLabel 
)

Adds a line containing a map object, with an optional label to the left of it. If aFeatureInfo is null, uses the default feature info value (unknown non-route).

◆ addScaleLine()

native void com.cartotype.Legend.addScaleLine ( boolean  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()

native void com.cartotype.Legend.addTextLine ( String  aText)

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

◆ clear()

native void com.cartotype.Legend.clear ( )

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

◆ hasTurnInstruction()

native boolean com.cartotype.Legend.hasTurnInstruction ( )

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

◆ setAlignment()

void com.cartotype.Legend.setAlignment ( Align  aAlignment)

Sets the alignment for labels and scale bars.

◆ setBackgroundColor()

native void com.cartotype.Legend.setBackgroundColor ( int  aColor)

Sets the background color. Transparent colors are allowed. Use Framework.Color() or the Framework color constants to create values for aTextColor.

◆ setBorder()

native void com.cartotype.Legend.setBorder ( int  aColor,
double  aStrokeWidth,
double  aRadius,
String  aUnit 
)

Sets the border color and corner radius for the whole legend. Transparent border colors are allowed. Use Framework.Color() or the Framework color constants to create values for aTextColor.

◆ setDiagramColor()

native void com.cartotype.Legend.setDiagramColor ( int  aDiagramColor)

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

◆ setExtraStyleSheet()

native void com.cartotype.Legend.setExtraStyleSheet ( byte[]  aData)

Sets the extra style sheet.

The purpose of this function is to allow a caller such as a style sheet editor to create an extra style sheet containing a single layer, or a small number of layers, and draw a legend for that layer only.

◆ setFontFamily()

native void com.cartotype.Legend.setFontFamily ( String  aFontFamily)

Sets the font family for subsequently added lines.

◆ setFontSize()

native void com.cartotype.Legend.setFontSize ( double  aFontSize,
String  aUnit 
)

Sets the font size for subsequently added lines.

◆ setLabelWrapWidth()

native void com.cartotype.Legend.setLabelWrapWidth ( double  aWrapWidth,
String  aUnit 
)

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

◆ setMainStyleSheet()

native void com.cartotype.Legend.setMainStyleSheet ( byte[]  aData)

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

◆ setMarginWidth()

native void com.cartotype.Legend.setMarginWidth ( double  aMarginWidth,
String  aUnit 
)

Sets the margin width for the whole legend.

◆ setMinLineHeight()

native void com.cartotype.Legend.setMinLineHeight ( double  aLineHeight,
String  aUnit 
)

Sets the minimum line height for subsequently added lines.

◆ setPolygonRotation()

native void com.cartotype.Legend.setPolygonRotation ( double  aDegrees)

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

◆ setTextColor()

native void com.cartotype.Legend.setTextColor ( int  aTextColor)

Sets the text color for subsequently added lines. Use Framework.Color() or the Framework color constants to create values for aTextColor.

◆ setTurnInstruction()

native void com.cartotype.Legend.setTurnInstruction ( String  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()

native String com.cartotype.Legend.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: