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

Package | org.openscales.core
Class | public class Util

Public Methods

| Method | Defined by
--- | --- | ---
|  | Util() | Util
|  | degToDMS(dec:Number, locals:Array = null, numDigits:Number = 1):String [static] Convert decimal degrees number into sexagecimal degrees string. | Util
|  | dmsToDeg(dms:String):Number [static] Convert a string representation of a sexagecimal degrees into a numeric representation of decimal degrees. | Util
|  | extend(destination:Object, source:Object):Object [static] Copy all properties of a source object to a destination object. | Util
|  | getArgs(url:String = null):Object [static] Get Ags | Util
|  | getParameterString(params:Object):String [static] Get parameter | Util
|  | hypot(x:Number, y:Number):Number Return sqrt(x2 +y2) without intermediate overflow or underflow. | Util
|  | indexOf(array:Array, obj:Object):int [static] Get the index of an object in an array | Util
|  | mouseLeft(evt:MouseEvent, can:DisplayObject):Boolean [static] | Util
|  | normalizeScale(scale:Number):Number [static] Normalise scale | Util
|  | pagePosition(forElement:Object):Array [static] | Util
|  | removeItem(array:Array, item:Object):Array [static] Remove an item of an array | Util
|  | upperCaseObject(object:Object):Object [static] Store all the keys of the Object in uppercase | Util

Constructor detail

Util | () | constructor

`public function Util()`
Method detail

degToDMS | () | method

`public static function degToDMS(dec:Number, locals:Array = null, numDigits:Number = 1):String`

Convert decimal degrees number into sexagecimal degrees string.

Parameters

| `dec:Number` — decimal degrees.
| `locals:Array` (default = `null`)`` — the axis direction (N, S) or (E, W). If undefined, null or empty, the leading minus will prefix the decimal degrees string.
| `numDigits:Number` (default = `1`)`` — number of figures in tenth of second.

Returns

| `String` — the sexagecimal value whose syntax conforms with dmsToDeg() function.

dmsToDeg | () | method |

`public static function dmsToDeg(dms:String):Number`

Convert a string representation of a sexagecimal degrees into a numeric representation of decimal degrees.

Parameters

| `dms:String` — a sexagecimal value. The supported syntax is :
          \s?-?(\d{1,3})[.,°d]?\s?(\d{0,2})[']?\s?(\d{0,2})[.,]?(\d{0,})(?:["]|[']{2})?
          |
          \s?(\d{1,3})[.,°d]?\s?(\d{0,2})[']?\s?(\d{0,2})[.,]?(\d{0,})(?:["]|[']{2})?\s?([NSEW])?

Returns

| `Number` — the decimal value or NaN if error occurs.

extend | () | method |

`public static function extend(destination:Object, source:Object):Object`

Copy all properties of a source object to a destination object. Modifies the passed in destination object.

Parameters

| `destination:Object` — The object that will be modified
| `source:Object` — The object with properties to be set on the destination

Returns

| `Object` — The destination object

getArgs | () | method |

`public static function getArgs(url:String = null):Object`

Get Ags

Parameters

| `url:String` (default = `null`)``

Returns

| `Object` — An object of key/value pairs from the query string

getParameterString | () | method |

`public static function getParameterString(params:Object):String`

Get parameter

Parameters

| `params:Object`

Returns

| `String` — A concatenation of the properties of an object in http parameter notation

hypot | () | method |

`public function hypot(x:Number, y:Number):Number`

Return sqrt(x2 +y2) without intermediate overflow or underflow. Special cases:

- If either argument is infinite, then the result is positive infinity.
- If either argument is NaN and neither argument is infinite, then the result is NaN.

The computed result must be within 1 ulp of the exact result. If one parameter is held constant, the results must be semi-monotonic in the other parameter. Parameters

| `x:Number` — a value.
| `y:Number` — a value.

Returns

| `Number` — sqrt(x2 +y2) without intermediate overflow or underflow.

indexOf | () | method |

`public static function indexOf(array:Array, obj:Object):int`

Get the index of an object in an array

Parameters

| `array:Array` — array containning items
| `obj:Object` — Item that we find index

Returns

| `int` — index of the item

mouseLeft | () | method |

`public static function mouseLeft(evt:MouseEvent, can:DisplayObject):Boolean` Parameters

| `evt:MouseEvent`
| `can:DisplayObject`

Returns

| `Boolean`

normalizeScale | () | method |

`public static function normalizeScale(scale:Number):Number`

Normalise scale

Parameters

| `scale:Number`

Returns

| `Number` — return a normalized scale value, in 1 / X format

pagePosition | () | method |

`public static function pagePosition(forElement:Object):Array` Parameters

| `forElement:Object`

Returns

| `Array`

removeItem | () | method |

`public static function removeItem(array:Array, item:Object):Array`

Remove an item of an array

Parameters

| `array:Array` — the array containing items
| `item:Object` — item to remove

Returns

| `Array` — the new array

upperCaseObject | () | method |

`public static function upperCaseObject(object:Object):Object`

Store all the keys of the Object in uppercase

Parameters

| `object:Object`

Returns

| `Object` — a new Object with all the same keys but uppercased