Table of Contents

Class LineStyle

Namespace
ThinkGeo.Core
Assembly
ThinkGeo.Core.dll

This class is the style used to draw lines.

public class LineStyle : Style
Inheritance
LineStyle
Derived
Inherited Members

Remarks

This class is commonly used to draw lines on the GeoCanvas. It is specialized for drawing roads, as this is the main kind of line feature that is most often drawn. You can set an inner, outer and center pen to give you a nice effect. The outer pen draws first, and should typically be black and larger then the inner pen. The inner pen draws next, and should be set as the color of the road you want. It should be thinner than the outer pen. The center pen draws last, and is used to represent a centerline in the road. We suggest that you only use the center pen for highways at low zoom level, as the dashed pen has some performance penalties.

Constructors

LineStyle()

This is a constructor for the class.

public LineStyle()

LineStyle(GeoPen)

This is a constructor for the class.

public LineStyle(GeoPen outerPen)

Parameters

outerPen GeoPen

This parameter is the outer pen used to draw the feature.

Remarks

Use this when you do not need any additional pens to draw the feature.

LineStyle(GeoPen, GeoPen)

This is a constructor for the class.

public LineStyle(GeoPen outerPen, GeoPen innerPen)

Parameters

outerPen GeoPen

This parameter is the outer pen used to draw the feature.

innerPen GeoPen

This parameter is the inner pen used to draw the feature.

Remarks

This is a common constructor for drawing roads.

LineStyle(GeoPen, GeoPen, GeoPen)

This is a constructor for the class.

public LineStyle(GeoPen outerPen, GeoPen innerPen, GeoPen centerPen)

Parameters

outerPen GeoPen

This parameter is the outer pen used to draw the feature.

innerPen GeoPen

This parameter is the inner pen used to draw the feature.

centerPen GeoPen

This parameter is the center pen used to draw the feature.

Remarks

This is common for drawing low level highways with center lines.

Properties

CenterPen

This property gets and sets the center pen for the line.

public GeoPen CenterPen { get; set; }

Property Value

GeoPen

This property gets the center pen for the line.

Remarks

You can set an inner, outer and center pen to give you a nice effect. The outer pen draws first, and should typically be black and larger then the inner pen. The inner pen draws next, and should be set as the color of the road you want. It should be thinner than the outer pen. The center pen draws last, and is used to represent a centerline in the road. We suggest that you only use the center pen for highways at low zoom level, as the dashed pen has some performance penalties.

CenterPenDrawingLevel

public DrawingLevel CenterPenDrawingLevel { get; set; }

Property Value

DrawingLevel

CustomLineStyles

This property returns a collection of line styles, allowing you to stack multiple line styles on top of each other.

public Collection<LineStyle> CustomLineStyles { get; }

Property Value

Collection<LineStyle>

This property returns a collection of line styles.

Remarks

Using this collection, you can stack multiple styles on top of each other. When we draw the feature, we will draw them in order that they exist in the collection. You can use these stacks to create drop shadow effects, multiple colored outlines, etc.

DirectionPointInterval

public double DirectionPointInterval { get; set; }

Property Value

double

DirectionPointMinimumInterval

public double DirectionPointMinimumInterval { get; set; }

Property Value

double

DirectionPointStyle

public PointStyle DirectionPointStyle { get; set; }

Property Value

PointStyle

InnerPen

This property gets and sets the inner pen for the line.

public GeoPen InnerPen { get; set; }

Property Value

GeoPen

This property gets the inner pen for the line.

Remarks

You can set an inner, outer and center pen to give you a nice effect. The outer pen draws first, and should typically be black and larger then the inner pen. The inner pen draws next, and should be set as the color of the road you want. It should be thinner than the outer pen. The center pen draws last, and is used to represent a centerline in the road. We suggest that you only use the center pen for highways at low zoom level, as the dashed pen has some performance penalties.

InnerPenDrawingLevel

public DrawingLevel InnerPenDrawingLevel { get; set; }

Property Value

DrawingLevel

OuterPen

This property gets and sets the outer pen for the line.

public GeoPen OuterPen { get; set; }

Property Value

GeoPen

This property gets the outer pen for the line.

Remarks

You can set an inner, outer and center pen to give you a nice effect. The outer pen draws first, and should typically be black and larger then the inner pen. The inner pen draws next, and should be set as the color of the road you want. It should be thinner than the outer pen. The center pen draws last, and is used to represent a centerline in the road. We suggest that you only use the center pen for highways at low zoom level, as the dashed pen has some performance penalties.

OuterPenDrawingLevel

