Skip to content

LineBaseShape

Namespace: ThinkGeo.Core

This abstract class is the root of all line-based shapes, such as LineShape and MultilineShape.

public abstract class LineBaseShape : BaseShape

Inheritance ObjectBaseShapeLineBaseShape

Remarks:

This class is used as the base class for line shapes such as:

LineShape
MultilineShape

It can be inherited from to create your own specialized line geometry. If you choose to do this, your new class must conform to one of the well-known text standard shapes in order for the base implementations to work properly.

Properties

Id

The id of the shape.

public string Id { get; set; }

Property Value

String

Tag

The tag of the shape.

public object Tag { get; set; }

Property Value

Object

Methods

GetLength(GeographyUnit, DistanceUnit)

This method returns the length of the line shape.

public double GetLength(GeographyUnit shapeUnit, DistanceUnit returningUnit)

Parameters

shapeUnit GeographyUnit

        This is the GeographyUnit of the shape you are performing the operation
        on.

returningUnit DistanceUnit

        This is the distance unit you would like to use as the return value. For example, if
        you select miles as your returningUnit, then the distance will be returned in
        miles.

Returns

Double

        This overload returns the length in the unit of your choice, based on
        the returningUnit parameter specified.

Exceptions

ArgumentOutOfRangeException
If you pass in a shapeUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a returningUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

Remarks:

This is a useful method when you want to know the total length of a line-based shape. If the shape is a MultiLineShape, then the length is the sum of all of its lines.

As this is a concrete public method that wraps a Core method, we reserve the right to add events and other logic to pre- or post-process data returned by the Core version of the method. In this way, we leave our framework open on our end, but also allow you the developer to extend our logic to suit your needs. If you have questions about this, please contact our support team as we would be happy to work with you on extending our framework.

GetLengthCore(GeographyUnit, DistanceUnit)

This method returns the length of the line shape.

protected double GetLengthCore(GeographyUnit shapeUnit, DistanceUnit returningUnit)

Parameters

shapeUnit GeographyUnit

        This is the GeographyUnit of the shape you are performing the operation
        on.

returningUnit DistanceUnit

        This is the distance unit you would like to use as the return value. For example, if
        you select miles as your returningUnit, then the distance will be returned in
        miles.

Returns

Double

        This overload returns the length in the unit of your choice, based on
        the returningUnit parameter specified.

Exceptions

ArgumentOutOfRangeException
If you pass in a shapeUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a returningUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

Remarks:

This is a useful method when you want to know the total length of a line-based shape. If the shape is a MultiLineShape, then the length is the sum of all of its lines.


Overriding:

Please ensure that you validate the parameters being passed in and raise the exceptions defined above.

ScaleUp(LineBaseShape, Double)

This method returns a new shape that is increased by the percentage given in the percentage parameter.

public static LineBaseShape ScaleUp(LineBaseShape sourceShape, double percentage)

Parameters

sourceShape LineBaseShape
This parameter is the basis for the scale up up but is not modified.

percentage Double
This is the percentage by which to increase the shape�s size.

Returns

LineBaseShape
a scaled line type shape.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid percentage which is less than 0 will thrown an ArgumentOutOfRangeException.

Remarks:

This method is useful when you would like to increase the size of the shape. Note that a larger percentage will scale the shape up faster as you apply the operation multiple times. There is also a ScaleDown method that will shrink the shape as well.

As this is a concrete public method that wraps a Core method we reserve the right to add events and other logic to pre or post process data returned by the Core version of the method. In this way we leave our framework open on our end but also allow you the developer to extend our logic to your needs. If you have questions about this please contact support as we would be happy to work with you on extending our framework.

ScaleUp(Feature, Double)

This method returns a new feature that is increased by the percentage given in the percentage parameter.

public static Feature ScaleUp(Feature sourceLine, double percentage)

Parameters

sourceLine Feature
This parameter is the basis for the scale up up but is not modified.

percentage Double
This is the percentage by which to increase the shape�s size.

Returns

