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 than 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

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.

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

Gets or sets the OuterPenDrawingLevel.

public DrawingLevel OuterPenDrawingLevel { get; set; }

Property Value

DrawingLevel

InnerPenDrawingLevel

Gets or sets the InnerPenDrawingLevel.

public DrawingLevel InnerPenDrawingLevel { get; set; }

Property Value

DrawingLevel

CenterPenDrawingLevel

Gets or sets the CenterPenDrawingLevel.

public DrawingLevel CenterPenDrawingLevel { get; set; }

Property Value

DrawingLevel

DirectionPointStyle

Gets or sets the DirectionPointStyle.

public PointStyle DirectionPointStyle { get; set; }

Property Value

PointStyle

DirectionPointInterval

Gets or sets the DirectionPointInterval.

public double DirectionPointInterval { get; set; }

Property Value

double

DirectionPointMinimumInterval

Gets or sets the 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

bool
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>

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

Gets the list of SQL-style filters applied to this style.

public Collection<string> Filters { get; }

Property Value

Collection<string>

LabelDisplayMode

Gets the current label display mode that determines whether labels, shapes, or both are rendered.

public LabelDisplayMode LabelDisplayMode { get; }

Property Value

LabelDisplayMode

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)

Parses the specified input and returns the corresponding value.

public static LineStyle Parse(string styleJson)

Parameters

styleJson string
The style JSON.

Returns

LineStyle
The result of the operation.

4xU=(JObject)

internal static LineStyle 4xU=(JObject jObject)

Parameters

jObject JObject

Returns

LineStyle

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, 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 parameter 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, 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, 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, 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, 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 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.

Returns

void
None

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)

Performs on drawing direction point.

protected void OnDrawingDirectionPoint(DrawingDirectionPointEventArgs drawingDirectionPointEventArgs)

Parameters

drawingDirectionPointEventArgs DrawingDirectionPointEventArgs
The rectangle that defines the area of interest.

Returns

void

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
Specifies the drawingExtent.

Returns

void
None

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.

FTM=(String[])

internal static GeoPen FTM=(String[] valueExpressions)

Parameters

valueExpressions String[]

Returns

GeoPen

Events

DrawingDirectionPoint

Occurs when the DrawingDirectionPoint event is raised.

public event EventHandler<DrawingDirectionPointEventArgs> DrawingDirectionPoint;