CartoType Android API 7.8.2, 2022-03-25
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 ()
 
native void addMapObjectLine (int aObjectType, String aLayer, String aOsmType, int aIntAttrib, String aStringAttrib, String aLabel)
 
native void addTextLine (String aText)
 
native void addScaleLine (boolean aMetricUnits)
 
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 setFontFamily (String aFontFamily)
 
native void setFontSize (double aFontSize, String aUnit)
 
native void setTextColor (int aTextColor)
 
void setAlignment (Align aAlignment)
 

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

native void com.cartotype.Legend.addMapObjectLine ( int  aObjectType,
String  aLayer,
String  aOsmType,
int  aIntAttrib,
String  aStringAttrib,
String  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()

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

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

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

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

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


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