Feature
a scaled line type feature.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid percentage which is less than 0 will thrown an ArgumentOutOfRangeException.

Remarks:

This method is useful when you would like to increase the size of the feature. Note that a larger percentage will scale the shape up faster as you apply the operation multiple times. There is also a ScaleDown method that will shrink the shape as well.

As this is a concrete public method that wraps a Core method we reserve the right to add events and other logic to pre or post process data returned by the Core version of the method. In this way we leave our framework open on our end but also allow you the developer to extend our logic to your needs. If you have questions about this please contact support as we would be happy to work with you on extending our framework.

ScaleUp(Double)

This method increases the size of the LineShape by the percentage given in the percentage parameter.

public void ScaleUp(double percentage)

Parameters

percentage Double
This is the percentage by which to increase the shape�s size.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid percentage which is less than 0 will thrown an ArgumentOutOfRangeException.

Remarks:

This method is useful when you would like to increase the size of the shape. Note that a larger percentage will scale the shape up faster as you apply the operation multiple times. There is also a ScaleDown method that will shrink the shape as well.

As this is a concrete public method that wraps a Core method we reserve the right to add events and other logic to pre or post process data returned by the Core version of the method. In this way we leave our framework open on our end but also allow you the developer to extend our logic to your needs. If you have questions about this please contact support as we would be happy to work with you on extending our framework.

ScaleUpCore(Double)

This method increases the size of the LineShape by the percentage given in the percentage parameter.

protected void ScaleUpCore(double percentage)

Parameters

percentage Double
This is the percentage by which to increase the shape�s size.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid percentage which is less than 0 will thrown an ArgumentOutOfRangeException.

Remarks:

This method is useful when you would like to increase the size of the shape. Note that a larger percentage will scale the shape up faster as you apply the operation multiple times. There is also a ScaleDown method that will shrink the shape as well.


Overriding:

Please ensure that you validate the parameters being passed in and raise the exceptions defined above.

ScaleDown(LineBaseShape, Double)

This method returns a new shape that is decreases by the percentage given in the percentage parameter.

public static LineBaseShape ScaleDown(LineBaseShape sourceLineBaseShape, double percentage)

Parameters

sourceLineBaseShape LineBaseShape
This parameter is the basis for the scale up up but is not modified.

percentage Double
This is the percentage by which to decrease the shape�s size.

Returns

LineBaseShape
a scaled down line type shape.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid percentage which is less than 0 will thrown an ArgumentOutOfRangeException.

Remarks:

This method is useful when you would like to decrease the size of the shape. Note that a larger percentage will scale the shape down faster as you apply the operation multiple times. There is also a ScaleUp method that will enlarge the shape as well.

As this is a concrete public method that wraps a Core method we reserve the right to add events and other logic to pre or post process data returned by the Core version of the method. In this way we leave our framework open on our end but also allow you the developer to extend our logic to your needs. If you have questions about this please contact support as we would be happy to work with you on extending our framework.

ScaleDown(Feature, Double)

This method returns a new feature that is decreases by the percentage given in the percentage parameter.

public static Feature ScaleDown(Feature sourceLine, double percentage)

Parameters

sourceLine Feature
This parameter is the basis for the scale up up but is not modified.

percentage Double
This is the percentage by which to decrease the shape�s size.

Returns

Feature
a scaled down line type feature.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid percentage which is less than 0 will thrown an ArgumentOutOfRangeException.

Remarks:

This method is useful when you would like to decrease the size of the feature. Note that a larger percentage will scale the shape down faster as you apply the operation multiple times. There is also a ScaleUp method that will enlarge the shape as well.

As this is a concrete public method that wraps a Core method we reserve the right to add events and other logic to pre or post process data returned by the Core version of the method. In this way we leave our framework open on our end but also allow you the developer to extend our logic to your needs. If you have questions about this please contact support as we would be happy to work with you on extending our framework.

ScaleDown(Double)

This method decreases the size of the LineShape by the percentage given in the percentage parameter.

public void ScaleDown(double percentage)

Parameters

