CartoType .NET API 8.8-7-gb35e4dc71
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, 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 the default feature is used (unknown non-route). | |
void | AddMapObjectLine (MapObjectType aType, String^ aLayer, FeatureType aFeatureType, 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 (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 | SetMainStyleSheet (array< Byte >^ aData) |
Sets the main style sheet, replacing the style sheet copied from the Framework parameter to the Legend constructor. | |
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 | 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 | 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. | |
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.