public DrawingLevel OuterPenDrawingLevel { get; set; }

Property Value

DrawingLevel

XOffsetInPixel

This property gets and sets the X pixel offset for drawing each feature.

public float XOffsetInPixel { get; set; }

Property Value

float

This property gets the X pixel offset for drawing each feature.

Remarks

This property allows you to specify an X offset. When combined with a Y offset, it is useful to allow you to achieve effects such as drop shadows, etc. There also may be times when you need to modify the location of feature data so as to better align it with raster satellite data.

YOffsetInPixel

This property gets and sets the Y pixel offset for drawing each feature.

public float YOffsetInPixel { get; set; }

Property Value

float

This property gets the Y pixel offset for drawing each feature.

Remarks

This property allows you to specify an Y offset. When combined with an X offset, it is useful to allow you to achieve effects such as drop shadows, etc. There also may be times when you need to modify the location of feature data so as to better align it with raster satellite data.

Methods

CreateSimpleLineStyle(GeoColor, float, bool)

This method returns a LineStyle based on the parameters passed in.

public static LineStyle CreateSimpleLineStyle(GeoColor centerlineColor, float centerlineWidth, bool roundCap)

Parameters

centerlineColor GeoColor
centerlineWidth float
roundCap bool

Returns

LineStyle

This method returns a LineStyle based on the parameters passed in.

Remarks

None

CreateSimpleLineStyle(GeoColor, float, GeoColor, float, bool)

This method returns a LineStyle based on the parameters passed in.

public static LineStyle CreateSimpleLineStyle(GeoColor innerLineColor, float innerLineWidth, GeoColor outerLineColor, float outerLineWidth, bool roundCap)

Parameters

innerLineColor GeoColor

This parameter is the inner line color.

innerLineWidth float

This parameter is the inner line width.

outerLineColor GeoColor

This parameter is the outer line color.

outerLineWidth float

This parameter is the outer line width.

roundCap bool

This parameter defines whether you want a rounded end cap.

Returns

LineStyle

This method returns a LineStyle based on the parameters passed in.

Remarks

None

CreateSimpleLineStyle(GeoColor, float, GeoColor, float, GeoColor, float, bool)

This method returns a LineStyle based on the parameters passed in.

public static LineStyle CreateSimpleLineStyle(GeoColor centerlineColor, float centerlineWidth, GeoColor innerLineColor, float innerLineWidth, GeoColor outerLineColor, float outerLineWidth, bool roundCap)

Parameters

centerlineColor GeoColor

This parameter is the center line color.

centerlineWidth float

This parameter is the center line width.

innerLineColor GeoColor

This parameter is the inner line color.

innerLineWidth float

This parameter is the inner line width.

outerLineColor GeoColor

This parameter is the outer line color.

outerLineWidth float

This parameter is the outer line width.

roundCap bool

This parameter defines whether you want a rounded end cap.

Returns

LineStyle

This method returns a LineStyle based on the parameters passed in.

Remarks

None

CreateSimpleLineStyle(GeoColor, float, LineDashStyle, bool)

This method returns a LineStyle based on the parameters passed in.

public static LineStyle CreateSimpleLineStyle(GeoColor centerlineColor, float centerlineWidth, LineDashStyle centerlineDashStyle, bool roundCap)

Parameters

centerlineColor GeoColor

This parameter is the center line color.

centerlineWidth float

This paramter is the the center line width.

centerlineDashStyle LineDashStyle

This parameter is the dash style for the center line.

roundCap bool

This parameter defines whether you want a rounded end cap.

Returns

LineStyle

This method returns a LineStyle based on the parameters passed in.

Remarks

None

CreateSimpleLineStyle(GeoColor, float, LineDashStyle, GeoColor, float, LineDashStyle, bool)

This method returns a LineStyle based on the parameters passed in.

public static LineStyle CreateSimpleLineStyle(GeoColor innerLineColor, float innerLineWidth, LineDashStyle innerLineDashStyle, GeoColor outerLineColor, float outerLineWidth, LineDashStyle outerLineDashStyle, bool roundCap)

Parameters

innerLineColor GeoColor

This parameter is the inner line color.

innerLineWidth float

This parameter is the inner line width.

innerLineDashStyle LineDashStyle

This parameter is the inner line dash style.

outerLineColor GeoColor

This parameter is the outer line color.

outerLineWidth float

This parameter is the outer line width.

outerLineDashStyle LineDashStyle

This parameter is the outer line dash style.

roundCap bool

This parameter defines whether you want a rounded end cap.

Returns

LineStyle

This method returns a LineStyle based on the parameters passed in.

Remarks

None

