API Documentation | All Packages | All Classes | Index | Frames No Frames |
Class LineString

Package | org.openscales.core.geometry
Class | public class LineString
Inheritance | LineString MultiPoint Collection Geometry
Subclasses | LinearRing

A LineString is a is a MultiPoint (2 vertices min), whose points are assumed to be connected.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined by
--- | --- | ---
|  | area : Number Calculate the approximate area of this geometry (the projection and the geodesic are not managed). | MultiPoint
|  | bounds : Bounds | Geometry
|  | components : Array Setter of the components (children) of this collection. | Collection
|  | componentsLength : int Number of components in the collection | Collection
|  | componentsString : String Get a string representing the components for this collection | Collection
|  | componentTypes : Array Getter and setter of the authorized types for the components (children) of this collection | Collection
|  | id : String | Geometry
|  | length : Number [read-only] Length getter which iterates through the vertices summing the distances of each edges. | LineString
|  | parent : Geometry | Geometry

Protected Properties
Hide Inherited Protected Properties
Show Inherited Protected Properties

| Property | Defined by
--- | --- | ---
|  | _bounds : Bounds = null The bounds of this geometry | Geometry

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined by
--- | --- | ---
|  | LineString(vertices:Array) LineString constructor | LineString
|  | addComponent(component:Geometry, index:Number):Boolean Add a new component (geometry) to the collection. | Collection
|  | addComponents(vertices:Array):void Add vertices to the end of the LineString | LineString
|  | addPoint(point:Point, index:Number):void Component of the specified index, casted to the Point type | MultiPoint
|  | atPoint(lonlat:LonLat, toleranceLon:Number, toleranceLat:Number):Boolean Determines if the feature is placed at the given point with a certain tolerance (or not). | Geometry
|  | calculateBounds():void Recalculate the bounds by iterating through the components and calling extendBounds() on each item. | Collection
|  | clearBounds():void Clear the geometry's bounds | Geometry
|  | clone():Geometry To get this geometry clone | LineString
|  | componentByIndex(i:int):Geometry Component of the specified index, casted to the Geometry type | Collection
|  | contains(geom:Geometry, assertIntersection:Boolean = false):Boolean Determine if the input geometry is fully contained in this one. | Geometry
|  | containsPoint(p:Point):Boolean Test if a point is inside this geometry. | Collection
|  | destroy():void Destroy the collection. | Collection
|  | distanceTo(geom:Geometry):Number Calculate the closest distance between two geometries (on the x-y plane). | Geometry
|  | extendBounds(newBounds:Bounds):void Extends geometry's bounds If bounds are not defined yet, it initializes the bounds. | Geometry
|  | getcomponentsClone():Array TO get component clone | Collection
|  | getLastPoint():Point | LineString
|  | getPointAt(index:Number):Point | LineString
|  | intersects(geom:Geometry):Boolean Test for instersection between this LineString and a geometry. | LineString
|  | isLeftOrRight(p:Point, p0:Point, p1:Point):Number [static] Test if a point is at the left, at the right or on an infinite line. | Geometry
|  | removeComponent(vertex:Geometry):void Remove a vertex of the LineString. | LineString
|  | removeComponents(components:Array):void Remove components from this geometry. | Collection
|  | removePoint(point:Point):void | MultiPoint
|  | replaceComponent(index:int, component:Geometry):Boolean replace the component of specified index by the input geometry. | Collection
|  | segmentsIntersect(seg1:Array, seg2:Array, tolerance:Number = 0.0):Boolean [static] Determine whether two line segments intersect or not. | Geometry
|  | toShortString():String | MultiPoint
|  | toVertices():Array Return an array of all the vertices (Point) of this geometry | Collection
|  | transform(source:ProjProjection, dest:ProjProjection):void Method to convert the multipoint (x/y) from a projection system to an other. | MultiPoint
|  | transformLineString(source:ProjProjection, dest:ProjProjection):void Method to convert the multipoint (x/y) from a projection system to an other. | LineString

Property detail

length | property

`length:Number` [read-only]

Length getter which iterates through the vertices summing the distances of each edges.

Implementation
`public function get length():Number`
Constructor detail

LineString | () | constructor

`public function LineString(vertices:Array)`

LineString constructor

Parameters

| `vertices:Array` — Array of two or more points

Method detail

addComponents | () | method

`public override function addComponents(vertices:Array):void`

Add vertices to the end of the LineString

Parameters

| `vertices:Array` — the array of vertices to add

clone | () | method |

`public override function clone():Geometry`

To get this geometry clone

Returns

| `Geometry`

getLastPoint | () | method |

`public function getLastPoint():Point`

Returns

| `Point` — the last vertex of the LineString

getPointAt | () | method |

`public function getPointAt(index:Number):Point`

Parameters

| `index:Number` — the index of the attended vertex

Returns

| `Point` — the vertex requested or null for an invalid index

intersects | () | method |

`public override function intersects(geom:Geometry):Boolean`

Test for instersection between this LineString and a geometry. This is a cheapo implementation of the Bentley-Ottmann algorithm but it doesn't really keep track of a sweep line data structure. It is closer to the brute force method, except that segments are X-sorted and potential intersections are only calculated when their bounding boxes intersect.

Parameters

| `geom:Geometry` — the geometry (of any type) to intersect with

Returns

| `Boolean` — a boolean defining if an intersection exist or not

removeComponent | () | method |

`public override function removeComponent(vertex:Geometry):void`

Remove a vertex of the LineString.

Parameters

| `vertex:Geometry` — the vertex of the LineString to remove

transformLineString | () | method |

`public function transformLineString(source:ProjProjection, dest:ProjProjection):void`

Method to convert the multipoint (x/y) from a projection system to an other.

Parameters

| `source:ProjProjection` — The source projection
| `dest:ProjProjection` — The destination projection