id int32 0 58k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7,000 | TerriaJS/terriajs | lib/Models/SdmxJsonCatalogItem.js | canTotalBeCalculatedAndIfNotWarnUser | function canTotalBeCalculatedAndIfNotWarnUser(item) {
if (canResultsBeSummed(item)) {
return true;
}
var conceptItems = item._concepts[0].items;
var changedActive = [];
conceptItems.forEach(concept => {
var numberActive = concept.items.filter(function(subconcept) {
return subconcept.isActive;
... | javascript | function canTotalBeCalculatedAndIfNotWarnUser(item) {
if (canResultsBeSummed(item)) {
return true;
}
var conceptItems = item._concepts[0].items;
var changedActive = [];
conceptItems.forEach(concept => {
var numberActive = concept.items.filter(function(subconcept) {
return subconcept.isActive;
... | [
"function",
"canTotalBeCalculatedAndIfNotWarnUser",
"(",
"item",
")",
"{",
"if",
"(",
"canResultsBeSummed",
"(",
"item",
")",
")",
"{",
"return",
"true",
";",
"}",
"var",
"conceptItems",
"=",
"item",
".",
"_concepts",
"[",
"0",
"]",
".",
"items",
";",
"var... | Only show a warning if more than one value of a concept has been selected. Returns true if the user has been warned. | [
"Only",
"show",
"a",
"warning",
"if",
"more",
"than",
"one",
"value",
"of",
"a",
"concept",
"has",
"been",
"selected",
".",
"Returns",
"true",
"if",
"the",
"user",
"has",
"been",
"warned",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/SdmxJsonCatalogItem.js#L1264-L1296 |
7,001 | TerriaJS/terriajs | lib/Models/SdmxJsonCatalogItem.js | changedActiveItems | function changedActiveItems(item) {
if (!defined(item._dataflowUrl)) {
// All the data is already here, just update the total columns.
var shownDimensionCombinations = calculateShownDimensionCombinations(
item,
item._fullDimensions
);
var columns = item._tableStructure.columns.slice(
... | javascript | function changedActiveItems(item) {
if (!defined(item._dataflowUrl)) {
// All the data is already here, just update the total columns.
var shownDimensionCombinations = calculateShownDimensionCombinations(
item,
item._fullDimensions
);
var columns = item._tableStructure.columns.slice(
... | [
"function",
"changedActiveItems",
"(",
"item",
")",
"{",
"if",
"(",
"!",
"defined",
"(",
"item",
".",
"_dataflowUrl",
")",
")",
"{",
"// All the data is already here, just update the total columns.",
"var",
"shownDimensionCombinations",
"=",
"calculateShownDimensionCombinat... | Called when the active column changes. Returns a promise. | [
"Called",
"when",
"the",
"active",
"column",
"changes",
".",
"Returns",
"a",
"promise",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/SdmxJsonCatalogItem.js#L1426-L1457 |
7,002 | TerriaJS/terriajs | lib/Models/SdmxJsonCatalogItem.js | getUrlFromDimensionRequestString | function getUrlFromDimensionRequestString(item, dimensionRequestString) {
var url = item._originalUrl;
if (url[url.length - 1] !== "/") {
url += "/";
}
url += dimensionRequestString + "/" + item.providerId;
if (defined(item.startTime)) {
url += "?startTime=" + item.startTime;
if (defined(item.endT... | javascript | function getUrlFromDimensionRequestString(item, dimensionRequestString) {
var url = item._originalUrl;
if (url[url.length - 1] !== "/") {
url += "/";
}
url += dimensionRequestString + "/" + item.providerId;
if (defined(item.startTime)) {
url += "?startTime=" + item.startTime;
if (defined(item.endT... | [
"function",
"getUrlFromDimensionRequestString",
"(",
"item",
",",
"dimensionRequestString",
")",
"{",
"var",
"url",
"=",
"item",
".",
"_originalUrl",
";",
"if",
"(",
"url",
"[",
"url",
".",
"length",
"-",
"1",
"]",
"!==",
"\"/\"",
")",
"{",
"url",
"+=",
... | Convert a dimension request string like "a+b+c.d.e+f.g" into a URL. | [
"Convert",
"a",
"dimension",
"request",
"string",
"like",
"a",
"+",
"b",
"+",
"c",
".",
"d",
".",
"e",
"+",
"f",
".",
"g",
"into",
"a",
"URL",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/SdmxJsonCatalogItem.js#L1460-L1475 |
7,003 | TerriaJS/terriajs | lib/Core/hashFromString.js | hashFromString | function hashFromString(s) {
return Math.abs(
s.split("").reduce(function(prev, c) {
var hash = (prev << 5) - prev + c.charCodeAt(0);
return hash;
}, 0)
);
} | javascript | function hashFromString(s) {
return Math.abs(
s.split("").reduce(function(prev, c) {
var hash = (prev << 5) - prev + c.charCodeAt(0);
return hash;
}, 0)
);
} | [
"function",
"hashFromString",
"(",
"s",
")",
"{",
"return",
"Math",
".",
"abs",
"(",
"s",
".",
"split",
"(",
"\"\"",
")",
".",
"reduce",
"(",
"function",
"(",
"prev",
",",
"c",
")",
"{",
"var",
"hash",
"=",
"(",
"prev",
"<<",
"5",
")",
"-",
"pr... | Returns a 32-bit integer hash of a string. '' => 0. | [
"Returns",
"a",
"32",
"-",
"bit",
"integer",
"hash",
"of",
"a",
"string",
".",
"=",
">",
"0",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/hashFromString.js#L4-L11 |
7,004 | TerriaJS/terriajs | lib/Models/LocationMarkerUtils.js | correctEntityHeight | function correctEntityHeight(
entity,
currentCartographicPosition,
terrainProvider,
levelHint
) {
sampleTerrain(terrainProvider, levelHint, [currentCartographicPosition]).then(
function(updatedPositions) {
if (updatedPositions[0].height !== undefined) {
entity.position = Ellipsoid.WGS84.cart... | javascript | function correctEntityHeight(
entity,
currentCartographicPosition,
terrainProvider,
levelHint
) {
sampleTerrain(terrainProvider, levelHint, [currentCartographicPosition]).then(
function(updatedPositions) {
if (updatedPositions[0].height !== undefined) {
entity.position = Ellipsoid.WGS84.cart... | [
"function",
"correctEntityHeight",
"(",
"entity",
",",
"currentCartographicPosition",
",",
"terrainProvider",
",",
"levelHint",
")",
"{",
"sampleTerrain",
"(",
"terrainProvider",
",",
"levelHint",
",",
"[",
"currentCartographicPosition",
"]",
")",
".",
"then",
"(",
... | Gets the most detailed height from terrainProvider at currentCartographicPosition and updates entity position.
It starts querying at levelHint and makes its way down to level zero. | [
"Gets",
"the",
"most",
"detailed",
"height",
"from",
"terrainProvider",
"at",
"currentCartographicPosition",
"and",
"updates",
"entity",
"position",
".",
"It",
"starts",
"querying",
"at",
"levelHint",
"and",
"makes",
"its",
"way",
"down",
"to",
"level",
"zero",
... | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/LocationMarkerUtils.js#L79-L101 |
7,005 | TerriaJS/terriajs | lib/Models/CatalogGroup.js | indexWithDescendants | function indexWithDescendants(items, index) {
items.forEach(function(item) {
item.allShareKeys.forEach(function(key) {
var insertionKey = key;
if (index[insertionKey]) {
insertionKey = generateUniqueKey(index, key);
if (item.uniqueId === key) {
// If this duplicate was the ... | javascript | function indexWithDescendants(items, index) {
items.forEach(function(item) {
item.allShareKeys.forEach(function(key) {
var insertionKey = key;
if (index[insertionKey]) {
insertionKey = generateUniqueKey(index, key);
if (item.uniqueId === key) {
// If this duplicate was the ... | [
"function",
"indexWithDescendants",
"(",
"items",
",",
"index",
")",
"{",
"items",
".",
"forEach",
"(",
"function",
"(",
"item",
")",
"{",
"item",
".",
"allShareKeys",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"var",
"insertionKey",
"=",
"ke... | Adds all passed items to the passed index, and all the children of those items recursively.
@private
@param {CatalogMember[]} items
@param {Object} index | [
"Adds",
"all",
"passed",
"items",
"to",
"the",
"passed",
"index",
"and",
"all",
"the",
"children",
"of",
"those",
"items",
"recursively",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/CatalogGroup.js#L349-L378 |
7,006 | TerriaJS/terriajs | lib/Models/CatalogGroup.js | generateUniqueKey | function generateUniqueKey(index, initialKey) {
var currentCandidate = initialKey;
var counter = 0;
while (index[currentCandidate]) {
var numberAtEndOfKeyMatches = currentCandidate.match(
NUMBER_AT_END_OF_KEY_REGEX
);
if (numberAtEndOfKeyMatches !== null) {
var nextNumber = parseInt(numbe... | javascript | function generateUniqueKey(index, initialKey) {
var currentCandidate = initialKey;
var counter = 0;
while (index[currentCandidate]) {
var numberAtEndOfKeyMatches = currentCandidate.match(
NUMBER_AT_END_OF_KEY_REGEX
);
if (numberAtEndOfKeyMatches !== null) {
var nextNumber = parseInt(numbe... | [
"function",
"generateUniqueKey",
"(",
"index",
",",
"initialKey",
")",
"{",
"var",
"currentCandidate",
"=",
"initialKey",
";",
"var",
"counter",
"=",
"0",
";",
"while",
"(",
"index",
"[",
"currentCandidate",
"]",
")",
"{",
"var",
"numberAtEndOfKeyMatches",
"="... | Generates a unique key from a non-unique one by adding a number after it. If the key already has a number added,
it will increment that number.
@private
@param index An index to check for uniqueness.
@param initialKey The key to start from.
@returns {String} A new, unique key. | [
"Generates",
"a",
"unique",
"key",
"from",
"a",
"non",
"-",
"unique",
"one",
"by",
"adding",
"a",
"number",
"after",
"it",
".",
"If",
"the",
"key",
"already",
"has",
"a",
"number",
"added",
"it",
"will",
"increment",
"that",
"number",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/CatalogGroup.js#L388-L420 |
7,007 | TerriaJS/terriajs | lib/Models/CatalogGroup.js | deIndexWithDescendants | function deIndexWithDescendants(items, index) {
items.forEach(function(item) {
item.allShareKeys.forEach(function(key) {
index[key] = undefined;
}, this);
if (defined(item.items)) {
deIndexWithDescendants(item.items, index);
}
});
} | javascript | function deIndexWithDescendants(items, index) {
items.forEach(function(item) {
item.allShareKeys.forEach(function(key) {
index[key] = undefined;
}, this);
if (defined(item.items)) {
deIndexWithDescendants(item.items, index);
}
});
} | [
"function",
"deIndexWithDescendants",
"(",
"items",
",",
"index",
")",
"{",
"items",
".",
"forEach",
"(",
"function",
"(",
"item",
")",
"{",
"item",
".",
"allShareKeys",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"index",
"[",
"key",
"]",
"... | Removes all passed items to the passed index, and all the children of those items recursively.
@param {CatalogMember[]} items
@param {Object} index | [
"Removes",
"all",
"passed",
"items",
"to",
"the",
"passed",
"index",
"and",
"all",
"the",
"children",
"of",
"those",
"items",
"recursively",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/CatalogGroup.js#L428-L438 |
7,008 | TerriaJS/terriajs | lib/Models/CswCatalogGroup.js | findGroup | function findGroup(catalogGroup, keywordsGroups, record) {
for (var i = 0; i < keywordsGroups.length; i++) {
var kg = keywordsGroups[i];
var fields = record[kg.field];
var matched = false;
if (defined(fields)) {
if (fields instanceof String || typeof fields === "string") {
fields = [fiel... | javascript | function findGroup(catalogGroup, keywordsGroups, record) {
for (var i = 0; i < keywordsGroups.length; i++) {
var kg = keywordsGroups[i];
var fields = record[kg.field];
var matched = false;
if (defined(fields)) {
if (fields instanceof String || typeof fields === "string") {
fields = [fiel... | [
"function",
"findGroup",
"(",
"catalogGroup",
",",
"keywordsGroups",
",",
"record",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"keywordsGroups",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"kg",
"=",
"keywordsGroups",
"[",
"i",
"]... | find groups that the record belongs to and create any that don't exist already | [
"find",
"groups",
"that",
"the",
"record",
"belongs",
"to",
"and",
"create",
"any",
"that",
"don",
"t",
"exist",
"already"
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/CswCatalogGroup.js#L635-L670 |
7,009 | TerriaJS/terriajs | lib/ReactViews/Custom/Chart/downloadHrefWorker.js | toArrayOfRows | function toArrayOfRows(columnValueArrays, columnNames) {
if (columnValueArrays.length < 1) {
return;
}
const rows = columnValueArrays[0].map(function(value0, rowIndex) {
return columnValueArrays.map(function(values) {
return values[rowIndex];
});
});
rows.unshift(columnNames);
return rows;... | javascript | function toArrayOfRows(columnValueArrays, columnNames) {
if (columnValueArrays.length < 1) {
return;
}
const rows = columnValueArrays[0].map(function(value0, rowIndex) {
return columnValueArrays.map(function(values) {
return values[rowIndex];
});
});
rows.unshift(columnNames);
return rows;... | [
"function",
"toArrayOfRows",
"(",
"columnValueArrays",
",",
"columnNames",
")",
"{",
"if",
"(",
"columnValueArrays",
".",
"length",
"<",
"1",
")",
"{",
"return",
";",
"}",
"const",
"rows",
"=",
"columnValueArrays",
"[",
"0",
"]",
".",
"map",
"(",
"function... | Convert an array of column values, with column names, to an array of row values.
@param {Array[]} columnValueArrays Array of column values, eg. [[1,2,3], [4,5,6]].
@param {String[]} columnNames Array of column names, eg ['x', 'y'].
@return {Array[]} Array of rows, starting with the column names, eg. [['x', 'y'], [1, ... | [
"Convert",
"an",
"array",
"of",
"column",
"values",
"with",
"column",
"names",
"to",
"an",
"array",
"of",
"row",
"values",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/ReactViews/Custom/Chart/downloadHrefWorker.js#L106-L117 |
7,010 | TerriaJS/terriajs | lib/Map/EarthGravityModel1996.js | getHeightValue | function getHeightValue(data, recordIndex, heightIndex) {
if (recordIndex > 720) {
recordIndex = 720;
} else if (recordIndex < 0) {
recordIndex = 0;
}
if (heightIndex > 1439) {
heightIndex -= 1440;
} else if (heightIndex < 0) {
heightIndex += 1440;
}
return data[recordIndex * 1440 + heig... | javascript | function getHeightValue(data, recordIndex, heightIndex) {
if (recordIndex > 720) {
recordIndex = 720;
} else if (recordIndex < 0) {
recordIndex = 0;
}
if (heightIndex > 1439) {
heightIndex -= 1440;
} else if (heightIndex < 0) {
heightIndex += 1440;
}
return data[recordIndex * 1440 + heig... | [
"function",
"getHeightValue",
"(",
"data",
",",
"recordIndex",
",",
"heightIndex",
")",
"{",
"if",
"(",
"recordIndex",
">",
"720",
")",
"{",
"recordIndex",
"=",
"720",
";",
"}",
"else",
"if",
"(",
"recordIndex",
"<",
"0",
")",
"{",
"recordIndex",
"=",
... | Heights returned by this function are in centimeters. | [
"Heights",
"returned",
"by",
"this",
"function",
"are",
"in",
"centimeters",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/EarthGravityModel1996.js#L120-L134 |
7,011 | TerriaJS/terriajs | lib/Models/PlacesLikeMeCatalogFunction.js | function(terria) {
CatalogFunction.call(this, terria);
this.url = undefined;
this.name = "Regions like this";
this.description =
"Identifies regions that are _most like_ a given region according to a given set of characteristics.";
this._regionTypeParameter = new RegionTypeParameter({
terria: this.t... | javascript | function(terria) {
CatalogFunction.call(this, terria);
this.url = undefined;
this.name = "Regions like this";
this.description =
"Identifies regions that are _most like_ a given region according to a given set of characteristics.";
this._regionTypeParameter = new RegionTypeParameter({
terria: this.t... | [
"function",
"(",
"terria",
")",
"{",
"CatalogFunction",
".",
"call",
"(",
"this",
",",
"terria",
")",
";",
"this",
".",
"url",
"=",
"undefined",
";",
"this",
".",
"name",
"=",
"\"Regions like this\"",
";",
"this",
".",
"description",
"=",
"\"Identifies reg... | A Terria Spatial Inference function to identify regions that are _most like_ a given region according to a
given set of characteristics.
@alias PlacesLikeMeCatalogfunction
@constructor
@extends CatalogFunction
@param {Terria} terria The Terria instance. | [
"A",
"Terria",
"Spatial",
"Inference",
"function",
"to",
"identify",
"regions",
"that",
"are",
"_most",
"like_",
"a",
"given",
"region",
"according",
"to",
"a",
"given",
"set",
"of",
"characteristics",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/PlacesLikeMeCatalogFunction.js#L28-L68 | |
7,012 | TerriaJS/terriajs | lib/Map/TableColumn.js | applyHintsToName | function applyHintsToName(hintSet, name, unallowedTypes) {
for (var i in hintSet) {
if (hintSet[i].hint.test(name)) {
var guess = hintSet[i].type;
if (unallowedTypes.indexOf(guess) === -1) {
return guess;
}
}
}
} | javascript | function applyHintsToName(hintSet, name, unallowedTypes) {
for (var i in hintSet) {
if (hintSet[i].hint.test(name)) {
var guess = hintSet[i].type;
if (unallowedTypes.indexOf(guess) === -1) {
return guess;
}
}
}
} | [
"function",
"applyHintsToName",
"(",
"hintSet",
",",
"name",
",",
"unallowedTypes",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"hintSet",
")",
"{",
"if",
"(",
"hintSet",
"[",
"i",
"]",
".",
"hint",
".",
"test",
"(",
"name",
")",
")",
"{",
"var",
"gues... | Guesses the best variable type based on its name. Returns undefined if no guess.
@private
@param {Object[]} hintSet The hint set to use, eg. [{ hint: /^(.*[_ ])?(year)/i, type: VarSubType.YEAR }].
@param {String} name The variable name, eg. 'Time (AEST)'.
@param {VarType[]|VarSubType[]} unallowedTypes Types not to cons... | [
"Guesses",
"the",
"best",
"variable",
"type",
"based",
"on",
"its",
"name",
".",
"Returns",
"undefined",
"if",
"no",
"guess",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/TableColumn.js#L710-L719 |
7,013 | TerriaJS/terriajs | lib/Core/formatPropertyValue.js | formatPropertyValue | function formatPropertyValue(value, options) {
if (typeof value === "number") {
return formatNumberForLocale(value, options);
} else if (typeof value === "string") {
// do not linkify if it contains html elements, which we detect by looking for <x...>
// this could catch some non-html strings such as "a... | javascript | function formatPropertyValue(value, options) {
if (typeof value === "number") {
return formatNumberForLocale(value, options);
} else if (typeof value === "string") {
// do not linkify if it contains html elements, which we detect by looking for <x...>
// this could catch some non-html strings such as "a... | [
"function",
"formatPropertyValue",
"(",
"value",
",",
"options",
")",
"{",
"if",
"(",
"typeof",
"value",
"===",
"\"number\"",
")",
"{",
"return",
"formatNumberForLocale",
"(",
"value",
",",
"options",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"value",
"=... | Format the value for the description, used by the Feature Info Panel.
Strings have markdown applied to them. Anything else is returned as-is.
@param {} value The value to format.
@param {Object} [options] Number formatting options, passed to formatNumberForLocale. | [
"Format",
"the",
"value",
"for",
"the",
"description",
"used",
"by",
"the",
"Feature",
"Info",
"Panel",
".",
"Strings",
"have",
"markdown",
"applied",
"to",
"them",
".",
"Anything",
"else",
"is",
"returned",
"as",
"-",
"is",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/formatPropertyValue.js#L14-L25 |
7,014 | TerriaJS/terriajs | lib/Core/serializeToJson.js | serializeToJson | function serializeToJson(target, filterFunction, options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
filterFunction = defaultValue(filterFunction, function() {
return true;
});
var result = {};
for (var propertyName in target) {
if (
target.hasOwnProperty(propertyName) &&
... | javascript | function serializeToJson(target, filterFunction, options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
filterFunction = defaultValue(filterFunction, function() {
return true;
});
var result = {};
for (var propertyName in target) {
if (
target.hasOwnProperty(propertyName) &&
... | [
"function",
"serializeToJson",
"(",
"target",
",",
"filterFunction",
",",
"options",
")",
"{",
"options",
"=",
"defaultValue",
"(",
"options",
",",
"defaultValue",
".",
"EMPTY_OBJECT",
")",
";",
"filterFunction",
"=",
"defaultValue",
"(",
"filterFunction",
",",
... | Serializes an object to JSON.
@param {Object} target The object to serialize.
@param {Function} filterFunction A function that, when passed the name of a property as its only parameter, returns true if that property should be serialized and false otherwise.
@param {Object} [options] Optional parameters to custom serial... | [
"Serializes",
"an",
"object",
"to",
"JSON",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/serializeToJson.js#L13-L38 |
7,015 | TerriaJS/terriajs | lib/Models/RegionMapping.js | function(catalogItem, tableStructure, tableStyle) {
this._tableStructure = defined(tableStructure)
? tableStructure
: new TableStructure();
if (defined(tableStyle) && !(tableStyle instanceof TableStyle)) {
throw new DeveloperError("Please pass a TableStyle object.");
}
this._tableStyle = tableStyle;... | javascript | function(catalogItem, tableStructure, tableStyle) {
this._tableStructure = defined(tableStructure)
? tableStructure
: new TableStructure();
if (defined(tableStyle) && !(tableStyle instanceof TableStyle)) {
throw new DeveloperError("Please pass a TableStyle object.");
}
this._tableStyle = tableStyle;... | [
"function",
"(",
"catalogItem",
",",
"tableStructure",
",",
"tableStyle",
")",
"{",
"this",
".",
"_tableStructure",
"=",
"defined",
"(",
"tableStructure",
")",
"?",
"tableStructure",
":",
"new",
"TableStructure",
"(",
")",
";",
"if",
"(",
"defined",
"(",
"ta... | A DataSource for table-based data.
Handles the graphical display of lat-lon and region-mapped datasets.
For lat-lon data sets, each row is taken to be a feature. RegionMapping generates Cesium entities for each row.
For region-mapped data sets, each row is a region. The regions are displayed using a WMS imagery layer.
... | [
"A",
"DataSource",
"for",
"table",
"-",
"based",
"data",
".",
"Handles",
"the",
"graphical",
"display",
"of",
"lat",
"-",
"lon",
"and",
"region",
"-",
"mapped",
"datasets",
".",
"For",
"lat",
"-",
"lon",
"data",
"sets",
"each",
"row",
"is",
"taken",
"t... | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/RegionMapping.js#L52-L99 | |
7,016 | TerriaJS/terriajs | lib/Models/RegionMapping.js | loadRegionIds | function loadRegionIds(regionMapping, rawRegionDetails) {
var promises = rawRegionDetails.map(function(rawRegionDetail) {
return rawRegionDetail.regionProvider.loadRegionIDs();
});
return when
.all(promises)
.then(function() {
// Cache the details in a nicer format, storing the actual columns ra... | javascript | function loadRegionIds(regionMapping, rawRegionDetails) {
var promises = rawRegionDetails.map(function(rawRegionDetail) {
return rawRegionDetail.regionProvider.loadRegionIDs();
});
return when
.all(promises)
.then(function() {
// Cache the details in a nicer format, storing the actual columns ra... | [
"function",
"loadRegionIds",
"(",
"regionMapping",
",",
"rawRegionDetails",
")",
"{",
"var",
"promises",
"=",
"rawRegionDetails",
".",
"map",
"(",
"function",
"(",
"rawRegionDetail",
")",
"{",
"return",
"rawRegionDetail",
".",
"regionProvider",
".",
"loadRegionIDs",... | Loads region ids from the region providers, and returns the region details. | [
"Loads",
"region",
"ids",
"from",
"the",
"region",
"providers",
"and",
"returns",
"the",
"region",
"details",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/RegionMapping.js#L439-L461 |
7,017 | TerriaJS/terriajs | lib/Models/RegionMapping.js | calculateRegionIndices | function calculateRegionIndices(
regionMapping,
time,
failedMatches,
ambiguousMatches
) {
// As described in load, currently we only use the first possible region column.
var regionDetail = regionMapping._regionDetails[0];
var tableStructure = regionMapping._tableStructure;
var regionColumn = tableStruc... | javascript | function calculateRegionIndices(
regionMapping,
time,
failedMatches,
ambiguousMatches
) {
// As described in load, currently we only use the first possible region column.
var regionDetail = regionMapping._regionDetails[0];
var tableStructure = regionMapping._tableStructure;
var regionColumn = tableStruc... | [
"function",
"calculateRegionIndices",
"(",
"regionMapping",
",",
"time",
",",
"failedMatches",
",",
"ambiguousMatches",
")",
"{",
"// As described in load, currently we only use the first possible region column.",
"var",
"regionDetail",
"=",
"regionMapping",
".",
"_regionDetails"... | Returns an array the same length as regionProvider.regions, mapping each region into the relevant index into the table data source.
Takes the current time into account if a time is provided, and there is a time column with timeIntervals defined.
@private
@param {RegionMapping} regionMapping The table data source.
@para... | [
"Returns",
"an",
"array",
"the",
"same",
"length",
"as",
"regionProvider",
".",
"regions",
"mapping",
"each",
"region",
"into",
"the",
"relevant",
"index",
"into",
"the",
"table",
"data",
"source",
".",
"Takes",
"the",
"current",
"time",
"into",
"account",
"... | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/RegionMapping.js#L473-L504 |
7,018 | TerriaJS/terriajs | lib/Models/LegendHelper.js | function(tableColumn, tableStyle, regionProvider, name) {
this.tableColumn = tableColumn;
this.tableStyle = defined(tableStyle) ? tableStyle : new TableStyle(); // instead of defaultValue, so new object only created if needed.
this.tableColumnStyle = getTableColumnStyle(tableColumn, this.tableStyle);
this.name ... | javascript | function(tableColumn, tableStyle, regionProvider, name) {
this.tableColumn = tableColumn;
this.tableStyle = defined(tableStyle) ? tableStyle : new TableStyle(); // instead of defaultValue, so new object only created if needed.
this.tableColumnStyle = getTableColumnStyle(tableColumn, this.tableStyle);
this.name ... | [
"function",
"(",
"tableColumn",
",",
"tableStyle",
",",
"regionProvider",
",",
"name",
")",
"{",
"this",
".",
"tableColumn",
"=",
"tableColumn",
";",
"this",
".",
"tableStyle",
"=",
"defined",
"(",
"tableStyle",
")",
"?",
"tableStyle",
":",
"new",
"TableStyl... | Legends for table columns depend on both the table style and the selected column.
This class brings the two together to generate a legend.
Its key output is legendUrl.
@alias LegendHelper
@constructor
@param {TableColumn} tableColumn The column whose values inform the legend.
@param {TableStyle} [tableStyle] The styl... | [
"Legends",
"for",
"table",
"columns",
"depend",
"on",
"both",
"the",
"table",
"style",
"and",
"the",
"selected",
"column",
".",
"This",
"class",
"brings",
"the",
"two",
"together",
"to",
"generate",
"a",
"legend",
".",
"Its",
"key",
"output",
"is",
"legend... | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/LegendHelper.js#L50-L82 | |
7,019 | 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 |
7,020 | 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 |
7,021 | 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 |
7,022 | 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 |
7,023 | 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 | |
7,024 | 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 |
7,025 | 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 |
7,026 | 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 | |
7,027 | 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 |
7,028 | 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 | |
7,029 | 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 |
7,030 | 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 | |
7,031 | 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 |
7,032 | 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 |
7,033 | 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 |
7,034 | 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 |
7,035 | 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 |
7,036 | 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 |
7,037 | 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 | |
7,038 | 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 | |
7,039 | 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 | |
7,040 | 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 |
7,041 | 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 |
7,042 | 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 |
7,043 | 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 |
7,044 | 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 |
7,045 | 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 |
7,046 | 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 |
7,047 | 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 | |
7,048 | 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 |
7,049 | 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 |
7,050 | 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 |
7,051 | 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 |
7,052 | 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 |
7,053 | 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 |
7,054 | 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 |
7,055 | 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 |
7,056 | 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 |
7,057 | 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 |
7,058 | 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 |
7,059 | 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 |
7,060 | 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 | |
7,061 | 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 |
7,062 | 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 | |
7,063 | 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 |
7,064 | 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 |
7,065 | 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 | |
7,066 | 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 |
7,067 | 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 |
7,068 | 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 |
7,069 | 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 |
7,070 | 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 |
7,071 | 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 |
7,072 | 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 |
7,073 | 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 |
7,074 | 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 |
7,075 | 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 |
7,076 | 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 |
7,077 | 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 |
7,078 | 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 |
7,079 | 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 |
7,080 | 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 | |
7,081 | 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 | |
7,082 | 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 |
7,083 | 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 | |
7,084 | 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 |
7,085 | 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 | |
7,086 | 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 | |
7,087 | 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 |
7,088 | 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 | |
7,089 | 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 | |
7,090 | 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 | |
7,091 | 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 | |
7,092 | 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 | |
7,093 | 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 |
7,094 | 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 |
7,095 | 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 |
7,096 | 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 |
7,097 | 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 |
7,098 | 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 |
7,099 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.