CreateSimpleLineStyle(GeoColor, float, LineDashStyle, GeoColor, float, LineDashStyle, GeoColor, float, LineDashStyle, bool)

This method returns a LineStyle based on the parameters passed in.

public static LineStyle CreateSimpleLineStyle(GeoColor centerlineColor, float centerlineWidth, LineDashStyle centerlineDashStyle, GeoColor innerLineColor, float innerLineWidth, LineDashStyle innerLineDashStyle, GeoColor outerLineColor, float outerLineWidth, LineDashStyle outerLineDashStyle, bool roundCap)

Parameters

centerlineColor GeoColor

This parameter is the center line color.

centerlineWidth float

This parameter is the center line width.

centerlineDashStyle LineDashStyle

This parameter is the center line dash style.

innerLineColor GeoColor

This parameter is the inner line color.

innerLineWidth float

This parameter is the inner line width.

innerLineDashStyle LineDashStyle

This parameter is the inner line dash style.

outerLineColor GeoColor

This parameter is the outer line color.

outerLineWidth float

This parameter is the outer line width.

outerLineDashStyle LineDashStyle

This parameter is the outer line dash style.

roundCap bool

This parameter defines whether you want a rounded end cap.

Returns

LineStyle

This method returns a LineStyle based on the parameters passed in.

Remarks

None

DrawCore(IEnumerable<Feature>, GeoCanvas, Collection<SimpleCandidate>, Collection<SimpleCandidate>)

This method draws the features on the view you provided.

protected override void DrawCore(IEnumerable<Feature> features, GeoCanvas canvas, Collection<SimpleCandidate> labelsInThisLayer, Collection<SimpleCandidate> labelsInAllLayers)

Parameters

features IEnumerable<Feature>

This parameter represents the features you want to draw on the view.

canvas GeoCanvas

This parameter represents the view you want to draw the features on.

labelsInThisLayer Collection<SimpleCandidate>

The labels will be drawn in the current layer only.

labelsInAllLayers Collection<SimpleCandidate>

The labels will be drawn in all layers.

Remarks

This overridden method is called from the concrete public method Draw. In this method, we take the features you passed in and draw them on the view you provided. Each style (based on its properties) may draw each feature differently.


When overriding this method, consider each feature and its column data values. You can use the full power of the GeoCanvas to do the drawing. If you need column data for a feature, be sure to override the GetRequiredColumnNamesCore and add the columns you need to the collection. In many of the styles, we add properties to allow the user to specify which field they need; then, in the GetRequiredColumnNamesCore, we read that property and add it to the collection.

Exceptions

InvalidOperationException

In the event you attempt to call this method when the GeoCanvas's IsDrawing mode is false, it will throw an InvalidOperationException.

ArgumentNullException

If you pass a null as the view, we will throw an ArgumentNullException.

ArgumentNullException

If you pass a null as the features, we will throw an ArgumentNullException.

ArgumentNullException

If OuterPen is null, we will throw an ArgumentNullException.

ArgumentNullException

If InnerPen is null, we will throw an ArgumentNullException.

ArgumentNullException

If CenterPen is null, we will throw an ArgumentNullException.

DrawSampleCore(GeoCanvas, DrawingRectangleF)

This method draws a sample feature on the view you provided.

protected override void DrawSampleCore(GeoCanvas canvas, DrawingRectangleF drawingExtent)

Parameters

canvas GeoCanvas

This parameter represents the view you want to draw the features on.

drawingExtent DrawingRectangleF

Remarks

This virtual method is called from the concrete public method Draw. In this method, we draw a sample style on the view you provided. This is typically used to display a legend or other sample area.

When implementing this virtual method, consider the view size and draw the sample image appropriately. You should keep in mind that the sample typically shows up on a legend.

Exceptions

ArgumentNullException

If you pass a null as the view, we will throw an ArgumentNullException.

InvalidOperationException

In the event you attempt to call this method when the GeoCanvas's IsDrawing mode is false, it will throw an InvalidOperationException.

OnDrawingDirectionPoint(DrawingDirectionPointEventArgs)

protected virtual void OnDrawingDirectionPoint(DrawingDirectionPointEventArgs drawingDirectionPointEventArgs)

Parameters

drawingDirectionPointEventArgs DrawingDirectionPointEventArgs

Parse(string)

public static LineStyle Parse(string styleJson)

Parameters

styleJson string

Returns

LineStyle

Events

DrawingDirectionPoint

public event EventHandler<DrawingDirectionPointEventArgs> DrawingDirectionPoint

Event Type

EventHandler<DrawingDirectionPointEventArgs>