_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3 values | text stringlengths 52 373k | language stringclasses 1 value | meta_information dict |
|---|---|---|---|---|---|
q25500 | train | function (xmlDom) {
// Create a WmtsCapabilities object from the XML DOM
var wmtsCapabilities = new WorldWind.WmtsCapabilities(xmlDom);
// Retrieve a WmtsLayerCapabilities object by the desired layer name
var wmtsLayerCapabilities = wmtsCapabilities.getLayer(layerIdentifier);
// Form a configuration object from the WmtsLayerCapabilities object
var wmtsConfig = WorldWind.WmtsLayer.formLayerConfiguration(wmtsLayerCapabilities);
// Create the WMTS Layer from the configuration object
var wmtsLayer = new WorldWind.WmtsLayer(wmtsConfig);
// Add the layers to WorldWind and update the layer manager
wwd.addLayer(wmtsLayer);
layerManager.synchronizeLayerList();
} | javascript | {
"resource": ""
} | |
q25501 | train | function (layerElement, capabilities) {
if (!layerElement) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "WmtsLayerCapabilities", "constructor", "missingDomElement"));
}
OwsDescription.call(this, layerElement);
/**
* This layer's WMTS capabilities document, as specified to the constructor of this object.
* @type {{}}
* @readonly
*/
this.capabilities = capabilities;
/**
* The identifier of this layer description.
* @type {String}
* @readonly
*/
this.identifier;
/**
* The titles of this layer.
* @type {String[]}
* @readonly
*/
this.title;
/**
* The abstracts of this layer.
* @type {String[]}
* @readonly
*/
this.abstract;
/**
* The list of keywords associated with this layer description.
* @type {String[]}
* @readonly
*/
this.keywords;
/**
* The WGS84 bounding box associated with this layer. The returned object has the following properties:
* "lowerCorner", "upperCorner".
* @type {{}}
* @readonly
*/
this.wgs84BoundingBox;
/**
* The bounding boxes associated with this layer. The returned array contains objects with the following
* properties: TODO
* @type {Object[]}
* @readonly
*/
this.boundingBox;
/**
* The list of styles associated with this layer description, accumulated from this layer and its parent
* layers. Each object returned may have the following properties: name {String}, title {String},
* abstract {String}, legendUrls {Object[]}, styleSheetUrl, styleUrl. Legend urls may have the following
* properties: width, height, format, url. Style sheet urls and style urls have the following properties:
* format, url.
* @type {Object[]}
* @readonly
*/
this.styles;
/**
* The formats supported by this layer.
* @type {String[]}
* @readonly
*/
this.formats;
/**
* The Feature Info formats supported by this layer.
* @type {String[]}
* @readonly
*/
this.infoFormat;
/**
* The dimensions associated with this layer. The returned array contains objects with the following
* properties:
* @type {Object[]}
* @readonly
*/
this.dimension;
/**
* The metadata associated with this layer description. Each object in the returned array has the
* following properties: type, format, url.
* @type {Object[]}
* @readonly
*/
this.metadata;
/**
* The tile matris sets associated with this layer.
* @type {Object[]}
* @readonly
*/
this.tileMatrixSetLink;
/**
* The resource URLs associated with this layer description. Each object in the returned array has the
* following properties: format, url.
* @type {Object[]}
* @readonly
*/
this.resourceUrl;
this.assembleLayer(layerElement);
} | javascript | {
"resource": ""
} | |
q25502 | train | function (value, minimum, maximum) {
return value < minimum ? minimum : value > maximum ? maximum : value;
} | javascript | {
"resource": ""
} | |
q25503 | train | function (line, equatorialRadius, polarRadius, result) {
if (!line) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath",
"computeEllipsoidalGlobeIntersection", "missingLine"));
}
if (!result) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath",
"computeEllipsoidalGlobeIntersection", "missingResult"));
}
// Taken from "Mathematics for 3D Game Programming and Computer Graphics, Second Edition", Section 5.2.3.
//
// Note that the parameter n from in equations 5.70 and 5.71 is omitted here. For an ellipsoidal globe this
// parameter is always 1, so its square and its product with any other value simplifies to the identity.
var vx = line.direction[0],
vy = line.direction[1],
vz = line.direction[2],
sx = line.origin[0],
sy = line.origin[1],
sz = line.origin[2],
m = equatorialRadius / polarRadius, // ratio of the x semi-axis length to the y semi-axis length
m2 = m * m,
r2 = equatorialRadius * equatorialRadius, // nominal radius squared
a = vx * vx + m2 * vy * vy + vz * vz,
b = 2 * (sx * vx + m2 * sy * vy + sz * vz),
c = sx * sx + m2 * sy * sy + sz * sz - r2,
d = b * b - 4 * a * c, // discriminant
t;
if (d < 0) {
return false;
}
else {
t = (-b - Math.sqrt(d)) / (2 * a);
result[0] = sx + vx * t;
result[1] = sy + vy * t;
result[2] = sz + vz * t;
return true;
}
} | javascript | {
"resource": ""
} | |
q25504 | train | function (origin, globe, xAxisResult, yAxisResult, zAxisResult) {
if (!origin) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath",
"localCoordinateAxesAtPoint", "missingVector"));
}
if (!globe) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath",
"localCoordinateAxesAtPoint", "missingGlobe"));
}
if (!xAxisResult || !yAxisResult || !zAxisResult) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath",
"localCoordinateAxesAtPoint", "missingResult"));
}
var x = origin[0],
y = origin[1],
z = origin[2];
// Compute the z axis from the surface normal in model coordinates. This axis is used to determine the other two
// axes, and is the only constant in the computations below.
globe.surfaceNormalAtPoint(x, y, z, zAxisResult);
// Compute the y axis from the north pointing tangent in model coordinates. This axis is known to be orthogonal to
// the z axis, and is therefore used to compute the x axis.
globe.northTangentAtPoint(x, y, z, yAxisResult);
// Compute the x axis as the cross product of the y and z axes. This ensures that the x and z axes are orthogonal.
xAxisResult.set(yAxisResult[0], yAxisResult[1], yAxisResult[2]);
xAxisResult.cross(zAxisResult);
xAxisResult.normalize();
// Re-compute the y axis as the cross product of the z and x axes. This ensures that all three axes are orthogonal.
// Though the initial y axis computed above is likely to be very nearly orthogonal, we re-compute it using cross
// products to reduce the effect of floating point rounding errors caused by working with Earth sized coordinates.
yAxisResult.set(zAxisResult[0], zAxisResult[1], zAxisResult[2]);
yAxisResult.cross(xAxisResult);
yAxisResult.normalize();
} | javascript | {
"resource": ""
} | |
q25505 | train | function (radius, altitude) {
if (radius < 0) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath",
"horizontalDistanceForGlobeRadius", "The specified globe radius is negative."));
}
return (radius > 0 && altitude > 0) ? Math.sqrt(altitude * (2 * radius + altitude)) : 0;
} | javascript | {
"resource": ""
} | |
q25506 | train | function (farDistance, farResolution, depthBits) {
if (farDistance < 0) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath", "perspectiveNearDistanceForFarDistance",
"The specified distance is negative."));
}
if (farResolution < 0) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath", "perspectiveNearDistanceForFarDistance",
"The specified resolution is negative."));
}
if (depthBits < 1) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath", "perspectiveNearDistanceForFarDistance",
"The specified depth bits is negative."));
}
var maxDepthValue = (1 << depthBits) - 1;
return farDistance / (maxDepthValue / (1 - farResolution / farDistance) - maxDepthValue + 1);
} | javascript | {
"resource": ""
} | |
q25507 | train | function (viewportWidth, viewportHeight, distance) {
if (viewportWidth <= 0) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath", "perspectiveFrustumRectangle",
"invalidWidth"));
}
if (viewportHeight <= 0) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath", "perspectiveFrustumRectangle",
"invalidHeight"));
}
if (distance < 0) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath", "perspectiveFrustumRectangle",
"The specified distance is negative."));
}
// Assumes a 45 degree horizontal field of view.
var width = distance,
height = distance * viewportHeight / viewportWidth;
return new Rectangle(-width / 2, -height / 2, width, height);
} | javascript | {
"resource": ""
} | |
q25508 | train | function (transformMatrix) {
if (!transformMatrix) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "WWMath", "boundingRectForUnitQuad",
"missingMatrix"));
}
var m = transformMatrix,
// transform of (0, 0)
x1 = m[3],
y1 = m[7],
// transform of (1, 0)
x2 = m[0] + m[3],
y2 = m[4] + m[7],
// transform of (0, 1)
x3 = m[1] + m[3],
y3 = m[5] + m[7],
// transform of (1, 1)
x4 = m[0] + m[1] + m[3],
y4 = m[4] + m[5] + m[7],
minX = Math.min(Math.min(x1, x2), Math.min(x3, x4)),
maxX = Math.max(Math.max(x1, x2), Math.max(x3, x4)),
minY = Math.min(Math.min(y1, y2), Math.min(y3, y4)),
maxY = Math.max(Math.max(y1, y2), Math.max(y3, y4));
return new Rectangle(minX, minY, maxX - minX, maxY - minY);
} | javascript | {
"resource": ""
} | |
q25509 | train | function (latitude) {
return Math.log(Math.tan(Math.PI / 4 + (latitude * Angle.DEGREES_TO_RADIANS) / 2)) / Math.PI;
} | javascript | {
"resource": ""
} | |
q25510 | train | function (value) {
var power = Math.floor(Math.log(value) / Math.log(2));
return Math.pow(2, power);
} | javascript | {
"resource": ""
} | |
q25511 | train | function (worldWindow) {
if (!worldWindow) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "FrameStatisticsLayer", "constructor", "missingWorldWindow"));
}
Layer.call(this, "Frame Statistics");
// No picking of this layer's screen elements.
this.pickEnabled = false;
var textAttributes = new TextAttributes(null);
textAttributes.color = Color.GREEN;
textAttributes.font = new Font(12);
textAttributes.offset = new Offset(WorldWind.OFFSET_FRACTION, 0, WorldWind.OFFSET_FRACTION, 1);
// Intentionally not documented.
this.frameTime = new ScreenText(new Offset(WorldWind.OFFSET_PIXELS, 5, WorldWind.OFFSET_INSET_PIXELS, 5), " ");
this.frameTime.attributes = textAttributes;
// Intentionally not documented.
this.frameRate = new ScreenText(new Offset(WorldWind.OFFSET_PIXELS, 5, WorldWind.OFFSET_INSET_PIXELS, 25), " ");
this.frameRate.attributes = textAttributes;
// Register a redraw callback on the WorldWindow.
var thisLayer = this;
function redrawCallback(worldWindow, stage) {
thisLayer.handleRedraw(worldWindow, stage);
}
worldWindow.redrawCallbacks.push(redrawCallback);
} | javascript | {
"resource": ""
} | |
q25512 | train | function (screenOffset, imagePath) {
var sOffset = screenOffset ? screenOffset
: new Offset(WorldWind.OFFSET_FRACTION, 1, WorldWind.OFFSET_FRACTION, 1), // upper-right placement
iPath = imagePath ? imagePath : WorldWind.configuration.baseUrl + "images/notched-compass.png";
ScreenImage.call(this, sOffset, iPath);
// Must set the default image offset after calling the constructor above.
if (!screenOffset) {
// Align the upper right corner of the image with the screen point, and give the image some padding.
this.imageOffset = new Offset(WorldWind.OFFSET_FRACTION, 1.1, WorldWind.OFFSET_FRACTION, 1.1);
}
/**
* Specifies the size of the compass as a fraction of the WorldWindow width.
* @type {number}
* @default 0.15
*/
this.size = 0.15;
} | javascript | {
"resource": ""
} | |
q25513 | train | function (displayName, measuredLocations, numLevels) {
this.tileWidth = 256;
this.tileHeight = 256;
TiledImageLayer.call(this, new Sector(-90, 90, -180, 180), new Location(45, 45), numLevels || 18, 'image/png', 'HeatMap' + WWUtil.guid(), this.tileWidth, this.tileHeight);
this.displayName = displayName;
var data = {};
for (var lat = -90; lat <= 90; lat++) {
data[lat] = {};
for (var lon = -180; lon <= 180; lon++) {
data[lat][lon] = [];
}
}
var latitude, longitude;
var max = Number.MIN_VALUE;
measuredLocations.forEach(function (measured) {
latitude = Math.floor(measured.latitude);
longitude = Math.floor(measured.longitude);
data[latitude][longitude].push(measured);
if(measured.measure > max) {
max = measured.measure;
}
});
this._data = data;
this._measuredLocations = measuredLocations;
this._intervalType = HeatMapIntervalType.CONTINUOUS;
this._scale = ['blue', 'cyan', 'lime', 'yellow', 'red'];
this._radius = 12.5;
this._incrementPerIntensity = 1 / max;
this.setGradient(measuredLocations);
} | javascript | {
"resource": ""
} | |
q25514 | train | function (target, callback) {
GestureRecognizer.call(this, target, callback);
/**
*
* @type {Number}
*/
this.minNumberOfTouches = 1;
/**
*
* @type {Number}
*/
this.maxNumberOfTouches = Number.MAX_VALUE;
// Intentionally not documented.
this.interpretDistance = 20;
} | javascript | {
"resource": ""
} | |
q25515 | train | function () {
var pathAttributes = new WorldWind.ShapeAttributes(null);
pathAttributes.interiorColor = WorldWind.Color.CYAN;
pathAttributes.outlineColor= WorldWind.Color.BLUE;
var pathPositions = [
new WorldWind.Position(40, -100, 1e4),
new WorldWind.Position(45, -110, 1e4),
new WorldWind.Position(46, -122, 1e4)
];
var path = new WorldWind.Path(pathPositions);
path.attributes = pathAttributes;
path.altitudeMode = WorldWind.RELATIVE_TO_GROUND;
path.followTerrain = true;
var pathLayer = new WorldWind.RenderableLayer("Path Layer");
pathLayer.addRenderable(path);
return pathLayer;
} | javascript | {
"resource": ""
} | |
q25516 | train | function (o) {
// The input argument is either an Event or a TapRecognizer. Both have the same properties for determining
// the mouse or tap location.
var x = o.clientX,
y = o.clientY;
// Perform the pick. Must first convert from window coordinates to canvas coordinates, which are
// relative to the upper left corner of the canvas rather than the upper left corner of the page.
var pickList = wwd.pick(wwd.canvasCoordinates(x, y));
if (pickList.objects.length > 0) {
for (var p = 0; p < pickList.objects.length; p++) {
// If the compass is picked, reset the navigator heading to 0 to re-orient the globe.
if (pickList.objects[p].userObject instanceof WorldWind.Compass) {
wwd.navigator.heading = 0;
wwd.redraw();
}
else if (pickList.objects[p].userObject instanceof WorldWind.ScreenImage) {
console.log("Screen image picked");
}
}
}
} | javascript | {
"resource": ""
} | |
q25517 | train | function (position, sceneData) {
if (!position) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "ColladaScene", "constructor", "missingPosition"));
}
Renderable.call(this);
// Documented in defineProperties below.
this._position = position;
// Documented in defineProperties below.
this._nodes = [];
this._meshes = {};
this._materials = {};
this._images = {};
this._upAxis = '';
this._dirPath = '';
// Documented in defineProperties below.
this._xRotation = 0;
this._yRotation = 0;
this._zRotation = 0;
// Documented in defineProperties below.
this._xTranslation = 0;
this._yTranslation = 0;
this._zTranslation = 0;
// Documented in defineProperties below.
this._scale = 1;
// Documented in defineProperties below.
this._altitudeMode = WorldWind.ABSOLUTE;
// Documented in defineProperties below.
this._localTransforms = true;
// Documented in defineProperties below.
this._useTexturePaths = true;
// Documented in defineProperties below.
this._nodesToHide = [];
this._hideNodes = false;
// Documented in defineProperties below.
this._placePoint = new Vec3(0, 0, 0);
// Documented in defineProperties below.
this._transformationMatrix = Matrix.fromIdentity();
this._mvpMatrix = Matrix.fromIdentity();
// Documented in defineProperties below.
this._normalTransformMatrix = Matrix.fromIdentity();
this._normalMatrix = Matrix.fromIdentity();
this._texCoordMatrix = Matrix.fromIdentity().setToUnitYFlip();
//Internal. Intentionally not documented.
this._entities = [];
//Internal. Intentionally not documented.
this._activeTexture = null;
//Internal. Intentionally not documented.
this._tmpVector = new Vec3(0, 0, 0);
this._tmpColor = new Color(1, 1, 1, 1);
//Internal. Intentionally not documented.
this._vboCacheKey = '';
this._iboCacheKey = '';
this.setSceneData(sceneData);
} | javascript | {
"resource": ""
} | |
q25518 | train | function (serverAddress, pathToData, displayName) {
var cachePath = WWUtil.urlPath(serverAddress + "/" + pathToData);
TiledImageLayer.call(this, Sector.FULL_SPHERE, new Location(36, 36), 10, "image/png", cachePath, 512, 512);
this.displayName = displayName;
this.pickEnabled = false;
this.urlBuilder = new LevelRowColumnUrlBuilder(serverAddress, pathToData);
} | javascript | {
"resource": ""
} | |
q25519 | train | function (globe, tessellator, terrainTiles, verticalExaggeration) {
/**
* The globe associated with this terrain.
* @type {Globe}
*/
this.globe = globe;
/**
* The vertical exaggeration of this terrain.
* @type {Number}
*/
this.verticalExaggeration = verticalExaggeration;
/**
* The sector spanned by this terrain.
* @type {Sector}
*/
this.sector = terrainTiles.sector;
/**
* The tessellator used to generate this terrain.
* @type {Tessellator}
*/
this.tessellator = tessellator;
/**
* The surface geometry for this terrain
* @type {TerrainTile[]}
*/
this.surfaceGeometry = terrainTiles.tileArray;
/**
* A string identifying this terrain's current state. Used to compare states during rendering to
* determine whether state dependent cached values must be updated. Applications typically do not
* interact with this property.
* @readonly
* @type {String}
*/
this.stateKey = globe.stateKey + " ve " + verticalExaggeration.toString();
} | javascript | {
"resource": ""
} | |
q25520 | train | function (nightImageSource) {
Layer.call(this, "Atmosphere");
// The atmosphere layer is not pickable.
this.pickEnabled = false;
//Documented in defineProperties below.
this._nightImageSource = nightImageSource ||
WorldWind.configuration.baseUrl + 'images/dnb_land_ocean_ice_2012.png';
//Internal use only.
//The light direction in cartesian space, computed from the layer time or defaults to the eyePoint.
this._activeLightDirection = new Vec3(0, 0, 0);
this._fullSphereSector = Sector.FULL_SPHERE;
//Internal use only. Intentionally not documented.
this._skyData = {};
//Internal use only. The number of longitudinal points in the grid for the sky geometry.
this._skyWidth = 128;
//Internal use only. The number of latitudinal points in the grid for the sky geometry.
this._skyHeight = 128;
//Internal use only. Number of indices for the sky geometry.
this._numIndices = 0;
//Internal use only. Texture coordinate matrix used for the night texture.
this._texMatrix = Matrix3.fromIdentity();
//Internal use only. The night texture.
this._activeTexture = null;
} | javascript | {
"resource": ""
} | |
q25521 | train | function (target, callback) {
if (!target) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "GestureRecognizer", "constructor", "missingTarget"));
}
/**
* Indicates the document element this gesture recognizer observes for UI events.
* @type {EventTarget}
* @readonly
*/
this.target = target;
/**
* Indicates whether or not this gesture recognizer is enabled. When false, this gesture recognizer will
* ignore any events dispatched by its target.
* @type {Boolean}
* @default true
*/
this.enabled = true;
// Documented with its property accessor below.
this._state = WorldWind.POSSIBLE;
// Intentionally not documented.
this._nextState = null;
// Documented with its property accessor below.
this._clientX = 0;
// Documented with its property accessor below.
this._clientY = 0;
// Intentionally not documented.
this._clientStartX = 0;
// Intentionally not documented.
this._clientStartY = 0;
// Documented with its property accessor below.
this._translationX = 0;
// Documented with its property accessor below.
this._translationY = 0;
// Intentionally not documented.
this._translationWeight = 0.4;
// Documented with its property accessor below.
this._mouseButtonMask = 0;
// Intentionally not documented.
this._touches = [];
// Intentionally not documented.
this._touchCentroidShiftX = 0;
// Intentionally not documented.
this._touchCentroidShiftY = 0;
// Documented with its property accessor below.
this._gestureCallbacks = [];
// Intentionally not documented.
this._canRecognizeWith = [];
// Intentionally not documented.
this._requiresFailureOf = [];
// Intentionally not documented.
this._requiredToFailBy = [];
// Add the optional gesture callback.
if (callback) {
this._gestureCallbacks.push(callback);
}
// Intentionally not documented.
this.listenerList = [];
// Add this recognizer to the list of all recognizers.
GestureRecognizer.allRecognizers.push(this);
} | javascript | {
"resource": ""
} | |
q25522 | train | function (minLatitude, maxLatitude, minLongitude, maxLongitude) {
/**
* This sector's minimum latitude in degrees.
* @type {Number}
*/
this.minLatitude = minLatitude;
/**
* This sector's maximum latitude in degrees.
* @type {Number}
*/
this.maxLatitude = maxLatitude;
/**
* This sector's minimum longitude in degrees.
* @type {Number}
*/
this.minLongitude = minLongitude;
/**
* This sector's maximum longitude in degrees.
* @type {Number}
*/
this.maxLongitude = maxLongitude;
} | javascript | {
"resource": ""
} | |
q25523 | train | function(data, options) {
HeatMapTile.call(this, data, options);
this._extendedWidth = options.extendedWidth;
this._extendedHeight = options.extendedHeight;
this._gradient = this.gradient(options.intensityGradient);
} | javascript | {
"resource": ""
} | |
q25524 | train | function (sector, imageSource) {
if (!sector) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceImage", "constructor",
"missingSector"));
}
if (!imageSource) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceImage", "constructor",
"missingImage"));
}
SurfaceTile.call(this, sector);
/**
* Indicates whether this surface image is drawn.
* @type {boolean}
* @default true
*/
this.enabled = true;
/**
* The path to the image.
* @type {String}
*/
this._imageSource = imageSource;
/**
* This surface image's resampling mode. Indicates the sampling algorithm used to display this image when it
* is larger on screen than its native resolution. May be one of:
* <ul>
* <li>WorldWind.FILTER_LINEAR</li>
* <li>WorldWind.FILTER_NEAREST</li>
* </ul>
* @default WorldWind.FILTER_LINEAR
*/
this.resamplingMode = WorldWind.FILTER_LINEAR;
/**
* This surface image's opacity. When this surface image is drawn, the actual opacity is the product of
* this opacity and the opacity of the layer containing this surface image.
* @type {number}
*/
this.opacity = 1;
/**
* This surface image's display name;
* @type {string}
*/
this.displayName = "Surface Image";
// Internal. Indicates whether the image needs to be updated in the GPU resource cache.
this.imageSourceWasUpdated = true;
} | javascript | {
"resource": ""
} | |
q25525 | train | function () {
// Documented in defineProperties below.
this._ncols = null;
// Documented in defineProperties below.
this._nrows = null;
// Documented in defineProperties below.
this._xllcorner = null;
// Documented in defineProperties below.
this._yllcorner = null;
// Documented in defineProperties below.
this._cellsize = null;
// Documented in defineProperties below.
this._NODATA_value = undefined;
} | javascript | {
"resource": ""
} | |
q25526 | train | function () {
/**
* The width in pixels of framebuffers associated with this controller's tiles.
* @type {Number}
* @readonly
*/
this.tileWidth = 256;
/**
* The height in pixels of framebuffers associated with this controller's tiles.
* @type {Number}
* @readonly
*/
this.tileHeight = 256;
/**
* Controls the level of detail switching for this controller. The next highest resolution level is
* used when an image's texel size is greater than this number of pixels.
* @type {Number}
* @default 1.75
*/
this.detailControl = 1.75;
// Internal. Intentionally not documented.
this.levels = new LevelSet(Sector.FULL_SPHERE, new Location(45, 45), 16, this.tileWidth, this.tileHeight);
// Internal. Intentionally not documented.
this.topLevelTiles = [];
// Internal. Intentionally not documented.
this.currentTiles = [];
// Internal. Intentionally not documented.
this.currentTimestamp = null;
// Internal. Intentionally not documented.
this.currentGlobeStateKey = null;
// Internal. Intentionally not documented.
this.tileCache = new MemoryCache(500000, 400000);
// Internal. Intentionally not documented.
this.key = "FramebufferTileController " + ++FramebufferTileController.keyPool;
} | javascript | {
"resource": ""
} | |
q25527 | getTextOfNode | train | function getTextOfNode(node) {
var result;
if (node != null && node.childNodes[0]) {
result = node.childNodes[0].nodeValue;
} else if (node != null) {
result = "";
}
return result;
} | javascript | {
"resource": ""
} |
q25528 | train | function (target, callback) {
GestureRecognizer.call(this, target, callback);
/**
*
* @type {Number}
*/
this.numberOfClicks = 1;
/**
*
* @type {Number}
*/
this.button = 0;
// Intentionally not documented.
this.maxMouseMovement = 5;
// Intentionally not documented.
this.maxClickDuration = 500;
// Intentionally not documented.
this.maxClickInterval = 400;
// Intentionally not documented.
this.clicks = [];
// Intentionally not documented.
this.timeout = null;
} | javascript | {
"resource": ""
} | |
q25529 | train | function (sequenceString) {
if (!sequenceString) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "PeriodicTimeSequence", "constructor", "missingString"));
}
var intervalParts = sequenceString.split("/");
if (intervalParts.length !== 3) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "PeriodicTimeSequence", "constructor",
"The interval string " + sequenceString + " does not contain 3 elements."));
}
/**
* This sequence's sequence string, as specified to the constructor.
* @type {String}
* @readonly
*/
this.sequenceString = sequenceString;
/**
* This sequence's start time.
* @type {Date}
* @readonly
*/
this.startTime = new Date(intervalParts[0]);
/**
* This sequence's end time.
* @type {Date}
* @readonly
*/
this.endTime = new Date(intervalParts[1]);
// Intentionally not documented.
this.intervalMilliseconds = this.endTime.getTime() - this.startTime.getTime();
// Documented with property accessor below.
this._currentTime = this.startTime;
/**
* Indicates whether this sequence is an infinite sequence -- the start and end dates are the same.
* @type {Boolean}
* @readonly
*/
this.infiniteInterval = this.startTime.getTime() == this.endTime.getTime();
// Intentionally not documented. The array of sequence increments:
// year, month, week, day, hours, minutes, seconds
this.period = PeriodicTimeSequence.parsePeriodString(intervalParts[2], false);
} | javascript | {
"resource": ""
} | |
q25530 | train | function (xUnits, x, yUnits, y) {
/**
* The offset in the X dimension, interpreted according to this instance's xUnits argument.
* @type {Number}
*/
this.x = x;
/**
* The offset in the Y dimension, interpreted according to this instance's yUnits argument.
* @type {Number}
*/
this.y = y;
/**
* The units of this instance's X offset. See this class' constructor description for a list of the
* possible values.
* @type {String}
*/
this.xUnits = xUnits;
/**
* The units of this instance's Y offset. See this class' constructor description for a list of the
* possible values.
* @type {String}
*/
this.yUnits = yUnits;
} | javascript | {
"resource": ""
} | |
q25531 | train | function (xmlNode) {
if (!xmlNode) {
return null;
}
var text = xmlNode.textContent;
text = text.replace(/\n/gi, " ");
text = text.replace(/\s+/gi, " ");
text = text.trim();
if (text.length === 0) {
return null;
}
return text.split(" ");
} | javascript | {
"resource": ""
} | |
q25532 | train | function (xmlNode) {
var rawValues = this.getRawValues(xmlNode);
if (!rawValues) {
return null;
}
var len = rawValues.length;
var bufferData = new Float32Array(len);
for (var i = 0; i < len; i++) {
bufferData[i] = parseFloat(rawValues[i]);
}
return bufferData;
} | javascript | {
"resource": ""
} | |
q25533 | train | function (xmlNode) {
var rawValues = this.getRawValues(xmlNode);
if (!rawValues) {
return null;
}
var len = rawValues.length;
var bufferData = new Uint32Array(len);
for (var i = 0; i < len; i++) {
bufferData[i] = parseInt(rawValues[i]);
}
return bufferData;
} | javascript | {
"resource": ""
} | |
q25534 | train | function (xmlNode, nodeName) {
var childs = xmlNode.childNodes;
for (var i = 0; i < childs.length; ++i) {
var item = childs.item(i);
if (item.nodeType !== 1) {
continue;
}
if ((item.nodeName && !nodeName) || (nodeName && nodeName === item.nodeName)) {
return item;
}
}
return null;
} | javascript | {
"resource": ""
} | |
q25535 | train | function (filePath) {
var pos = filePath.lastIndexOf("\\");
if (pos !== -1) {
filePath = filePath.substr(pos + 1);
}
pos = filePath.lastIndexOf("/");
if (pos !== -1) {
filePath = filePath.substr(pos + 1);
}
return filePath;
} | javascript | {
"resource": ""
} | |
q25536 | train | function (nodes, id) {
for (var i = 0; i < nodes.length; i++) {
var attrId = nodes.item(i).getAttribute("id");
if (!attrId) {
continue;
}
if (attrId.toString() === id) {
return nodes.item(i);
}
}
return null;
} | javascript | {
"resource": ""
} | |
q25537 | train | function (uvs) {
var clamp = true;
for (var i = 0, len = uvs.length; i < len; i++) {
if (uvs[i] < 0 || uvs[i] > 1) {
clamp = false;
break;
}
}
return clamp;
} | javascript | {
"resource": ""
} | |
q25538 | train | function (url, cb) {
var request = new XMLHttpRequest();
request.onload = function () {
if (this.status >= 200 && this.status < 400) {
cb(this.response);
}
else {
Logger.log(Logger.LEVEL_SEVERE, "sever error: " + this.status);
cb(null);
}
};
request.onerror = function (e) {
Logger.log(Logger.LEVEL_SEVERE, "connection error: " + e);
cb(null);
};
request.open("get", url, true);
request.send();
} | javascript | {
"resource": ""
} | |
q25539 | train | function () {
RenderableLayer.call(this, "Blue Marble Image");
var surfaceImage = new SurfaceImage(Sector.FULL_SPHERE,
WorldWind.configuration.baseUrl + "images/BMNG_world.topo.bathy.200405.3.2048x1024.jpg");
this.addRenderable(surfaceImage);
this.pickEnabled = false;
this.minActiveAltitude = 3e6;
} | javascript | {
"resource": ""
} | |
q25540 | train | function (attributes, record) {
var configuration = {};
configuration.name = attributes.values.name || attributes.values.Name || attributes.values.NAME;
if (record.isPointType()) { // Configure point-based features (cities, in this example)
configuration.name = attributes.values.name || attributes.values.Name || attributes.values.NAME;
configuration.attributes = new WorldWind.PlacemarkAttributes(placemarkAttributes);
if (attributes.values.pop_max) {
var population = attributes.values.pop_max;
configuration.attributes.imageScale = 0.01 * Math.log(population);
}
} else if (record.isPolygonType()) { // Configure polygon-based features (countries, in this example).
configuration.attributes = new WorldWind.ShapeAttributes(null);
// Fill the polygon with a random pastel color.
configuration.attributes.interiorColor = new WorldWind.Color(
0.375 + 0.5 * Math.random(),
0.375 + 0.5 * Math.random(),
0.375 + 0.5 * Math.random(),
1.0);
// Paint the outline in a darker variant of the interior color.
configuration.attributes.outlineColor = new WorldWind.Color(
0.5 * configuration.attributes.interiorColor.red,
0.5 * configuration.attributes.interiorColor.green,
0.5 * configuration.attributes.interiorColor.blue,
1.0);
}
return configuration;
} | javascript | {
"resource": ""
} | |
q25541 | train | function (capacity, lowWater) {
if (!capacity || capacity < 1) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "GpuResourceCache", "constructor",
"Specified cache capacity is undefined, 0 or negative."));
}
if (!lowWater || lowWater < 0 || lowWater >= capacity) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "GpuResourceCache", "constructor",
"Specified cache low-water value is undefined, negative or not less than the capacity."));
}
// Private. Holds the actual cache entries.
this.entries = new MemoryCache(capacity, lowWater);
// Private. Counter for generating cache keys.
this.cacheKeyPool = 0;
// Private. List of retrievals currently in progress.
this.currentRetrievals = {};
// Private. Identifies requested resources that whose retrieval failed.
this.absentResourceList = new AbsentResourceList(3, 60e3);
} | javascript | {
"resource": ""
} | |
q25542 | train | function () {
/**
* This ordered renderable's display name.
* @type {String}
* @default Renderable
*/
this.displayName = "Renderable";
/**
* Indicates whether this ordered renderable is enabled.
* @type {Boolean}
* @default true
*/
this.enabled = true;
/**
* This ordered renderable's distance from the eye point in meters.
* @type {Number}
* @default Number.MAX_VALUE
*/
this.eyeDistance = Number.MAX_VALUE;
/**
* The time at which this ordered renderable was inserted into the ordered rendering list.
* @type {Number}
* @default 0
*/
this.insertionTime = 0;
throw new UnsupportedOperationError(
Logger.logMessage(Logger.LEVEL_SEVERE, "OrderedRenderable", "constructor", "abstractInvocation"));
} | javascript | {
"resource": ""
} | |
q25543 | train | function (size, style, variant, weight, family, horizontalAlignment) {
/*
* All properties of Font are intended to be private and must be accessed via public getters and setters.
*/
if (!size) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "Font", "constructor",
"missingSize"));
}
else if (size <= 0) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "Font", "constructor",
"invalidSize"));
}
else {
this._size = size;
}
this.style = style || "normal";
this.variant = variant || "normal";
this.weight = weight || "normal";
this.family = family || "sans-serif";
this.horizontalAlignment = horizontalAlignment || "center";
} | javascript | {
"resource": ""
} | |
q25544 | train | function (sector, imageWidth, imageHeight) {
if (!sector) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "ElevationImage", "constructor", "missingSector"));
}
/**
* The sector spanned by this elevation image.
* @type {Sector}
* @readonly
*/
this.sector = sector;
/**
* The number of longitudinal sample points in this elevation image.
* @type {Number}
* @readonly
*/
this.imageWidth = imageWidth;
/**
* The number of latitudinal sample points in this elevation image.
* @type {Number}
* @readonly
*/
this.imageHeight = imageHeight;
/**
* The size in bytes of this elevation image.
* @type {number}
* @readonly
*/
this.size = this.imageWidth * this.imageHeight;
/**
* Internal use only
* false if the entire image consists of NO_DATA values, true otherwise.
* @ignore
*/
this.hasData = true;
/**
* Internal use only
* true if any pixel in the image has a NO_DATA value, false otherwise.
* @ignore
*/
this.hasMissingData = false;
} | javascript | {
"resource": ""
} | |
q25545 | getLetter100kID | train | function getLetter100kID(column, row, parm) {
// colOrigin and rowOrigin are the letters at the origin of the set
var index = parm - 1;
var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index);
var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index);
// colInt and rowInt are the letters to build to return
var colInt = colOrigin + column - 1;
var rowInt = rowOrigin + row;
var rollover = false;
if (colInt > Z) {
colInt = colInt - Z + A - 1;
rollover = true;
}
if (colInt === I || (colOrigin < I && colInt > I) || ((colInt > I || colOrigin < I) && rollover)) {
colInt++;
}
if (colInt === O || (colOrigin < O && colInt > O) || ((colInt > O || colOrigin < O) && rollover)) {
colInt++;
if (colInt === I) {
colInt++;
}
}
if (colInt > Z) {
colInt = colInt - Z + A - 1;
}
if (rowInt > V) {
rowInt = rowInt - V + A - 1;
rollover = true;
}
else {
rollover = false;
}
if (((rowInt === I) || ((rowOrigin < I) && (rowInt > I))) || (((rowInt > I) || (rowOrigin < I)) && rollover)) {
rowInt++;
}
if (((rowInt === O) || ((rowOrigin < O) && (rowInt > O))) || (((rowInt > O) || (rowOrigin < O)) && rollover)) {
rowInt++;
if (rowInt === I) {
rowInt++;
}
}
if (rowInt > V) {
rowInt = rowInt - V + A - 1;
}
var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt);
return twoLetter;
} | javascript | {
"resource": ""
} |
q25546 | decode | train | function decode(mgrsString) {
if (mgrsString && mgrsString.length === 0) {
throw ("MGRSPoint coverting from nothing");
}
var length = mgrsString.length;
var hunK = null;
var sb = "";
var testChar;
var i = 0;
// get Zone number
while (!(/[A-Z]/).test(testChar = mgrsString.charAt(i))) {
if (i >= 2) {
throw ("MGRSPoint bad conversion from: " + mgrsString);
}
sb += testChar;
i++;
}
var zoneNumber = parseInt(sb, 10);
if (i === 0 || i + 3 > length) {
// A good MGRS string has to be 4-5 digits long,
// ##AAA/#AAA at least.
throw ("MGRSPoint bad conversion from: " + mgrsString);
}
var zoneLetter = mgrsString.charAt(i++);
// Should we check the zone letter here? Why not.
if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') {
throw ("MGRSPoint zone letter " + zoneLetter + " not handled: " + mgrsString);
}
hunK = mgrsString.substring(i, i += 2);
var set = get100kSetForZone(zoneNumber);
var east100k = getEastingFromChar(hunK.charAt(0), set);
var north100k = getNorthingFromChar(hunK.charAt(1), set);
// We have a bug where the northing may be 2000000 too low.
// How
// do we know when to roll over?
while (north100k < getMinNorthing(zoneLetter)) {
north100k += 2000000;
}
// calculate the char index for easting/northing separator
var remainder = length - i;
if (remainder % 2 !== 0) {
throw ("MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters" + mgrsString);
}
var sep = remainder / 2;
var sepEasting = 0.0;
var sepNorthing = 0.0;
var accuracyBonus, sepEastingString, sepNorthingString, easting, northing;
if (sep > 0) {
accuracyBonus = 100000.0 / Math.pow(10, sep);
sepEastingString = mgrsString.substring(i, i + sep);
sepEasting = parseFloat(sepEastingString) * accuracyBonus;
sepNorthingString = mgrsString.substring(i + sep);
sepNorthing = parseFloat(sepNorthingString) * accuracyBonus;
}
easting = sepEasting + east100k;
northing = sepNorthing + north100k;
return {
easting: easting,
northing: northing,
zoneLetter: zoneLetter,
zoneNumber: zoneNumber,
accuracy: accuracyBonus
};
} | javascript | {
"resource": ""
} |
q25547 | getEastingFromChar | train | function getEastingFromChar(e, set) {
// colOrigin is the letter at the origin of the set for the
// column
var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1);
var eastingValue = 100000.0;
var rewindMarker = false;
while (curCol !== e.charCodeAt(0)) {
curCol++;
if (curCol === I) {
curCol++;
}
if (curCol === O) {
curCol++;
}
if (curCol > Z) {
if (rewindMarker) {
throw ("Bad character: " + e);
}
curCol = A;
rewindMarker = true;
}
eastingValue += 100000.0;
}
return eastingValue;
} | javascript | {
"resource": ""
} |
q25548 | train | function (imagerySet, bingMapsKey) {
var wwBingMapsKey = "AkttWCS8p6qzxvx5RH3qUcCPgwG9nRJ7IwlpFGb14B0rBorB5DvmXr2Y_eCUNIxH";
// Use key specified for this layer
this.bingMapsKey = bingMapsKey;
// If none, fallback to key specified globally
if (!this.bingMapsKey) {
this.bingMapsKey = WorldWind.BingMapsKey;
}
// If none, fallback to default demo key
if (!this.bingMapsKey) {
this.bingMapsKey = wwBingMapsKey;
}
// If using WorldWind Bing Maps demo key, show warning
if (this.bingMapsKey === wwBingMapsKey) {
BingImageryUrlBuilder.showBingMapsKeyWarning();
}
this.imagerySet = imagerySet;
} | javascript | {
"resource": ""
} | |
q25549 | train | function () {
this.id = "";
this.name = "";
this.sid = "";
this.children = [];
this.materials = [];
this.mesh = "";
this.localMatrix = Matrix.fromIdentity();
this.worldMatrix = Matrix.fromIdentity();
} | javascript | {
"resource": ""
} | |
q25550 | train | function (worldWindow) {
if (!worldWindow) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "WorldWindowController", "constructor", "missingWorldWindow"));
}
/**
* The WorldWindow associated with this controller.
* @type {WorldWindow}
* @readonly
*/
this.wwd = worldWindow;
// Intentionally not documented.
this.allGestureListeners = [];
} | javascript | {
"resource": ""
} | |
q25551 | train | function (origin, direction) {
if (!origin) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "Line", "constructor",
"Origin is null or undefined."));
}
if (!direction) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "Line", "constructor",
"Direction is null or undefined."));
}
/**
* This line's origin.
* @type {Vec3}
*/
this.origin = origin;
/**
* This line's direction.
* @type {Vec3}
*/
this.direction = direction;
} | javascript | {
"resource": ""
} | |
q25552 | train | function (image) {
if (!image) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "ImageSource", "constructor",
"missingImage"));
}
/**
* This image source's image
* @type {Image}
* @readonly
*/
this.image = image;
/**
* This image source's key. A unique key is automatically generated and assigned during construction.
* Applications may assign a different key after construction.
* @type {String}
* @default A unique string for this image source.
*/
this.key = "ImageSource " + ++ImageSource.keyPool;
} | javascript | {
"resource": ""
} | |
q25553 | train | function (config) {
if (!config) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "WmsTimeDimensionedLayer", "constructor",
"No configuration specified."));
}
Layer.call(this, "WMS Time Dimensioned Layer");
/**
* The configuration object specified at construction.
* @type {{}}
* @readonly
*/
this.config = config;
// Intentionally not documented.
this.displayName = config.title;
this.pickEnabled = false;
// Intentionally not documented. Contains the lazily loaded list of sub-layers.
this.layers = {};
} | javascript | {
"resource": ""
} | |
q25554 | train | function (degrees) {
var sign,
temp,
d,
m,
s;
sign = degrees < 0 ? -1 : 1;
temp = sign * degrees;
d = Math.floor(temp);
temp = (temp - d) * 60;
m = Math.floor(temp);
temp = (temp - m) * 60;
s = Math.round(temp);
if (s == 60) {
m++;
s = 0;
}
if (m == 60) {
d++;
m = 0;
}
return (sign == -1 ? "-" : "") + d + "\u00B0" + " " + m + "\u2019" + " " + s + "\u201D";
} | javascript | {
"resource": ""
} | |
q25555 | train | function (element) {
if (!element) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "OwsOperationsMetadata", "constructor", "missingDomElement"));
}
var children = element.children || element.childNodes;
for (var c = 0; c < children.length; c++) {
var child = children[c];
if (child.localName === "Operation") {
this.operation = this.operation || [];
this.operation.push(OwsOperationsMetadata.assembleOperation(child));
}
// TODO: Parameter, Constraint, ExtendedCapabilities
}
} | javascript | {
"resource": ""
} | |
q25556 | train | function () {
Layer.call(this, "ScreenCreditController");
/**
* An {@link Offset} indicating where to place the attributions on the screen.
* @type {Offset}
* @default The lower left corner of the window with an 11px left margin and a 2px bottom margin.
*/
this.creditPlacement = new Offset(WorldWind.OFFSET_PIXELS, 11, WorldWind.OFFSET_PIXELS, 2);
/**
* The amount of horizontal spacing between adjacent attributions.
* @type {number}
* @default An 11px margin between attributions.
*/
this.creditMargin = 11;
// Apply 50% opacity to all shapes rendered by this layer.
this.opacity = 0.5;
// Internal. Intentionally not documented.
this.credits = [];
} | javascript | {
"resource": ""
} | |
q25557 | train | function () {
var protocol = window.location.protocol,
host = window.location.host,
path = window.location.pathname,
pathParts = path.split("/"),
newPath = "";
for (var i = 0, len = pathParts.length; i < len - 1; i++) {
if (pathParts[i].length > 0) {
newPath = newPath + "/" + pathParts[i];
}
}
return protocol + "//" + host + newPath;
} | javascript | {
"resource": ""
} | |
q25558 | train | function () {
var scripts = document.getElementsByTagName("script"),
libraryName = "/worldwind.";
for (var i = 0; i < scripts.length; i++) {
var index = scripts[i].src.indexOf(libraryName);
if (index >= 0) {
return scripts[i].src.substring(0, index) + "/";
}
}
return null;
} | javascript | {
"resource": ""
} | |
q25559 | train | function (url) {
if (!url)
return "";
var urlParts = url.split("/"),
newPath = "";
for (var i = 0, len = urlParts.length; i < len; i++) {
var part = urlParts[i];
if (!part || part.length === 0
|| part.indexOf(":") != -1
|| part === "."
|| part === ".."
|| part === "null"
|| part === "undefined") {
continue;
}
if (newPath.length !== 0) {
newPath = newPath + "/";
}
newPath = newPath + part;
}
return newPath;
} | javascript | {
"resource": ""
} | |
q25560 | train | function (url, parameterName, callback) {
// Generate a unique function name for the JSONP callback.
var functionName = "gov_nasa_worldwind_jsonp_" + WWUtil.jsonpCounter++;
// Define a JSONP callback function. Assign it to global scope the browser can find it.
window[functionName] = function (jsonData) {
// Remove the JSONP callback from global scope.
delete window[functionName];
// Call the client's callback function.
callback(jsonData);
};
// Append the callback query parameter to the URL.
var jsonpUrl = url + (url.indexOf('?') === -1 ? '?' : '&');
jsonpUrl += parameterName + "=" + functionName;
// Create a script element for the browser to invoke.
var script = document.createElement('script');
script.async = true;
script.src = jsonpUrl;
// Prepare to add the script to the document's head.
var head = document.getElementsByTagName('head')[0];
// Set up to remove the script element once it's invoked.
var cleanup = function () {
script.onload = undefined;
script.onerror = undefined;
head.removeChild(script);
};
script.onload = cleanup;
script.onerror = cleanup;
// Add the script element to the document, causing the browser to invoke it.
head.appendChild(script);
} | javascript | {
"resource": ""
} | |
q25561 | train | function (original) {
var clone = {};
var i, keys = Object.keys(original);
for (i = 0; i < keys.length; i++) {
// copy each property into the clone
clone[keys[i]] = original[keys[i]];
}
return clone;
} | javascript | {
"resource": ""
} | |
q25562 | train | function(subjectString, searchString, position) {
position = position || 0;
return subjectString.substr(position, searchString.length) === searchString;
} | javascript | {
"resource": ""
} | |
q25563 | train | function(subjectString, searchString, length) {
if (typeof length !== 'number' || !isFinite(length) || Math.floor(length) !== length || length > subjectString.length) {
length = subjectString.length;
}
length -= searchString.length;
var lastIndex = subjectString.lastIndexOf(searchString, length);
return lastIndex !== -1 && lastIndex === length;
} | javascript | {
"resource": ""
} | |
q25564 | train | function () {
TiledElevationCoverage.call(this, {
coverageSector: Sector.FULL_SPHERE,
resolution: 0.008333333333333,
retrievalImageFormat: "image/tiff",
minElevation: -11000,
maxElevation: 8850,
urlBuilder: new WcsTileUrlBuilder("https://worldwind26.arc.nasa.gov/wms2",
"NASA_SRTM30_900m_Tiled", "1.0.0")
});
this.displayName = "WCS Earth Elevation Coverage";
} | javascript | {
"resource": ""
} | |
q25565 | train | function (contours, resultContours) {
var doesCross = false;
for (var i = 0, len = contours.length; i < len; i++) {
var contourInfo = this.splitContour(contours[i]);
if (contourInfo.polygons.length > 1) {
doesCross = true;
}
resultContours.push(contourInfo);
}
return doesCross;
} | javascript | {
"resource": ""
} | |
q25566 | train | function (points) {
var iMap = new HashMap();
var newPoints = [];
var intersections = [];
var polygons = [];
var iMaps = [];
var poleIndex = -1;
var pole = this.findIntersectionAndPole(points, newPoints, intersections, iMap);
if (intersections.length === 0) {
polygons.push(newPoints);
iMaps.push(iMap);
return this.formatContourOutput(polygons, pole, poleIndex, iMaps);
}
if (intersections.length > 2) {
intersections.sort(function (a, b) {
return b.latitude - a.latitude;
});
}
if (pole !== Location.poles.NONE) {
newPoints = this.handleOnePole(newPoints, intersections, iMap, pole);
iMap = this.reindexIntersections(intersections, iMap, this.poleIndexOffset);
}
if (intersections.length === 0) {
polygons.push(newPoints);
iMaps.push(iMap);
poleIndex = 0;
return this.formatContourOutput(polygons, pole, poleIndex, iMaps);
}
this.linkIntersections(intersections, iMap);
poleIndex = this.makePolygons(newPoints, intersections, iMap, polygons, iMaps);
return this.formatContourOutput(polygons, pole, poleIndex, iMaps);
} | javascript | {
"resource": ""
} | |
q25567 | train | function (points, newPoints, intersections, iMap) {
var containsPole = false;
var minLatitude = 90.0;
var maxLatitude = -90.0;
this.addedIndex = -1;
for (var i = 0, lenC = points.length; i < lenC; i++) {
var pt1 = points[i];
var pt2 = points[(i + 1) % lenC];
minLatitude = Math.min(minLatitude, pt1.latitude);
maxLatitude = Math.max(maxLatitude, pt1.latitude);
var doesCross = Location.locationsCrossDateLine([pt1, pt2]);
if (doesCross) {
containsPole = !containsPole;
var iLatitude = Location.meridianIntersection(pt1, pt2, 180);
if (iLatitude === null) {
iLatitude = (pt1.latitude + pt2.latitude) / 2;
}
var iLongitude = WWMath.signum(pt1.longitude) * 180 || 180;
var iLoc1 = this.createPoint(iLatitude, iLongitude, pt1.altitude);
var iLoc2 = this.createPoint(iLatitude, -iLongitude, pt2.altitude);
this.safeAdd(newPoints, pt1, i, lenC);
var index = newPoints.length;
iMap.set(index, this.makeIntersectionEntry(index));
iMap.set(index + 1, this.makeIntersectionEntry(index + 1));
intersections.push({
indexEnd: index,
indexStart: index + 1,
latitude: iLatitude
});
newPoints.push(iLoc1);
newPoints.push(iLoc2);
this.safeAdd(newPoints, pt2, i + 1, lenC);
}
else {
this.safeAdd(newPoints, pt1, i, lenC);
this.safeAdd(newPoints, pt2, i + 1, lenC);
}
}
var pole = Location.poles.NONE;
if (containsPole) {
pole = this.determinePole(minLatitude, maxLatitude);
}
return pole;
} | javascript | {
"resource": ""
} | |
q25568 | train | function (minLatitude, maxLatitude) {
var pole;
if (minLatitude > 0) {
pole = Location.poles.NORTH; // Entirely in Northern Hemisphere.
}
else if (maxLatitude < 0) {
pole = Location.poles.SOUTH; // Entirely in Southern Hemisphere.
}
else if (Math.abs(maxLatitude) >= Math.abs(minLatitude)) {
pole = Location.poles.NORTH; // Spans equator, but more north than south.
}
else {
pole = Location.poles.SOUTH; // Spans equator, but more south than north.
}
return pole;
} | javascript | {
"resource": ""
} | |
q25569 | train | function (points, intersections, iMap, pole) {
var pointsClone;
if (pole === Location.poles.NORTH) {
var intersection = intersections.shift();
var poleLat = 90;
}
else if (pole === Location.poles.SOUTH) {
intersection = intersections.pop();
poleLat = -90;
}
var iEnd = iMap.get(intersection.indexEnd);
var iStart = iMap.get(intersection.indexStart);
iEnd.forPole = true;
iStart.forPole = true;
this.poleIndexOffset = intersection.indexStart;
pointsClone = points.slice(0, intersection.indexEnd + 1);
var polePoint1 = this.createPoint(poleLat, points[iEnd.index].longitude, points[iEnd.index].altitude);
var polePoint2 = this.createPoint(poleLat, points[iStart.index].longitude, points[iStart.index].altitude);
pointsClone.push(polePoint1, polePoint2);
pointsClone = pointsClone.concat(points.slice(this.poleIndexOffset));
return pointsClone;
} | javascript | {
"resource": ""
} | |
q25570 | train | function (intersections, iMap) {
for (var i = 0; i < intersections.length - 1; i += 2) {
var i0 = intersections[i];
var i1 = intersections[i + 1];
var iEnd0 = iMap.get(i0.indexEnd);
var iStart0 = iMap.get(i0.indexStart);
var iEnd1 = iMap.get(i1.indexEnd);
var iStart1 = iMap.get(i1.indexStart);
iEnd0.linkTo = i1.indexStart;
iStart0.linkTo = i1.indexEnd;
iEnd1.linkTo = i0.indexStart;
iStart1.linkTo = i0.indexEnd;
}
} | javascript | {
"resource": ""
} | |
q25571 | train | function (intersections, iMap, indexOffset) {
iMap = HashMap.reIndex(iMap, indexOffset, 2);
for (var i = 0, len = intersections.length; i < len; i++) {
if (intersections[i].indexEnd >= indexOffset) {
intersections[i].indexEnd += 2;
}
if (intersections[i].indexStart >= indexOffset) {
intersections[i].indexStart += 2;
}
}
return iMap;
} | javascript | {
"resource": ""
} | |
q25572 | train | function (start, end, points, iMap, resultPolygon, polygonHashMap) {
var pass = false;
var len = points.length;
var containsPole = false;
if (end < start) {
end += len;
}
for (var i = start; i <= end; i++) {
var idx = i % len;
var pt = points[idx];
var intersection = iMap.get(idx);
if (intersection) {
if (intersection.visited) {
break;
}
resultPolygon.push(pt);
polygonHashMap.set(resultPolygon.length - 1, intersection);
if (intersection.forPole) {
containsPole = true;
}
else {
if (pass) {
i = intersection.linkTo - 1;
if (i + 1 === start) {
break;
}
}
pass = !pass;
intersection.visited = true;
}
}
else {
resultPolygon.push(pt);
}
}
return containsPole;
} | javascript | {
"resource": ""
} | |
q25573 | train | function (points, point, index, len) {
if (this.addedIndex < index && this.addedIndex < len - 1) {
points.push(point);
this.addedIndex = index;
}
} | javascript | {
"resource": ""
} | |
q25574 | train | function (latitude, longitude, altitude) {
if (altitude == null) {
return new Location(latitude, longitude);
}
return new Position(latitude, longitude, altitude);
} | javascript | {
"resource": ""
} | |
q25575 | train | function (type) {
/**
* Type of this object.
* @type {WKTType}
*/
this.type = type;
/**
* It is possible for the WKT object to be displayed not in 2D but in 3D.
* @type {Boolean}
* @private
*/
this._is3d = false;
/**
* It is possible for the WKT object to be referenced using Linear referencing system. This is flag for it.
* @type {boolean}
* @private
*/
this._isLrs = false;
/**
*
* @type {Position[]|Location[]}
*/
this.coordinates = [];
/**
* Options contains information relevant for parsing of this specific Object. Basically processed tokens, parsed
* coordinates and amounts of parntheses used to find out whether the object was already finished.
* @type {{coordinates: Array, leftParenthesis: number, rightParenthesis: number, tokens: Array}}
*/
this.options = {
coordinates: [],
leftParenthesis: 0,
rightParenthesis: 0,
tokens: []
};
} | javascript | {
"resource": ""
} | |
q25576 | train | function (recognizer) {
// Obtain the event location.
var x = recognizer.clientX,
y = recognizer.clientY;
// Perform the pick. Must first convert from window coordinates to canvas coordinates, which are
// relative to the upper left corner of the canvas rather than the upper left corner of the page.
var pickList = wwd.pick(wwd.canvasCoordinates(x, y));
// If only one thing is picked and it is the terrain, tell the WorldWindow to go to the picked location.
if (pickList.objects.length === 1 && pickList.objects[0].isTerrain) {
var position = pickList.objects[0].position;
wwd.goTo(new WorldWind.Location(position.latitude, position.longitude));
}
} | javascript | {
"resource": ""
} | |
q25577 | train | function (displayName) {
/**
* This layer's display name.
* @type {String}
* @default "Layer"
*/
this.displayName = displayName ? displayName : "Layer";
/**
* Indicates whether to display this layer.
* @type {Boolean}
* @default true
*/
this.enabled = true;
/**
* Indicates whether this layer is pickable.
* @type {Boolean}
* @default true
*/
this.pickEnabled = true;
/**
* This layer's opacity, which is combined with the opacity of shapes within layers.
* Opacity is in the range [0, 1], with 1 indicating fully opaque.
* @type {Number}
* @default 1
*/
this.opacity = 1;
/**
* The eye altitude above which this layer is displayed, in meters.
* @type {Number}
* @default -Number.MAX_VALUE (always displayed)
*/
this.minActiveAltitude = -Number.MAX_VALUE;
/**
* The eye altitude below which this layer is displayed, in meters.
* @type {Number}
* @default Number.MAX_VALUE (always displayed)
*/
this.maxActiveAltitude = Number.MAX_VALUE;
/**
* Indicates whether elements of this layer were drawn in the most recently generated frame.
* @type {Boolean}
* @readonly
*/
this.inCurrentFrame = false;
/**
* The time to display. This property selects the layer contents that represents the specified time.
* If null, layer-type dependent contents are displayed.
* @type {Date}
*/
this.time = null;
} | javascript | {
"resource": ""
} | |
q25578 | train | function (worldWindow) {
if (!worldWindow) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "GoToAnimator", "constructor",
"missingWorldWindow"));
}
/**
* The WorldWindow associated with this animator.
* @type {WorldWindow}
* @readonly
*/
this.wwd = worldWindow;
/**
* The frequency in milliseconds at which to animate the position change.
* @type {Number}
* @default 20
*/
this.animationFrequency = 20;
/**
* The animation's duration, in milliseconds. When the distance is short, less than twice the viewport
* size, the travel time is reduced proportionally to the distance to travel. It therefore takes less
* time to move shorter distances.
* @type {Number}
* @default 3000
*/
this.travelTime = 3000;
/**
* Indicates whether the current or most recent animation has been cancelled. Use the cancel() function
* to cancel an animation.
* @type {Boolean}
* @default false
* @readonly
*/
this.cancelled = false;
} | javascript | {
"resource": ""
} | |
q25579 | train | function (displayName, continuous, projectionLimits) {
/**
* This projection's display name.
* @type {string}
*/
this.displayName = displayName || "Geographic Projection";
/**
* Indicates whether this projection should be treated as continuous with itself. If true, the 2D map
* will appear to scroll continuously horizontally.
* @type {boolean}
* @readonly
*/
this.continuous = continuous;
/**
* Indicates the geographic limits of this projection.
* @type {Sector}
* @readonly
*/
this.projectionLimits = projectionLimits;
/**
* Indicates whether this projection is a 2D projection.
* @type {boolean}
* @readonly
*/
this.is2D = true;
} | javascript | {
"resource": ""
} | |
q25580 | train | function (pole) {
GeographicProjection.call(this, "Polar Equidistant", false, null);
// Internal. Intentionally not documented. See "pole" property accessor below for public interface.
this._pole = pole;
// Internal. Intentionally not documented.
this.north = !(pole === "South");
// Documented in superclass.
this.displayName = this.north ? "North Polar" : "South Polar";
// Internal. Intentionally not documented. See "stateKey" property accessor below for public interface.
this._stateKey = "projection polar equidistant " + this._pole + " ";
} | javascript | {
"resource": ""
} | |
q25581 | onExportWkt | train | function onExportWkt() {
// This is the actual export action.
var exportedWkt = WorldWind.WktExporter.exportRenderables(shapesLayer.renderables);
document.getElementById("wktTxtArea").value = exportedWkt;
} | javascript | {
"resource": ""
} |
q25582 | train | 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 | {
"resource": ""
} | |
q25583 | train | 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 | {
"resource": ""
} | |
q25584 | train | 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 | {
"resource": ""
} | |
q25585 | train | 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 | {
"resource": ""
} | |
q25586 | train | 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 | {
"resource": ""
} | |
q25587 | train | 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 | {
"resource": ""
} | |
q25588 | train | 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 | {
"resource": ""
} | |
q25589 | train | 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 | {
"resource": ""
} | |
q25590 | train | 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 | {
"resource": ""
} | |
q25591 | train | 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 | {
"resource": ""
} | |
q25592 | train | 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 | {
"resource": ""
} | |
q25593 | train | 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 | {
"resource": ""
} | |
q25594 | train | 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 | {
"resource": ""
} | |
q25595 | train | 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 | {
"resource": ""
} | |
q25596 | train | function () {
ElevationModel.call(this);
this.addCoverage(new GebcoElevationCoverage());
this.addCoverage(new AsterV2ElevationCoverage());
this.addCoverage(new UsgsNedElevationCoverage());
this.addCoverage(new UsgsNedHiElevationCoverage());
} | javascript | {
"resource": ""
} | |
q25597 | train | 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 | {
"resource": ""
} | |
q25598 | train | 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 | {
"resource": ""
} | |
q25599 | train | 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 | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.