Skip to content

LineStyle

Namespace: ThinkGeo.Core

This class is the style used to draw lines.

public class LineStyle : Style

Inheritance ObjectStyleLineStyle

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.

Properties

XOffsetInPixel

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

public float XOffsetInPixel { get; set; }

Property Value

Single
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

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

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.

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.

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.

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.

OuterPenDrawingLevel

public DrawingLevel OuterPenDrawingLevel { get; set; }

Property Value

DrawingLevel

InnerPenDrawingLevel

public DrawingLevel InnerPenDrawingLevel { get; set; }

Property Value

DrawingLevel

CenterPenDrawingLevel

public DrawingLevel CenterPenDrawingLevel { get; set; }

Property Value

DrawingLevel

DirectionPointStyle

public PointStyle DirectionPointStyle { get; set; }

Property Value

PointStyle

DirectionPointInterval

public double DirectionPointInterval { get; set; }

Property Value

Double

DirectionPointMinimumInterval

public double DirectionPointMinimumInterval { get; set; }

Property Value

Double

Name

This property gets and set the name of the style.

public string Name { get; set; }

Property Value

String
This property gets the name of the style.

Remarks:

This name is not used by the system; it is only for the developer. However, it can be used if you generate your own legend.

IsActive

This property gets and sets the active status of the style.

public bool IsActive { get; set; }

Property Value

Boolean
This property gets the active status of the style.

Remarks:

If the style is not active then it will not draw.

RequiredColumnNames

This property gets the collection of fields that are required for the style.

public Collection<string> RequiredColumnNames { get; }

Property Value

Collection<String>

        This property gets the collection of fields that are required for the
        style.

Remarks:

This property gets the collection of fields that are required for the style. These are in addition to any other columns you specify in styles that inherit from this one. For example, if you have use a ValueStyle and it requires a column name for the value comparison, then that column does not need to be in this collection. You only use the RequiredColumnNames for columns you need beyond those required by specific inherited styles.

Filters

public Collection<string> Filters { get; }

Property Value

Collection<String>

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.

Methods

Parse(String)

public static LineStyle Parse(string styleJson)

Parameters

styleJson String

Returns

LineStyle

Parse(JObject)

internal static LineStyle Parse(JObject jObject)

Parameters

jObject JObject

Returns

LineStyle

CreateSimpleLineStyle(GeoColor, Single, Boolean)

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 Single

roundCap Boolean

Returns

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

Remarks:

None

CreateSimpleLineStyle(GeoColor, Single, LineDashStyle, Boolean)

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 Single
This paramter is the the center line width.

centerlineDashStyle LineDashStyle
This parameter is the dash style for the center line.

roundCap Boolean
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, Single, GeoColor, Single, Boolean)

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 Single
This parameter is the inner line width.

outerLineColor GeoColor
This parameter is the outer line color.

outerLineWidth Single
This parameter is the outer line width.

roundCap Boolean
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, Single, LineDashStyle, GeoColor, Single, LineDashStyle, Boolean)

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 Single
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 Single
This parameter is the outer line width.

outerLineDashStyle LineDashStyle
This parameter is the outer line dash style.

roundCap Boolean
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, Single, GeoColor, Single, GeoColor, Single, Boolean)

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 Single
This parameter is the center line width.

innerLineColor GeoColor
This parameter is the inner line color.

innerLineWidth Single
This parameter is the inner line width.

outerLineColor GeoColor
This parameter is the outer line color.

outerLineWidth Single
This parameter is the outer line width.

roundCap Boolean
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, Single, LineDashStyle, GeoColor, Single, LineDashStyle, GeoColor, Single, LineDashStyle, Boolean)

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 Single
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 Single
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 Single
This parameter is the outer line width.

outerLineDashStyle LineDashStyle
This parameter is the outer line dash style.

roundCap Boolean
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 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.

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.

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.

OnDrawingDirectionPoint(DrawingDirectionPointEventArgs)

protected void OnDrawingDirectionPoint(DrawingDirectionPointEventArgs drawingDirectionPointEventArgs)

Parameters

drawingDirectionPointEventArgs DrawingDirectionPointEventArgs

DrawSampleCore(GeoCanvas, DrawingRectangleF)

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

protected void DrawSampleCore(GeoCanvas canvas, DrawingRectangleF drawingExtent)

Parameters

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

drawingExtent DrawingRectangleF

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.

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.

CreateLinePen(String[])

internal static GeoPen CreateLinePen(String[] valueExpressions)

Parameters

valueExpressions String[]

Returns

GeoPen

Events

DrawingDirectionPoint

public event EventHandler<DrawingDirectionPointEventArgs> DrawingDirectionPoint;