Class: LengthMeasurer

LengthMeasurer(wwd)

new LengthMeasurer(wwd)

Utility class to measure length along a path on a globe.

Segments which are longer then the current maxSegmentLength will be subdivided along lines following the current pathType - WorldWind.LINEAR, WorldWind.RHUMB_LINE or WorldWind.GREAT_CIRCLE.

For follow terrain, the computed length will account for terrain deformations as if someone was walking along that path. Otherwise the length is the sum of the cartesian distance between the positions.

When following terrain the measurer will sample terrain elevations at regular intervals along the path. The minimum number of samples used for the whole length can be set with lengthTerrainSamplingSteps. However, the minimum sampling interval is 30 meters.

Parameters:
Name Type Description
wwd WorldWindow The WorldWindow associated with LengthMeasurer.
Source:
Throws:
If the specified WorldWindow is null or undefined.
Type
ArgumentError

Members

lengthTerrainSamplingSteps :Number

The number of terrain elevation samples used along the path to approximate it's terrain following length.
Type:
  • Number
Source:

maxSegmentLength :Number

The maximum length a segment can have before being subdivided along a line following the current pathType.
Type:
  • Number
Source:

Methods

computeLength(positions, followTerrain, pathType)

Computes the length.
Parameters:
Name Type Description
positions Array.<Position>
followTerrain Boolean
pathType String One of WorldWind.LINEAR, WorldWind.RHUMB_LINE or WorldWind.GREAT_CIRCLE
Source:

getGeographicDistance(path, pathType) → {Number}

Get the great circle, rhumb or linear distance, in meter, of a Path or an array of Positions.
Parameters:
Name Type Description
path Path | Array.<Position> A Path or an array of Positions
pathType String Optional argument used when path is an array of Positions. Defaults to WorldWind.GREAT_CIRCLE. Recognized values are:
  • WorldWind.GREAT_CIRCLE
  • WorldWind.RHUMB_LINE
  • WorldWind.LINEAR
Source:
Returns:
the current path length or -1 if the position list is too short.
Type
Number

getLength(positions, followTerrain, pathType)

Get the path length in meter.

If followTerrain is true, the computed length will account for terrain deformations as if someone was walking along that path. Otherwise the length is the sum of the cartesian distance between each positions.

Parameters:
Name Type Description
positions Array.<Position>
followTerrain Boolean
pathType String One of WorldWind.LINEAR, WorldWind.RHUMB_LINE or WorldWind.GREAT_CIRCLE
Source:
Returns:
the current path length or -1 if the position list is too short.

getPathLength(path)

Get the path length in meter of a Path.

If the path's followTerrain is true, the computed length will account for terrain deformations as if someone was walking along that path. Otherwise the length is the sum of the cartesian distance between each positions.

Parameters:
Name Type Description
path Path
Source:
Returns:
the current path length or -1 if the position list is too short.