The namespace for all Utilitity objects and static functions
Classes
- AdditionalLayersManager
- CookieManager
- Events
- FilteredOverlayGetter
- GeognoSIS8MetaData
- GeognoSISOverlayGetter
- MetaData
- MetaDataBase
Methods
(static) Class() → {function}
Function used to create all other classes. Includes support for
multiple inheritance.
To create a new class, use the following syntax:
Any properties that start with m_ are considered private or protected and a getter and setter will be created for them.
For example, the private member below will hace a getter called get_privateProperty and a setter called set_privateProperty
var MyClass = OpenLayers.Class(prototype);
Prototype must be a an object that has a function called construct.
var myPrototype = {
publicProperty: null,
m_privateProperty: null,
construct: function(){
this.m_privateProprty = 'test string';
}
});
To create a new class with multiple inheritance, use the following syntax:
var MyClass = OpenLayers.Class(Class1, Class2, prototype);
Note that instanceof reflection will only reveal Class1 as superclass.
The parameter prototype must have a function called 'construct', this will become the constructorAny properties that start with m_ are considered private or protected and a getter and setter will be created for them.
For example, the private member below will hace a getter called get_privateProperty and a setter called set_privateProperty
var myConstructor = Cadcorp.Util.Class({
m_privateProperty: null,
construct: function(){
this.m_privateProprty = 'test string';
}
});
var myClass = new myConstructor();
myClass.set_privateProperty('set from public accessor');
Returns:
The constructor for the class
- Type
- function
(static) converToLink(source) → {string}
Converts a string to a url to an <a> tag.
Source is searched for a url and the href and content of the <a> will be set to the url
Parameters:
Name | Type | Description |
---|---|---|
source |
string | The string to be converted to an <a> tag |
Returns:
The <a> tag
- Type
- string
(static) createDelegate(object, method)
Creates a delegate function that can be passed to html or jQuery event methods.
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | The context, or this, that the method will be called with |
method |
function | The function that will be called |
(static) createUniqueID() → {string}
Creates a unique ID for HTML elements
Returns:
A unique string suitable to be used as an ID for HTML elements
- Type
- string
(static) doAjaxCallback(url, data, successCallbackopt, nullable, errorCallbackopt, nullable, contextopt, nullable, methodopt, nullable, completeCallbackopt, nullable, responseTypeopt, nullable, contentType, processData)
Perform an asynchronous HTTP (Ajax) request
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string | The url of the ajax request | |
data |
string | object | The data to be passed, it should be a JSON serialised object | |
successCallback |
function |
<optional> <nullable> |
A function to be called if the request succeeds |
errorCallback |
function |
<optional> <nullable> |
A function to be called if the request fails |
context |
Object |
<optional> <nullable> |
This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax) |
method |
string |
<optional> <nullable> |
The type of the callback, e.g. 'POST', 'GET', etc. The default is 'POST' |
completeCallback |
function |
<optional> <nullable> |
A function to be called when the request finishes (after success and error callbacks are executed) |
responseType |
string |
<optional> <nullable> |
The type of data that you're expecting back from the server. The default is 'json'. |
contentType |
string | boolean | The type of data is being sent to the server. The default is 'application/json; charset=utf-8'. | |
processData |
string | boolean | By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type 'application/x-www-form-urlencoded'. If you want to send a DOMDocument, or other non-processed data, set this option to false. |
(static) extend(destination, source) → {Object}
Copy all properties of a source object to a destination object. Modifies
the passed in destination object. Any properties on the source object
that are set to undefined will not be (re)set on the destination object.
Parameters:
Name | Type | Description |
---|---|---|
destination |
Object | The object that will be modified |
source |
Object | The object with properties to be set on the destination |
Returns:
The destination object.
- Type
- Object
(static) getScrollBarWidth()
Calculates the width of the current browsers scroll bar
(static) hexToB(hexString) → {number}
Gets the blue part of a hex colour.
Parameters:
Name | Type | Description |
---|---|---|
hexString |
string | The hex colour. The colour is expected to be a 6 digit representation of the colour with or without a leading # e.g. FF0000 or #FF0000 |
Returns:
The blue part of the hex colour
- Type
- number
(static) hexToG(hexString) → {number}
Gets the green part of a hex colour.
Parameters:
Name | Type | Description |
---|---|---|
hexString |
string | The hex colour. The colour is expected to be a 6 digit representation of the colour with or without a leading # e.g. FF0000 or #FF0000 |
Returns:
The green part of the hex colour
- Type
- number
(static) hexToR(hexString) → {number}
Gets the red part of a hex colour.
Parameters:
Name | Type | Description |
---|---|---|
hexString |
string | The hex colour. The colour is expected to be a 6 digit representation of the colour with or without a leading # e.g. FF0000 or #FF0000 |
Returns:
The red part of the hex colour
- Type
- number
(static) isAUrl(source) → {boolean}
Determines if a string is a url
Parameters:
Name | Type | Description |
---|---|---|
source |
string | The source string to be tested |
Returns:
If the source is a url returns true, otherwise false
- Type
- boolean
(static) isTouchDevice() → {boolean}
Does the current device support touch events
Returns:
True if the device supports touch events, otherwise false
- Type
- boolean
(static) round(value, decimalPlaces) → {number}
Rounds a number to the specified number of decimal places
Parameters:
Name | Type | Description |
---|---|---|
value |
number | The number to round |
decimalPlaces |
number | The number of decimal places to round to |
Returns:
The rounded number
- Type
- number
(static) toType(objectToTest) → {string}
Determines the type of an object.
Parameters:
Name | Type | Description |
---|---|---|
objectToTest |
Object | The object to determine the type of. |
Returns:
The type of the object
- Type
- string
(static) touchScroll(id)
Adds touch scroll events if the current device supports them
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The client side ID of the element to add touch events to |
Type Definitions
EventConfig
Configuration for Cadcorp.Util.Events
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
parentObject |
Object | The owner object for this event object |
MetaDataBaseConfig
Configuration for Cadcorp.Util.MetaDataBase
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
Organisation |
string | The organisation |
OrganisationTitle |
string | The title to display next to the organisation e.g. Company-Cadcorp |
ContactPerson |
string | The contact person |
ContactPersonTitle |
string | The title to display next to the contact person |
Email |
string | The email address for the contact person |
EmailTitle |
string | The title to display next to the email address |
MetaDataConfig
Configuration for Cadcorp.Util.MetaData
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
Organisation |
string | The organisation |
OrganisationTitle |
string | The title to display next to the organisation e.g. Company-Cadcorp |
ContactPerson |
string | The contact person |
ContactPersonTitle |
string | The title to display next to the contact person |
Email |
string | The email address for the contact person |
EmailTitle |
string | The title to display next to the email address |
AccessConstraint |
string | The access constraints for this layer |
AccessConstraintTitle |
string | The title to display next to the access constraints |
MetaDataGeognoSIS8Config
Configuration for Cadcorp.Util.GeognoSIS8MetaData
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
Organisation |
string | The organisation |
OrganisationTitle |
string | The title to display next to the organisation e.g. Company-Cadcorp |
ContactPerson |
string | The contact person |
ContactPersonTitle |
string | The title to display next to the contact person |
Email |
string | The email address for the contact person |
EmailTitle |
string | The title to display next to the email address |
ResourceTitle |
string | The Resource Title for this layer |
ResourceTitleTitle |
string | The title to display next to the Resource Title |
Abstract |
string | The abstract text for this layer |