Project

General

Profile

API/WMJSDimension

WMJSDimension is used to translate WMS dimensions to objects. The best way to get values for a dimension is by determining its size with size() and using getValueForIndex(index) for getting a value at the specified index.

These methods also work for dimensions defined in the service with a start stop and resolution, e.g. 2000-01-01T00:00:00Z/2013-01-01T00:00:00Z/P1Y. In this case the dimension will have a size of 13 (corresponding to each year), and getValueForIndex will return each year by using an index between 0 and 12. There is also a function which does the reversal, with getIndexForValue it is possible to get the index in the dimension for a given value.

Note that all individual values possible for a dimension with start/stop and resolution, which can be many, are not stored or pre-calculated in the dimension object directly. These are calculated on the fly based on the requested index in getValueForIndex(index). This way a service with many time values stays responsive and takes up little memory.

Configuration

Properties

  • currentValue - The current value of this dimension
  • defaultValue - The default value as given in the service
  • linked - true or false, whether this dimension is linked to other dimension in WMJSMap
  • name - The name of this dimension
  • parentLayer - The layer where this dimension is part of
  • units - The units of the dimension as given in the service
  • values - The values of the dimension as given in the service

Methods

  • getValue() - Returns the current value of the dimension
  • setValue(value) - Sets the new value for this dimension
  • getValueForIndex(index) - Gets the value for this dimension for the specified index, between 0 and size()
  • get(index) - Shorthand for getValueForIndex(index)
  • getIndexForValue(value) - Gets the index corresponding to the given value, returns -1 if not found
  • size() - Returns the number of values in this dimension
  • clone() - Return a copy of this dimension