Class Geometry

This class contains methods for geometry operations requiring call to Leaflet functions

See theGeometry for the one and only one instance of this class

Source : file core/lib/Geometry.js at line 46

Constructor

new Geometry ( )

The constructor

Source : file core/lib/Geometry.js at line 60

Public methods

addPoints ( point1, point2 )

Add two points

Source : file core/lib/Geometry.js at line 214

Parameters

Name Type Description
point1 Array of Number

The first point to add

point2 Array of Number

The second point to add

Returns

The result point
Type : Array of Number

getClosestLatLngDistance ( route, latLng )

This method search the nearest point on a route from a given point and compute the distance between the beginning of the route and the nearest point

Source : file core/lib/Geometry.js at line 103

Parameters

Name Type Description
route Route

The route object to be used

latLng Array of Number

The latitude and longitude of the point

Returns

An object with the latitude, longitude and distance
Type : LatLngDistance

getLatLngBounds ( latLngs )

This method build a LeafletLatLngBounds object from an array of points

Source : file core/lib/Geometry.js at line 148

Parameters

Name Type Description
latLngs Array of Array of Number

The array of latitude and longitude

Returns

A Leaflet latLngBounds object
Type : LeafletObject

getLatLngElevAtDist ( route, distance )

Compute the latitude, longitude, elevation, ascent and distance of a point on a route when only the distance between the beginning of the route and the point is know

Source : file core/lib/Geometry.js at line 72

Parameters

Name Type Description
route Route

The route

distance Number

The distance (units: meter)

Returns

A LatLngElevOnRoute with the desired values
Type : LatLngElevOnRoute

getSquareBoundingBox ( latLngCenter, dimension )

This method returns a LeafletLatLngBounds that represents a square

Source : file core/lib/Geometry.js at line 168

Parameters

Name Type Description
latLngCenter Array of Number

The latitude and longitude of the center of the square

dimension Number

The half length of the square side in meter.

project ( latLng, zoom )

This method transforms a lat lng coordinate to pixel coordinate relative to the CRS origin using the Leaflet method map.project

Source : file core/lib/Geometry.js at line 190

Parameters

Name Type Description
latLng Array of Number

The latitude and longitude of the point

zoom Number

The zoom factor to use

Returns

An array with the projected point
Type : Array of Number

screenCoordToLatLng ( xScreen, yScreen )

Transform a screen coordinate to a latLng using the Leaflet map.containerPointToLatLng method

Source : file core/lib/Geometry.js at line 202

Parameters

Name Type Description
xScreen Number

The x screen coordinate

yScreen Number

The y screen coordinate

Returns

The latitude and longitude of the point
Type : Array of Number

subtrackPoints ( point1, point2 )

Subtrack two points

Source : file core/lib/Geometry.js at line 228

Parameters

Name Type Description
point1 Array of Number

The first point

point2 Array of Number

The point to subtrack

Returns

The result point
Type : Array of Number

Private getters and setters

readonly static get #HUNDRED : Number

Simple constant for computation

Source : file core/lib/Geometry.js at line 54