new Util()
modules/core/util.js, line 57
Properties:
Name | Type | Default | Description |
---|---|---|---|
config |
String | "" | todo |
ignoredKeys |
Array.<String> | ["BOUNDEDBY", | "SHAPE", "SHAPE_LENGTH", "SHAPE_AREA", "OBJECTID", "GLOBALID", "GEOMETRY", "SHP", "SHP_AREA", "SHP_LENGTH", "GEOM"] List of ignored attribute names when displaying attribute information of all layer types. |
uiStyle |
String | "DEFAULT" | Controls the layout of the controls. |
proxy |
String | true | Specifies whether points should be replaced by underscores in URLs. This prevents CORS errors. Attention: A reverse proxy must be set up on the server side. |
proxyHost |
String | "" | Hostname of a remote proxy (CORS must be activated there). |
loaderOverlayTimeoutReference |
String | null | todo |
loaderOverlayTimeout |
String | "20" | Timeout for the loadergif. |
Fires:
- Core#event:RadioTriggerIsViewMobileChanged
- Alerting#event:RadioTriggerAlertAlert
- Alerting#event:RadioTriggerAlertAlert
- Core#event:RadioTriggerUtilHideLoader
Listens to Events:
- Core#event:RadioRequestUtilIsViewMobile
- Core#event:RadioRequestUtilGetProxyURL
- Core#event:RadioRequestUtilIsApple
- Core#event:RadioRequestUtilIsAndroid
- Core#event:RadioRequestUtilIsOpera
- Core#event:RadioRequestUtilIsWindows
- Core#event:RadioRequestUtilIsChrome
- Core#event:RadioRequestUtilIsInternetExplorer
- Core#event:RadioRequestUtilIsAny
- Core#event:RadioRequestUtilGetConfig
- Core#event:RadioRequestUtilGetUiStyle
- Core#event:RadioRequestUtilGetIgnoredKeys
- Core#event:RadioRequestUtilPunctuate
- Core#event:RadioRequestUtilSort
- Core#event:RadioRequestUtilConvertArrayOfObjectsToCsv
- Core#event:RadioRequestUtilGetPathFromLoader
- Core#event:RadioRequestUtilGetMasterPortalVersionNumber
- Core#event:RadioRequestUtilRenameKeys
- Core#event:RadioRequestUtilRenameValues
- Core#event:RadioRequestUtilSetUrlQueryParams
- Core#event:RadioRequestUtilSetUrlQueryParamsFromArray
- Core#event:RadioTriggerUtilHideLoader
- Core#event:RadioTriggerUtilShowLoader
- Core#event:RadioTriggerUtilSetUiStyle
- Core#event:RadioTriggerUtilCopyToClipboard
- Core#event:changeIsViewMobile
Extends
Methods
-
addCorsProxy(url){String}
modules/core/util.js, line 599 -
Method adds a CORS proxy to the given URL if configured and not already contained in URL
Name Type Description url
String The URL to proxy Returns:
final URL
-
convertArrayOfObjectsToCsv(data, colDeli, lineDeli){string}
modules/core/util.js, line 811 -
converts an array of objects to csv
Name Type Description data
Array.<object> array of object (no nested objects) colDeli
string column delimiter lineDeli
string line delimiter -
copyToClipboard(str){void}
modules/core/util.js, line 384 -
Copies the given content to clipboard as long as browser accepts command. Code mainly taken from: https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f behaviour of ios strange used solution from : https://stackoverflow.com/questions/34045777/copy-to-clipboard-using-javascript-in-ios
Name Type Description str
str content to copy Fires:
-
decLoaderOverlayCounter(){Void}
modules/core/util.js, line 975 -
decrements the loaderOverlayCounter
-
findWhereJs(list, findId){Object}
modules/core/util.js, line 1041 -
Looks through the list and returns the firts value that matches all of the key-value pairs listed in hitId.
Name Type Default Description list
Array.<Object> [] optional the list. findId
Object "" optional the id/entry to search for. Returns:
returns the first value/entry, that matches.
-
getMasterPortalVersionNumber(){string}
modules/core/util.js, line 127 -
Returns current Master Portal Version Number
Returns:
version number
-
getPathFromLoader(){String}
modules/core/util.js, line 545 -
search the path from the loader gif
Returns:
to loader gif
-
getProxyURL(url){String}
modules/core/util.js, line 554 -
rewrites the URL by replacing the dots with underlined
Name Type Description url
Stirng url to rewrite Returns:
URL
-
groupBy(arr, fn){object}
modules/core/util.js, line 925 -
Groups the elements of an array based on the given function. Use Array.prototype.map() to map the values of an array to a function or property name. Use Array.prototype.reduce() to create an object, where the keys are produced from the mapped results.
Name Type Description arr
array elements to group fn
function reducer function Returns:
the grouped object
-
hideLoader(){void}
modules/core/util.js, line 517 -
hides the loder gif until the timeout has expired
-
hideLoadingModule(){void}
modules/core/util.js, line 528 -
hides the loading module until the timeout has expired
-
incLoaderOverlayCounter(){Void}
modules/core/util.js, line 965 -
increments the loaderOverlayCounter
-
isAndroid(){Array|null}
modules/core/util.js, line 430 -
Searches the userAgent for the string android.
Returns:
an array with the results. Returns zero if nothing is found.
-
isAny(){*}
modules/core/util.js, line 475 -
todo
-
isApple(){Array|null}
modules/core/util.js, line 438 -
Searches the userAgent for the string iPhone, iPod or iPad.
Returns:
an array with the results. Returns zero if nothing is found.
-
isChrome(){Array|null}
modules/core/util.js, line 462 -
Searches the userAgent for the string chrome.
Returns:
an array with the results. Returns zero if nothing is found.
-
isInternetExplorer(){Array|null}
modules/core/util.js, line 483 -
Searches the userAgent for the string internet explorer.
Returns:
an array with the results. Returns zero if nothing is found.
-
isOpera(){Array|null}
modules/core/util.js, line 446 -
Searches the userAgent for the string opera.
Returns:
an array with the results. Returns zero if nothing is found.
-
isValidAddressString(string, separator, lastOccurrenceChar){Boolean}
modules/core/util.js, line 309 -
Checks if address string is valid for address sorting. The string gets splitted by "separator". The occurrence of the "lastOcccurrenceChar" is checked.
Name Type Description string
String String to check. separator
String Separator to separate Address (streetname and housenumber) from additional information (postal code, etc.). lastOccurrenceChar
String Charactor to separate the streetname from the housenumber. Returns:
Flag if string is valid.
-
isWindows(){Array|null}
modules/core/util.js, line 454 -
Searches the userAgent for the string windows.
Returns:
an array with the results. Returns zero if nothing is found.
-
omit(object, blacklist){Object}
modules/core/util.js, line 1023 -
Returns a copy of the object, filtered to omit the keys specified (or array of blacklisted keys).
Name Type Description object
Object the object. blacklist
Array.<Number> blacklisted keys Returns:
returns the entry/entries without the blacklisted key/keys.
-
parseConfigFromURL(){void}
modules/core/util.js, line 776 -
todo
Fires:
-
pick(object, keys){Object}
modules/core/util.js, line 1007 -
Return a copy of the object, filtered to only have values for the whitelisted keys (or array of valid keys).
Name Type Description object
Object the object. keys
Array.<Number> the key(s) to search for. Returns:
returns the entry/entries with the right key/keys.
-
pickKeyValuePairs(obj, keys){object}
modules/core/util.js, line 905 -
picks the key-value pairs corresponding to the given keys from an object.
Name Type Description obj
object the original object keys
Array.<string> the given keys to be returned Returns:
picked object
-
punctuate(value){string}
modules/core/util.js, line 136 -
converts value to String and rewrites punctuation rules. The 1000 separator is "." and the decimal separator is a ","
Name Type Description value
String feature attribute values Returns:
value
-
refreshTree(){void}
modules/core/util.js, line 983 -
Refresh LayerTree dependant on TreeType supports light and custom
-
renameKeys(keysMap, obj){object}
modules/core/util.js, line 841 -
replaces the names of object keys with the values provided.
Name Type Description keysMap
object keys mapping object obj
object the original object Returns:
renamed object
-
renameValues(valuesMap, obj){object}
modules/core/util.js, line 857 -
recursively replaces the names of object values with the values provided.
Name Type Description valuesMap
object values mapping object obj
object the original object Returns:
renamed object
-
replaceObjValuesRecursive(obj, search, replace){void}
modules/core/util.js, line 884 -
Replaces recursively string values in an object detected by "search" parameter the with the given replacement.
Name Type Description obj
Object The object to replace strings in search
RegExp | String The pattern to replace replace
String Replacement -
searchNestedObject(obj, key){mixed}
modules/core/util.js, line 1055 -
helper function to find a key in nested object
Name Type Description obj
object object to search key
string name of key to search for Returns:
value for the given key or null if not found
-
searchNestedObjectByKeyVal(obj, key, val){mixed}
modules/core/util.js, line 1089 -
helper function to find an object by given key and value
Name Type Description obj
object object to search in key
string name of key to search for val
string value of the key we a researching for Returns:
object for the given key and value or null if not found
-
setConfig(value){void}
modules/core/util.js, line 937 -
Setter for config
Name Type Description value
* todo -
setIsViewMobile(value){void}
modules/core/util.js, line 754 -
Setter for attribute isViewMobile
Name Type Description value
boolean visibility -
setLoaderOverlayCounter(value){Void}
modules/core/util.js, line 955 -
sets the loaderOverlayCounter to a specific number
Name Type Description value
Integer the value to set the loaderOverlayCounter to -
setLoaderOverlayTimeoutReference(timeoutReference){void}
modules/core/util.js, line 537 -
Setter for loaderOverlayTimeoutReference
Name Type Description timeoutReference
* todo -
setUiStyle(value){void}
modules/core/util.js, line 946 -
Setter for uiStyle
Name Type Description value
* todo -
setUrlQueryParams(url, queryParams, caseSensitive){String}
modules/core/util.js, line 701 -
Sets the query parameters to a given url. By default, considers case-sensitivity of the query keys. Does not add multiple queries with the exact same key. Existing keys on a url will be kept, except they were overwritten by an equal key in the queryParams argument. Returns the url with the added keys.
Name Type Description url
String url to append the queries to queryParams
Object Query params as object with key values matching query key values caseSensitive
Boolean true, if query keys should be handled case-sensitive, false otherwise, defaults to true Returns:
with additional query params
-
setUrlQueryParamsFromArray(url, queryParams){String}
modules/core/util.js, line 629 -
Sets the query params to a given url. Given params will not be overwritten and params with the same key can appear multiple times. The queryParams argument MUST be in following structure: [ ["param1", Set{"paramValue1", 2}], ["param2"], ["param2", Set{1,2}] ] --> ?param1=paramValue1,2¶m2¶m2=1,2 The first element MUST be a string describing the name of the query. The second argument is optional, but MUST be a Set if given. Each value in the Set will be set as comma separated value to the query name.
Name Type Description url
String The base url queryParams
Array.<Array> Nested Array with query Params Returns:
final url
-
showLoader(){void}
modules/core/util.js, line 503 -
shows the loader gif
Fires:
-
sort(type, input, first, second){array}
modules/core/util.js, line 164 -
Sorting alorithm that distinguishes between array[objects] and other arrays. arrays[objects] can be sorted by up to 2 object attributes
Name Type Description type
String Type of sortAlgorithm input
array array that has to be sorted first
String first attribute an array[objects] has to be sorted by second
String second attribute an array[objects] has to be sorted by Returns:
array
-
sortAddress(aObj, bObj){Number}
modules/core/util.js, line 256 -
Sorting Function to sort address. Expected string format to be "STREETNAME HOUSENUMBER_WITH_OR_WITHOUT_SUFFIX, *"
Name Type Description aObj
String First comparator. bObj
String Secons comparator. Returns:
index.
-
sortAlphaNum(a, b){Number}
modules/core/util.js, line 194 -
Sorting function for alphanumeric sorting. First sorts alphabetically, then numerically.
Name Type Description a
* First comparator. b
* Secons comparator. Returns:
index.
-
sortArray(input){Array}
modules/core/util.js, line 184 -
Sorts an array.
Name Type Description input
Array array to sort. Returns:
array
-
sortNumAlpha(a, b){Number}
modules/core/util.js, line 225 -
Sorting function for numalpha sorting. First sorts numerically, then alphabetically.
Name Type Description a
* First comparator. b
* Secons comparator. Returns:
index.
-
sortObjects(type, input, first, second){Array.<Object>}
modules/core/util.js, line 329 -
Sorts array of objects basend on the given type.
Name Type Description type
String Type of sort algorithm. input
Array.<Object> Array with object to be sorted. first
String First attribute to sort by. second
String Second attribute to sort by. Returns:
Sorted array of objects.
-
sortObjectsAsAddress(input){Array.<Object>}
modules/core/util.js, line 369 -
Sorts array of objects as address using a special sorting alorithm
Name Type Description input
Array.<Object> Array with object to be sorted. Returns:
Sorted array of objects.
-
sortObjectsNonAddress(input, first, second){Array.<Object>}
modules/core/util.js, line 349 -
Sorts Objects not as address.
Name Type Description input
Array.<Object> Array with object to be sorted. first
String First attribute to sort by. second
String Second attribute to sort by. Returns:
Sorted array of objects.
-
splitAddressString(string, separator, lastOccurrenceChar){Array.<String>}
modules/core/util.js, line 286 -
Splits the address string.
Name Type Description string
String Address string. separator
String Separator to separate the Address and Housenumber from other info such as zipCode or City. lastOccurrenceChar
String Character to separate the streetname from the housenumber. Returns:
Array containing the splitted parts.
-
toggleIsViewMobile(){void}
modules/core/util.js, line 762 -
Toggled the isViewMobile attribute when the window width exceeds or falls below 768px