percentage Double
This is the percentage by which to decrease the shape�s size.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid percentage which is less than 0 will thrown an ArgumentOutOfRangeException.

Remarks:

This method is useful when you would like to decrease the size of the shape. Note that a larger percentage will scale the shape down faster as you apply the operation multiple times. There is also a ScaleUp method that will enlarge the shape as well.

As this is a concrete public method that wraps a Core method we reserve the right to add events and other logic to pre or post process data returned by the Core version of the method. In this way we leave our framework open on our end but also allow you the developer to extend our logic to your needs. If you have questions about this please contact support as we would be happy to work with you on extending our framework.

ScaleDownCore(Double)

This method decreases the size of the LineShape by the percentage given in the percentage parameter.

protected void ScaleDownCore(double percentage)

Parameters

percentage Double
This is the percentage by which to decrease the shape�s size.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid percentage which is less than 0 will thrown an ArgumentOutOfRangeException.

Remarks:

This method is useful when you would like to decrease the size of the shape. Note that a larger percentage will scale the shape down faster as you apply the operation multiple times. There is also a ScaleUp method that will enlarge the shape as well.


Overriding:

Please ensure that you validate the parameters being passed in and raise the exceptions defined above.

GetLength(Int32, DistanceUnit)

public double GetLength(int shapeSrid, DistanceUnit returningUnit)

Parameters

shapeSrid Int32

returningUnit DistanceUnit

Returns

Double

GetLength(String, DistanceUnit)

public double GetLength(string shapeProj4ProjectionParameters, DistanceUnit returningUnit)

Parameters

shapeProj4ProjectionParameters String

returningUnit DistanceUnit

Returns

Double

GetLength(Projection, DistanceUnit)

public double GetLength(Projection shapeProjection, DistanceUnit returningUnit)

Parameters

shapeProjection Projection

returningUnit DistanceUnit

Returns

Double

GetLength(Int32, DistanceUnit, DistanceCalculationMode)

public double GetLength(int shapeSrid, DistanceUnit returningUnit, DistanceCalculationMode distanceCalculationMode)

Parameters

shapeSrid Int32

returningUnit DistanceUnit

distanceCalculationMode DistanceCalculationMode

Returns

Double

GetLength(String, DistanceUnit, DistanceCalculationMode)

public double GetLength(string shapeProj4ProjectionParameters, DistanceUnit returningUnit, DistanceCalculationMode distanceCalculationMode)

Parameters

shapeProj4ProjectionParameters String

returningUnit DistanceUnit

distanceCalculationMode DistanceCalculationMode

Returns

Double

GetLength(Projection, DistanceUnit, DistanceCalculationMode)

public double GetLength(Projection shapeProjection, DistanceUnit returningUnit, DistanceCalculationMode distanceCalculationMode)

Parameters

shapeProjection Projection

returningUnit DistanceUnit

distanceCalculationMode DistanceCalculationMode

Returns

Double

GetLengthCore(Projection, DistanceUnit, DistanceCalculationMode)

protected double GetLengthCore(Projection shapeProjection, DistanceUnit returningUnit, DistanceCalculationMode distanceCalculationMode)

Parameters

shapeProjection Projection

returningUnit DistanceUnit

distanceCalculationMode DistanceCalculationMode

Returns

Double

ConvexHull()

This method returns the convex hull of the shape defined as the smallest convex ring that contains all the points in the shape.

public RingShape ConvexHull()

Returns

RingShape

        This method returns a RingShape defined as the smallest convex ring that contains
        all the points in the shape.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

Remarks:

This method is useful when you want to create a perimeter around the shape. For example if you had a MultiPolygon which represented buildings in a campus you could easily get the convex hull of the buildings and determine the perimeter of all of the buildings together. This also works with MultiPoint shapes where each point may represent a certain type of person you are doing statistics on. With convex hull you can get an idea of the regions those points are located in.

As this is a concrete public method that wraps a Core method we reserve the right to add events and other logic to pre or post process data returned by the Core version of the method. In this way we leave our framework open on our end but also allow you the developer to extend our logic to your needs. If you have questions about this please contact support as we would be happy to work with you on extending our framework.

