Skip to content

VTS Browser Utility API

David Levinsky edited this page May 9, 2019 · 2 revisions

Proj4

Usage of the Proj4.js library is documented at this page.

Math

Method Returns Description
isEqual(<Number> a, <Number> b, delta) Bool Compares two number with delta tolerance.
clamp(<Number> a, <Number> min, <Number> max) Number Clamps provided number into the min, max range
radians(<Number> a) Number Converts degrees to the radians
degrees(<Number> a) Number Converts radians to the degrees

Vec3, Vec4, Mat3, Mat4

Usage of these interfaces is very similar to glMatrix whic is documented at this page.

  • mat4 is a 4x4 row major matrix (array of 16 numbers)
  • mat3 is a 3x3 row major matrix (array of 9 numbers)
  • vec3 is an array of 3 numbers [x,y,z]
  • vec4 is an array of 3 numbers [x,y,z,w]

Dom

Method Returns Description
preventDefault(<Event> e) Null More about function
stopPropagation(<Event> e) Null More about function

Utility

Method Returns Description
loadImage(<String> URL, <Function> onLoaded, <Function> onError) Image Creates a DOM image object from the provided URL which points to the image resource. Once the image is loaded the onLoaded function is called. If some error occurs the onError function is called.
loadJSON(<String> URL, <Function> onLoaded, <Function> onError) null Loads a JSON from the provided URL. Once the JSON is loaded the onLoaded(data) function is called. The first argument of this function is a data object with the file content. If an error occurs the onError function is called.
loadBinary(<String> URL, <Function> onLoaded, <Function> onError) null Loads a binary file from the provided URL. Once the file is loaded the onLoaded(data) function is called. The first argument of this function is an array buffer object with the file content. If an error occurs the onError function is called.