CartoType UWP API 8.12-19-g3f49c29ef
for development in C#, VB.NET and C++
Public Member Functions | List of all members
CartoType::Legend Class Reference

The Legend class is used to specify legends, scales, copyright notices and turn instructions. More...

#include <CartoTypeWrapper.h>

Public Member Functions

 Legend (Framework^ aFramework)
 Creates a Legend object with the same fonts and style sheet as aFramework.
 
 Legend (Framework^ aFramework, uint32_t aStyle)
 Creates a Legend object with the same fonts and style sheet as aFramework, specifying a style made from LegendStyleFlag values.
 
void Clear ()
 Deletes all legend lines (map objects, text lines and scale bars).
 
void AddMapObjectLine (MapObjectType aType, String^ aLayer, FeatureInfo^ aFeatureInfo, String^ aStringAttrib, String^ aLabel)
 Adds a line containing a map object, with an optional label to the left of it.
 
void AddTextLine (String^ aText)
 Adds a line of text, using the current font family, font size, text color and minimum line height.
 
void AddScaleLine ()
 Adds a scale bar line, using the current font family, font size, alignment, text color and minimum line height.
 
void AddTurnLine (bool aAbbreviate)
 Adds a turn line, using the current font family, font size, alignment, text color and minimum line height.
 
void SetMainStyleSheet (String^ aData)
 Sets the main style sheet, replacing the style sheet copied from the Framework parameter to the Legend constructor.
 
void SetExtraStyleSheet (String^ aData)
 Sets the extra style sheet. More...
 
void SetBackgroundColor (Color aColor)
 Sets the background color. Transparent colors are allowed.
 
void SetBorder (Color aColor, double aStrokeWidth, double aRadius, String^ aUnit)
 Sets the border color and corner radius for the whole legend. Transparent border colors are allowed.
 
void SetMarginWidth (double aMarginWidth, String^ aUnit)
 Sets the margin width for the whole legend.
 
void SetMinLineHeight (double aLineHeight, String^ aUnit)
 Sets the minimum line height for subsequently added lines.
 
void SetLabelWrapWidth (double aWrapWidth, String^ aUnit)
 Sets the label wrap width for subsequently added lines. Values of zero or less prevent wrapping..
 
void SetFontFamily (String^ aFontFamily)
 Sets the font family for subsequently added lines.
 
void SetFontStyle (uint32_t aStyle)
 Sets the font style for subsequently added lines. The style is made from FontStyleFlag values.
 
void SetFontSize (double aFontSize, String^ aUnit)
 Sets the font size for subsequently added lines.
 
void SetTextColor (Color aTextColor)
 Sets the text color for subsequently added lines.
 
void SetDiagramColor (Color aDiagramColor)
 Sets the diagram color, used for scale bars and turn diagrams, for subsequently added lines.
 
void SetAlignment (Align aAlignment)
 Sets the alignment for labels and scale bars.
 
void SetPolygonRotation (double aDegrees)
 Sets the amount in degrees by which rectangles drawn for polygon legend lines are rotated, for subsequently added lines.
 
bool HasTurnInstruction ()
 Returns true if any of the lines of this legend object is a turn instruction.
 
void 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.
 
String ^ 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.
 

Detailed Description

The Legend class is used to specify legends, scales, copyright notices and turn instructions.

You can these to the map using the Framework functions SetLegend, SetScaleBar, SetCopyrightNotice, and SetTurnInstructions.

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

Member Function Documentation

◆ SetExtraStyleSheet()

void CartoType::Legend::SetExtraStyleSheet ( String^  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.


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