ConvexHullCore()

This method returns the convex hull of the shape defined as the smallest convex ring that contains all the points in the shape.

protected RingShape ConvexHullCore()

Returns

RingShape

        This method returns a RingShape defined as the smallest convex ring that contains
        all the points in the shape.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

Remarks:

This method is useful when you want to create a perimeter around the shape. For example, if you had a MultiPolygon that represented buildings on a campus, you could easily get the convex hull of the buildings and determine the perimeter of all of the buildings together. This also works with MultiPoint shapes, where each point may represent a certain type of person you are doing statistics on. With convex hull, you can get an idea of the regions those points are located in.

Simplify(LineBaseShape, GeographyUnit, Double, DistanceUnit, SimplificationType)

Simplify the LineBaseShape to MultilineShape depends on distance tolerance and different SimplificationType.

public static MultilineShape Simplify(LineBaseShape targetShape, GeographyUnit targetShapeUnit, double tolerance, DistanceUnit toleranceUnit, SimplificationType simplificationType)

Parameters

targetShape LineBaseShape
target shape which will be simplified.

targetShapeUnit GeographyUnit
the geography unit of the target shape

tolerance Double
distance tolerance

toleranceUnit DistanceUnit
the distance unit of tolerance

simplificationType SimplificationType
Specifies which algorthm will be use to simplify.

Returns

MultilineShape
Simplify the LineBaseShape to MultilineShape depends on distance tolerance and different SimplificationType.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid tolerance which is less than 0 will thrown an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
Passing an invalid simplificationType will thrown an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
Passing an invalid shapeUnit will thrown an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
Passing an invalid toleranceUnit will thrown an ArgumentOutOfRangeException.

Simplify(LineBaseShape, Double, SimplificationType)

Simplify the LineBaseShape to MultilineShape depends on distance tolerance and different SimplificationType.

public static MultilineShape Simplify(LineBaseShape targetShape, double tolerance, SimplificationType simplificationType)

Parameters

targetShape LineBaseShape
target shape which will be simplified.

tolerance Double
distance tolerance

simplificationType SimplificationType
Specifies which algorthm will be use to simplify.

Returns

MultilineShape
Simplify the LineBaseShape to MultilineShape depends on distance tolerance and different SimplificationType.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid tolerance which is less than 0 will thrown an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
Passing an invalid simplificationType will thrown an ArgumentOutOfRangeException.

Simplify(GeographyUnit, Double, DistanceUnit, SimplificationType)

Simplify the LineBaseShape to MultilineShape depends on distance tolerance and different SimplificationType.

public MultilineShape Simplify(GeographyUnit shapeUnit, double tolerance, DistanceUnit toleranceUnit, SimplificationType simplificationType)

Parameters

shapeUnit GeographyUnit
the geography unit of the target shape

tolerance Double
distance tolerance

toleranceUnit DistanceUnit
the distance unit of tolerance

simplificationType SimplificationType
Specifies which algorthm will be use to simplify.

Returns

MultilineShape
Simplify the LineBaseShape to MultilineShape depends on distance tolerance and different SimplificationType.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid tolerance which is less than 0 will thrown an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
Passing an invalid simplificationType will thrown an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
Passing an invalid shapeUnit will thrown an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
Passing an invalid toleranceUnit will thrown an ArgumentOutOfRangeException.

Simplify(Double, SimplificationType)

Simplify the LineBaseShape to MultilineShape depends on distance tolerance and different SimplificationType.

public MultilineShape Simplify(double tolerance, SimplificationType simplificationType)

Parameters

tolerance Double
distance tolerance

simplificationType SimplificationType
Specifies which algorthm will be use to simplify.

Returns

MultilineShape
Simplify the LineBaseShape to MultilineShape depends on distance tolerance and different SimplificationType.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid tolerance which is less than 0 will thrown an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
Passing an invalid simplificationType will thrown an ArgumentOutOfRangeException.

SimplifyCore(Double, SimplificationType)

