repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
TerriaJS/terriajs
lib/Models/LegendHelper.js
getTableColumnStyle
function getTableColumnStyle(tableColumn, tableStyle) { var tableColumnStyle; if (defined(tableColumn) && defined(tableStyle.columns)) { if (defined(tableStyle.columns[tableColumn.id])) { tableColumnStyle = clone(tableStyle.columns[tableColumn.id]); } else { // Also support column indices as key...
javascript
function getTableColumnStyle(tableColumn, tableStyle) { var tableColumnStyle; if (defined(tableColumn) && defined(tableStyle.columns)) { if (defined(tableStyle.columns[tableColumn.id])) { tableColumnStyle = clone(tableStyle.columns[tableColumn.id]); } else { // Also support column indices as key...
[ "function", "getTableColumnStyle", "(", "tableColumn", ",", "tableStyle", ")", "{", "var", "tableColumnStyle", ";", "if", "(", "defined", "(", "tableColumn", ")", "&&", "defined", "(", "tableStyle", ".", "columns", ")", ")", "{", "if", "(", "defined", "(", ...
Find the right table column style for this column. By default, take styling directly from the tableStyle, unless there is a suitable 'columns' entry.
[ "Find", "the", "right", "table", "column", "style", "for", "this", "column", ".", "By", "default", "take", "styling", "directly", "from", "the", "tableStyle", "unless", "there", "is", "a", "suitable", "columns", "entry", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/LegendHelper.js#L86-L115
train
TerriaJS/terriajs
lib/Models/LegendHelper.js
getFractionalValue
function getFractionalValue(legendHelper, value) { var extremes = getExtremes( legendHelper.tableColumn, legendHelper.tableColumnStyle ); var f = extremes.maximum === extremes.minimum ? 0 : (value - extremes.minimum) / (extremes.maximum - extremes.minimum); if (legendHelper.tableColumnSt...
javascript
function getFractionalValue(legendHelper, value) { var extremes = getExtremes( legendHelper.tableColumn, legendHelper.tableColumnStyle ); var f = extremes.maximum === extremes.minimum ? 0 : (value - extremes.minimum) / (extremes.maximum - extremes.minimum); if (legendHelper.tableColumnSt...
[ "function", "getFractionalValue", "(", "legendHelper", ",", "value", ")", "{", "var", "extremes", "=", "getExtremes", "(", "legendHelper", ".", "tableColumn", ",", "legendHelper", ".", "tableColumnStyle", ")", ";", "var", "f", "=", "extremes", ".", "maximum", ...
Convert a value to a fractional value, eg. in a column that ranges from 0 to 100, 20 -> 0.2. TableStyle can override the minimum and maximum of the range. @private @param {Number} value The value. @return {Number} The fractional value.
[ "Convert", "a", "value", "to", "a", "fractional", "value", "eg", ".", "in", "a", "column", "that", "ranges", "from", "0", "to", "100", "20", "-", ">", "0", ".", "2", ".", "TableStyle", "can", "override", "the", "minimum", "and", "maximum", "of", "the...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/LegendHelper.js#L330-L343
train
TerriaJS/terriajs
lib/Models/RegionDataValue.js
RegionDataValue
function RegionDataValue( regionCodes, columnHeadings, table, singleSelectValues ) { this.regionCodes = regionCodes; this.columnHeadings = columnHeadings; this.table = table; this.singleSelectValues = singleSelectValues; }
javascript
function RegionDataValue( regionCodes, columnHeadings, table, singleSelectValues ) { this.regionCodes = regionCodes; this.columnHeadings = columnHeadings; this.table = table; this.singleSelectValues = singleSelectValues; }
[ "function", "RegionDataValue", "(", "regionCodes", ",", "columnHeadings", ",", "table", ",", "singleSelectValues", ")", "{", "this", ".", "regionCodes", "=", "regionCodes", ";", "this", ".", "columnHeadings", "=", "columnHeadings", ";", "this", ".", "table", "="...
Holds a collection of region data. @param {String[]} regionCodes The list of region codes. @param {String[]} columnHeadings The list of column headings describing the values associated with each region. @param {Number[][]} table An array of arrays where each array in the outer array corresponds to a single region in t...
[ "Holds", "a", "collection", "of", "region", "data", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/RegionDataValue.js#L14-L24
train
TerriaJS/terriajs
lib/Models/CsvCatalogItem.js
loadTableFromCsv
function loadTableFromCsv(item, csvString) { var tableStyle = item._tableStyle; var options = { idColumnNames: item.idColumns, isSampled: item.isSampled, initialTimeSource: item.initialTimeSource, displayDuration: tableStyle.displayDuration, replaceWithNullValues: tableStyle.replaceWithNullValue...
javascript
function loadTableFromCsv(item, csvString) { var tableStyle = item._tableStyle; var options = { idColumnNames: item.idColumns, isSampled: item.isSampled, initialTimeSource: item.initialTimeSource, displayDuration: tableStyle.displayDuration, replaceWithNullValues: tableStyle.replaceWithNullValue...
[ "function", "loadTableFromCsv", "(", "item", ",", "csvString", ")", "{", "var", "tableStyle", "=", "item", ".", "_tableStyle", ";", "var", "options", "=", "{", "idColumnNames", ":", "item", ".", "idColumns", ",", "isSampled", ":", "item", ".", "isSampled", ...
Loads the TableStructure from a csv file. @param {CsvCatalogItem} item Item that tableDataSource is created for @param {String} csvString String in csv format. @return {Promise} A promise that resolves to true if it is a recognised format. @private
[ "Loads", "the", "TableStructure", "from", "a", "csv", "file", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/CsvCatalogItem.js#L139-L153
train
TerriaJS/terriajs
lib/Models/RegionDataParameter.js
function(options) { if (!defined(options) || !defined(options.regionProvider)) { throw new DeveloperError("options.regionProvider is required."); } FunctionParameter.call(this, options); this._regionProvider = options.regionProvider; this.singleSelect = defaultValue(options.singleSelect, false); knoc...
javascript
function(options) { if (!defined(options) || !defined(options.regionProvider)) { throw new DeveloperError("options.regionProvider is required."); } FunctionParameter.call(this, options); this._regionProvider = options.regionProvider; this.singleSelect = defaultValue(options.singleSelect, false); knoc...
[ "function", "(", "options", ")", "{", "if", "(", "!", "defined", "(", "options", ")", "||", "!", "defined", "(", "options", ".", "regionProvider", ")", ")", "{", "throw", "new", "DeveloperError", "(", "\"options.regionProvider is required.\"", ")", ";", "}",...
A parameter that specifies a set of characteristics for regions of a particular type. @alias RegionDataParameter @constructor @extends FunctionParameter @param {Object} [options] Object with the following properties: @param {Terria} options.terria The Terria instance. @param {String} options.id The unique ID of this ...
[ "A", "parameter", "that", "specifies", "a", "set", "of", "characteristics", "for", "regions", "of", "a", "particular", "type", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/RegionDataParameter.js#L30-L41
train
TerriaJS/terriajs
lib/Map/LeafletVisualizer.js
recolorBillboard
function recolorBillboard(img, color) { var canvas = document.createElement("canvas"); canvas.width = img.width; canvas.height = img.height; // Copy the image contents to the canvas var context = canvas.getContext("2d"); context.drawImage(img, 0, 0); var image = context.getImageData(0, 0, canvas.width, c...
javascript
function recolorBillboard(img, color) { var canvas = document.createElement("canvas"); canvas.width = img.width; canvas.height = img.height; // Copy the image contents to the canvas var context = canvas.getContext("2d"); context.drawImage(img, 0, 0); var image = context.getImageData(0, 0, canvas.width, c...
[ "function", "recolorBillboard", "(", "img", ",", "color", ")", "{", "var", "canvas", "=", "document", ".", "createElement", "(", "\"canvas\"", ")", ";", "canvas", ".", "width", "=", "img", ".", "width", ";", "canvas", ".", "height", "=", "img", ".", "h...
Recolor an image using 2d canvas
[ "Recolor", "an", "image", "using", "2d", "canvas" ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/LeafletVisualizer.js#L524-L545
train
TerriaJS/terriajs
lib/Core/printWindow.js
printWindow
function printWindow(windowToPrint) { const deferred = when.defer(); let printInProgressCount = 0; const timeout = setTimeout(function() { deferred.reject( new TerriaError({ title: "Error printing", message: "Printing did not start within 10 seconds. Maybe this web browser doe...
javascript
function printWindow(windowToPrint) { const deferred = when.defer(); let printInProgressCount = 0; const timeout = setTimeout(function() { deferred.reject( new TerriaError({ title: "Error printing", message: "Printing did not start within 10 seconds. Maybe this web browser doe...
[ "function", "printWindow", "(", "windowToPrint", ")", "{", "const", "deferred", "=", "when", ".", "defer", "(", ")", ";", "let", "printInProgressCount", "=", "0", ";", "const", "timeout", "=", "setTimeout", "(", "function", "(", ")", "{", "deferred", ".", ...
Tells the web browser to print a given window, which my be an iframe window, and returns a promise that resolves when printing is safely over so that, for example the window can be removed. @param {Window} windowToPrint The window to print. @returns {Promise} A promise that resolves when printing is safely over. The pr...
[ "Tells", "the", "web", "browser", "to", "print", "a", "given", "window", "which", "my", "be", "an", "iframe", "window", "and", "returns", "a", "promise", "that", "resolves", "when", "printing", "is", "safely", "over", "so", "that", "for", "example", "the",...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/printWindow.js#L12-L71
train
TerriaJS/terriajs
lib/Models/TableStyle.js
function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); TableColumnStyle.call(this, options); /** * The name of the variable (column) to be used for region mapping. * @type {String} */ this.regionVariable = options.regionVariable; /** * The identifier of a region type, a...
javascript
function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); TableColumnStyle.call(this, options); /** * The name of the variable (column) to be used for region mapping. * @type {String} */ this.regionVariable = options.regionVariable; /** * The identifier of a region type, a...
[ "function", "(", "options", ")", "{", "options", "=", "defaultValue", "(", "options", ",", "defaultValue", ".", "EMPTY_OBJECT", ")", ";", "TableColumnStyle", ".", "call", "(", "this", ",", "options", ")", ";", "/**\n * The name of the variable (column) to be used ...
A set of properties that define how a table, such as a CSV file, should be displayed. If not set explicitly, many of these properties will be given default or guessed values elsewhere, such as in CsvCatalogItem. @alias TableStyle @constructor @extends TableColumnStyle @param {Object} [options] The values of the prope...
[ "A", "set", "of", "properties", "that", "define", "how", "a", "table", "such", "as", "a", "CSV", "file", "should", "be", "displayed", ".", "If", "not", "set", "explicitly", "many", "of", "these", "properties", "will", "be", "given", "default", "or", "gue...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/TableStyle.js#L33-L76
train
TerriaJS/terriajs
lib/Map/GnafAddressGeocoder.js
prefilterAddresses
function prefilterAddresses(addressList) { var addressesPlusInd = { skipIndices: [], nullAddresses: 0, addresses: [] }; for (var i = 0; i < addressList.length; i++) { var address = addressList[i]; if (address === null) { addressesPlusInd.skipIndices.push(i); addressesPlusInd.nullAddresses++; ...
javascript
function prefilterAddresses(addressList) { var addressesPlusInd = { skipIndices: [], nullAddresses: 0, addresses: [] }; for (var i = 0; i < addressList.length; i++) { var address = addressList[i]; if (address === null) { addressesPlusInd.skipIndices.push(i); addressesPlusInd.nullAddresses++; ...
[ "function", "prefilterAddresses", "(", "addressList", ")", "{", "var", "addressesPlusInd", "=", "{", "skipIndices", ":", "[", "]", ",", "nullAddresses", ":", "0", ",", "addresses", ":", "[", "]", "}", ";", "for", "(", "var", "i", "=", "0", ";", "i", ...
Do not try to geocode addresses that don't look valid. @param {Array} addressList List of addresses that will be considered for geocoding @return {Object} Probably shorter list of addresses that should be geocoded, as well as indices of addresses that were removed. @private
[ "Do", "not", "try", "to", "geocode", "addresses", "that", "don", "t", "look", "valid", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/GnafAddressGeocoder.js#L139-L159
train
TerriaJS/terriajs
lib/Models/TableDataSource.js
function( terria, tableStructure, tableStyle, name, isUpdating ) { this._guid = createGuid(); // Used internally to give features a globally unique id. this._name = name; this._isUpdating = isUpdating || false; this._hasFeaturePerRow = undefined; // If this changes, need to remove old features. this...
javascript
function( terria, tableStructure, tableStyle, name, isUpdating ) { this._guid = createGuid(); // Used internally to give features a globally unique id. this._name = name; this._isUpdating = isUpdating || false; this._hasFeaturePerRow = undefined; // If this changes, need to remove old features. this...
[ "function", "(", "terria", ",", "tableStructure", ",", "tableStyle", ",", "name", ",", "isUpdating", ")", "{", "this", ".", "_guid", "=", "createGuid", "(", ")", ";", "// Used internally to give features a globally unique id.", "this", ".", "_name", "=", "name", ...
A DataSource for table-based data where each row corresponds to a single feature or point - not region-mapped. Generates Cesium entities for each row. Displaying the points requires a legend. @name TableDataSource @alias TableDataSource @constructor @param {TableStructure} [tableStructure] The Table Structure instanc...
[ "A", "DataSource", "for", "table", "-", "based", "data", "where", "each", "row", "corresponds", "to", "a", "single", "feature", "or", "point", "-", "not", "region", "-", "mapped", ".", "Generates", "Cesium", "entities", "for", "each", "row", ".", "Displayi...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/TableDataSource.js#L52-L102
train
TerriaJS/terriajs
lib/Core/CorsProxy.js
hostInDomains
function hostInDomains(host, domains) { if (!defined(domains)) { return false; } host = host.toLowerCase(); for (var i = 0; i < domains.length; i++) { if (host.match("(^|\\.)" + domains[i] + "$")) { return true; } } return false; }
javascript
function hostInDomains(host, domains) { if (!defined(domains)) { return false; } host = host.toLowerCase(); for (var i = 0; i < domains.length; i++) { if (host.match("(^|\\.)" + domains[i] + "$")) { return true; } } return false; }
[ "function", "hostInDomains", "(", "host", ",", "domains", ")", "{", "if", "(", "!", "defined", "(", "domains", ")", ")", "{", "return", "false", ";", "}", "host", "=", "host", ".", "toLowerCase", "(", ")", ";", "for", "(", "var", "i", "=", "0", "...
Determines whether this host is, or is a subdomain of, an item in the provided array. @param {String} host The host to search for @param {String[]} domains The array of domains to look in @returns {boolean} The result.
[ "Determines", "whether", "this", "host", "is", "or", "is", "a", "subdomain", "of", "an", "item", "in", "the", "provided", "array", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/CorsProxy.js#L181-L193
train
TerriaJS/terriajs
lib/Models/TimeSeriesStack.js
function(clock) { this.clock = clock; this._layerStack = []; knockout.track(this, ["_layerStack"]); /** * The highest time-series layer, or undefined if there are no time series layers. */ knockout.defineProperty(this, "topLayer", { get: function() { if (this._layerStack.length) { r...
javascript
function(clock) { this.clock = clock; this._layerStack = []; knockout.track(this, ["_layerStack"]); /** * The highest time-series layer, or undefined if there are no time series layers. */ knockout.defineProperty(this, "topLayer", { get: function() { if (this._layerStack.length) { r...
[ "function", "(", "clock", ")", "{", "this", ".", "clock", "=", "clock", ";", "this", ".", "_layerStack", "=", "[", "]", ";", "knockout", ".", "track", "(", "this", ",", "[", "\"_layerStack\"", "]", ")", ";", "/**\n * The highest time-series layer, or undef...
Manages a stack of all the time series layers currently being shown and makes sure the clock provided is always tracking the highest one. When the top-most layer is disabled, the clock will track the next highest in the stack. Provides access to the current top layer so that can be displayed to the user. @param clock ...
[ "Manages", "a", "stack", "of", "all", "the", "time", "series", "layers", "currently", "being", "shown", "and", "makes", "sure", "the", "clock", "provided", "is", "always", "tracking", "the", "highest", "one", ".", "When", "the", "top", "-", "most", "layer"...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/TimeSeriesStack.js#L16-L44
train
TerriaJS/terriajs
lib/Core/triggerResize.js
triggerResize
function triggerResize() { try { window.dispatchEvent(new Event("resize")); } catch (e) { var evt = window.document.createEvent("UIEvents"); evt.initUIEvent("resize", true, false, window, 0); window.dispatchEvent(evt); } }
javascript
function triggerResize() { try { window.dispatchEvent(new Event("resize")); } catch (e) { var evt = window.document.createEvent("UIEvents"); evt.initUIEvent("resize", true, false, window, 0); window.dispatchEvent(evt); } }
[ "function", "triggerResize", "(", ")", "{", "try", "{", "window", ".", "dispatchEvent", "(", "new", "Event", "(", "\"resize\"", ")", ")", ";", "}", "catch", "(", "e", ")", "{", "var", "evt", "=", "window", ".", "document", ".", "createEvent", "(", "\...
Trigger a window resize event.
[ "Trigger", "a", "window", "resize", "event", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/triggerResize.js#L6-L14
train
TerriaJS/terriajs
lib/Models/WebMapServiceCatalogItem.js
objectToLowercase
function objectToLowercase(obj) { var result = {}; for (var key in obj) { if (obj.hasOwnProperty(key)) { result[key.toLowerCase()] = obj[key]; } } return result; }
javascript
function objectToLowercase(obj) { var result = {}; for (var key in obj) { if (obj.hasOwnProperty(key)) { result[key.toLowerCase()] = obj[key]; } } return result; }
[ "function", "objectToLowercase", "(", "obj", ")", "{", "var", "result", "=", "{", "}", ";", "for", "(", "var", "key", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "result", "[", "key", ".", "toLowerCase...
This is copied directly from Cesium's WebMapServiceImageryProvider.
[ "This", "is", "copied", "directly", "from", "Cesium", "s", "WebMapServiceImageryProvider", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/WebMapServiceCatalogItem.js#L2044-L2052
train
TerriaJS/terriajs
lib/Core/combineFilters.js
combineFilters
function combineFilters(filters) { var allFilters, returnFn; allFilters = filters .filter(function(filter) { return defined(filter); }) .reduce(function(filtersSoFar, thisFilter) { if (thisFilter._filterIndex) { // If a filter is an instance of this function just pull that filter's ...
javascript
function combineFilters(filters) { var allFilters, returnFn; allFilters = filters .filter(function(filter) { return defined(filter); }) .reduce(function(filtersSoFar, thisFilter) { if (thisFilter._filterIndex) { // If a filter is an instance of this function just pull that filter's ...
[ "function", "combineFilters", "(", "filters", ")", "{", "var", "allFilters", ",", "returnFn", ";", "allFilters", "=", "filters", ".", "filter", "(", "function", "(", "filter", ")", "{", "return", "defined", "(", "filter", ")", ";", "}", ")", ".", "reduce...
Combines a number of functions that return a boolean into a single function that executes all of them and returns true only if all them do. Maintains an set of filter functions, so if the same function is combined more than once, it is only executed one time. This means that it is also safe to call combineFilter on its...
[ "Combines", "a", "number", "of", "functions", "that", "return", "a", "boolean", "into", "a", "single", "function", "that", "executes", "all", "of", "them", "and", "returns", "true", "only", "if", "all", "them", "do", ".", "Maintains", "an", "set", "of", ...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/combineFilters.js#L15-L46
train
TerriaJS/terriajs
lib/Core/propertyGetTimeValues.js
propertyGetTimeValues
function propertyGetTimeValues(properties, currentTime) { // properties itself may be a time-varying "property" with a getValue function. // If not, check each of its properties for a getValue function; if it exists, use it to get the current value. if (!defined(properties)) { return; } var result = {}; ...
javascript
function propertyGetTimeValues(properties, currentTime) { // properties itself may be a time-varying "property" with a getValue function. // If not, check each of its properties for a getValue function; if it exists, use it to get the current value. if (!defined(properties)) { return; } var result = {}; ...
[ "function", "propertyGetTimeValues", "(", "properties", ",", "currentTime", ")", "{", "// properties itself may be a time-varying \"property\" with a getValue function.", "// If not, check each of its properties for a getValue function; if it exists, use it to get the current value.", "if", "(...
Gets the values from a Entity's properties object for the time on the current clock. @param properties An entity's property object @param {JulianDate} currentTime The current time if it is a time varying catalog item. @returns {Object} a simple key-value object of properties.
[ "Gets", "the", "values", "from", "a", "Entity", "s", "properties", "object", "for", "the", "time", "on", "the", "current", "clock", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/propertyGetTimeValues.js#L12-L32
train
TerriaJS/terriajs
lib/Map/gmlToGeoJson.js
gmlToGeoJson
function gmlToGeoJson(xml) { if (typeof xml === "string") { var parser = new DOMParser(); xml = parser.parseFromString(xml, "text/xml"); } var result = []; var featureCollection = xml.documentElement; var featureMembers = featureCollection.getElementsByTagNameNS( gmlNamespace, "featureMembe...
javascript
function gmlToGeoJson(xml) { if (typeof xml === "string") { var parser = new DOMParser(); xml = parser.parseFromString(xml, "text/xml"); } var result = []; var featureCollection = xml.documentElement; var featureMembers = featureCollection.getElementsByTagNameNS( gmlNamespace, "featureMembe...
[ "function", "gmlToGeoJson", "(", "xml", ")", "{", "if", "(", "typeof", "xml", "===", "\"string\"", ")", "{", "var", "parser", "=", "new", "DOMParser", "(", ")", ";", "xml", "=", "parser", ".", "parseFromString", "(", "xml", ",", "\"text/xml\"", ")", ";...
Converts a GML v3.1.1 simple features document to GeoJSON. @param {Document|String} xml The GML document. @return {Object} The GeoJSON object.
[ "Converts", "a", "GML", "v3", ".", "1", ".", "1", "simple", "features", "document", "to", "GeoJSON", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/gmlToGeoJson.js#L14-L55
train
TerriaJS/terriajs
lib/Map/gmlToGeoJson.js
gml2coord
function gml2coord(posList) { var pnts = posList.split(/[ ,]+/).filter(isNotEmpty); var coords = []; for (var i = 0; i < pnts.length; i += 2) { coords.push([parseFloat(pnts[i + 1]), parseFloat(pnts[i])]); } return coords; }
javascript
function gml2coord(posList) { var pnts = posList.split(/[ ,]+/).filter(isNotEmpty); var coords = []; for (var i = 0; i < pnts.length; i += 2) { coords.push([parseFloat(pnts[i + 1]), parseFloat(pnts[i])]); } return coords; }
[ "function", "gml2coord", "(", "posList", ")", "{", "var", "pnts", "=", "posList", ".", "split", "(", "/", "[ ,]+", "/", ")", ".", "filter", "(", "isNotEmpty", ")", ";", "var", "coords", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", ...
Utility function to change esri gml positions to geojson positions
[ "Utility", "function", "to", "change", "esri", "gml", "positions", "to", "geojson", "positions" ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/gmlToGeoJson.js#L277-L284
train
TerriaJS/terriajs
lib/Models/Catalog.js
function(terria) { if (!defined(terria)) { throw new DeveloperError("terria is required"); } this._terria = terria; this._shareKeyIndex = {}; this._group = new CatalogGroup(terria); this._group.name = "Root Group"; this._group.preserveOrder = true; /** * Gets or sets a flag indicating whether ...
javascript
function(terria) { if (!defined(terria)) { throw new DeveloperError("terria is required"); } this._terria = terria; this._shareKeyIndex = {}; this._group = new CatalogGroup(terria); this._group.name = "Root Group"; this._group.preserveOrder = true; /** * Gets or sets a flag indicating whether ...
[ "function", "(", "terria", ")", "{", "if", "(", "!", "defined", "(", "terria", ")", ")", "{", "throw", "new", "DeveloperError", "(", "\"terria is required\"", ")", ";", "}", "this", ".", "_terria", "=", "terria", ";", "this", ".", "_shareKeyIndex", "=", ...
The view model for the data catalog. @param {Terria} terria The Terria instance. @alias Catalog @constructor
[ "The", "view", "model", "for", "the", "data", "catalog", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/Catalog.js#L23-L62
train
TerriaJS/terriajs
lib/Models/TableColumnStyle.js
function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); /** * All data values less than or equal to this are considered equal for the purpose of display. * @type {Float} */ this.minDisplayValue = options.minDisplayValue; /** * Minimum y value to display in charts; if not sp...
javascript
function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); /** * All data values less than or equal to this are considered equal for the purpose of display. * @type {Float} */ this.minDisplayValue = options.minDisplayValue; /** * Minimum y value to display in charts; if not sp...
[ "function", "(", "options", ")", "{", "options", "=", "defaultValue", "(", "options", ",", "defaultValue", ".", "EMPTY_OBJECT", ")", ";", "/**\n * All data values less than or equal to this are considered equal for the purpose of display.\n * @type {Float}\n */", "this", "....
A set of properties that define how a table column should be displayed. If not set explicitly, many of these properties will be given default or guessed values elsewhere, such as in CsvCatalogItem. @alias TableColumnStyle @constructor @param {Object} [options] The values of the properties of the new instance. @param ...
[ "A", "set", "of", "properties", "that", "define", "how", "a", "table", "column", "should", "be", "displayed", ".", "If", "not", "set", "explicitly", "many", "of", "these", "properties", "will", "be", "given", "default", "or", "guessed", "values", "elsewhere"...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/TableColumnStyle.js#L52-L234
train
TerriaJS/terriajs
lib/Map/AbsConcept.js
function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); Concept.call(this, options.name || options.id); /** * Gets or sets the name of the concept item. This property is observable. * @type {String} */ this.id = options.id; /** * Gets the list of absCodes contained in t...
javascript
function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); Concept.call(this, options.name || options.id); /** * Gets or sets the name of the concept item. This property is observable. * @type {String} */ this.id = options.id; /** * Gets the list of absCodes contained in t...
[ "function", "(", "options", ")", "{", "options", "=", "defaultValue", "(", "options", ",", "defaultValue", ".", "EMPTY_OBJECT", ")", ";", "Concept", ".", "call", "(", "this", ",", "options", ".", "name", "||", "options", ".", "id", ")", ";", "/**\n * G...
Represents an ABS concept associated with a AbsDataset. An AbsConcept contains an array one of more AbsCodes. @alias AbsConcept @constructor @extends Concept @param {Object} [options] Object with the following properties: @param {String} [options.name] The concept's human-readable name, eg. "Region Type". @param {Stri...
[ "Represents", "an", "ABS", "concept", "associated", "with", "a", "AbsDataset", ".", "An", "AbsConcept", "contains", "an", "array", "one", "of", "more", "AbsCodes", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/AbsConcept.js#L31-L88
train
TerriaJS/terriajs
lib/Map/AbsConcept.js
buildConceptTree
function buildConceptTree(parent, filter, concept, codes) { // Use natural sort for fields with included ages or incomes. codes.sort(function(a, b) { return naturalSort( a.description.replace(",", ""), b.description.replace(",", "") ); }); var anyActive = false; for (var i = 0; i < codes.l...
javascript
function buildConceptTree(parent, filter, concept, codes) { // Use natural sort for fields with included ages or incomes. codes.sort(function(a, b) { return naturalSort( a.description.replace(",", ""), b.description.replace(",", "") ); }); var anyActive = false; for (var i = 0; i < codes.l...
[ "function", "buildConceptTree", "(", "parent", ",", "filter", ",", "concept", ",", "codes", ")", "{", "// Use natural sort for fields with included ages or incomes.", "codes", ".", "sort", "(", "function", "(", "a", ",", "b", ")", "{", "return", "naturalSort", "("...
Recursively builds out the AbsCodes underneath this AbsConcept. Returns true if any codes were made active, false if none.
[ "Recursively", "builds", "out", "the", "AbsCodes", "underneath", "this", "AbsConcept", ".", "Returns", "true", "if", "any", "codes", "were", "made", "active", "false", "if", "none", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/AbsConcept.js#L139-L167
train
TerriaJS/terriajs
lib/Models/AbsIttCatalogItem.js
loadConceptIdsAndConceptNameMap
function loadConceptIdsAndConceptNameMap(item) { if (!defined(item._loadConceptIdsAndNameMapPromise)) { var parameters = { method: "GetDatasetConcepts", datasetid: item.datasetId, format: "json" }; var datasetConceptsUrl = item._baseUrl + "?" + objectToQuery(parameters); var loadData...
javascript
function loadConceptIdsAndConceptNameMap(item) { if (!defined(item._loadConceptIdsAndNameMapPromise)) { var parameters = { method: "GetDatasetConcepts", datasetid: item.datasetId, format: "json" }; var datasetConceptsUrl = item._baseUrl + "?" + objectToQuery(parameters); var loadData...
[ "function", "loadConceptIdsAndConceptNameMap", "(", "item", ")", "{", "if", "(", "!", "defined", "(", "item", ".", "_loadConceptIdsAndNameMapPromise", ")", ")", "{", "var", "parameters", "=", "{", "method", ":", "\"GetDatasetConcepts\"", ",", "datasetid", ":", "...
Returns a promise which, when resolved, indicates that item._conceptIds and item._conceptNamesMap are loaded. @private @param {AbsIttCatalogItem} item This catalog item. @return {Promise} Promise which, when resolved, indicates that item._conceptIds and item._conceptNamesMap are loaded.
[ "Returns", "a", "promise", "which", "when", "resolved", "indicates", "that", "item", ".", "_conceptIds", "and", "item", ".", "_conceptNamesMap", "are", "loaded", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/AbsIttCatalogItem.js#L445-L485
train
TerriaJS/terriajs
lib/Models/AbsIttCatalogItem.js
loadConcepts
function loadConcepts(item) { if (!defined(item._loadConceptsPromise)) { var absConcepts = []; var promises = item._conceptIds .filter(function(conceptId) { return item.conceptsNotToLoad.indexOf(conceptId) === -1; }) .map(function(conceptId) { var parameters = { met...
javascript
function loadConcepts(item) { if (!defined(item._loadConceptsPromise)) { var absConcepts = []; var promises = item._conceptIds .filter(function(conceptId) { return item.conceptsNotToLoad.indexOf(conceptId) === -1; }) .map(function(conceptId) { var parameters = { met...
[ "function", "loadConcepts", "(", "item", ")", "{", "if", "(", "!", "defined", "(", "item", ".", "_loadConceptsPromise", ")", ")", "{", "var", "absConcepts", "=", "[", "]", ";", "var", "promises", "=", "item", ".", "_conceptIds", ".", "filter", "(", "fu...
Loads concept codes. As they are loaded, each is processed into a tree of AbsCodes under an AbsConcept. Returns a promise which, when resolved, indicates that item._concepts is complete. The promise is cached, since the promise won't ever change for a given datasetId. @private @param {AbsIttCatalogItem} item This cata...
[ "Loads", "concept", "codes", ".", "As", "they", "are", "loaded", "each", "is", "processed", "into", "a", "tree", "of", "AbsCodes", "under", "an", "AbsConcept", ".", "Returns", "a", "promise", "which", "when", "resolved", "indicates", "that", "item", ".", "...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/AbsIttCatalogItem.js#L536-L604
train
TerriaJS/terriajs
lib/Models/AbsIttCatalogItem.js
getHumanReadableConceptName
function getHumanReadableConceptName(conceptNameMap, concept) { if (!defined(conceptNameMap[concept.name])) { return concept.name; // Default to the name given in the file. } if (typeof conceptNameMap[concept.name] === "string") { return conceptNameMap[concept.name]; } else { var codeMap = conceptNa...
javascript
function getHumanReadableConceptName(conceptNameMap, concept) { if (!defined(conceptNameMap[concept.name])) { return concept.name; // Default to the name given in the file. } if (typeof conceptNameMap[concept.name] === "string") { return conceptNameMap[concept.name]; } else { var codeMap = conceptNa...
[ "function", "getHumanReadableConceptName", "(", "conceptNameMap", ",", "concept", ")", "{", "if", "(", "!", "defined", "(", "conceptNameMap", "[", "concept", ".", "name", "]", ")", ")", "{", "return", "concept", ".", "name", ";", "// Default to the name given in...
Given a concept object with name and possibly items properties, return its human-readable version. @private @param {Object} conceptNameMap An object whose keys are the concept.names, eg. "ANCP". Values may be Strings (eg. "Ancestry"), or a 'code map' (eg. "MEASURE" : {"Persons": "Sex", "85 years and over": "Age", "*":...
[ "Given", "a", "concept", "object", "with", "name", "and", "possibly", "items", "properties", "return", "its", "human", "-", "readable", "version", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/AbsIttCatalogItem.js#L616-L632
train
TerriaJS/terriajs
lib/Models/AbsIttCatalogItem.js
getActiveRegionTypeCode
function getActiveRegionTypeCode(item) { // We always put the region first, and at most one is active. var activeRegions = item._concepts[0].activeItems; if (activeRegions.length === 1) { return activeRegions[0].code; } }
javascript
function getActiveRegionTypeCode(item) { // We always put the region first, and at most one is active. var activeRegions = item._concepts[0].activeItems; if (activeRegions.length === 1) { return activeRegions[0].code; } }
[ "function", "getActiveRegionTypeCode", "(", "item", ")", "{", "// We always put the region first, and at most one is active.", "var", "activeRegions", "=", "item", ".", "_concepts", "[", "0", "]", ".", "activeItems", ";", "if", "(", "activeRegions", ".", "length", "==...
Returns the active regiontype code, eg. SA4, or undefined if none _or more than one_ active.
[ "Returns", "the", "active", "regiontype", "code", "eg", ".", "SA4", "or", "undefined", "if", "none", "_or", "more", "than", "one_", "active", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/AbsIttCatalogItem.js#L635-L641
train
TerriaJS/terriajs
lib/Models/AbsIttCatalogItem.js
loadDataFiles
function loadDataFiles(item) { // An array of arrays, indexed by activeItemsPerConcept[conceptIndex][codeIndex]. var activeCodesPerConcept = item._concepts.map(function(concept) { return concept.activeItems; }); // If any one of the concepts has no active selection, there will be no files to load. for (v...
javascript
function loadDataFiles(item) { // An array of arrays, indexed by activeItemsPerConcept[conceptIndex][codeIndex]. var activeCodesPerConcept = item._concepts.map(function(concept) { return concept.activeItems; }); // If any one of the concepts has no active selection, there will be no files to load. for (v...
[ "function", "loadDataFiles", "(", "item", ")", "{", "// An array of arrays, indexed by activeItemsPerConcept[conceptIndex][codeIndex].", "var", "activeCodesPerConcept", "=", "item", ".", "_concepts", ".", "map", "(", "function", "(", "concept", ")", "{", "return", "concep...
Loads all the datafiles for this catalog item, given the active concepts. @private @param {AbsIttCatalogItem} item The AbsIttCatalogItem instance. @return {Promise} A Promise which resolves to an object of TableStructures for each loaded dataset, with the total populations as the final one; and the active combinations...
[ "Loads", "all", "the", "datafiles", "for", "this", "catalog", "item", "given", "the", "active", "concepts", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/AbsIttCatalogItem.js#L656-L718
train
TerriaJS/terriajs
lib/Models/AbsIttCatalogItem.js
buildValueColumns
function buildValueColumns(item, tableStructures, activeCombinations) { // The tableStructures are from the raw data files, one per activeCombinations. return tableStructures.map(function(tableStructure, index) { var columnNames = tableStructure.getColumnNames(); // Check that the data is not blank, and tha...
javascript
function buildValueColumns(item, tableStructures, activeCombinations) { // The tableStructures are from the raw data files, one per activeCombinations. return tableStructures.map(function(tableStructure, index) { var columnNames = tableStructure.getColumnNames(); // Check that the data is not blank, and tha...
[ "function", "buildValueColumns", "(", "item", ",", "tableStructures", ",", "activeCombinations", ")", "{", "// The tableStructures are from the raw data files, one per activeCombinations.", "return", "tableStructures", ".", "map", "(", "function", "(", "tableStructure", ",", ...
Given the loaded data files in their TableStructures, create a suitably named array of columns, from their "Value" columns.
[ "Given", "the", "loaded", "data", "files", "in", "their", "TableStructures", "create", "a", "suitably", "named", "array", "of", "columns", "from", "their", "Value", "columns", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/AbsIttCatalogItem.js#L721-L757
train
TerriaJS/terriajs
lib/Map/TableStructure.js
function(name, options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); DisplayVariablesConcept.call(this, name, { getColorCallback: options.getColorCallback, requireSomeActive: defaultValue(options.requireSomeActive, false) }); this.displayVariableTypes = defaultValue( options.displa...
javascript
function(name, options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); DisplayVariablesConcept.call(this, name, { getColorCallback: options.getColorCallback, requireSomeActive: defaultValue(options.requireSomeActive, false) }); this.displayVariableTypes = defaultValue( options.displa...
[ "function", "(", "name", ",", "options", ")", "{", "options", "=", "defaultValue", "(", "options", ",", "defaultValue", ".", "EMPTY_OBJECT", ")", ";", "DisplayVariablesConcept", ".", "call", "(", "this", ",", "name", ",", "{", "getColorCallback", ":", "optio...
TableStructure provides an abstraction of a data table, ie. a structure with rows and columns. Its primary responsibility is to load and parse the data, from csvs or other. It stores each column as a TableColumn, and saves the rows too if conversion to rows is requested. Columns are also sorted by type for easier acces...
[ "TableStructure", "provides", "an", "abstraction", "of", "a", "data", "table", "ie", ".", "a", "structure", "with", "rows", "and", "columns", ".", "Its", "primary", "responsibility", "is", "to", "load", "and", "parse", "the", "data", "from", "csvs", "or", ...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L66-L112
train
TerriaJS/terriajs
lib/Map/TableStructure.js
castToScalar
function castToScalar(value, state) { if (state.rowNum === 1) { // Don't cast column names return value; } else { var hasDot = /\./; var leadingZero = /^0[0-9]/; var numberWithThousands = /^[1-9]\d?\d?(,\d\d\d)+(\.\d+)?$/; if (numberWithThousands.test(value)) { value ...
javascript
function castToScalar(value, state) { if (state.rowNum === 1) { // Don't cast column names return value; } else { var hasDot = /\./; var leadingZero = /^0[0-9]/; var numberWithThousands = /^[1-9]\d?\d?(,\d\d\d)+(\.\d+)?$/; if (numberWithThousands.test(value)) { value ...
[ "function", "castToScalar", "(", "value", ",", "state", ")", "{", "if", "(", "state", ".", "rowNum", "===", "1", ")", "{", "// Don't cast column names", "return", "value", ";", "}", "else", "{", "var", "hasDot", "=", "/", "\\.", "/", ";", "var", "leadi...
Originally from jquery-csv plugin. Modified to avoid stripping leading zeros.
[ "Originally", "from", "jquery", "-", "csv", "plugin", ".", "Modified", "to", "avoid", "stripping", "leading", "zeros", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L358-L384
train
TerriaJS/terriajs
lib/Map/TableStructure.js
finishFromIndex
function finishFromIndex(timeColumn, index) { if (!defined(timeColumn.displayDuration)) { return timeColumn.finishJulianDates[index]; } else { return JulianDate.addMinutes( timeColumn.julianDates[index], timeColumn.displayDuration, endScratch ); } }
javascript
function finishFromIndex(timeColumn, index) { if (!defined(timeColumn.displayDuration)) { return timeColumn.finishJulianDates[index]; } else { return JulianDate.addMinutes( timeColumn.julianDates[index], timeColumn.displayDuration, endScratch ); } }
[ "function", "finishFromIndex", "(", "timeColumn", ",", "index", ")", "{", "if", "(", "!", "defined", "(", "timeColumn", ".", "displayDuration", ")", ")", "{", "return", "timeColumn", ".", "finishJulianDates", "[", "index", "]", ";", "}", "else", "{", "retu...
Gets the finish time for the specified index. @private @param {TableColumn} timeColumn The time column that applies to this data. @param {Integer} index The index into the time column. @return {JulianDate} The finnish time that corresponds to the index.
[ "Gets", "the", "finish", "time", "for", "the", "specified", "index", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L631-L641
train
TerriaJS/terriajs
lib/Map/TableStructure.js
calculateAvailability
function calculateAvailability(timeColumn, index, endTime) { var startJulianDate = timeColumn.julianDates[index]; if (defined(startJulianDate)) { var finishJulianDate = finishFromIndex(timeColumn, index); return new TimeInterval({ start: timeColumn.julianDates[index], stop: finishJulianDate, ...
javascript
function calculateAvailability(timeColumn, index, endTime) { var startJulianDate = timeColumn.julianDates[index]; if (defined(startJulianDate)) { var finishJulianDate = finishFromIndex(timeColumn, index); return new TimeInterval({ start: timeColumn.julianDates[index], stop: finishJulianDate, ...
[ "function", "calculateAvailability", "(", "timeColumn", ",", "index", ",", "endTime", ")", "{", "var", "startJulianDate", "=", "timeColumn", ".", "julianDates", "[", "index", "]", ";", "if", "(", "defined", "(", "startJulianDate", ")", ")", "{", "var", "fini...
Calculate and return the availability interval for the index'th entry in timeColumn. If the entry has no valid time, returns undefined. @private @param {TableColumn} timeColumn The time column that applies to this data. @param {Integer} index The index into the time column. @param {JulianDate} endTime The last time ...
[ "Calculate", "and", "return", "the", "availability", "interval", "for", "the", "index", "th", "entry", "in", "timeColumn", ".", "If", "the", "entry", "has", "no", "valid", "time", "returns", "undefined", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L652-L663
train
TerriaJS/terriajs
lib/Map/TableStructure.js
calculateTimeIntervals
function calculateTimeIntervals(timeColumn) { // First we find the last time for all of the data (this is an optomisation for the calculateAvailability operation. const endTime = timeColumn.values.reduce(function(latest, value, index) { const current = finishFromIndex(timeColumn, index); if ( !defined...
javascript
function calculateTimeIntervals(timeColumn) { // First we find the last time for all of the data (this is an optomisation for the calculateAvailability operation. const endTime = timeColumn.values.reduce(function(latest, value, index) { const current = finishFromIndex(timeColumn, index); if ( !defined...
[ "function", "calculateTimeIntervals", "(", "timeColumn", ")", "{", "// First we find the last time for all of the data (this is an optomisation for the calculateAvailability operation.", "const", "endTime", "=", "timeColumn", ".", "values", ".", "reduce", "(", "function", "(", "l...
Calculates and returns TimeInterval array, whose elements say when to display each row. @private
[ "Calculates", "and", "returns", "TimeInterval", "array", "whose", "elements", "say", "when", "to", "display", "each", "row", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L669-L685
train
TerriaJS/terriajs
lib/Map/TableStructure.js
createClock
function createClock(timeColumn, tableStructure) { var availabilityCollection = new TimeIntervalCollection(); timeColumn._timeIntervals .filter(function(availability) { return defined(availability && availability.start); }) .forEach(function(availability) { availabilityCollection.addInterval...
javascript
function createClock(timeColumn, tableStructure) { var availabilityCollection = new TimeIntervalCollection(); timeColumn._timeIntervals .filter(function(availability) { return defined(availability && availability.start); }) .forEach(function(availability) { availabilityCollection.addInterval...
[ "function", "createClock", "(", "timeColumn", ",", "tableStructure", ")", "{", "var", "availabilityCollection", "=", "new", "TimeIntervalCollection", "(", ")", ";", "timeColumn", ".", "_timeIntervals", ".", "filter", "(", "function", "(", "availability", ")", "{",...
Returns a DataSourceClock out of this column. Only call if this is a time column. @private
[ "Returns", "a", "DataSourceClock", "out", "of", "this", "column", ".", "Only", "call", "if", "this", "is", "a", "time", "column", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L691-L730
train
TerriaJS/terriajs
lib/Map/TableStructure.js
getIndexOfColumn
function getIndexOfColumn(tableStructure, column) { for (var i = 0; i < tableStructure.columns.length; i++) { if (tableStructure.columns[i] === column) { return i; } } }
javascript
function getIndexOfColumn(tableStructure, column) { for (var i = 0; i < tableStructure.columns.length; i++) { if (tableStructure.columns[i] === column) { return i; } } }
[ "function", "getIndexOfColumn", "(", "tableStructure", ",", "column", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "tableStructure", ".", "columns", ".", "length", ";", "i", "++", ")", "{", "if", "(", "tableStructure", ".", "columns", "["...
Returns the index of the given column, or undefined if none match. @param {TableStructure} tableStructure the table structure. @param {TableColumn} column The column. @returns {integer} The index of the column. @private
[ "Returns", "the", "index", "of", "the", "given", "column", "or", "undefined", "if", "none", "match", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L1030-L1036
train
TerriaJS/terriajs
lib/Map/TableStructure.js
getColumnWithNameOrId
function getColumnWithNameOrId(nameOrId, columns) { for (var i = 0; i < columns.length; i++) { if (columns[i].name === nameOrId || columns[i].id === nameOrId) { return columns[i]; } } }
javascript
function getColumnWithNameOrId(nameOrId, columns) { for (var i = 0; i < columns.length; i++) { if (columns[i].name === nameOrId || columns[i].id === nameOrId) { return columns[i]; } } }
[ "function", "getColumnWithNameOrId", "(", "nameOrId", ",", "columns", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "columns", ".", "length", ";", "i", "++", ")", "{", "if", "(", "columns", "[", "i", "]", ".", "name", "===", "nameOrId"...
Returns the first column with the given name or id, or undefined if none match. @param {String} nameOrId The column name or id. @param {TableColumn[]} columns Test on these columns. @returns {TableColumn} The matching column. @private
[ "Returns", "the", "first", "column", "with", "the", "given", "name", "or", "id", "or", "undefined", "if", "none", "match", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L1045-L1051
train
TerriaJS/terriajs
lib/Map/TableStructure.js
getIdColumns
function getIdColumns(idColumnNames, columns) { if (!defined(idColumnNames)) { return []; } return idColumnNames.map(name => getColumnWithNameIdOrIndex(name, columns)); }
javascript
function getIdColumns(idColumnNames, columns) { if (!defined(idColumnNames)) { return []; } return idColumnNames.map(name => getColumnWithNameIdOrIndex(name, columns)); }
[ "function", "getIdColumns", "(", "idColumnNames", ",", "columns", ")", "{", "if", "(", "!", "defined", "(", "idColumnNames", ")", ")", "{", "return", "[", "]", ";", "}", "return", "idColumnNames", ".", "map", "(", "name", "=>", "getColumnWithNameIdOrIndex", ...
columns is a required parameter.
[ "columns", "is", "a", "required", "parameter", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L1101-L1106
train
TerriaJS/terriajs
lib/Map/TableStructure.js
getIdMapping
function getIdMapping(idColumnNames, columns) { var idColumns = getIdColumns(idColumnNames, columns); if (idColumns.length === 0) { return {}; } return idColumns[0].values.reduce(function(result, value, rowNumber) { var idString = getIdStringForRowNumber(idColumns, rowNumber); if (!defined(result[id...
javascript
function getIdMapping(idColumnNames, columns) { var idColumns = getIdColumns(idColumnNames, columns); if (idColumns.length === 0) { return {}; } return idColumns[0].values.reduce(function(result, value, rowNumber) { var idString = getIdStringForRowNumber(idColumns, rowNumber); if (!defined(result[id...
[ "function", "getIdMapping", "(", "idColumnNames", ",", "columns", ")", "{", "var", "idColumns", "=", "getIdColumns", "(", "idColumnNames", ",", "columns", ")", ";", "if", "(", "idColumns", ".", "length", "===", "0", ")", "{", "return", "{", "}", ";", "}"...
Both arguments are required.
[ "Both", "arguments", "are", "required", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L1137-L1150
train
TerriaJS/terriajs
lib/Map/TableStructure.js
getSortedColumns
function getSortedColumns(tableStructure, sortColumn, compareFunction) { // With help from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort var mappedArray = sortColumn.julianDatesOrValues.map(function(value, i) { return { index: i, value: value }; }); if (!defined...
javascript
function getSortedColumns(tableStructure, sortColumn, compareFunction) { // With help from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort var mappedArray = sortColumn.julianDatesOrValues.map(function(value, i) { return { index: i, value: value }; }); if (!defined...
[ "function", "getSortedColumns", "(", "tableStructure", ",", "sortColumn", ",", "compareFunction", ")", "{", "// With help from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort", "var", "mappedArray", "=", "sortColumn", ".", "julianDatesOrVal...
Returns new columns sorted in sortColumn order.
[ "Returns", "new", "columns", "sorted", "in", "sortColumn", "order", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L1380-L1406
train
TerriaJS/terriajs
lib/Map/TableStructure.js
getColumnOptions
function getColumnOptions(name, tableStructure, columnNumber) { var columnOptions = defaultValue.EMPTY_OBJECT; if (defined(tableStructure.columnOptions)) { columnOptions = defaultValue( tableStructure.columnOptions[name], defaultValue( tableStructure.columnOptions[columnNumber], defa...
javascript
function getColumnOptions(name, tableStructure, columnNumber) { var columnOptions = defaultValue.EMPTY_OBJECT; if (defined(tableStructure.columnOptions)) { columnOptions = defaultValue( tableStructure.columnOptions[name], defaultValue( tableStructure.columnOptions[columnNumber], defa...
[ "function", "getColumnOptions", "(", "name", ",", "tableStructure", ",", "columnNumber", ")", "{", "var", "columnOptions", "=", "defaultValue", ".", "EMPTY_OBJECT", ";", "if", "(", "defined", "(", "tableStructure", ".", "columnOptions", ")", ")", "{", "columnOpt...
Return column options object, using defaults where appropriate. @param {String} name Name of column @param {TableStructure} tableStructure TableStructure to use to calculate values. @param {Int} columnNumber Which column should be used as template for default column options @return {Object} Column options that Tabl...
[ "Return", "column", "options", "object", "using", "defaults", "where", "appropriate", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L1534-L1577
train
TerriaJS/terriajs
lib/Map/TableStructure.js
areColumnsEqualLength
function areColumnsEqualLength(columns) { if (columns.length <= 1) { return true; } var firstLength = columns[0].values.length; var columnsWithTheSameLength = columns.slice(1).filter(function(column) { return column.values.length === firstLength; }); return columnsWithTheSameLength.length === column...
javascript
function areColumnsEqualLength(columns) { if (columns.length <= 1) { return true; } var firstLength = columns[0].values.length; var columnsWithTheSameLength = columns.slice(1).filter(function(column) { return column.values.length === firstLength; }); return columnsWithTheSameLength.length === column...
[ "function", "areColumnsEqualLength", "(", "columns", ")", "{", "if", "(", "columns", ".", "length", "<=", "1", ")", "{", "return", "true", ";", "}", "var", "firstLength", "=", "columns", "[", "0", "]", ".", "values", ".", "length", ";", "var", "columns...
Normally a TableStructure is generated from a csvString, using loadFromCsv, or via loadFromJson. However, if its columns are set directly, we should check the columns are all the same length. @private @param {Concept[]} columns Array of columns to check. @return {Boolean} True if the columns are all the same length, f...
[ "Normally", "a", "TableStructure", "is", "generated", "from", "a", "csvString", "using", "loadFromCsv", "or", "via", "loadFromJson", ".", "However", "if", "its", "columns", "are", "set", "directly", "we", "should", "check", "the", "columns", "are", "all", "the...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableStructure.js#L1586-L1595
train
TerriaJS/terriajs
lib/Map/DisplayVariablesConcept.js
function(name, options) { const that = this; name = defaultValue(name, "Display Variable"); options = defaultValue(options, defaultValue.EMPTY_OBJECT); VariableConcept.call(this, name, options); /** * Gets or sets a flag for whether more than one checkbox can be selected at a time. * Default false. ...
javascript
function(name, options) { const that = this; name = defaultValue(name, "Display Variable"); options = defaultValue(options, defaultValue.EMPTY_OBJECT); VariableConcept.call(this, name, options); /** * Gets or sets a flag for whether more than one checkbox can be selected at a time. * Default false. ...
[ "function", "(", "name", ",", "options", ")", "{", "const", "that", "=", "this", ";", "name", "=", "defaultValue", "(", "name", ",", "\"Display Variable\"", ")", ";", "options", "=", "defaultValue", "(", "options", ",", "defaultValue", ".", "EMPTY_OBJECT", ...
Represents a concept which contains a list of variables which can be used to change the appearance of data. A DisplayVariablesConcept contains an items array of VariableConcepts. @alias DisplayVariablesConcept @constructor @extends VariableConcept @param {String} [name='Display Variable'] Display name of this concept....
[ "Represents", "a", "concept", "which", "contains", "a", "list", "of", "variables", "which", "can", "be", "used", "to", "change", "the", "appearance", "of", "data", ".", "A", "DisplayVariablesConcept", "contains", "an", "items", "array", "of", "VariableConcepts",...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/DisplayVariablesConcept.js#L31-L117
train
TerriaJS/terriajs
lib/Map/DisplayVariablesConcept.js
getNestedNodes
function getNestedNodes(concept, condition) { if (condition(concept)) { return concept; } if (!concept.items) { return []; } return concept.items.map(child => getNestedNodes(child, condition)); }
javascript
function getNestedNodes(concept, condition) { if (condition(concept)) { return concept; } if (!concept.items) { return []; } return concept.items.map(child => getNestedNodes(child, condition)); }
[ "function", "getNestedNodes", "(", "concept", ",", "condition", ")", "{", "if", "(", "condition", "(", "concept", ")", ")", "{", "return", "concept", ";", "}", "if", "(", "!", "concept", ".", "items", ")", "{", "return", "[", "]", ";", "}", "return",...
Returns a nested array containing only the leaf concepts, at their actual depths in the tree of nodes.
[ "Returns", "a", "nested", "array", "containing", "only", "the", "leaf", "concepts", "at", "their", "actual", "depths", "in", "the", "tree", "of", "nodes", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/DisplayVariablesConcept.js#L139-L147
train
TerriaJS/terriajs
lib/Models/RegionParameter.js
function(options) { if (!defined(options) || !defined(options.regionProvider)) { throw new DeveloperError("options.regionProvider is required."); } FunctionParameter.call(this, options); this._regionProvider = options.regionProvider; }
javascript
function(options) { if (!defined(options) || !defined(options.regionProvider)) { throw new DeveloperError("options.regionProvider is required."); } FunctionParameter.call(this, options); this._regionProvider = options.regionProvider; }
[ "function", "(", "options", ")", "{", "if", "(", "!", "defined", "(", "options", ")", "||", "!", "defined", "(", "options", ".", "regionProvider", ")", ")", "{", "throw", "new", "DeveloperError", "(", "\"options.regionProvider is required.\"", ")", ";", "}",...
A parameter that specifies a particular region. @alias RegionParameter @constructor @extends FunctionParameter @param {Object} [options] Object with the following properties: @param {Terria} options.terria The Terria instance. @param {String} options.id The unique ID of this parameter. @param {String} [options.name] ...
[ "A", "parameter", "that", "specifies", "a", "particular", "region", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/RegionParameter.js#L26-L34
train
TerriaJS/terriajs
lib/Models/setClockCurrentTime.js
setClockCurrentTime
function setClockCurrentTime(clock, initialTimeSource, stopTime) { if (!defined(clock)) { return; } // This is our default. Start at the nearest instant in time. var now = JulianDate.now(); _setTimeIfInRange(clock, now, stopTime); initialTimeSource = defaultValue(initialTimeSource, "present"); switc...
javascript
function setClockCurrentTime(clock, initialTimeSource, stopTime) { if (!defined(clock)) { return; } // This is our default. Start at the nearest instant in time. var now = JulianDate.now(); _setTimeIfInRange(clock, now, stopTime); initialTimeSource = defaultValue(initialTimeSource, "present"); switc...
[ "function", "setClockCurrentTime", "(", "clock", ",", "initialTimeSource", ",", "stopTime", ")", "{", "if", "(", "!", "defined", "(", "clock", ")", ")", "{", "return", ";", "}", "// This is our default. Start at the nearest instant in time.", "var", "now", "=", "J...
Sets the current time of the clock, using a string defined specification for the time point to use. @param {DataSourceClock} clock clock to set the current time on. @param {String} initialTimeSource A string specifiying the value to use when setting the currentTime of the clock. Valid options are: ("present": closest t...
[ "Sets", "the", "current", "time", "of", "the", "clock", "using", "a", "string", "defined", "specification", "for", "the", "time", "point", "to", "use", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/setClockCurrentTime.js#L39-L81
train
TerriaJS/terriajs
lib/ViewModels/GazetteerSearchProviderViewModel.js
stripDuplicates
function stripDuplicates(results) { var i; var placeshash = {}; var stripped = []; for (i = 0; i < results.length; i++) { var lat = Number(results[i].location.split(",")[0]).toFixed(1); var lng = Number(results[i].location.split(",")[1]).toFixed(1); var hash = results[i].name + "_" + lat + " " + ln...
javascript
function stripDuplicates(results) { var i; var placeshash = {}; var stripped = []; for (i = 0; i < results.length; i++) { var lat = Number(results[i].location.split(",")[0]).toFixed(1); var lng = Number(results[i].location.split(",")[1]).toFixed(1); var hash = results[i].name + "_" + lat + " " + ln...
[ "function", "stripDuplicates", "(", "results", ")", "{", "var", "i", ";", "var", "placeshash", "=", "{", "}", ";", "var", "stripped", "=", "[", "]", ";", "for", "(", "i", "=", "0", ";", "i", "<", "results", ".", "length", ";", "i", "++", ")", "...
Given a list of results sorted in decreasing importance, strip results that are close to another result with the same name
[ "Given", "a", "list", "of", "results", "sorted", "in", "decreasing", "importance", "strip", "results", "that", "are", "close", "to", "another", "result", "with", "the", "same", "name" ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ViewModels/GazetteerSearchProviderViewModel.js#L124-L139
train
TerriaJS/terriajs
lib/ViewModels/GnafSearchProviderViewModel.js
function(options) { SearchProviderViewModel.call(this); options = defaultValue(options, defaultValue.EMPTY_OBJECT); this.terria = options.terria; var url = defaultValue( options.url, this.terria.configParameters.gnafSearchUrl ); this.name = NAME; this.gnafApi = defaultValue( options.gnafApi...
javascript
function(options) { SearchProviderViewModel.call(this); options = defaultValue(options, defaultValue.EMPTY_OBJECT); this.terria = options.terria; var url = defaultValue( options.url, this.terria.configParameters.gnafSearchUrl ); this.name = NAME; this.gnafApi = defaultValue( options.gnafApi...
[ "function", "(", "options", ")", "{", "SearchProviderViewModel", ".", "call", "(", "this", ")", ";", "options", "=", "defaultValue", "(", "options", ",", "defaultValue", ".", "EMPTY_OBJECT", ")", ";", "this", ".", "terria", "=", "options", ".", "terria", "...
Search provider that uses the Data61 Elastic Search GNAF service to look up addresses. @param options.terria Terria instance @param [options.gnafApi] The GnafApi object to query - if none is provided one will be created using terria.corsProxy and the default settings. @param [options.flightDurationSeconds] The number ...
[ "Search", "provider", "that", "uses", "the", "Data61", "Elastic", "Search", "GNAF", "service", "to", "look", "up", "addresses", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ViewModels/GnafSearchProviderViewModel.js#L24-L42
train
TerriaJS/terriajs
lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js
getShareData
function getShareData(terria) { const initSources = terria.initSources.slice(); addUserAddedCatalog(terria, initSources); addSharedMembers(terria, initSources); addViewSettings(terria, initSources); addFeaturePicking(terria, initSources); addLocationMarker(terria, initSources); return { version: "0....
javascript
function getShareData(terria) { const initSources = terria.initSources.slice(); addUserAddedCatalog(terria, initSources); addSharedMembers(terria, initSources); addViewSettings(terria, initSources); addFeaturePicking(terria, initSources); addLocationMarker(terria, initSources); return { version: "0....
[ "function", "getShareData", "(", "terria", ")", "{", "const", "initSources", "=", "terria", ".", "initSources", ".", "slice", "(", ")", ";", "addUserAddedCatalog", "(", "terria", ",", "initSources", ")", ";", "addSharedMembers", "(", "terria", ",", "initSource...
Returns just the JSON that defines the current view. @param {Object} terria The Terria object. @return {Object}
[ "Returns", "just", "the", "JSON", "that", "defines", "the", "current", "view", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js#L40-L53
train
TerriaJS/terriajs
lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js
addUserAddedCatalog
function addUserAddedCatalog(terria, initSources) { const localDataFilterRemembering = rememberRejections( CatalogMember.itemFilters.noLocalData ); const userAddedCatalog = terria.catalog.serializeToJson({ itemFilter: combineFilters([ localDataFilterRemembering.filter, CatalogMember.itemFilte...
javascript
function addUserAddedCatalog(terria, initSources) { const localDataFilterRemembering = rememberRejections( CatalogMember.itemFilters.noLocalData ); const userAddedCatalog = terria.catalog.serializeToJson({ itemFilter: combineFilters([ localDataFilterRemembering.filter, CatalogMember.itemFilte...
[ "function", "addUserAddedCatalog", "(", "terria", ",", "initSources", ")", "{", "const", "localDataFilterRemembering", "=", "rememberRejections", "(", "CatalogMember", ".", "itemFilters", ".", "noLocalData", ")", ";", "const", "userAddedCatalog", "=", "terria", ".", ...
Adds user-added catalog members to the passed initSources. @private
[ "Adds", "user", "-", "added", "catalog", "members", "to", "the", "passed", "initSources", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js#L89-L115
train
TerriaJS/terriajs
lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js
addSharedMembers
function addSharedMembers(terria, initSources) { const catalogForSharing = flattenCatalog( terria.catalog.serializeToJson({ itemFilter: combineFilters([CatalogMember.itemFilters.noLocalData]), propertyFilter: combineFilters([ CatalogMember.propertyFilters.sharedOnly, function(property)...
javascript
function addSharedMembers(terria, initSources) { const catalogForSharing = flattenCatalog( terria.catalog.serializeToJson({ itemFilter: combineFilters([CatalogMember.itemFilters.noLocalData]), propertyFilter: combineFilters([ CatalogMember.propertyFilters.sharedOnly, function(property)...
[ "function", "addSharedMembers", "(", "terria", ",", "initSources", ")", "{", "const", "catalogForSharing", "=", "flattenCatalog", "(", "terria", ".", "catalog", ".", "serializeToJson", "(", "{", "itemFilter", ":", "combineFilters", "(", "[", "CatalogMember", ".", ...
Adds existing catalog members that the user has enabled or opened to the passed initSources object. @private
[ "Adds", "existing", "catalog", "members", "that", "the", "user", "has", "enabled", "or", "opened", "to", "the", "passed", "initSources", "object", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js#L121-L159
train
TerriaJS/terriajs
lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js
addViewSettings
function addViewSettings(terria, initSources) { const cameraExtent = terria.currentViewer.getCurrentExtent(); // Add an init source with the camera position. const initialCamera = { west: CesiumMath.toDegrees(cameraExtent.west), south: CesiumMath.toDegrees(cameraExtent.south), east: CesiumMath.toDegr...
javascript
function addViewSettings(terria, initSources) { const cameraExtent = terria.currentViewer.getCurrentExtent(); // Add an init source with the camera position. const initialCamera = { west: CesiumMath.toDegrees(cameraExtent.west), south: CesiumMath.toDegrees(cameraExtent.south), east: CesiumMath.toDegr...
[ "function", "addViewSettings", "(", "terria", ",", "initSources", ")", "{", "const", "cameraExtent", "=", "terria", ".", "currentViewer", ".", "getCurrentExtent", "(", ")", ";", "// Add an init source with the camera position.", "const", "initialCamera", "=", "{", "we...
Adds the details of the current view to the init sources. @private
[ "Adds", "the", "details", "of", "the", "current", "view", "to", "the", "init", "sources", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js#L165-L223
train
TerriaJS/terriajs
lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js
addFeaturePicking
function addFeaturePicking(terria, initSources) { if ( defined(terria.pickedFeatures) && terria.pickedFeatures.features.length > 0 ) { const positionInRadians = Ellipsoid.WGS84.cartesianToCartographic( terria.pickedFeatures.pickPosition ); const pickedFeatures = { providerCoords: te...
javascript
function addFeaturePicking(terria, initSources) { if ( defined(terria.pickedFeatures) && terria.pickedFeatures.features.length > 0 ) { const positionInRadians = Ellipsoid.WGS84.cartesianToCartographic( terria.pickedFeatures.pickPosition ); const pickedFeatures = { providerCoords: te...
[ "function", "addFeaturePicking", "(", "terria", ",", "initSources", ")", "{", "if", "(", "defined", "(", "terria", ".", "pickedFeatures", ")", "&&", "terria", ".", "pickedFeatures", ".", "features", ".", "length", ">", "0", ")", "{", "const", "positionInRadi...
Add details of currently picked features. @private
[ "Add", "details", "of", "currently", "picked", "features", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js#L229-L270
train
TerriaJS/terriajs
lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js
addLocationMarker
function addLocationMarker(terria, initSources) { if (defined(terria.locationMarker)) { const position = terria.locationMarker.entities.values[0].position.getValue(); const positionDegrees = Ellipsoid.WGS84.cartesianToCartographic(position); initSources.push({ locationMarker: { name: terria...
javascript
function addLocationMarker(terria, initSources) { if (defined(terria.locationMarker)) { const position = terria.locationMarker.entities.values[0].position.getValue(); const positionDegrees = Ellipsoid.WGS84.cartesianToCartographic(position); initSources.push({ locationMarker: { name: terria...
[ "function", "addLocationMarker", "(", "terria", ",", "initSources", ")", "{", "if", "(", "defined", "(", "terria", ".", "locationMarker", ")", ")", "{", "const", "position", "=", "terria", ".", "locationMarker", ".", "entities", ".", "values", "[", "0", "]...
Add details of the location marker if it is set. @private
[ "Add", "details", "of", "the", "location", "marker", "if", "it", "is", "set", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js#L276-L289
train
TerriaJS/terriajs
lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js
rememberRejections
function rememberRejections(filterFn) { const rejections = []; return { filter: function(item) { const allowed = filterFn(item); if (!allowed) { rejections.push(item); } return allowed; }, rejections: rejections }; }
javascript
function rememberRejections(filterFn) { const rejections = []; return { filter: function(item) { const allowed = filterFn(item); if (!allowed) { rejections.push(item); } return allowed; }, rejections: rejections }; }
[ "function", "rememberRejections", "(", "filterFn", ")", "{", "const", "rejections", "=", "[", "]", ";", "return", "{", "filter", ":", "function", "(", "item", ")", "{", "const", "allowed", "=", "filterFn", "(", "item", ")", ";", "if", "(", "!", "allowe...
Wraps around a filter function and records all items that are excluded by it. Does not modify the function passed in. @param filterFn The fn to wrap around @returns {{filter: filter, rejections: Array}} The resulting filter function that remembers rejections, and an array array of the rejected items. As the filter fun...
[ "Wraps", "around", "a", "filter", "function", "and", "records", "all", "items", "that", "are", "excluded", "by", "it", ".", "Does", "not", "modify", "the", "function", "passed", "in", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Map/Panels/SharePanel/BuildShareLink.js#L298-L313
train
TerriaJS/terriajs
lib/Models/getAncestors.js
getAncestors
function getAncestors(member) { var parent = member.parent; var ancestors = []; while (defined(parent) && defined(parent.parent)) { ancestors = [parent].concat(ancestors); parent = parent.parent; } return ancestors; }
javascript
function getAncestors(member) { var parent = member.parent; var ancestors = []; while (defined(parent) && defined(parent.parent)) { ancestors = [parent].concat(ancestors); parent = parent.parent; } return ancestors; }
[ "function", "getAncestors", "(", "member", ")", "{", "var", "parent", "=", "member", ".", "parent", ";", "var", "ancestors", "=", "[", "]", ";", "while", "(", "defined", "(", "parent", ")", "&&", "defined", "(", "parent", ".", "parent", ")", ")", "{"...
Return the ancestors in the data catalog of the given catalog member, recursively using "member.parent". The "Root Group" is not included. @param {CatalogMember} member The catalog member. @return {CatalogMember[]} The members' ancestors in its parent tree, starting at the top, not including this member.
[ "Return", "the", "ancestors", "in", "the", "data", "catalog", "of", "the", "given", "catalog", "member", "recursively", "using", "member", ".", "parent", ".", "The", "Root", "Group", "is", "not", "included", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/getAncestors.js#L12-L20
train
TerriaJS/terriajs
lib/ReactViews/Preview/Description.js
getBetterFileName
function getBetterFileName(dataUrlType, itemName, format) { let name = itemName; const extension = "." + format; // Only add the extension if it's not already there. if (name.indexOf(extension) !== name.length - extension.length) { name = name + extension; } // For local files, the file already exists o...
javascript
function getBetterFileName(dataUrlType, itemName, format) { let name = itemName; const extension = "." + format; // Only add the extension if it's not already there. if (name.indexOf(extension) !== name.length - extension.length) { name = name + extension; } // For local files, the file already exists o...
[ "function", "getBetterFileName", "(", "dataUrlType", ",", "itemName", ",", "format", ")", "{", "let", "name", "=", "itemName", ";", "const", "extension", "=", "\".\"", "+", "format", ";", "// Only add the extension if it's not already there.", "if", "(", "name", "...
Return a nicer filename for this file. @private
[ "Return", "a", "nicer", "filename", "for", "this", "file", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Preview/Description.js#L329-L341
train
TerriaJS/terriajs
lib/Map/RegionProvider.js
applyReplacements
function applyReplacements(regionProvider, s, replacementsProp) { if (!defined(s)) { return undefined; } var r; if (typeof s === "number") { r = String(s); } else { r = s.toLowerCase().trim(); } var replacements = regionProvider[replacementsProp]; if (replacements === undefined || replacemen...
javascript
function applyReplacements(regionProvider, s, replacementsProp) { if (!defined(s)) { return undefined; } var r; if (typeof s === "number") { r = String(s); } else { r = s.toLowerCase().trim(); } var replacements = regionProvider[replacementsProp]; if (replacements === undefined || replacemen...
[ "function", "applyReplacements", "(", "regionProvider", ",", "s", ",", "replacementsProp", ")", "{", "if", "(", "!", "defined", "(", "s", ")", ")", "{", "return", "undefined", ";", "}", "var", "r", ";", "if", "(", "typeof", "s", "===", "\"number\"", ")...
Apply an array of regular expression replacements to a string. Also caches the applied replacements in regionProvider._appliedReplacements. @private @param {RegionProvider} regionProvider The RegionProvider instance. @param {String} s The string. @param {String} replacementsProp Name of a property containing [ [ regex,...
[ "Apply", "an", "array", "of", "regular", "expression", "replacements", "to", "a", "string", ".", "Also", "caches", "the", "applied", "replacements", "in", "regionProvider", ".", "_appliedReplacements", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/RegionProvider.js#L689-L713
train
TerriaJS/terriajs
lib/Map/RegionProvider.js
findRegionIndex
function findRegionIndex(regionProvider, code, disambigCode) { if (!defined(code) || code === "") { // Note a code of 0 is ok return -1; } var processedCode = applyReplacements( regionProvider, code, "dataReplacements" ); var id = regionProvider._idIndex[processedCode]; if (!defined(id))...
javascript
function findRegionIndex(regionProvider, code, disambigCode) { if (!defined(code) || code === "") { // Note a code of 0 is ok return -1; } var processedCode = applyReplacements( regionProvider, code, "dataReplacements" ); var id = regionProvider._idIndex[processedCode]; if (!defined(id))...
[ "function", "findRegionIndex", "(", "regionProvider", ",", "code", ",", "disambigCode", ")", "{", "if", "(", "!", "defined", "(", "code", ")", "||", "code", "===", "\"\"", ")", "{", "// Note a code of 0 is ok", "return", "-", "1", ";", "}", "var", "process...
Given a region code, try to find a region that matches it, using replacements, disambiguation, indexes and other wizardry. @private @param {RegionProvider} regionProvider The RegionProvider instance. @param {String} code Code to search for. Falsy codes return -1. @returns {Number} Zero-based index in list of regions if...
[ "Given", "a", "region", "code", "try", "to", "find", "a", "region", "that", "matches", "it", "using", "replacements", "disambiguation", "indexes", "and", "other", "wizardry", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/RegionProvider.js#L722-L763
train
TerriaJS/terriajs
lib/ReactViews/Custom/registerCustomComponentTypes.js
getSourceData
function getSourceData(node, children) { const sourceData = node.attribs["data"]; if (sourceData) { return sourceData; } if (Array.isArray(children) && children.length > 0) { return children[0]; } return children; }
javascript
function getSourceData(node, children) { const sourceData = node.attribs["data"]; if (sourceData) { return sourceData; } if (Array.isArray(children) && children.length > 0) { return children[0]; } return children; }
[ "function", "getSourceData", "(", "node", ",", "children", ")", "{", "const", "sourceData", "=", "node", ".", "attribs", "[", "\"data\"", "]", ";", "if", "(", "sourceData", ")", "{", "return", "sourceData", ";", "}", "if", "(", "Array", ".", "isArray", ...
Returns the 'data' attribute if available, otherwise the child of this node. @private
[ "Returns", "the", "data", "attribute", "if", "available", "otherwise", "the", "child", "of", "this", "node", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Custom/registerCustomComponentTypes.js#L249-L258
train
TerriaJS/terriajs
lib/ReactViews/Custom/registerCustomComponentTypes.js
tableStructureFromStringData
function tableStructureFromStringData(stringData) { // sourceData can be either json (starts with a '[') or csv format (contains a true line feed or '\n'; \n is replaced with a real linefeed). if (!defined(stringData) || stringData.length < 2) { return; } // We prevent ALT, LON and LAT from being ...
javascript
function tableStructureFromStringData(stringData) { // sourceData can be either json (starts with a '[') or csv format (contains a true line feed or '\n'; \n is replaced with a real linefeed). if (!defined(stringData) || stringData.length < 2) { return; } // We prevent ALT, LON and LAT from being ...
[ "function", "tableStructureFromStringData", "(", "stringData", ")", "{", "// sourceData can be either json (starts with a '[') or csv format (contains a true line feed or '\\n'; \\n is replaced with a real linefeed).", "if", "(", "!", "defined", "(", "stringData", ")", "||", "stringDat...
This function does not activate any columns in itself. That should be done by TableCatalogItem when it is created around this. @private
[ "This", "function", "does", "not", "activate", "any", "columns", "in", "itself", ".", "That", "should", "be", "done", "by", "TableCatalogItem", "when", "it", "is", "created", "around", "this", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Custom/registerCustomComponentTypes.js#L265-L283
train
TerriaJS/terriajs
lib/Core/readJson.js
readJson
function readJson(file) { return when( readText(file), function(result) { try { return JSON.parse(result); } catch (e) { if (e instanceof SyntaxError) { return json5.parse(result); } else { throw e; } } }, function(e) { throw ...
javascript
function readJson(file) { return when( readText(file), function(result) { try { return JSON.parse(result); } catch (e) { if (e instanceof SyntaxError) { return json5.parse(result); } else { throw e; } } }, function(e) { throw ...
[ "function", "readJson", "(", "file", ")", "{", "return", "when", "(", "readText", "(", "file", ")", ",", "function", "(", "result", ")", "{", "try", "{", "return", "JSON", ".", "parse", "(", "result", ")", ";", "}", "catch", "(", "e", ")", "{", "...
Try to read the file as JSON. If that fails, try JSON5. @param {File} file The file. @return {Object} The JSON or json5 object described by the file.
[ "Try", "to", "read", "the", "file", "as", "JSON", ".", "If", "that", "fails", "try", "JSON5", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/readJson.js#L14-L32
train
TerriaJS/terriajs
lib/Models/GeoJsonParameter.js
function(options) { FunctionParameter.call(this, options); this.regionParameter = options.regionParameter; this.value = ""; this._subtype = undefined; }
javascript
function(options) { FunctionParameter.call(this, options); this.regionParameter = options.regionParameter; this.value = ""; this._subtype = undefined; }
[ "function", "(", "options", ")", "{", "FunctionParameter", ".", "call", "(", "this", ",", "options", ")", ";", "this", ".", "regionParameter", "=", "options", ".", "regionParameter", ";", "this", ".", "value", "=", "\"\"", ";", "this", ".", "_subtype", "...
A parameter that specifies an arbitrary polygon on the globe. @alias GeoJsonParameter @constructor @extends FunctionParameter @param {Object} options Object with the following properties: @param {Terria} options.terria The Terria instance. @param {String} options.id The unique ID of this parameter. @param {String} [o...
[ "A", "parameter", "that", "specifies", "an", "arbitrary", "polygon", "on", "the", "globe", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/GeoJsonParameter.js#L26-L31
train
TerriaJS/terriajs
lib/Models/createCatalogItemFromFileOrUrl.js
function( terria, viewState, fileOrUrl, dataType, confirmConversion ) { function tryConversionService(newItem) { if (terria.configParameters.conversionServiceBaseUrl === false) { // Don't allow conversion service. Duplicated in OgrCatalogItem.js terria.error.raiseEvent( new TerriaErr...
javascript
function( terria, viewState, fileOrUrl, dataType, confirmConversion ) { function tryConversionService(newItem) { if (terria.configParameters.conversionServiceBaseUrl === false) { // Don't allow conversion service. Duplicated in OgrCatalogItem.js terria.error.raiseEvent( new TerriaErr...
[ "function", "(", "terria", ",", "viewState", ",", "fileOrUrl", ",", "dataType", ",", "confirmConversion", ")", "{", "function", "tryConversionService", "(", "newItem", ")", "{", "if", "(", "terria", ".", "configParameters", ".", "conversionServiceBaseUrl", "===", ...
Asynchronously creates and loads a catalog item for a given file. The returned promise does not resolve until the catalog item is successfully loaded, and it rejects if the file is not in the expected format or another error occurs during loading. If the OGR-based conversion service needs to be invoked to convert the...
[ "Asynchronously", "creates", "and", "loads", "a", "catalog", "item", "for", "a", "given", "file", ".", "The", "returned", "promise", "does", "not", "resolve", "until", "the", "catalog", "item", "is", "successfully", "loaded", "and", "it", "rejects", "if", "t...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/createCatalogItemFromFileOrUrl.js#L30-L128
train
TerriaJS/terriajs
lib/Map/Legend.js
drawTick
function drawTick(y) { barGroup.appendChild( svgElement( legend, "line", { x1: legend.itemWidth, x2: legend.itemWidth + 5, y1: y, y2: y }, "tick-mark" ) ); }
javascript
function drawTick(y) { barGroup.appendChild( svgElement( legend, "line", { x1: legend.itemWidth, x2: legend.itemWidth + 5, y1: y, y2: y }, "tick-mark" ) ); }
[ "function", "drawTick", "(", "y", ")", "{", "barGroup", ".", "appendChild", "(", "svgElement", "(", "legend", ",", "\"line\"", ",", "{", "x1", ":", "legend", ".", "itemWidth", ",", "x2", ":", "legend", ".", "itemWidth", "+", "5", ",", "y1", ":", "y",...
draw a subtle tick to help indicate what the label refers to
[ "draw", "a", "subtle", "tick", "to", "help", "indicate", "what", "the", "label", "refers", "to" ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/Legend.js#L412-L426
train
TerriaJS/terriajs
lib/Map/AbsCode.js
function(code, name, concept) { Concept.call(this, name); /** * Gets or sets the value of the abs code. * @type {String} */ this.code = code; /** * Gets the list of abs codes contained in this group. This property is observable. * @type {AbsCode[]} */ this.items = []; /** * Gets or s...
javascript
function(code, name, concept) { Concept.call(this, name); /** * Gets or sets the value of the abs code. * @type {String} */ this.code = code; /** * Gets the list of abs codes contained in this group. This property is observable. * @type {AbsCode[]} */ this.items = []; /** * Gets or s...
[ "function", "(", "code", ",", "name", ",", "concept", ")", "{", "Concept", ".", "call", "(", "this", ",", "name", ")", ";", "/**\n * Gets or sets the value of the abs code.\n * @type {String}\n */", "this", ".", "code", "=", "code", ";", "/**\n * Gets the li...
Represents an ABS code associated with a AbsConcept. An AbsCode may contains an array one of more child AbsCodes. @alias AbsCode @constructor @extends {Concept}
[ "Represents", "an", "ABS", "code", "associated", "with", "a", "AbsConcept", ".", "An", "AbsCode", "may", "contains", "an", "array", "one", "of", "more", "child", "AbsCodes", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/AbsCode.js#L20-L75
train
TerriaJS/terriajs
lib/ReactViews/ObserveModelMixin.js
disposeSubscription
function disposeSubscription(component) { if (defined(component.__observeModelChangeSubscriptions)) { for ( let i = 0; i < component.__observeModelChangeSubscriptions.length; ++i ) { component.__observeModelChangeSubscriptions[i].dispose(); } component.__observeModelChangeSubsc...
javascript
function disposeSubscription(component) { if (defined(component.__observeModelChangeSubscriptions)) { for ( let i = 0; i < component.__observeModelChangeSubscriptions.length; ++i ) { component.__observeModelChangeSubscriptions[i].dispose(); } component.__observeModelChangeSubsc...
[ "function", "disposeSubscription", "(", "component", ")", "{", "if", "(", "defined", "(", "component", ".", "__observeModelChangeSubscriptions", ")", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "component", ".", "__observeModelChangeSubscriptions"...
Disposes of all subscriptions that a component currently has. @param component The component to find and dispose subscriptions on.
[ "Disposes", "of", "all", "subscriptions", "that", "a", "component", "currently", "has", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/ObserveModelMixin.js#L98-L109
train
TerriaJS/terriajs
lib/Models/RegionTypeParameter.js
function(options) { FunctionParameter.call(this, options); this._regionProviderPromise = undefined; this._regionProviderList = undefined; this.validRegionTypes = options.validRegionTypes; // Track this so that defaultValue can update once regionProviderList is known. knockout.track(this, ["_regionProvide...
javascript
function(options) { FunctionParameter.call(this, options); this._regionProviderPromise = undefined; this._regionProviderList = undefined; this.validRegionTypes = options.validRegionTypes; // Track this so that defaultValue can update once regionProviderList is known. knockout.track(this, ["_regionProvide...
[ "function", "(", "options", ")", "{", "FunctionParameter", ".", "call", "(", "this", ",", "options", ")", ";", "this", ".", "_regionProviderPromise", "=", "undefined", ";", "this", ".", "_regionProviderList", "=", "undefined", ";", "this", ".", "validRegionTyp...
A parameter that specifies a type of region. @alias RegionTypeParameter @constructor @extends FunctionParameter @param {Object} [options] Object with the following properties: @param {Terria} options.terria The Terria instance. @param {String} options.id The unique ID of this parameter. @param {String} [options.name]...
[ "A", "parameter", "that", "specifies", "a", "type", "of", "region", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/RegionTypeParameter.js#L29-L79
train
TerriaJS/terriajs
lib/Models/NowViewing.js
function(terria) { this._terria = terria; this._eventSubscriptions = new EventHelper(); /** * Gets the list of items that we are "now viewing". It is recommended that you use * the methods on this instance instead of manipulating the list of items directly. * This property is observable. * @type {Ca...
javascript
function(terria) { this._terria = terria; this._eventSubscriptions = new EventHelper(); /** * Gets the list of items that we are "now viewing". It is recommended that you use * the methods on this instance instead of manipulating the list of items directly. * This property is observable. * @type {Ca...
[ "function", "(", "terria", ")", "{", "this", ".", "_terria", "=", "terria", ";", "this", ".", "_eventSubscriptions", "=", "new", "EventHelper", "(", ")", ";", "/**\n * Gets the list of items that we are \"now viewing\". It is recommended that you use\n * the methods on t...
The model for the "Now Viewing" pane.
[ "The", "model", "for", "the", "Now", "Viewing", "pane", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/NowViewing.js#L16-L47
train
TerriaJS/terriajs
lib/ReactViews/Custom/parseCustomHtmlToReact.js
parseCustomHtmlToReact
function parseCustomHtmlToReact(html, context) { if (!defined(html) || html.length === 0) { return html; } return htmlToReactParser.parseWithInstructions( html, isValidNode, getProcessingInstructions(context || {}) ); }
javascript
function parseCustomHtmlToReact(html, context) { if (!defined(html) || html.length === 0) { return html; } return htmlToReactParser.parseWithInstructions( html, isValidNode, getProcessingInstructions(context || {}) ); }
[ "function", "parseCustomHtmlToReact", "(", "html", ",", "context", ")", "{", "if", "(", "!", "defined", "(", "html", ")", "||", "html", ".", "length", "===", "0", ")", "{", "return", "html", ";", "}", "return", "htmlToReactParser", ".", "parseWithInstructi...
Return html as a React Element. @param {String} html @param {Object} [context] Provide any further information that custom components need to know here, eg. which feature and catalogItem they come from. @return {ReactElement}
[ "Return", "html", "as", "a", "React", "Element", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Custom/parseCustomHtmlToReact.js#L89-L98
train
TerriaJS/terriajs
lib/ThirdParty/sdmxjsonlib.js
function(observations, seriesKey, dimIdx, attrIdx) { if (observations === undefined || observations === null) return; // process each observation in object. for (var key in observations) { // convert key from string to an array of numbers var obsDimIdx = key.split(KEY_SEPARATOR).map(Number); ...
javascript
function(observations, seriesKey, dimIdx, attrIdx) { if (observations === undefined || observations === null) return; // process each observation in object. for (var key in observations) { // convert key from string to an array of numbers var obsDimIdx = key.split(KEY_SEPARATOR).map(Number); ...
[ "function", "(", "observations", ",", "seriesKey", ",", "dimIdx", ",", "attrIdx", ")", "{", "if", "(", "observations", "===", "undefined", "||", "observations", "===", "null", ")", "return", ";", "// process each observation in object.", "for", "(", "var", "key"...
Process observations object and call the iterator function for each observation. Works for both dataset and series level observations. Updates the results array.
[ "Process", "observations", "object", "and", "call", "the", "iterator", "function", "for", "each", "observation", ".", "Works", "for", "both", "dataset", "and", "series", "level", "observations", ".", "Updates", "the", "results", "array", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ThirdParty/sdmxjsonlib.js#L319-L351
train
TerriaJS/terriajs
lib/ThirdParty/sdmxjsonlib.js
function(dvi, di) { var dim = msg.structure.dimensions.series[di]; var pos = dimPosition(dim); seriesKey[pos] = obsKey[pos] = dim.values[dvi].id; }
javascript
function(dvi, di) { var dim = msg.structure.dimensions.series[di]; var pos = dimPosition(dim); seriesKey[pos] = obsKey[pos] = dim.values[dvi].id; }
[ "function", "(", "dvi", ",", "di", ")", "{", "var", "dim", "=", "msg", ".", "structure", ".", "dimensions", ".", "series", "[", "di", "]", ";", "var", "pos", "=", "dimPosition", "(", "dim", ")", ";", "seriesKey", "[", "pos", "]", "=", "obsKey", "...
Update series and obs keys with a series level dimension value.
[ "Update", "series", "and", "obs", "keys", "with", "a", "series", "level", "dimension", "value", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ThirdParty/sdmxjsonlib.js#L354-L358
train
TerriaJS/terriajs
lib/ThirdParty/sdmxjsonlib.js
function(series) { if (series === undefined || series === null) return; for (var key in series) { // Convert key from string into array of numbers var serDimIdx = key.split(KEY_SEPARATOR).map(Number); // Update series and obs keys serDimIdx.forEach(updateSeriesAndObsKeys); var va...
javascript
function(series) { if (series === undefined || series === null) return; for (var key in series) { // Convert key from string into array of numbers var serDimIdx = key.split(KEY_SEPARATOR).map(Number); // Update series and obs keys serDimIdx.forEach(updateSeriesAndObsKeys); var va...
[ "function", "(", "series", ")", "{", "if", "(", "series", "===", "undefined", "||", "series", "===", "null", ")", "return", ";", "for", "(", "var", "key", "in", "series", ")", "{", "// Convert key from string into array of numbers", "var", "serDimIdx", "=", ...
Call processObservations for each series object
[ "Call", "processObservations", "for", "each", "series", "object" ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ThirdParty/sdmxjsonlib.js#L361-L384
train
TerriaJS/terriajs
lib/ThirdParty/sdmxjsonlib.js
function(c, i, array) { if (c === undefined || c === null) return; // c is the component, type is dimension|attribute, // level is dataset|series|observation, i is index, // array is the component array failed += !iterator.call(context, c, type, level, i, array); }
javascript
function(c, i, array) { if (c === undefined || c === null) return; // c is the component, type is dimension|attribute, // level is dataset|series|observation, i is index, // array is the component array failed += !iterator.call(context, c, type, level, i, array); }
[ "function", "(", "c", ",", "i", ",", "array", ")", "{", "if", "(", "c", "===", "undefined", "||", "c", "===", "null", ")", "return", ";", "// c is the component, type is dimension|attribute,", "// level is dataset|series|observation, i is index,", "// array is the compo...
Applies the iterator function and collects boolean results
[ "Applies", "the", "iterator", "function", "and", "collects", "boolean", "results" ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ThirdParty/sdmxjsonlib.js#L567-L573
train
TerriaJS/terriajs
lib/ThirdParty/sdmxjsonlib.js
function(v, i) { if (v === undefined || v === null) return; failed += !iterator.call(context, v, type, level, i); }
javascript
function(v, i) { if (v === undefined || v === null) return; failed += !iterator.call(context, v, type, level, i); }
[ "function", "(", "v", ",", "i", ")", "{", "if", "(", "v", "===", "undefined", "||", "v", "===", "null", ")", "return", ";", "failed", "+=", "!", "iterator", ".", "call", "(", "context", ",", "v", ",", "type", ",", "level", ",", "i", ")", ";", ...
Value iterator function. Gets the value and index as arguments. Collects boolean results.
[ "Value", "iterator", "function", ".", "Gets", "the", "value", "and", "index", "as", "arguments", ".", "Collects", "boolean", "results", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ThirdParty/sdmxjsonlib.js#L598-L601
train
TerriaJS/terriajs
lib/Core/updateFromJson.js
updateFromJson
function updateFromJson(target, json, options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); var promises = []; for (var propertyName in target) { if ( target.hasOwnProperty(propertyName) && shouldBeUpdated(target, propertyName, json) ) { if (target.updaters && target.u...
javascript
function updateFromJson(target, json, options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); var promises = []; for (var propertyName in target) { if ( target.hasOwnProperty(propertyName) && shouldBeUpdated(target, propertyName, json) ) { if (target.updaters && target.u...
[ "function", "updateFromJson", "(", "target", ",", "json", ",", "options", ")", "{", "options", "=", "defaultValue", "(", "options", ",", "defaultValue", ".", "EMPTY_OBJECT", ")", ";", "var", "promises", "=", "[", "]", ";", "for", "(", "var", "propertyName"...
Updates an object from a JSON representation of the object. Only properties that actually exist on the object are read from the JSON, and the object has the opportunity to inject specialized deserialization logic by providing an `updaters` property. @param {Object} target The object to update from the JSON. @param {Ob...
[ "Updates", "an", "object", "from", "a", "JSON", "representation", "of", "the", "object", ".", "Only", "properties", "that", "actually", "exist", "on", "the", "object", "are", "read", "from", "the", "JSON", "and", "the", "object", "has", "the", "opportunity",...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/updateFromJson.js#L15-L36
train
TerriaJS/terriajs
lib/Core/updateFromJson.js
shouldBeUpdated
function shouldBeUpdated(target, propertyName, json) { return ( json[propertyName] !== undefined && // Must have a value to update to propertyName.length > 0 && // Must have a name to update propertyName[0] !== "_" && // Must not be a private property (propertyName !== "id" || !defined(target.id)) )...
javascript
function shouldBeUpdated(target, propertyName, json) { return ( json[propertyName] !== undefined && // Must have a value to update to propertyName.length > 0 && // Must have a name to update propertyName[0] !== "_" && // Must not be a private property (propertyName !== "id" || !defined(target.id)) )...
[ "function", "shouldBeUpdated", "(", "target", ",", "propertyName", ",", "json", ")", "{", "return", "(", "json", "[", "propertyName", "]", "!==", "undefined", "&&", "// Must have a value to update to", "propertyName", ".", "length", ">", "0", "&&", "// Must have a...
Determines whether this property is valid for updating.
[ "Determines", "whether", "this", "property", "is", "valid", "for", "updating", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/updateFromJson.js#L41-L48
train
TerriaJS/terriajs
lib/Models/CatalogItem.js
removeCurrentTimeSubscription
function removeCurrentTimeSubscription(catalogItem) { if (defined(catalogItem._removeCurrentTimeChange)) { catalogItem._removeCurrentTimeChange(); catalogItem._removeCurrentTimeChange = undefined; } }
javascript
function removeCurrentTimeSubscription(catalogItem) { if (defined(catalogItem._removeCurrentTimeChange)) { catalogItem._removeCurrentTimeChange(); catalogItem._removeCurrentTimeChange = undefined; } }
[ "function", "removeCurrentTimeSubscription", "(", "catalogItem", ")", "{", "if", "(", "defined", "(", "catalogItem", ".", "_removeCurrentTimeChange", ")", ")", "{", "catalogItem", ".", "_removeCurrentTimeChange", "(", ")", ";", "catalogItem", ".", "_removeCurrentTimeC...
Removes catalogItem.clock.definitionChanged subscriptions.
[ "Removes", "catalogItem", ".", "clock", ".", "definitionChanged", "subscriptions", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/CatalogItem.js#L1360-L1365
train
TerriaJS/terriajs
lib/Models/CatalogItem.js
updateCurrentTime
function updateCurrentTime(catalogItem, updatedTime) { if (defined(catalogItem.clock)) { catalogItem.clock.currentTime = JulianDate.clone(updatedTime); } }
javascript
function updateCurrentTime(catalogItem, updatedTime) { if (defined(catalogItem.clock)) { catalogItem.clock.currentTime = JulianDate.clone(updatedTime); } }
[ "function", "updateCurrentTime", "(", "catalogItem", ",", "updatedTime", ")", "{", "if", "(", "defined", "(", "catalogItem", ".", "clock", ")", ")", "{", "catalogItem", ".", "clock", ".", "currentTime", "=", "JulianDate", ".", "clone", "(", "updatedTime", ")...
Updates the item.clock.currentTime using the value provided. This function does this so that all clients subscribed to the items clock with DataSourceClock.definitionChanged are notified. @param catalogItem The CatalogItem to set the current time for. @param updatedTime The new current time to use. @private
[ "Updates", "the", "item", ".", "clock", ".", "currentTime", "using", "the", "value", "provided", ".", "This", "function", "does", "this", "so", "that", "all", "clients", "subscribed", "to", "the", "items", "clock", "with", "DataSourceClock", ".", "definitionCh...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/CatalogItem.js#L1551-L1555
train
TerriaJS/terriajs
lib/Models/CatalogItem.js
useOwnClockChanged
function useOwnClockChanged(catalogItem) { // If we are changing the state, copy the time from the clock that was in use to the clock that will be in use. if (catalogItem._lastUseOwnClock !== catalogItem.useOwnClock) { // Check that both clocks are defined before syncing the time (they may not both be defined d...
javascript
function useOwnClockChanged(catalogItem) { // If we are changing the state, copy the time from the clock that was in use to the clock that will be in use. if (catalogItem._lastUseOwnClock !== catalogItem.useOwnClock) { // Check that both clocks are defined before syncing the time (they may not both be defined d...
[ "function", "useOwnClockChanged", "(", "catalogItem", ")", "{", "// If we are changing the state, copy the time from the clock that was in use to the clock that will be in use.", "if", "(", "catalogItem", ".", "_lastUseOwnClock", "!==", "catalogItem", ".", "useOwnClock", ")", "{", ...
Syncs the time between the terria.clock and the catalogItem.clock. The sync is performed in the direction that is required depending on the state change true->false / false->true of useOwnClock. @param catalogItem The CatalogItem to sync the time for. @private
[ "Syncs", "the", "time", "between", "the", "terria", ".", "clock", "and", "the", "catalogItem", ".", "clock", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/CatalogItem.js#L1565-L1590
train
TerriaJS/terriajs
lib/Models/GeoJsonCatalogItem.js
describeWithoutUnderscores
function describeWithoutUnderscores(properties, nameProperty) { var html = ""; for (var key in properties) { if (properties.hasOwnProperty(key)) { if (key === nameProperty || simpleStyleIdentifiers.indexOf(key) !== -1) { continue; } var value = properties[key]; if (typeof value =...
javascript
function describeWithoutUnderscores(properties, nameProperty) { var html = ""; for (var key in properties) { if (properties.hasOwnProperty(key)) { if (key === nameProperty || simpleStyleIdentifiers.indexOf(key) !== -1) { continue; } var value = properties[key]; if (typeof value =...
[ "function", "describeWithoutUnderscores", "(", "properties", ",", "nameProperty", ")", "{", "var", "html", "=", "\"\"", ";", "for", "(", "var", "key", "in", "properties", ")", "{", "if", "(", "properties", ".", "hasOwnProperty", "(", "key", ")", ")", "{", ...
This next function modelled on Cesium.geoJsonDataSource's defaultDescribe.
[ "This", "next", "function", "modelled", "on", "Cesium", ".", "geoJsonDataSource", "s", "defaultDescribe", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/GeoJsonCatalogItem.js#L159-L185
train
TerriaJS/terriajs
lib/Models/GeoJsonCatalogItem.js
reprojectPointList
function reprojectPointList(pts, code) { if (!(pts[0] instanceof Array)) { return Reproject.reprojectPoint(pts, code, "EPSG:4326"); } var pts_out = []; for (var i = 0; i < pts.length; i++) { pts_out.push(Reproject.reprojectPoint(pts[i], code, "EPSG:4326")); } return pts_out; }
javascript
function reprojectPointList(pts, code) { if (!(pts[0] instanceof Array)) { return Reproject.reprojectPoint(pts, code, "EPSG:4326"); } var pts_out = []; for (var i = 0; i < pts.length; i++) { pts_out.push(Reproject.reprojectPoint(pts[i], code, "EPSG:4326")); } return pts_out; }
[ "function", "reprojectPointList", "(", "pts", ",", "code", ")", "{", "if", "(", "!", "(", "pts", "[", "0", "]", "instanceof", "Array", ")", ")", "{", "return", "Reproject", ".", "reprojectPoint", "(", "pts", ",", "code", ",", "\"EPSG:4326\"", ")", ";",...
Reproject a point list based on the supplied crs code.
[ "Reproject", "a", "point", "list", "based", "on", "the", "supplied", "crs", "code", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/GeoJsonCatalogItem.js#L719-L728
train
TerriaJS/terriajs
lib/Models/GeoJsonCatalogItem.js
filterValue
function filterValue(obj, prop, func) { for (var p in obj) { if (obj.hasOwnProperty(p) === false) { continue; } else if (p === prop) { if (func && typeof func === "function") { func(obj, prop); } } else if (typeof obj[p] === "object") { filterValue(obj[p], prop, func); ...
javascript
function filterValue(obj, prop, func) { for (var p in obj) { if (obj.hasOwnProperty(p) === false) { continue; } else if (p === prop) { if (func && typeof func === "function") { func(obj, prop); } } else if (typeof obj[p] === "object") { filterValue(obj[p], prop, func); ...
[ "function", "filterValue", "(", "obj", ",", "prop", ",", "func", ")", "{", "for", "(", "var", "p", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "p", ")", "===", "false", ")", "{", "continue", ";", "}", "else", "if", "(", ...
Find a member by name in the gml.
[ "Find", "a", "member", "by", "name", "in", "the", "gml", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/GeoJsonCatalogItem.js#L731-L743
train
TerriaJS/terriajs
lib/Models/GeoJsonCatalogItem.js
filterArray
function filterArray(pts, func) { if (!(pts[0] instanceof Array) || !(pts[0][0] instanceof Array)) { pts = func(pts); return pts; } var result = new Array(pts.length); for (var i = 0; i < pts.length; i++) { result[i] = filterArray(pts[i], func); //at array of arrays of points } return result; }
javascript
function filterArray(pts, func) { if (!(pts[0] instanceof Array) || !(pts[0][0] instanceof Array)) { pts = func(pts); return pts; } var result = new Array(pts.length); for (var i = 0; i < pts.length; i++) { result[i] = filterArray(pts[i], func); //at array of arrays of points } return result; }
[ "function", "filterArray", "(", "pts", ",", "func", ")", "{", "if", "(", "!", "(", "pts", "[", "0", "]", "instanceof", "Array", ")", "||", "!", "(", "pts", "[", "0", "]", "[", "0", "]", "instanceof", "Array", ")", ")", "{", "pts", "=", "func", ...
Filter a geojson coordinates array structure.
[ "Filter", "a", "geojson", "coordinates", "array", "structure", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/GeoJsonCatalogItem.js#L746-L757
train
TerriaJS/terriajs
lib/Models/SpatialDetailingCatalogFunction.js
function(terria) { CatalogFunction.call(this, terria); this.url = undefined; this.name = "Spatial Detailing"; this.description = "Predicts the characteristics of fine-grained regions by learning and exploiting correlations of coarse-grained data with Census characteristics."; this._regionTypeToPredictPa...
javascript
function(terria) { CatalogFunction.call(this, terria); this.url = undefined; this.name = "Spatial Detailing"; this.description = "Predicts the characteristics of fine-grained regions by learning and exploiting correlations of coarse-grained data with Census characteristics."; this._regionTypeToPredictPa...
[ "function", "(", "terria", ")", "{", "CatalogFunction", ".", "call", "(", "this", ",", "terria", ")", ";", "this", ".", "url", "=", "undefined", ";", "this", ".", "name", "=", "\"Spatial Detailing\"", ";", "this", ".", "description", "=", "\"Predicts the c...
A Terria Spatial Inference function to predicts the characteristics of fine-grained regions by learning and exploiting correlations of coarse-grained data with Census characteristics. @alias SpatialDetailingCatalogFunction @constructor @extends CatalogFunction @param {Terria} terria The Terria instance.
[ "A", "Terria", "Spatial", "Inference", "function", "to", "predicts", "the", "characteristics", "of", "fine", "-", "grained", "regions", "by", "learning", "and", "exploiting", "correlations", "of", "coarse", "-", "grained", "data", "with", "Census", "characteristic...
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/SpatialDetailingCatalogFunction.js#L24-L81
train
TerriaJS/terriajs
lib/Charts/ChartRenderer.js
findSelectedData
function findSelectedData(data, x) { // For each chart line (pointArray), find the point with the closest x to the mouse. const closestXPoints = data.map(line => line.points.reduce((previous, current) => Math.abs(current.x - x) < Math.abs(previous.x - x) ? current : previous ) ); // Of those, find...
javascript
function findSelectedData(data, x) { // For each chart line (pointArray), find the point with the closest x to the mouse. const closestXPoints = data.map(line => line.points.reduce((previous, current) => Math.abs(current.x - x) < Math.abs(previous.x - x) ? current : previous ) ); // Of those, find...
[ "function", "findSelectedData", "(", "data", ",", "x", ")", "{", "// For each chart line (pointArray), find the point with the closest x to the mouse.", "const", "closestXPoints", "=", "data", ".", "map", "(", "line", "=>", "line", ".", "points", ".", "reduce", "(", "...
Returns only the data lines which have a selected point on them, with an added "point" property for the selected point.
[ "Returns", "only", "the", "data", "lines", "which", "have", "a", "selected", "point", "on", "them", "with", "an", "added", "point", "property", "for", "the", "selected", "point", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Charts/ChartRenderer.js#L512-L534
train
TerriaJS/terriajs
lib/Models/GnafApi.js
function(corsProxy, overrideUrl) { this.url = corsProxy.getURLProxyIfNecessary( defaultValue(overrideUrl, DATA61_GNAF_SEARCH_URL) ); this.bulk_url = corsProxy.getURLProxyIfNecessary( defaultValue(overrideUrl, DATA61_GNAF_BULK_SEARCH_URL) ); }
javascript
function(corsProxy, overrideUrl) { this.url = corsProxy.getURLProxyIfNecessary( defaultValue(overrideUrl, DATA61_GNAF_SEARCH_URL) ); this.bulk_url = corsProxy.getURLProxyIfNecessary( defaultValue(overrideUrl, DATA61_GNAF_BULK_SEARCH_URL) ); }
[ "function", "(", "corsProxy", ",", "overrideUrl", ")", "{", "this", ".", "url", "=", "corsProxy", ".", "getURLProxyIfNecessary", "(", "defaultValue", "(", "overrideUrl", ",", "DATA61_GNAF_SEARCH_URL", ")", ")", ";", "this", ".", "bulk_url", "=", "corsProxy", "...
Simple JS Api for the Data61 Lucene GNAF service. @param {CorsProxy} corsProxy CorsProxy to use to determine whether calls need to go through the terria proxy. @param {String} [overrideUrl] The URL to use to query the service - will default if not provided. @constructor
[ "Simple", "JS", "Api", "for", "the", "Data61", "Lucene", "GNAF", "service", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/GnafApi.js#L23-L30
train
TerriaJS/terriajs
lib/Models/GnafApi.js
convertLuceneHit
function convertLuceneHit(locational, item) { var jsonInfo = JSON.parse(item.json); return { score: item.score, locational: locational, name: item.d61Address .slice(0, 3) .filter(function(string) { return string.length > 0; }) .join(", "), flatNumber: sanitiseAddress...
javascript
function convertLuceneHit(locational, item) { var jsonInfo = JSON.parse(item.json); return { score: item.score, locational: locational, name: item.d61Address .slice(0, 3) .filter(function(string) { return string.length > 0; }) .join(", "), flatNumber: sanitiseAddress...
[ "function", "convertLuceneHit", "(", "locational", ",", "item", ")", "{", "var", "jsonInfo", "=", "JSON", ".", "parse", "(", "item", ".", "json", ")", ";", "return", "{", "score", ":", "item", ".", "score", ",", "locational", ":", "locational", ",", "n...
Converts from the Lucene schema to a neater one better suited to addresses. @param {boolean} locational Whether to set locational to true - this is set for results that came up within the bounding box passed to {@link #geoCode}. @param {object} item The lucene schema object to convert.
[ "Converts", "from", "the", "Lucene", "schema", "to", "a", "neater", "one", "better", "suited", "to", "addresses", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/GnafApi.js#L201-L232
train
TerriaJS/terriajs
lib/Models/GnafApi.js
buildRequestData
function buildRequestData(searchTerm, maxResults) { var requestData = { numHits: maxResults, fuzzy: { maxEdits: 2, minLength: 5, prefixLength: 2 } }; if (searchTerm instanceof Array) { requestData["addresses"] = searchTerm.map(processAddress); } else { requestData["addr"] ...
javascript
function buildRequestData(searchTerm, maxResults) { var requestData = { numHits: maxResults, fuzzy: { maxEdits: 2, minLength: 5, prefixLength: 2 } }; if (searchTerm instanceof Array) { requestData["addresses"] = searchTerm.map(processAddress); } else { requestData["addr"] ...
[ "function", "buildRequestData", "(", "searchTerm", ",", "maxResults", ")", "{", "var", "requestData", "=", "{", "numHits", ":", "maxResults", ",", "fuzzy", ":", "{", "maxEdits", ":", "2", ",", "minLength", ":", "5", ",", "prefixLength", ":", "2", "}", "}...
Builds the data to be POSTed to elastic search. @param {string} searchTerm The plain-text query to search for. @param {number} maxResults The max number of results to search for.
[ "Builds", "the", "data", "to", "be", "POSTed", "to", "elastic", "search", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/GnafApi.js#L248-L264
train
TerriaJS/terriajs
lib/Models/GnafApi.js
addBoundingBox
function addBoundingBox(requestData, rectangle) { requestData["box"] = { minLat: CesiumMath.toDegrees(rectangle.south), maxLon: CesiumMath.toDegrees(rectangle.east), maxLat: CesiumMath.toDegrees(rectangle.north), minLon: CesiumMath.toDegrees(rectangle.west) }; }
javascript
function addBoundingBox(requestData, rectangle) { requestData["box"] = { minLat: CesiumMath.toDegrees(rectangle.south), maxLon: CesiumMath.toDegrees(rectangle.east), maxLat: CesiumMath.toDegrees(rectangle.north), minLon: CesiumMath.toDegrees(rectangle.west) }; }
[ "function", "addBoundingBox", "(", "requestData", ",", "rectangle", ")", "{", "requestData", "[", "\"box\"", "]", "=", "{", "minLat", ":", "CesiumMath", ".", "toDegrees", "(", "rectangle", ".", "south", ")", ",", "maxLon", ":", "CesiumMath", ".", "toDegrees"...
Adds a bounding box filter to the search query for elastic search. This simply modifies requestData and returns nothing. @param {object} requestData Request data to modify @param {Rectangle} rectangle rectangle to source the bounding box from.
[ "Adds", "a", "bounding", "box", "filter", "to", "the", "search", "query", "for", "elastic", "search", ".", "This", "simply", "modifies", "requestData", "and", "returns", "nothing", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/GnafApi.js#L283-L290
train
TerriaJS/terriajs
lib/Models/GnafApi.js
splitIntoBatches
function splitIntoBatches(arrayToSplit, batchSize) { var arrayBatches = []; var minSlice = 0; var finish = false; for (var maxSlice = batchSize; maxSlice < Infinity; maxSlice += batchSize) { if (maxSlice >= arrayToSplit.length) { maxSlice = arrayToSplit.length; finish = true; } arrayBatc...
javascript
function splitIntoBatches(arrayToSplit, batchSize) { var arrayBatches = []; var minSlice = 0; var finish = false; for (var maxSlice = batchSize; maxSlice < Infinity; maxSlice += batchSize) { if (maxSlice >= arrayToSplit.length) { maxSlice = arrayToSplit.length; finish = true; } arrayBatc...
[ "function", "splitIntoBatches", "(", "arrayToSplit", ",", "batchSize", ")", "{", "var", "arrayBatches", "=", "[", "]", ";", "var", "minSlice", "=", "0", ";", "var", "finish", "=", "false", ";", "for", "(", "var", "maxSlice", "=", "batchSize", ";", "maxSl...
Breaks an array into pieces, putting them in another array. @param {Array} arrayToSplit array to split @param {number} batchSize maximum number of items in each array at end @return array containing other arrays, which contain a maxiumum number of items in each.
[ "Breaks", "an", "array", "into", "pieces", "putting", "them", "in", "another", "array", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/GnafApi.js#L299-L315
train
TerriaJS/terriajs
lib/Core/supportsWebGL.js
supportsWebGL
function supportsWebGL() { if (defined(result)) { return result; } //Check for webgl support and if not, then fall back to leaflet if (!window.WebGLRenderingContext) { // Browser has no idea what WebGL is. Suggest they // get a new browser by presenting the user with link to // http://get.webgl...
javascript
function supportsWebGL() { if (defined(result)) { return result; } //Check for webgl support and if not, then fall back to leaflet if (!window.WebGLRenderingContext) { // Browser has no idea what WebGL is. Suggest they // get a new browser by presenting the user with link to // http://get.webgl...
[ "function", "supportsWebGL", "(", ")", "{", "if", "(", "defined", "(", "result", ")", ")", "{", "return", "result", ";", "}", "//Check for webgl support and if not, then fall back to leaflet", "if", "(", "!", "window", ".", "WebGLRenderingContext", ")", "{", "// B...
Determines if the current browser supports WebGL. @return {Boolean|String} False if WebGL is not supported at all, 'slow' if WebGL is supported but it has a major performance caveat (e.g. software rendering), and True if WebGL is available without a major performance caveat.
[ "Determines", "if", "the", "current", "browser", "supports", "WebGL", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/supportsWebGL.js#L14-L57
train
TerriaJS/terriajs
lib/Models/CatalogMember.js
getParentIds
function getParentIds(catalogMember, parentIds) { parentIds = defaultValue(parentIds, []); if (defined(catalogMember.parent)) { return getParentIds( catalogMember.parent, parentIds.concat([catalogMember.uniqueId]) ); } return parentIds; }
javascript
function getParentIds(catalogMember, parentIds) { parentIds = defaultValue(parentIds, []); if (defined(catalogMember.parent)) { return getParentIds( catalogMember.parent, parentIds.concat([catalogMember.uniqueId]) ); } return parentIds; }
[ "function", "getParentIds", "(", "catalogMember", ",", "parentIds", ")", "{", "parentIds", "=", "defaultValue", "(", "parentIds", ",", "[", "]", ")", ";", "if", "(", "defined", "(", "catalogMember", ".", "parent", ")", ")", "{", "return", "getParentIds", "...
Gets the ids of all parents of a catalog member, ordered from the closest descendant to the most distant. Ignores the root. @private @param catalogMember The catalog member to get parent ids for. @param parentIds A starting list of parent ids to add to (allows the function to work recursively). @returns {String[]}
[ "Gets", "the", "ids", "of", "all", "parents", "of", "a", "catalog", "member", "ordered", "from", "the", "closest", "descendant", "to", "the", "most", "distant", ".", "Ignores", "the", "root", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/CatalogMember.js#L543-L554
train
TerriaJS/terriajs
lib/Models/TableCatalogItem.js
createDataSourceForLatLong
function createDataSourceForLatLong(item, tableStructure) { // Create the TableDataSource and save it to item._dataSource. item._dataSource = new TableDataSource( item.terria, tableStructure, item._tableStyle, item.name, item.polling.seconds > 0 ); item._dataSource.changedEvent.addEventListe...
javascript
function createDataSourceForLatLong(item, tableStructure) { // Create the TableDataSource and save it to item._dataSource. item._dataSource = new TableDataSource( item.terria, tableStructure, item._tableStyle, item.name, item.polling.seconds > 0 ); item._dataSource.changedEvent.addEventListe...
[ "function", "createDataSourceForLatLong", "(", "item", ",", "tableStructure", ")", "{", "// Create the TableDataSource and save it to item._dataSource.", "item", ".", "_dataSource", "=", "new", "TableDataSource", "(", "item", ".", "terria", ",", "tableStructure", ",", "it...
Creates a datasource based on tableStructure provided and adds it to item. Suitable for TableStructures that contain lat-lon columns. @param {TableCatalogItem} item Item that tableDataSource is created for. @param {TableStructure} tableStructure TableStructure to use in creating datasource. @return {Promise} @private
[ "Creates", "a", "datasource", "based", "on", "tableStructure", "provided", "and", "adds", "it", "to", "item", ".", "Suitable", "for", "TableStructures", "that", "contain", "lat", "-", "lon", "columns", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/TableCatalogItem.js#L817-L835
train
TerriaJS/terriajs
lib/Models/Leaflet.js
function(terria, map) { GlobeOrMap.call(this, terria); /** * Gets or sets the Leaflet {@link Map} instance. * @type {Map} */ this.map = map; this.scene = new LeafletScene(map); /** * Gets or sets whether this viewer _can_ show a splitter. * @type {Boolean} */ this.canShowSplitter = true...
javascript
function(terria, map) { GlobeOrMap.call(this, terria); /** * Gets or sets the Leaflet {@link Map} instance. * @type {Map} */ this.map = map; this.scene = new LeafletScene(map); /** * Gets or sets whether this viewer _can_ show a splitter. * @type {Boolean} */ this.canShowSplitter = true...
[ "function", "(", "terria", ",", "map", ")", "{", "GlobeOrMap", ".", "call", "(", "this", ",", "terria", ")", ";", "/**\n * Gets or sets the Leaflet {@link Map} instance.\n * @type {Map}\n */", "this", ".", "map", "=", "map", ";", "this", ".", "scene", "=", ...
The Leaflet viewer component @alias Leaflet @constructor @extends GlobeOrMap @param {Terria} terria The Terria instance. @param {Map} map The leaflet map instance.
[ "The", "Leaflet", "viewer", "component" ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/Leaflet.js#L85-L202
train
TerriaJS/terriajs
lib/Models/Leaflet.js
updateOneLayer
function updateOneLayer(item, currZIndex) { if (defined(item.imageryLayer) && defined(item.imageryLayer.setZIndex)) { if (item.supportsReordering) { item.imageryLayer.setZIndex(currZIndex.reorderable++); } else { item.imageryLayer.setZIndex(currZIndex.fixed++); } } }
javascript
function updateOneLayer(item, currZIndex) { if (defined(item.imageryLayer) && defined(item.imageryLayer.setZIndex)) { if (item.supportsReordering) { item.imageryLayer.setZIndex(currZIndex.reorderable++); } else { item.imageryLayer.setZIndex(currZIndex.fixed++); } } }
[ "function", "updateOneLayer", "(", "item", ",", "currZIndex", ")", "{", "if", "(", "defined", "(", "item", ".", "imageryLayer", ")", "&&", "defined", "(", "item", ".", "imageryLayer", ".", "setZIndex", ")", ")", "{", "if", "(", "item", ".", "supportsReor...
this private function is called by updateLayerOrder
[ "this", "private", "function", "is", "called", "by", "updateLayerOrder" ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/Leaflet.js#L507-L515
train
TerriaJS/terriajs
lib/Models/ImageryLayerCatalogItem.js
nextLayerFromIndex
function nextLayerFromIndex(index) { const imageryProvider = catalogItem.createImageryProvider( catalogItem.intervals.get(index).data ); imageryProvider.enablePickFeatures = false; catalogItem._nextLayer = ImageryLayerCatalogItem.enableLayer( catalogItem, imageryProvider, 0.0 ...
javascript
function nextLayerFromIndex(index) { const imageryProvider = catalogItem.createImageryProvider( catalogItem.intervals.get(index).data ); imageryProvider.enablePickFeatures = false; catalogItem._nextLayer = ImageryLayerCatalogItem.enableLayer( catalogItem, imageryProvider, 0.0 ...
[ "function", "nextLayerFromIndex", "(", "index", ")", "{", "const", "imageryProvider", "=", "catalogItem", ".", "createImageryProvider", "(", "catalogItem", ".", "intervals", ".", "get", "(", "index", ")", ".", "data", ")", ";", "imageryProvider", ".", "enablePic...
Given an interval index, set up an imagery provider and layer.
[ "Given", "an", "interval", "index", "set", "up", "an", "imagery", "provider", "and", "layer", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/ImageryLayerCatalogItem.js#L1243-L1255
train
TerriaJS/terriajs
lib/Models/CkanCatalogGroup.js
addItem
function addItem(resource, rootCkanGroup, itemData, extras, parent) { var item = rootCkanGroup.terria.catalog.shareKeyIndex[ parent.uniqueId + "/" + resource.id ]; var alreadyExists = defined(item); if (!alreadyExists) { item = createItemFromResource( resource, rootCkanGroup, ...
javascript
function addItem(resource, rootCkanGroup, itemData, extras, parent) { var item = rootCkanGroup.terria.catalog.shareKeyIndex[ parent.uniqueId + "/" + resource.id ]; var alreadyExists = defined(item); if (!alreadyExists) { item = createItemFromResource( resource, rootCkanGroup, ...
[ "function", "addItem", "(", "resource", ",", "rootCkanGroup", ",", "itemData", ",", "extras", ",", "parent", ")", "{", "var", "item", "=", "rootCkanGroup", ".", "terria", ".", "catalog", ".", "shareKeyIndex", "[", "parent", ".", "uniqueId", "+", "\"/\"", "...
Creates a catalog item from the supplied resource and adds it to the supplied parent if necessary.. @private @param resource The Ckan resource @param rootCkanGroup The root group of all items in this Ckan hierarchy @param itemData The data of the item to build the catalog item from @param extras @param parent The paren...
[ "Creates", "a", "catalog", "item", "from", "the", "supplied", "resource", "and", "adds", "it", "to", "the", "supplied", "parent", "if", "necessary", ".." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/CkanCatalogGroup.js#L845-L867
train
TerriaJS/terriajs
lib/Map/featureDataToGeoJson.js
getEsriGeometry
function getEsriGeometry(featureData, geometryType, spatialReference) { if (defined(featureData.features)) { // This is a FeatureCollection. return { type: "FeatureCollection", crs: esriSpatialReferenceToCrs(featureData.spatialReference), features: featureData.features.map(function(subFeatur...
javascript
function getEsriGeometry(featureData, geometryType, spatialReference) { if (defined(featureData.features)) { // This is a FeatureCollection. return { type: "FeatureCollection", crs: esriSpatialReferenceToCrs(featureData.spatialReference), features: featureData.features.map(function(subFeatur...
[ "function", "getEsriGeometry", "(", "featureData", ",", "geometryType", ",", "spatialReference", ")", "{", "if", "(", "defined", "(", "featureData", ".", "features", ")", ")", "{", "// This is a FeatureCollection.", "return", "{", "type", ":", "\"FeatureCollection\"...
spatialReference is optional.
[ "spatialReference", "is", "optional", "." ]
abcce28ff189f6fdbc0ee541a235ec6cabd90bd5
https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/featureDataToGeoJson.js#L63-L155
train
cornerstonejs/cornerstoneTools
src/store/setToolMode.js
function( element, toolName, options, interactionTypes ) { // If interactionTypes was passed in via options if (interactionTypes === undefined && Array.isArray(options)) { interactionTypes = options; options = null; } const tool = getToolForElement(element, toolName); if (tool) { _resolv...
javascript
function( element, toolName, options, interactionTypes ) { // If interactionTypes was passed in via options if (interactionTypes === undefined && Array.isArray(options)) { interactionTypes = options; options = null; } const tool = getToolForElement(element, toolName); if (tool) { _resolv...
[ "function", "(", "element", ",", "toolName", ",", "options", ",", "interactionTypes", ")", "{", "// If interactionTypes was passed in via options", "if", "(", "interactionTypes", "===", "undefined", "&&", "Array", ".", "isArray", "(", "options", ")", ")", "{", "in...
Sets a tool's state, with the provided toolName and element, to 'active'. Active tools are rendered, respond to user input, and can create new data. @public @function setToolActiveForElement @memberof CornerstoneTools @example <caption>Setting a tool 'active' for a specific interaction type.</caption> // Sets length ...
[ "Sets", "a", "tool", "s", "state", "with", "the", "provided", "toolName", "and", "element", "to", "active", ".", "Active", "tools", "are", "rendered", "respond", "to", "user", "input", "and", "can", "create", "new", "data", "." ]
8480029f4f42da521d5d5fb9351afee98d84d58e
https://github.com/cornerstonejs/cornerstoneTools/blob/8480029f4f42da521d5d5fb9351afee98d84d58e/src/store/setToolMode.js#L39-L79
train
cornerstonejs/cornerstoneTools
src/store/setToolMode.js
_resolveGenericInputConflicts
function _resolveGenericInputConflicts( interactionType, tool, element, options ) { const interactionTypeFlag = `is${interactionType}Active`; const activeToolWithActiveInteractionType = store.state.tools.find( t => t.element === element && t.mode === 'active' && t.options[interactionTy...
javascript
function _resolveGenericInputConflicts( interactionType, tool, element, options ) { const interactionTypeFlag = `is${interactionType}Active`; const activeToolWithActiveInteractionType = store.state.tools.find( t => t.element === element && t.mode === 'active' && t.options[interactionTy...
[ "function", "_resolveGenericInputConflicts", "(", "interactionType", ",", "tool", ",", "element", ",", "options", ")", "{", "const", "interactionTypeFlag", "=", "`", "${", "interactionType", "}", "`", ";", "const", "activeToolWithActiveInteractionType", "=", "store", ...
If the incoming tool isTouchActive, find any conflicting tools and set their isTouchActive to false to avoid conflicts. @private @function _resolveGenericInputConflicts @param {string} interactionType @param {Object} tool @param {HTMLElement} element @param {(Object|number)} options @returns {undefined}
[ "If", "the", "incoming", "tool", "isTouchActive", "find", "any", "conflicting", "tools", "and", "set", "their", "isTouchActive", "to", "false", "to", "avoid", "conflicts", "." ]
8480029f4f42da521d5d5fb9351afee98d84d58e
https://github.com/cornerstonejs/cornerstoneTools/blob/8480029f4f42da521d5d5fb9351afee98d84d58e/src/store/setToolMode.js#L507-L529
train