CartoType .NET API 7.8.2, 2022-03-25
for development in C#, Visual Basic and other .NET languages
|
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. | |
void | Clear () |
Deletes all legend lines (map objects, text lines and scale bars). | |
Drawing::Bitmap ^ | CreateLegend (double aWidth, String^ aUnit, double aScaleDenominator, double aScaleDenominatorInView, BlendStyleSet^ aBlendStyleSet) |
Creates a legend bitmap for the current set of map objects, text lines and scale bars. More... | |
void | AddMapObjectLine (MapObjectType aType, 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. | |
void | AddTextLine (String^ aText) |
Adds a line of text, using the current font family, font size, text color and minimum line height. | |
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. | |
void | AddTurnLine (bool aMetricUnits, bool aAbbreviate) |
Adds a turn line, using the current font family, font size, alignment, text color and minimum line height. If aMetricUnits is true kilometers and meters are used for the distance to the turn, otherwise miles and yards. | |
void | SetExtraStyleSheet (array< Byte >^ 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 | SetFontFamily (String^ aFontFamily) |
Sets the font family for subsequently added lines. | |
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 | SetAlignment (Align aAlignment) |
Sets the alignment for labels and scale bars. | |
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".
Drawing::Bitmap ^ CartoType::Legend::CreateLegend | ( | double | aWidth, |
String^ | aUnit, | ||
double | aScaleDenominator, | ||
double | aScaleDenominatorInView, | ||
BlendStyleSet^ | aBlendStyleSet | ||
) |
Creates a legend bitmap for the current set of map objects, text lines and scale bars.
In general you should not call this function from application code. It is called automatically when necessary if you add a legend or other notice using Framework.SetLegend, Framework.SetCopyright, etc.
For example, if objects of all the different road types are supplied, a bitmap is created containing horizontal roads of the specified types.
The width does not include the width of any labels drawn to the left of map objects.
The scales are used like this: aScaleDenominator is used to compile the style sheet, and aScaleDenominatorInView is used to draw the scale bar if any; it is the local scale, as opposed to the projection's scale. They can be very different where there is great distortion, as when using the Mercator projection and displaying an area a long way from the equator.
void CartoType::Legend::SetExtraStyleSheet | ( | array< 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 a style sheet containing a single layer, or a small number of layers, and draw a legend for that layer only.