LegendItem¶
Namespace: ThinkGeo.Core
Represents a single row in a legend, including the symbol sample, descriptive text, and layout metadata.
public class LegendItem
Inheritance object → LegendItem
Properties¶
TopPadding¶
Gets or sets the padding applied to the top edge of the entire legend item.
public float TopPadding { get; set; }
Property Value¶
BottomPadding¶
Gets or sets the padding applied to the bottom edge of the entire legend item.
public float BottomPadding { get; set; }
Property Value¶
LeftPadding¶
Gets or sets the padding applied to the left edge of the entire legend item.
public float LeftPadding { get; set; }
Property Value¶
RightPadding¶
Gets or sets the padding applied to the right edge of the entire legend item.
public float RightPadding { get; set; }
Property Value¶
ImageTopPadding¶
Gets or sets the padding between the top of the image column and the symbol.
public float ImageTopPadding { get; set; }
Property Value¶
ImageBottomPadding¶
Gets or sets the padding between the bottom of the image column and the symbol.
public float ImageBottomPadding { get; set; }
Property Value¶
ImageLeftPadding¶
Gets or sets the padding on the left side of the image column.
public float ImageLeftPadding { get; set; }
Property Value¶
ImageRightPadding¶
Gets or sets the padding on the right side of the image column.
public float ImageRightPadding { get; set; }
Property Value¶
TextTopPadding¶
Gets or sets the padding above the text column.
public float TextTopPadding { get; set; }
Property Value¶
TextBottomPadding¶
Gets or sets the padding below the text column.
public float TextBottomPadding { get; set; }
Property Value¶
TextLeftPadding¶
Gets or sets the padding on the left side of the text column.
public float TextLeftPadding { get; set; }
Property Value¶
TextRightPadding¶
Gets or sets the padding on the right side of the text column.
public float TextRightPadding { get; set; }
Property Value¶
Width¶
Gets or sets the total width allocated to the legend item.
public float Width { get; set; }
Property Value¶
Height¶
Gets or sets the total height allocated to the legend item.
public float Height { get; set; }
Property Value¶
ImageWidth¶
Gets or sets the width of the symbol column.
public float ImageWidth { get; set; }
Property Value¶
ImageHeight¶
Gets or sets the height of the symbol column.
public float ImageHeight { get; set; }
Property Value¶
ImageStyle¶
Gets or sets the Style used to draw the symbol sample.
public Style ImageStyle { get; set; }
Property Value¶
TextStyle¶
Gets or sets the LegendItem.TextStyle used to render the legend text.
public TextStyle TextStyle { get; set; }
Property Value¶
BackgroundMask¶
Gets or sets the area style drawn behind the entire legend item.
public AreaStyle BackgroundMask { get; set; }
Property Value¶
TextMask¶
Gets or sets the optional area style rendered behind the text column.
public AreaStyle TextMask { get; set; }
Property Value¶
ImageMask¶
Gets or sets the optional area style rendered behind the image column.
public AreaStyle ImageMask { get; set; }
Property Value¶
Ratio¶
Gets or sets the scaling ratio applied when the legend is resized.
public float Ratio { get; set; }
Property Value¶
ImageJustificationMode¶
Gets or sets the image justification mode that determines whether the symbol appears to the left or right of the text.
public LegendImageJustificationMode ImageJustificationMode { get; set; }
Property Value¶
Constructors¶
LegendItem()¶
Initializes a new instance of the LegendItem class with default dimensions and padding.
public LegendItem()
LegendItem(int, int, float, float, Style, TextStyle)¶
Initializes a new instance of the LegendItem class with the supplied symbol and text settings.
public LegendItem(int width, int height, float imageWidth, float imageHeight, Style imageStyle, TextStyle textStyle)
Parameters¶
width int
Total width in display units that the legend item should occupy.
height int
Total height in display units that the legend item should occupy.
imageWidth float
Width in display units reserved for the symbol column.
imageHeight float
Height in display units reserved for the symbol column.
imageStyle Style
The style that draws the symbol sample.
textStyle TextStyle
The style that renders the legend text.
Methods¶
Draw(GeoCanvas, Collection<SimpleCandidate>, LegendDrawingParameters)¶
Draws the legend item to the specified canvas using the supplied layout parameters.
public void Draw(GeoCanvas adornmentGeoCanvas, Collection<SimpleCandidate> labelsInAllLayers, LegendDrawingParameters legendDrawingParameters)
Parameters¶
adornmentGeoCanvas GeoCanvas
Canvas that is currently rendering the legend.
labelsInAllLayers Collection<SimpleCandidate>
Shared label collection used to manage label collisions.
legendDrawingParameters LegendDrawingParameters
Calculated offsets that determine where the item should be painted.
Returns¶
DrawCore(GeoCanvas, Collection<SimpleCandidate>, LegendDrawingParameters)¶
When overridden in a derived class, renders the legend item symbol and text onto the target canvas.
protected void DrawCore(GeoCanvas adornmentGeoCanvas, Collection<SimpleCandidate> labelsInAllLayers, LegendDrawingParameters legendDrawingParameters)
Parameters¶
adornmentGeoCanvas GeoCanvas
Canvas that is currently drawing.
labelsInAllLayers Collection<SimpleCandidate>
Global label candidate collection.
legendDrawingParameters LegendDrawingParameters
Offsets that describe the item's placement.
Returns¶
UpdateSizeByTextLength(GeoCanvas, double)¶
Updates the width and height of the legend item based on the rendered size of the text at the specified zoom level.
public void UpdateSizeByTextLength(GeoCanvas canvas, double zoomRatio)
Parameters¶
canvas GeoCanvas
Canvas used to measure the text.
zoomRatio double
Scale factor that converts style sizes into the current canvas units.