Simplify the LineBaseShape to MultilineShape depends on distance tolerance and different SimplificationType.

protected MultilineShape SimplifyCore(double tolerance, SimplificationType simplificationType)

Parameters

tolerance Double
distance tolerance

simplificationType SimplificationType
Specifies which algorthm will be use to simplify.

Returns

MultilineShape
Simplify the LineBaseShape to MultilineShape depends on distance tolerance and different SimplificationType.

Exceptions

InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid tolerance which is less than 0 will thrown an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
Passing an invalid simplificationType will thrown an ArgumentOutOfRangeException.

Union(LineBaseShape)

Calculates a new geometry that contains all the points in this LineBaseShape and input LineBaseShape

public MultilineShape Union(LineBaseShape targetShape)

Parameters

targetShape LineBaseShape
The target LineBasheShape with which to compute the union

Returns

MultilineShape
A set combining the points of this LineBaseShape and the points of input LineBaseShape.

Union(IEnumerable<LineBaseShape>)

Calculates a new geometry that contains all the points in this LineBaseShape and input LineBaseShape set.

public static MultilineShape Union(IEnumerable<LineBaseShape> lineBaseShapes)

Parameters

lineBaseShapes IEnumerable<LineBaseShape>

Returns

MultilineShape
A set combining the points of this LineBaseShape and the points of input LineBaseShape set.

Union(Feature)

public MultilineShape Union(Feature targetFeature)

Parameters

targetFeature Feature

Returns

MultilineShape

Union(IEnumerable<Feature>)

public static MultilineShape Union(IEnumerable<Feature> targetFeatures)

Parameters

targetFeatures IEnumerable<Feature>

Returns

MultilineShape

UnionCore(IEnumerable<LineBaseShape>)

The protected virtual method used by "Union" that you can overwrite to implement your own logic.

protected MultilineShape UnionCore(IEnumerable<LineBaseShape> lineBaseShapes)

Parameters

lineBaseShapes IEnumerable<LineBaseShape>
The target LineBasheShape set with which to compute the union

Returns

MultilineShape
A set combining the points of this LineBaseShape and the points of input LineBaseShape set.

GetIntersection(Feature)

public MultilineShape GetIntersection(Feature targetFeature)

Parameters

targetFeature Feature

Returns

MultilineShape

GetIntersection(AreaBaseShape)

public MultilineShape GetIntersection(AreaBaseShape targetShape)

Parameters

targetShape AreaBaseShape

Returns

MultilineShape

GetIntersectionCore(AreaBaseShape)

protected MultilineShape GetIntersectionCore(AreaBaseShape targetShape)

Parameters

targetShape AreaBaseShape

Returns

MultilineShape

IsPointBetweenVerteces(Vertex, Vertex, PointShape)

internal static bool IsPointBetweenVerteces(Vertex vertex1, Vertex vertex2, PointShape point)

Parameters

vertex1 Vertex

vertex2 Vertex

point PointShape

Returns

Boolean

Snap(IEnumerable<LineBaseShape>, GeographyUnit, Double, DistanceUnit)

Simplify the LineShapes by snapping vertexes based on specified tolerance distance.

public static Collection<LineShape> Snap(IEnumerable<LineBaseShape> shapes, GeographyUnit shapeUnit, double snappingTolerance, DistanceUnit toleranceUnit)

Parameters

shapes IEnumerable<LineBaseShape>
target shapes which will be simplified

shapeUnit GeographyUnit
the geography unit of the target shapes

snappingTolerance Double
distance tolerance

toleranceUnit DistanceUnit
the distance unit of tolerance

Returns

Collection<LineShape>
Simplified lineshape depends on distance tolerance of each vertexes.

Exceptions

InvalidOperationException
In the event you attempt to call this method on an empty ineBaseShapes collection, it will throw an InvalidOperationException.

ArgumentOutOfRangeException
Passing an invalid tolerance which is less than 0 will thrown an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
Passing an invalid shapeUnit will thrown an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
Passing an invalid toleranceUnit will thrown an ArgumentOutOfRangeException.