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
10,600
NASAWorldWind/WebWorldWind
examples/WktExporter.js
onExportWkt
function onExportWkt() { // This is the actual export action. var exportedWkt = WorldWind.WktExporter.exportRenderables(shapesLayer.renderables); document.getElementById("wktTxtArea").value = exportedWkt; }
javascript
function onExportWkt() { // This is the actual export action. var exportedWkt = WorldWind.WktExporter.exportRenderables(shapesLayer.renderables); document.getElementById("wktTxtArea").value = exportedWkt; }
[ "function", "onExportWkt", "(", ")", "{", "// This is the actual export action.", "var", "exportedWkt", "=", "WorldWind", ".", "WktExporter", ".", "exportRenderables", "(", "shapesLayer", ".", "renderables", ")", ";", "document", ".", "getElementById", "(", "\"wktTxtArea\"", ")", ".", "value", "=", "exportedWkt", ";", "}" ]
Export the surface shapes on click
[ "Export", "the", "surface", "shapes", "on", "click" ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/examples/WktExporter.js#L115-L121
10,601
NASAWorldWind/WebWorldWind
src/util/LevelSet.js
function (sector, levelZeroDelta, numLevels, tileWidth, tileHeight) { if (!sector) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "LevelSet", "constructor", "missingSector")); } if (!levelZeroDelta) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "LevelSet", "constructor", "The specified level zero delta is null or undefined")); } if (levelZeroDelta.latitude <= 0 || levelZeroDelta.longitude <= 0) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "LevelSet", "constructor", "The specified level zero delta is less than or equal to zero.")); } if (numLevels < 1) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "LevelSet", "constructor", "The specified number of levels is less than one.")); } if (tileWidth < 1 || tileHeight < 1) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "LevelSet", "constructor", "The specified tile width or tile height is less than one.")); } /** * The sector spanned by this level set. * @type {Sector} * @readonly */ this.sector = sector; /** * The geographic size of the lowest resolution (level 0) tiles in this level set. * @type {Location} * @readonly */ this.levelZeroDelta = levelZeroDelta; /** * The number of levels in this level set. * @type {Number} * @readonly */ this.numLevels = numLevels; /** * The width in pixels of images associated with tiles in this level set, or the number of sample points * in the longitudinal direction of elevation tiles associated with this level set. * @type {Number} * @readonly */ this.tileWidth = tileWidth; /** * The height in pixels of images associated with tiles in this level set, or the number of sample points * in the latitudinal direction of elevation tiles associated with this level set. * @type {Number} * @readonly */ this.tileHeight = tileHeight; this.levels = []; for (var i = 0; i < numLevels; i += 1) { var n = Math.pow(2, i), latDelta = levelZeroDelta.latitude / n, lonDelta = levelZeroDelta.longitude / n, tileDelta = new Location(latDelta, lonDelta), level = new Level(i, tileDelta, this); this.levels[i] = level; } }
javascript
function (sector, levelZeroDelta, numLevels, tileWidth, tileHeight) { if (!sector) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "LevelSet", "constructor", "missingSector")); } if (!levelZeroDelta) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "LevelSet", "constructor", "The specified level zero delta is null or undefined")); } if (levelZeroDelta.latitude <= 0 || levelZeroDelta.longitude <= 0) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "LevelSet", "constructor", "The specified level zero delta is less than or equal to zero.")); } if (numLevels < 1) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "LevelSet", "constructor", "The specified number of levels is less than one.")); } if (tileWidth < 1 || tileHeight < 1) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "LevelSet", "constructor", "The specified tile width or tile height is less than one.")); } /** * The sector spanned by this level set. * @type {Sector} * @readonly */ this.sector = sector; /** * The geographic size of the lowest resolution (level 0) tiles in this level set. * @type {Location} * @readonly */ this.levelZeroDelta = levelZeroDelta; /** * The number of levels in this level set. * @type {Number} * @readonly */ this.numLevels = numLevels; /** * The width in pixels of images associated with tiles in this level set, or the number of sample points * in the longitudinal direction of elevation tiles associated with this level set. * @type {Number} * @readonly */ this.tileWidth = tileWidth; /** * The height in pixels of images associated with tiles in this level set, or the number of sample points * in the latitudinal direction of elevation tiles associated with this level set. * @type {Number} * @readonly */ this.tileHeight = tileHeight; this.levels = []; for (var i = 0; i < numLevels; i += 1) { var n = Math.pow(2, i), latDelta = levelZeroDelta.latitude / n, lonDelta = levelZeroDelta.longitude / n, tileDelta = new Location(latDelta, lonDelta), level = new Level(i, tileDelta, this); this.levels[i] = level; } }
[ "function", "(", "sector", ",", "levelZeroDelta", ",", "numLevels", ",", "tileWidth", ",", "tileHeight", ")", "{", "if", "(", "!", "sector", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"LevelSet\"", ",", "\"constructor\"", ",", "\"missingSector\"", ")", ")", ";", "}", "if", "(", "!", "levelZeroDelta", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"LevelSet\"", ",", "\"constructor\"", ",", "\"The specified level zero delta is null or undefined\"", ")", ")", ";", "}", "if", "(", "levelZeroDelta", ".", "latitude", "<=", "0", "||", "levelZeroDelta", ".", "longitude", "<=", "0", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"LevelSet\"", ",", "\"constructor\"", ",", "\"The specified level zero delta is less than or equal to zero.\"", ")", ")", ";", "}", "if", "(", "numLevels", "<", "1", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"LevelSet\"", ",", "\"constructor\"", ",", "\"The specified number of levels is less than one.\"", ")", ")", ";", "}", "if", "(", "tileWidth", "<", "1", "||", "tileHeight", "<", "1", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"LevelSet\"", ",", "\"constructor\"", ",", "\"The specified tile width or tile height is less than one.\"", ")", ")", ";", "}", "/**\n * The sector spanned by this level set.\n * @type {Sector}\n * @readonly\n */", "this", ".", "sector", "=", "sector", ";", "/**\n * The geographic size of the lowest resolution (level 0) tiles in this level set.\n * @type {Location}\n * @readonly\n */", "this", ".", "levelZeroDelta", "=", "levelZeroDelta", ";", "/**\n * The number of levels in this level set.\n * @type {Number}\n * @readonly\n */", "this", ".", "numLevels", "=", "numLevels", ";", "/**\n * The width in pixels of images associated with tiles in this level set, or the number of sample points\n * in the longitudinal direction of elevation tiles associated with this level set.\n * @type {Number}\n * @readonly\n */", "this", ".", "tileWidth", "=", "tileWidth", ";", "/**\n * The height in pixels of images associated with tiles in this level set, or the number of sample points\n * in the latitudinal direction of elevation tiles associated with this level set.\n * @type {Number}\n * @readonly\n */", "this", ".", "tileHeight", "=", "tileHeight", ";", "this", ".", "levels", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "numLevels", ";", "i", "+=", "1", ")", "{", "var", "n", "=", "Math", ".", "pow", "(", "2", ",", "i", ")", ",", "latDelta", "=", "levelZeroDelta", ".", "latitude", "/", "n", ",", "lonDelta", "=", "levelZeroDelta", ".", "longitude", "/", "n", ",", "tileDelta", "=", "new", "Location", "(", "latDelta", ",", "lonDelta", ")", ",", "level", "=", "new", "Level", "(", "i", ",", "tileDelta", ",", "this", ")", ";", "this", ".", "levels", "[", "i", "]", "=", "level", ";", "}", "}" ]
Constructs a level set. @alias Level @constructor @classdesc Represents a multi-resolution, hierarchical collection of tiles. Applications typically do not interact with this class. @param {Sector} sector The sector spanned by this level set. @param {Location} levelZeroDelta The geographic size of tiles in the lowest resolution level of this level set. @param {Number} numLevels The number of levels in the level set. @param {Number} tileWidth The height in pixels of images associated with tiles in this level set, or the number of sample points in the longitudinal direction of elevation tiles associate with this level set. @param {Number} tileHeight The height in pixels of images associated with tiles in this level set, or the number of sample points in the latitudinal direction of elevation tiles associate with this level set. @throws {ArgumentError} If the specified sector or level-zero-delta is null or undefined, the level zero delta values are less than or equal to zero, or any of the number-of-levels, tile-width or tile-height arguments are less than 1.
[ "Constructs", "a", "level", "set", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/LevelSet.js#L49-L127
10,602
NASAWorldWind/WebWorldWind
src/util/Logger.js
function (level, message) { if (message && level > 0 && level <= loggingLevel) { if (level === Logger.LEVEL_SEVERE) { console.error(message); } else if (level === Logger.LEVEL_WARNING) { console.warn(message); } else if (level === Logger.LEVEL_INFO) { console.info(message); } else { console.log(message); } } }
javascript
function (level, message) { if (message && level > 0 && level <= loggingLevel) { if (level === Logger.LEVEL_SEVERE) { console.error(message); } else if (level === Logger.LEVEL_WARNING) { console.warn(message); } else if (level === Logger.LEVEL_INFO) { console.info(message); } else { console.log(message); } } }
[ "function", "(", "level", ",", "message", ")", "{", "if", "(", "message", "&&", "level", ">", "0", "&&", "level", "<=", "loggingLevel", ")", "{", "if", "(", "level", "===", "Logger", ".", "LEVEL_SEVERE", ")", "{", "console", ".", "error", "(", "message", ")", ";", "}", "else", "if", "(", "level", "===", "Logger", ".", "LEVEL_WARNING", ")", "{", "console", ".", "warn", "(", "message", ")", ";", "}", "else", "if", "(", "level", "===", "Logger", ".", "LEVEL_INFO", ")", "{", "console", ".", "info", "(", "message", ")", ";", "}", "else", "{", "console", ".", "log", "(", "message", ")", ";", "}", "}", "}" ]
Logs a specified message at a specified level. @param {Number} level The logging level of the message. If the current logging level allows this message to be logged it is written to the console. @param {String} message The message to log. Nothing is logged if the message is null or undefined.
[ "Logs", "a", "specified", "message", "at", "a", "specified", "level", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/Logger.js#L69-L81
10,603
NASAWorldWind/WebWorldWind
src/util/ByteBuffer.js
function(array) { if (!array) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "ByteBuffer", "constructor", "missingArray")); } /** * The raw data of the array buffer. * @type {ArrayBuffer} */ this.array = array; /** * A data view on the array buffer. * This data view is used to extract integer and floating point data from that array buffer. * @type {DataView} */ this.data = new DataView(array); /** * The current position in the array buffer. * This position is implicitly used to access all data. * @type {Number} */ this.position = 0; /** * The byte order in which the data is encoded. * Byte order will either be big endian or little endian. * @type {Boolean} * @default ByteByffer.LITTLE_ENDIAN * @private */ this._order = ByteBuffer.LITTLE_ENDIAN; }
javascript
function(array) { if (!array) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "ByteBuffer", "constructor", "missingArray")); } /** * The raw data of the array buffer. * @type {ArrayBuffer} */ this.array = array; /** * A data view on the array buffer. * This data view is used to extract integer and floating point data from that array buffer. * @type {DataView} */ this.data = new DataView(array); /** * The current position in the array buffer. * This position is implicitly used to access all data. * @type {Number} */ this.position = 0; /** * The byte order in which the data is encoded. * Byte order will either be big endian or little endian. * @type {Boolean} * @default ByteByffer.LITTLE_ENDIAN * @private */ this._order = ByteBuffer.LITTLE_ENDIAN; }
[ "function", "(", "array", ")", "{", "if", "(", "!", "array", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"ByteBuffer\"", ",", "\"constructor\"", ",", "\"missingArray\"", ")", ")", ";", "}", "/**\n * The raw data of the array buffer.\n * @type {ArrayBuffer}\n */", "this", ".", "array", "=", "array", ";", "/**\n * A data view on the array buffer.\n * This data view is used to extract integer and floating point data from that array buffer.\n * @type {DataView}\n */", "this", ".", "data", "=", "new", "DataView", "(", "array", ")", ";", "/**\n * The current position in the array buffer.\n * This position is implicitly used to access all data.\n * @type {Number}\n */", "this", ".", "position", "=", "0", ";", "/**\n * The byte order in which the data is encoded.\n * Byte order will either be big endian or little endian.\n * @type {Boolean}\n * @default ByteByffer.LITTLE_ENDIAN\n * @private\n */", "this", ".", "_order", "=", "ByteBuffer", ".", "LITTLE_ENDIAN", ";", "}" ]
Constructs a wrapper around an array buffer that enables byte-level access to its data. This wrapper strives to minimize secondary allocations when subarrays are accessed. The one exception is when double precision floating point data is access that is not properly aligned. @alias ByteBuffer @classdesc A structured wrapper around an array buffer that provides byte-level access to its data. @param {ArrayBuffer} array An array buffer containing source data. @constructor
[ "Constructs", "a", "wrapper", "around", "an", "array", "buffer", "that", "enables", "byte", "-", "level", "access", "to", "its", "data", ".", "This", "wrapper", "strives", "to", "minimize", "secondary", "allocations", "when", "subarrays", "are", "accessed", ".", "The", "one", "exception", "is", "when", "double", "precision", "floating", "point", "data", "is", "access", "that", "is", "not", "properly", "aligned", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/ByteBuffer.js#L36-L70
10,604
NASAWorldWind/WebWorldWind
src/layer/heatmap/HeatMapTile.js
function(data, options) { this._data = data; this._sector = options.sector; this._canvas = this.createCanvas(options.width, options.height); this._width = options.width; this._height = options.height; this._intensityGradient = options.intensityGradient; this._radius = options.radius; this._incrementPerIntensity = options.incrementPerIntensity; }
javascript
function(data, options) { this._data = data; this._sector = options.sector; this._canvas = this.createCanvas(options.width, options.height); this._width = options.width; this._height = options.height; this._intensityGradient = options.intensityGradient; this._radius = options.radius; this._incrementPerIntensity = options.incrementPerIntensity; }
[ "function", "(", "data", ",", "options", ")", "{", "this", ".", "_data", "=", "data", ";", "this", ".", "_sector", "=", "options", ".", "sector", ";", "this", ".", "_canvas", "=", "this", ".", "createCanvas", "(", "options", ".", "width", ",", "options", ".", "height", ")", ";", "this", ".", "_width", "=", "options", ".", "width", ";", "this", ".", "_height", "=", "options", ".", "height", ";", "this", ".", "_intensityGradient", "=", "options", ".", "intensityGradient", ";", "this", ".", "_radius", "=", "options", ".", "radius", ";", "this", ".", "_incrementPerIntensity", "=", "options", ".", "incrementPerIntensity", ";", "}" ]
Constructs a HeatMapTile. Returns one tile for the HeatMap information. It is basically an interface specifying the public methods properties and default configuration. The logic itself is handled in the subclasses. @alias HeatMapTile @constructor @classdesc Tile for the HeatMap layer visualising data on a canvas using shades of gray scale. @param data {Object[]} Array of information constituting points in the map. @param options {Object} @param options.sector {Sector} Sector representing the geographical area for this tile. It is used to correctly interpret the location of the MeasuredLocation on the resulting canvas. @param options.width {Number} Width of the Canvas to be created in pixels. @param options.height {Number} Height of the Canvas to be created in pixels. @param options.radius {Number} Radius of the data point in pixels. The radius represents the blur applied to the drawn shape @param options.incrementPerIntensity {Number} The ratio representing the 1 / measure for the maximum measure. @param options.intensityGradient {Object} Keys represent the opacity between 0 and 1 and the values represent color strings.
[ "Constructs", "a", "HeatMapTile", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/layer/heatmap/HeatMapTile.js#L40-L54
10,605
NASAWorldWind/WebWorldWind
src/formats/geotiff/GeoTiffMetadata.js
function () { // Documented in defineProperties below. this._bitsPerSample = null; // Documented in defineProperties below. this._colorMap = null; // Documented in defineProperties below. this._compression = null; // Documented in defineProperties below. this._extraSamples = null; // Documented in defineProperties below. this._imageDescription = null; // Documented in defineProperties below. this._imageLength = null; // Documented in defineProperties below. this._imageWidth = null; // Documented in defineProperties below. this._maxSampleValue = null; // Documented in defineProperties below. this._minSampleValue = null; // Documented in defineProperties below. this._orientation = 0; // Documented in defineProperties below. this._photometricInterpretation = null; // Documented in defineProperties below. this._planarConfiguration = null; // Documented in defineProperties below. this._resolutionUnit = null; // Documented in defineProperties below. this._rowsPerStrip = null; // Documented in defineProperties below. this._samplesPerPixel = null; // Documented in defineProperties below. this._sampleFormat = null; // Documented in defineProperties below. this._software = null; // Documented in defineProperties below. this._stripByteCounts = null; // Documented in defineProperties below. this._stripOffsets = null; // Documented in defineProperties below. this._tileByteCounts = null; // Documented in defineProperties below. this._tileOffsets = null; // Documented in defineProperties below. this._tileLength = null; // Documented in defineProperties below. this._tileWidth = null; // Documented in defineProperties below. this._xResolution = null; // Documented in defineProperties below. this._yResolution = null; // Documented in defineProperties below. this._geoAsciiParams = null; // Documented in defineProperties below. this._geoDoubleParams = null; // Documented in defineProperties below. this._geoKeyDirectory = null; // Documented in defineProperties below. this._modelPixelScale = null; // Documented in defineProperties below. this._modelTiepoint = null; // Documented in defineProperties below. this._modelTransformation = null; // Documented in defineProperties below. this._noData = null; // Documented in defineProperties below. this._metaData = null; // Documented in defineProperties below. this._bbox = null; // Documented in defineProperties below. this._gtModelTypeGeoKey = null; // Documented in defineProperties below. this._gtRasterTypeGeoKey = null; // Documented in defineProperties below. this._gtCitationGeoKey = null; // Documented in defineProperties below. this._geographicTypeGeoKey = null; // Documented in defineProperties below. this._geogCitationGeoKey = null; // Documented in defineProperties below. this._geogAngularUnitsGeoKey = null; // Documented in defineProperties below. this._geogAngularUnitSizeGeoKey = null; // Documented in defineProperties below. this._geogSemiMajorAxisGeoKey = null; // Documented in defineProperties below. this._geogInvFlatteningGeoKey = null; // Documented in defineProperties below. this._projectedCSType = null; // Documented in defineProperties below. this._projLinearUnits = null; }
javascript
function () { // Documented in defineProperties below. this._bitsPerSample = null; // Documented in defineProperties below. this._colorMap = null; // Documented in defineProperties below. this._compression = null; // Documented in defineProperties below. this._extraSamples = null; // Documented in defineProperties below. this._imageDescription = null; // Documented in defineProperties below. this._imageLength = null; // Documented in defineProperties below. this._imageWidth = null; // Documented in defineProperties below. this._maxSampleValue = null; // Documented in defineProperties below. this._minSampleValue = null; // Documented in defineProperties below. this._orientation = 0; // Documented in defineProperties below. this._photometricInterpretation = null; // Documented in defineProperties below. this._planarConfiguration = null; // Documented in defineProperties below. this._resolutionUnit = null; // Documented in defineProperties below. this._rowsPerStrip = null; // Documented in defineProperties below. this._samplesPerPixel = null; // Documented in defineProperties below. this._sampleFormat = null; // Documented in defineProperties below. this._software = null; // Documented in defineProperties below. this._stripByteCounts = null; // Documented in defineProperties below. this._stripOffsets = null; // Documented in defineProperties below. this._tileByteCounts = null; // Documented in defineProperties below. this._tileOffsets = null; // Documented in defineProperties below. this._tileLength = null; // Documented in defineProperties below. this._tileWidth = null; // Documented in defineProperties below. this._xResolution = null; // Documented in defineProperties below. this._yResolution = null; // Documented in defineProperties below. this._geoAsciiParams = null; // Documented in defineProperties below. this._geoDoubleParams = null; // Documented in defineProperties below. this._geoKeyDirectory = null; // Documented in defineProperties below. this._modelPixelScale = null; // Documented in defineProperties below. this._modelTiepoint = null; // Documented in defineProperties below. this._modelTransformation = null; // Documented in defineProperties below. this._noData = null; // Documented in defineProperties below. this._metaData = null; // Documented in defineProperties below. this._bbox = null; // Documented in defineProperties below. this._gtModelTypeGeoKey = null; // Documented in defineProperties below. this._gtRasterTypeGeoKey = null; // Documented in defineProperties below. this._gtCitationGeoKey = null; // Documented in defineProperties below. this._geographicTypeGeoKey = null; // Documented in defineProperties below. this._geogCitationGeoKey = null; // Documented in defineProperties below. this._geogAngularUnitsGeoKey = null; // Documented in defineProperties below. this._geogAngularUnitSizeGeoKey = null; // Documented in defineProperties below. this._geogSemiMajorAxisGeoKey = null; // Documented in defineProperties below. this._geogInvFlatteningGeoKey = null; // Documented in defineProperties below. this._projectedCSType = null; // Documented in defineProperties below. this._projLinearUnits = null; }
[ "function", "(", ")", "{", "// Documented in defineProperties below.", "this", ".", "_bitsPerSample", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_colorMap", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_compression", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_extraSamples", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_imageDescription", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_imageLength", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_imageWidth", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_maxSampleValue", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_minSampleValue", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_orientation", "=", "0", ";", "// Documented in defineProperties below.", "this", ".", "_photometricInterpretation", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_planarConfiguration", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_resolutionUnit", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_rowsPerStrip", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_samplesPerPixel", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_sampleFormat", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_software", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_stripByteCounts", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_stripOffsets", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_tileByteCounts", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_tileOffsets", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_tileLength", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_tileWidth", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_xResolution", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_yResolution", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_geoAsciiParams", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_geoDoubleParams", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_geoKeyDirectory", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_modelPixelScale", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_modelTiepoint", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_modelTransformation", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_noData", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_metaData", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_bbox", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_gtModelTypeGeoKey", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_gtRasterTypeGeoKey", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_gtCitationGeoKey", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_geographicTypeGeoKey", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_geogCitationGeoKey", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_geogAngularUnitsGeoKey", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_geogAngularUnitSizeGeoKey", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_geogSemiMajorAxisGeoKey", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_geogInvFlatteningGeoKey", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_projectedCSType", "=", "null", ";", "// Documented in defineProperties below.", "this", ".", "_projLinearUnits", "=", "null", ";", "}" ]
Provides GeoTIFF metadata. @alias GeoTiffMetadata @constructor @classdesc Contains all of the TIFF and GeoTIFF metadata for a geotiff file.
[ "Provides", "GeoTIFF", "metadata", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/formats/geotiff/GeoTiffMetadata.js#L31-L167
10,606
NASAWorldWind/WebWorldWind
src/render/Texture.js
function (gl, image, wrapMode) { if (!gl) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "Texture", "constructor", "missingGlContext")); } if (!image) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "Texture", "constructor", "missingImage")); } if (!wrapMode) { wrapMode = gl.CLAMP_TO_EDGE; } var textureId = gl.createTexture(), isPowerOfTwo = (WWMath.isPowerOfTwo(image.width) && WWMath.isPowerOfTwo(image.height)); this.originalImageWidth = image.width; this.originalImageHeight = image.height; if (wrapMode === gl.REPEAT && !isPowerOfTwo) { image = this.resizeImage(image); isPowerOfTwo = true; } this.imageWidth = image.width; this.imageHeight = image.height; this.size = image.width * image.height * 4; gl.bindTexture(gl.TEXTURE_2D, textureId); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, isPowerOfTwo ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapMode); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapMode); gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0); if (isPowerOfTwo) { gl.generateMipmap(gl.TEXTURE_2D); } this.textureId = textureId; /** * The time at which this texture was created. * @type {Date} */ this.creationTime = new Date(); // Internal use only. Intentionally not documented. this.texParameters = {}; // Internal use only. Intentionally not documented. // https://www.khronos.org/registry/webgl/extensions/EXT_texture_filter_anisotrop this.anisotropicFilterExt = (gl.getExtension("EXT_texture_filter_anisotropic") || gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")); }
javascript
function (gl, image, wrapMode) { if (!gl) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "Texture", "constructor", "missingGlContext")); } if (!image) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "Texture", "constructor", "missingImage")); } if (!wrapMode) { wrapMode = gl.CLAMP_TO_EDGE; } var textureId = gl.createTexture(), isPowerOfTwo = (WWMath.isPowerOfTwo(image.width) && WWMath.isPowerOfTwo(image.height)); this.originalImageWidth = image.width; this.originalImageHeight = image.height; if (wrapMode === gl.REPEAT && !isPowerOfTwo) { image = this.resizeImage(image); isPowerOfTwo = true; } this.imageWidth = image.width; this.imageHeight = image.height; this.size = image.width * image.height * 4; gl.bindTexture(gl.TEXTURE_2D, textureId); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, isPowerOfTwo ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapMode); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapMode); gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0); if (isPowerOfTwo) { gl.generateMipmap(gl.TEXTURE_2D); } this.textureId = textureId; /** * The time at which this texture was created. * @type {Date} */ this.creationTime = new Date(); // Internal use only. Intentionally not documented. this.texParameters = {}; // Internal use only. Intentionally not documented. // https://www.khronos.org/registry/webgl/extensions/EXT_texture_filter_anisotrop this.anisotropicFilterExt = (gl.getExtension("EXT_texture_filter_anisotropic") || gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")); }
[ "function", "(", "gl", ",", "image", ",", "wrapMode", ")", "{", "if", "(", "!", "gl", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"Texture\"", ",", "\"constructor\"", ",", "\"missingGlContext\"", ")", ")", ";", "}", "if", "(", "!", "image", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"Texture\"", ",", "\"constructor\"", ",", "\"missingImage\"", ")", ")", ";", "}", "if", "(", "!", "wrapMode", ")", "{", "wrapMode", "=", "gl", ".", "CLAMP_TO_EDGE", ";", "}", "var", "textureId", "=", "gl", ".", "createTexture", "(", ")", ",", "isPowerOfTwo", "=", "(", "WWMath", ".", "isPowerOfTwo", "(", "image", ".", "width", ")", "&&", "WWMath", ".", "isPowerOfTwo", "(", "image", ".", "height", ")", ")", ";", "this", ".", "originalImageWidth", "=", "image", ".", "width", ";", "this", ".", "originalImageHeight", "=", "image", ".", "height", ";", "if", "(", "wrapMode", "===", "gl", ".", "REPEAT", "&&", "!", "isPowerOfTwo", ")", "{", "image", "=", "this", ".", "resizeImage", "(", "image", ")", ";", "isPowerOfTwo", "=", "true", ";", "}", "this", ".", "imageWidth", "=", "image", ".", "width", ";", "this", ".", "imageHeight", "=", "image", ".", "height", ";", "this", ".", "size", "=", "image", ".", "width", "*", "image", ".", "height", "*", "4", ";", "gl", ".", "bindTexture", "(", "gl", ".", "TEXTURE_2D", ",", "textureId", ")", ";", "gl", ".", "texParameteri", "(", "gl", ".", "TEXTURE_2D", ",", "gl", ".", "TEXTURE_MIN_FILTER", ",", "isPowerOfTwo", "?", "gl", ".", "LINEAR_MIPMAP_LINEAR", ":", "gl", ".", "LINEAR", ")", ";", "gl", ".", "texParameteri", "(", "gl", ".", "TEXTURE_2D", ",", "gl", ".", "TEXTURE_WRAP_S", ",", "wrapMode", ")", ";", "gl", ".", "texParameteri", "(", "gl", ".", "TEXTURE_2D", ",", "gl", ".", "TEXTURE_WRAP_T", ",", "wrapMode", ")", ";", "gl", ".", "pixelStorei", "(", "gl", ".", "UNPACK_PREMULTIPLY_ALPHA_WEBGL", ",", "1", ")", ";", "gl", ".", "texImage2D", "(", "gl", ".", "TEXTURE_2D", ",", "0", ",", "gl", ".", "RGBA", ",", "gl", ".", "RGBA", ",", "gl", ".", "UNSIGNED_BYTE", ",", "image", ")", ";", "gl", ".", "pixelStorei", "(", "gl", ".", "UNPACK_PREMULTIPLY_ALPHA_WEBGL", ",", "0", ")", ";", "if", "(", "isPowerOfTwo", ")", "{", "gl", ".", "generateMipmap", "(", "gl", ".", "TEXTURE_2D", ")", ";", "}", "this", ".", "textureId", "=", "textureId", ";", "/**\n * The time at which this texture was created.\n * @type {Date}\n */", "this", ".", "creationTime", "=", "new", "Date", "(", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "texParameters", "=", "{", "}", ";", "// Internal use only. Intentionally not documented.", "// https://www.khronos.org/registry/webgl/extensions/EXT_texture_filter_anisotrop", "this", ".", "anisotropicFilterExt", "=", "(", "gl", ".", "getExtension", "(", "\"EXT_texture_filter_anisotropic\"", ")", "||", "gl", ".", "getExtension", "(", "\"WEBKIT_EXT_texture_filter_anisotropic\"", ")", ")", ";", "}" ]
Constructs a texture for a specified image. @alias Texture @constructor @classdesc Represents a WebGL texture. Applications typically do not interact with this class. @param {WebGLRenderingContext} gl The current WebGL rendering context. @param {Image} image The texture's image. @param {GLenum} wrapMode Optional. Specifies the wrap mode of the texture. Defaults to gl.CLAMP_TO_EDGE @throws {ArgumentError} If the specified WebGL context or image is null or undefined.
[ "Constructs", "a", "texture", "for", "a", "specified", "image", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/render/Texture.js#L40-L102
10,607
NASAWorldWind/WebWorldWind
src/shapes/ShapeAttributes.js
function (attributes) { // All these are documented with their property accessors below. this._drawInterior = attributes ? attributes._drawInterior : true; this._drawOutline = attributes ? attributes._drawOutline : true; this._enableLighting = attributes ? attributes._enableLighting : false; this._interiorColor = attributes ? attributes._interiorColor.clone() : Color.WHITE.clone(); this._outlineColor = attributes ? attributes._outlineColor.clone() : Color.RED.clone(); this._outlineWidth = attributes ? attributes._outlineWidth : 1.0; this._outlineStippleFactor = attributes ? attributes._outlineStippleFactor : 0; this._outlineStipplePattern = attributes ? attributes._outlineStipplePattern : 0xF0F0; this._imageSource = attributes ? attributes._imageSource : null; this._depthTest = attributes ? attributes._depthTest : true; this._drawVerticals = attributes ? attributes._drawVerticals : false; this._applyLighting = attributes ? attributes._applyLighting : false; /** * Indicates whether this object's state key is invalid. Subclasses must set this value to true when their * attributes change. The state key will be automatically computed the next time it's requested. This flag * will be set to false when that occurs. * @type {Boolean} * @protected */ this.stateKeyInvalid = true; }
javascript
function (attributes) { // All these are documented with their property accessors below. this._drawInterior = attributes ? attributes._drawInterior : true; this._drawOutline = attributes ? attributes._drawOutline : true; this._enableLighting = attributes ? attributes._enableLighting : false; this._interiorColor = attributes ? attributes._interiorColor.clone() : Color.WHITE.clone(); this._outlineColor = attributes ? attributes._outlineColor.clone() : Color.RED.clone(); this._outlineWidth = attributes ? attributes._outlineWidth : 1.0; this._outlineStippleFactor = attributes ? attributes._outlineStippleFactor : 0; this._outlineStipplePattern = attributes ? attributes._outlineStipplePattern : 0xF0F0; this._imageSource = attributes ? attributes._imageSource : null; this._depthTest = attributes ? attributes._depthTest : true; this._drawVerticals = attributes ? attributes._drawVerticals : false; this._applyLighting = attributes ? attributes._applyLighting : false; /** * Indicates whether this object's state key is invalid. Subclasses must set this value to true when their * attributes change. The state key will be automatically computed the next time it's requested. This flag * will be set to false when that occurs. * @type {Boolean} * @protected */ this.stateKeyInvalid = true; }
[ "function", "(", "attributes", ")", "{", "// All these are documented with their property accessors below.", "this", ".", "_drawInterior", "=", "attributes", "?", "attributes", ".", "_drawInterior", ":", "true", ";", "this", ".", "_drawOutline", "=", "attributes", "?", "attributes", ".", "_drawOutline", ":", "true", ";", "this", ".", "_enableLighting", "=", "attributes", "?", "attributes", ".", "_enableLighting", ":", "false", ";", "this", ".", "_interiorColor", "=", "attributes", "?", "attributes", ".", "_interiorColor", ".", "clone", "(", ")", ":", "Color", ".", "WHITE", ".", "clone", "(", ")", ";", "this", ".", "_outlineColor", "=", "attributes", "?", "attributes", ".", "_outlineColor", ".", "clone", "(", ")", ":", "Color", ".", "RED", ".", "clone", "(", ")", ";", "this", ".", "_outlineWidth", "=", "attributes", "?", "attributes", ".", "_outlineWidth", ":", "1.0", ";", "this", ".", "_outlineStippleFactor", "=", "attributes", "?", "attributes", ".", "_outlineStippleFactor", ":", "0", ";", "this", ".", "_outlineStipplePattern", "=", "attributes", "?", "attributes", ".", "_outlineStipplePattern", ":", "0xF0F0", ";", "this", ".", "_imageSource", "=", "attributes", "?", "attributes", ".", "_imageSource", ":", "null", ";", "this", ".", "_depthTest", "=", "attributes", "?", "attributes", ".", "_depthTest", ":", "true", ";", "this", ".", "_drawVerticals", "=", "attributes", "?", "attributes", ".", "_drawVerticals", ":", "false", ";", "this", ".", "_applyLighting", "=", "attributes", "?", "attributes", ".", "_applyLighting", ":", "false", ";", "/**\n * Indicates whether this object's state key is invalid. Subclasses must set this value to true when their\n * attributes change. The state key will be automatically computed the next time it's requested. This flag\n * will be set to false when that occurs.\n * @type {Boolean}\n * @protected\n */", "this", ".", "stateKeyInvalid", "=", "true", ";", "}" ]
Constructs a shape attributes bundle, optionally specifying a prototype set of attributes. Not all shapes use all the properties in the bundle. See the documentation of a specific shape to determine the properties it does use. @alias ShapeAttributes @constructor @classdesc Holds attributes applied to WorldWind shapes. @param {ShapeAttributes} attributes An attribute bundle whose properties are used to initially populate the constructed attributes bundle. May be null, in which case the constructed attributes bundle is populated with default attributes.
[ "Constructs", "a", "shape", "attributes", "bundle", "optionally", "specifying", "a", "prototype", "set", "of", "attributes", ".", "Not", "all", "shapes", "use", "all", "the", "properties", "in", "the", "bundle", ".", "See", "the", "documentation", "of", "a", "specific", "shape", "to", "determine", "the", "properties", "it", "does", "use", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shapes/ShapeAttributes.js#L39-L63
10,608
NASAWorldWind/WebWorldWind
src/shapes/SurfacePolyline.js
function (locations, attributes) { if (!locations) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfacePolyline", "constructor", "The specified locations array is null or undefined.")); } SurfaceShape.call(this, attributes); /** * This shape's locations, specified as an array locations. * @type {Array} */ this._boundaries = locations; this._stateId = SurfacePolyline.stateId++; // Internal use only. this._isInteriorInhibited = true; }
javascript
function (locations, attributes) { if (!locations) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfacePolyline", "constructor", "The specified locations array is null or undefined.")); } SurfaceShape.call(this, attributes); /** * This shape's locations, specified as an array locations. * @type {Array} */ this._boundaries = locations; this._stateId = SurfacePolyline.stateId++; // Internal use only. this._isInteriorInhibited = true; }
[ "function", "(", "locations", ",", "attributes", ")", "{", "if", "(", "!", "locations", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"SurfacePolyline\"", ",", "\"constructor\"", ",", "\"The specified locations array is null or undefined.\"", ")", ")", ";", "}", "SurfaceShape", ".", "call", "(", "this", ",", "attributes", ")", ";", "/**\n * This shape's locations, specified as an array locations.\n * @type {Array}\n */", "this", ".", "_boundaries", "=", "locations", ";", "this", ".", "_stateId", "=", "SurfacePolyline", ".", "stateId", "++", ";", "// Internal use only.", "this", ".", "_isInteriorInhibited", "=", "true", ";", "}" ]
Constructs a surface polyline. @alias SurfacePolyline @constructor @augments SurfaceShape @classdesc Represents a polyline draped over the terrain surface. <p> SurfacePolyline uses the following attributes from its associated shape attributes bundle: <ul> <li>Draw outline</li> <li>Outline color</li> <li>Outline width</li> <li>Outline stipple factor</li> <li>Outline stipple pattern</li> </ul> @param {Location[]} locations This polyline's locations. @param {ShapeAttributes} attributes The attributes to apply to this shape. May be null, in which case attributes must be set directly before the shape is drawn. @throws {ArgumentError} If the specified locations are null or undefined.
[ "Constructs", "a", "surface", "polyline", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shapes/SurfacePolyline.js#L52-L71
10,609
NASAWorldWind/WebWorldWind
src/util/BasicTimeSequence.js
function (dates) { if (!dates && dates.length < 2) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "BasicTimeSequence", "constructor", "missingDates")); } /** * This sequence's list of Dates. * @type {Date[]} */ this.dates = dates; /** * This sequence's current index. * @type {Number} * @default 0. */ this.currentIndex = 0; /** * This sequence's current time. * @type {Date} * @default This sequence's start time. */ this.currentTime = dates[0]; }
javascript
function (dates) { if (!dates && dates.length < 2) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "BasicTimeSequence", "constructor", "missingDates")); } /** * This sequence's list of Dates. * @type {Date[]} */ this.dates = dates; /** * This sequence's current index. * @type {Number} * @default 0. */ this.currentIndex = 0; /** * This sequence's current time. * @type {Date} * @default This sequence's start time. */ this.currentTime = dates[0]; }
[ "function", "(", "dates", ")", "{", "if", "(", "!", "dates", "&&", "dates", ".", "length", "<", "2", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"BasicTimeSequence\"", ",", "\"constructor\"", ",", "\"missingDates\"", ")", ")", ";", "}", "/**\n * This sequence's list of Dates.\n * @type {Date[]}\n */", "this", ".", "dates", "=", "dates", ";", "/**\n * This sequence's current index.\n * @type {Number}\n * @default 0.\n */", "this", ".", "currentIndex", "=", "0", ";", "/**\n * This sequence's current time.\n * @type {Date}\n * @default This sequence's start time.\n */", "this", ".", "currentTime", "=", "dates", "[", "0", "]", ";", "}" ]
Constructs a time sequence from an array of Dates. @alias BasicTimeSequence @constructor @classdesc Represents a time sequence described as an array of Date objects as required by WMS. This class provides iteration over the sequence in steps specified by the period. If the start and end dates are different, iteration will start at the start date and end at the end date. @param {Date[]} dates An array of Date objects. @throws {ArgumentError} If the specified dates array is null, undefined or has a length less than two.
[ "Constructs", "a", "time", "sequence", "from", "an", "array", "of", "Dates", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/BasicTimeSequence.js#L40-L66
10,610
NASAWorldWind/WebWorldWind
src/shaders/GpuShader.js
function (gl, shaderType, shaderSource) { if (!(shaderType === gl.VERTEX_SHADER || shaderType === gl.FRAGMENT_SHADER)) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "GpuShader", "constructor", "The specified shader type is unrecognized.")); } if (!shaderSource) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "GpuShader", "constructor", "The specified shader source is null or undefined.")); } var shader = gl.createShader(shaderType); if (!shader) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "GpuShader", "constructor", "Unable to create shader of type " + (shaderType == gl.VERTEX_SHADER ? "VERTEX_SHADER." : "FRAGMENT_SHADER."))); } if (!this.compile(gl, shader, shaderType, shaderSource)) { var infoLog = gl.getShaderInfoLog(shader); gl.deleteShader(shader); throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "GpuShader", "constructor", "Unable to compile shader: " + infoLog)); } this.shaderId = shader; }
javascript
function (gl, shaderType, shaderSource) { if (!(shaderType === gl.VERTEX_SHADER || shaderType === gl.FRAGMENT_SHADER)) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "GpuShader", "constructor", "The specified shader type is unrecognized.")); } if (!shaderSource) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "GpuShader", "constructor", "The specified shader source is null or undefined.")); } var shader = gl.createShader(shaderType); if (!shader) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "GpuShader", "constructor", "Unable to create shader of type " + (shaderType == gl.VERTEX_SHADER ? "VERTEX_SHADER." : "FRAGMENT_SHADER."))); } if (!this.compile(gl, shader, shaderType, shaderSource)) { var infoLog = gl.getShaderInfoLog(shader); gl.deleteShader(shader); throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "GpuShader", "constructor", "Unable to compile shader: " + infoLog)); } this.shaderId = shader; }
[ "function", "(", "gl", ",", "shaderType", ",", "shaderSource", ")", "{", "if", "(", "!", "(", "shaderType", "===", "gl", ".", "VERTEX_SHADER", "||", "shaderType", "===", "gl", ".", "FRAGMENT_SHADER", ")", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"GpuShader\"", ",", "\"constructor\"", ",", "\"The specified shader type is unrecognized.\"", ")", ")", ";", "}", "if", "(", "!", "shaderSource", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"GpuShader\"", ",", "\"constructor\"", ",", "\"The specified shader source is null or undefined.\"", ")", ")", ";", "}", "var", "shader", "=", "gl", ".", "createShader", "(", "shaderType", ")", ";", "if", "(", "!", "shader", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"GpuShader\"", ",", "\"constructor\"", ",", "\"Unable to create shader of type \"", "+", "(", "shaderType", "==", "gl", ".", "VERTEX_SHADER", "?", "\"VERTEX_SHADER.\"", ":", "\"FRAGMENT_SHADER.\"", ")", ")", ")", ";", "}", "if", "(", "!", "this", ".", "compile", "(", "gl", ",", "shader", ",", "shaderType", ",", "shaderSource", ")", ")", "{", "var", "infoLog", "=", "gl", ".", "getShaderInfoLog", "(", "shader", ")", ";", "gl", ".", "deleteShader", "(", "shader", ")", ";", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"GpuShader\"", ",", "\"constructor\"", ",", "\"Unable to compile shader: \"", "+", "infoLog", ")", ")", ";", "}", "this", ".", "shaderId", "=", "shader", ";", "}" ]
Constructs a GPU shader of a specified type with specified GLSL source code. @alias GpuShader @constructor @classdesc Represents an OpenGL shading language (GLSL) shader and provides methods for compiling and disposing of them. @param {WebGLRenderingContext} gl The current WebGL context. @param {Number} shaderType The type of shader, either WebGLRenderingContext.VERTEX_SHADER or WebGLRenderingContext.FRAGMENT_SHADER. @param {String} shaderSource The shader's source code. @throws {ArgumentError} If the shader type is unrecognized, the shader source is null or undefined or shader compilation fails. If the compilation fails the error thrown contains any compilation messages.
[ "Constructs", "a", "GPU", "shader", "of", "a", "specified", "type", "with", "specified", "GLSL", "source", "code", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shaders/GpuShader.js#L44-L73
10,611
NASAWorldWind/WebWorldWind
src/shapes/SurfaceCircle.js
function (center, radius, attributes) { if (!center) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceCircle", "constructor", "missingLocation")); } if (radius < 0) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceCircle", "constructor", "Radius is negative")); } SurfaceShape.call(this, attributes); // All these are documented with their property accessors below. this._center = center; this._radius = radius; this._intervals = SurfaceCircle.DEFAULT_NUM_INTERVALS; }
javascript
function (center, radius, attributes) { if (!center) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceCircle", "constructor", "missingLocation")); } if (radius < 0) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceCircle", "constructor", "Radius is negative")); } SurfaceShape.call(this, attributes); // All these are documented with their property accessors below. this._center = center; this._radius = radius; this._intervals = SurfaceCircle.DEFAULT_NUM_INTERVALS; }
[ "function", "(", "center", ",", "radius", ",", "attributes", ")", "{", "if", "(", "!", "center", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"SurfaceCircle\"", ",", "\"constructor\"", ",", "\"missingLocation\"", ")", ")", ";", "}", "if", "(", "radius", "<", "0", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"SurfaceCircle\"", ",", "\"constructor\"", ",", "\"Radius is negative\"", ")", ")", ";", "}", "SurfaceShape", ".", "call", "(", "this", ",", "attributes", ")", ";", "// All these are documented with their property accessors below.", "this", ".", "_center", "=", "center", ";", "this", ".", "_radius", "=", "radius", ";", "this", ".", "_intervals", "=", "SurfaceCircle", ".", "DEFAULT_NUM_INTERVALS", ";", "}" ]
Constructs a surface circle with a specified center and radius and an optional attributes bundle. @alias SurfaceCircle @constructor @augments SurfaceShape @classdesc Represents a circle draped over the terrain surface. <p> SurfaceCircle uses the following attributes from its associated shape attributes bundle: <ul> <li>Draw interior</li> <li>Draw outline</li> <li>Interior color</li> <li>Outline color</li> <li>Outline width</li> <li>Outline stipple factor</li> <li>Outline stipple pattern</li> </ul> @param {Location} center The circle's center location. @param {Number} radius The circle's radius in meters. @param {ShapeAttributes} attributes The attributes to apply to this shape. May be null, in which case attributes must be set directly before the shape is drawn. @throws {ArgumentError} If the specified center location is null or undefined or the specified radius is negative.
[ "Constructs", "a", "surface", "circle", "with", "a", "specified", "center", "and", "radius", "and", "an", "optional", "attributes", "bundle", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shapes/SurfaceCircle.js#L57-L74
10,612
NASAWorldWind/WebWorldWind
apps/util/ServersPanel.js
function (worldWindow, layersPanel, timeSeriesPlayer) { var thisServersPanel = this; this.wwd = worldWindow; this.layersPanel = layersPanel; this.timeSeriesPlayer = timeSeriesPlayer; this.idCounter = 1; this.legends = {}; $("#addServerBox").find("button").on("click", function (e) { thisServersPanel.onAddServerButton(e); }); $("#addServerText").on("keypress", function (e) { thisServersPanel.onAddServerTextKeyPress($(this), e); }); }
javascript
function (worldWindow, layersPanel, timeSeriesPlayer) { var thisServersPanel = this; this.wwd = worldWindow; this.layersPanel = layersPanel; this.timeSeriesPlayer = timeSeriesPlayer; this.idCounter = 1; this.legends = {}; $("#addServerBox").find("button").on("click", function (e) { thisServersPanel.onAddServerButton(e); }); $("#addServerText").on("keypress", function (e) { thisServersPanel.onAddServerTextKeyPress($(this), e); }); }
[ "function", "(", "worldWindow", ",", "layersPanel", ",", "timeSeriesPlayer", ")", "{", "var", "thisServersPanel", "=", "this", ";", "this", ".", "wwd", "=", "worldWindow", ";", "this", ".", "layersPanel", "=", "layersPanel", ";", "this", ".", "timeSeriesPlayer", "=", "timeSeriesPlayer", ";", "this", ".", "idCounter", "=", "1", ";", "this", ".", "legends", "=", "{", "}", ";", "$", "(", "\"#addServerBox\"", ")", ".", "find", "(", "\"button\"", ")", ".", "on", "(", "\"click\"", ",", "function", "(", "e", ")", "{", "thisServersPanel", ".", "onAddServerButton", "(", "e", ")", ";", "}", ")", ";", "$", "(", "\"#addServerText\"", ")", ".", "on", "(", "\"keypress\"", ",", "function", "(", "e", ")", "{", "thisServersPanel", ".", "onAddServerTextKeyPress", "(", "$", "(", "this", ")", ",", "e", ")", ";", "}", ")", ";", "}" ]
Constructs a servers panel. @alias ServersPanel @constructor @classdesc Provides a list of collapsible panels that indicate the layers associated with a WMS or other image server. Currently only WMS is supported. The user can select a server's layers and they will be added to the WorldWindow's layer list. @param {WorldWindow} worldWindow The WorldWindow to associate this layers panel with. @param {LayersPanel} layersPanel The layers panel managing the specified WorldWindows layer list.
[ "Constructs", "a", "servers", "panel", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/apps/util/ServersPanel.js#L33-L51
10,613
NASAWorldWind/WebWorldWind
src/layer/CoordinatesDisplayLayer.js
function (worldWindow) { if (!worldWindow) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "CoordinatesDisplayLayer", "constructor", "missingWorldWindow")); } Layer.call(this, "Coordinates"); /** * The WorldWindow associated with this layer. * @type {WorldWindow} * @readonly */ this.wwd = worldWindow; // No picking of this layer's screen elements. this.pickEnabled = false; // Intentionally not documented. this.eventType = null; // Intentionally not documented. this.clientX = null; // Intentionally not documented. this.clientY = null; // Intentionally not documented. this.terrainPosition = null; // Intentionally not documented. this.latText = new ScreenText(new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0), " "); this.latText.attributes = new TextAttributes(null); this.latText.attributes.color = Color.YELLOW; // Intentionally not documented. this.lonText = new ScreenText(new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0), " "); this.lonText.attributes = new TextAttributes(null); this.lonText.attributes.color = Color.YELLOW; // Intentionally not documented. this.elevText = new ScreenText(new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0), " "); this.elevText.attributes = new TextAttributes(null); this.elevText.attributes.color = Color.YELLOW; // Intentionally not documented. this.eyeText = new ScreenText(new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0), " "); this.eyeText.attributes = new TextAttributes(null); this.eyeText.attributes.color = Color.YELLOW; // Intentionally not documented. var imageOffset = new Offset(WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 0.5), imagePath = WorldWind.configuration.baseUrl + "images/crosshair.png"; this.crosshairImage = new ScreenImage(imageOffset, imagePath); // Register user input event listeners on the WorldWindow. var thisLayer = this; function eventListener(event) { thisLayer.handleUIEvent(event); } if (window.PointerEvent) { worldWindow.addEventListener("pointerdown", eventListener); worldWindow.addEventListener("pointermove", eventListener); worldWindow.addEventListener("pointerleave", eventListener); } else { worldWindow.addEventListener("mousedown", eventListener); worldWindow.addEventListener("mousemove", eventListener); worldWindow.addEventListener("mouseleave", eventListener); worldWindow.addEventListener("touchstart", eventListener); worldWindow.addEventListener("touchmove", eventListener); } // Register a redraw callback on the WorldWindow. function redrawCallback(worldWindow, stage) { thisLayer.handleRedraw(stage); } this.wwd.redrawCallbacks.push(redrawCallback); }
javascript
function (worldWindow) { if (!worldWindow) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "CoordinatesDisplayLayer", "constructor", "missingWorldWindow")); } Layer.call(this, "Coordinates"); /** * The WorldWindow associated with this layer. * @type {WorldWindow} * @readonly */ this.wwd = worldWindow; // No picking of this layer's screen elements. this.pickEnabled = false; // Intentionally not documented. this.eventType = null; // Intentionally not documented. this.clientX = null; // Intentionally not documented. this.clientY = null; // Intentionally not documented. this.terrainPosition = null; // Intentionally not documented. this.latText = new ScreenText(new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0), " "); this.latText.attributes = new TextAttributes(null); this.latText.attributes.color = Color.YELLOW; // Intentionally not documented. this.lonText = new ScreenText(new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0), " "); this.lonText.attributes = new TextAttributes(null); this.lonText.attributes.color = Color.YELLOW; // Intentionally not documented. this.elevText = new ScreenText(new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0), " "); this.elevText.attributes = new TextAttributes(null); this.elevText.attributes.color = Color.YELLOW; // Intentionally not documented. this.eyeText = new ScreenText(new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0), " "); this.eyeText.attributes = new TextAttributes(null); this.eyeText.attributes.color = Color.YELLOW; // Intentionally not documented. var imageOffset = new Offset(WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 0.5), imagePath = WorldWind.configuration.baseUrl + "images/crosshair.png"; this.crosshairImage = new ScreenImage(imageOffset, imagePath); // Register user input event listeners on the WorldWindow. var thisLayer = this; function eventListener(event) { thisLayer.handleUIEvent(event); } if (window.PointerEvent) { worldWindow.addEventListener("pointerdown", eventListener); worldWindow.addEventListener("pointermove", eventListener); worldWindow.addEventListener("pointerleave", eventListener); } else { worldWindow.addEventListener("mousedown", eventListener); worldWindow.addEventListener("mousemove", eventListener); worldWindow.addEventListener("mouseleave", eventListener); worldWindow.addEventListener("touchstart", eventListener); worldWindow.addEventListener("touchmove", eventListener); } // Register a redraw callback on the WorldWindow. function redrawCallback(worldWindow, stage) { thisLayer.handleRedraw(stage); } this.wwd.redrawCallbacks.push(redrawCallback); }
[ "function", "(", "worldWindow", ")", "{", "if", "(", "!", "worldWindow", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"CoordinatesDisplayLayer\"", ",", "\"constructor\"", ",", "\"missingWorldWindow\"", ")", ")", ";", "}", "Layer", ".", "call", "(", "this", ",", "\"Coordinates\"", ")", ";", "/**\n * The WorldWindow associated with this layer.\n * @type {WorldWindow}\n * @readonly\n */", "this", ".", "wwd", "=", "worldWindow", ";", "// No picking of this layer's screen elements.", "this", ".", "pickEnabled", "=", "false", ";", "// Intentionally not documented.", "this", ".", "eventType", "=", "null", ";", "// Intentionally not documented.", "this", ".", "clientX", "=", "null", ";", "// Intentionally not documented.", "this", ".", "clientY", "=", "null", ";", "// Intentionally not documented.", "this", ".", "terrainPosition", "=", "null", ";", "// Intentionally not documented.", "this", ".", "latText", "=", "new", "ScreenText", "(", "new", "Offset", "(", "WorldWind", ".", "OFFSET_PIXELS", ",", "0", ",", "WorldWind", ".", "OFFSET_PIXELS", ",", "0", ")", ",", "\" \"", ")", ";", "this", ".", "latText", ".", "attributes", "=", "new", "TextAttributes", "(", "null", ")", ";", "this", ".", "latText", ".", "attributes", ".", "color", "=", "Color", ".", "YELLOW", ";", "// Intentionally not documented.", "this", ".", "lonText", "=", "new", "ScreenText", "(", "new", "Offset", "(", "WorldWind", ".", "OFFSET_PIXELS", ",", "0", ",", "WorldWind", ".", "OFFSET_PIXELS", ",", "0", ")", ",", "\" \"", ")", ";", "this", ".", "lonText", ".", "attributes", "=", "new", "TextAttributes", "(", "null", ")", ";", "this", ".", "lonText", ".", "attributes", ".", "color", "=", "Color", ".", "YELLOW", ";", "// Intentionally not documented.", "this", ".", "elevText", "=", "new", "ScreenText", "(", "new", "Offset", "(", "WorldWind", ".", "OFFSET_PIXELS", ",", "0", ",", "WorldWind", ".", "OFFSET_PIXELS", ",", "0", ")", ",", "\" \"", ")", ";", "this", ".", "elevText", ".", "attributes", "=", "new", "TextAttributes", "(", "null", ")", ";", "this", ".", "elevText", ".", "attributes", ".", "color", "=", "Color", ".", "YELLOW", ";", "// Intentionally not documented.", "this", ".", "eyeText", "=", "new", "ScreenText", "(", "new", "Offset", "(", "WorldWind", ".", "OFFSET_PIXELS", ",", "0", ",", "WorldWind", ".", "OFFSET_PIXELS", ",", "0", ")", ",", "\" \"", ")", ";", "this", ".", "eyeText", ".", "attributes", "=", "new", "TextAttributes", "(", "null", ")", ";", "this", ".", "eyeText", ".", "attributes", ".", "color", "=", "Color", ".", "YELLOW", ";", "// Intentionally not documented.", "var", "imageOffset", "=", "new", "Offset", "(", "WorldWind", ".", "OFFSET_FRACTION", ",", "0.5", ",", "WorldWind", ".", "OFFSET_FRACTION", ",", "0.5", ")", ",", "imagePath", "=", "WorldWind", ".", "configuration", ".", "baseUrl", "+", "\"images/crosshair.png\"", ";", "this", ".", "crosshairImage", "=", "new", "ScreenImage", "(", "imageOffset", ",", "imagePath", ")", ";", "// Register user input event listeners on the WorldWindow.", "var", "thisLayer", "=", "this", ";", "function", "eventListener", "(", "event", ")", "{", "thisLayer", ".", "handleUIEvent", "(", "event", ")", ";", "}", "if", "(", "window", ".", "PointerEvent", ")", "{", "worldWindow", ".", "addEventListener", "(", "\"pointerdown\"", ",", "eventListener", ")", ";", "worldWindow", ".", "addEventListener", "(", "\"pointermove\"", ",", "eventListener", ")", ";", "worldWindow", ".", "addEventListener", "(", "\"pointerleave\"", ",", "eventListener", ")", ";", "}", "else", "{", "worldWindow", ".", "addEventListener", "(", "\"mousedown\"", ",", "eventListener", ")", ";", "worldWindow", ".", "addEventListener", "(", "\"mousemove\"", ",", "eventListener", ")", ";", "worldWindow", ".", "addEventListener", "(", "\"mouseleave\"", ",", "eventListener", ")", ";", "worldWindow", ".", "addEventListener", "(", "\"touchstart\"", ",", "eventListener", ")", ";", "worldWindow", ".", "addEventListener", "(", "\"touchmove\"", ",", "eventListener", ")", ";", "}", "// Register a redraw callback on the WorldWindow.", "function", "redrawCallback", "(", "worldWindow", ",", "stage", ")", "{", "thisLayer", ".", "handleRedraw", "(", "stage", ")", ";", "}", "this", ".", "wwd", ".", "redrawCallbacks", ".", "push", "(", "redrawCallback", ")", ";", "}" ]
Constructs a layer that displays the current map coordinates. @alias CoordinatesDisplayLayer @constructor @augments Layer @classDesc Displays the current map coordinates. A coordinates display layer cannot be shared among World Windows. Each WorldWindow if it is to have a coordinates display layer must have its own. See the MultiWindow example for guidance. @param {WorldWindow} worldWindow The WorldWindow associated with this layer. This layer may not be associated with more than one WorldWindow. Each WorldWindow must have it's own instance of this layer if each window is to have a coordinates display. @throws {ArgumentError} If the specified WorldWindow is null or undefined.
[ "Constructs", "a", "layer", "that", "displays", "the", "current", "map", "coordinates", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/layer/CoordinatesDisplayLayer.js#L59-L139
10,614
NASAWorldWind/WebWorldWind
src/geom/Plane.js
function (x, y, z, distance) { /** * The normal vector to the plane. * @type {Vec3} */ this.normal = new Vec3(x, y, z); /** * The plane's distance from the origin. * @type {Number} */ this.distance = distance; }
javascript
function (x, y, z, distance) { /** * The normal vector to the plane. * @type {Vec3} */ this.normal = new Vec3(x, y, z); /** * The plane's distance from the origin. * @type {Number} */ this.distance = distance; }
[ "function", "(", "x", ",", "y", ",", "z", ",", "distance", ")", "{", "/**\n * The normal vector to the plane.\n * @type {Vec3}\n */", "this", ".", "normal", "=", "new", "Vec3", "(", "x", ",", "y", ",", "z", ")", ";", "/**\n * The plane's distance from the origin.\n * @type {Number}\n */", "this", ".", "distance", "=", "distance", ";", "}" ]
Constructs a plane. This constructor does not normalize the components. It assumes that a unit normal vector is provided. @alias Plane @constructor @classdesc Represents a plane in Cartesian coordinates. The plane's X, Y and Z components indicate the plane's normal vector. The distance component indicates the plane's distance from the origin relative to its unit normal. The components are expected to be normalized. @param {Number} x The X coordinate of the plane's unit normal vector. @param {Number} y The Y coordinate of the plane's unit normal vector. @param {Number} z The Z coordinate of the plane's unit normal vector. @param {Number} distance The plane's distance from the origin.
[ "Constructs", "a", "plane", ".", "This", "constructor", "does", "not", "normalize", "the", "components", ".", "It", "assumes", "that", "a", "unit", "normal", "vector", "is", "provided", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/geom/Plane.js#L46-L58
10,615
NASAWorldWind/WebWorldWind
src/globe/EarthElevationModel.js
function () { ElevationModel.call(this); this.addCoverage(new GebcoElevationCoverage()); this.addCoverage(new AsterV2ElevationCoverage()); this.addCoverage(new UsgsNedElevationCoverage()); this.addCoverage(new UsgsNedHiElevationCoverage()); }
javascript
function () { ElevationModel.call(this); this.addCoverage(new GebcoElevationCoverage()); this.addCoverage(new AsterV2ElevationCoverage()); this.addCoverage(new UsgsNedElevationCoverage()); this.addCoverage(new UsgsNedHiElevationCoverage()); }
[ "function", "(", ")", "{", "ElevationModel", ".", "call", "(", "this", ")", ";", "this", ".", "addCoverage", "(", "new", "GebcoElevationCoverage", "(", ")", ")", ";", "this", ".", "addCoverage", "(", "new", "AsterV2ElevationCoverage", "(", ")", ")", ";", "this", ".", "addCoverage", "(", "new", "UsgsNedElevationCoverage", "(", ")", ")", ";", "this", ".", "addCoverage", "(", "new", "UsgsNedHiElevationCoverage", "(", ")", ")", ";", "}" ]
Constructs an EarthElevationModel consisting of three elevation coverages GEBCO, Aster V2, and USGS NED. @alias EarthElevationModel @constructor
[ "Constructs", "an", "EarthElevationModel", "consisting", "of", "three", "elevation", "coverages", "GEBCO", "Aster", "V2", "and", "USGS", "NED", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/globe/EarthElevationModel.js#L39-L46
10,616
NASAWorldWind/WebWorldWind
src/ogc/wcs/WcsCoverageDescriptions.js
function (xmlDom) { if (!xmlDom) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WcsCoverageDescriptions", "constructor", "missingDom")); } /** * The original unmodified XML document. Referenced for use in advanced cases. * @type {{}} */ this.xmlDom = xmlDom; this.assembleDocument(); }
javascript
function (xmlDom) { if (!xmlDom) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WcsCoverageDescriptions", "constructor", "missingDom")); } /** * The original unmodified XML document. Referenced for use in advanced cases. * @type {{}} */ this.xmlDom = xmlDom; this.assembleDocument(); }
[ "function", "(", "xmlDom", ")", "{", "if", "(", "!", "xmlDom", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"WcsCoverageDescriptions\"", ",", "\"constructor\"", ",", "\"missingDom\"", ")", ")", ";", "}", "/**\n * The original unmodified XML document. Referenced for use in advanced cases.\n * @type {{}}\n */", "this", ".", "xmlDom", "=", "xmlDom", ";", "this", ".", "assembleDocument", "(", ")", ";", "}" ]
Constructs a simple javascript object representation of an OGC WCS Describe Coverage XML response. @alias WcsCoverageDescriptions @constructor @classdesc Represents the common properties of a WCS CoverageDescription document. Common properties are parsed and mapped to a plain javascript object model. Most fields can be accessed as properties named according to their document names converted to camel case. This model supports version 1.0.0 and 2.0.x of the WCS specification. Not all properties are mapped to this representative javascript object model, but the provided XML DOM is maintained in xmlDom property for reference. @param {{}} xmlDom an XML DOM representing the WCS DescribeCoverage document. @throws {ArgumentError} If the specified XML DOM is null or undefined.
[ "Constructs", "a", "simple", "javascript", "object", "representation", "of", "an", "OGC", "WCS", "Describe", "Coverage", "XML", "response", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/ogc/wcs/WcsCoverageDescriptions.js#L50-L63
10,617
NASAWorldWind/WebWorldWind
src/shapes/ScreenImage.js
function (screenOffset, imageSource) { if (!screenOffset) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "ScreenImage", "constructor", "missingOffset")); } if (!imageSource) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "ScreenImage", "constructor", "missingImage")); } Renderable.call(this); /** * The offset indicating this screen image's placement on the screen. * @type {Offset} */ this.screenOffset = screenOffset; // Documented with its property accessor below. this._imageSource = imageSource; /** * The image color. When displayed, this shape's image is multiplied by this image color to achieve the * final image color. The color white, the default, causes the image to be drawn in its native colors. * @type {Color} * @default White (1, 1, 1, 1) */ this.imageColor = Color.WHITE; /** * Indicates the location within the image at which to align with the specified screen location. * May be null, in which case the image's bottom-left corner is placed at the screen location. * @type {Offset} * @default 0.5, 0.5, both fractional (Centers the image on the screen location.) */ this.imageOffset = new Offset(WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 0.5); /** * Indicates the amount to scale the image. * @type {Number} * @default 1 */ this.imageScale = 1; /** * The amount of rotation to apply to the image, measured in degrees clockwise from the top of the window. * @type {Number} * @default 0 */ this.imageRotation = 0; /** * The amount of tilt to apply to the image, measured in degrees. * @type {Number} * @default 0 */ this.imageTilt = 0; /** * Indicates whether to draw this screen image. * @type {Boolean} * @default true */ this.enabled = true; /** * This image's opacity. When this screen image is drawn, the actual opacity is the product of * this opacity and the opacity of the layer containing this screen image. * @type {Number} */ this.opacity = 1; /** * Indicates the object to return as the userObject of this shape when picked. If null, * then this shape is returned as the userObject. * @type {Object} * @default null * @see [PickedObject.userObject]{@link PickedObject#userObject} */ this.pickDelegate = null; // Internal use only. Intentionally not documented. this.activeTexture = null; // Internal use only. Intentionally not documented. this.imageTransform = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.texCoordMatrix = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.imageBounds = null; // Internal use only. Intentionally not documented. this.layer = null; }
javascript
function (screenOffset, imageSource) { if (!screenOffset) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "ScreenImage", "constructor", "missingOffset")); } if (!imageSource) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "ScreenImage", "constructor", "missingImage")); } Renderable.call(this); /** * The offset indicating this screen image's placement on the screen. * @type {Offset} */ this.screenOffset = screenOffset; // Documented with its property accessor below. this._imageSource = imageSource; /** * The image color. When displayed, this shape's image is multiplied by this image color to achieve the * final image color. The color white, the default, causes the image to be drawn in its native colors. * @type {Color} * @default White (1, 1, 1, 1) */ this.imageColor = Color.WHITE; /** * Indicates the location within the image at which to align with the specified screen location. * May be null, in which case the image's bottom-left corner is placed at the screen location. * @type {Offset} * @default 0.5, 0.5, both fractional (Centers the image on the screen location.) */ this.imageOffset = new Offset(WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 0.5); /** * Indicates the amount to scale the image. * @type {Number} * @default 1 */ this.imageScale = 1; /** * The amount of rotation to apply to the image, measured in degrees clockwise from the top of the window. * @type {Number} * @default 0 */ this.imageRotation = 0; /** * The amount of tilt to apply to the image, measured in degrees. * @type {Number} * @default 0 */ this.imageTilt = 0; /** * Indicates whether to draw this screen image. * @type {Boolean} * @default true */ this.enabled = true; /** * This image's opacity. When this screen image is drawn, the actual opacity is the product of * this opacity and the opacity of the layer containing this screen image. * @type {Number} */ this.opacity = 1; /** * Indicates the object to return as the userObject of this shape when picked. If null, * then this shape is returned as the userObject. * @type {Object} * @default null * @see [PickedObject.userObject]{@link PickedObject#userObject} */ this.pickDelegate = null; // Internal use only. Intentionally not documented. this.activeTexture = null; // Internal use only. Intentionally not documented. this.imageTransform = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.texCoordMatrix = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.imageBounds = null; // Internal use only. Intentionally not documented. this.layer = null; }
[ "function", "(", "screenOffset", ",", "imageSource", ")", "{", "if", "(", "!", "screenOffset", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"ScreenImage\"", ",", "\"constructor\"", ",", "\"missingOffset\"", ")", ")", ";", "}", "if", "(", "!", "imageSource", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"ScreenImage\"", ",", "\"constructor\"", ",", "\"missingImage\"", ")", ")", ";", "}", "Renderable", ".", "call", "(", "this", ")", ";", "/**\n * The offset indicating this screen image's placement on the screen.\n * @type {Offset}\n */", "this", ".", "screenOffset", "=", "screenOffset", ";", "// Documented with its property accessor below.", "this", ".", "_imageSource", "=", "imageSource", ";", "/**\n * The image color. When displayed, this shape's image is multiplied by this image color to achieve the\n * final image color. The color white, the default, causes the image to be drawn in its native colors.\n * @type {Color}\n * @default White (1, 1, 1, 1)\n */", "this", ".", "imageColor", "=", "Color", ".", "WHITE", ";", "/**\n * Indicates the location within the image at which to align with the specified screen location.\n * May be null, in which case the image's bottom-left corner is placed at the screen location.\n * @type {Offset}\n * @default 0.5, 0.5, both fractional (Centers the image on the screen location.)\n */", "this", ".", "imageOffset", "=", "new", "Offset", "(", "WorldWind", ".", "OFFSET_FRACTION", ",", "0.5", ",", "WorldWind", ".", "OFFSET_FRACTION", ",", "0.5", ")", ";", "/**\n * Indicates the amount to scale the image.\n * @type {Number}\n * @default 1\n */", "this", ".", "imageScale", "=", "1", ";", "/**\n * The amount of rotation to apply to the image, measured in degrees clockwise from the top of the window.\n * @type {Number}\n * @default 0\n */", "this", ".", "imageRotation", "=", "0", ";", "/**\n * The amount of tilt to apply to the image, measured in degrees.\n * @type {Number}\n * @default 0\n */", "this", ".", "imageTilt", "=", "0", ";", "/**\n * Indicates whether to draw this screen image.\n * @type {Boolean}\n * @default true\n */", "this", ".", "enabled", "=", "true", ";", "/**\n * This image's opacity. When this screen image is drawn, the actual opacity is the product of\n * this opacity and the opacity of the layer containing this screen image.\n * @type {Number}\n */", "this", ".", "opacity", "=", "1", ";", "/**\n * Indicates the object to return as the userObject of this shape when picked. If null,\n * then this shape is returned as the userObject.\n * @type {Object}\n * @default null\n * @see [PickedObject.userObject]{@link PickedObject#userObject}\n */", "this", ".", "pickDelegate", "=", "null", ";", "// Internal use only. Intentionally not documented.", "this", ".", "activeTexture", "=", "null", ";", "// Internal use only. Intentionally not documented.", "this", ".", "imageTransform", "=", "Matrix", ".", "fromIdentity", "(", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "texCoordMatrix", "=", "Matrix", ".", "fromIdentity", "(", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "imageBounds", "=", "null", ";", "// Internal use only. Intentionally not documented.", "this", ".", "layer", "=", "null", ";", "}" ]
Constructs a screen image. @alias ScreenImage @constructor @augments Renderable @classdesc Displays an image at a specified screen location in the WorldWindow. The image location is specified by an offset, which causes the image to maintain its relative position when the window size changes. @param {Offset} screenOffset The offset indicating the image's placement on the screen. Use [the image offset property]{@link ScreenImage#imageOffset} to position the image relative to the specified screen offset. @param {String|ImageSource} imageSource The source of the image to display. May be either a string identifying the URL of the image, or an {@link ImageSource} object identifying a dynamically created image. @throws {ArgumentError} If the specified screen offset or image source is null or undefined.
[ "Constructs", "a", "screen", "image", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shapes/ScreenImage.js#L62-L158
10,618
NASAWorldWind/WebWorldWind
src/shapes/SurfaceShape.js
function () { // If we don't have a state key for the shape attributes, consider this state key to be invalid. if (!this._attributesStateKey) { // Update the state key for the appropriate attributes for future if (this._highlighted) { if (!!this._highlightAttributes) { this._attributesStateKey = this._highlightAttributes.stateKey; } } else { if (!!this._attributes) { this._attributesStateKey = this._attributes.stateKey; } } // If we now actually have a state key for the attributes, it was previously invalid. if (!!this._attributesStateKey) { this.stateKeyInvalid = true; } } else { // Detect a change in the appropriate attributes. var currentAttributesStateKey = null; if (this._highlighted) { // If there are highlight attributes associated with this shape, ... if (!!this._highlightAttributes) { currentAttributesStateKey = this._highlightAttributes.stateKey; } } else { if (!!this._attributes) { currentAttributesStateKey = this._attributes.stateKey; } } // If the attributes state key changed, ... if (currentAttributesStateKey != this._attributesStateKey) { this._attributesStateKey = currentAttributesStateKey; this.stateKeyInvalid = true; } } if (this.stateKeyInvalid) { this._stateKey = this.computeStateKey(); } return this._stateKey; }
javascript
function () { // If we don't have a state key for the shape attributes, consider this state key to be invalid. if (!this._attributesStateKey) { // Update the state key for the appropriate attributes for future if (this._highlighted) { if (!!this._highlightAttributes) { this._attributesStateKey = this._highlightAttributes.stateKey; } } else { if (!!this._attributes) { this._attributesStateKey = this._attributes.stateKey; } } // If we now actually have a state key for the attributes, it was previously invalid. if (!!this._attributesStateKey) { this.stateKeyInvalid = true; } } else { // Detect a change in the appropriate attributes. var currentAttributesStateKey = null; if (this._highlighted) { // If there are highlight attributes associated with this shape, ... if (!!this._highlightAttributes) { currentAttributesStateKey = this._highlightAttributes.stateKey; } } else { if (!!this._attributes) { currentAttributesStateKey = this._attributes.stateKey; } } // If the attributes state key changed, ... if (currentAttributesStateKey != this._attributesStateKey) { this._attributesStateKey = currentAttributesStateKey; this.stateKeyInvalid = true; } } if (this.stateKeyInvalid) { this._stateKey = this.computeStateKey(); } return this._stateKey; }
[ "function", "(", ")", "{", "// If we don't have a state key for the shape attributes, consider this state key to be invalid.", "if", "(", "!", "this", ".", "_attributesStateKey", ")", "{", "// Update the state key for the appropriate attributes for future", "if", "(", "this", ".", "_highlighted", ")", "{", "if", "(", "!", "!", "this", ".", "_highlightAttributes", ")", "{", "this", ".", "_attributesStateKey", "=", "this", ".", "_highlightAttributes", ".", "stateKey", ";", "}", "}", "else", "{", "if", "(", "!", "!", "this", ".", "_attributes", ")", "{", "this", ".", "_attributesStateKey", "=", "this", ".", "_attributes", ".", "stateKey", ";", "}", "}", "// If we now actually have a state key for the attributes, it was previously invalid.", "if", "(", "!", "!", "this", ".", "_attributesStateKey", ")", "{", "this", ".", "stateKeyInvalid", "=", "true", ";", "}", "}", "else", "{", "// Detect a change in the appropriate attributes.", "var", "currentAttributesStateKey", "=", "null", ";", "if", "(", "this", ".", "_highlighted", ")", "{", "// If there are highlight attributes associated with this shape, ...", "if", "(", "!", "!", "this", ".", "_highlightAttributes", ")", "{", "currentAttributesStateKey", "=", "this", ".", "_highlightAttributes", ".", "stateKey", ";", "}", "}", "else", "{", "if", "(", "!", "!", "this", ".", "_attributes", ")", "{", "currentAttributesStateKey", "=", "this", ".", "_attributes", ".", "stateKey", ";", "}", "}", "// If the attributes state key changed, ...", "if", "(", "currentAttributesStateKey", "!=", "this", ".", "_attributesStateKey", ")", "{", "this", ".", "_attributesStateKey", "=", "currentAttributesStateKey", ";", "this", ".", "stateKeyInvalid", "=", "true", ";", "}", "}", "if", "(", "this", ".", "stateKeyInvalid", ")", "{", "this", ".", "_stateKey", "=", "this", ".", "computeStateKey", "(", ")", ";", "}", "return", "this", ".", "_stateKey", ";", "}" ]
A hash key of the total visible external state of the surface shape. @memberof SurfaceShape.prototype @type {String}
[ "A", "hash", "key", "of", "the", "total", "visible", "external", "state", "of", "the", "surface", "shape", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shapes/SurfaceShape.js#L190-L235
10,619
NASAWorldWind/WebWorldWind
src/util/WcsTileUrlBuilder.js
function (serviceAddress, coverageName, wcsVersion) { if (!serviceAddress || (serviceAddress.length === 0)) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WcsTileUrlBuilder", "constructor", "The WCS service address is missing.")); } if (!coverageName || (coverageName.length === 0)) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WcsTileUrlBuilder", "constructor", "The WCS coverage name is missing.")); } /** * The address of the WCS server. * @type {String} */ this.serviceAddress = serviceAddress; /** * The name of the coverage to retrieve. * @type {String} */ this.coverageName = coverageName; /** * The WCS version to specify when requesting resources. * @type {String} * @default 1.0.0 */ this.wcsVersion = (wcsVersion && wcsVersion.length > 0) ? wcsVersion : "1.0.0"; /** * The coordinate reference system to use when requesting coverages. * @type {String} * @default EPSG:4326 */ this.crs = "EPSG:4326"; }
javascript
function (serviceAddress, coverageName, wcsVersion) { if (!serviceAddress || (serviceAddress.length === 0)) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WcsTileUrlBuilder", "constructor", "The WCS service address is missing.")); } if (!coverageName || (coverageName.length === 0)) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WcsTileUrlBuilder", "constructor", "The WCS coverage name is missing.")); } /** * The address of the WCS server. * @type {String} */ this.serviceAddress = serviceAddress; /** * The name of the coverage to retrieve. * @type {String} */ this.coverageName = coverageName; /** * The WCS version to specify when requesting resources. * @type {String} * @default 1.0.0 */ this.wcsVersion = (wcsVersion && wcsVersion.length > 0) ? wcsVersion : "1.0.0"; /** * The coordinate reference system to use when requesting coverages. * @type {String} * @default EPSG:4326 */ this.crs = "EPSG:4326"; }
[ "function", "(", "serviceAddress", ",", "coverageName", ",", "wcsVersion", ")", "{", "if", "(", "!", "serviceAddress", "||", "(", "serviceAddress", ".", "length", "===", "0", ")", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"WcsTileUrlBuilder\"", ",", "\"constructor\"", ",", "\"The WCS service address is missing.\"", ")", ")", ";", "}", "if", "(", "!", "coverageName", "||", "(", "coverageName", ".", "length", "===", "0", ")", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"WcsTileUrlBuilder\"", ",", "\"constructor\"", ",", "\"The WCS coverage name is missing.\"", ")", ")", ";", "}", "/**\n * The address of the WCS server.\n * @type {String}\n */", "this", ".", "serviceAddress", "=", "serviceAddress", ";", "/**\n * The name of the coverage to retrieve.\n * @type {String}\n */", "this", ".", "coverageName", "=", "coverageName", ";", "/**\n * The WCS version to specify when requesting resources.\n * @type {String}\n * @default 1.0.0\n */", "this", ".", "wcsVersion", "=", "(", "wcsVersion", "&&", "wcsVersion", ".", "length", ">", "0", ")", "?", "wcsVersion", ":", "\"1.0.0\"", ";", "/**\n * The coordinate reference system to use when requesting coverages.\n * @type {String}\n * @default EPSG:4326\n */", "this", ".", "crs", "=", "\"EPSG:4326\"", ";", "}" ]
Constructs a WCS tile URL builder. @alias WcsTileUrlBuilder @constructor @classdesc Provides a factory to create URLs for WCS Get Coverage requests. @param {String} serviceAddress The address of the WCS server. @param {String} coverageName The name of the coverage to retrieve. @param {String} wcsVersion The version of the WCS server. May be null, in which case version 1.0.0 is assumed. @constructor @deprecated
[ "Constructs", "a", "WCS", "tile", "URL", "builder", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/WcsTileUrlBuilder.js#L40-L78
10,620
NASAWorldWind/WebWorldWind
src/shapes/Annotation.js
function (position, attributes) { if (!position) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "Annotation", "constructor", "missingPosition")); } Renderable.call(this); /** * This annotation's geographic position. * @type {Position} */ this.position = position; /** * The annotation's attributes. * @type {AnnotationAttributes} * @default see [AnnotationAttributes]{@link AnnotationAttributes} */ this.attributes = attributes ? attributes : new AnnotationAttributes(null); /** * This annotation's altitude mode. May be one of * <ul> * <li>[WorldWind.ABSOLUTE]{@link WorldWind#ABSOLUTE}</li> * <li>[WorldWind.RELATIVE_TO_GROUND]{@link WorldWind#RELATIVE_TO_GROUND}</li> * <li>[WorldWind.CLAMP_TO_GROUND]{@link WorldWind#CLAMP_TO_GROUND}</li> * </ul> * @default WorldWind.ABSOLUTE */ this.altitudeMode = WorldWind.ABSOLUTE; // Internal use only. Intentionally not documented. this.layer = null; // Internal use only. Intentionally not documented. this.lastStateKey = null; // Internal use only. Intentionally not documented. this.calloutTransform = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.calloutOffset = new WorldWind.Offset( WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 0); // Internal use only. Intentionally not documented. this.label = ""; // Internal use only. Intentionally not documented. this.labelTexture = null; // Internal use only. Intentionally not documented. this.labelTransform = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.placePoint = new Vec3(0, 0, 0); // Internal use only. Intentionally not documented. this.depthOffset = -2.05; // Internal use only. Intentionally not documented. this.calloutPoints = null; }
javascript
function (position, attributes) { if (!position) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "Annotation", "constructor", "missingPosition")); } Renderable.call(this); /** * This annotation's geographic position. * @type {Position} */ this.position = position; /** * The annotation's attributes. * @type {AnnotationAttributes} * @default see [AnnotationAttributes]{@link AnnotationAttributes} */ this.attributes = attributes ? attributes : new AnnotationAttributes(null); /** * This annotation's altitude mode. May be one of * <ul> * <li>[WorldWind.ABSOLUTE]{@link WorldWind#ABSOLUTE}</li> * <li>[WorldWind.RELATIVE_TO_GROUND]{@link WorldWind#RELATIVE_TO_GROUND}</li> * <li>[WorldWind.CLAMP_TO_GROUND]{@link WorldWind#CLAMP_TO_GROUND}</li> * </ul> * @default WorldWind.ABSOLUTE */ this.altitudeMode = WorldWind.ABSOLUTE; // Internal use only. Intentionally not documented. this.layer = null; // Internal use only. Intentionally not documented. this.lastStateKey = null; // Internal use only. Intentionally not documented. this.calloutTransform = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.calloutOffset = new WorldWind.Offset( WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 0); // Internal use only. Intentionally not documented. this.label = ""; // Internal use only. Intentionally not documented. this.labelTexture = null; // Internal use only. Intentionally not documented. this.labelTransform = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.placePoint = new Vec3(0, 0, 0); // Internal use only. Intentionally not documented. this.depthOffset = -2.05; // Internal use only. Intentionally not documented. this.calloutPoints = null; }
[ "function", "(", "position", ",", "attributes", ")", "{", "if", "(", "!", "position", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"Annotation\"", ",", "\"constructor\"", ",", "\"missingPosition\"", ")", ")", ";", "}", "Renderable", ".", "call", "(", "this", ")", ";", "/**\n * This annotation's geographic position.\n * @type {Position}\n */", "this", ".", "position", "=", "position", ";", "/**\n * The annotation's attributes.\n * @type {AnnotationAttributes}\n * @default see [AnnotationAttributes]{@link AnnotationAttributes}\n */", "this", ".", "attributes", "=", "attributes", "?", "attributes", ":", "new", "AnnotationAttributes", "(", "null", ")", ";", "/**\n * This annotation's altitude mode. May be one of\n * <ul>\n * <li>[WorldWind.ABSOLUTE]{@link WorldWind#ABSOLUTE}</li>\n * <li>[WorldWind.RELATIVE_TO_GROUND]{@link WorldWind#RELATIVE_TO_GROUND}</li>\n * <li>[WorldWind.CLAMP_TO_GROUND]{@link WorldWind#CLAMP_TO_GROUND}</li>\n * </ul>\n * @default WorldWind.ABSOLUTE\n */", "this", ".", "altitudeMode", "=", "WorldWind", ".", "ABSOLUTE", ";", "// Internal use only. Intentionally not documented.", "this", ".", "layer", "=", "null", ";", "// Internal use only. Intentionally not documented.", "this", ".", "lastStateKey", "=", "null", ";", "// Internal use only. Intentionally not documented.", "this", ".", "calloutTransform", "=", "Matrix", ".", "fromIdentity", "(", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "calloutOffset", "=", "new", "WorldWind", ".", "Offset", "(", "WorldWind", ".", "OFFSET_FRACTION", ",", "0.5", ",", "WorldWind", ".", "OFFSET_FRACTION", ",", "0", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "label", "=", "\"\"", ";", "// Internal use only. Intentionally not documented.", "this", ".", "labelTexture", "=", "null", ";", "// Internal use only. Intentionally not documented.", "this", ".", "labelTransform", "=", "Matrix", ".", "fromIdentity", "(", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "placePoint", "=", "new", "Vec3", "(", "0", ",", "0", ",", "0", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "depthOffset", "=", "-", "2.05", ";", "// Internal use only. Intentionally not documented.", "this", ".", "calloutPoints", "=", "null", ";", "}" ]
Constructs an annotation. @alias Annotation @constructor @augments Renderable @classdesc Represents an Annotation shape. An annotation displays a callout, a text and a leader pointing the annotation's geographic position to the ground. @param {Position} position The annotations's geographic position. @param {AnnotationAttributes} attributes The attributes to associate with this annotation. @throws {ArgumentError} If the specified position is null or undefined.
[ "Constructs", "an", "annotation", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shapes/Annotation.js#L62-L126
10,621
NASAWorldWind/WebWorldWind
src/shapes/SurfaceRectangle.js
function (center, width, height, heading, attributes) { if (!center) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceRectangle", "constructor", "missingLocation")); } if (width < 0 || height < 0) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceRectangle", "constructor", "Size is negative.")); } SurfaceShape.call(this, attributes); // All these are documented with their property accessors below. this._center = center; this._width = width; this._height = height; this._heading = heading; }
javascript
function (center, width, height, heading, attributes) { if (!center) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceRectangle", "constructor", "missingLocation")); } if (width < 0 || height < 0) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceRectangle", "constructor", "Size is negative.")); } SurfaceShape.call(this, attributes); // All these are documented with their property accessors below. this._center = center; this._width = width; this._height = height; this._heading = heading; }
[ "function", "(", "center", ",", "width", ",", "height", ",", "heading", ",", "attributes", ")", "{", "if", "(", "!", "center", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"SurfaceRectangle\"", ",", "\"constructor\"", ",", "\"missingLocation\"", ")", ")", ";", "}", "if", "(", "width", "<", "0", "||", "height", "<", "0", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"SurfaceRectangle\"", ",", "\"constructor\"", ",", "\"Size is negative.\"", ")", ")", ";", "}", "SurfaceShape", ".", "call", "(", "this", ",", "attributes", ")", ";", "// All these are documented with their property accessors below.", "this", ".", "_center", "=", "center", ";", "this", ".", "_width", "=", "width", ";", "this", ".", "_height", "=", "height", ";", "this", ".", "_heading", "=", "heading", ";", "}" ]
Constructs a surface rectangle with a specified center and size and an optional attributes bundle. @alias SurfaceRectangle @constructor @augments SurfaceShape @classdesc Represents a rectangle draped over the terrain surface. <p> SurfaceRectangle uses the following attributes from its associated shape attributes bundle: <ul> <li>Draw interior</li> <li>Draw outline</li> <li>Interior color</li> <li>Outline color</li> <li>Outline width</li> <li>Outline stipple factor</li> <li>Outline stipple pattern</li> </ul> @param {Location} center The rectangle's center location. @param {Number} width The rectangle's width in meters. @param {Number} height The rectangle's height in meters. @param {Number} heading The rectangle's heading. @param {ShapeAttributes} attributes The attributes to apply to this shape. May be null, in which case attributes must be set directly before the shape is drawn. @throws {ArgumentError} If the specified center location is null or undefined or if either specified width or height is negative.
[ "Constructs", "a", "surface", "rectangle", "with", "a", "specified", "center", "and", "size", "and", "an", "optional", "attributes", "bundle", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shapes/SurfaceRectangle.js#L64-L82
10,622
NASAWorldWind/WebWorldWind
src/geom/Matrix3.js
function (m11, m12, m13, m21, m22, m23, m31, m32, m33) { this[0] = m11; this[1] = m12; this[2] = m13; this[3] = m21; this[4] = m22; this[5] = m23; this[6] = m31; this[7] = m32; this[8] = m33; }
javascript
function (m11, m12, m13, m21, m22, m23, m31, m32, m33) { this[0] = m11; this[1] = m12; this[2] = m13; this[3] = m21; this[4] = m22; this[5] = m23; this[6] = m31; this[7] = m32; this[8] = m33; }
[ "function", "(", "m11", ",", "m12", ",", "m13", ",", "m21", ",", "m22", ",", "m23", ",", "m31", ",", "m32", ",", "m33", ")", "{", "this", "[", "0", "]", "=", "m11", ";", "this", "[", "1", "]", "=", "m12", ";", "this", "[", "2", "]", "=", "m13", ";", "this", "[", "3", "]", "=", "m21", ";", "this", "[", "4", "]", "=", "m22", ";", "this", "[", "5", "]", "=", "m23", ";", "this", "[", "6", "]", "=", "m31", ";", "this", "[", "7", "]", "=", "m32", ";", "this", "[", "8", "]", "=", "m33", ";", "}" ]
Constructs a 3 x 3 matrix. @alias Matrix3 @constructor @classdesc Represents a 3 x 3 double precision matrix stored in a Float64Array in row-major order. @param {Number} m11 matrix element at row 1, column 1. @param {Number} m12 matrix element at row 1, column 2. @param {Number} m13 matrix element at row 1, column 3. @param {Number} m21 matrix element at row 2, column 1. @param {Number} m22 matrix element at row 2, column 2. @param {Number} m23 matrix element at row 2, column 3. @param {Number} m31 matrix element at row 3, column 1. @param {Number} m32 matrix element at row 3, column 2. @param {Number} m33 matrix element at row 3, column 3.
[ "Constructs", "a", "3", "x", "3", "matrix", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/geom/Matrix3.js#L44-L56
10,623
NASAWorldWind/WebWorldWind
src/error/UnsupportedOperationError.js
function (message) { AbstractError.call(this, "UnsupportedOperationError", message); var stack; try { //noinspection ExceptionCaughtLocallyJS throw new Error(); } catch (e) { stack = e.stack; } this.stack = stack; }
javascript
function (message) { AbstractError.call(this, "UnsupportedOperationError", message); var stack; try { //noinspection ExceptionCaughtLocallyJS throw new Error(); } catch (e) { stack = e.stack; } this.stack = stack; }
[ "function", "(", "message", ")", "{", "AbstractError", ".", "call", "(", "this", ",", "\"UnsupportedOperationError\"", ",", "message", ")", ";", "var", "stack", ";", "try", "{", "//noinspection ExceptionCaughtLocallyJS", "throw", "new", "Error", "(", ")", ";", "}", "catch", "(", "e", ")", "{", "stack", "=", "e", ".", "stack", ";", "}", "this", ".", "stack", "=", "stack", ";", "}" ]
Constructs an unsupported-operation error with a specified message. @alias UnsupportedOperationError @constructor @classdesc Represents an error associated with an operation that is not available or should not be invoked. Typically raised when an abstract function of an abstract base class is called because a subclass has not implemented the function. @augments AbstractError @param {String} message The message.
[ "Constructs", "an", "unsupported", "-", "operation", "error", "with", "a", "specified", "message", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/error/UnsupportedOperationError.js#L34-L45
10,624
NASAWorldWind/WebWorldWind
src/globe/TerrainTile.js
function (sector, level, row, column) { Tile.call(this, sector, level, row, column); // args are checked in the superclass' constructor /** * The transformation matrix that maps tile local coordinates to model coordinates. * @type {Matrix} */ this.transformationMatrix = Matrix.fromIdentity(); /** * The tile's model coordinate points. * @type {Float32Array} */ this.points = null; /** * Indicates the state of this tile when the model coordinate points were last updated. This is used to * invalidate the points when this tile's state changes. * @type {String} */ this.pointsStateKey = null; /** * Indicates the state of this tile when the model coordinate VBO was last uploaded to GL. This is used to * invalidate the VBO when the tile's state changes. * @type {String} */ this.pointsVboStateKey = null; // Internal use. Intentionally not documented. this.neighborMap = {}; this.neighborMap[WorldWind.NORTH] = null; this.neighborMap[WorldWind.SOUTH] = null; this.neighborMap[WorldWind.EAST] = null; this.neighborMap[WorldWind.WEST] = null; // Internal use. Intentionally not documented. this._stateKey = null; // Internal use. Intentionally not documented. this._elevationTimestamp = null; // Internal use. Intentionally not documented. this.scratchArray = []; }
javascript
function (sector, level, row, column) { Tile.call(this, sector, level, row, column); // args are checked in the superclass' constructor /** * The transformation matrix that maps tile local coordinates to model coordinates. * @type {Matrix} */ this.transformationMatrix = Matrix.fromIdentity(); /** * The tile's model coordinate points. * @type {Float32Array} */ this.points = null; /** * Indicates the state of this tile when the model coordinate points were last updated. This is used to * invalidate the points when this tile's state changes. * @type {String} */ this.pointsStateKey = null; /** * Indicates the state of this tile when the model coordinate VBO was last uploaded to GL. This is used to * invalidate the VBO when the tile's state changes. * @type {String} */ this.pointsVboStateKey = null; // Internal use. Intentionally not documented. this.neighborMap = {}; this.neighborMap[WorldWind.NORTH] = null; this.neighborMap[WorldWind.SOUTH] = null; this.neighborMap[WorldWind.EAST] = null; this.neighborMap[WorldWind.WEST] = null; // Internal use. Intentionally not documented. this._stateKey = null; // Internal use. Intentionally not documented. this._elevationTimestamp = null; // Internal use. Intentionally not documented. this.scratchArray = []; }
[ "function", "(", "sector", ",", "level", ",", "row", ",", "column", ")", "{", "Tile", ".", "call", "(", "this", ",", "sector", ",", "level", ",", "row", ",", "column", ")", ";", "// args are checked in the superclass' constructor", "/**\n * The transformation matrix that maps tile local coordinates to model coordinates.\n * @type {Matrix}\n */", "this", ".", "transformationMatrix", "=", "Matrix", ".", "fromIdentity", "(", ")", ";", "/**\n * The tile's model coordinate points.\n * @type {Float32Array}\n */", "this", ".", "points", "=", "null", ";", "/**\n * Indicates the state of this tile when the model coordinate points were last updated. This is used to\n * invalidate the points when this tile's state changes.\n * @type {String}\n */", "this", ".", "pointsStateKey", "=", "null", ";", "/**\n * Indicates the state of this tile when the model coordinate VBO was last uploaded to GL. This is used to\n * invalidate the VBO when the tile's state changes.\n * @type {String}\n */", "this", ".", "pointsVboStateKey", "=", "null", ";", "// Internal use. Intentionally not documented.", "this", ".", "neighborMap", "=", "{", "}", ";", "this", ".", "neighborMap", "[", "WorldWind", ".", "NORTH", "]", "=", "null", ";", "this", ".", "neighborMap", "[", "WorldWind", ".", "SOUTH", "]", "=", "null", ";", "this", ".", "neighborMap", "[", "WorldWind", ".", "EAST", "]", "=", "null", ";", "this", ".", "neighborMap", "[", "WorldWind", ".", "WEST", "]", "=", "null", ";", "// Internal use. Intentionally not documented.", "this", ".", "_stateKey", "=", "null", ";", "// Internal use. Intentionally not documented.", "this", ".", "_elevationTimestamp", "=", "null", ";", "// Internal use. Intentionally not documented.", "this", ".", "scratchArray", "=", "[", "]", ";", "}" ]
Constructs a terrain tile. @alias TerrainTile @constructor @augments Tile @classdesc Represents a portion of a globe's terrain. Applications typically do not interact directly with this class. @param {Sector} sector The sector this tile covers. @param {Level} level The level this tile is associated with. @param {Number} row This tile's row in the associated level. @param {Number} column This tile's column in the associated level. @throws {ArgumentError} If the specified sector or level is null or undefined or the row or column arguments are less than zero.
[ "Constructs", "a", "terrain", "tile", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/globe/TerrainTile.js#L46-L90
10,625
NASAWorldWind/WebWorldWind
src/layer/RestTiledImageLayer.js
function (serverAddress, pathToData, displayName, configuration) { var cachePath = WWUtil.urlPath(serverAddress + "/" + pathToData); TiledImageLayer.call(this, (configuration && configuration.sector) || Sector.FULL_SPHERE, (configuration && configuration.levelZeroTileDelta) || new Location(45, 45), (configuration && configuration.numLevels) || 5, (configuration && configuration.imageFormat) || "image/jpeg", cachePath, (configuration && configuration.tileWidth) || 256, (configuration && configuration.tileHeight) || 256); this.displayName = displayName; this.pickEnabled = false; this.urlBuilder = new LevelRowColumnUrlBuilder(serverAddress, pathToData); }
javascript
function (serverAddress, pathToData, displayName, configuration) { var cachePath = WWUtil.urlPath(serverAddress + "/" + pathToData); TiledImageLayer.call(this, (configuration && configuration.sector) || Sector.FULL_SPHERE, (configuration && configuration.levelZeroTileDelta) || new Location(45, 45), (configuration && configuration.numLevels) || 5, (configuration && configuration.imageFormat) || "image/jpeg", cachePath, (configuration && configuration.tileWidth) || 256, (configuration && configuration.tileHeight) || 256); this.displayName = displayName; this.pickEnabled = false; this.urlBuilder = new LevelRowColumnUrlBuilder(serverAddress, pathToData); }
[ "function", "(", "serverAddress", ",", "pathToData", ",", "displayName", ",", "configuration", ")", "{", "var", "cachePath", "=", "WWUtil", ".", "urlPath", "(", "serverAddress", "+", "\"/\"", "+", "pathToData", ")", ";", "TiledImageLayer", ".", "call", "(", "this", ",", "(", "configuration", "&&", "configuration", ".", "sector", ")", "||", "Sector", ".", "FULL_SPHERE", ",", "(", "configuration", "&&", "configuration", ".", "levelZeroTileDelta", ")", "||", "new", "Location", "(", "45", ",", "45", ")", ",", "(", "configuration", "&&", "configuration", ".", "numLevels", ")", "||", "5", ",", "(", "configuration", "&&", "configuration", ".", "imageFormat", ")", "||", "\"image/jpeg\"", ",", "cachePath", ",", "(", "configuration", "&&", "configuration", ".", "tileWidth", ")", "||", "256", ",", "(", "configuration", "&&", "configuration", ".", "tileHeight", ")", "||", "256", ")", ";", "this", ".", "displayName", "=", "displayName", ";", "this", ".", "pickEnabled", "=", "false", ";", "this", ".", "urlBuilder", "=", "new", "LevelRowColumnUrlBuilder", "(", "serverAddress", ",", "pathToData", ")", ";", "}" ]
Constructs a tiled image layer that uses a REST interface to retrieve its imagery. @alias RestTiledImageLayer @constructor @augments TiledImageLayer @classdesc Displays a layer whose imagery is retrieved using a REST interface. See [LevelRowColumnUrlBuilder]{@link LevelRowColumnUrlBuilder} for a description of the REST interface. @param {String} serverAddress The server address of the tile service. May be null, in which case the current origin is used (see window.location). @param {String} pathToData The path to the data directory relative to the specified server address. May be null, in which case the server address is assumed to be the full path to the data directory. @param {String} displayName The display name to associate with this layer. @param {{}} configuration The tiled image layer configuration. May have the following properties: <ul> <li>sector {Sector}, default is full sphere</li> <li>levelZerotTileDelta {Location}, default is 45, 45</li> <li>numLevels {Number}, default is 5</li> <li>imageFormat {String}, default is image/jpeg</li> <li>tileWidth {Number}, default is 256</li> <li>tileHeight {Number}, default is 256</li> </ul> The specified default is used for any property not specified.
[ "Constructs", "a", "tiled", "image", "layer", "that", "uses", "a", "REST", "interface", "to", "retrieve", "its", "imagery", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/layer/RestTiledImageLayer.js#L61-L76
10,626
NASAWorldWind/WebWorldWind
src/ogc/wcs/WcsCoverage.js
function (coverageId, webCoverageService) { if (!coverageId) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WcsCoverage", "constructor", "missingId")); } if (!webCoverageService) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WcsCoverage", "constructor", "missingWebCoverageService")); } /** * The Web Coverage Service Coverages id or name as assigned by the providing service. * @type {String} */ this.coverageId = coverageId; /** * The WebCoverageService responsible for managing this Coverage and Web Coverage Service. * @type {WebCoverageService} */ this.service = webCoverageService; /** * The Sector representing the bounds of the coverage. * @type {Sector} */ this.sector = this.service.coverageDescriptions.getSector(this.coverageId); /** * The resolution of the coverage, in degrees. * @type {Number} */ this.resolution = this.service.coverageDescriptions.getResolution(this.coverageId); /** * A configuration object for use by TiledElevationCoverage. * @type {{}} */ this.elevationConfig = this.createElevationConfig(); }
javascript
function (coverageId, webCoverageService) { if (!coverageId) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WcsCoverage", "constructor", "missingId")); } if (!webCoverageService) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WcsCoverage", "constructor", "missingWebCoverageService")); } /** * The Web Coverage Service Coverages id or name as assigned by the providing service. * @type {String} */ this.coverageId = coverageId; /** * The WebCoverageService responsible for managing this Coverage and Web Coverage Service. * @type {WebCoverageService} */ this.service = webCoverageService; /** * The Sector representing the bounds of the coverage. * @type {Sector} */ this.sector = this.service.coverageDescriptions.getSector(this.coverageId); /** * The resolution of the coverage, in degrees. * @type {Number} */ this.resolution = this.service.coverageDescriptions.getResolution(this.coverageId); /** * A configuration object for use by TiledElevationCoverage. * @type {{}} */ this.elevationConfig = this.createElevationConfig(); }
[ "function", "(", "coverageId", ",", "webCoverageService", ")", "{", "if", "(", "!", "coverageId", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"WcsCoverage\"", ",", "\"constructor\"", ",", "\"missingId\"", ")", ")", ";", "}", "if", "(", "!", "webCoverageService", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"WcsCoverage\"", ",", "\"constructor\"", ",", "\"missingWebCoverageService\"", ")", ")", ";", "}", "/**\n * The Web Coverage Service Coverages id or name as assigned by the providing service.\n * @type {String}\n */", "this", ".", "coverageId", "=", "coverageId", ";", "/**\n * The WebCoverageService responsible for managing this Coverage and Web Coverage Service.\n * @type {WebCoverageService}\n */", "this", ".", "service", "=", "webCoverageService", ";", "/**\n * The Sector representing the bounds of the coverage.\n * @type {Sector}\n */", "this", ".", "sector", "=", "this", ".", "service", ".", "coverageDescriptions", ".", "getSector", "(", "this", ".", "coverageId", ")", ";", "/**\n * The resolution of the coverage, in degrees.\n * @type {Number}\n */", "this", ".", "resolution", "=", "this", ".", "service", ".", "coverageDescriptions", ".", "getResolution", "(", "this", ".", "coverageId", ")", ";", "/**\n * A configuration object for use by TiledElevationCoverage.\n * @type {{}}\n */", "this", ".", "elevationConfig", "=", "this", ".", "createElevationConfig", "(", ")", ";", "}" ]
A simple object representation of a Web Coverage Service coverage. Provides utility methods and properties for use in common WCS Coverage operations. @param {String} coverageId the name or id of the coverage @param {WebCoverageService} webCoverageService the WebCoverageService providing the coverage @constructor
[ "A", "simple", "object", "representation", "of", "a", "Web", "Coverage", "Service", "coverage", ".", "Provides", "utility", "methods", "and", "properties", "for", "use", "in", "common", "WCS", "Coverage", "operations", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/ogc/wcs/WcsCoverage.js#L37-L77
10,627
NASAWorldWind/WebWorldWind
src/layer/BMNGRestLayer.js
function (serverAddress, pathToData, displayName, initialTime) { Layer.call(this, displayName || "Blue Marble time series"); /** * A value indicating the month to display. The nearest month to the specified time is displayed. * @type {Date} * @default January 2004 (new Date("2004-01")); */ this.time = initialTime || new Date("2004-01"); // Intentionally not documented. this.timeSequence = new PeriodicTimeSequence("2004-01-01/2004-12-01/P1M"); // Intentionally not documented. this.serverAddress = serverAddress; // Intentionally not documented. this.pathToData = pathToData; // Intentionally not documented. this.layers = {}; // holds the layers as they're created. // Intentionally not documented. this.layerNames = [ {month: "BlueMarble-200401", time: BMNGRestLayer.availableTimes[0]}, {month: "BlueMarble-200402", time: BMNGRestLayer.availableTimes[1]}, {month: "BlueMarble-200403", time: BMNGRestLayer.availableTimes[2]}, {month: "BlueMarble-200404", time: BMNGRestLayer.availableTimes[3]}, {month: "BlueMarble-200405", time: BMNGRestLayer.availableTimes[4]}, {month: "BlueMarble-200406", time: BMNGRestLayer.availableTimes[5]}, {month: "BlueMarble-200407", time: BMNGRestLayer.availableTimes[6]}, {month: "BlueMarble-200408", time: BMNGRestLayer.availableTimes[7]}, {month: "BlueMarble-200409", time: BMNGRestLayer.availableTimes[8]}, {month: "BlueMarble-200410", time: BMNGRestLayer.availableTimes[9]}, {month: "BlueMarble-200411", time: BMNGRestLayer.availableTimes[10]}, {month: "BlueMarble-200412", time: BMNGRestLayer.availableTimes[11]} ]; this.pickEnabled = false; }
javascript
function (serverAddress, pathToData, displayName, initialTime) { Layer.call(this, displayName || "Blue Marble time series"); /** * A value indicating the month to display. The nearest month to the specified time is displayed. * @type {Date} * @default January 2004 (new Date("2004-01")); */ this.time = initialTime || new Date("2004-01"); // Intentionally not documented. this.timeSequence = new PeriodicTimeSequence("2004-01-01/2004-12-01/P1M"); // Intentionally not documented. this.serverAddress = serverAddress; // Intentionally not documented. this.pathToData = pathToData; // Intentionally not documented. this.layers = {}; // holds the layers as they're created. // Intentionally not documented. this.layerNames = [ {month: "BlueMarble-200401", time: BMNGRestLayer.availableTimes[0]}, {month: "BlueMarble-200402", time: BMNGRestLayer.availableTimes[1]}, {month: "BlueMarble-200403", time: BMNGRestLayer.availableTimes[2]}, {month: "BlueMarble-200404", time: BMNGRestLayer.availableTimes[3]}, {month: "BlueMarble-200405", time: BMNGRestLayer.availableTimes[4]}, {month: "BlueMarble-200406", time: BMNGRestLayer.availableTimes[5]}, {month: "BlueMarble-200407", time: BMNGRestLayer.availableTimes[6]}, {month: "BlueMarble-200408", time: BMNGRestLayer.availableTimes[7]}, {month: "BlueMarble-200409", time: BMNGRestLayer.availableTimes[8]}, {month: "BlueMarble-200410", time: BMNGRestLayer.availableTimes[9]}, {month: "BlueMarble-200411", time: BMNGRestLayer.availableTimes[10]}, {month: "BlueMarble-200412", time: BMNGRestLayer.availableTimes[11]} ]; this.pickEnabled = false; }
[ "function", "(", "serverAddress", ",", "pathToData", ",", "displayName", ",", "initialTime", ")", "{", "Layer", ".", "call", "(", "this", ",", "displayName", "||", "\"Blue Marble time series\"", ")", ";", "/**\n * A value indicating the month to display. The nearest month to the specified time is displayed.\n * @type {Date}\n * @default January 2004 (new Date(\"2004-01\"));\n */", "this", ".", "time", "=", "initialTime", "||", "new", "Date", "(", "\"2004-01\"", ")", ";", "// Intentionally not documented.", "this", ".", "timeSequence", "=", "new", "PeriodicTimeSequence", "(", "\"2004-01-01/2004-12-01/P1M\"", ")", ";", "// Intentionally not documented.", "this", ".", "serverAddress", "=", "serverAddress", ";", "// Intentionally not documented.", "this", ".", "pathToData", "=", "pathToData", ";", "// Intentionally not documented.", "this", ".", "layers", "=", "{", "}", ";", "// holds the layers as they're created.", "// Intentionally not documented.", "this", ".", "layerNames", "=", "[", "{", "month", ":", "\"BlueMarble-200401\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "0", "]", "}", ",", "{", "month", ":", "\"BlueMarble-200402\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "1", "]", "}", ",", "{", "month", ":", "\"BlueMarble-200403\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "2", "]", "}", ",", "{", "month", ":", "\"BlueMarble-200404\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "3", "]", "}", ",", "{", "month", ":", "\"BlueMarble-200405\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "4", "]", "}", ",", "{", "month", ":", "\"BlueMarble-200406\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "5", "]", "}", ",", "{", "month", ":", "\"BlueMarble-200407\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "6", "]", "}", ",", "{", "month", ":", "\"BlueMarble-200408\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "7", "]", "}", ",", "{", "month", ":", "\"BlueMarble-200409\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "8", "]", "}", ",", "{", "month", ":", "\"BlueMarble-200410\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "9", "]", "}", ",", "{", "month", ":", "\"BlueMarble-200411\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "10", "]", "}", ",", "{", "month", ":", "\"BlueMarble-200412\"", ",", "time", ":", "BMNGRestLayer", ".", "availableTimes", "[", "11", "]", "}", "]", ";", "this", ".", "pickEnabled", "=", "false", ";", "}" ]
Constructs a Blue Marble layer. @alias BMNGRestLayer @constructor @augments Layer @classdesc Represents the 12 month collection of Blue Marble Next Generation imagery for the year 2004. By default the month of January is displayed, but this can be changed by setting this class' time property to indicate the month to display. @param {String} serverAddress The server address of the tile service. May be null, in which case the current origin is used (see window.location). @param {String} pathToData The path to the data directory relative to the specified server address. May be null, in which case the server address is assumed to be the full path to the data directory. @param {String} displayName The display name to assign this layer. Defaults to "Blue Marble" if null or undefined. @param {Date} initialTime A date value indicating the month to display. The nearest month to the specified time is displayed. January is displayed if this argument is null or undefined, i.e., new Date("2004-01"); See {@link RestTiledImageLayer} for a description of its contents. May be null, in which case default values are used.
[ "Constructs", "a", "Blue", "Marble", "layer", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/layer/BMNGRestLayer.js#L53-L92
10,628
NASAWorldWind/WebWorldWind
examples/ParseUrlArguments.js
function () { var result = {}; var queryString = window.location.href.split("?"); if (queryString && queryString.length > 1) { var args = queryString[1].split("&"); for (var a = 0; a < args.length; a++) { var arg = args[a].split("="); // Obtain geographic position to redirect WorldWindow camera view. if (arg[0] === "pos") { // arg format is "pos=lat,lon,alt" var position = arg[1].split(","), lat = parseFloat(position[0]), lon = parseFloat(position[1]), alt = parseFloat(position[2]); result.position = new WorldWind.Position(lat, lon, alt); } } } return result; }
javascript
function () { var result = {}; var queryString = window.location.href.split("?"); if (queryString && queryString.length > 1) { var args = queryString[1].split("&"); for (var a = 0; a < args.length; a++) { var arg = args[a].split("="); // Obtain geographic position to redirect WorldWindow camera view. if (arg[0] === "pos") { // arg format is "pos=lat,lon,alt" var position = arg[1].split(","), lat = parseFloat(position[0]), lon = parseFloat(position[1]), alt = parseFloat(position[2]); result.position = new WorldWind.Position(lat, lon, alt); } } } return result; }
[ "function", "(", ")", "{", "var", "result", "=", "{", "}", ";", "var", "queryString", "=", "window", ".", "location", ".", "href", ".", "split", "(", "\"?\"", ")", ";", "if", "(", "queryString", "&&", "queryString", ".", "length", ">", "1", ")", "{", "var", "args", "=", "queryString", "[", "1", "]", ".", "split", "(", "\"&\"", ")", ";", "for", "(", "var", "a", "=", "0", ";", "a", "<", "args", ".", "length", ";", "a", "++", ")", "{", "var", "arg", "=", "args", "[", "a", "]", ".", "split", "(", "\"=\"", ")", ";", "// Obtain geographic position to redirect WorldWindow camera view.", "if", "(", "arg", "[", "0", "]", "===", "\"pos\"", ")", "{", "// arg format is \"pos=lat,lon,alt\"", "var", "position", "=", "arg", "[", "1", "]", ".", "split", "(", "\",\"", ")", ",", "lat", "=", "parseFloat", "(", "position", "[", "0", "]", ")", ",", "lon", "=", "parseFloat", "(", "position", "[", "1", "]", ")", ",", "alt", "=", "parseFloat", "(", "position", "[", "2", "]", ")", ";", "result", ".", "position", "=", "new", "WorldWind", ".", "Position", "(", "lat", ",", "lon", ",", "alt", ")", ";", "}", "}", "}", "return", "result", ";", "}" ]
Function to obtain arguments from query string.
[ "Function", "to", "obtain", "arguments", "from", "query", "string", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/examples/ParseUrlArguments.js#L54-L77
10,629
NASAWorldWind/WebWorldWind
src/render/TextRenderer.js
function (drawContext) { if (!drawContext) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "TextRenderer", "constructor", "missingDc")); } // Internal use only. Intentionally not documented. this.canvas2D = document.createElement("canvas"); // Internal use only. Intentionally not documented. this.ctx2D = this.canvas2D.getContext("2d"); // Internal use only. Intentionally not documented. this.dc = drawContext; /** * Indicates if the text will feature an outline around its characters. * @type {boolean} */ this.enableOutline = true; // Internal use only. Intentionally not documented. this.lineSpacing = 0.15; // fraction of font size /** * The color for the Text outline. * Its default has half transparency to avoid visual artifacts that appear while fully opaque. * @type {Color} */ this.outlineColor = new Color(0, 0, 0, 0.5); /** * Indicates the text outline width (or thickness) in pixels. * @type {number} */ this.outlineWidth = 4; /** * The text color. * @type {Color} */ this.textColor = new Color(1, 1, 1, 1); /** * The text size, face and other characteristics, as described in [Font]{@link Font}. * @type {Font} */ this.typeFace = new Font(14); }
javascript
function (drawContext) { if (!drawContext) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "TextRenderer", "constructor", "missingDc")); } // Internal use only. Intentionally not documented. this.canvas2D = document.createElement("canvas"); // Internal use only. Intentionally not documented. this.ctx2D = this.canvas2D.getContext("2d"); // Internal use only. Intentionally not documented. this.dc = drawContext; /** * Indicates if the text will feature an outline around its characters. * @type {boolean} */ this.enableOutline = true; // Internal use only. Intentionally not documented. this.lineSpacing = 0.15; // fraction of font size /** * The color for the Text outline. * Its default has half transparency to avoid visual artifacts that appear while fully opaque. * @type {Color} */ this.outlineColor = new Color(0, 0, 0, 0.5); /** * Indicates the text outline width (or thickness) in pixels. * @type {number} */ this.outlineWidth = 4; /** * The text color. * @type {Color} */ this.textColor = new Color(1, 1, 1, 1); /** * The text size, face and other characteristics, as described in [Font]{@link Font}. * @type {Font} */ this.typeFace = new Font(14); }
[ "function", "(", "drawContext", ")", "{", "if", "(", "!", "drawContext", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"TextRenderer\"", ",", "\"constructor\"", ",", "\"missingDc\"", ")", ")", ";", "}", "// Internal use only. Intentionally not documented.", "this", ".", "canvas2D", "=", "document", ".", "createElement", "(", "\"canvas\"", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "ctx2D", "=", "this", ".", "canvas2D", ".", "getContext", "(", "\"2d\"", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "dc", "=", "drawContext", ";", "/**\n * Indicates if the text will feature an outline around its characters.\n * @type {boolean}\n */", "this", ".", "enableOutline", "=", "true", ";", "// Internal use only. Intentionally not documented.", "this", ".", "lineSpacing", "=", "0.15", ";", "// fraction of font size", "/**\n * The color for the Text outline.\n * Its default has half transparency to avoid visual artifacts that appear while fully opaque.\n * @type {Color}\n */", "this", ".", "outlineColor", "=", "new", "Color", "(", "0", ",", "0", ",", "0", ",", "0.5", ")", ";", "/**\n * Indicates the text outline width (or thickness) in pixels.\n * @type {number}\n */", "this", ".", "outlineWidth", "=", "4", ";", "/**\n * The text color.\n * @type {Color}\n */", "this", ".", "textColor", "=", "new", "Color", "(", "1", ",", "1", ",", "1", ",", "1", ")", ";", "/**\n * The text size, face and other characteristics, as described in [Font]{@link Font}.\n * @type {Font}\n */", "this", ".", "typeFace", "=", "new", "Font", "(", "14", ")", ";", "}" ]
Constructs a TextRenderer instance. @alias TextRenderer @constructor @classdesc Provides methods useful for displaying text. An instance of this class is attached to the WorldWindow {@link DrawContext} and is not intended to be used independently of that. Applications typically do not create instances of this class. @param {drawContext} drawContext The current draw context. Typically the same draw context that TextRenderer is attached to. @throws {ArgumentError} If the specified draw context is null or undefined.
[ "Constructs", "a", "TextRenderer", "instance", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/render/TextRenderer.js#L51-L99
10,630
NASAWorldWind/WebWorldWind
apps/util/GoToBox.js
function (worldWindow) { var thisGoToBox = this; this.wwd = worldWindow; $("#searchBox").find("button").on("click", function (e) { thisGoToBox.onSearchButton(e); }); this.geocoder = new WorldWind.NominatimGeocoder(); $("#searchText").on("keypress", function (e) { thisGoToBox.onSearchTextKeyPress($(this), e); }); }
javascript
function (worldWindow) { var thisGoToBox = this; this.wwd = worldWindow; $("#searchBox").find("button").on("click", function (e) { thisGoToBox.onSearchButton(e); }); this.geocoder = new WorldWind.NominatimGeocoder(); $("#searchText").on("keypress", function (e) { thisGoToBox.onSearchTextKeyPress($(this), e); }); }
[ "function", "(", "worldWindow", ")", "{", "var", "thisGoToBox", "=", "this", ";", "this", ".", "wwd", "=", "worldWindow", ";", "$", "(", "\"#searchBox\"", ")", ".", "find", "(", "\"button\"", ")", ".", "on", "(", "\"click\"", ",", "function", "(", "e", ")", "{", "thisGoToBox", ".", "onSearchButton", "(", "e", ")", ";", "}", ")", ";", "this", ".", "geocoder", "=", "new", "WorldWind", ".", "NominatimGeocoder", "(", ")", ";", "$", "(", "\"#searchText\"", ")", ".", "on", "(", "\"keypress\"", ",", "function", "(", "e", ")", "{", "thisGoToBox", ".", "onSearchTextKeyPress", "(", "$", "(", "this", ")", ",", "e", ")", ";", "}", ")", ";", "}" ]
Constructs a GoToBox. @alias GoToBox @constructor @classdesc Provides a search box enabling the user to find and move to specified locations. @param {WorldWindow} worldWindow The WorldWindow to associate this GoToBox with.
[ "Constructs", "a", "GoToBox", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/apps/util/GoToBox.js#L30-L42
10,631
NASAWorldWind/WebWorldWind
examples/WMS.js
function (xmlDom) { // Create a WmsCapabilities object from the XML DOM var wms = new WorldWind.WmsCapabilities(xmlDom); // Retrieve a WmsLayerCapabilities object by the desired layer name var wmsLayerCapabilities = wms.getNamedLayer(layerName); // Form a configuration object from the WmsLayerCapability object var wmsConfig = WorldWind.WmsLayer.formLayerConfiguration(wmsLayerCapabilities); // Modify the configuration objects title property to a more user friendly title wmsConfig.title = "Average Surface Temp"; // Create the WMS Layer from the configuration object var wmsLayer = new WorldWind.WmsLayer(wmsConfig); // Add the layers to WorldWind and update the layer manager wwd.addLayer(wmsLayer); layerManager.synchronizeLayerList(); }
javascript
function (xmlDom) { // Create a WmsCapabilities object from the XML DOM var wms = new WorldWind.WmsCapabilities(xmlDom); // Retrieve a WmsLayerCapabilities object by the desired layer name var wmsLayerCapabilities = wms.getNamedLayer(layerName); // Form a configuration object from the WmsLayerCapability object var wmsConfig = WorldWind.WmsLayer.formLayerConfiguration(wmsLayerCapabilities); // Modify the configuration objects title property to a more user friendly title wmsConfig.title = "Average Surface Temp"; // Create the WMS Layer from the configuration object var wmsLayer = new WorldWind.WmsLayer(wmsConfig); // Add the layers to WorldWind and update the layer manager wwd.addLayer(wmsLayer); layerManager.synchronizeLayerList(); }
[ "function", "(", "xmlDom", ")", "{", "// Create a WmsCapabilities object from the XML DOM", "var", "wms", "=", "new", "WorldWind", ".", "WmsCapabilities", "(", "xmlDom", ")", ";", "// Retrieve a WmsLayerCapabilities object by the desired layer name", "var", "wmsLayerCapabilities", "=", "wms", ".", "getNamedLayer", "(", "layerName", ")", ";", "// Form a configuration object from the WmsLayerCapability object", "var", "wmsConfig", "=", "WorldWind", ".", "WmsLayer", ".", "formLayerConfiguration", "(", "wmsLayerCapabilities", ")", ";", "// Modify the configuration objects title property to a more user friendly title", "wmsConfig", ".", "title", "=", "\"Average Surface Temp\"", ";", "// Create the WMS Layer from the configuration object", "var", "wmsLayer", "=", "new", "WorldWind", ".", "WmsLayer", "(", "wmsConfig", ")", ";", "// Add the layers to WorldWind and update the layer manager", "wwd", ".", "addLayer", "(", "wmsLayer", ")", ";", "layerManager", ".", "synchronizeLayerList", "(", ")", ";", "}" ]
Called asynchronously to parse and create the WMS layer
[ "Called", "asynchronously", "to", "parse", "and", "create", "the", "WMS", "layer" ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/examples/WMS.js#L59-L74
10,632
NASAWorldWind/WebWorldWind
src/formats/kml/util/KmlRemoteFile.js
function(options) { if(!options.ajax && !options.zip) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "RemoteDocument", "constructor", "Invalid option for retrieval specified. Use either ajax or zip option.") ); } this.options = options; }
javascript
function(options) { if(!options.ajax && !options.zip) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "RemoteDocument", "constructor", "Invalid option for retrieval specified. Use either ajax or zip option.") ); } this.options = options; }
[ "function", "(", "options", ")", "{", "if", "(", "!", "options", ".", "ajax", "&&", "!", "options", ".", "zip", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"RemoteDocument\"", ",", "\"constructor\"", ",", "\"Invalid option for retrieval specified. Use either ajax or zip option.\"", ")", ")", ";", "}", "this", ".", "options", "=", "options", ";", "}" ]
Creates representation of KmlRemoteFile. In order to load an object it is necessary to run get function on created object. @param options {Object} @param options.ajax {Boolean} If we should use plain AJAX @param options.zip {Boolean} If we are downloading kmz @param options.responseType {String} Optional responseType applied in specific circumstances for the kmz @constructor @alias KmlRemoteFile
[ "Creates", "representation", "of", "KmlRemoteFile", ".", "In", "order", "to", "load", "an", "object", "it", "is", "necessary", "to", "run", "get", "function", "on", "created", "object", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/formats/kml/util/KmlRemoteFile.js#L36-L45
10,633
NASAWorldWind/WebWorldWind
src/shapes/SurfaceEllipse.js
function (center, majorRadius, minorRadius, heading, attributes) { if (!center) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceEllipse", "constructor", "missingLocation")); } if (majorRadius < 0 || minorRadius < 0) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceEllipse", "constructor", "Radius is negative.")); } SurfaceShape.call(this, attributes); // All these are documented with their property accessors below. this._center = center; this._majorRadius = majorRadius; this._minorRadius = minorRadius; this._heading = heading; this._intervals = SurfaceEllipse.DEFAULT_NUM_INTERVALS; }
javascript
function (center, majorRadius, minorRadius, heading, attributes) { if (!center) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceEllipse", "constructor", "missingLocation")); } if (majorRadius < 0 || minorRadius < 0) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceEllipse", "constructor", "Radius is negative.")); } SurfaceShape.call(this, attributes); // All these are documented with their property accessors below. this._center = center; this._majorRadius = majorRadius; this._minorRadius = minorRadius; this._heading = heading; this._intervals = SurfaceEllipse.DEFAULT_NUM_INTERVALS; }
[ "function", "(", "center", ",", "majorRadius", ",", "minorRadius", ",", "heading", ",", "attributes", ")", "{", "if", "(", "!", "center", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"SurfaceEllipse\"", ",", "\"constructor\"", ",", "\"missingLocation\"", ")", ")", ";", "}", "if", "(", "majorRadius", "<", "0", "||", "minorRadius", "<", "0", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"SurfaceEllipse\"", ",", "\"constructor\"", ",", "\"Radius is negative.\"", ")", ")", ";", "}", "SurfaceShape", ".", "call", "(", "this", ",", "attributes", ")", ";", "// All these are documented with their property accessors below.", "this", ".", "_center", "=", "center", ";", "this", ".", "_majorRadius", "=", "majorRadius", ";", "this", ".", "_minorRadius", "=", "minorRadius", ";", "this", ".", "_heading", "=", "heading", ";", "this", ".", "_intervals", "=", "SurfaceEllipse", ".", "DEFAULT_NUM_INTERVALS", ";", "}" ]
Constructs a surface ellipse with a specified center and radii and an optional attributes bundle. @alias SurfaceEllipse @constructor @augments SurfaceShape @classdesc Represents an ellipse draped over the terrain surface. <p> SurfaceEllipse uses the following attributes from its associated shape attributes bundle: <ul> <li>Draw interior</li> <li>Draw outline</li> <li>Interior color</li> <li>Outline color</li> <li>Outline width</li> <li>Outline stipple factor</li> <li>Outline stipple pattern</li> </ul> @param {Location} center The ellipse's center location. @param {Number} majorRadius The ellipse's major radius in meters. @param {Number} minorRadius The ellipse's minor radius in meters. @param {Number} heading The heading of the major axis in degrees. @param {ShapeAttributes} attributes The attributes to apply to this shape. May be null, in which case attributes must be set directly before the shape is drawn. @throws {ArgumentError} If the specified center location is null or undefined or if either specified radii is negative.
[ "Constructs", "a", "surface", "ellipse", "with", "a", "specified", "center", "and", "radii", "and", "an", "optional", "attributes", "bundle", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shapes/SurfaceEllipse.js#L64-L83
10,634
NASAWorldWind/WebWorldWind
src/ogc/wms/WmsLayerCapabilities.js
function (layerElement, parentNode) { if (!layerElement) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WmsLayerCapabilities", "constructor", "Layer element is null or undefined.")); } /** * The parent object, as specified to the constructor of this object. * @type {{}} * @readonly */ this.parent = parentNode; /** * The layers that are children of this layer. * @type {WmsLayerCapabilities[]} * @readonly */ this.layers; /** * The name of this layer description. * @type {String} * @readonly */ this.name; /** * The title of this layer. * @type {String} * @readonly */ this.title; /** * The abstract of this layer. * @type {String} * @readonly */ this.abstract; /** * The list of keywords associated with this layer description. * @type {String[]} * @readonly */ this.keywordList; /** * The identifiers associated with this layer description. Each identifier has the following properties: * authority, content. * @type {Object[]} */ this.identifiers; /** * The metadata URLs associated with this layer description. Each object in the returned array has the * following properties: type, format, url. * @type {Object[]} * @readonly */ this.metadataUrls; /** * The data URLs associated with this layer description. Each object in the returned array has the * following properties: format, url. * @type {Object[]} * @readonly */ this.dataUrls; /** * The feature list URLs associated with this layer description. Each object in the returned array has the * following properties: format, url. * @type {Object[]} * @readonly */ this.featureListUrls; this.assembleLayer(layerElement); }
javascript
function (layerElement, parentNode) { if (!layerElement) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WmsLayerCapabilities", "constructor", "Layer element is null or undefined.")); } /** * The parent object, as specified to the constructor of this object. * @type {{}} * @readonly */ this.parent = parentNode; /** * The layers that are children of this layer. * @type {WmsLayerCapabilities[]} * @readonly */ this.layers; /** * The name of this layer description. * @type {String} * @readonly */ this.name; /** * The title of this layer. * @type {String} * @readonly */ this.title; /** * The abstract of this layer. * @type {String} * @readonly */ this.abstract; /** * The list of keywords associated with this layer description. * @type {String[]} * @readonly */ this.keywordList; /** * The identifiers associated with this layer description. Each identifier has the following properties: * authority, content. * @type {Object[]} */ this.identifiers; /** * The metadata URLs associated with this layer description. Each object in the returned array has the * following properties: type, format, url. * @type {Object[]} * @readonly */ this.metadataUrls; /** * The data URLs associated with this layer description. Each object in the returned array has the * following properties: format, url. * @type {Object[]} * @readonly */ this.dataUrls; /** * The feature list URLs associated with this layer description. Each object in the returned array has the * following properties: format, url. * @type {Object[]} * @readonly */ this.featureListUrls; this.assembleLayer(layerElement); }
[ "function", "(", "layerElement", ",", "parentNode", ")", "{", "if", "(", "!", "layerElement", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"WmsLayerCapabilities\"", ",", "\"constructor\"", ",", "\"Layer element is null or undefined.\"", ")", ")", ";", "}", "/**\n * The parent object, as specified to the constructor of this object.\n * @type {{}}\n * @readonly\n */", "this", ".", "parent", "=", "parentNode", ";", "/**\n * The layers that are children of this layer.\n * @type {WmsLayerCapabilities[]}\n * @readonly\n */", "this", ".", "layers", ";", "/**\n * The name of this layer description.\n * @type {String}\n * @readonly\n */", "this", ".", "name", ";", "/**\n * The title of this layer.\n * @type {String}\n * @readonly\n */", "this", ".", "title", ";", "/**\n * The abstract of this layer.\n * @type {String}\n * @readonly\n */", "this", ".", "abstract", ";", "/**\n * The list of keywords associated with this layer description.\n * @type {String[]}\n * @readonly\n */", "this", ".", "keywordList", ";", "/**\n * The identifiers associated with this layer description. Each identifier has the following properties:\n * authority, content.\n * @type {Object[]}\n */", "this", ".", "identifiers", ";", "/**\n * The metadata URLs associated with this layer description. Each object in the returned array has the\n * following properties: type, format, url.\n * @type {Object[]}\n * @readonly\n */", "this", ".", "metadataUrls", ";", "/**\n * The data URLs associated with this layer description. Each object in the returned array has the\n * following properties: format, url.\n * @type {Object[]}\n * @readonly\n */", "this", ".", "dataUrls", ";", "/**\n * The feature list URLs associated with this layer description. Each object in the returned array has the\n * following properties: format, url.\n * @type {Object[]}\n * @readonly\n */", "this", ".", "featureListUrls", ";", "this", ".", "assembleLayer", "(", "layerElement", ")", ";", "}" ]
Constructs an WMS Layer instance from an XML DOM. @alias WmsLayerCapabilities @constructor @classdesc Represents a WMS layer description from a WMS Capabilities document. This object holds all the fields specified in the associated WMS Capabilities document. @param {{}} layerElement A WMS Layer element describing the layer. @param {{}} parentNode An object indicating the new layer object's parent object. @throws {ArgumentError} If the specified layer element is null or undefined.
[ "Constructs", "an", "WMS", "Layer", "instance", "from", "an", "XML", "DOM", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/ogc/wms/WmsLayerCapabilities.js#L38-L119
10,635
NASAWorldWind/WebWorldWind
src/shapes/Placemark.js
function (position, eyeDistanceScaling, attributes) { if (!position) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "Placemark", "constructor", "missingPosition")); } Renderable.call(this); /** * The placemark's attributes. If null and this placemark is not highlighted, this placemark is not * drawn. * @type {PlacemarkAttributes} * @default see [PlacemarkAttributes]{@link PlacemarkAttributes} */ this.attributes = attributes ? attributes : new PlacemarkAttributes(null); /** * The attributes used when this placemark's highlighted flag is true. If null and the * highlighted flag is true, this placemark's normal attributes are used. If they, too, are null, this * placemark is not drawn. * @type {PlacemarkAttributes} * @default null */ this.highlightAttributes = null; /** * Indicates whether this placemark uses its highlight attributes rather than its normal attributes. * @type {Boolean} * @default false */ this.highlighted = false; /** * This placemark's geographic position. * @type {Position} */ this.position = position; /** * Indicates whether this placemark's size is reduced at higher eye distances. If true, this placemark's * size is scaled inversely proportional to the eye distance if the eye distance is greater than the * value of the [eyeDistanceScalingThreshold]{@link Placemark#eyeDistanceScalingThreshold} property. * When the eye distance is below the threshold, this placemark is scaled only according to the * [imageScale]{@link PlacemarkAttributes#imageScale}. * @type {Boolean} */ this.eyeDistanceScaling = eyeDistanceScaling; /** * The eye distance above which to reduce the size of this placemark, in meters. If * [eyeDistanceScaling]{@link Placemark#eyeDistanceScaling} is true, this placemark's image, label and leader * line sizes are reduced as the eye distance increases beyond this threshold. * @type {Number} * @default 1e6 (meters) */ this.eyeDistanceScalingThreshold = 1e6; /** * The eye altitude above which this placemark's label is not displayed. * @type {number} */ this.eyeDistanceScalingLabelThreshold = 1.5 * this.eyeDistanceScalingThreshold; /** * This placemark's textual label. If null, no label is drawn. * @type {String} * @default null */ this.label = null; /** * This placemark's altitude mode. May be one of * <ul> * <li>[WorldWind.ABSOLUTE]{@link WorldWind#ABSOLUTE}</li> * <li>[WorldWind.RELATIVE_TO_GROUND]{@link WorldWind#RELATIVE_TO_GROUND}</li> * <li>[WorldWind.CLAMP_TO_GROUND]{@link WorldWind#CLAMP_TO_GROUND}</li> * </ul> * @default WorldWind.ABSOLUTE */ this.altitudeMode = WorldWind.ABSOLUTE; /** * Indicates whether this placemark has visual priority over other shapes in the scene. * @type {Boolean} * @default false */ this.alwaysOnTop = false; /** * Indicates whether this placemark's leader line, if any, is pickable. * @type {Boolean} * @default false */ this.enableLeaderLinePicking = false; /** * Indicates whether this placemark's image should be re-retrieved even if it has already been retrieved. * Set this property to true when the image has changed but has the same image path. * The property is set to false when the image is re-retrieved. * @type {Boolean} */ this.updateImage = true; /** * Indicates the group ID of the declutter group to include this placemark. If non-zero, this placemark * is decluttered relative to all other shapes within its group. * @type {Number} * @default 2 */ this.declutterGroup = 2; /** * This placemark's target label visibility, a value between 0 and 1. During ordered rendering this * placemark modifies its [current visibility]{@link Placemark#currentVisibility} towards its target * visibility at the rate specified by the draw context's [fade time]{@link DrawContext#fadeTime} property. * The target visibility and current visibility are used to control the fading in and out of this * placemark's label. * @type {Number} * @default 1 */ this.targetVisibility = 1; /** * This placemark's current label visibility, a value between 0 and 1. This property scales the placemark's * effective label opacity. It is incremented or decremented each frame according to the draw context's * [fade time]{@link DrawContext#fadeTime} property in order to achieve this placemark's * [target visibility]{@link Placemark#targetVisibility}. This current visibility and target visibility are * used to control the fading in and out of this placemark's label. * @type {Number} * @default 1 * @readonly */ this.currentVisibility = 1; /** * The amount of rotation to apply to the image, measured in degrees clockwise and relative to this * placemark's [imageRotationReference]{@link Placemark#imageRotationReference}. * @type {Number} * @default 0 */ this.imageRotation = 0; /** * The amount of tilt to apply to the image, measured in degrees away from the eye point and relative * to this placemark's [imageTiltReference]{@link Placemark#imageTiltReference}. While any positive or * negative number may be specified, values outside the range [0. 90] cause some or all of the image to * be clipped. * @type {Number} * @default 0 */ this.imageTilt = 0; /** * Indicates whether to apply this placemark's image rotation relative to the screen or the globe. * If WorldWind.RELATIVE_TO_SCREEN, this placemark's image is rotated in the plane of the screen and * its orientation relative to the globe changes as the view changes. * If WorldWind.RELATIVE_TO_GLOBE, this placemark's image is rotated in a plane tangent to the globe * at this placemark's position and retains its orientation relative to the globe. * @type {String} * @default WorldWind.RELATIVE_TO_SCREEN */ this.imageRotationReference = WorldWind.RELATIVE_TO_SCREEN; /** * Indicates whether to apply this placemark's image tilt relative to the screen or the globe. * If WorldWind.RELATIVE_TO_SCREEN, this placemark's image is tilted inwards (for positive tilts) * relative to the plane of the screen, and its orientation relative to the globe changes as the view * changes. If WorldWind.RELATIVE_TO_GLOBE, this placemark's image is tilted towards the globe's surface, * and retains its orientation relative to the surface. * @type {string} * @default WorldWind.RELATIVE_TO_SCREEN */ this.imageTiltReference = WorldWind.RELATIVE_TO_SCREEN; // Internal use only. Intentionally not documented. this.activeAttributes = null; // Internal use only. Intentionally not documented. this.activeTexture = null; // Internal use only. Intentionally not documented. this.labelTexture = null; // Internal use only. Intentionally not documented. this.placePoint = new Vec3(0, 0, 0); // Cartesian point corresponding to this placemark's geographic position // Internal use only. Intentionally not documented. this.groundPoint = new Vec3(0, 0, 0); // Cartesian point corresponding to ground position below this placemark // Internal use only. Intentionally not documented. this.imageTransform = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.labelTransform = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.texCoordMatrix = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.imageBounds = null; // Internal use only. Intentionally not documented. this.layer = null; // Internal use only. Intentionally not documented. this.depthOffset = -0.003; }
javascript
function (position, eyeDistanceScaling, attributes) { if (!position) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "Placemark", "constructor", "missingPosition")); } Renderable.call(this); /** * The placemark's attributes. If null and this placemark is not highlighted, this placemark is not * drawn. * @type {PlacemarkAttributes} * @default see [PlacemarkAttributes]{@link PlacemarkAttributes} */ this.attributes = attributes ? attributes : new PlacemarkAttributes(null); /** * The attributes used when this placemark's highlighted flag is true. If null and the * highlighted flag is true, this placemark's normal attributes are used. If they, too, are null, this * placemark is not drawn. * @type {PlacemarkAttributes} * @default null */ this.highlightAttributes = null; /** * Indicates whether this placemark uses its highlight attributes rather than its normal attributes. * @type {Boolean} * @default false */ this.highlighted = false; /** * This placemark's geographic position. * @type {Position} */ this.position = position; /** * Indicates whether this placemark's size is reduced at higher eye distances. If true, this placemark's * size is scaled inversely proportional to the eye distance if the eye distance is greater than the * value of the [eyeDistanceScalingThreshold]{@link Placemark#eyeDistanceScalingThreshold} property. * When the eye distance is below the threshold, this placemark is scaled only according to the * [imageScale]{@link PlacemarkAttributes#imageScale}. * @type {Boolean} */ this.eyeDistanceScaling = eyeDistanceScaling; /** * The eye distance above which to reduce the size of this placemark, in meters. If * [eyeDistanceScaling]{@link Placemark#eyeDistanceScaling} is true, this placemark's image, label and leader * line sizes are reduced as the eye distance increases beyond this threshold. * @type {Number} * @default 1e6 (meters) */ this.eyeDistanceScalingThreshold = 1e6; /** * The eye altitude above which this placemark's label is not displayed. * @type {number} */ this.eyeDistanceScalingLabelThreshold = 1.5 * this.eyeDistanceScalingThreshold; /** * This placemark's textual label. If null, no label is drawn. * @type {String} * @default null */ this.label = null; /** * This placemark's altitude mode. May be one of * <ul> * <li>[WorldWind.ABSOLUTE]{@link WorldWind#ABSOLUTE}</li> * <li>[WorldWind.RELATIVE_TO_GROUND]{@link WorldWind#RELATIVE_TO_GROUND}</li> * <li>[WorldWind.CLAMP_TO_GROUND]{@link WorldWind#CLAMP_TO_GROUND}</li> * </ul> * @default WorldWind.ABSOLUTE */ this.altitudeMode = WorldWind.ABSOLUTE; /** * Indicates whether this placemark has visual priority over other shapes in the scene. * @type {Boolean} * @default false */ this.alwaysOnTop = false; /** * Indicates whether this placemark's leader line, if any, is pickable. * @type {Boolean} * @default false */ this.enableLeaderLinePicking = false; /** * Indicates whether this placemark's image should be re-retrieved even if it has already been retrieved. * Set this property to true when the image has changed but has the same image path. * The property is set to false when the image is re-retrieved. * @type {Boolean} */ this.updateImage = true; /** * Indicates the group ID of the declutter group to include this placemark. If non-zero, this placemark * is decluttered relative to all other shapes within its group. * @type {Number} * @default 2 */ this.declutterGroup = 2; /** * This placemark's target label visibility, a value between 0 and 1. During ordered rendering this * placemark modifies its [current visibility]{@link Placemark#currentVisibility} towards its target * visibility at the rate specified by the draw context's [fade time]{@link DrawContext#fadeTime} property. * The target visibility and current visibility are used to control the fading in and out of this * placemark's label. * @type {Number} * @default 1 */ this.targetVisibility = 1; /** * This placemark's current label visibility, a value between 0 and 1. This property scales the placemark's * effective label opacity. It is incremented or decremented each frame according to the draw context's * [fade time]{@link DrawContext#fadeTime} property in order to achieve this placemark's * [target visibility]{@link Placemark#targetVisibility}. This current visibility and target visibility are * used to control the fading in and out of this placemark's label. * @type {Number} * @default 1 * @readonly */ this.currentVisibility = 1; /** * The amount of rotation to apply to the image, measured in degrees clockwise and relative to this * placemark's [imageRotationReference]{@link Placemark#imageRotationReference}. * @type {Number} * @default 0 */ this.imageRotation = 0; /** * The amount of tilt to apply to the image, measured in degrees away from the eye point and relative * to this placemark's [imageTiltReference]{@link Placemark#imageTiltReference}. While any positive or * negative number may be specified, values outside the range [0. 90] cause some or all of the image to * be clipped. * @type {Number} * @default 0 */ this.imageTilt = 0; /** * Indicates whether to apply this placemark's image rotation relative to the screen or the globe. * If WorldWind.RELATIVE_TO_SCREEN, this placemark's image is rotated in the plane of the screen and * its orientation relative to the globe changes as the view changes. * If WorldWind.RELATIVE_TO_GLOBE, this placemark's image is rotated in a plane tangent to the globe * at this placemark's position and retains its orientation relative to the globe. * @type {String} * @default WorldWind.RELATIVE_TO_SCREEN */ this.imageRotationReference = WorldWind.RELATIVE_TO_SCREEN; /** * Indicates whether to apply this placemark's image tilt relative to the screen or the globe. * If WorldWind.RELATIVE_TO_SCREEN, this placemark's image is tilted inwards (for positive tilts) * relative to the plane of the screen, and its orientation relative to the globe changes as the view * changes. If WorldWind.RELATIVE_TO_GLOBE, this placemark's image is tilted towards the globe's surface, * and retains its orientation relative to the surface. * @type {string} * @default WorldWind.RELATIVE_TO_SCREEN */ this.imageTiltReference = WorldWind.RELATIVE_TO_SCREEN; // Internal use only. Intentionally not documented. this.activeAttributes = null; // Internal use only. Intentionally not documented. this.activeTexture = null; // Internal use only. Intentionally not documented. this.labelTexture = null; // Internal use only. Intentionally not documented. this.placePoint = new Vec3(0, 0, 0); // Cartesian point corresponding to this placemark's geographic position // Internal use only. Intentionally not documented. this.groundPoint = new Vec3(0, 0, 0); // Cartesian point corresponding to ground position below this placemark // Internal use only. Intentionally not documented. this.imageTransform = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.labelTransform = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.texCoordMatrix = Matrix.fromIdentity(); // Internal use only. Intentionally not documented. this.imageBounds = null; // Internal use only. Intentionally not documented. this.layer = null; // Internal use only. Intentionally not documented. this.depthOffset = -0.003; }
[ "function", "(", "position", ",", "eyeDistanceScaling", ",", "attributes", ")", "{", "if", "(", "!", "position", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"Placemark\"", ",", "\"constructor\"", ",", "\"missingPosition\"", ")", ")", ";", "}", "Renderable", ".", "call", "(", "this", ")", ";", "/**\n * The placemark's attributes. If null and this placemark is not highlighted, this placemark is not\n * drawn.\n * @type {PlacemarkAttributes}\n * @default see [PlacemarkAttributes]{@link PlacemarkAttributes}\n */", "this", ".", "attributes", "=", "attributes", "?", "attributes", ":", "new", "PlacemarkAttributes", "(", "null", ")", ";", "/**\n * The attributes used when this placemark's highlighted flag is true. If null and the\n * highlighted flag is true, this placemark's normal attributes are used. If they, too, are null, this\n * placemark is not drawn.\n * @type {PlacemarkAttributes}\n * @default null\n */", "this", ".", "highlightAttributes", "=", "null", ";", "/**\n * Indicates whether this placemark uses its highlight attributes rather than its normal attributes.\n * @type {Boolean}\n * @default false\n */", "this", ".", "highlighted", "=", "false", ";", "/**\n * This placemark's geographic position.\n * @type {Position}\n */", "this", ".", "position", "=", "position", ";", "/**\n * Indicates whether this placemark's size is reduced at higher eye distances. If true, this placemark's\n * size is scaled inversely proportional to the eye distance if the eye distance is greater than the\n * value of the [eyeDistanceScalingThreshold]{@link Placemark#eyeDistanceScalingThreshold} property.\n * When the eye distance is below the threshold, this placemark is scaled only according to the\n * [imageScale]{@link PlacemarkAttributes#imageScale}.\n * @type {Boolean}\n */", "this", ".", "eyeDistanceScaling", "=", "eyeDistanceScaling", ";", "/**\n * The eye distance above which to reduce the size of this placemark, in meters. If\n * [eyeDistanceScaling]{@link Placemark#eyeDistanceScaling} is true, this placemark's image, label and leader\n * line sizes are reduced as the eye distance increases beyond this threshold.\n * @type {Number}\n * @default 1e6 (meters)\n */", "this", ".", "eyeDistanceScalingThreshold", "=", "1e6", ";", "/**\n * The eye altitude above which this placemark's label is not displayed.\n * @type {number}\n */", "this", ".", "eyeDistanceScalingLabelThreshold", "=", "1.5", "*", "this", ".", "eyeDistanceScalingThreshold", ";", "/**\n * This placemark's textual label. If null, no label is drawn.\n * @type {String}\n * @default null\n */", "this", ".", "label", "=", "null", ";", "/**\n * This placemark's altitude mode. May be one of\n * <ul>\n * <li>[WorldWind.ABSOLUTE]{@link WorldWind#ABSOLUTE}</li>\n * <li>[WorldWind.RELATIVE_TO_GROUND]{@link WorldWind#RELATIVE_TO_GROUND}</li>\n * <li>[WorldWind.CLAMP_TO_GROUND]{@link WorldWind#CLAMP_TO_GROUND}</li>\n * </ul>\n * @default WorldWind.ABSOLUTE\n */", "this", ".", "altitudeMode", "=", "WorldWind", ".", "ABSOLUTE", ";", "/**\n * Indicates whether this placemark has visual priority over other shapes in the scene.\n * @type {Boolean}\n * @default false\n */", "this", ".", "alwaysOnTop", "=", "false", ";", "/**\n * Indicates whether this placemark's leader line, if any, is pickable.\n * @type {Boolean}\n * @default false\n */", "this", ".", "enableLeaderLinePicking", "=", "false", ";", "/**\n * Indicates whether this placemark's image should be re-retrieved even if it has already been retrieved.\n * Set this property to true when the image has changed but has the same image path.\n * The property is set to false when the image is re-retrieved.\n * @type {Boolean}\n */", "this", ".", "updateImage", "=", "true", ";", "/**\n * Indicates the group ID of the declutter group to include this placemark. If non-zero, this placemark\n * is decluttered relative to all other shapes within its group.\n * @type {Number}\n * @default 2\n */", "this", ".", "declutterGroup", "=", "2", ";", "/**\n * This placemark's target label visibility, a value between 0 and 1. During ordered rendering this\n * placemark modifies its [current visibility]{@link Placemark#currentVisibility} towards its target\n * visibility at the rate specified by the draw context's [fade time]{@link DrawContext#fadeTime} property.\n * The target visibility and current visibility are used to control the fading in and out of this\n * placemark's label.\n * @type {Number}\n * @default 1\n */", "this", ".", "targetVisibility", "=", "1", ";", "/**\n * This placemark's current label visibility, a value between 0 and 1. This property scales the placemark's\n * effective label opacity. It is incremented or decremented each frame according to the draw context's\n * [fade time]{@link DrawContext#fadeTime} property in order to achieve this placemark's\n * [target visibility]{@link Placemark#targetVisibility}. This current visibility and target visibility are\n * used to control the fading in and out of this placemark's label.\n * @type {Number}\n * @default 1\n * @readonly\n */", "this", ".", "currentVisibility", "=", "1", ";", "/**\n * The amount of rotation to apply to the image, measured in degrees clockwise and relative to this\n * placemark's [imageRotationReference]{@link Placemark#imageRotationReference}.\n * @type {Number}\n * @default 0\n */", "this", ".", "imageRotation", "=", "0", ";", "/**\n * The amount of tilt to apply to the image, measured in degrees away from the eye point and relative\n * to this placemark's [imageTiltReference]{@link Placemark#imageTiltReference}. While any positive or\n * negative number may be specified, values outside the range [0. 90] cause some or all of the image to\n * be clipped.\n * @type {Number}\n * @default 0\n */", "this", ".", "imageTilt", "=", "0", ";", "/**\n * Indicates whether to apply this placemark's image rotation relative to the screen or the globe.\n * If WorldWind.RELATIVE_TO_SCREEN, this placemark's image is rotated in the plane of the screen and\n * its orientation relative to the globe changes as the view changes.\n * If WorldWind.RELATIVE_TO_GLOBE, this placemark's image is rotated in a plane tangent to the globe\n * at this placemark's position and retains its orientation relative to the globe.\n * @type {String}\n * @default WorldWind.RELATIVE_TO_SCREEN\n */", "this", ".", "imageRotationReference", "=", "WorldWind", ".", "RELATIVE_TO_SCREEN", ";", "/**\n * Indicates whether to apply this placemark's image tilt relative to the screen or the globe.\n * If WorldWind.RELATIVE_TO_SCREEN, this placemark's image is tilted inwards (for positive tilts)\n * relative to the plane of the screen, and its orientation relative to the globe changes as the view\n * changes. If WorldWind.RELATIVE_TO_GLOBE, this placemark's image is tilted towards the globe's surface,\n * and retains its orientation relative to the surface.\n * @type {string}\n * @default WorldWind.RELATIVE_TO_SCREEN\n */", "this", ".", "imageTiltReference", "=", "WorldWind", ".", "RELATIVE_TO_SCREEN", ";", "// Internal use only. Intentionally not documented.", "this", ".", "activeAttributes", "=", "null", ";", "// Internal use only. Intentionally not documented.", "this", ".", "activeTexture", "=", "null", ";", "// Internal use only. Intentionally not documented.", "this", ".", "labelTexture", "=", "null", ";", "// Internal use only. Intentionally not documented.", "this", ".", "placePoint", "=", "new", "Vec3", "(", "0", ",", "0", ",", "0", ")", ";", "// Cartesian point corresponding to this placemark's geographic position", "// Internal use only. Intentionally not documented.", "this", ".", "groundPoint", "=", "new", "Vec3", "(", "0", ",", "0", ",", "0", ")", ";", "// Cartesian point corresponding to ground position below this placemark", "// Internal use only. Intentionally not documented.", "this", ".", "imageTransform", "=", "Matrix", ".", "fromIdentity", "(", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "labelTransform", "=", "Matrix", ".", "fromIdentity", "(", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "texCoordMatrix", "=", "Matrix", ".", "fromIdentity", "(", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "imageBounds", "=", "null", ";", "// Internal use only. Intentionally not documented.", "this", ".", "layer", "=", "null", ";", "// Internal use only. Intentionally not documented.", "this", ".", "depthOffset", "=", "-", "0.003", ";", "}" ]
Constructs a placemark. @alias Placemark @constructor @augments Renderable @classdesc Represents a Placemark shape. A placemark displays an image, a label and a leader line connecting the placemark's geographic position to the ground. All three of these items are optional. By default, the leader line is not pickable. See [enableLeaderLinePicking]{@link Placemark#enableLeaderLinePicking}. <p> Placemarks may be drawn with either an image or as single-color square with a specified size. When the placemark attributes indicate a valid image, the placemark's image is drawn as a rectangle in the image's original dimensions, scaled by the image scale attribute. Otherwise, the placemark is drawn as a square with width and height equal to the value of the image scale attribute, in pixels, and color equal to the image color attribute. <p> By default, placemarks participate in decluttering with a [declutterGroupID]{@link Placemark#declutterGroup} of 2. Only placemark labels are decluttered relative to other placemark labels. The placemarks themselves are optionally scaled with eye distance to achieve decluttering of the placemark as a whole. See [eyeDistanceScaling]{@link Placemark#eyeDistanceScaling}. @param {Position} position The placemark's geographic position. @param {Boolean} eyeDistanceScaling Indicates whether the size of this placemark scales with eye distance. See [eyeDistanceScalingThreshold]{@link Placemark#eyeDistanceScalingThreshold} and [eyeDistanceScalingLabelThreshold]{@link Placemark#eyeDistanceScalingLabelThreshold}. @param {PlacemarkAttributes} attributes The attributes to associate with this placemark. May be null, in which case default attributes are associated. @throws {ArgumentError} If the specified position is null or undefined.
[ "Constructs", "a", "placemark", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shapes/Placemark.js#L75-L281
10,636
NASAWorldWind/WebWorldWind
src/shapes/SurfaceSector.js
function (sector, attributes) { if (!sector) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceSector", "constructor", "missingSector")); } SurfaceShape.call(this, attributes); /** * This shape's sector. * @type {Sector} */ this._sector = sector; // The default path type for a surface sector is linear so that it represents a bounding box by default. this._pathType = WorldWind.LINEAR; }
javascript
function (sector, attributes) { if (!sector) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceSector", "constructor", "missingSector")); } SurfaceShape.call(this, attributes); /** * This shape's sector. * @type {Sector} */ this._sector = sector; // The default path type for a surface sector is linear so that it represents a bounding box by default. this._pathType = WorldWind.LINEAR; }
[ "function", "(", "sector", ",", "attributes", ")", "{", "if", "(", "!", "sector", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"SurfaceSector\"", ",", "\"constructor\"", ",", "\"missingSector\"", ")", ")", ";", "}", "SurfaceShape", ".", "call", "(", "this", ",", "attributes", ")", ";", "/**\n * This shape's sector.\n * @type {Sector}\n */", "this", ".", "_sector", "=", "sector", ";", "// The default path type for a surface sector is linear so that it represents a bounding box by default.", "this", ".", "_pathType", "=", "WorldWind", ".", "LINEAR", ";", "}" ]
Constructs a surface sector. @alias SurfaceSector @constructor @augments SurfaceShape @classdesc Represents a sector draped over the terrain surface. The sector is specified as a rectangular region in geographic coordinates. By default, a surface sector is drawn with a linear path, see {@link SurfaceShape#pathType}. <p> SurfaceSector uses the following attributes from its associated shape attributes bundle: <ul> <li>Draw interior</li> <li>Draw outline</li> <li>Interior color</li> <li>Outline color</li> <li>Outline width</li> <li>Outline stipple factor</li> <li>Outline stipple pattern</li> </ul> @param {Sector} sector This surface sector's sector. @param {ShapeAttributes} attributes The attributes to apply to this shape. May be null, in which case attributes must be set directly before the shape is drawn. @throws {ArgumentError} If the specified boundaries are null or undefined.
[ "Constructs", "a", "surface", "sector", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shapes/SurfaceSector.js#L58-L74
10,637
NASAWorldWind/WebWorldWind
src/layer/WmsLayer.js
function (config, timeString) { if (!config) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WmsLayer", "constructor", "No configuration specified.")); } var cachePath = config.service + config.layerNames + config.styleNames; if (timeString) { cachePath = cachePath + timeString; } TiledImageLayer.call(this, config.sector, config.levelZeroDelta, config.numLevels, config.format, cachePath, config.size, config.size); this.displayName = config.title; this.pickEnabled = false; this.urlBuilder = new WmsUrlBuilder(config.service, config.layerNames, config.styleNames, config.version, timeString); if (config.coordinateSystem) { this.urlBuilder.crs = config.coordinateSystem; } /** * The time string passed to this layer's constructor. * @type {String} * @readonly */ this.timeString = timeString; }
javascript
function (config, timeString) { if (!config) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "WmsLayer", "constructor", "No configuration specified.")); } var cachePath = config.service + config.layerNames + config.styleNames; if (timeString) { cachePath = cachePath + timeString; } TiledImageLayer.call(this, config.sector, config.levelZeroDelta, config.numLevels, config.format, cachePath, config.size, config.size); this.displayName = config.title; this.pickEnabled = false; this.urlBuilder = new WmsUrlBuilder(config.service, config.layerNames, config.styleNames, config.version, timeString); if (config.coordinateSystem) { this.urlBuilder.crs = config.coordinateSystem; } /** * The time string passed to this layer's constructor. * @type {String} * @readonly */ this.timeString = timeString; }
[ "function", "(", "config", ",", "timeString", ")", "{", "if", "(", "!", "config", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"WmsLayer\"", ",", "\"constructor\"", ",", "\"No configuration specified.\"", ")", ")", ";", "}", "var", "cachePath", "=", "config", ".", "service", "+", "config", ".", "layerNames", "+", "config", ".", "styleNames", ";", "if", "(", "timeString", ")", "{", "cachePath", "=", "cachePath", "+", "timeString", ";", "}", "TiledImageLayer", ".", "call", "(", "this", ",", "config", ".", "sector", ",", "config", ".", "levelZeroDelta", ",", "config", ".", "numLevels", ",", "config", ".", "format", ",", "cachePath", ",", "config", ".", "size", ",", "config", ".", "size", ")", ";", "this", ".", "displayName", "=", "config", ".", "title", ";", "this", ".", "pickEnabled", "=", "false", ";", "this", ".", "urlBuilder", "=", "new", "WmsUrlBuilder", "(", "config", ".", "service", ",", "config", ".", "layerNames", ",", "config", ".", "styleNames", ",", "config", ".", "version", ",", "timeString", ")", ";", "if", "(", "config", ".", "coordinateSystem", ")", "{", "this", ".", "urlBuilder", ".", "crs", "=", "config", ".", "coordinateSystem", ";", "}", "/**\n * The time string passed to this layer's constructor.\n * @type {String}\n * @readonly\n */", "this", ".", "timeString", "=", "timeString", ";", "}" ]
Constructs a WMS image layer. @alias WmsLayer @constructor @augments TiledImageLayer @classdesc Displays a WMS image layer. @param {{}} config Specifies configuration information for the layer. Must contain the following properties: <ul> <li>service: {String} The URL of the WMS server.</li> <li>layerNames: {String} A comma separated list of the names of the WMS layers to include in this layer.</li> <li>sector: {Sector} The sector spanned by this layer.</li> <li>levelZeroDelta: {Location} The level-zero tile delta to use for this layer.</li> <li>numLevels: {Number} The number of levels to make for this layer.</li> <li>format: {String} The mime type of the image format to request, e.g., image/png.</li> <li>size: {Number} The size in pixels of tiles for this layer.</li> <li>coordinateSystem (optional): {String} The coordinate system to use for this layer, e.g., EPSG:4326.</li> <li>styleNames (optional): {String} A comma separated list of the styles to include in this layer.</li> </ul> The function [WmsLayer.formLayerConfiguration]{@link WmsLayer#formLayerConfiguration} will create an appropriate configuration object given a {@link WmsLayerCapabilities} object. @param {String} timeString The time parameter passed to the WMS server when imagery is requested. May be null, in which case no time parameter is passed to the server. @throws {ArgumentError} If the specified configuration is null or undefined.
[ "Constructs", "a", "WMS", "image", "layer", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/layer/WmsLayer.js#L63-L92
10,638
NASAWorldWind/WebWorldWind
src/geom/BoundingBox.js
function () { /** * The box's center point. * @type {Vec3} * @default (0, 0, 0) */ this.center = new Vec3(0, 0, 0); /** * The center point of the box's bottom. (The origin of the R axis.) * @type {Vec3} * @default (-0.5, 0, 0) */ this.bottomCenter = new Vec3(-0.5, 0, 0); /** * The center point of the box's top. (The end of the R axis.) * @type {Vec3} * @default (0.5, 0, 0) */ this.topCenter = new Vec3(0.5, 0, 0); /** * The box's R axis, its longest axis. * @type {Vec3} * @default (1, 0, 0) */ this.r = new Vec3(1, 0, 0); /** * The box's S axis, its mid-length axis. * @type {Vec3} * @default (0, 1, 0) */ this.s = new Vec3(0, 1, 0); /** * The box's T axis, its shortest axis. * @type {Vec3} * @default (0, 0, 1) */ this.t = new Vec3(0, 0, 1); /** * The box's radius. (The half-length of its diagonal.) * @type {number} * @default sqrt(3) */ this.radius = Math.sqrt(3); // Internal use only. Intentionally not documented. this.tmp1 = new Vec3(0, 0, 0); this.tmp2 = new Vec3(0, 0, 0); this.tmp3 = new Vec3(0, 0, 0); // Internal use only. Intentionally not documented. this.scratchElevations = new Float64Array(9); this.scratchPoints = new Float64Array(3 * this.scratchElevations.length); }
javascript
function () { /** * The box's center point. * @type {Vec3} * @default (0, 0, 0) */ this.center = new Vec3(0, 0, 0); /** * The center point of the box's bottom. (The origin of the R axis.) * @type {Vec3} * @default (-0.5, 0, 0) */ this.bottomCenter = new Vec3(-0.5, 0, 0); /** * The center point of the box's top. (The end of the R axis.) * @type {Vec3} * @default (0.5, 0, 0) */ this.topCenter = new Vec3(0.5, 0, 0); /** * The box's R axis, its longest axis. * @type {Vec3} * @default (1, 0, 0) */ this.r = new Vec3(1, 0, 0); /** * The box's S axis, its mid-length axis. * @type {Vec3} * @default (0, 1, 0) */ this.s = new Vec3(0, 1, 0); /** * The box's T axis, its shortest axis. * @type {Vec3} * @default (0, 0, 1) */ this.t = new Vec3(0, 0, 1); /** * The box's radius. (The half-length of its diagonal.) * @type {number} * @default sqrt(3) */ this.radius = Math.sqrt(3); // Internal use only. Intentionally not documented. this.tmp1 = new Vec3(0, 0, 0); this.tmp2 = new Vec3(0, 0, 0); this.tmp3 = new Vec3(0, 0, 0); // Internal use only. Intentionally not documented. this.scratchElevations = new Float64Array(9); this.scratchPoints = new Float64Array(3 * this.scratchElevations.length); }
[ "function", "(", ")", "{", "/**\n * The box's center point.\n * @type {Vec3}\n * @default (0, 0, 0)\n */", "this", ".", "center", "=", "new", "Vec3", "(", "0", ",", "0", ",", "0", ")", ";", "/**\n * The center point of the box's bottom. (The origin of the R axis.)\n * @type {Vec3}\n * @default (-0.5, 0, 0)\n */", "this", ".", "bottomCenter", "=", "new", "Vec3", "(", "-", "0.5", ",", "0", ",", "0", ")", ";", "/**\n * The center point of the box's top. (The end of the R axis.)\n * @type {Vec3}\n * @default (0.5, 0, 0)\n */", "this", ".", "topCenter", "=", "new", "Vec3", "(", "0.5", ",", "0", ",", "0", ")", ";", "/**\n * The box's R axis, its longest axis.\n * @type {Vec3}\n * @default (1, 0, 0)\n */", "this", ".", "r", "=", "new", "Vec3", "(", "1", ",", "0", ",", "0", ")", ";", "/**\n * The box's S axis, its mid-length axis.\n * @type {Vec3}\n * @default (0, 1, 0)\n */", "this", ".", "s", "=", "new", "Vec3", "(", "0", ",", "1", ",", "0", ")", ";", "/**\n * The box's T axis, its shortest axis.\n * @type {Vec3}\n * @default (0, 0, 1)\n */", "this", ".", "t", "=", "new", "Vec3", "(", "0", ",", "0", ",", "1", ")", ";", "/**\n * The box's radius. (The half-length of its diagonal.)\n * @type {number}\n * @default sqrt(3)\n */", "this", ".", "radius", "=", "Math", ".", "sqrt", "(", "3", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "tmp1", "=", "new", "Vec3", "(", "0", ",", "0", ",", "0", ")", ";", "this", ".", "tmp2", "=", "new", "Vec3", "(", "0", ",", "0", ",", "0", ")", ";", "this", ".", "tmp3", "=", "new", "Vec3", "(", "0", ",", "0", ",", "0", ")", ";", "// Internal use only. Intentionally not documented.", "this", ".", "scratchElevations", "=", "new", "Float64Array", "(", "9", ")", ";", "this", ".", "scratchPoints", "=", "new", "Float64Array", "(", "3", "*", "this", ".", "scratchElevations", ".", "length", ")", ";", "}" ]
Constructs a unit bounding box. The unit box has its R, S and T axes aligned with the X, Y and Z axes, respectively, and has its length, width and height set to 1. @alias BoundingBox @constructor @classdesc Represents a bounding box in Cartesian coordinates. Typically used as a bounding volume.
[ "Constructs", "a", "unit", "bounding", "box", ".", "The", "unit", "box", "has", "its", "R", "S", "and", "T", "axes", "aligned", "with", "the", "X", "Y", "and", "Z", "axes", "respectively", "and", "has", "its", "length", "width", "and", "height", "set", "to", "1", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/geom/BoundingBox.js#L54-L113
10,639
NASAWorldWind/WebWorldWind
src/globe/TiledElevationCoverage.js
function (config) { if (!config) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "TiledElevationCoverage", "constructor", "missingConfig")); } if (!config.coverageSector) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "TiledElevationCoverage", "constructor", "missingSector")); } if (!config.resolution) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "TiledElevationCoverage", "constructor", "missingResolution")); } if (!config.retrievalImageFormat) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "TiledElevationCoverage", "constructor", "missingImageFormat")); } ElevationCoverage.call(this, config.resolution); var firstLevelDelta = 45, tileWidth = 256, lastLevel = LevelSet.numLevelsForResolution(firstLevelDelta / tileWidth, config.resolution), numLevels = Math.ceil(lastLevel); // match or exceed the specified resolution /** * The sector this coverage spans. * @type {Sector} * @readonly */ this.coverageSector = config.coverageSector; /** * The mime type to use when retrieving elevations. * @type {String} * @readonly */ this.retrievalImageFormat = config.retrievalImageFormat; /** * This coverage's minimum elevation in meters. * @type {Number} * @default 0 */ this.minElevation = config.minElevation || 0; /** * This coverage's maximum elevation in meters. * @type {Number} */ this.maxElevation = config.maxElevation || 0; /** * Indicates whether the data associated with this coverage is point data. A value of false * indicates that the data is area data (pixel is area). * @type {Boolean} * @default true */ this.pixelIsPoint = false; /** * The {@link LevelSet} dividing this coverage's geographic domain into a multi-resolution, hierarchical * collection of tiles. * @type {LevelSet} * @readonly */ this.levels = new LevelSet(this.coverageSector, new Location(firstLevelDelta, firstLevelDelta), numLevels, tileWidth, tileWidth); /** * Internal use only * The list of assembled tiles. * @type {Array} * @ignore */ this.currentTiles = []; /** * Internal use only * A scratch sector for use in computations. * @type {Sector} * @ignore */ this.currentSector = new Sector(0, 0, 0, 0); /** * Internal use only * A cache of elevation tiles. * @type {MemoryCache} * @ignore */ this.tileCache = new MemoryCache(1000000, 800000); /** * Internal use only * A cache of elevations. * @type {MemoryCache} * @ignore */ this.imageCache = new MemoryCache(10000000, 8000000); /** * Controls how many concurrent tile requests are allowed for this coverage. * @type {Number} * @default WorldWind.configuration.coverageRetrievalQueueSize */ this.retrievalQueueSize = WorldWind.configuration.coverageRetrievalQueueSize; /** * Internal use only * The list of elevation retrievals in progress. * @type {Array} * @ignore */ this.currentRetrievals = []; /** * Internal use only * The list of resources pending acquisition. * @type {Array} * @ignore */ this.absentResourceList = new AbsentResourceList(3, 5e3); /** * Internal use only * The factory to create URLs for data requests. This property is typically set in the constructor of child * classes. See {@link WcsUrlBuilder} for a concrete example. * @type {UrlBuilder} * @ignore */ this.urlBuilder = config.urlBuilder || null; }
javascript
function (config) { if (!config) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "TiledElevationCoverage", "constructor", "missingConfig")); } if (!config.coverageSector) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "TiledElevationCoverage", "constructor", "missingSector")); } if (!config.resolution) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "TiledElevationCoverage", "constructor", "missingResolution")); } if (!config.retrievalImageFormat) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "TiledElevationCoverage", "constructor", "missingImageFormat")); } ElevationCoverage.call(this, config.resolution); var firstLevelDelta = 45, tileWidth = 256, lastLevel = LevelSet.numLevelsForResolution(firstLevelDelta / tileWidth, config.resolution), numLevels = Math.ceil(lastLevel); // match or exceed the specified resolution /** * The sector this coverage spans. * @type {Sector} * @readonly */ this.coverageSector = config.coverageSector; /** * The mime type to use when retrieving elevations. * @type {String} * @readonly */ this.retrievalImageFormat = config.retrievalImageFormat; /** * This coverage's minimum elevation in meters. * @type {Number} * @default 0 */ this.minElevation = config.minElevation || 0; /** * This coverage's maximum elevation in meters. * @type {Number} */ this.maxElevation = config.maxElevation || 0; /** * Indicates whether the data associated with this coverage is point data. A value of false * indicates that the data is area data (pixel is area). * @type {Boolean} * @default true */ this.pixelIsPoint = false; /** * The {@link LevelSet} dividing this coverage's geographic domain into a multi-resolution, hierarchical * collection of tiles. * @type {LevelSet} * @readonly */ this.levels = new LevelSet(this.coverageSector, new Location(firstLevelDelta, firstLevelDelta), numLevels, tileWidth, tileWidth); /** * Internal use only * The list of assembled tiles. * @type {Array} * @ignore */ this.currentTiles = []; /** * Internal use only * A scratch sector for use in computations. * @type {Sector} * @ignore */ this.currentSector = new Sector(0, 0, 0, 0); /** * Internal use only * A cache of elevation tiles. * @type {MemoryCache} * @ignore */ this.tileCache = new MemoryCache(1000000, 800000); /** * Internal use only * A cache of elevations. * @type {MemoryCache} * @ignore */ this.imageCache = new MemoryCache(10000000, 8000000); /** * Controls how many concurrent tile requests are allowed for this coverage. * @type {Number} * @default WorldWind.configuration.coverageRetrievalQueueSize */ this.retrievalQueueSize = WorldWind.configuration.coverageRetrievalQueueSize; /** * Internal use only * The list of elevation retrievals in progress. * @type {Array} * @ignore */ this.currentRetrievals = []; /** * Internal use only * The list of resources pending acquisition. * @type {Array} * @ignore */ this.absentResourceList = new AbsentResourceList(3, 5e3); /** * Internal use only * The factory to create URLs for data requests. This property is typically set in the constructor of child * classes. See {@link WcsUrlBuilder} for a concrete example. * @type {UrlBuilder} * @ignore */ this.urlBuilder = config.urlBuilder || null; }
[ "function", "(", "config", ")", "{", "if", "(", "!", "config", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"TiledElevationCoverage\"", ",", "\"constructor\"", ",", "\"missingConfig\"", ")", ")", ";", "}", "if", "(", "!", "config", ".", "coverageSector", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"TiledElevationCoverage\"", ",", "\"constructor\"", ",", "\"missingSector\"", ")", ")", ";", "}", "if", "(", "!", "config", ".", "resolution", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"TiledElevationCoverage\"", ",", "\"constructor\"", ",", "\"missingResolution\"", ")", ")", ";", "}", "if", "(", "!", "config", ".", "retrievalImageFormat", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"TiledElevationCoverage\"", ",", "\"constructor\"", ",", "\"missingImageFormat\"", ")", ")", ";", "}", "ElevationCoverage", ".", "call", "(", "this", ",", "config", ".", "resolution", ")", ";", "var", "firstLevelDelta", "=", "45", ",", "tileWidth", "=", "256", ",", "lastLevel", "=", "LevelSet", ".", "numLevelsForResolution", "(", "firstLevelDelta", "/", "tileWidth", ",", "config", ".", "resolution", ")", ",", "numLevels", "=", "Math", ".", "ceil", "(", "lastLevel", ")", ";", "// match or exceed the specified resolution", "/**\n * The sector this coverage spans.\n * @type {Sector}\n * @readonly\n */", "this", ".", "coverageSector", "=", "config", ".", "coverageSector", ";", "/**\n * The mime type to use when retrieving elevations.\n * @type {String}\n * @readonly\n */", "this", ".", "retrievalImageFormat", "=", "config", ".", "retrievalImageFormat", ";", "/**\n * This coverage's minimum elevation in meters.\n * @type {Number}\n * @default 0\n */", "this", ".", "minElevation", "=", "config", ".", "minElevation", "||", "0", ";", "/**\n * This coverage's maximum elevation in meters.\n * @type {Number}\n */", "this", ".", "maxElevation", "=", "config", ".", "maxElevation", "||", "0", ";", "/**\n * Indicates whether the data associated with this coverage is point data. A value of false\n * indicates that the data is area data (pixel is area).\n * @type {Boolean}\n * @default true\n */", "this", ".", "pixelIsPoint", "=", "false", ";", "/**\n * The {@link LevelSet} dividing this coverage's geographic domain into a multi-resolution, hierarchical\n * collection of tiles.\n * @type {LevelSet}\n * @readonly\n */", "this", ".", "levels", "=", "new", "LevelSet", "(", "this", ".", "coverageSector", ",", "new", "Location", "(", "firstLevelDelta", ",", "firstLevelDelta", ")", ",", "numLevels", ",", "tileWidth", ",", "tileWidth", ")", ";", "/**\n * Internal use only\n * The list of assembled tiles.\n * @type {Array}\n * @ignore\n */", "this", ".", "currentTiles", "=", "[", "]", ";", "/**\n * Internal use only\n * A scratch sector for use in computations.\n * @type {Sector}\n * @ignore\n */", "this", ".", "currentSector", "=", "new", "Sector", "(", "0", ",", "0", ",", "0", ",", "0", ")", ";", "/**\n * Internal use only\n * A cache of elevation tiles.\n * @type {MemoryCache}\n * @ignore\n */", "this", ".", "tileCache", "=", "new", "MemoryCache", "(", "1000000", ",", "800000", ")", ";", "/**\n * Internal use only\n * A cache of elevations.\n * @type {MemoryCache}\n * @ignore\n */", "this", ".", "imageCache", "=", "new", "MemoryCache", "(", "10000000", ",", "8000000", ")", ";", "/**\n * Controls how many concurrent tile requests are allowed for this coverage.\n * @type {Number}\n * @default WorldWind.configuration.coverageRetrievalQueueSize\n */", "this", ".", "retrievalQueueSize", "=", "WorldWind", ".", "configuration", ".", "coverageRetrievalQueueSize", ";", "/**\n * Internal use only\n * The list of elevation retrievals in progress.\n * @type {Array}\n * @ignore\n */", "this", ".", "currentRetrievals", "=", "[", "]", ";", "/**\n * Internal use only\n * The list of resources pending acquisition.\n * @type {Array}\n * @ignore\n */", "this", ".", "absentResourceList", "=", "new", "AbsentResourceList", "(", "3", ",", "5e3", ")", ";", "/**\n * Internal use only\n * The factory to create URLs for data requests. This property is typically set in the constructor of child\n * classes. See {@link WcsUrlBuilder} for a concrete example.\n * @type {UrlBuilder}\n * @ignore\n */", "this", ".", "urlBuilder", "=", "config", ".", "urlBuilder", "||", "null", ";", "}" ]
Constructs a TiledElevationCoverage @alias TiledElevationCoverage @constructor @classdesc Represents the elevations for an area, often but not necessarily the whole globe. @param {{}} config Configuration properties for the coverage: <ul> <li>coverageSector: {Sector} The sector this coverage spans.</li> <li>resolution: {Number} The resolution of the coverage, in degrees. (To compute degrees from meters, divide the number of meters by the globe's radius to obtain radians and convert the result to degrees.)</li> <li>retrievalImageFormat: {String} The mime type of the elevation data retrieved by this coverage.</li> <li>minElevation (optional): {Number} The coverage's minimum elevation in meters.</li> <li>maxElevation (optional): {Number} Te coverage's maximum elevation in meters.</li> <li>urlBuilder (optional): {UrlBuilder} The factory to create URLs for elevation data requests.</li> <ul> @throws {ArgumentError} If any required configuration parameter is null or undefined.
[ "Constructs", "a", "TiledElevationCoverage" ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/globe/TiledElevationCoverage.js#L63-L198
10,640
NASAWorldWind/WebWorldWind
src/layer/WmtsLayerTile.js
function (sector, tileMatrix, row, column, imagePath) { this.sector = sector; this.tileMatrix = tileMatrix; this.row = row; this.column = column; this.imagePath = imagePath; this.texelSize = (sector.deltaLatitude() * Angle.DEGREES_TO_RADIANS) / tileMatrix.tileHeight; this.tileKey = tileMatrix.levelNumber.toString() + "." + row.toString() + "." + column.toString(); this.gpuCacheKey = imagePath; }
javascript
function (sector, tileMatrix, row, column, imagePath) { this.sector = sector; this.tileMatrix = tileMatrix; this.row = row; this.column = column; this.imagePath = imagePath; this.texelSize = (sector.deltaLatitude() * Angle.DEGREES_TO_RADIANS) / tileMatrix.tileHeight; this.tileKey = tileMatrix.levelNumber.toString() + "." + row.toString() + "." + column.toString(); this.gpuCacheKey = imagePath; }
[ "function", "(", "sector", ",", "tileMatrix", ",", "row", ",", "column", ",", "imagePath", ")", "{", "this", ".", "sector", "=", "sector", ";", "this", ".", "tileMatrix", "=", "tileMatrix", ";", "this", ".", "row", "=", "row", ";", "this", ".", "column", "=", "column", ";", "this", ".", "imagePath", "=", "imagePath", ";", "this", ".", "texelSize", "=", "(", "sector", ".", "deltaLatitude", "(", ")", "*", "Angle", ".", "DEGREES_TO_RADIANS", ")", "/", "tileMatrix", ".", "tileHeight", ";", "this", ".", "tileKey", "=", "tileMatrix", ".", "levelNumber", ".", "toString", "(", ")", "+", "\".\"", "+", "row", ".", "toString", "(", ")", "+", "\".\"", "+", "column", ".", "toString", "(", ")", ";", "this", ".", "gpuCacheKey", "=", "imagePath", ";", "}" ]
This is an internal class and is intentionally not documented.
[ "This", "is", "an", "internal", "class", "and", "is", "intentionally", "not", "documented", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/layer/WmtsLayerTile.js#L34-L46
10,641
NASAWorldWind/WebWorldWind
src/render/FramebufferTile.js
function (sector, level, row, column, cacheKey) { if (!cacheKey || (cacheKey.length < 1)) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "FramebufferTile", "constructor", "The specified cache name is null, undefined or zero length.")); } TextureTile.call(this, sector, level, row, column); // args are checked in the superclass' constructor // Assign the cacheKey as the gpuCacheKey (inherited from TextureTile). this.gpuCacheKey = cacheKey; // Internal. Intentionally not documented. this.textureTransform = Matrix.fromIdentity().setToUnitYFlip(); // Internal. Intentionally not documented. this.mustClear = true; }
javascript
function (sector, level, row, column, cacheKey) { if (!cacheKey || (cacheKey.length < 1)) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "FramebufferTile", "constructor", "The specified cache name is null, undefined or zero length.")); } TextureTile.call(this, sector, level, row, column); // args are checked in the superclass' constructor // Assign the cacheKey as the gpuCacheKey (inherited from TextureTile). this.gpuCacheKey = cacheKey; // Internal. Intentionally not documented. this.textureTransform = Matrix.fromIdentity().setToUnitYFlip(); // Internal. Intentionally not documented. this.mustClear = true; }
[ "function", "(", "sector", ",", "level", ",", "row", ",", "column", ",", "cacheKey", ")", "{", "if", "(", "!", "cacheKey", "||", "(", "cacheKey", ".", "length", "<", "1", ")", ")", "{", "throw", "new", "ArgumentError", "(", "Logger", ".", "logMessage", "(", "Logger", ".", "LEVEL_SEVERE", ",", "\"FramebufferTile\"", ",", "\"constructor\"", ",", "\"The specified cache name is null, undefined or zero length.\"", ")", ")", ";", "}", "TextureTile", ".", "call", "(", "this", ",", "sector", ",", "level", ",", "row", ",", "column", ")", ";", "// args are checked in the superclass' constructor", "// Assign the cacheKey as the gpuCacheKey (inherited from TextureTile).", "this", ".", "gpuCacheKey", "=", "cacheKey", ";", "// Internal. Intentionally not documented.", "this", ".", "textureTransform", "=", "Matrix", ".", "fromIdentity", "(", ")", ".", "setToUnitYFlip", "(", ")", ";", "// Internal. Intentionally not documented.", "this", ".", "mustClear", "=", "true", ";", "}" ]
Constructs a framebuffer tile. @alias FramebufferTile @constructor @augments TextureTile @classdesc Represents a WebGL framebuffer applied to a portion of a globe's terrain. The framebuffer's width and height in pixels are equal to this tile's [tileWidth]{@link FramebufferTile#tileWidth} and [tileHeight]{@link FramebufferTile#tileHeight}, respectively. The framebuffer can be made active by calling [bindFramebuffer]{@link FramebufferTile#bindFramebuffer}. Color fragments written to this tile's framebuffer can then be drawn on the terrain surface using a [SurfaceTileRenderer]{@link SurfaceTileRenderer}. <p> This class is meant to be used internally. Applications typically do not interact with this class. @param {Sector} sector The sector this tile covers. @param {Level} level The level this tile is associated with. @param {Number} row This tile's row in the associated level. @param {Number} column This tile's column in the associated level. @param {String} cacheKey A string uniquely identifying this tile relative to other tiles. @throws {ArgumentError} If the specified sector or level is null or undefined, the row or column arguments are less than zero, or the cache name is null, undefined or empty.
[ "Constructs", "a", "framebuffer", "tile", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/render/FramebufferTile.js#L57-L74
10,642
NASAWorldWind/WebWorldWind
examples/Measurements.js
doCalc
function doCalc() { var distance = lengthMeasurer.getLength(pathPositions, false, WorldWind.GREAT_CIRCLE); var terrainDistance = lengthMeasurer.getLength(pathPositions, true, WorldWind.GREAT_CIRCLE); var geographicDistance = lengthMeasurer.getGeographicDistance(pathPositions, WorldWind.GREAT_CIRCLE); var area = areaMeasurer.getArea(pathPositions, false); var terrainArea = areaMeasurer.getArea(pathPositions, true); // Display the results. geoDistSpan.textContent = (geographicDistance / 1e3).toFixed(3); distSpan.textContent = (distance / 1e3).toFixed(3); terrainDistSpan.textContent = (terrainDistance / 1e3).toFixed(3); projectedAreaSpan.textContent = (area / 1e6).toFixed(3); terrainAreaSpan.textContent = (terrainArea / 1e6).toFixed(3); }
javascript
function doCalc() { var distance = lengthMeasurer.getLength(pathPositions, false, WorldWind.GREAT_CIRCLE); var terrainDistance = lengthMeasurer.getLength(pathPositions, true, WorldWind.GREAT_CIRCLE); var geographicDistance = lengthMeasurer.getGeographicDistance(pathPositions, WorldWind.GREAT_CIRCLE); var area = areaMeasurer.getArea(pathPositions, false); var terrainArea = areaMeasurer.getArea(pathPositions, true); // Display the results. geoDistSpan.textContent = (geographicDistance / 1e3).toFixed(3); distSpan.textContent = (distance / 1e3).toFixed(3); terrainDistSpan.textContent = (terrainDistance / 1e3).toFixed(3); projectedAreaSpan.textContent = (area / 1e6).toFixed(3); terrainAreaSpan.textContent = (terrainArea / 1e6).toFixed(3); }
[ "function", "doCalc", "(", ")", "{", "var", "distance", "=", "lengthMeasurer", ".", "getLength", "(", "pathPositions", ",", "false", ",", "WorldWind", ".", "GREAT_CIRCLE", ")", ";", "var", "terrainDistance", "=", "lengthMeasurer", ".", "getLength", "(", "pathPositions", ",", "true", ",", "WorldWind", ".", "GREAT_CIRCLE", ")", ";", "var", "geographicDistance", "=", "lengthMeasurer", ".", "getGeographicDistance", "(", "pathPositions", ",", "WorldWind", ".", "GREAT_CIRCLE", ")", ";", "var", "area", "=", "areaMeasurer", ".", "getArea", "(", "pathPositions", ",", "false", ")", ";", "var", "terrainArea", "=", "areaMeasurer", ".", "getArea", "(", "pathPositions", ",", "true", ")", ";", "// Display the results.", "geoDistSpan", ".", "textContent", "=", "(", "geographicDistance", "/", "1e3", ")", ".", "toFixed", "(", "3", ")", ";", "distSpan", ".", "textContent", "=", "(", "distance", "/", "1e3", ")", ".", "toFixed", "(", "3", ")", ";", "terrainDistSpan", ".", "textContent", "=", "(", "terrainDistance", "/", "1e3", ")", ".", "toFixed", "(", "3", ")", ";", "projectedAreaSpan", ".", "textContent", "=", "(", "area", "/", "1e6", ")", ".", "toFixed", "(", "3", ")", ";", "terrainAreaSpan", ".", "textContent", "=", "(", "terrainArea", "/", "1e6", ")", ".", "toFixed", "(", "3", ")", ";", "}" ]
Calculate the length and area measurements of the path defined before.
[ "Calculate", "the", "length", "and", "area", "measurements", "of", "the", "path", "defined", "before", "." ]
399daee66deded581a2d1067a2ac04232c954b8f
https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/examples/Measurements.js#L93-L106
10,643
objectivehtml/FlipClock
src/flipclock/js/libs/timer.js
function(callback) { this.factory.running = false; this._clearInterval(callback); this.callback(this.callbacks.stop); this.callback(callback); }
javascript
function(callback) { this.factory.running = false; this._clearInterval(callback); this.callback(this.callbacks.stop); this.callback(callback); }
[ "function", "(", "callback", ")", "{", "this", ".", "factory", ".", "running", "=", "false", ";", "this", ".", "_clearInterval", "(", "callback", ")", ";", "this", ".", "callback", "(", "this", ".", "callbacks", ".", "stop", ")", ";", "this", ".", "callback", "(", "callback", ")", ";", "}" ]
This method is stops the timer @param callback A function that is called once the timer is destroyed @return void
[ "This", "method", "is", "stops", "the", "timer" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/timer.js#L129-L134
10,644
objectivehtml/FlipClock
src/flipclock/js/libs/timer.js
function(callback) { var t = this; t._interval(callback); t.timer = setInterval(function() { t._interval(callback); }, this.interval); }
javascript
function(callback) { var t = this; t._interval(callback); t.timer = setInterval(function() { t._interval(callback); }, this.interval); }
[ "function", "(", "callback", ")", "{", "var", "t", "=", "this", ";", "t", ".", "_interval", "(", "callback", ")", ";", "t", ".", "timer", "=", "setInterval", "(", "function", "(", ")", "{", "t", ".", "_interval", "(", "callback", ")", ";", "}", ",", "this", ".", "interval", ")", ";", "}" ]
This sets the timer interval @param callback A function that is called once the timer is destroyed @return void
[ "This", "sets", "the", "timer", "interval" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/timer.js#L191-L199
10,645
objectivehtml/FlipClock
src/flipclock/js/libs/face.js
function(digit) { var obj = this.createList(digit, { classes: { active: this.factory.classes.active, before: this.factory.classes.before, flip: this.factory.classes.flip } }); this.appendDigitToClock(obj); }
javascript
function(digit) { var obj = this.createList(digit, { classes: { active: this.factory.classes.active, before: this.factory.classes.before, flip: this.factory.classes.flip } }); this.appendDigitToClock(obj); }
[ "function", "(", "digit", ")", "{", "var", "obj", "=", "this", ".", "createList", "(", "digit", ",", "{", "classes", ":", "{", "active", ":", "this", ".", "factory", ".", "classes", ".", "active", ",", "before", ":", "this", ".", "factory", ".", "classes", ".", "before", ",", "flip", ":", "this", ".", "factory", ".", "classes", ".", "flip", "}", "}", ")", ";", "this", ".", "appendDigitToClock", "(", "obj", ")", ";", "}" ]
Add a digit to the clock face
[ "Add", "a", "digit", "to", "the", "clock", "face" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/face.js#L160-L170
10,646
objectivehtml/FlipClock
src/flipclock/js/libs/factory.js
function(name) { var lang; if(FlipClock.Lang[name.ucfirst()]) { lang = FlipClock.Lang[name.ucfirst()]; } else if(FlipClock.Lang[name]) { lang = FlipClock.Lang[name]; } else { lang = FlipClock.Lang[this.defaultLanguage]; } return this.lang = lang; }
javascript
function(name) { var lang; if(FlipClock.Lang[name.ucfirst()]) { lang = FlipClock.Lang[name.ucfirst()]; } else if(FlipClock.Lang[name]) { lang = FlipClock.Lang[name]; } else { lang = FlipClock.Lang[this.defaultLanguage]; } return this.lang = lang; }
[ "function", "(", "name", ")", "{", "var", "lang", ";", "if", "(", "FlipClock", ".", "Lang", "[", "name", ".", "ucfirst", "(", ")", "]", ")", "{", "lang", "=", "FlipClock", ".", "Lang", "[", "name", ".", "ucfirst", "(", ")", "]", ";", "}", "else", "if", "(", "FlipClock", ".", "Lang", "[", "name", "]", ")", "{", "lang", "=", "FlipClock", ".", "Lang", "[", "name", "]", ";", "}", "else", "{", "lang", "=", "FlipClock", ".", "Lang", "[", "this", ".", "defaultLanguage", "]", ";", "}", "return", "this", ".", "lang", "=", "lang", ";", "}" ]
Load the FlipClock.Lang object @param object The name of the language to load
[ "Load", "the", "FlipClock", ".", "Lang", "object" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/factory.js#L245-L259
10,647
objectivehtml/FlipClock
src/flipclock/js/libs/factory.js
function(callback) { var t = this; if(!t.running && (!t.countdown || t.countdown && t.time.time > 0)) { t.face.start(t.time); t.timer.start(function() { t.flip(); if(typeof callback === "function") { callback(); } }); } else { t.log('Trying to start timer when countdown already at 0'); } }
javascript
function(callback) { var t = this; if(!t.running && (!t.countdown || t.countdown && t.time.time > 0)) { t.face.start(t.time); t.timer.start(function() { t.flip(); if(typeof callback === "function") { callback(); } }); } else { t.log('Trying to start timer when countdown already at 0'); } }
[ "function", "(", "callback", ")", "{", "var", "t", "=", "this", ";", "if", "(", "!", "t", ".", "running", "&&", "(", "!", "t", ".", "countdown", "||", "t", ".", "countdown", "&&", "t", ".", "time", ".", "time", ">", "0", ")", ")", "{", "t", ".", "face", ".", "start", "(", "t", ".", "time", ")", ";", "t", ".", "timer", ".", "start", "(", "function", "(", ")", "{", "t", ".", "flip", "(", ")", ";", "if", "(", "typeof", "callback", "===", "\"function\"", ")", "{", "callback", "(", ")", ";", "}", "}", ")", ";", "}", "else", "{", "t", ".", "log", "(", "'Trying to start timer when countdown already at 0'", ")", ";", "}", "}" ]
Starts the clock
[ "Starts", "the", "clock" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/factory.js#L293-L309
10,648
objectivehtml/FlipClock
src/flipclock/js/libs/core.js
function(_default, options) { if(typeof _default !== "object") { _default = {}; } if(typeof options !== "object") { options = {}; } this.setOptions($.extend(true, {}, _default, options)); }
javascript
function(_default, options) { if(typeof _default !== "object") { _default = {}; } if(typeof options !== "object") { options = {}; } this.setOptions($.extend(true, {}, _default, options)); }
[ "function", "(", "_default", ",", "options", ")", "{", "if", "(", "typeof", "_default", "!==", "\"object\"", ")", "{", "_default", "=", "{", "}", ";", "}", "if", "(", "typeof", "options", "!==", "\"object\"", ")", "{", "options", "=", "{", "}", ";", "}", "this", ".", "setOptions", "(", "$", ".", "extend", "(", "true", ",", "{", "}", ",", "_default", ",", "options", ")", ")", ";", "}" ]
Sets the default options @param object The default options @param object The override options
[ "Sets", "the", "default", "options" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/core.js#L69-L77
10,649
objectivehtml/FlipClock
src/flipclock/js/libs/core.js
function(method) { if(typeof method === "function") { var args = []; for(var x = 1; x <= arguments.length; x++) { if(arguments[x]) { args.push(arguments[x]); } } method.apply(this, args); } }
javascript
function(method) { if(typeof method === "function") { var args = []; for(var x = 1; x <= arguments.length; x++) { if(arguments[x]) { args.push(arguments[x]); } } method.apply(this, args); } }
[ "function", "(", "method", ")", "{", "if", "(", "typeof", "method", "===", "\"function\"", ")", "{", "var", "args", "=", "[", "]", ";", "for", "(", "var", "x", "=", "1", ";", "x", "<=", "arguments", ".", "length", ";", "x", "++", ")", "{", "if", "(", "arguments", "[", "x", "]", ")", "{", "args", ".", "push", "(", "arguments", "[", "x", "]", ")", ";", "}", "}", "method", ".", "apply", "(", "this", ",", "args", ")", ";", "}", "}" ]
Delegates the callback to the defined method @param object The default options @param object The override options
[ "Delegates", "the", "callback", "to", "the", "defined", "method" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/core.js#L86-L98
10,650
objectivehtml/FlipClock
src/flipclock/js/libs/time.js
function(str) { var data = []; str = str.toString(); for(var x = 0;x < str.length; x++) { if(str[x].match(/^\d*$/g)) { data.push(str[x]); } } return data; }
javascript
function(str) { var data = []; str = str.toString(); for(var x = 0;x < str.length; x++) { if(str[x].match(/^\d*$/g)) { data.push(str[x]); } } return data; }
[ "function", "(", "str", ")", "{", "var", "data", "=", "[", "]", ";", "str", "=", "str", ".", "toString", "(", ")", ";", "for", "(", "var", "x", "=", "0", ";", "x", "<", "str", ".", "length", ";", "x", "++", ")", "{", "if", "(", "str", "[", "x", "]", ".", "match", "(", "/", "^\\d*$", "/", "g", ")", ")", "{", "data", ".", "push", "(", "str", "[", "x", "]", ")", ";", "}", "}", "return", "data", ";", "}" ]
Convert a string or integer to an array of digits @param mixed String or Integer of digits @return array An array of digits
[ "Convert", "a", "string", "or", "integer", "to", "an", "array", "of", "digits" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/time.js#L77-L89
10,651
objectivehtml/FlipClock
src/flipclock/js/libs/time.js
function(i) { var timeStr = this.toString(); var length = timeStr.length; if(timeStr[length - i]) { return timeStr[length - i]; } return false; }
javascript
function(i) { var timeStr = this.toString(); var length = timeStr.length; if(timeStr[length - i]) { return timeStr[length - i]; } return false; }
[ "function", "(", "i", ")", "{", "var", "timeStr", "=", "this", ".", "toString", "(", ")", ";", "var", "length", "=", "timeStr", ".", "length", ";", "if", "(", "timeStr", "[", "length", "-", "i", "]", ")", "{", "return", "timeStr", "[", "length", "-", "i", "]", ";", "}", "return", "false", ";", "}" ]
Get a specific digit from the time integer @param int The specific digit to select from the time @return mixed Returns FALSE if no digit is found, otherwise the method returns the defined digit
[ "Get", "a", "specific", "digit", "from", "the", "time", "integer" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/time.js#L99-L108
10,652
objectivehtml/FlipClock
src/flipclock/js/libs/time.js
function(obj) { var data = []; $.each(obj, function(i, value) { value = value.toString(); if(value.length == 1) { value = '0'+value; } for(var x = 0; x < value.length; x++) { data.push(value.charAt(x)); } }); if(data.length > this.minimumDigits) { this.minimumDigits = data.length; } if(this.minimumDigits > data.length) { for(var x = data.length; x < this.minimumDigits; x++) { data.unshift('0'); } } return data; }
javascript
function(obj) { var data = []; $.each(obj, function(i, value) { value = value.toString(); if(value.length == 1) { value = '0'+value; } for(var x = 0; x < value.length; x++) { data.push(value.charAt(x)); } }); if(data.length > this.minimumDigits) { this.minimumDigits = data.length; } if(this.minimumDigits > data.length) { for(var x = data.length; x < this.minimumDigits; x++) { data.unshift('0'); } } return data; }
[ "function", "(", "obj", ")", "{", "var", "data", "=", "[", "]", ";", "$", ".", "each", "(", "obj", ",", "function", "(", "i", ",", "value", ")", "{", "value", "=", "value", ".", "toString", "(", ")", ";", "if", "(", "value", ".", "length", "==", "1", ")", "{", "value", "=", "'0'", "+", "value", ";", "}", "for", "(", "var", "x", "=", "0", ";", "x", "<", "value", ".", "length", ";", "x", "++", ")", "{", "data", ".", "push", "(", "value", ".", "charAt", "(", "x", ")", ")", ";", "}", "}", ")", ";", "if", "(", "data", ".", "length", ">", "this", ".", "minimumDigits", ")", "{", "this", ".", "minimumDigits", "=", "data", ".", "length", ";", "}", "if", "(", "this", ".", "minimumDigits", ">", "data", ".", "length", ")", "{", "for", "(", "var", "x", "=", "data", ".", "length", ";", "x", "<", "this", ".", "minimumDigits", ";", "x", "++", ")", "{", "data", ".", "unshift", "(", "'0'", ")", ";", "}", "}", "return", "data", ";", "}" ]
Formats any array of digits into a valid array of digits @param mixed An array of digits @return array An array of digits
[ "Formats", "any", "array", "of", "digits", "into", "a", "valid", "array", "of", "digits" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/time.js#L117-L143
10,653
objectivehtml/FlipClock
src/flipclock/js/libs/time.js
function(includeSeconds) { var digits = [ this.getDays(), this.getHours(true), this.getMinutes(true) ]; if(includeSeconds) { digits.push(this.getSeconds(true)); } return this.digitize(digits); }
javascript
function(includeSeconds) { var digits = [ this.getDays(), this.getHours(true), this.getMinutes(true) ]; if(includeSeconds) { digits.push(this.getSeconds(true)); } return this.digitize(digits); }
[ "function", "(", "includeSeconds", ")", "{", "var", "digits", "=", "[", "this", ".", "getDays", "(", ")", ",", "this", ".", "getHours", "(", "true", ")", ",", "this", ".", "getMinutes", "(", "true", ")", "]", ";", "if", "(", "includeSeconds", ")", "{", "digits", ".", "push", "(", "this", ".", "getSeconds", "(", "true", ")", ")", ";", "}", "return", "this", ".", "digitize", "(", "digits", ")", ";", "}" ]
Gets a digitized daily counter @return object Returns a digitized object
[ "Gets", "a", "digitized", "daily", "counter" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/time.js#L165-L177
10,654
objectivehtml/FlipClock
src/flipclock/js/libs/time.js
function(date) { if(!date) { date = new Date(); } if (this.time instanceof Date) { if (this.factory.countdown) { return Math.max(this.time.getTime()/1000 - date.getTime()/1000,0); } else { return date.getTime()/1000 - this.time.getTime()/1000 ; } } else { return this.time; } }
javascript
function(date) { if(!date) { date = new Date(); } if (this.time instanceof Date) { if (this.factory.countdown) { return Math.max(this.time.getTime()/1000 - date.getTime()/1000,0); } else { return date.getTime()/1000 - this.time.getTime()/1000 ; } } else { return this.time; } }
[ "function", "(", "date", ")", "{", "if", "(", "!", "date", ")", "{", "date", "=", "new", "Date", "(", ")", ";", "}", "if", "(", "this", ".", "time", "instanceof", "Date", ")", "{", "if", "(", "this", ".", "factory", ".", "countdown", ")", "{", "return", "Math", ".", "max", "(", "this", ".", "time", ".", "getTime", "(", ")", "/", "1000", "-", "date", ".", "getTime", "(", ")", "/", "1000", ",", "0", ")", ";", "}", "else", "{", "return", "date", ".", "getTime", "(", ")", "/", "1000", "-", "this", ".", "time", ".", "getTime", "(", ")", "/", "1000", ";", "}", "}", "else", "{", "return", "this", ".", "time", ";", "}", "}" ]
Gets time count in seconds regardless of if targetting date or not. @return int Returns a floored integer
[ "Gets", "time", "count", "in", "seconds", "regardless", "of", "if", "targetting", "date", "or", "not", "." ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/time.js#L302-L316
10,655
objectivehtml/FlipClock
src/flipclock/js/libs/time.js
function(totalDigits, digits) { var total = 0; var newArray = []; $.each(digits, function(i, digit) { if(i < totalDigits) { total += parseInt(digits[i], 10); } else { newArray.push(digits[i]); } }); if(total === 0) { return newArray; } return digits; }
javascript
function(totalDigits, digits) { var total = 0; var newArray = []; $.each(digits, function(i, digit) { if(i < totalDigits) { total += parseInt(digits[i], 10); } else { newArray.push(digits[i]); } }); if(total === 0) { return newArray; } return digits; }
[ "function", "(", "totalDigits", ",", "digits", ")", "{", "var", "total", "=", "0", ";", "var", "newArray", "=", "[", "]", ";", "$", ".", "each", "(", "digits", ",", "function", "(", "i", ",", "digit", ")", "{", "if", "(", "i", "<", "totalDigits", ")", "{", "total", "+=", "parseInt", "(", "digits", "[", "i", "]", ",", "10", ")", ";", "}", "else", "{", "newArray", ".", "push", "(", "digits", "[", "i", "]", ")", ";", "}", "}", ")", ";", "if", "(", "total", "===", "0", ")", "{", "return", "newArray", ";", "}", "return", "digits", ";", "}" ]
Removes a specific number of leading zeros from the array. This method prevents you from removing too many digits, even if you try. @param int Total number of digits to remove @return array An array of digits
[ "Removes", "a", "specific", "number", "of", "leading", "zeros", "from", "the", "array", ".", "This", "method", "prevents", "you", "from", "removing", "too", "many", "digits", "even", "if", "you", "try", "." ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/time.js#L398-L416
10,656
objectivehtml/FlipClock
src/flipclock/js/libs/time.js
function(x) { if(this.time instanceof Date) { this.time.setSeconds(this.time.getSeconds() + x); } else { this.time += x; } }
javascript
function(x) { if(this.time instanceof Date) { this.time.setSeconds(this.time.getSeconds() + x); } else { this.time += x; } }
[ "function", "(", "x", ")", "{", "if", "(", "this", ".", "time", "instanceof", "Date", ")", "{", "this", ".", "time", ".", "setSeconds", "(", "this", ".", "time", ".", "getSeconds", "(", ")", "+", "x", ")", ";", "}", "else", "{", "this", ".", "time", "+=", "x", ";", "}", "}" ]
Adds X second to the current time
[ "Adds", "X", "second", "to", "the", "current", "time" ]
6559204ce92585d29ccc1b5f303de9b85bf3f76a
https://github.com/objectivehtml/FlipClock/blob/6559204ce92585d29ccc1b5f303de9b85bf3f76a/src/flipclock/js/libs/time.js#L422-L429
10,657
joeferner/redis-commander
lib/util.js
createRedisClient
function createRedisClient(clientConfig, callback) { let c = require('config'); let client = null; let conId = null; let redisOpts = { //showFriendlyErrorStack: true, db: clientConfig.dbIndex, password: clientConfig.password, connectionName: clientConfig.connectionName || c.get('redis.connectionName'), retryStrategy: function (times) { return times > 10 ? 3000 : 1000; } }; // add tls support (simple and complex) // 1) boolean flag - simple tls without cert validation and similiar // 2) object - all params allowed for tls socket possible (see https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options) if (typeof clientConfig.tls === 'boolean' && clientConfig.tls) { redisOpts.tls = {}; } else if (typeof clientConfig.tls === 'object') { redisOpts.tls = clientConfig.tls; } if (clientConfig.sentinels) { Object.assign(redisOpts, { sentinels: clientConfig.sentinels, name: clientConfig.sentinel_name || 'mymaster', }); conId = `S:${redisOpts.sentinels[0].host}:${redisOpts.sentinels[0].port}:${redisOpts.name}-${redisOpts.db}`; } else { Object.assign(redisOpts, { port: clientConfig.port, host: clientConfig.host, path: clientConfig.path, family: 4 }); if (clientConfig.path) { // unix-socket: // no need for strong crypto here, just short string hopefully unique between different socket paths // only needed if someone uses this app with multiple different local redis sockets... // ATTN: use no hardcoded algorithm as some systems may not support it. just search for a sha-something let hashAlg = crypto.getHashes().find((h) => (h.startsWith('sha'))); let cid =crypto.createHash(hashAlg).update(clientConfig.path).digest('hex').substring(24); conId = `U:${cid}:${redisOpts.db}`; } else { conId = `R:${redisOpts.host}:${redisOpts.port}:${redisOpts.db}`; } } client = new Redis(redisOpts); client.label = clientConfig.label; client.options.connectionId = clientConfig.connectionId = conId; return client; }
javascript
function createRedisClient(clientConfig, callback) { let c = require('config'); let client = null; let conId = null; let redisOpts = { //showFriendlyErrorStack: true, db: clientConfig.dbIndex, password: clientConfig.password, connectionName: clientConfig.connectionName || c.get('redis.connectionName'), retryStrategy: function (times) { return times > 10 ? 3000 : 1000; } }; // add tls support (simple and complex) // 1) boolean flag - simple tls without cert validation and similiar // 2) object - all params allowed for tls socket possible (see https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options) if (typeof clientConfig.tls === 'boolean' && clientConfig.tls) { redisOpts.tls = {}; } else if (typeof clientConfig.tls === 'object') { redisOpts.tls = clientConfig.tls; } if (clientConfig.sentinels) { Object.assign(redisOpts, { sentinels: clientConfig.sentinels, name: clientConfig.sentinel_name || 'mymaster', }); conId = `S:${redisOpts.sentinels[0].host}:${redisOpts.sentinels[0].port}:${redisOpts.name}-${redisOpts.db}`; } else { Object.assign(redisOpts, { port: clientConfig.port, host: clientConfig.host, path: clientConfig.path, family: 4 }); if (clientConfig.path) { // unix-socket: // no need for strong crypto here, just short string hopefully unique between different socket paths // only needed if someone uses this app with multiple different local redis sockets... // ATTN: use no hardcoded algorithm as some systems may not support it. just search for a sha-something let hashAlg = crypto.getHashes().find((h) => (h.startsWith('sha'))); let cid =crypto.createHash(hashAlg).update(clientConfig.path).digest('hex').substring(24); conId = `U:${cid}:${redisOpts.db}`; } else { conId = `R:${redisOpts.host}:${redisOpts.port}:${redisOpts.db}`; } } client = new Redis(redisOpts); client.label = clientConfig.label; client.options.connectionId = clientConfig.connectionId = conId; return client; }
[ "function", "createRedisClient", "(", "clientConfig", ",", "callback", ")", "{", "let", "c", "=", "require", "(", "'config'", ")", ";", "let", "client", "=", "null", ";", "let", "conId", "=", "null", ";", "let", "redisOpts", "=", "{", "//showFriendlyErrorStack: true,", "db", ":", "clientConfig", ".", "dbIndex", ",", "password", ":", "clientConfig", ".", "password", ",", "connectionName", ":", "clientConfig", ".", "connectionName", "||", "c", ".", "get", "(", "'redis.connectionName'", ")", ",", "retryStrategy", ":", "function", "(", "times", ")", "{", "return", "times", ">", "10", "?", "3000", ":", "1000", ";", "}", "}", ";", "// add tls support (simple and complex)", "// 1) boolean flag - simple tls without cert validation and similiar", "// 2) object - all params allowed for tls socket possible (see https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options)", "if", "(", "typeof", "clientConfig", ".", "tls", "===", "'boolean'", "&&", "clientConfig", ".", "tls", ")", "{", "redisOpts", ".", "tls", "=", "{", "}", ";", "}", "else", "if", "(", "typeof", "clientConfig", ".", "tls", "===", "'object'", ")", "{", "redisOpts", ".", "tls", "=", "clientConfig", ".", "tls", ";", "}", "if", "(", "clientConfig", ".", "sentinels", ")", "{", "Object", ".", "assign", "(", "redisOpts", ",", "{", "sentinels", ":", "clientConfig", ".", "sentinels", ",", "name", ":", "clientConfig", ".", "sentinel_name", "||", "'mymaster'", ",", "}", ")", ";", "conId", "=", "`", "${", "redisOpts", ".", "sentinels", "[", "0", "]", ".", "host", "}", "${", "redisOpts", ".", "sentinels", "[", "0", "]", ".", "port", "}", "${", "redisOpts", ".", "name", "}", "${", "redisOpts", ".", "db", "}", "`", ";", "}", "else", "{", "Object", ".", "assign", "(", "redisOpts", ",", "{", "port", ":", "clientConfig", ".", "port", ",", "host", ":", "clientConfig", ".", "host", ",", "path", ":", "clientConfig", ".", "path", ",", "family", ":", "4", "}", ")", ";", "if", "(", "clientConfig", ".", "path", ")", "{", "// unix-socket:", "// no need for strong crypto here, just short string hopefully unique between different socket paths", "// only needed if someone uses this app with multiple different local redis sockets...", "// ATTN: use no hardcoded algorithm as some systems may not support it. just search for a sha-something", "let", "hashAlg", "=", "crypto", ".", "getHashes", "(", ")", ".", "find", "(", "(", "h", ")", "=>", "(", "h", ".", "startsWith", "(", "'sha'", ")", ")", ")", ";", "let", "cid", "=", "crypto", ".", "createHash", "(", "hashAlg", ")", ".", "update", "(", "clientConfig", ".", "path", ")", ".", "digest", "(", "'hex'", ")", ".", "substring", "(", "24", ")", ";", "conId", "=", "`", "${", "cid", "}", "${", "redisOpts", ".", "db", "}", "`", ";", "}", "else", "{", "conId", "=", "`", "${", "redisOpts", ".", "host", "}", "${", "redisOpts", ".", "port", "}", "${", "redisOpts", ".", "db", "}", "`", ";", "}", "}", "client", "=", "new", "Redis", "(", "redisOpts", ")", ";", "client", ".", "label", "=", "clientConfig", ".", "label", ";", "client", ".", "options", ".", "connectionId", "=", "clientConfig", ".", "connectionId", "=", "conId", ";", "return", "client", ";", "}" ]
Function to craete a new redis client object by given parameter This one is used by creating clients at startup from command line, config file or new connections added via ui during runtime. The redis client created can be either a normal redis client or a sentinel client, base on configuration given. @param {object} clientConfig - configuration to create client from @param {function} callback - function with error object and new client created: cb(error, client)
[ "Function", "to", "craete", "a", "new", "redis", "client", "object", "by", "given", "parameter", "This", "one", "is", "used", "by", "creating", "clients", "at", "startup", "from", "command", "line", "config", "file", "or", "new", "connections", "added", "via", "ui", "during", "runtime", ".", "The", "redis", "client", "created", "can", "be", "either", "a", "normal", "redis", "client", "or", "a", "sentinel", "client", "base", "on", "configuration", "given", "." ]
c8966ff20f53fac73537643b64162d4007af68a8
https://github.com/joeferner/redis-commander/blob/c8966ff20f53fac73537643b64162d4007af68a8/lib/util.js#L282-L338
10,658
joeferner/redis-commander
lib/util.js
parseRedisSentinel
function parseRedisSentinel(key, sentinelsString) { if (!sentinelsString) return []; // convert array entries from string to object if needed if (Array.isArray(sentinelsString)) { sentinelsString.forEach(function(entry, index) { if (typeof entry === 'string') { let tmp = entry.trim().split(':'); sentinelsString[index] = {host: tmp[0].toLowerCase(), port: parseInt(tmp[1])}; } }); return sentinelsString.sort((i1, i2) => ((i1.host.toLowerCase()) > i2.host.toLowerCase() || i1.port - i2.port)); } if (typeof sentinelsString !== 'string') { throw new Error('Invalid type for key ' + key + ': must be either comma separated string with sentinels or list of them'); } try { let sentinels = []; if (sentinelsString.startsWith('[')) { let obj = JSON.parse(sentinelsString); obj.forEach(function(sentinel) { if (typeof sentinel === 'object') sentinels.push(sentinel); else { let tmp = sentinel.trim().split(':'); sentinels.push({host: tmp[0].toLowerCase(), port: parseInt(tmp[1])}); } }); } else { // simple string, comma separated list of host:port let obj = sentinelsString.split(','); obj.forEach(function(sentinel) { if (sentinel && sentinel.trim()) { let tmp = sentinel.trim().split(':'); sentinels.push({host: tmp[0].toLowerCase(), port: parseInt(tmp[1])}); } }); } return sentinels.sort((i1, i2) => ((i1.host.toLowerCase()) > i2.host.toLowerCase() || i1.port - i2.port)); } catch (e) { throw new Error('Invalid type for key ' + key + ': Cannot parse redis sentinels string - ' + e.message ); } }
javascript
function parseRedisSentinel(key, sentinelsString) { if (!sentinelsString) return []; // convert array entries from string to object if needed if (Array.isArray(sentinelsString)) { sentinelsString.forEach(function(entry, index) { if (typeof entry === 'string') { let tmp = entry.trim().split(':'); sentinelsString[index] = {host: tmp[0].toLowerCase(), port: parseInt(tmp[1])}; } }); return sentinelsString.sort((i1, i2) => ((i1.host.toLowerCase()) > i2.host.toLowerCase() || i1.port - i2.port)); } if (typeof sentinelsString !== 'string') { throw new Error('Invalid type for key ' + key + ': must be either comma separated string with sentinels or list of them'); } try { let sentinels = []; if (sentinelsString.startsWith('[')) { let obj = JSON.parse(sentinelsString); obj.forEach(function(sentinel) { if (typeof sentinel === 'object') sentinels.push(sentinel); else { let tmp = sentinel.trim().split(':'); sentinels.push({host: tmp[0].toLowerCase(), port: parseInt(tmp[1])}); } }); } else { // simple string, comma separated list of host:port let obj = sentinelsString.split(','); obj.forEach(function(sentinel) { if (sentinel && sentinel.trim()) { let tmp = sentinel.trim().split(':'); sentinels.push({host: tmp[0].toLowerCase(), port: parseInt(tmp[1])}); } }); } return sentinels.sort((i1, i2) => ((i1.host.toLowerCase()) > i2.host.toLowerCase() || i1.port - i2.port)); } catch (e) { throw new Error('Invalid type for key ' + key + ': Cannot parse redis sentinels string - ' + e.message ); } }
[ "function", "parseRedisSentinel", "(", "key", ",", "sentinelsString", ")", "{", "if", "(", "!", "sentinelsString", ")", "return", "[", "]", ";", "// convert array entries from string to object if needed", "if", "(", "Array", ".", "isArray", "(", "sentinelsString", ")", ")", "{", "sentinelsString", ".", "forEach", "(", "function", "(", "entry", ",", "index", ")", "{", "if", "(", "typeof", "entry", "===", "'string'", ")", "{", "let", "tmp", "=", "entry", ".", "trim", "(", ")", ".", "split", "(", "':'", ")", ";", "sentinelsString", "[", "index", "]", "=", "{", "host", ":", "tmp", "[", "0", "]", ".", "toLowerCase", "(", ")", ",", "port", ":", "parseInt", "(", "tmp", "[", "1", "]", ")", "}", ";", "}", "}", ")", ";", "return", "sentinelsString", ".", "sort", "(", "(", "i1", ",", "i2", ")", "=>", "(", "(", "i1", ".", "host", ".", "toLowerCase", "(", ")", ")", ">", "i2", ".", "host", ".", "toLowerCase", "(", ")", "||", "i1", ".", "port", "-", "i2", ".", "port", ")", ")", ";", "}", "if", "(", "typeof", "sentinelsString", "!==", "'string'", ")", "{", "throw", "new", "Error", "(", "'Invalid type for key '", "+", "key", "+", "': must be either comma separated string with sentinels or list of them'", ")", ";", "}", "try", "{", "let", "sentinels", "=", "[", "]", ";", "if", "(", "sentinelsString", ".", "startsWith", "(", "'['", ")", ")", "{", "let", "obj", "=", "JSON", ".", "parse", "(", "sentinelsString", ")", ";", "obj", ".", "forEach", "(", "function", "(", "sentinel", ")", "{", "if", "(", "typeof", "sentinel", "===", "'object'", ")", "sentinels", ".", "push", "(", "sentinel", ")", ";", "else", "{", "let", "tmp", "=", "sentinel", ".", "trim", "(", ")", ".", "split", "(", "':'", ")", ";", "sentinels", ".", "push", "(", "{", "host", ":", "tmp", "[", "0", "]", ".", "toLowerCase", "(", ")", ",", "port", ":", "parseInt", "(", "tmp", "[", "1", "]", ")", "}", ")", ";", "}", "}", ")", ";", "}", "else", "{", "// simple string, comma separated list of host:port", "let", "obj", "=", "sentinelsString", ".", "split", "(", "','", ")", ";", "obj", ".", "forEach", "(", "function", "(", "sentinel", ")", "{", "if", "(", "sentinel", "&&", "sentinel", ".", "trim", "(", ")", ")", "{", "let", "tmp", "=", "sentinel", ".", "trim", "(", ")", ".", "split", "(", "':'", ")", ";", "sentinels", ".", "push", "(", "{", "host", ":", "tmp", "[", "0", "]", ".", "toLowerCase", "(", ")", ",", "port", ":", "parseInt", "(", "tmp", "[", "1", "]", ")", "}", ")", ";", "}", "}", ")", ";", "}", "return", "sentinels", ".", "sort", "(", "(", "i1", ",", "i2", ")", "=>", "(", "(", "i1", ".", "host", ".", "toLowerCase", "(", ")", ")", ">", "i2", ".", "host", ".", "toLowerCase", "(", ")", "||", "i1", ".", "port", "-", "i2", ".", "port", ")", ")", ";", "}", "catch", "(", "e", ")", "{", "throw", "new", "Error", "(", "'Invalid type for key '", "+", "key", "+", "': Cannot parse redis sentinels string - '", "+", "e", ".", "message", ")", ";", "}", "}" ]
Parse a string with redis sentinel names and ports to an objects as needed by ioredis for connections. Allowed formats are: <ul> <li>comma separeted list of <code>hostname:port</code> values, port is optional</li> <li>JSON-String with list of <code>hostname:port</code> string entries</li> <li>JSON-String with list of sentinel objects <code>{"host":"localhost", "port": 26379}</code> </ul> The return value is a list with sentinel objects, e.g.: <code>{"host":"localhost", "port": 26379}</code>. The list is sorted (needed for easier comparision if this connection i already known) @param {string} key configuration key @param {string} sentinelsString string or list object to check for valid sentinel connetion data @return {object} ioredis sentinel list @private
[ "Parse", "a", "string", "with", "redis", "sentinel", "names", "and", "ports", "to", "an", "objects", "as", "needed", "by", "ioredis", "for", "connections", "." ]
c8966ff20f53fac73537643b64162d4007af68a8
https://github.com/joeferner/redis-commander/blob/c8966ff20f53fac73537643b64162d4007af68a8/lib/util.js#L621-L666
10,659
joeferner/redis-commander
web/static/scripts/redisCommander.js
enableJsonValidationCheck
function enableJsonValidationCheck(value, isJsonCheckBox) { try { JSON.parse(value); // if this is valid json and is array or object assume we want validation active if (value.match(/^\s*[{\[]/)) { $(isJsonCheckBox).click(); } } catch (ex) { // do nothing } }
javascript
function enableJsonValidationCheck(value, isJsonCheckBox) { try { JSON.parse(value); // if this is valid json and is array or object assume we want validation active if (value.match(/^\s*[{\[]/)) { $(isJsonCheckBox).click(); } } catch (ex) { // do nothing } }
[ "function", "enableJsonValidationCheck", "(", "value", ",", "isJsonCheckBox", ")", "{", "try", "{", "JSON", ".", "parse", "(", "value", ")", ";", "// if this is valid json and is array or object assume we want validation active", "if", "(", "value", ".", "match", "(", "/", "^\\s*[{\\[]", "/", ")", ")", "{", "$", "(", "isJsonCheckBox", ")", ".", "click", "(", ")", ";", "}", "}", "catch", "(", "ex", ")", "{", "// do nothing", "}", "}" ]
check if given string value is valid json and, if so enable validation for given field if this is an json object or array. Do not automatically enable validation on numbers or quted strings. May be coincidence that this is json... @param {string} value string to check if valid json @param {string} isJsonCheckBox id string of checkbox element to activate validation
[ "check", "if", "given", "string", "value", "is", "valid", "json", "and", "if", "so", "enable", "validation", "for", "given", "field", "if", "this", "is", "an", "json", "object", "or", "array", ".", "Do", "not", "automatically", "enable", "validation", "on", "numbers", "or", "quted", "strings", ".", "May", "be", "coincidence", "that", "this", "is", "json", "..." ]
c8966ff20f53fac73537643b64162d4007af68a8
https://github.com/joeferner/redis-commander/blob/c8966ff20f53fac73537643b64162d4007af68a8/web/static/scripts/redisCommander.js#L645-L656
10,660
joeferner/redis-commander
web/static/scripts/redisCommander.js
addInputValidator
function addInputValidator(inputId, format, currentState) { var input; if (typeof inputId === 'string') { input = $('#' + inputId) } else if (typeof inputId === 'object') { input = inputId; } if (!input){ console.log('Invalid html id given to validate format: ', inputId); return; } switch (format) { case 'json': input.on('keyup', validateInputAsJson); break; default: console.log('Invalid format given to validate input: ', format); return; } // set initial state if requested if (typeof currentState === 'boolean') { setValidationClasses(input.get(0), currentState); } else { input.trigger( "keyup" ); } }
javascript
function addInputValidator(inputId, format, currentState) { var input; if (typeof inputId === 'string') { input = $('#' + inputId) } else if (typeof inputId === 'object') { input = inputId; } if (!input){ console.log('Invalid html id given to validate format: ', inputId); return; } switch (format) { case 'json': input.on('keyup', validateInputAsJson); break; default: console.log('Invalid format given to validate input: ', format); return; } // set initial state if requested if (typeof currentState === 'boolean') { setValidationClasses(input.get(0), currentState); } else { input.trigger( "keyup" ); } }
[ "function", "addInputValidator", "(", "inputId", ",", "format", ",", "currentState", ")", "{", "var", "input", ";", "if", "(", "typeof", "inputId", "===", "'string'", ")", "{", "input", "=", "$", "(", "'#'", "+", "inputId", ")", "}", "else", "if", "(", "typeof", "inputId", "===", "'object'", ")", "{", "input", "=", "inputId", ";", "}", "if", "(", "!", "input", ")", "{", "console", ".", "log", "(", "'Invalid html id given to validate format: '", ",", "inputId", ")", ";", "return", ";", "}", "switch", "(", "format", ")", "{", "case", "'json'", ":", "input", ".", "on", "(", "'keyup'", ",", "validateInputAsJson", ")", ";", "break", ";", "default", ":", "console", ".", "log", "(", "'Invalid format given to validate input: '", ",", "format", ")", ";", "return", ";", "}", "// set initial state if requested", "if", "(", "typeof", "currentState", "===", "'boolean'", ")", "{", "setValidationClasses", "(", "input", ".", "get", "(", "0", ")", ",", "currentState", ")", ";", "}", "else", "{", "input", ".", "trigger", "(", "\"keyup\"", ")", ";", "}", "}" ]
Add data format validation function to an input element. The field gets decorated to visualize if input is valid for given data format. @param {string|object} inputId id of html input element to watch or jquery object @param {string} format data format to validate against, possible values: "json" @param {boolean} [currentState] optional start state to set now
[ "Add", "data", "format", "validation", "function", "to", "an", "input", "element", ".", "The", "field", "gets", "decorated", "to", "visualize", "if", "input", "is", "valid", "for", "given", "data", "format", "." ]
c8966ff20f53fac73537643b64162d4007af68a8
https://github.com/joeferner/redis-commander/blob/c8966ff20f53fac73537643b64162d4007af68a8/web/static/scripts/redisCommander.js#L816-L846
10,661
joeferner/redis-commander
web/static/scripts/redisCommander.js
validateInputAsJson
function validateInputAsJson() { if (this.value) { try { JSON.parse(this.value); setValidationClasses(this, true); } catch(e) { setValidationClasses(this, false); } } else { setValidationClasses(this, false) } }
javascript
function validateInputAsJson() { if (this.value) { try { JSON.parse(this.value); setValidationClasses(this, true); } catch(e) { setValidationClasses(this, false); } } else { setValidationClasses(this, false) } }
[ "function", "validateInputAsJson", "(", ")", "{", "if", "(", "this", ".", "value", ")", "{", "try", "{", "JSON", ".", "parse", "(", "this", ".", "value", ")", ";", "setValidationClasses", "(", "this", ",", "true", ")", ";", "}", "catch", "(", "e", ")", "{", "setValidationClasses", "(", "this", ",", "false", ")", ";", "}", "}", "else", "{", "setValidationClasses", "(", "this", ",", "false", ")", "}", "}" ]
method to check if a input field contains valid json and set visual accordingly.
[ "method", "to", "check", "if", "a", "input", "field", "contains", "valid", "json", "and", "set", "visual", "accordingly", "." ]
c8966ff20f53fac73537643b64162d4007af68a8
https://github.com/joeferner/redis-commander/blob/c8966ff20f53fac73537643b64162d4007af68a8/web/static/scripts/redisCommander.js#L851-L864
10,662
joeferner/redis-commander
web/static/scripts/redisCommander.js
setValidationClasses
function setValidationClasses(element, success) { var add = (success ? 'validate-positive' : 'validate-negative'); var remove = (success ? 'validate-negative' : 'validate-positive'); if (element.className.indexOf(add) < 0) { $(element).removeClass(remove).addClass(add); } }
javascript
function setValidationClasses(element, success) { var add = (success ? 'validate-positive' : 'validate-negative'); var remove = (success ? 'validate-negative' : 'validate-positive'); if (element.className.indexOf(add) < 0) { $(element).removeClass(remove).addClass(add); } }
[ "function", "setValidationClasses", "(", "element", ",", "success", ")", "{", "var", "add", "=", "(", "success", "?", "'validate-positive'", ":", "'validate-negative'", ")", ";", "var", "remove", "=", "(", "success", "?", "'validate-negative'", ":", "'validate-positive'", ")", ";", "if", "(", "element", ".", "className", ".", "indexOf", "(", "add", ")", "<", "0", ")", "{", "$", "(", "element", ")", ".", "removeClass", "(", "remove", ")", ".", "addClass", "(", "add", ")", ";", "}", "}" ]
classes are only changed if not set right now @param {Element} element HTML DOM element to change validation classes @param {boolean} success true if positive validation class shall be assigned, false for error class
[ "classes", "are", "only", "changed", "if", "not", "set", "right", "now" ]
c8966ff20f53fac73537643b64162d4007af68a8
https://github.com/joeferner/redis-commander/blob/c8966ff20f53fac73537643b64162d4007af68a8/web/static/scripts/redisCommander.js#L871-L877
10,663
joeferner/redis-commander
web/static/scripts/redisCommander.js
renderEjs
function renderEjs(filename, data, element, callback) { $.get(filename) .done(function(htmlTmpl) { element.html(ejs.render(htmlTmpl, data)); }) .fail(function(error) { console.log('failed to get html template ' + filename + ': ' + JSON.stringify(error)); alert('failed to fetch html template ' + filename); }) .always(function () { if (typeof callback === 'function') callback(); resizeApp(); }); }
javascript
function renderEjs(filename, data, element, callback) { $.get(filename) .done(function(htmlTmpl) { element.html(ejs.render(htmlTmpl, data)); }) .fail(function(error) { console.log('failed to get html template ' + filename + ': ' + JSON.stringify(error)); alert('failed to fetch html template ' + filename); }) .always(function () { if (typeof callback === 'function') callback(); resizeApp(); }); }
[ "function", "renderEjs", "(", "filename", ",", "data", ",", "element", ",", "callback", ")", "{", "$", ".", "get", "(", "filename", ")", ".", "done", "(", "function", "(", "htmlTmpl", ")", "{", "element", ".", "html", "(", "ejs", ".", "render", "(", "htmlTmpl", ",", "data", ")", ")", ";", "}", ")", ".", "fail", "(", "function", "(", "error", ")", "{", "console", ".", "log", "(", "'failed to get html template '", "+", "filename", "+", "': '", "+", "JSON", ".", "stringify", "(", "error", ")", ")", ";", "alert", "(", "'failed to fetch html template '", "+", "filename", ")", ";", "}", ")", ".", "always", "(", "function", "(", ")", "{", "if", "(", "typeof", "callback", "===", "'function'", ")", "callback", "(", ")", ";", "resizeApp", "(", ")", ";", "}", ")", ";", "}" ]
Fetch the url give at filename from the server and render the content of this template with the data object. Afterwards the rendered html is added at the html element given. @param {string} filename url to retrieve as template @param {object} data object to use for rendering @param {object} element jquery html element to attach rendered data to @param {function} [callback] optional function to call when rendering html is attached to dom
[ "Fetch", "the", "url", "give", "at", "filename", "from", "the", "server", "and", "render", "the", "content", "of", "this", "template", "with", "the", "data", "object", ".", "Afterwards", "the", "rendered", "html", "is", "added", "at", "the", "html", "element", "given", "." ]
c8966ff20f53fac73537643b64162d4007af68a8
https://github.com/joeferner/redis-commander/blob/c8966ff20f53fac73537643b64162d4007af68a8/web/static/scripts/redisCommander.js#L896-L909
10,664
joeferner/redis-commander
lib/routes/apiv1.js
getConnection
function getConnection (req, res, next, connectionId) { let con = req.app.locals.redisConnections.find(function(connection) { return (connection.options.connectionId === connectionId); }); if (con) { res.locals.connection = con; res.locals.connectionId = connectionId; } else { console.error('Connection with id ' + connectionId + ' not found.'); return printError(res, next, null, req.originalUrl); } next(); }
javascript
function getConnection (req, res, next, connectionId) { let con = req.app.locals.redisConnections.find(function(connection) { return (connection.options.connectionId === connectionId); }); if (con) { res.locals.connection = con; res.locals.connectionId = connectionId; } else { console.error('Connection with id ' + connectionId + ' not found.'); return printError(res, next, null, req.originalUrl); } next(); }
[ "function", "getConnection", "(", "req", ",", "res", ",", "next", ",", "connectionId", ")", "{", "let", "con", "=", "req", ".", "app", ".", "locals", ".", "redisConnections", ".", "find", "(", "function", "(", "connection", ")", "{", "return", "(", "connection", ".", "options", ".", "connectionId", "===", "connectionId", ")", ";", "}", ")", ";", "if", "(", "con", ")", "{", "res", ".", "locals", ".", "connection", "=", "con", ";", "res", ".", "locals", ".", "connectionId", "=", "connectionId", ";", "}", "else", "{", "console", ".", "error", "(", "'Connection with id '", "+", "connectionId", "+", "' not found.'", ")", ";", "return", "printError", "(", "res", ",", "next", ",", "null", ",", "req", ".", "originalUrl", ")", ";", "}", "next", "(", ")", ";", "}" ]
method called to extract url parameter 'connectionId' from all routes. The connection object found is attached to the res.locals.connection variable for all following routes to work with. The connectionId param is attached to res.locals.connectionId. This method exits with JSON error response if no connection is found. @param {object} req Express request object @param {object} res Express response object @param {function} next The next middleware function to call @param {string} [connectionId] The value of the connectionId parameter.
[ "method", "called", "to", "extract", "url", "parameter", "connectionId", "from", "all", "routes", ".", "The", "connection", "object", "found", "is", "attached", "to", "the", "res", ".", "locals", ".", "connection", "variable", "for", "all", "following", "routes", "to", "work", "with", ".", "The", "connectionId", "param", "is", "attached", "to", "res", ".", "locals", ".", "connectionId", "." ]
c8966ff20f53fac73537643b64162d4007af68a8
https://github.com/joeferner/redis-commander/blob/c8966ff20f53fac73537643b64162d4007af68a8/lib/routes/apiv1.js#L147-L160
10,665
joeferner/redis-commander
lib/routes/apiv1.js
postExec
function postExec (req, res) { let cmd = req.body.cmd; let connection = res.locals.connection; let parts = myutil.split(cmd); parts[0] = parts[0].toLowerCase(); let commandName = parts[0].toLowerCase(); // must be in our white list to be allowed in read only mode if (req.app.locals.redisReadOnly) { if (!isReadOnlyCommand(commandName, connection)) { return res.send('ERROR: Command not read-only'); } } let args = parts.slice(1); args.push(function (err, results) { if (err) { return res.send(err.message); } return res.send(JSON.stringify(results)); }); // check if command is valid is done by ioredis if called with // 'connection.call(command, ...)' and our callback called to handle it // but throws Error if called via 'connection[commandName].apply(connection, ...)' connection.call(commandName, ...args); }
javascript
function postExec (req, res) { let cmd = req.body.cmd; let connection = res.locals.connection; let parts = myutil.split(cmd); parts[0] = parts[0].toLowerCase(); let commandName = parts[0].toLowerCase(); // must be in our white list to be allowed in read only mode if (req.app.locals.redisReadOnly) { if (!isReadOnlyCommand(commandName, connection)) { return res.send('ERROR: Command not read-only'); } } let args = parts.slice(1); args.push(function (err, results) { if (err) { return res.send(err.message); } return res.send(JSON.stringify(results)); }); // check if command is valid is done by ioredis if called with // 'connection.call(command, ...)' and our callback called to handle it // but throws Error if called via 'connection[commandName].apply(connection, ...)' connection.call(commandName, ...args); }
[ "function", "postExec", "(", "req", ",", "res", ")", "{", "let", "cmd", "=", "req", ".", "body", ".", "cmd", ";", "let", "connection", "=", "res", ".", "locals", ".", "connection", ";", "let", "parts", "=", "myutil", ".", "split", "(", "cmd", ")", ";", "parts", "[", "0", "]", "=", "parts", "[", "0", "]", ".", "toLowerCase", "(", ")", ";", "let", "commandName", "=", "parts", "[", "0", "]", ".", "toLowerCase", "(", ")", ";", "// must be in our white list to be allowed in read only mode", "if", "(", "req", ".", "app", ".", "locals", ".", "redisReadOnly", ")", "{", "if", "(", "!", "isReadOnlyCommand", "(", "commandName", ",", "connection", ")", ")", "{", "return", "res", ".", "send", "(", "'ERROR: Command not read-only'", ")", ";", "}", "}", "let", "args", "=", "parts", ".", "slice", "(", "1", ")", ";", "args", ".", "push", "(", "function", "(", "err", ",", "results", ")", "{", "if", "(", "err", ")", "{", "return", "res", ".", "send", "(", "err", ".", "message", ")", ";", "}", "return", "res", ".", "send", "(", "JSON", ".", "stringify", "(", "results", ")", ")", ";", "}", ")", ";", "// check if command is valid is done by ioredis if called with", "// 'connection.call(command, ...)' and our callback called to handle it", "// but throws Error if called via 'connection[commandName].apply(connection, ...)'", "connection", ".", "call", "(", "commandName", ",", "...", "args", ")", ";", "}" ]
this needs special handling for read-only mode. Must check all commands and classify if command to view or manipulatie data...
[ "this", "needs", "special", "handling", "for", "read", "-", "only", "mode", ".", "Must", "check", "all", "commands", "and", "classify", "if", "command", "to", "view", "or", "manipulatie", "data", "..." ]
c8966ff20f53fac73537643b64162d4007af68a8
https://github.com/joeferner/redis-commander/blob/c8966ff20f53fac73537643b64162d4007af68a8/lib/routes/apiv1.js#L254-L279
10,666
thelinmichael/spotify-web-api-node
src/server-methods.js
function(options, callback) { return AuthenticationRequest.builder() .withPath('/api/token') .withBodyParameters({ grant_type: 'client_credentials' }) .withBodyParameters(options) .withHeaders({ Authorization: 'Basic ' + new Buffer( this.getClientId() + ':' + this.getClientSecret() ).toString('base64') }) .build() .execute(HttpManager.post, callback); }
javascript
function(options, callback) { return AuthenticationRequest.builder() .withPath('/api/token') .withBodyParameters({ grant_type: 'client_credentials' }) .withBodyParameters(options) .withHeaders({ Authorization: 'Basic ' + new Buffer( this.getClientId() + ':' + this.getClientSecret() ).toString('base64') }) .build() .execute(HttpManager.post, callback); }
[ "function", "(", "options", ",", "callback", ")", "{", "return", "AuthenticationRequest", ".", "builder", "(", ")", ".", "withPath", "(", "'/api/token'", ")", ".", "withBodyParameters", "(", "{", "grant_type", ":", "'client_credentials'", "}", ")", ".", "withBodyParameters", "(", "options", ")", ".", "withHeaders", "(", "{", "Authorization", ":", "'Basic '", "+", "new", "Buffer", "(", "this", ".", "getClientId", "(", ")", "+", "':'", "+", "this", ".", "getClientSecret", "(", ")", ")", ".", "toString", "(", "'base64'", ")", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "post", ",", "callback", ")", ";", "}" ]
Request an access token using the Client Credentials flow. Requires that client ID and client secret has been set previous to the call. @param {Object} options Options. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @returns {Promise|undefined} A promise that if successful, resolves into an object containing the access token, token type and time to expiration. If rejected, it contains an error object. Not returned if a callback is given.
[ "Request", "an", "access", "token", "using", "the", "Client", "Credentials", "flow", ".", "Requires", "that", "client", "ID", "and", "client", "secret", "has", "been", "set", "previous", "to", "the", "call", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/server-methods.js#L15-L31
10,667
thelinmichael/spotify-web-api-node
src/server-methods.js
function(code, callback) { return AuthenticationRequest.builder() .withPath('/api/token') .withBodyParameters({ grant_type: 'authorization_code', redirect_uri: this.getRedirectURI(), code: code, client_id: this.getClientId(), client_secret: this.getClientSecret() }) .build() .execute(HttpManager.post, callback); }
javascript
function(code, callback) { return AuthenticationRequest.builder() .withPath('/api/token') .withBodyParameters({ grant_type: 'authorization_code', redirect_uri: this.getRedirectURI(), code: code, client_id: this.getClientId(), client_secret: this.getClientSecret() }) .build() .execute(HttpManager.post, callback); }
[ "function", "(", "code", ",", "callback", ")", "{", "return", "AuthenticationRequest", ".", "builder", "(", ")", ".", "withPath", "(", "'/api/token'", ")", ".", "withBodyParameters", "(", "{", "grant_type", ":", "'authorization_code'", ",", "redirect_uri", ":", "this", ".", "getRedirectURI", "(", ")", ",", "code", ":", "code", ",", "client_id", ":", "this", ".", "getClientId", "(", ")", ",", "client_secret", ":", "this", ".", "getClientSecret", "(", ")", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "post", ",", "callback", ")", ";", "}" ]
Request an access token using the Authorization Code flow. Requires that client ID, client secret, and redirect URI has been set previous to the call. @param {string} code The authorization code returned in the callback in the Authorization Code flow. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @returns {Promise|undefined} A promise that if successful, resolves into an object containing the access token, refresh token, token type and time to expiration. If rejected, it contains an error object. Not returned if a callback is given.
[ "Request", "an", "access", "token", "using", "the", "Authorization", "Code", "flow", ".", "Requires", "that", "client", "ID", "client", "secret", "and", "redirect", "URI", "has", "been", "set", "previous", "to", "the", "call", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/server-methods.js#L42-L54
10,668
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(trackId, options, callback) { // In case someone is using a version where options parameter did not exist. var actualCallback, actualOptions; if (typeof options === 'function' && !callback) { actualCallback = options; actualOptions = {}; } else { actualCallback = callback; actualOptions = options; } return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/tracks/' + trackId) .withQueryParameters(actualOptions) .build() .execute(HttpManager.get, actualCallback); }
javascript
function(trackId, options, callback) { // In case someone is using a version where options parameter did not exist. var actualCallback, actualOptions; if (typeof options === 'function' && !callback) { actualCallback = options; actualOptions = {}; } else { actualCallback = callback; actualOptions = options; } return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/tracks/' + trackId) .withQueryParameters(actualOptions) .build() .execute(HttpManager.get, actualCallback); }
[ "function", "(", "trackId", ",", "options", ",", "callback", ")", "{", "// In case someone is using a version where options parameter did not exist.", "var", "actualCallback", ",", "actualOptions", ";", "if", "(", "typeof", "options", "===", "'function'", "&&", "!", "callback", ")", "{", "actualCallback", "=", "options", ";", "actualOptions", "=", "{", "}", ";", "}", "else", "{", "actualCallback", "=", "callback", ";", "actualOptions", "=", "options", ";", "}", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/tracks/'", "+", "trackId", ")", ".", "withQueryParameters", "(", "actualOptions", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "get", ",", "actualCallback", ")", ";", "}" ]
Look up a track. @param {string} trackId The track's ID. @param {Object} [options] The possible options, currently only market. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example getTrack('3Qm86XLflmIXVm1wcwkgDK').then(...) @returns {Promise|undefined} A promise that if successful, returns an object containing information about the track. Not returned if a callback is given.
[ "Look", "up", "a", "track", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L118-L134
10,669
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(trackIds, options, callback) { // In case someone is using a version where options parameter did not exist. var actualCallback, actualOptions; if (typeof options === 'function' && !callback) { actualCallback = options; actualOptions = {}; } else { actualCallback = callback; actualOptions = options; } return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/tracks') .withQueryParameters( { ids: trackIds.join(',') }, actualOptions ) .build() .execute(HttpManager.get, actualCallback); }
javascript
function(trackIds, options, callback) { // In case someone is using a version where options parameter did not exist. var actualCallback, actualOptions; if (typeof options === 'function' && !callback) { actualCallback = options; actualOptions = {}; } else { actualCallback = callback; actualOptions = options; } return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/tracks') .withQueryParameters( { ids: trackIds.join(',') }, actualOptions ) .build() .execute(HttpManager.get, actualCallback); }
[ "function", "(", "trackIds", ",", "options", ",", "callback", ")", "{", "// In case someone is using a version where options parameter did not exist.", "var", "actualCallback", ",", "actualOptions", ";", "if", "(", "typeof", "options", "===", "'function'", "&&", "!", "callback", ")", "{", "actualCallback", "=", "options", ";", "actualOptions", "=", "{", "}", ";", "}", "else", "{", "actualCallback", "=", "callback", ";", "actualOptions", "=", "options", ";", "}", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/tracks'", ")", ".", "withQueryParameters", "(", "{", "ids", ":", "trackIds", ".", "join", "(", "','", ")", "}", ",", "actualOptions", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "get", ",", "actualCallback", ")", ";", "}" ]
Look up several tracks. @param {string[]} trackIds The IDs of the artists. @param {Object} [options] The possible options, currently only market. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example getArtists(['0oSGxfWSnnOXhD2fKuz2Gy', '3dBVyJ7JuOMt4GE9607Qin']).then(...) @returns {Promise|undefined} A promise that if successful, returns an object containing information about the artists. Not returned if a callback is given.
[ "Look", "up", "several", "tracks", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L145-L166
10,670
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(query, types, options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/search/') .withQueryParameters( { type: types.join(','), q: query }, options ) .build() .execute(HttpManager.get, callback); }
javascript
function(query, types, options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/search/') .withQueryParameters( { type: types.join(','), q: query }, options ) .build() .execute(HttpManager.get, callback); }
[ "function", "(", "query", ",", "types", ",", "options", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/search/'", ")", ".", "withQueryParameters", "(", "{", "type", ":", "types", ".", "join", "(", "','", ")", ",", "q", ":", "query", "}", ",", "options", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "get", ",", "callback", ")", ";", "}" ]
Search for music entities of certain types. @param {string} query The search query. @param {string[]} types An array of item types to search across. Valid types are: 'album', 'artist', 'playlist', and 'track'. @param {Object} [options] The possible options, e.g. limit, offset. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example search('Abba', ['track', 'playlist'], { limit : 5, offset : 1 }).then(...) @returns {Promise|undefined} A promise that if successful, returns an object containing the search results. The result is paginated. If the promise is rejected, it contains an error object. Not returned if a callback is given.
[ "Search", "for", "music", "entities", "of", "certain", "types", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L272-L284
10,671
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(userId, options, callback) { var path; if (typeof userId === 'string') { path = '/v1/users/' + encodeURIComponent(userId) + '/playlists'; } else if (typeof userId === 'object') { callback = options; options = userId; path = '/v1/me/playlists'; } /* undefined */ else { path = '/v1/me/playlists'; } return WebApiRequest.builder(this.getAccessToken()) .withPath(path) .withQueryParameters(options) .build() .execute(HttpManager.get, callback); }
javascript
function(userId, options, callback) { var path; if (typeof userId === 'string') { path = '/v1/users/' + encodeURIComponent(userId) + '/playlists'; } else if (typeof userId === 'object') { callback = options; options = userId; path = '/v1/me/playlists'; } /* undefined */ else { path = '/v1/me/playlists'; } return WebApiRequest.builder(this.getAccessToken()) .withPath(path) .withQueryParameters(options) .build() .execute(HttpManager.get, callback); }
[ "function", "(", "userId", ",", "options", ",", "callback", ")", "{", "var", "path", ";", "if", "(", "typeof", "userId", "===", "'string'", ")", "{", "path", "=", "'/v1/users/'", "+", "encodeURIComponent", "(", "userId", ")", "+", "'/playlists'", ";", "}", "else", "if", "(", "typeof", "userId", "===", "'object'", ")", "{", "callback", "=", "options", ";", "options", "=", "userId", ";", "path", "=", "'/v1/me/playlists'", ";", "}", "/* undefined */", "else", "{", "path", "=", "'/v1/me/playlists'", ";", "}", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "path", ")", ".", "withQueryParameters", "(", "options", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "get", ",", "callback", ")", ";", "}" ]
Get a user's playlists. @param {string} userId An optional id of the user. If you know the Spotify URI it is easy to find the id (e.g. spotify:user:<here_is_the_id>). If not provided, the id of the user that granted the permissions will be used. @param {Object} [options] The options supplied to this request. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example getUserPlaylists('thelinmichael').then(...) @returns {Promise|undefined} A promise that if successful, resolves to an object containing a list of playlists. If rejected, it contains an error object. Not returned if a callback is given.
[ "Get", "a", "user", "s", "playlists", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L456-L473
10,672
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(userId, playlistName, options, callback) { // In case someone is using a version where options parameter did not exist. var actualCallback; if (typeof options === 'function' && !callback) { actualCallback = options; } else { actualCallback = callback; } var actualOptions = { name: playlistName }; if (typeof options === 'object') { Object.keys(options).forEach(function(key) { actualOptions[key] = options[key]; }); } return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/users/' + encodeURIComponent(userId) + '/playlists') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters(actualOptions) .build() .execute(HttpManager.post, actualCallback); }
javascript
function(userId, playlistName, options, callback) { // In case someone is using a version where options parameter did not exist. var actualCallback; if (typeof options === 'function' && !callback) { actualCallback = options; } else { actualCallback = callback; } var actualOptions = { name: playlistName }; if (typeof options === 'object') { Object.keys(options).forEach(function(key) { actualOptions[key] = options[key]; }); } return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/users/' + encodeURIComponent(userId) + '/playlists') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters(actualOptions) .build() .execute(HttpManager.post, actualCallback); }
[ "function", "(", "userId", ",", "playlistName", ",", "options", ",", "callback", ")", "{", "// In case someone is using a version where options parameter did not exist.", "var", "actualCallback", ";", "if", "(", "typeof", "options", "===", "'function'", "&&", "!", "callback", ")", "{", "actualCallback", "=", "options", ";", "}", "else", "{", "actualCallback", "=", "callback", ";", "}", "var", "actualOptions", "=", "{", "name", ":", "playlistName", "}", ";", "if", "(", "typeof", "options", "===", "'object'", ")", "{", "Object", ".", "keys", "(", "options", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "actualOptions", "[", "key", "]", "=", "options", "[", "key", "]", ";", "}", ")", ";", "}", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/users/'", "+", "encodeURIComponent", "(", "userId", ")", "+", "'/playlists'", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "withBodyParameters", "(", "actualOptions", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "post", ",", "actualCallback", ")", ";", "}" ]
Create a playlist. @param {string} userId The playlist's owner's user ID. @param {string} playlistName The name of the playlist. @param {Object} [options] The possible options, currently only public. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example createPlaylist('thelinmichael', 'My cool playlist!', { public : false }).then(...) @returns {Promise|undefined} A promise that if successful, resolves to an object containing information about the created playlist. If rejected, it contains an error object. Not returned if a callback is given.
[ "Create", "a", "playlist", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L519-L541
10,673
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(playlistId, options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/playlists/' + playlistId + '/followers') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters(options) .build() .execute(HttpManager.put, callback); }
javascript
function(playlistId, options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/playlists/' + playlistId + '/followers') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters(options) .build() .execute(HttpManager.put, callback); }
[ "function", "(", "playlistId", ",", "options", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/playlists/'", "+", "playlistId", "+", "'/followers'", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "withBodyParameters", "(", "options", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "put", ",", "callback", ")", ";", "}" ]
Follow a playlist. @param {string} playlistId The playlist's ID @param {Object} [options] The possible options, currently only public. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @returns {Promise|undefined} A promise that if successful, simply resolves to an empty object. If rejected, it contains an error object. Not returned if a callback is given.
[ "Follow", "a", "playlist", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L551-L558
10,674
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(playlistId, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/playlists/' + playlistId + '/followers') .withHeaders({ 'Content-Type': 'application/json' }) .build() .execute(HttpManager.del, callback); }
javascript
function(playlistId, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/playlists/' + playlistId + '/followers') .withHeaders({ 'Content-Type': 'application/json' }) .build() .execute(HttpManager.del, callback); }
[ "function", "(", "playlistId", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/playlists/'", "+", "playlistId", "+", "'/followers'", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "del", ",", "callback", ")", ";", "}" ]
Unfollow a playlist. @param {string} playlistId The playlist's ID @param {Object} [options] The possible options, currently only public. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @returns {Promise|undefined} A promise that if successful, simply resolves to an empty object. If rejected, it contains an error object. Not returned if a callback is given.
[ "Unfollow", "a", "playlist", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L568-L574
10,675
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(playlistId, tracks, options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/playlists/' + playlistId + '/tracks') .withHeaders({ 'Content-Type': 'application/json' }) .withQueryParameters(options) .withBodyParameters({ uris: tracks }) .build() .execute(HttpManager.post, callback); }
javascript
function(playlistId, tracks, options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/playlists/' + playlistId + '/tracks') .withHeaders({ 'Content-Type': 'application/json' }) .withQueryParameters(options) .withBodyParameters({ uris: tracks }) .build() .execute(HttpManager.post, callback); }
[ "function", "(", "playlistId", ",", "tracks", ",", "options", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/playlists/'", "+", "playlistId", "+", "'/tracks'", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "withQueryParameters", "(", "options", ")", ".", "withBodyParameters", "(", "{", "uris", ":", "tracks", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "post", ",", "callback", ")", ";", "}" ]
Add tracks to a playlist. @param {string} playlistId The playlist's ID @param {string[]} tracks URIs of the tracks to add to the playlist. @param {Object} [options] Options, position being the only one. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example addTracksToPlaylist('thelinmichael', '3EsfV6XzCHU8SPNdbnFogK', '["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M"]').then(...) @returns {Promise|undefined} A promise that if successful returns an object containing a snapshot_id. If rejected, it contains an error object. Not returned if a callback is given.
[ "Add", "tracks", "to", "a", "playlist", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L623-L633
10,676
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function( playlistId, positions, snapshotId, callback ) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/playlists/' + playlistId + '/tracks') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters({ positions: positions, snapshot_id: snapshotId }) .build() .execute(HttpManager.del, callback); }
javascript
function( playlistId, positions, snapshotId, callback ) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/playlists/' + playlistId + '/tracks') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters({ positions: positions, snapshot_id: snapshotId }) .build() .execute(HttpManager.del, callback); }
[ "function", "(", "playlistId", ",", "positions", ",", "snapshotId", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/playlists/'", "+", "playlistId", "+", "'/tracks'", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "withBodyParameters", "(", "{", "positions", ":", "positions", ",", "snapshot_id", ":", "snapshotId", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "del", ",", "callback", ")", ";", "}" ]
Remove tracks from a playlist by position instead of specifying the tracks' URIs. @param {string} playlistId The playlist's ID @param {int[]} positions The positions of the tracks in the playlist that should be removed @param {string} snapshot_id The snapshot ID, or version, of the playlist. Required @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @returns {Promise|undefined} A promise that if successful returns an object containing a snapshot_id. If rejected, it contains an error object. Not returned if a callback is given.
[ "Remove", "tracks", "from", "a", "playlist", "by", "position", "instead", "of", "specifying", "the", "tracks", "URIs", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L668-L683
10,677
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function( playlistId, rangeStart, insertBefore, options, callback ) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/playlists/' + playlistId + '/tracks') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters( { range_start: rangeStart, insert_before: insertBefore }, options ) .build() .execute(HttpManager.put, callback); }
javascript
function( playlistId, rangeStart, insertBefore, options, callback ) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/playlists/' + playlistId + '/tracks') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters( { range_start: rangeStart, insert_before: insertBefore }, options ) .build() .execute(HttpManager.put, callback); }
[ "function", "(", "playlistId", ",", "rangeStart", ",", "insertBefore", ",", "options", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/playlists/'", "+", "playlistId", "+", "'/tracks'", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "withBodyParameters", "(", "{", "range_start", ":", "rangeStart", ",", "insert_before", ":", "insertBefore", "}", ",", "options", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "put", ",", "callback", ")", ";", "}" ]
Reorder tracks in a playlist. @param {string} playlistId The playlist's ID @param {int} rangeStart The position of the first track to be reordered. @param {int} insertBefore The position where the tracks should be inserted. @param {Object} options Optional parameters, i.e. range_length and snapshot_id. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @returns {Promise|undefined} A promise that if successful returns an object containing a snapshot_id. If rejected, it contains an error object. Not returned if a callback is given.
[ "Reorder", "tracks", "in", "a", "playlist", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L714-L733
10,678
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(options, callback) { var _opts = {}; var optionsOfTypeArray = ['seed_artists', 'seed_genres', 'seed_tracks']; for (var option in options) { if (options.hasOwnProperty(option)) { if ( optionsOfTypeArray.indexOf(option) !== -1 && Object.prototype.toString.call(options[option]) === '[object Array]' ) { _opts[option] = options[option].join(','); } else { _opts[option] = options[option]; } } } return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/recommendations') .withQueryParameters(_opts) .build() .execute(HttpManager.get, callback); }
javascript
function(options, callback) { var _opts = {}; var optionsOfTypeArray = ['seed_artists', 'seed_genres', 'seed_tracks']; for (var option in options) { if (options.hasOwnProperty(option)) { if ( optionsOfTypeArray.indexOf(option) !== -1 && Object.prototype.toString.call(options[option]) === '[object Array]' ) { _opts[option] = options[option].join(','); } else { _opts[option] = options[option]; } } } return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/recommendations') .withQueryParameters(_opts) .build() .execute(HttpManager.get, callback); }
[ "function", "(", "options", ",", "callback", ")", "{", "var", "_opts", "=", "{", "}", ";", "var", "optionsOfTypeArray", "=", "[", "'seed_artists'", ",", "'seed_genres'", ",", "'seed_tracks'", "]", ";", "for", "(", "var", "option", "in", "options", ")", "{", "if", "(", "options", ".", "hasOwnProperty", "(", "option", ")", ")", "{", "if", "(", "optionsOfTypeArray", ".", "indexOf", "(", "option", ")", "!==", "-", "1", "&&", "Object", ".", "prototype", ".", "toString", ".", "call", "(", "options", "[", "option", "]", ")", "===", "'[object Array]'", ")", "{", "_opts", "[", "option", "]", "=", "options", "[", "option", "]", ".", "join", "(", "','", ")", ";", "}", "else", "{", "_opts", "[", "option", "]", "=", "options", "[", "option", "]", ";", "}", "}", "}", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/recommendations'", ")", ".", "withQueryParameters", "(", "_opts", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "get", ",", "callback", ")", ";", "}" ]
Create a playlist-style listening experience based on seed artists, tracks and genres. @param {Object} [options] The options supplied to this request. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example getRecommendations({ min_energy: 0.4, seed_artists: ['6mfK6Q2tzLMEchAr0e9Uzu', '4DYFVNKZ1uixa6SQTvzQwJ'], min_popularity: 50 }).then(...) @returns {Promise|undefined} A promise that if successful, resolves to an object containing a list of tracks and a list of seeds. If rejected, it contains an error object. Not returned if a callback is given.
[ "Create", "a", "playlist", "-", "style", "listening", "experience", "based", "on", "seed", "artists", "tracks", "and", "genres", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L794-L815
10,679
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(scopes, state, showDialog) { return AuthenticationRequest.builder() .withPath('/authorize') .withQueryParameters({ client_id: this.getClientId(), response_type: 'code', redirect_uri: this.getRedirectURI(), scope: scopes.join('%20'), state: state, show_dialog: showDialog && !!showDialog }) .build() .getURL(); }
javascript
function(scopes, state, showDialog) { return AuthenticationRequest.builder() .withPath('/authorize') .withQueryParameters({ client_id: this.getClientId(), response_type: 'code', redirect_uri: this.getRedirectURI(), scope: scopes.join('%20'), state: state, show_dialog: showDialog && !!showDialog }) .build() .getURL(); }
[ "function", "(", "scopes", ",", "state", ",", "showDialog", ")", "{", "return", "AuthenticationRequest", ".", "builder", "(", ")", ".", "withPath", "(", "'/authorize'", ")", ".", "withQueryParameters", "(", "{", "client_id", ":", "this", ".", "getClientId", "(", ")", ",", "response_type", ":", "'code'", ",", "redirect_uri", ":", "this", ".", "getRedirectURI", "(", ")", ",", "scope", ":", "scopes", ".", "join", "(", "'%20'", ")", ",", "state", ":", "state", ",", "show_dialog", ":", "showDialog", "&&", "!", "!", "showDialog", "}", ")", ".", "build", "(", ")", ".", "getURL", "(", ")", ";", "}" ]
Retrieve a URL where the user can give the application permissions. @param {string[]} scopes The scopes corresponding to the permissions the application needs. @param {string} state A parameter that you can use to maintain a value between the request and the callback to redirect_uri.It is useful to prevent CSRF exploits. @param {boolean} showDialog A parameter that you can use to force the user to approve the app on each login rather than being automatically redirected. @returns {string} The URL where the user can give application permissions.
[ "Retrieve", "a", "URL", "where", "the", "user", "can", "give", "the", "application", "permissions", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L839-L852
10,680
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(trackIds, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/tracks') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters({ ids: trackIds }) .build() .execute(HttpManager.del, callback); }
javascript
function(trackIds, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/tracks') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters({ ids: trackIds }) .build() .execute(HttpManager.del, callback); }
[ "function", "(", "trackIds", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/me/tracks'", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "withBodyParameters", "(", "{", "ids", ":", "trackIds", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "del", ",", "callback", ")", ";", "}" ]
Remove a track from the authenticated user's Your Music library. @param {string[]} trackIds The track IDs @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @returns {Promise|undefined} A promise that if successful returns null, otherwise an error. Not returned if a callback is given.
[ "Remove", "a", "track", "from", "the", "authenticated", "user", "s", "Your", "Music", "library", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L895-L902
10,681
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(albumIds, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/albums') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters(albumIds) .build() .execute(HttpManager.del, callback); }
javascript
function(albumIds, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/albums') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters(albumIds) .build() .execute(HttpManager.del, callback); }
[ "function", "(", "albumIds", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/me/albums'", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "withBodyParameters", "(", "albumIds", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "del", ",", "callback", ")", ";", "}" ]
Remove an album from the authenticated user's Your Music library. @param {string[]} albumIds The album IDs @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @returns {Promise|undefined} A promise that if successful returns null, otherwise an error. Not returned if a callback is given.
[ "Remove", "an", "album", "from", "the", "authenticated", "user", "s", "Your", "Music", "library", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L926-L933
10,682
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/player') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters({ device_ids: options.deviceIds, play: !!options.play }) .build() .execute(HttpManager.put, callback); }
javascript
function(options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/player') .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters({ device_ids: options.deviceIds, play: !!options.play }) .build() .execute(HttpManager.put, callback); }
[ "function", "(", "options", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/me/player'", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "withBodyParameters", "(", "{", "device_ids", ":", "options", ".", "deviceIds", ",", "play", ":", "!", "!", "options", ".", "play", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "put", ",", "callback", ")", ";", "}" ]
Transfer a User's Playback @param {Object} [options] Options, being market. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @returns {Promise|undefined} A promise that if successful, resolves into a paging object of tracks, otherwise an error. Not returned if a callback is given.
[ "Transfer", "a", "User", "s", "Playback" ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L1079-L1089
10,683
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(options, callback) { /*jshint camelcase: false */ var _options = options || {}; var queryParams = _options.device_id ? { device_id: _options.device_id } : null; var postData = {}; ['context_uri', 'uris', 'offset'].forEach(function(field) { if (field in _options) { postData[field] = _options[field]; } }); return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/player/play') .withQueryParameters(queryParams) .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters(postData) .build() .execute(HttpManager.put, callback); }
javascript
function(options, callback) { /*jshint camelcase: false */ var _options = options || {}; var queryParams = _options.device_id ? { device_id: _options.device_id } : null; var postData = {}; ['context_uri', 'uris', 'offset'].forEach(function(field) { if (field in _options) { postData[field] = _options[field]; } }); return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/player/play') .withQueryParameters(queryParams) .withHeaders({ 'Content-Type': 'application/json' }) .withBodyParameters(postData) .build() .execute(HttpManager.put, callback); }
[ "function", "(", "options", ",", "callback", ")", "{", "/*jshint camelcase: false */", "var", "_options", "=", "options", "||", "{", "}", ";", "var", "queryParams", "=", "_options", ".", "device_id", "?", "{", "device_id", ":", "_options", ".", "device_id", "}", ":", "null", ";", "var", "postData", "=", "{", "}", ";", "[", "'context_uri'", ",", "'uris'", ",", "'offset'", "]", ".", "forEach", "(", "function", "(", "field", ")", "{", "if", "(", "field", "in", "_options", ")", "{", "postData", "[", "field", "]", "=", "_options", "[", "field", "]", ";", "}", "}", ")", ";", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/me/player/play'", ")", ".", "withQueryParameters", "(", "queryParams", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "withBodyParameters", "(", "postData", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "put", ",", "callback", ")", ";", "}" ]
Starts o Resumes the Current User's Playback @param {Object} [options] Options, being device_id, context_uri, offset, uris. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example playbackResume({context_uri: 'spotify:album:5ht7ItJgpBH7W6vJ5BqpPr'}).then(...) @returns {Promise|undefined} A promise that if successful, resolves into a paging object of tracks, otherwise an error. Not returned if a callback is given.
[ "Starts", "o", "Resumes", "the", "Current", "User", "s", "Playback" ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L1099-L1118
10,684
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(options, callback) { return ( WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/player/pause') /*jshint camelcase: false */ .withQueryParameters( options && options.device_id ? { device_id: options.device_id } : null ) .withHeaders({ 'Content-Type': 'application/json' }) .build() .execute(HttpManager.put, callback) ); }
javascript
function(options, callback) { return ( WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/player/pause') /*jshint camelcase: false */ .withQueryParameters( options && options.device_id ? { device_id: options.device_id } : null ) .withHeaders({ 'Content-Type': 'application/json' }) .build() .execute(HttpManager.put, callback) ); }
[ "function", "(", "options", ",", "callback", ")", "{", "return", "(", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/me/player/pause'", ")", "/*jshint camelcase: false */", ".", "withQueryParameters", "(", "options", "&&", "options", ".", "device_id", "?", "{", "device_id", ":", "options", ".", "device_id", "}", ":", "null", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "put", ",", "callback", ")", ")", ";", "}" ]
Pauses the Current User's Playback @param {Object} [options] Options, for now device_id, @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example playbackPause().then(...) @returns {Promise|undefined} A promise that if successful, resolves into a paging object of tracks, otherwise an error. Not returned if a callback is given.
[ "Pauses", "the", "Current", "User", "s", "Playback" ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L1128-L1140
10,685
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/player/previous') .withHeaders({ 'Content-Type': 'application/json' }) .build() .execute(HttpManager.post, callback); }
javascript
function(callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/player/previous') .withHeaders({ 'Content-Type': 'application/json' }) .build() .execute(HttpManager.post, callback); }
[ "function", "(", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/me/player/previous'", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "post", ",", "callback", ")", ";", "}" ]
Skip the Current User's Playback To Previous Track @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example playbackPrevious().then(...) @returns {Promise|undefined} A promise that if successful, resolves into a paging object of tracks, otherwise an error. Not returned if a callback is given.
[ "Skip", "the", "Current", "User", "s", "Playback", "To", "Previous", "Track" ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L1149-L1155
10,686
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/player/repeat') .withQueryParameters({ state: options.state || 'off' }) .build() .execute(HttpManager.put, callback); }
javascript
function(options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/player/repeat') .withQueryParameters({ state: options.state || 'off' }) .build() .execute(HttpManager.put, callback); }
[ "function", "(", "options", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/me/player/repeat'", ")", ".", "withQueryParameters", "(", "{", "state", ":", "options", ".", "state", "||", "'off'", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "put", ",", "callback", ")", ";", "}" ]
Set Repeat Mode On The Current User's Playback @param {Object} [options] Options, being state (track, context, off). @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example playbackRepeat({state: 'context'}).then(...) @returns {Promise|undefined} A promise that if successful, resolves into a paging object of tracks, otherwise an error. Not returned if a callback is given.
[ "Set", "Repeat", "Mode", "On", "The", "Current", "User", "s", "Playback" ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L1205-L1213
10,687
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(userIds, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/following') .withQueryParameters({ ids: userIds.join(','), type: 'user' }) .build() .execute(HttpManager.del, callback); }
javascript
function(userIds, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/following') .withQueryParameters({ ids: userIds.join(','), type: 'user' }) .build() .execute(HttpManager.del, callback); }
[ "function", "(", "userIds", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/me/following'", ")", ".", "withQueryParameters", "(", "{", "ids", ":", "userIds", ".", "join", "(", "','", ")", ",", "type", ":", "'user'", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "del", ",", "callback", ")", ";", "}" ]
Remove the current user as a follower of one or more other Spotify users. @param {string[]} userIds The IDs of the users to be unfollowed. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @example unfollowUsers(['thelinmichael', 'wizzler']).then(...) @returns {Promise|undefined} A promise that if successful, simply resolves to an empty object. If rejected, it contains an error object. Not returned if a callback is given.
[ "Remove", "the", "current", "user", "as", "a", "follower", "of", "one", "or", "more", "other", "Spotify", "users", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L1304-L1313
10,688
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/following') .withHeaders({ 'Content-Type': 'application/json' }) .withQueryParameters( { type: 'artist' }, options ) .build() .execute(HttpManager.get, callback); }
javascript
function(options, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath('/v1/me/following') .withHeaders({ 'Content-Type': 'application/json' }) .withQueryParameters( { type: 'artist' }, options ) .build() .execute(HttpManager.get, callback); }
[ "function", "(", "options", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/me/following'", ")", ".", "withHeaders", "(", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ".", "withQueryParameters", "(", "{", "type", ":", "'artist'", "}", ",", "options", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "get", ",", "callback", ")", ";", "}" ]
Get the current user's followed artists. @param {Object} [options] Options, being after and limit. @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @returns {Promise|undefined} A promise that if successful, resolves to an object containing a paging object which contains album objects. Not returned if a callback is given.
[ "Get", "the", "current", "user", "s", "followed", "artists", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L1362-L1374
10,689
thelinmichael/spotify-web-api-node
src/spotify-web-api.js
function(userId, playlistId, followerIds, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath( '/v1/users/' + encodeURIComponent(userId) + '/playlists/' + playlistId + '/followers/contains' ) .withQueryParameters({ ids: followerIds.join(',') }) .build() .execute(HttpManager.get, callback); }
javascript
function(userId, playlistId, followerIds, callback) { return WebApiRequest.builder(this.getAccessToken()) .withPath( '/v1/users/' + encodeURIComponent(userId) + '/playlists/' + playlistId + '/followers/contains' ) .withQueryParameters({ ids: followerIds.join(',') }) .build() .execute(HttpManager.get, callback); }
[ "function", "(", "userId", ",", "playlistId", ",", "followerIds", ",", "callback", ")", "{", "return", "WebApiRequest", ".", "builder", "(", "this", ".", "getAccessToken", "(", ")", ")", ".", "withPath", "(", "'/v1/users/'", "+", "encodeURIComponent", "(", "userId", ")", "+", "'/playlists/'", "+", "playlistId", "+", "'/followers/contains'", ")", ".", "withQueryParameters", "(", "{", "ids", ":", "followerIds", ".", "join", "(", "','", ")", "}", ")", ".", "build", "(", ")", ".", "execute", "(", "HttpManager", ".", "get", ",", "callback", ")", ";", "}" ]
Check if users are following a playlist. @param {string} userId The playlist's owner's user ID @param {string} playlistId The playlist's ID @param {String[]} User IDs of the following users @param {requestCallback} [callback] Optional callback method to be called instead of the promise. @returns {Promise|undefined} A promise that if successful returns an array of booleans. If rejected, it contains an error object. Not returned if a callback is given.
[ "Check", "if", "users", "are", "following", "a", "playlist", "." ]
37a78656198185776ca825b37e2de4a31c2ae5de
https://github.com/thelinmichael/spotify-web-api-node/blob/37a78656198185776ca825b37e2de4a31c2ae5de/src/spotify-web-api.js#L1385-L1399
10,690
bee-queue/arena
src/server/views/dashboard/queueJobsByState.js
isValidState
function isValidState(state, isBee) { const validStates = isBee ? BEE_STATES : BULL_STATES; return _.includes(validStates, state); }
javascript
function isValidState(state, isBee) { const validStates = isBee ? BEE_STATES : BULL_STATES; return _.includes(validStates, state); }
[ "function", "isValidState", "(", "state", ",", "isBee", ")", "{", "const", "validStates", "=", "isBee", "?", "BEE_STATES", ":", "BULL_STATES", ";", "return", "_", ".", "includes", "(", "validStates", ",", "state", ")", ";", "}" ]
Determines if the requested job state lookup is valid. @param {String} state @param {Boolean} isBee States vary between bull and bee @return {Boolean}
[ "Determines", "if", "the", "requested", "job", "state", "lookup", "is", "valid", "." ]
ae39d9051e87f5f0f120db24dc649c98129a9f1e
https://github.com/bee-queue/arena/blob/ae39d9051e87f5f0f120db24dc649c98129a9f1e/src/server/views/dashboard/queueJobsByState.js#L12-L15
10,691
bee-queue/arena
src/server/views/dashboard/queueJobsByState.js
_json
async function _json(req, res) { const { queueName, queueHost, state } = req.params; const {Queues} = req.app.locals; const queue = await Queues.get(queueName, queueHost); if (!queue) return res.status(404).json({ message: 'Queue not found' }); if (!isValidState(state, queue.IS_BEE)) return res.status(400).json({ message: `Invalid state requested: ${state}` }); let jobs; if (queue.IS_BEE) { jobs = await queue.getJobs(state, { size: 1000 }); jobs = jobs.map((j) => _.pick(j, 'id', 'progress', 'data', 'options', 'status')); } else { jobs = await queue[`get${_.capitalize(state)}`](0, 1000); jobs = jobs.map((j) => j.toJSON()); } const filename = `${queueName}-${state}-dump.json`; res.setHeader('Content-disposition', `attachment; filename=${filename}`); res.setHeader('Content-type', 'application/json'); res.write(JSON.stringify(jobs, null, 2), () => res.end()); }
javascript
async function _json(req, res) { const { queueName, queueHost, state } = req.params; const {Queues} = req.app.locals; const queue = await Queues.get(queueName, queueHost); if (!queue) return res.status(404).json({ message: 'Queue not found' }); if (!isValidState(state, queue.IS_BEE)) return res.status(400).json({ message: `Invalid state requested: ${state}` }); let jobs; if (queue.IS_BEE) { jobs = await queue.getJobs(state, { size: 1000 }); jobs = jobs.map((j) => _.pick(j, 'id', 'progress', 'data', 'options', 'status')); } else { jobs = await queue[`get${_.capitalize(state)}`](0, 1000); jobs = jobs.map((j) => j.toJSON()); } const filename = `${queueName}-${state}-dump.json`; res.setHeader('Content-disposition', `attachment; filename=${filename}`); res.setHeader('Content-type', 'application/json'); res.write(JSON.stringify(jobs, null, 2), () => res.end()); }
[ "async", "function", "_json", "(", "req", ",", "res", ")", "{", "const", "{", "queueName", ",", "queueHost", ",", "state", "}", "=", "req", ".", "params", ";", "const", "{", "Queues", "}", "=", "req", ".", "app", ".", "locals", ";", "const", "queue", "=", "await", "Queues", ".", "get", "(", "queueName", ",", "queueHost", ")", ";", "if", "(", "!", "queue", ")", "return", "res", ".", "status", "(", "404", ")", ".", "json", "(", "{", "message", ":", "'Queue not found'", "}", ")", ";", "if", "(", "!", "isValidState", "(", "state", ",", "queue", ".", "IS_BEE", ")", ")", "return", "res", ".", "status", "(", "400", ")", ".", "json", "(", "{", "message", ":", "`", "${", "state", "}", "`", "}", ")", ";", "let", "jobs", ";", "if", "(", "queue", ".", "IS_BEE", ")", "{", "jobs", "=", "await", "queue", ".", "getJobs", "(", "state", ",", "{", "size", ":", "1000", "}", ")", ";", "jobs", "=", "jobs", ".", "map", "(", "(", "j", ")", "=>", "_", ".", "pick", "(", "j", ",", "'id'", ",", "'progress'", ",", "'data'", ",", "'options'", ",", "'status'", ")", ")", ";", "}", "else", "{", "jobs", "=", "await", "queue", "[", "`", "${", "_", ".", "capitalize", "(", "state", ")", "}", "`", "]", "(", "0", ",", "1000", ")", ";", "jobs", "=", "jobs", ".", "map", "(", "(", "j", ")", "=>", "j", ".", "toJSON", "(", ")", ")", ";", "}", "const", "filename", "=", "`", "${", "queueName", "}", "${", "state", "}", "`", ";", "res", ".", "setHeader", "(", "'Content-disposition'", ",", "`", "${", "filename", "}", "`", ")", ";", "res", ".", "setHeader", "(", "'Content-type'", ",", "'application/json'", ")", ";", "res", ".", "write", "(", "JSON", ".", "stringify", "(", "jobs", ",", "null", ",", "2", ")", ",", "(", ")", "=>", "res", ".", "end", "(", ")", ")", ";", "}" ]
Returns the queue jobs in the requested state as a json document. @prop {Object} req express request object @prop {Object} res express response object
[ "Returns", "the", "queue", "jobs", "in", "the", "requested", "state", "as", "a", "json", "document", "." ]
ae39d9051e87f5f0f120db24dc649c98129a9f1e
https://github.com/bee-queue/arena/blob/ae39d9051e87f5f0f120db24dc649c98129a9f1e/src/server/views/dashboard/queueJobsByState.js#L29-L51
10,692
bee-queue/arena
src/server/views/dashboard/queueJobsByState.js
_html
async function _html(req, res) { const { queueName, queueHost, state } = req.params; const {Queues} = req.app.locals; const queue = await Queues.get(queueName, queueHost); const basePath = req.baseUrl; if (!queue) return res.status(404).render('dashboard/templates/queueNotFound', {basePath, queueName, queueHost}); if (!isValidState(state, queue.IS_BEE)) return res.status(400).json({ message: `Invalid state requested: ${state}` }); let jobCounts; if (queue.IS_BEE) { jobCounts = await queue.checkHealth(); delete jobCounts.newestJob; } else { jobCounts = await queue.getJobCounts(); } const page = parseInt(req.query.page, 10) || 1; const pageSize = parseInt(req.query.pageSize, 10) || 100; const startId = (page - 1) * pageSize; const endId = startId + pageSize - 1; let jobs; if (queue.IS_BEE) { const page = {}; if (['failed', 'succeeded'].includes(state)) { page.size = pageSize; } else { page.start = startId; page.end = endId; } jobs = await queue.getJobs(state, page); // Filter out Bee jobs that have already been removed by the time the promise resolves jobs = jobs.filter((job) => job); } else { jobs = await queue[`get${_.capitalize(state)}`](startId, endId); } let pages = _.range(page - 6, page + 7) .filter((page) => page >= 1); while (pages.length < 12) { pages.push(_.last(pages) + 1); } pages = pages.filter((page) => page <= _.ceil(jobCounts[state] / pageSize)); return res.render('dashboard/templates/queueJobsByState', { basePath, queueName, queueHost, state, jobs, jobsInStateCount: jobCounts[state], disablePagination: queue.IS_BEE && (state === 'succeeded' || state === 'failed'), currentPage: page, pages, pageSize, lastPage: _.last(pages) }); }
javascript
async function _html(req, res) { const { queueName, queueHost, state } = req.params; const {Queues} = req.app.locals; const queue = await Queues.get(queueName, queueHost); const basePath = req.baseUrl; if (!queue) return res.status(404).render('dashboard/templates/queueNotFound', {basePath, queueName, queueHost}); if (!isValidState(state, queue.IS_BEE)) return res.status(400).json({ message: `Invalid state requested: ${state}` }); let jobCounts; if (queue.IS_BEE) { jobCounts = await queue.checkHealth(); delete jobCounts.newestJob; } else { jobCounts = await queue.getJobCounts(); } const page = parseInt(req.query.page, 10) || 1; const pageSize = parseInt(req.query.pageSize, 10) || 100; const startId = (page - 1) * pageSize; const endId = startId + pageSize - 1; let jobs; if (queue.IS_BEE) { const page = {}; if (['failed', 'succeeded'].includes(state)) { page.size = pageSize; } else { page.start = startId; page.end = endId; } jobs = await queue.getJobs(state, page); // Filter out Bee jobs that have already been removed by the time the promise resolves jobs = jobs.filter((job) => job); } else { jobs = await queue[`get${_.capitalize(state)}`](startId, endId); } let pages = _.range(page - 6, page + 7) .filter((page) => page >= 1); while (pages.length < 12) { pages.push(_.last(pages) + 1); } pages = pages.filter((page) => page <= _.ceil(jobCounts[state] / pageSize)); return res.render('dashboard/templates/queueJobsByState', { basePath, queueName, queueHost, state, jobs, jobsInStateCount: jobCounts[state], disablePagination: queue.IS_BEE && (state === 'succeeded' || state === 'failed'), currentPage: page, pages, pageSize, lastPage: _.last(pages) }); }
[ "async", "function", "_html", "(", "req", ",", "res", ")", "{", "const", "{", "queueName", ",", "queueHost", ",", "state", "}", "=", "req", ".", "params", ";", "const", "{", "Queues", "}", "=", "req", ".", "app", ".", "locals", ";", "const", "queue", "=", "await", "Queues", ".", "get", "(", "queueName", ",", "queueHost", ")", ";", "const", "basePath", "=", "req", ".", "baseUrl", ";", "if", "(", "!", "queue", ")", "return", "res", ".", "status", "(", "404", ")", ".", "render", "(", "'dashboard/templates/queueNotFound'", ",", "{", "basePath", ",", "queueName", ",", "queueHost", "}", ")", ";", "if", "(", "!", "isValidState", "(", "state", ",", "queue", ".", "IS_BEE", ")", ")", "return", "res", ".", "status", "(", "400", ")", ".", "json", "(", "{", "message", ":", "`", "${", "state", "}", "`", "}", ")", ";", "let", "jobCounts", ";", "if", "(", "queue", ".", "IS_BEE", ")", "{", "jobCounts", "=", "await", "queue", ".", "checkHealth", "(", ")", ";", "delete", "jobCounts", ".", "newestJob", ";", "}", "else", "{", "jobCounts", "=", "await", "queue", ".", "getJobCounts", "(", ")", ";", "}", "const", "page", "=", "parseInt", "(", "req", ".", "query", ".", "page", ",", "10", ")", "||", "1", ";", "const", "pageSize", "=", "parseInt", "(", "req", ".", "query", ".", "pageSize", ",", "10", ")", "||", "100", ";", "const", "startId", "=", "(", "page", "-", "1", ")", "*", "pageSize", ";", "const", "endId", "=", "startId", "+", "pageSize", "-", "1", ";", "let", "jobs", ";", "if", "(", "queue", ".", "IS_BEE", ")", "{", "const", "page", "=", "{", "}", ";", "if", "(", "[", "'failed'", ",", "'succeeded'", "]", ".", "includes", "(", "state", ")", ")", "{", "page", ".", "size", "=", "pageSize", ";", "}", "else", "{", "page", ".", "start", "=", "startId", ";", "page", ".", "end", "=", "endId", ";", "}", "jobs", "=", "await", "queue", ".", "getJobs", "(", "state", ",", "page", ")", ";", "// Filter out Bee jobs that have already been removed by the time the promise resolves", "jobs", "=", "jobs", ".", "filter", "(", "(", "job", ")", "=>", "job", ")", ";", "}", "else", "{", "jobs", "=", "await", "queue", "[", "`", "${", "_", ".", "capitalize", "(", "state", ")", "}", "`", "]", "(", "startId", ",", "endId", ")", ";", "}", "let", "pages", "=", "_", ".", "range", "(", "page", "-", "6", ",", "page", "+", "7", ")", ".", "filter", "(", "(", "page", ")", "=>", "page", ">=", "1", ")", ";", "while", "(", "pages", ".", "length", "<", "12", ")", "{", "pages", ".", "push", "(", "_", ".", "last", "(", "pages", ")", "+", "1", ")", ";", "}", "pages", "=", "pages", ".", "filter", "(", "(", "page", ")", "=>", "page", "<=", "_", ".", "ceil", "(", "jobCounts", "[", "state", "]", "/", "pageSize", ")", ")", ";", "return", "res", ".", "render", "(", "'dashboard/templates/queueJobsByState'", ",", "{", "basePath", ",", "queueName", ",", "queueHost", ",", "state", ",", "jobs", ",", "jobsInStateCount", ":", "jobCounts", "[", "state", "]", ",", "disablePagination", ":", "queue", ".", "IS_BEE", "&&", "(", "state", "===", "'succeeded'", "||", "state", "===", "'failed'", ")", ",", "currentPage", ":", "page", ",", "pages", ",", "pageSize", ",", "lastPage", ":", "_", ".", "last", "(", "pages", ")", "}", ")", ";", "}" ]
Renders an html view of the queue jobs in the requested state. @prop {Object} req express request object @prop {Object} res express response object
[ "Renders", "an", "html", "view", "of", "the", "queue", "jobs", "in", "the", "requested", "state", "." ]
ae39d9051e87f5f0f120db24dc649c98129a9f1e
https://github.com/bee-queue/arena/blob/ae39d9051e87f5f0f120db24dc649c98129a9f1e/src/server/views/dashboard/queueJobsByState.js#L59-L121
10,693
hustcc/timeago.js
src/lang/fa.js
toPersianNumber
function toPersianNumber(number) { // List of standard persian numbers from 0 to 9 const persianDigits = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; return number .toString() .replace(/\d/g, x => persianDigits[x]); }
javascript
function toPersianNumber(number) { // List of standard persian numbers from 0 to 9 const persianDigits = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; return number .toString() .replace(/\d/g, x => persianDigits[x]); }
[ "function", "toPersianNumber", "(", "number", ")", "{", "// List of standard persian numbers from 0 to 9", "const", "persianDigits", "=", "[", "'۰',", " ", "۱', ", "'", "', '", "۳", ", '۴", "'", " '۵'", ",", "'۶',", " ", "۷', ", "'", "', '", "۹", "];", "", "", "", "", "return", "number", ".", "toString", "(", ")", ".", "replace", "(", "/", "\\d", "/", "g", ",", "x", "=>", "persianDigits", "[", "x", "]", ")", ";", "}" ]
As persian language has different number symbols we need to replace regular numbers to standard persian numbres.
[ "As", "persian", "language", "has", "different", "number", "symbols", "we", "need", "to", "replace", "regular", "numbers", "to", "standard", "persian", "numbres", "." ]
1c58c61ced7ab40f630311c392a9142b8ee021fd
https://github.com/hustcc/timeago.js/blob/1c58c61ced7ab40f630311c392a9142b8ee021fd/src/lang/fa.js#L25-L32
10,694
mar10/fancytree
dist/jquery.fancytree-all-deps.js
_subclassObject
function _subclassObject(tree, base, extension, extName) { // $.ui.fancytree.debug("_subclassObject", tree, base, extension, extName); for (var attrName in extension) { if (typeof extension[attrName] === "function") { if (typeof tree[attrName] === "function") { // override existing method tree[attrName] = _makeVirtualFunction( attrName, tree, base, extension, extName ); } else if (attrName.charAt(0) === "_") { // Create private methods in tree.ext.EXTENSION namespace tree.ext[extName][attrName] = _makeVirtualFunction( attrName, tree, base, extension, extName ); } else { $.error( "Could not override tree." + attrName + ". Use prefix '_' to create tree." + extName + "._" + attrName ); } } else { // Create member variables in tree.ext.EXTENSION namespace if (attrName !== "options") { tree.ext[extName][attrName] = extension[attrName]; } } } }
javascript
function _subclassObject(tree, base, extension, extName) { // $.ui.fancytree.debug("_subclassObject", tree, base, extension, extName); for (var attrName in extension) { if (typeof extension[attrName] === "function") { if (typeof tree[attrName] === "function") { // override existing method tree[attrName] = _makeVirtualFunction( attrName, tree, base, extension, extName ); } else if (attrName.charAt(0) === "_") { // Create private methods in tree.ext.EXTENSION namespace tree.ext[extName][attrName] = _makeVirtualFunction( attrName, tree, base, extension, extName ); } else { $.error( "Could not override tree." + attrName + ". Use prefix '_' to create tree." + extName + "._" + attrName ); } } else { // Create member variables in tree.ext.EXTENSION namespace if (attrName !== "options") { tree.ext[extName][attrName] = extension[attrName]; } } } }
[ "function", "_subclassObject", "(", "tree", ",", "base", ",", "extension", ",", "extName", ")", "{", "// $.ui.fancytree.debug(\"_subclassObject\", tree, base, extension, extName);", "for", "(", "var", "attrName", "in", "extension", ")", "{", "if", "(", "typeof", "extension", "[", "attrName", "]", "===", "\"function\"", ")", "{", "if", "(", "typeof", "tree", "[", "attrName", "]", "===", "\"function\"", ")", "{", "// override existing method", "tree", "[", "attrName", "]", "=", "_makeVirtualFunction", "(", "attrName", ",", "tree", ",", "base", ",", "extension", ",", "extName", ")", ";", "}", "else", "if", "(", "attrName", ".", "charAt", "(", "0", ")", "===", "\"_\"", ")", "{", "// Create private methods in tree.ext.EXTENSION namespace", "tree", ".", "ext", "[", "extName", "]", "[", "attrName", "]", "=", "_makeVirtualFunction", "(", "attrName", ",", "tree", ",", "base", ",", "extension", ",", "extName", ")", ";", "}", "else", "{", "$", ".", "error", "(", "\"Could not override tree.\"", "+", "attrName", "+", "\". Use prefix '_' to create tree.\"", "+", "extName", "+", "\"._\"", "+", "attrName", ")", ";", "}", "}", "else", "{", "// Create member variables in tree.ext.EXTENSION namespace", "if", "(", "attrName", "!==", "\"options\"", ")", "{", "tree", ".", "ext", "[", "extName", "]", "[", "attrName", "]", "=", "extension", "[", "attrName", "]", ";", "}", "}", "}", "}" ]
Subclass `base` by creating proxy functions
[ "Subclass", "base", "by", "creating", "proxy", "functions" ]
54307b76844177207e321c5b88eb03a23a6e23a2
https://github.com/mar10/fancytree/blob/54307b76844177207e321c5b88eb03a23a6e23a2/dist/jquery.fancytree-all-deps.js#L1704-L1743
10,695
mar10/fancytree
dist/jquery.fancytree-all-deps.js
function(node, mode) { var i, n; mode = mode || "child"; if (node === false) { for (i = this.children.length - 1; i >= 0; i--) { n = this.children[i]; if (n.statusNodeType === "paging") { this.removeChild(n); } } this.partload = false; return; } node = $.extend( { title: this.tree.options.strings.moreData, statusNodeType: "paging", icon: false, }, node ); this.partload = true; return this.addNode(node, mode); }
javascript
function(node, mode) { var i, n; mode = mode || "child"; if (node === false) { for (i = this.children.length - 1; i >= 0; i--) { n = this.children[i]; if (n.statusNodeType === "paging") { this.removeChild(n); } } this.partload = false; return; } node = $.extend( { title: this.tree.options.strings.moreData, statusNodeType: "paging", icon: false, }, node ); this.partload = true; return this.addNode(node, mode); }
[ "function", "(", "node", ",", "mode", ")", "{", "var", "i", ",", "n", ";", "mode", "=", "mode", "||", "\"child\"", ";", "if", "(", "node", "===", "false", ")", "{", "for", "(", "i", "=", "this", ".", "children", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "n", "=", "this", ".", "children", "[", "i", "]", ";", "if", "(", "n", ".", "statusNodeType", "===", "\"paging\"", ")", "{", "this", ".", "removeChild", "(", "n", ")", ";", "}", "}", "this", ".", "partload", "=", "false", ";", "return", ";", "}", "node", "=", "$", ".", "extend", "(", "{", "title", ":", "this", ".", "tree", ".", "options", ".", "strings", ".", "moreData", ",", "statusNodeType", ":", "\"paging\"", ",", "icon", ":", "false", ",", "}", ",", "node", ")", ";", "this", ".", "partload", "=", "true", ";", "return", "this", ".", "addNode", "(", "node", ",", "mode", ")", ";", "}" ]
Add child status nodes that indicate 'More...', etc. This also maintains the node's `partload` property. @param {boolean|object} node optional node definition. Pass `false` to remove all paging nodes. @param {string} [mode='child'] 'child'|firstChild' @since 2.15
[ "Add", "child", "status", "nodes", "that", "indicate", "More", "...", "etc", "." ]
54307b76844177207e321c5b88eb03a23a6e23a2
https://github.com/mar10/fancytree/blob/54307b76844177207e321c5b88eb03a23a6e23a2/dist/jquery.fancytree-all-deps.js#L2092-L2116
10,696
mar10/fancytree
dist/jquery.fancytree-all-deps.js
function(patch) { // patch [key, null] means 'remove' if (patch === null) { this.remove(); return _getResolvedPromise(this); } // TODO: make sure that root node is not collapsed or modified // copy (most) attributes to node.ATTR or node.data.ATTR var name, promise, v, IGNORE_MAP = { children: true, expanded: true, parent: true }; // TODO: should be global for (name in patch) { v = patch[name]; if (!IGNORE_MAP[name] && !$.isFunction(v)) { if (NODE_ATTR_MAP[name]) { this[name] = v; } else { this.data[name] = v; } } } // Remove and/or create children if (patch.hasOwnProperty("children")) { this.removeChildren(); if (patch.children) { // only if not null and not empty list // TODO: addChildren instead? this._setChildren(patch.children); } // TODO: how can we APPEND or INSERT child nodes? } if (this.isVisible()) { this.renderTitle(); this.renderStatus(); } // Expand collapse (final step, since this may be async) if (patch.hasOwnProperty("expanded")) { promise = this.setExpanded(patch.expanded); } else { promise = _getResolvedPromise(this); } return promise; }
javascript
function(patch) { // patch [key, null] means 'remove' if (patch === null) { this.remove(); return _getResolvedPromise(this); } // TODO: make sure that root node is not collapsed or modified // copy (most) attributes to node.ATTR or node.data.ATTR var name, promise, v, IGNORE_MAP = { children: true, expanded: true, parent: true }; // TODO: should be global for (name in patch) { v = patch[name]; if (!IGNORE_MAP[name] && !$.isFunction(v)) { if (NODE_ATTR_MAP[name]) { this[name] = v; } else { this.data[name] = v; } } } // Remove and/or create children if (patch.hasOwnProperty("children")) { this.removeChildren(); if (patch.children) { // only if not null and not empty list // TODO: addChildren instead? this._setChildren(patch.children); } // TODO: how can we APPEND or INSERT child nodes? } if (this.isVisible()) { this.renderTitle(); this.renderStatus(); } // Expand collapse (final step, since this may be async) if (patch.hasOwnProperty("expanded")) { promise = this.setExpanded(patch.expanded); } else { promise = _getResolvedPromise(this); } return promise; }
[ "function", "(", "patch", ")", "{", "// patch [key, null] means 'remove'", "if", "(", "patch", "===", "null", ")", "{", "this", ".", "remove", "(", ")", ";", "return", "_getResolvedPromise", "(", "this", ")", ";", "}", "// TODO: make sure that root node is not collapsed or modified", "// copy (most) attributes to node.ATTR or node.data.ATTR", "var", "name", ",", "promise", ",", "v", ",", "IGNORE_MAP", "=", "{", "children", ":", "true", ",", "expanded", ":", "true", ",", "parent", ":", "true", "}", ";", "// TODO: should be global", "for", "(", "name", "in", "patch", ")", "{", "v", "=", "patch", "[", "name", "]", ";", "if", "(", "!", "IGNORE_MAP", "[", "name", "]", "&&", "!", "$", ".", "isFunction", "(", "v", ")", ")", "{", "if", "(", "NODE_ATTR_MAP", "[", "name", "]", ")", "{", "this", "[", "name", "]", "=", "v", ";", "}", "else", "{", "this", ".", "data", "[", "name", "]", "=", "v", ";", "}", "}", "}", "// Remove and/or create children", "if", "(", "patch", ".", "hasOwnProperty", "(", "\"children\"", ")", ")", "{", "this", ".", "removeChildren", "(", ")", ";", "if", "(", "patch", ".", "children", ")", "{", "// only if not null and not empty list", "// TODO: addChildren instead?", "this", ".", "_setChildren", "(", "patch", ".", "children", ")", ";", "}", "// TODO: how can we APPEND or INSERT child nodes?", "}", "if", "(", "this", ".", "isVisible", "(", ")", ")", "{", "this", ".", "renderTitle", "(", ")", ";", "this", ".", "renderStatus", "(", ")", ";", "}", "// Expand collapse (final step, since this may be async)", "if", "(", "patch", ".", "hasOwnProperty", "(", "\"expanded\"", ")", ")", "{", "promise", "=", "this", ".", "setExpanded", "(", "patch", ".", "expanded", ")", ";", "}", "else", "{", "promise", "=", "_getResolvedPromise", "(", "this", ")", ";", "}", "return", "promise", ";", "}" ]
Modify existing child nodes. @param {NodePatch} patch @returns {$.Promise} @see FancytreeNode#addChildren
[ "Modify", "existing", "child", "nodes", "." ]
54307b76844177207e321c5b88eb03a23a6e23a2
https://github.com/mar10/fancytree/blob/54307b76844177207e321c5b88eb03a23a6e23a2/dist/jquery.fancytree-all-deps.js#L2135-L2179
10,697
mar10/fancytree
dist/jquery.fancytree-all-deps.js
function(deep) { var cl = this.children, i, l, n; if (!cl) { return 0; } n = cl.length; if (deep !== false) { for (i = 0, l = n; i < l; i++) { n += cl[i].countChildren(); } } return n; }
javascript
function(deep) { var cl = this.children, i, l, n; if (!cl) { return 0; } n = cl.length; if (deep !== false) { for (i = 0, l = n; i < l; i++) { n += cl[i].countChildren(); } } return n; }
[ "function", "(", "deep", ")", "{", "var", "cl", "=", "this", ".", "children", ",", "i", ",", "l", ",", "n", ";", "if", "(", "!", "cl", ")", "{", "return", "0", ";", "}", "n", "=", "cl", ".", "length", ";", "if", "(", "deep", "!==", "false", ")", "{", "for", "(", "i", "=", "0", ",", "l", "=", "n", ";", "i", "<", "l", ";", "i", "++", ")", "{", "n", "+=", "cl", "[", "i", "]", ".", "countChildren", "(", ")", ";", "}", "}", "return", "n", ";", "}" ]
Count direct and indirect children. @param {boolean} [deep=true] pass 'false' to only count direct children @returns {int} number of child nodes
[ "Count", "direct", "and", "indirect", "children", "." ]
54307b76844177207e321c5b88eb03a23a6e23a2
https://github.com/mar10/fancytree/blob/54307b76844177207e321c5b88eb03a23a6e23a2/dist/jquery.fancytree-all-deps.js#L2201-L2216
10,698
mar10/fancytree
dist/jquery.fancytree-all-deps.js
function() { if (this.lazy) { if (this.children == null) { // null or undefined: Not yet loaded return undefined; } else if (this.children.length === 0) { // Loaded, but response was empty return false; } else if ( this.children.length === 1 && this.children[0].isStatusNode() ) { // Currently loading or load error return undefined; } return true; } return !!(this.children && this.children.length); }
javascript
function() { if (this.lazy) { if (this.children == null) { // null or undefined: Not yet loaded return undefined; } else if (this.children.length === 0) { // Loaded, but response was empty return false; } else if ( this.children.length === 1 && this.children[0].isStatusNode() ) { // Currently loading or load error return undefined; } return true; } return !!(this.children && this.children.length); }
[ "function", "(", ")", "{", "if", "(", "this", ".", "lazy", ")", "{", "if", "(", "this", ".", "children", "==", "null", ")", "{", "// null or undefined: Not yet loaded", "return", "undefined", ";", "}", "else", "if", "(", "this", ".", "children", ".", "length", "===", "0", ")", "{", "// Loaded, but response was empty", "return", "false", ";", "}", "else", "if", "(", "this", ".", "children", ".", "length", "===", "1", "&&", "this", ".", "children", "[", "0", "]", ".", "isStatusNode", "(", ")", ")", "{", "// Currently loading or load error", "return", "undefined", ";", "}", "return", "true", ";", "}", "return", "!", "!", "(", "this", ".", "children", "&&", "this", ".", "children", ".", "length", ")", ";", "}" ]
Return true if node has children. Return undefined if not sure, i.e. the node is lazy and not yet loaded). @returns {boolean | undefined}
[ "Return", "true", "if", "node", "has", "children", ".", "Return", "undefined", "if", "not", "sure", "i", ".", "e", ".", "the", "node", "is", "lazy", "and", "not", "yet", "loaded", ")", "." ]
54307b76844177207e321c5b88eb03a23a6e23a2
https://github.com/mar10/fancytree/blob/54307b76844177207e321c5b88eb03a23a6e23a2/dist/jquery.fancytree-all-deps.js#L2673-L2691
10,699
mar10/fancytree
dist/jquery.fancytree-all-deps.js
function(opts) { var i, that = this, deferreds = [], dfd = new $.Deferred(), parents = this.getParentList(false, false), len = parents.length, effects = !(opts && opts.noAnimation === true), scroll = !(opts && opts.scrollIntoView === false); // Expand bottom-up, so only the top node is animated for (i = len - 1; i >= 0; i--) { // that.debug("pushexpand" + parents[i]); deferreds.push(parents[i].setExpanded(true, opts)); } $.when.apply($, deferreds).done(function() { // All expands have finished // that.debug("expand DONE", scroll); if (scroll) { that.scrollIntoView(effects).done(function() { // that.debug("scroll DONE"); dfd.resolve(); }); } else { dfd.resolve(); } }); return dfd.promise(); }
javascript
function(opts) { var i, that = this, deferreds = [], dfd = new $.Deferred(), parents = this.getParentList(false, false), len = parents.length, effects = !(opts && opts.noAnimation === true), scroll = !(opts && opts.scrollIntoView === false); // Expand bottom-up, so only the top node is animated for (i = len - 1; i >= 0; i--) { // that.debug("pushexpand" + parents[i]); deferreds.push(parents[i].setExpanded(true, opts)); } $.when.apply($, deferreds).done(function() { // All expands have finished // that.debug("expand DONE", scroll); if (scroll) { that.scrollIntoView(effects).done(function() { // that.debug("scroll DONE"); dfd.resolve(); }); } else { dfd.resolve(); } }); return dfd.promise(); }
[ "function", "(", "opts", ")", "{", "var", "i", ",", "that", "=", "this", ",", "deferreds", "=", "[", "]", ",", "dfd", "=", "new", "$", ".", "Deferred", "(", ")", ",", "parents", "=", "this", ".", "getParentList", "(", "false", ",", "false", ")", ",", "len", "=", "parents", ".", "length", ",", "effects", "=", "!", "(", "opts", "&&", "opts", ".", "noAnimation", "===", "true", ")", ",", "scroll", "=", "!", "(", "opts", "&&", "opts", ".", "scrollIntoView", "===", "false", ")", ";", "// Expand bottom-up, so only the top node is animated", "for", "(", "i", "=", "len", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "// that.debug(\"pushexpand\" + parents[i]);", "deferreds", ".", "push", "(", "parents", "[", "i", "]", ".", "setExpanded", "(", "true", ",", "opts", ")", ")", ";", "}", "$", ".", "when", ".", "apply", "(", "$", ",", "deferreds", ")", ".", "done", "(", "function", "(", ")", "{", "// All expands have finished", "// that.debug(\"expand DONE\", scroll);", "if", "(", "scroll", ")", "{", "that", ".", "scrollIntoView", "(", "effects", ")", ".", "done", "(", "function", "(", ")", "{", "// that.debug(\"scroll DONE\");", "dfd", ".", "resolve", "(", ")", ";", "}", ")", ";", "}", "else", "{", "dfd", ".", "resolve", "(", ")", ";", "}", "}", ")", ";", "return", "dfd", ".", "promise", "(", ")", ";", "}" ]
Expand all parents and optionally scroll into visible area as neccessary. Promise is resolved, when lazy loading and animations are done. @param {object} [opts] passed to `setExpanded()`. Defaults to {noAnimation: false, noEvents: false, scrollIntoView: true} @returns {$.Promise}
[ "Expand", "all", "parents", "and", "optionally", "scroll", "into", "visible", "area", "as", "neccessary", ".", "Promise", "is", "resolved", "when", "lazy", "loading", "and", "animations", "are", "done", "." ]
54307b76844177207e321c5b88eb03a23a6e23a2
https://github.com/mar10/fancytree/blob/54307b76844177207e321c5b88eb03a23a6e23a2/dist/jquery.fancytree-all-deps.js#L2927-L2955