From efe052d227401b2dc795e03797abbe9653edadb3 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 19 Mar 2018 16:17:17 +0200 Subject: [PATCH 001/112] refactoring for shape editor --- examples/ShapeEditing.html | 53 ++ examples/ShapeEditing.js | 147 +++ src/WorldWind.js | 3 + src/shapes/ControlPointMarker.js | 139 +++ src/shapes/SurfaceCircle.js | 17 + src/shapes/SurfaceEllipse.js | 17 + src/shapes/SurfacePolygon.js | 51 + src/shapes/SurfacePolyline.js | 20 + src/shapes/SurfaceRectangle.js | 17 + src/util/ShapeEditor.js | 1532 ++++++++++++++++++++++++++++++ 10 files changed, 1996 insertions(+) create mode 100644 examples/ShapeEditing.html create mode 100644 examples/ShapeEditing.js create mode 100644 src/shapes/ControlPointMarker.js create mode 100644 src/util/ShapeEditor.js diff --git a/examples/ShapeEditing.html b/examples/ShapeEditing.html new file mode 100644 index 000000000..54ec1f768 --- /dev/null +++ b/examples/ShapeEditing.html @@ -0,0 +1,53 @@ + + + + + + + + + + + + +
+ +
+
+

Projection

+ +
+

Layers

+
+
+
+ +

Shape editing

+
+ + + +
+
+

Destination

+ +
+
+ + Your browser does not support HTML5 Canvas. + +
+
+
+ + diff --git a/examples/ShapeEditing.js b/examples/ShapeEditing.js new file mode 100644 index 000000000..7335bcb2d --- /dev/null +++ b/examples/ShapeEditing.js @@ -0,0 +1,147 @@ +/* +* Copyright 2015-2017 WorldWind Contributors +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * Illustrates how to use ShapeEditor. + * + */ + +requirejs(['../src/WorldWind', + './LayerManager'], + function (ww, + LayerManager) { + "use strict"; + + // Tell World Wind to log only warnings. + WorldWind.Logger.setLoggingLevel(WorldWind.Logger.LEVEL_WARNING); + + // Create the World Window. + var wwd = new WorldWind.WorldWindow("canvasOne"); + + /** + * Added imagery layers. + */ + var layers = [ + {layer: new WorldWind.BMNGLayer(), enabled: true}, + {layer: new WorldWind.CompassLayer(), enabled: true}, + {layer: new WorldWind.CoordinatesDisplayLayer(wwd), enabled: true}, + {layer: new WorldWind.ViewControlsLayer(wwd), enabled: true} + ]; + + for (var l = 0; l < layers.length; l++) { + layers[l].layer.enabled = layers[l].enabled; + wwd.addLayer(layers[l].layer); + } + + // Create a layer to hold the surface shapes. + var shapesLayer = new WorldWind.RenderableLayer("Surface Shapes"); + wwd.addLayer(shapesLayer); + + // Create a simple surface polygon, a triangle. + var boundary = []; + boundary.push(new WorldWind.Location(40, -100)); + boundary.push(new WorldWind.Location(42, -105)); + boundary.push(new WorldWind.Location(40, -110)); + + // Create and set attributes for it. The shapes below except the surface polyline use this same attributes + // object. Real apps typically create new attributes objects for each shape unless they know the attributes + // can be shared among shapes. + var attributes = new WorldWind.ShapeAttributes(null); + attributes.outlineColor = WorldWind.Color.BLACK; + attributes.interiorColor = new WorldWind.Color(1, 1, 1, 1.0); + + var highlightAttributes = new WorldWind.ShapeAttributes(attributes); + highlightAttributes.outlineColor = WorldWind.Color.RED; + + var polyShape = new WorldWind.SurfacePolygon(boundary, attributes); + polyShape.highlightAttributes = highlightAttributes; + shapesLayer.addRenderable(polyShape); + + var circleShape = new WorldWind.SurfaceCircle(new WorldWind.Location(35, -110), 200e3, attributes); + circleShape.highlightAttributes = highlightAttributes; + shapesLayer.addRenderable(circleShape); + + var ellipseShape = new WorldWind.SurfaceEllipse(new WorldWind.Location(35, -98), 300e3, 200e3, 45, attributes); + ellipseShape.highlightAttributes = highlightAttributes; + shapesLayer.addRenderable(ellipseShape); + + wwd.goTo(new WorldWind.Position(40.42, -104.60, 2417000)); + + // Create a layer manager for controlling layer visibility. + var layerManger = new LayerManager(wwd); + + var shapeEditor = new WorldWind.ShapeEditor(wwd, null); + + document.getElementById("editPolyBtn").addEventListener("click", function(){ + if(document.getElementById("editPolyBtn").innerHTML === "Start edit polygon"){ + shapeEditor.shape = polyShape; + shapeEditor.shape.highlighted = true; + shapeEditor.setArmed(true); + + document.getElementById("editPolyBtn").innerHTML = "Stop edit polygon"; + document.getElementById("editCircleBtn").disabled = true; + document.getElementById("editEllipseBtn").disabled = true; + } + else{ + shapeEditor.shape.highlighted = false; + shapeEditor.setArmed(false); + + document.getElementById("editPolyBtn").innerHTML = "Start edit polygon"; + document.getElementById("editCircleBtn").disabled = false; + document.getElementById("editEllipseBtn").disabled = false; + } + }); + + document.getElementById("editCircleBtn").addEventListener("click", function(){ + if(document.getElementById("editCircleBtn").innerHTML === "Start edit circle"){ + shapeEditor.shape = circleShape; + shapeEditor.shape.highlighted = true; + shapeEditor.setArmed(true); + + document.getElementById("editCircleBtn").innerHTML = "Stop edit circle"; + document.getElementById("editPolyBtn").disabled = true; + document.getElementById("editEllipseBtn").disabled = true; + } + else{ + shapeEditor.shape.highlighted = false; + shapeEditor.setArmed(false); + + document.getElementById("editCircleBtn").innerHTML = "Start edit circle"; + document.getElementById("editPolyBtn").disabled = false; + document.getElementById("editEllipseBtn").disabled = false; + } + }); + + document.getElementById("editEllipseBtn").addEventListener("click", function(){ + if(document.getElementById("editEllipseBtn").innerHTML === "Start edit ellipse"){ + shapeEditor .shape = ellipseShape; + shapeEditor.shape.highlighted = true; + shapeEditor.setArmed(true); + + document.getElementById("editEllipseBtn").innerHTML = "Stop edit ellipse"; + document.getElementById("editCircleBtn").disabled = true; + document.getElementById("editPolyBtn").disabled = true; + } + else{ + shapeEditor.shape.highlighted = false; + shapeEditor.setArmed(false); + + document.getElementById("editEllipseBtn").innerHTML = "Start edit ellipse"; + document.getElementById("editCircleBtn").disabled = false; + document.getElementById("editPolyBtn").disabled = false; + } + }); + } +); diff --git a/src/WorldWind.js b/src/WorldWind.js index d506dbeec..35590e3b8 100644 --- a/src/WorldWind.js +++ b/src/WorldWind.js @@ -182,6 +182,7 @@ define([ // PLEASE KEEP ALL THIS IN ALPHABETICAL ORDER BY MODULE NAME (not direc './shapes/ScreenText', './geom/Sector', './shapes/ShapeAttributes', + './util/ShapeEditor', './formats/shapefile/Shapefile', './layer/ShowTessellationLayer', './shaders/SkyProgram', @@ -423,6 +424,7 @@ define([ // PLEASE KEEP ALL THIS IN ALPHABETICAL ORDER BY MODULE NAME (not direc ScreenText, Sector, ShapeAttributes, + ShapeEditor, Shapefile, ShowTessellationLayer, SkyProgram, @@ -834,6 +836,7 @@ define([ // PLEASE KEEP ALL THIS IN ALPHABETICAL ORDER BY MODULE NAME (not direc WorldWind['ScreenImage'] = ScreenImage; WorldWind['Sector'] = Sector; WorldWind['ShapeAttributes'] = ShapeAttributes; + WorldWind['ShapeEditor'] = ShapeEditor; WorldWind['Shapefile'] = Shapefile; WorldWind['ShowTessellationLayer'] = ShowTessellationLayer; WorldWind['SkyProgram'] = SkyProgram; diff --git a/src/shapes/ControlPointMarker.js b/src/shapes/ControlPointMarker.js new file mode 100644 index 000000000..7d76fb86e --- /dev/null +++ b/src/shapes/ControlPointMarker.js @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2014 United States Government as represented by the Administrator of the + * National Aeronautics and Space Administration. All Rights Reserved. + */ +/** + * @exports ControlPointMarker + */ +define([ + '../error/ArgumentError', + '../util/Logger', + '../shapes/Placemark' + ], + function (ArgumentError, + Logger, + Placemark) { + "use strict"; + + /** + * Constructs a control point marker. Applications typically do not call this constructor. It is called by + * {@link ShapeEditor} during the shape editing process. + * @alias ControlPointMarker + * @constructor + * @classdesc A visual marker with position and purpose, used by {@link ShapeEditor} during the shape editing. + * @param {Position} position The control point's position. + * @param {PlacemarkAttributes} attributes The control point's attributes. + * @param {Number} id The control point's ID. + * @param {string} purpose The control point's purpose. + * @throws {ArgumentError} If the specified position, id or purpose is null or undefined. + */ + var ControlPointMarker = function (position, attributes, id, purpose) { + if (!position) { + throw new ArgumentError( + Logger.logMessage(Logger.LEVEL_SEVERE, "ControlPointMarker", "constructor", "missingPosition")); + } + + if (id === null || id === undefined) { + throw new ArgumentError( + Logger.logMessage(Logger.LEVEL_SEVERE, "ControlPointMarker", "constructor", "missingId")); + } + + if (!purpose) { + throw new ArgumentError( + Logger.logMessage(Logger.LEVEL_SEVERE, "ControlPointMarker", "constructor", "missingPurpose")); + } + + Placemark.call(this, position, false, attributes); + + // Documented in defineProperties below. + this._id = id; + + // Documented in defineProperties below. + this._purpose = purpose; + + // Documented in defineProperties below. + this._size = null; + + // Documented in defineProperties below. + this._rotation = null; + }; + + ControlPointMarker.prototype = Object.create(Placemark.prototype); + + Object.defineProperties(ControlPointMarker.prototype, { + /** + * The control point's ID, which is typically its array index when the shape has an array of locations. + * @memberof ControlPointMarker.prototype + * @type {Number} + * @readonly + */ + id: { + get: function () { + return this._id; + } + }, + /** + * Indicates the feature the control point affects. + * @memberof ControlPointMarker.prototype + * @type {string} + * @readonly + */ + purpose: { + get: function () { + return this._purpose; + } + }, + /** + * Indicates size (in meters) if this control point affects a size of the shape, otherwise null. + * @memberof ControlPointMarker.prototype + * @type {Number} + */ + size: { + get: function () { + return this._size; + }, + set: function (value) { + this._size = value; + } + }, + + /** + * Indicates angle if this control point affects an angle associated with the shape, otherwise null. + * @memberof ControlPointMarker.prototype + * @type {Number} + */ + rotation: { + get: function () { + return this._rotation; + }, + set: function (value) { + this._rotation = value; + } + } + }); + + // Control points purposes + + // Indicates that a control point is associated with annotation. + ControlPointMarker.ANNOTATION = "annotation"; + + // Indicates a control point is associated with a location. + ControlPointMarker.LOCATION = "location"; + + // Indicates that a control point is associated with whole-shape rotation. + ControlPointMarker.ROTATION = "rotation"; + + // Indicates that a control point is associated with width change. + ControlPointMarker.WIDTH = "width"; + + // Indicates that a control point is associated with height change. + ControlPointMarker.HEIGHT = "height"; + + // Indicates that a control point is associated with the right width of a shape. + ControlPointMarker.RIGHT_WIDTH = "rightWidth"; + + // Indicates that a control point is associated with the outer radius of a shape. + ControlPointMarker.OUTER_RADIUS = "outerRadius"; + + return ControlPointMarker; + }); \ No newline at end of file diff --git a/src/shapes/SurfaceCircle.js b/src/shapes/SurfaceCircle.js index 20a47cd0a..7de744b44 100644 --- a/src/shapes/SurfaceCircle.js +++ b/src/shapes/SurfaceCircle.js @@ -162,6 +162,23 @@ define(['../error/ArgumentError', } }; + // Internal use only. Intentionally not documented. + SurfaceCircle.prototype.getReferencePosition = function () { + return this.center; + }; + + // Internal use only. Intentionally not documented. + SurfaceCircle.prototype.moveTo = function (oldReferenceLocation, newReferenceLocation) { + var heading = Location.greatCircleAzimuth(oldReferenceLocation, + new Location(this.center.latitude, this.center.longitude)); + var pathLength = Location.greatCircleDistance(oldReferenceLocation, + new Location(this.center.latitude, this.center.longitude)); + var location = new Location(0, 0); + Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + + this.center = location; + }; + /** * The minimum number of intervals the circle generates. * @type {Number} diff --git a/src/shapes/SurfaceEllipse.js b/src/shapes/SurfaceEllipse.js index 66bef05df..c58ef60d9 100644 --- a/src/shapes/SurfaceEllipse.js +++ b/src/shapes/SurfaceEllipse.js @@ -212,6 +212,23 @@ define([ } }; + // Internal use only. Intentionally not documented. + SurfaceEllipse.prototype.getReferencePosition = function () { + return this.center; + }; + + // Internal use only. Intentionally not documented. + SurfaceEllipse.prototype.moveTo = function (oldReferenceLocation, newReferenceLocation) { + var heading = Location.greatCircleAzimuth(oldReferenceLocation, + new Location(this.center.latitude, this.center.longitude)); + var pathLength = Location.greatCircleDistance(oldReferenceLocation, + new Location(this.center.latitude, this.center.longitude)); + var location = new Location(0, 0); + Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + + this.center = location; + }; + /** * The minimum number of intervals the ellipse generates. * @type {Number} diff --git a/src/shapes/SurfacePolygon.js b/src/shapes/SurfacePolygon.js index c44f64593..2e7e33540 100644 --- a/src/shapes/SurfacePolygon.js +++ b/src/shapes/SurfacePolygon.js @@ -116,5 +116,56 @@ define([ SurfacePolygon.prototype.computeBoundaries = function(dc) { }; + // Internal use only. Intentionally not documented. + SurfacePolygon.prototype.getReferencePosition = function () { + // Assign the first position as the reference position. + if(this.boundaries.length > 0 && this.boundaries[0].length > 2){ + return this.boundaries[0][0]; + } + else if (this.boundaries.length > 2){ + return this.boundaries[0]; + } + else { + return null; + } + }; + + // Internal use only. Intentionally not documented. + SurfacePolygon.prototype.moveTo = function (oldReferenceLocation, newReferenceLocation) { + if(this.boundaries.length > 0 && this.boundaries[0].length > 2){ + var boundaries = []; + for (var i = 0; i < this._boundaries.length; i++){ + var locations = []; + for (var j = 0; j < this._boundaries[i].length; j++){ + var heading = Location.greatCircleAzimuth(oldReferenceLocation, + new Location(this._boundaries[i][j].latitude, this._boundaries[i][j].longitude)); + var pathLength = Location.greatCircleDistance(oldReferenceLocation, + new Location(this._boundaries[i][j].latitude, this._boundaries[i][j].longitude)); + var location = new Location(0, 0); + Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + locations.push(new Location(location.latitude, location.longitude)); + } + boundaries.push(locations); + } + this.boundaries = boundaries; + } + else if (this.boundaries.length > 2){ + var locations = []; + for (var i = 0; i < this._boundaries.length; i++){ + var heading = Location.greatCircleAzimuth(oldReferenceLocation, + new Location(this._boundaries[i].latitude, this._boundaries[i].longitude)); + var pathLength = Location.greatCircleDistance(oldReferenceLocation, + new Location(this._boundaries[i].latitude, this._boundaries[i].longitude)); + var location = new Location(0, 0); + Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + locations.push(new Location(location.latitude, location.longitude)); + } + this.boundaries = locations; + } + else { + return; + } + }; + return SurfacePolygon; }); \ No newline at end of file diff --git a/src/shapes/SurfacePolyline.js b/src/shapes/SurfacePolyline.js index abc312e08..d9cf0d31f 100644 --- a/src/shapes/SurfacePolyline.js +++ b/src/shapes/SurfacePolyline.js @@ -115,5 +115,25 @@ define([ SurfacePolyline.prototype.computeBoundaries = function(dc) { }; + // Internal use only. Intentionally not documented. + SurfacePolyline.prototype.getReferencePosition = function () { + return this.boundaries.length > 1 ? this.boundaries[0] : null; + }; + + // Internal use only. Intentionally not documented. + SurfacePolyline.prototype.moveTo = function (oldReferenceLocation, newReferenceLocation) { + var locations = []; + for (var i = 0; i < this.boundaries.length; i++){ + var heading = Location.greatCircleAzimuth(oldReferenceLocation, + new Location(this.boundaries[i].latitude, this.boundaries[i].longitude)); + var pathLength = Location.greatCircleDistance(oldReferenceLocation, + new Location(this._boundaries[i].latitude, this._boundaries[i].longitude)); + var location = new Location(0, 0); + Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + locations.push(new Location(location.latitude, location.longitude)); + } + this.boundaries = locations; + }; + return SurfacePolyline; }); \ No newline at end of file diff --git a/src/shapes/SurfaceRectangle.js b/src/shapes/SurfaceRectangle.js index 1bd4ed483..227e3fb5c 100644 --- a/src/shapes/SurfaceRectangle.js +++ b/src/shapes/SurfaceRectangle.js @@ -192,5 +192,22 @@ define([ }; + // Internal use only. Intentionally not documented. + SurfaceRectangle.prototype.getReferencePosition = function () { + return this.center; + }; + + // Internal use only. Intentionally not documented. + SurfaceRectangle.prototype.moveTo = function (oldReferenceLocation, newReferenceLocation) { + var heading = Location.greatCircleAzimuth(oldReferenceLocation, + new Location(this.center.latitude, this.center.longitude)); + var pathLength = Location.greatCircleDistance(oldReferenceLocation, + new Location(this.center.latitude, this.center.longitude)); + var location = new Location(0, 0); + Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + + this.center = location; + }; + return SurfaceRectangle; }); \ No newline at end of file diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js new file mode 100644 index 000000000..eae72316c --- /dev/null +++ b/src/util/ShapeEditor.js @@ -0,0 +1,1532 @@ +/* +* Copyright 2015-2017 WorldWind Contributors +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @exports ShapeEditor + */ +define([ + '../geom/Angle', + '../shapes/Annotation', + '../shapes/AnnotationAttributes', + '../error/ArgumentError', + '../util/Color', + '../shapes/ControlPointMarker', + '../util/Font', + '../util/Insets', + '../geom/Location', + '../util/Logger', + '../shapes/Path', + '../shapes/PlacemarkAttributes', + '../geom/Position', + '../layer/RenderableLayer', + '../shapes/ShapeAttributes', + '../shapes/SurfaceEllipse', + '../shapes/SurfaceCircle', + '../shapes/SurfacePolygon', + '../shapes/SurfacePolyline', + '../shapes/SurfaceRectangle', + '../shapes/SurfaceShape', + '../geom/Vec2', + '../geom/Vec3' + ], + function (Angle, + Annotation, + AnnotationAttributes, + ArgumentError, + Color, + ControlPointMarker, + Font, + Insets, + Location, + Logger, + Path, + PlacemarkAttributes, + Position, + RenderableLayer, + ShapeAttributes, + SurfaceEllipse, + SurfaceCircle, + SurfacePolygon, + SurfacePolyline, + SurfaceRectangle, + SurfaceShape, + Vec2, + Vec3) { + "use strict"; + + /** + * @alias ShapeEditor + * @constructor + * @classdesc Provides a user interface for editing a shape and performs editing. Depending on the shape type, + * the shape is shown with control points for vertex locations and size. All shapes are shown with a handle that + * provides rotation. + *

+ * Drag on the shape's body moves the whole shape. Drag on a control point performs the action + * associated with that control point. The editor provides vertex insertion and removal for SurfacePolygon and + * SurfacePolyline. Shift-click when the cursor is over the shape inserts a control + * point at the cursor's position. Alt-click when the cursor is over a control point removes that control point. + *

+ * This editor supports all surface shapes except SurfaceImage. + * @param {WorldWindow} worldWindow The World Window to associate this shape editor controller with. + * @throws {ArgumentError} If the specified world window is null or undefined. + */ + var ShapeEditor = function (worldWindow, shape) { + if (!worldWindow) { + throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "ShapeEditor", "constructor", + "missingWorldWindow")); + } + + // if (!shape) { + // throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "ShapeEditor", "constructor", + // "missingShape")); + // } + + /** + * The World Window associated with the shape editor controller. + * @type {WorldWindow} + */ + this.worldWindow = worldWindow; + + /** + * The shape associated with the editor. + * @type {Object} + */ + this.shape = shape; + + /** + * The layer holding the editor's control points. + * @type {RenderableLayer} + */ + this.controlPointLayer = new RenderableLayer(); + + /** + * The layer holding the rotation line. + * @type {RenderableLayer} + */ + this.accessoryLayer = new RenderableLayer(); + this.accessoryLayer.pickEnabled = false; + + /** + * The layer holding the control point's annotation. + * @type {RenderableLayer} + */ + this.annotationLayer = new RenderableLayer(); + this.annotationLayer.pickEnabled = false; + + /** + * The layer holding a shadow copy of the shape while the shape is being moved or sized. + * @type {RenderableLayer} + */ + this.shadowLayer = new RenderableLayer(); + this.shadowLayer.pickEnabled = false; + + /** + * The control point annotation. + * @type {Annotation} + */ + this.annotation = null; + + /** + * Indicates whether the editor is ready for editing. + * @type {boolean} + */ + this.armed = false; + + /** + * Indicates whether the editor is in the midst of an editing operation. + * @type {boolean} + */ + this.active = false; + + /** + * The terrain position associated with the cursor during the just previous drag event. + * @type {Position} + */ + this.previousPosition = null; + + /** + * The control point associated with the current sizing operation. + * @type {ControlPointMarker} + */ + this.currentSizingMarker = null; + + /** + * The attributes associated with the shape when the editor is constructed. These are swapped out during + * editing operations in order to make the shape semi-transparent. + * @type {ShapeAttributes} + */ + this.originalAttributes = new ShapeAttributes(null); + + /** + * The highlight attributes associated with the shape when the editor is constructed. These are swapped out + * during editing operations in order to make the shape semi-transparent. + * @type {ShapeAttributes} + */ + this.originalHighlightAttributes = new ShapeAttributes(null); + + /** + * For shapes without an inherent heading, the current heading established by the editor for the shape. + * @type {number} + */ + this.currentHeading = 0; + + /** + * Attributes used to represent shape vertices. + * @type {PlacemarkAttributes} + */ + this.locationControlPointAttributes = new PlacemarkAttributes(null); + + /** + * Attributes used to represent shape size. + * @type {PlacemarkAttributes} + */ + this.sizeControlPointAttributes = new PlacemarkAttributes(null); + + /** + * Attributes used to represent shape rotation. + * @type {PlacemarkAttributes} + */ + this.angleControlPointAttributes = new PlacemarkAttributes(null); + + this.makeControlPointAttributes(); + + this.makeAnnotation(); + + //Internal use only. Intentionally not documented. + this.isDragging = false; + + //Internal use only. Intentionally not documented. + this.startX = null; + + //Internal use only. Intentionally not documented. + this.startY = null; + + //Internal use only. Intentionally not documented. + this.lastX = null; + + //Internal use only. Intentionally not documented. + this.lastY = null; + + //Internal use only. Intentionally not documented. + this.currentEvent = null; + + var shapeEditor = this; + + var handleMouseMove = function (event) { + if(this.shape === null) + return; + + if (shapeEditor.isDragging === false) { + return; + } + + var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); + var terrainObject; + + if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); + } + + if (!terrainObject) { + return; + } + + if (shapeEditor.currentSizingMarker instanceof ControlPointMarker) { + shapeEditor.reshapeShape(terrainObject); + shapeEditor.updateControlPoints(); + } + else if (shapeEditor.shape instanceof SurfaceShape) { + shapeEditor.dragWholeShape(event); + shapeEditor.updateControlPoints(); + shapeEditor.updateShapeAnnotation(); + } + + event.preventDefault(); + }; + + var handleMouseDown = function (event) { + if(this.shape === null) + return; + + shapeEditor.currentEvent = event; + + var x = event.clientX, + y = event.clientY; + + shapeEditor.startX = x; + shapeEditor.startY = y; + shapeEditor.lastX = x; + shapeEditor.lastY = y; + + var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); + + if (pickList.objects.length > 0) { + for (var p = 0; p < pickList.objects.length; p++) { + if (!pickList.objects[p].isTerrain) { + if (shapeEditor.shape && pickList.objects[p].userObject === shapeEditor.shape) { + event.preventDefault(); + shapeEditor.isDragging = true; + shapeEditor.originalAttributes = shapeEditor.shape.attributes; + shapeEditor.originalHighlightAttributes = shapeEditor.shape.highlightAttributes; + shapeEditor.makeShadowShape(); + + //set previous position + shapeEditor.setPreviousPosition(event); + } + else if (pickList.objects[p].userObject instanceof ControlPointMarker) { + event.preventDefault(); + shapeEditor.currentSizingMarker = pickList.objects[p].userObject; + shapeEditor.isDragging = true; + shapeEditor.originalAttributes = shapeEditor.shape.attributes; + shapeEditor.originalHighlightAttributes = shapeEditor.shape.highlightAttributes; + shapeEditor.makeShadowShape(); + + //set previous position + shapeEditor.setPreviousPosition(event); + } + } + } + } + }; + + var handleMouseUp = function (event) { + if(this.shape === null) + return; + + var x = event.clientX, + y = event.clientY; + + if (shapeEditor.shape && shapeEditor.shadowLayer.renderables.length > 0) { + shapeEditor.removeShadowShape(); + shapeEditor.updateAnnotation(null); + } + + if (shapeEditor.currentSizingMarker instanceof ControlPointMarker) { + if (event.altKey) { + var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); + var terrainObject; + + if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); + } + + if (terrainObject) { + shapeEditor.reshapeShape(terrainObject); + shapeEditor.updateControlPoints(); + shapeEditor.updateAnnotation(null); + } + } + shapeEditor.isDragging = false; + shapeEditor.currentSizingMarker = null; + return; + } + + var redrawRequired = false; + + var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); + if (pickList.objects.length > 0) { + for (var p = 0; p < pickList.objects.length; p++) { + if (!pickList.objects[p].isTerrain) { + // if (shapeEditor.shape == null) { + // // Highlight current shape + // shapeEditor.shape = pickList.objects[p].userObject; + // shapeEditor.shape.highlighted = true; + // shapeEditor.setArmed(true); + // } + // else if (shapeEditor.shape !== pickList.objects[p].userObject && !(pickList.objects[p].userObject instanceof ControlPointMarker)) { + // // Switch editor to a different shape. + // shapeEditor.shape.highlighted = false; + // shapeEditor.setArmed(false); + // shapeEditor.shape = pickList.objects[p].userObject; + // shapeEditor.shape.highlighted = true; + // shapeEditor.setArmed(true); + // } else { + if (shapeEditor.startX === shapeEditor.lastX && + shapeEditor.startY === shapeEditor.lastY) { + if (event.shiftKey) { + var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, + event.clientY); + var terrainObject; + + if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint) + .terrainObject(); + } + + if (terrainObject) { + shapeEditor.addNearestLocation(terrainObject.position, 0, + shapeEditor.shape.boundaries); + } + } + // else { + // // Disable editing of the current shape. + // shapeEditor.shape.highlighted = false; + // shapeEditor.setArmed(false); + // shapeEditor.shape = null; + // } + } + //} + + redrawRequired = true; + break; + } + } + } + + shapeEditor.isDragging = false; + shapeEditor.currentSizingMarker = null; + + // Update the window if we changed anything. + if (redrawRequired) { + shapeEditor.worldWindow.redraw(); + } + }; + + if (window.PointerEvent) { + this.worldWindow.addEventListener("pointerup", handleMouseUp); + this.worldWindow.addEventListener("pointerdown", handleMouseDown); + this.worldWindow.addEventListener("pointermove", handleMouseMove, false); + } else { + this.worldWindow.addEventListener("mouseup", handleMouseUp); + this.worldWindow.addEventListener("mousedown", handleMouseDown); + this.worldWindow.addEventListener("mousemove", handleMouseMove, false); + } + }; + + /** + * Remove the control points. + */ + ShapeEditor.prototype.removeControlPoints = function () { + this.controlPointLayer.removeAllRenderables(); + }; + + /** + * Creates and returns the stationary shape displayed during editing operations. + * @returns {SurfaceShape} The new shadow shape created, or null if the shape type is not recognized. + */ + ShapeEditor.prototype.doMakeShadowShape = function () { + if (this.shape && this.shape instanceof SurfacePolygon) { + return new SurfacePolygon( + this.shape.boundaries, + this.shape.attributes); + } else if (this.shape && this.shape instanceof SurfaceEllipse) { + return new SurfaceEllipse( + this.shape.center, + this.shape.majorRadius, + this.shape.minorRadius, + this.shape.heading, + this.shape.attributes); + } else if (this.shape && this.shape instanceof SurfaceRectangle) { + return new SurfaceRectangle( + this.shape.center, + this.shape.width, + this.shape.height, + this.shape.heading, + this.shape.attributes); + } else if (this.shape && this.shape instanceof SurfacePolyline) { + return new SurfacePolyline( + this.shape.boundaries, + this.shape.attributes + ); + } + + return null; + }; + + /** + * Creates the shape that will remain at the same location and is the same size as the shape to be edited. + */ + ShapeEditor.prototype.makeShadowShape = function () { + var shadowShape = this.doMakeShadowShape(); + if (shadowShape == null) { + return; + } + + var editingAttributes = new ShapeAttributes(this.originalHighlightAttributes); + + if (editingAttributes.interiorColor.alpha === 1) { + editingAttributes.interiorColor.alpha = 0.7; + } + + this.shape.highlightAttributes = editingAttributes; + + shadowShape.highlighted = true; + shadowShape.highlightAttributes = new ShapeAttributes(this.originalHighlightAttributes); + + this.shadowLayer.addRenderable(shadowShape); + this.worldWindow.redraw(); + }; + + /** + * Remove the shadow shape. + */ + ShapeEditor.prototype.removeShadowShape = function () { + this.shadowLayer.removeAllRenderables(); + + // Restore the original highlight attributes. + this.shape.highlightAttributes = this.originalHighlightAttributes; + + this.worldWindow.redraw(); + }; + + /** + * Set up the Annotation. + */ + ShapeEditor.prototype.makeAnnotation = function () { + var annotationAttributes = new AnnotationAttributes(null); + annotationAttributes.altitudeMode = WorldWind.CLAMP_TO_GROUND; + annotationAttributes.cornerRadius = 5; + annotationAttributes.backgroundColor = new Color(0.67, 0.67, 0.67, 0.8); + annotationAttributes._leaderGapHeight = 0; + annotationAttributes.drawLeader = false; + annotationAttributes.scale = 1; + annotationAttributes._textAttributes.color = Color.BLACK; + annotationAttributes._textAttributes.font = new Font(10); + annotationAttributes.insets = new Insets(5, 5, 5, 5); + + this.annotation = new WorldWind.Annotation( + new WorldWind.Position(0, 0, 0), annotationAttributes); + this.annotation.text = ""; + this.annotationLayer.addRenderable(this.annotation); + this.annotationLayer.enabled = false; + }; + + /** + * Updates the annotation indicating the edited shape's center. If the shape has no designated center, this + * method prevents the annotation from displaying. + */ + ShapeEditor.prototype.updateShapeAnnotation = function () { + var center = this.getShapeCenter(); + + if (center != null) { + var dummyMarker = new ControlPointMarker( + new Position(center.latitude, center.longitude, 0), + null, 0, ControlPointMarker.ANNOTATION); + this.updateAnnotation(dummyMarker); + } + else { + this.updateAnnotation(null); + } + }; + + /** + * Remove the annotation. + */ + ShapeEditor.prototype.removeAnnotation = function () { + this.annotationLayer.removeAllRenderables(); + }; + + ShapeEditor.prototype.makeControlPointAttributes = function () { + this.locationControlPointAttributes.imageColor = WorldWind.Color.BLUE; + this.locationControlPointAttributes.imageScale = 6; + + this.sizeControlPointAttributes.imageColor = WorldWind.Color.CYAN; + this.sizeControlPointAttributes.imageScale = 6; + + this.angleControlPointAttributes.imageColor = WorldWind.Color.GREEN; + this.angleControlPointAttributes.imageScale = 6; + }; + + ShapeEditor.prototype.setArmed = function (armed) { + if (!this.armed && armed) { + this.enable(); + } + else if (this.armed && !armed) { + this.disable(); + this.shape = null; + } + + this.armed = armed; + }; + + ShapeEditor.prototype.enable = function () { + if (this.worldWindow.indexOfLayer(this.controlPointLayer) == -1) { + this.worldWindow.addLayer(this.controlPointLayer); + } + + if (this.worldWindow.indexOfLayer(this.accessoryLayer) == -1) { + this.worldWindow.addLayer(this.accessoryLayer); + } + this.makeAccessory(); + + if (this.worldWindow.indexOfLayer(this.annotationLayer) == -1) { + this.worldWindow.addLayer(this.annotationLayer); + } + + if (this.worldWindow.indexOfLayer(this.shadowLayer) == -1) { + this.worldWindow.insertLayer(0, this.shadowLayer); + } + + this.updateControlPoints(); + }; + + /** + * Called by {@link ShapeEditorController#setArmed} to remove resources no longer needed after editing. + */ + ShapeEditor.prototype.disable = function () { + this.removeControlPoints(); + this.worldWindow.removeLayer(this.controlPointLayer); + + this.removeAccessory(); + this.worldWindow.removeLayer(this.accessoryLayer); + + this.worldWindow.removeLayer(this.annotationLayer); + + this.worldWindow.removeLayer(this.shadowLayer); + + this.currentHeading = 0; + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.formatLatitude = function (number) { + var suffix = number < 0 ? "\u00b0S" : "\u00b0N"; + return Math.abs(number).toFixed(4) + suffix; + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.formatLongitude = function (number) { + var suffix = number < 0 ? "\u00b0W" : "\u00b0E"; + return Math.abs(number).toFixed(4) + suffix; + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.formatLength = function (number) { + var suffix = " km"; + return Math.abs(number / 1000.0).toFixed(3) + suffix; + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.formatRotation = function (rotation) { + return rotation.toFixed(4) + "°"; + }; + + ShapeEditor.prototype.updateControlPoints = function () { + if (this.shape && this.shape instanceof SurfaceShape) { + + if (this.shape instanceof SurfacePolygon || + this.shape instanceof SurfacePolyline) { + this.updateSurfacePolygonControlPoints(); + } + else if (this.shape instanceof SurfaceCircle) { + this.updateSurfaceCircleControlPoints(); + } + else if (this.shape instanceof SurfaceRectangle) { + this.updateSurfaceRectangleControlPoints(); + } + else if (this.shape instanceof SurfaceEllipse) { + this.updateSurfaceEllipseControlPoints(); + } + } + }; + + /** + * Set up the Path for the rotation line. + */ + ShapeEditor.prototype.makeAccessory = function () { + var pathPositions = []; + pathPositions.push(new Position(0, 0, 0)); + pathPositions.push(new Position(0, 0, 0)); + var rotationLine = new Path(pathPositions, null); + rotationLine.altitudeMode = WorldWind.CLAMP_TO_GROUND; + rotationLine.followTerrain = true; + + var pathAttributes = new ShapeAttributes(null); + pathAttributes.outlineColor = Color.GREEN; + pathAttributes.outlineWidth = 2; + rotationLine.attributes = pathAttributes; + + this.accessoryLayer.addRenderable(rotationLine); + }; + + /** + * Remove the orientation line. + */ + ShapeEditor.prototype.removeAccessory = function () { + this.accessoryLayer.removeAllRenderables(); + }; + + /** + * Moves the entire shape according to a specified event. + * @param {Event} event + */ + ShapeEditor.prototype.dragWholeShape = function (event) { + var refPos = this.shape.getReferencePosition(); + if (refPos === null) { + return; + } + + var refPoint = new Vec3(0, 0, 0); + this.worldWindow.globe.computePointFromPosition(refPos.latitude, refPos.longitude, 0, + refPoint); + + var screenRefPoint = new Vec3(0, 0, 0); + this.worldWindow.drawContext.navigatorState.project(refPoint, screenRefPoint); + + // Compute screen-coord delta since last event. + var dx = event.clientX - this.lastX; + var dy = event.clientY - this.lastY; + + this.lastX = event.clientX; + this.lastY = event.clientY; + + // Find intersection of screen coord ref-point with globe. + var x = screenRefPoint[0] + dx; + var y = this.worldWindow.canvas.height - screenRefPoint[1] + dy; + + var ray = this.worldWindow.drawContext.navigatorState.rayFromScreenPoint( + new Vec2(x, y)); + + var intersection = new Vec3(0, 0, 0); + if (this.worldWindow.globe.intersectsLine(ray, intersection)) { + var p = new Position(0, 0, 0); + this.worldWindow.globe.computePositionFromPoint(intersection[0], intersection[1], + intersection[2], p); + this.shape.moveTo(refPos, new WorldWind.Location(p.latitude, p.longitude)); + } + }; + + /** + * Modifies the shape's locations, size or rotation. This method is called when a control point is dragged. + * + * @param {PickedObject} terrainObject The terrain object. + */ + ShapeEditor.prototype.reshapeShape = function (terrainObject) { + if (!this.previousPosition) { + this.previousPosition = terrainObject.position; + return; + } + + this.doReshapeShape(this.currentSizingMarker, terrainObject.position); + + this.previousPosition = terrainObject.position; + }; + + /** + * Called by {@link ShapeEditor#reshapeShape} to perform the actual shape modification. + * Subclasses should override this method if they provide editing for shapes other than those supported by + * the basic editor. + * + * @param {ControlPointMarker} controlPoint The control point selected. + * @param {Position} terrainPosition The terrain position under the cursor. + */ + ShapeEditor.prototype.doReshapeShape = function (controlPoint, terrainPosition) { + if (this.shape && this.shape instanceof SurfaceShape) { + if (this.shape instanceof SurfacePolygon || + this.shape instanceof SurfacePolyline + ) { + this.reshapeSurfacePolygon(controlPoint, terrainPosition); + } + else if (this.shape instanceof SurfaceCircle) { + this.reshapeSurfaceCircle(controlPoint, terrainPosition); + } + else if (this.shape instanceof SurfaceRectangle) { + this.reshapeSurfaceRectangle(controlPoint, terrainPosition); + } + else if (this.shape instanceof SurfaceEllipse) { + this.reshapeSurfaceEllipse(controlPoint, terrainPosition); + } + this.currentSizingMarker.position = terrainPosition; + this.worldWindow.redraw(); + } + }; + + /** + * Computes the average location of a specified array of locations. + * @param {Location[]} locations The array of locations for the shape. + * @return {Position} the average of the locations specified in the array. + */ + ShapeEditor.prototype.getCenter = function (locations) { + var count = 0; + var center = new Vec3(0, 0, 0); + var globe = this.worldWindow.globe; + + if (locations.length > 0 && locations[0].length > 2) { + for (var i = 0; i < locations.length; i++) { + for (var j = 0; j < locations[i].length; j++) { + center = center.add(globe.computePointFromPosition( + locations[i][j].latitude, + locations[i][j].longitude, + 0, + new Vec3(0, 0, 0))); + ++count; + } + } + } + else if (locations.length >= 2) { + for (var i = 0; i < locations.length; i++) { + center = center.add(globe.computePointFromPosition( + locations[i].latitude, + locations[i].longitude, + 0, + new Vec3(0, 0, 0))); + ++count; + } + } + + center = center.divide(count); + + return globe.computePositionFromPoint( + center[0], + center[1], + center[2], + new Position(0, 0, 0) + ); + }; + + /** + * + * @returns {Location} The shape's center location, or null if the shape has no designated center. + */ + ShapeEditor.prototype.getShapeCenter = function () { + var center = null; + + if (this.shape instanceof SurfaceEllipse || this.shape instanceof SurfaceRectangle) { + center = this.shape.center; + } + + return center; + }; + + /** + * Computes the average distance between a specified center point and a list of locations. + * @param {Globe} globe The globe to use for the computations. + * @param {Location} center The center point. + * @param {Array} locations The locations. + * @returns {Number} The average distance. + */ + ShapeEditor.prototype.getAverageDistance = function (globe, center, locations) { + var count = locations.length; + + var centerPoint = globe.computePointFromLocation( + center.latitude, + center.longitude, + new Vec3(0, 0, 0) + ); + + var totalDistance = 0; + for (var i = 0; i < locations.length; i++) { + var distance = globe.computePointFromLocation( + locations[i].latitude, + locations[i].longitude, + new Vec3(0, 0, 0)).distanceTo(centerPoint); + totalDistance += distance / count; + } + + return (count === 0) ? 0 : totalDistance / globe.equatorialRadius; + }; + + /** + * Updates the annotation associated with a specified control point. + * @param {ControlPointMarker} controlPoint The control point. + */ + ShapeEditor.prototype.updateAnnotation = function (controlPoint) { + if (!controlPoint) { + this.annotationLayer.enabled = false; + return; + } + + this.annotationLayer.enabled = true; + this.annotation.position = new Position( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0 + ); + + var annotationText; + if (controlPoint.size !== null) { + annotationText = this.formatLength(controlPoint.size); + } + else if (controlPoint.rotation !== null) { + annotationText = this.formatRotation(controlPoint.rotation); + } + else { + annotationText = this.formatLatitude(controlPoint.position.latitude) + " " + + this.formatLongitude(controlPoint.position.longitude); + } + + this.annotation.text = annotationText; + }; + + /** + * Updates the line designating the shape's central axis. + * @param {Position} centerPosition The shape's center location and altitude at which to place one of the line's + * end points. + * @param {Position} controlPointPosition The shape orientation control point's position. + */ + ShapeEditor.prototype.updateOrientationLine = function (centerPosition, controlPointPosition) { + if (this.accessoryLayer.renderables.length == 0) { + return; + } + + var positions = []; + positions.push(centerPosition, controlPointPosition); + var rotationLine = this.accessoryLayer.renderables[0]; + rotationLine.positions = positions; + }; + + /** + * Computes the Cartesian difference between two control points. + * @param {Position} previousPosition The position of the previous control point. + * @param {Position} currentPosition The position of the current control point. + * @returns {Vec3} The Cartesian difference between the two control points. + */ + ShapeEditor.prototype.computeControlPointDelta = function (previousPosition, currentPosition) { + var terrainPoint = this.worldWindow.globe.computePointFromPosition( + currentPosition.latitude, + currentPosition.longitude, + currentPosition.altitude, + new Vec3(0, 0, 0) + ); + var previousPoint = this.worldWindow.globe.computePointFromPosition( + previousPosition.latitude, + previousPosition.longitude, + previousPosition.altitude, + new Vec3(0, 0, 0) + ); + + return terrainPoint.subtract(previousPoint); + }; + + /** + * Add a specified increment to an angle and normalize the result to be between 0 and 360 degrees. + * @param {Number} originalHeading The base angle. + * @param {Number} deltaHeading The increment to add prior to normalizing. + * @returns {Number} The normalized angle. + */ + ShapeEditor.prototype.normalizedHeading = function (originalHeading, deltaHeading) { + var newHeading = originalHeading * Angle.DEGREES_TO_RADIANS + deltaHeading * Angle.DEGREES_TO_RADIANS; + + if (Math.abs(newHeading) > Angle.TWO_PI) { + newHeading = newHeading % Angle.TWO_PI; + } + + return Angle.RADIANS_TO_DEGREES * (newHeading >= 0 ? newHeading : newHeading + Angle.TWO_PI); + }; + + /** + * Computes the point on a specified line segment that is nearest a specified point. + * + * @param {Vec3} p1 The line's first point. + * @param {Vec3} p2 The line's second point. + * @param {Vec3} point The point for which to determine a nearest point on the line segment. + * @returns {Vec3} The nearest point on the line segment. + */ + ShapeEditor.prototype.nearestPointOnSegment = function (p1, p2, point) { + var segment = p2.subtract(p1); + + var segmentCopy = new Vec3(0, 0, 0); + segmentCopy.copy(segment); + var dir = segmentCopy.normalize(); + + var dot = point.subtract(p1).dot(dir); + if (dot < 0.0) { + return p1; + } + else if (dot > segment.magnitude()) { + return p2; + } + else { + return Vec3.fromLine(p1, dot, dir); + } + }; + + /** + * Inserts the location nearest to a specified position on an edge of a specified list of locations into the + * appropriate place in that list. + * @param {Position} terrainPosition The position to find a nearest point for. + * @param {Number} altitude The altitude to use when determining the nearest point. Can be approximate and is + * not necessarily the altitude of the terrain position. + * @param {Location[]} locations The list of locations. This list is modified by this method to contain the new + * location on an edge nearest the specified terrain position. + */ + ShapeEditor.prototype.addNearestLocation = function (terrainPosition, altitude, locations) { + var globe = this.worldWindow.globe; + + // Find the nearest edge to the picked point and insert a new position on that edge. + var pointPicked = globe.computePointFromPosition( + terrainPosition.latitude, + terrainPosition.longitude, + altitude, + new Vec3(0, 0, 0) + ); + + var nearestPoint = null; + var nearestSegmentIndex = 0; + var nearestDistance = Number.MAX_VALUE; + for (var i = 1; i <= locations.length; i++) // <= is intentional, to handle the closing segment + { + // Skip the closing segment if the shape is not a polygon. + if (!(this.shape instanceof SurfacePolygon ) && i == locations.length) { + continue; + } + + var locationA = locations[i - 1]; + var locationB = locations[i == locations.length ? 0 : i]; + + var pointA = globe.computePointFromPosition( + locationA.latitude, + locationA.longitude, + altitude, + new Vec3(0, 0, 0) + ); + + var pointB = this.worldWindow.globe.computePointFromPosition( + locationB.latitude, + locationB.longitude, + altitude, + new Vec3(0, 0, 0) + ); + + var pointOnEdge = this.nearestPointOnSegment(pointA, pointB, new Vec3(pointPicked[0], pointPicked[1], pointPicked[2])); + + var distance = pointOnEdge.distanceTo(pointPicked); + if (distance < nearestDistance) { + nearestPoint = pointOnEdge; + nearestSegmentIndex = i; + nearestDistance = distance; + } + } + + if (nearestPoint) { + // Compute the location of the nearest point and add it to the shape. + var nearestLocation = this.worldWindow.globe.computePositionFromPoint( + nearestPoint[0], + nearestPoint[1], + nearestPoint[2], + new Position(0, 0, 0) + ); + + if (nearestSegmentIndex == locations.length) + locations.push(nearestLocation); + else + locations.splice(nearestSegmentIndex, 0, nearestLocation); + + this.removeControlPoints(); + this.shape.boundaries = locations; + this.updateControlPoints(); + } + }; + + /** + * Moves a control point location. + * @param {ControlPointMarker} controlPoint The control point being moved. + * @param {Position} terrainPosition The position selected by the user. + * @returns {Position} The position after move. + */ + ShapeEditor.prototype.moveLocation = function (controlPoint, terrainPosition) { + var delta = this.computeControlPointDelta(this.previousPosition, terrainPosition); + var markerPoint = this.worldWindow.globe.computePointFromPosition( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0, + new Vec3(0, 0, 0) + ); + + markerPoint.add(delta); + var markerPosition = this.worldWindow.globe.computePositionFromPoint( + markerPoint[0], + markerPoint[1], + markerPoint[2], + new Position(0, 0, 0) + ); + + return markerPosition; + }; + + /** + * Rotates a shape's locations. + * @param {Position} terrainPosition The position selected by the user. + * @param {Location[]} locations The array of locations for the shape. + */ + ShapeEditor.prototype.rotateLocations = function (terrainPosition, locations) { + var center = this.getCenter(locations); + var previousHeading = Location.greatCircleAzimuth(center, this.previousPosition); + var deltaHeading = Location.greatCircleAzimuth(center, terrainPosition) - previousHeading; + this.currentHeading = this.normalizedHeading(this.currentHeading, deltaHeading); + + if (locations.length > 0 && locations[0].length > 2) { + for (var i = 0; i < locations.length; i++) { + for (var j = 0; j < locations[i].length; j++) { + var heading = Location.greatCircleAzimuth(center, locations[i][j]); + var distance = Location.greatCircleDistance(center, locations[i][j]); + var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, + new Location(0, 0)); + locations[i][j] = newLocation; + } + } + } + else if (locations.length >= 2) { + for (var i = 0; i < locations.length; i++) { + var heading = Location.greatCircleAzimuth(center, locations[i]); + var distance = Location.greatCircleDistance(center, locations[i]); + var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, + new Location(0, 0)); + locations[i] = newLocation; + } + } + }; + + ShapeEditor.prototype.setPreviousPosition = function (event) { + var mousePoint = this.worldWindow.canvasCoordinates(event.clientX, + event.clientY); + if (this.worldWindow.viewport.containsPoint(mousePoint)) { + var terrainObject = this.worldWindow.pickTerrain(mousePoint).terrainObject(); + if (terrainObject) { + this.previousPosition = new Position( + terrainObject.position.latitude, + terrainObject.position.longitude, + terrainObject.position.altitude + ); + } + } + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.reshapeSurfacePolygon = function (controlPoint, terrainPosition) { + var boundaries = this.shape.boundaries; + var locations = []; + + var k = 0; + var newPos; + + if (boundaries.length > 0 && boundaries[0].length > 2) { + outer: + for (var i = 0; i < boundaries.length; i++) { + for (var j = 0; j < boundaries[i].length; j++) { + if (controlPoint.purpose == ControlPointMarker.LOCATION) { + if (controlPoint.id == k) { + newPos = this.moveLocation(controlPoint, terrainPosition); + boundaries[i][j] = newPos; + this.shape.boundaries = boundaries; + controlPoint.position = newPos; + break outer; + } + } + else if (controlPoint.purpose == ControlPointMarker.ROTATION) { + this.rotateLocations(terrainPosition, boundaries); + this.shape.boundaries = boundaries; + break outer; + } + k++; + } + } + } + else if (boundaries.length >= 2) { + //poly without whole + for (var i = 0; i < boundaries.length; i++) { + if (controlPoint.id == k) { + if (controlPoint.purpose == ControlPointMarker.LOCATION) { + if (controlPoint.id == k) { + if (this.currentEvent.altKey) { + //remove location + var minSize = this.shape instanceof SurfacePolygon ? 3 : 2; + if (boundaries.length > minSize) { + // Delete the control point. + boundaries.splice(i, 1); + this.shape.boundaries = boundaries; + this.removeControlPoints(); + } + } + else { + newPos = this.moveLocation(controlPoint, terrainPosition); + boundaries[i] = newPos; + this.shape.boundaries = boundaries; + controlPoint.position = newPos; + } + break; + } + } + } else if (controlPoint.purpose == ControlPointMarker.ROTATION) { + this.rotateLocations(terrainPosition, boundaries); + this.shape.boundaries = boundaries; + break; + } + k++; + } + } + + this.updateAnnotation(controlPoint); + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.updateSurfacePolygonControlPoints = function () { + var locations = []; + + if (this.shape.boundaries.length > 0 && this.shape.boundaries[0].length > 2) { + for (var i = 0; i < this.shape.boundaries.length; i++) { + for (var j = 0; j < this.shape.boundaries[i].length; j++) { + locations.push(this.shape.boundaries[i][j]); + } + } + } + else if (this.shape.boundaries.length >= 2) { + for (var i = 0; i < this.shape.boundaries.length; i++) { + locations.push(this.shape.boundaries[i]); + } + } + + if (locations.length < 2) + return; + + var globe = this.worldWindow.globe; + var polygonCenter = this.getCenter(locations); + var shapeRadius = this.getAverageDistance(globe, polygonCenter, locations); + shapeRadius = shapeRadius * 1.2; + var heading = this.currentHeading; + var rotationControlLocation = Location.greatCircleLocation( + polygonCenter, + heading, + shapeRadius, + new Location(0, 0)); + + var rotationPosition = new Position( + rotationControlLocation.latitude, + rotationControlLocation.longitude, + 0); + + var markers = this.controlPointLayer.renderables; + + if (markers.length > 0) { + for (var i = 0; i < locations.length; i++) { + markers[i].position = locations[i]; + } + markers[locations.length].position = rotationPosition; + markers[locations.length].rotation = heading; + } + else { + var controlPointMarker; + for (var i = 0; i < locations.length; i++) { + controlPointMarker = new ControlPointMarker( + locations[i], + this.locationControlPointAttributes, + i, + ControlPointMarker.LOCATION); + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; + this.controlPointLayer.addRenderable(controlPointMarker); + } + + controlPointMarker = new ControlPointMarker( + rotationPosition, + this.angleControlPointAttributes, + locations.length, + ControlPointMarker.ROTATION + ); + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPointMarker.rotation = heading; + this.controlPointLayer.addRenderable(controlPointMarker); + } + + this.updateOrientationLine(polygonCenter, rotationPosition); + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.reshapeSurfaceCircle = function (controlPoint, terrainPosition) { + if (!controlPoint) { + return; + } + + var circle = this.shape; + + var delta = this.computeControlPointDelta(this.previousPosition, terrainPosition); + var centerPoint = this.worldWindow.globe.computePointFromPosition( + circle.center.latitude, + circle.center.longitude, + 0, + new Vec3(0, 0, 0) + ); + var markerPoint = this.worldWindow.globe.computePointFromPosition( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0, + new Vec3(0, 0, 0) + ); + + var vMarker = markerPoint.subtract(centerPoint).normalize(); + + var radius = circle.radius + delta.dot(vMarker); + if (radius > 0) { + circle.radius = radius; + } + + this.updateAnnotation(controlPoint); + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.updateSurfaceCircleControlPoints = function () { + var circle = this.shape; + + var radiusLocation = Location.greatCircleLocation( + circle.center, + 90, + circle.radius / this.worldWindow.globe.equatorialRadius, + new Location(0, 0)); + + var markers = this.controlPointLayer.renderables; + + if (markers.length > 0) { + markers[0].position = radiusLocation; + } + else { + var controlPointMarker = new ControlPointMarker( + radiusLocation, + this.sizeControlPointAttributes, + 0, + ControlPointMarker.OUTER_RADIUS); + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; + this.controlPointLayer.addRenderable(controlPointMarker); + } + + markers[0].size = circle.radius; + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.reshapeSurfaceRectangle = function (controlPoint, terrainPosition) { + if (!controlPoint) { + return; + } + + var rectangle = this.shape; + + var terrainPoint = this.worldWindow.globe.computePointFromPosition( + terrainPosition.latitude, + terrainPosition.longitude, + 0, + new Vec3(0, 0, 0) + ); + var previousPoint = this.worldWindow.globe.computePointFromPosition( + this.previousPosition.latitude, + this.previousPosition.longitude, + 0, + new Vec3(0, 0, 0) + ); + var delta = terrainPoint.subtract(previousPoint); + + var centerPoint = this.worldWindow.globe.computePointFromPosition( + this.shape.center.latitude, + this.shape.center.longitude, + 0, + new Vec3(0, 0, 0) + ); + var markerPoint = this.worldWindow.globe.computePointFromPosition( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0, + new Vec3(0, 0, 0) + ); + var vMarker = markerPoint.subtract(centerPoint).normalize(); + + if (controlPoint.purpose == ControlPointMarker.WIDTH || controlPoint.purpose == ControlPointMarker.HEIGHT) { + var width = rectangle.width + (controlPoint.id == 0 ? delta.dot(vMarker) * 2 : 0); + var height = rectangle.height + (controlPoint.id == 1 ? delta.dot(vMarker) * 2 : 0); + + if (width > 0 && height > 0) { + rectangle.width = width; + rectangle.height = height; + } + } + else { + var oldHeading = Location.greatCircleAzimuth(rectangle.center, this.previousPosition); + var deltaHeading = Location.greatCircleAzimuth(rectangle.center, terrainPosition) - oldHeading; + rectangle.heading = this.normalizedHeading(rectangle.heading, deltaHeading); + } + + this.updateAnnotation(controlPoint); + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.updateSurfaceRectangleControlPoints = function () { + var rectangle = this.shape; + + var widthLocation = Location.greatCircleLocation( + rectangle.center, + 90 + rectangle.heading, + 0.5 * rectangle.width / this.worldWindow.globe.equatorialRadius, + new Location(0, 0)); + + var heightLocation = Location.greatCircleLocation( + rectangle.center, + rectangle.heading, + 0.5 * rectangle.height / this.worldWindow.globe.equatorialRadius, + new Location(0, 0)); + + var rotationLocation = Location.greatCircleLocation( + rectangle.center, + rectangle.heading, + 0.7 * rectangle.height / this.worldWindow.globe.equatorialRadius, + new Location(0, 0)); + + var markers; + + markers = this.controlPointLayer.renderables; + + if (markers.length > 0) { + markers[0].position = widthLocation; + markers[1].position = heightLocation; + markers[2].position = rotationLocation; + } + else { + var controlPointMarker = new ControlPointMarker( + widthLocation, + this.sizeControlPointAttributes, + 0, + ControlPointMarker.WIDTH + ); + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; + this.controlPointLayer.addRenderable(controlPointMarker); + + controlPointMarker = new ControlPointMarker( + heightLocation, + this.sizeControlPointAttributes, + 1, + ControlPointMarker.HEIGHT); + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; + this.controlPointLayer.addRenderable(controlPointMarker); + + controlPointMarker = new ControlPointMarker( + rotationLocation, + this.angleControlPointAttributes, + 1, + ControlPointMarker.ROTATION); + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; + this.controlPointLayer.addRenderable(controlPointMarker); + } + + markers[0].size = rectangle.width; + markers[1].size = rectangle.height; + markers[2].rotation = rectangle.heading; + + this.updateOrientationLine(rectangle.center, rotationLocation) + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.reshapeSurfaceEllipse = function (controlPoint, terrainPosition) { + if (!controlPoint) { + return; + } + + var ellipse = this.shape; + + var terrainPoint = this.worldWindow.globe.computePointFromPosition( + terrainPosition.latitude, + terrainPosition.longitude, + 0, + new Vec3(0, 0, 0) + ); + var previousPoint = this.worldWindow.globe.computePointFromPosition( + this.previousPosition.latitude, + this.previousPosition.longitude, + 0, + new Vec3(0, 0, 0) + ); + var delta = terrainPoint.subtract(previousPoint); + + var centerPoint = this.worldWindow.globe.computePointFromPosition( + ellipse.center.latitude, + ellipse.center.longitude, + 0, + new Vec3(0, 0, 0) + ); + var markerPoint = this.worldWindow.globe.computePointFromPosition( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0, + new Vec3(0, 0, 0) + ); + var vMarker = markerPoint.subtract(centerPoint).normalize(); + + if (controlPoint.purpose == ControlPointMarker.WIDTH || controlPoint.purpose == ControlPointMarker.HEIGHT) { + var majorRadius = ellipse.majorRadius + (controlPoint.id == 0 ? delta.dot(vMarker) : 0); + var minorRadius = ellipse.minorRadius + (controlPoint.id == 1 ? delta.dot(vMarker) : 0); + + if (majorRadius > 0 && minorRadius > 0) { + ellipse.majorRadius = majorRadius; + ellipse.minorRadius = minorRadius; + } + } + else { + var oldHeading = Location.greatCircleAzimuth(ellipse.center, this.previousPosition); + var deltaHeading = Location.greatCircleAzimuth(ellipse.center, terrainPosition) - oldHeading; + ellipse.heading = this.normalizedHeading(ellipse.heading, deltaHeading); + } + + this.updateAnnotation(controlPoint); + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.updateSurfaceEllipseControlPoints = function () { + var ellipse = this.shape; + + var majorLocation = Location.greatCircleLocation( + ellipse.center, + 90 + ellipse.heading, + ellipse.majorRadius / this.worldWindow.globe.equatorialRadius, + new Location(0, 0)); + + var minorLocation = Location.greatCircleLocation( + ellipse.center, + ellipse.heading, + ellipse.minorRadius / this.worldWindow.globe.equatorialRadius, + new Location(0, 0)); + + var rotationLocation = Location.greatCircleLocation( + ellipse.center, + ellipse.heading, + 1.15 * ellipse.minorRadius / this.worldWindow.globe.equatorialRadius, + new Location(0, 0) + ); + + var markers = this.controlPointLayer.renderables; + + if (markers.length > 0) { + markers[0].position = majorLocation; + markers[1].position = minorLocation; + markers[2].position = rotationLocation; + } + else { + var controlPointMarker = new ControlPointMarker( + majorLocation, + this.sizeControlPointAttributes, + 0, + ControlPointMarker.WIDTH); + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; + this.controlPointLayer.addRenderable(controlPointMarker); + + controlPointMarker = new ControlPointMarker( + minorLocation, + this.sizeControlPointAttributes, + 1, + ControlPointMarker.HEIGHT); + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; + this.controlPointLayer.addRenderable(controlPointMarker); + + controlPointMarker = new ControlPointMarker( + rotationLocation, + this.angleControlPointAttributes, + 2, + ControlPointMarker.ROTATION); + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; + this.controlPointLayer.addRenderable(controlPointMarker); + } + + markers[0].size = ellipse.majorRadius; + markers[1].size = ellipse.minorRadius; + markers[2].rotation = ellipse.heading; + + this.updateOrientationLine(ellipse.center, rotationLocation) + }; + + return ShapeEditor; + } +); \ No newline at end of file From db61444ba325ac4b54fbcf0d404dd0745372bb63 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 19 Mar 2018 16:39:38 +0200 Subject: [PATCH 002/112] bugfix - obsolete code --- src/util/ShapeEditor.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index eae72316c..5a5c4ac0c 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -672,7 +672,7 @@ define([ refPoint); var screenRefPoint = new Vec3(0, 0, 0); - this.worldWindow.drawContext.navigatorState.project(refPoint, screenRefPoint); + this.worldWindow.drawContext.project(refPoint, screenRefPoint); // Compute screen-coord delta since last event. var dx = event.clientX - this.lastX; @@ -685,8 +685,7 @@ define([ var x = screenRefPoint[0] + dx; var y = this.worldWindow.canvas.height - screenRefPoint[1] + dy; - var ray = this.worldWindow.drawContext.navigatorState.rayFromScreenPoint( - new Vec2(x, y)); + var ray = this.worldWindow.rayThroughScreenPoint(new Vec2(x, y)); var intersection = new Vec3(0, 0, 0); if (this.worldWindow.globe.intersectsLine(ray, intersection)) { From 95b72d529b8988c4de199c4dcd711d028cb5349d Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 19 Mar 2018 17:01:13 +0200 Subject: [PATCH 003/112] add Location dependency and remove commented code --- src/shapes/SurfacePolygon.js | 2 ++ src/shapes/SurfacePolyline.js | 2 ++ src/util/ShapeEditor.js | 53 +++++++++++------------------------ 3 files changed, 20 insertions(+), 37 deletions(-) diff --git a/src/shapes/SurfacePolygon.js b/src/shapes/SurfacePolygon.js index 2e7e33540..5a81690c3 100644 --- a/src/shapes/SurfacePolygon.js +++ b/src/shapes/SurfacePolygon.js @@ -18,11 +18,13 @@ */ define([ '../error/ArgumentError', + '../geom/Location', '../util/Logger', '../shapes/ShapeAttributes', '../shapes/SurfaceShape' ], function (ArgumentError, + Location, Logger, ShapeAttributes, SurfaceShape) { diff --git a/src/shapes/SurfacePolyline.js b/src/shapes/SurfacePolyline.js index d9cf0d31f..0639fecf7 100644 --- a/src/shapes/SurfacePolyline.js +++ b/src/shapes/SurfacePolyline.js @@ -18,11 +18,13 @@ */ define([ '../error/ArgumentError', + '../geom/Location', '../util/Logger', '../shapes/ShapeAttributes', '../shapes/SurfaceShape' ], function (ArgumentError, + Location, Logger, ShapeAttributes, SurfaceShape) { diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index 5a5c4ac0c..c3d8bc41d 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -339,45 +339,24 @@ define([ if (pickList.objects.length > 0) { for (var p = 0; p < pickList.objects.length; p++) { if (!pickList.objects[p].isTerrain) { - // if (shapeEditor.shape == null) { - // // Highlight current shape - // shapeEditor.shape = pickList.objects[p].userObject; - // shapeEditor.shape.highlighted = true; - // shapeEditor.setArmed(true); - // } - // else if (shapeEditor.shape !== pickList.objects[p].userObject && !(pickList.objects[p].userObject instanceof ControlPointMarker)) { - // // Switch editor to a different shape. - // shapeEditor.shape.highlighted = false; - // shapeEditor.setArmed(false); - // shapeEditor.shape = pickList.objects[p].userObject; - // shapeEditor.shape.highlighted = true; - // shapeEditor.setArmed(true); - // } else { - if (shapeEditor.startX === shapeEditor.lastX && - shapeEditor.startY === shapeEditor.lastY) { - if (event.shiftKey) { - var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, - event.clientY); - var terrainObject; - - if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint) - .terrainObject(); - } - - if (terrainObject) { - shapeEditor.addNearestLocation(terrainObject.position, 0, - shapeEditor.shape.boundaries); - } + if (shapeEditor.startX === shapeEditor.lastX && + shapeEditor.startY === shapeEditor.lastY) { + if (event.shiftKey) { + var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, + event.clientY); + var terrainObject; + + if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint) + .terrainObject(); + } + + if (terrainObject) { + shapeEditor.addNearestLocation(terrainObject.position, 0, + shapeEditor.shape.boundaries); } - // else { - // // Disable editing of the current shape. - // shapeEditor.shape.highlighted = false; - // shapeEditor.setArmed(false); - // shapeEditor.shape = null; - // } } - //} + } redrawRequired = true; break; From e65c45ee04e935e44d68d311ed6fb2d12ef747cb Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 19 Mar 2018 17:22:47 +0200 Subject: [PATCH 004/112] reneme parameter for moveTo method on shapes --- src/shapes/SurfaceCircle.js | 4 ++-- src/shapes/SurfaceEllipse.js | 4 ++-- src/shapes/SurfacePolygon.js | 6 +++--- src/shapes/SurfacePolyline.js | 4 ++-- src/shapes/SurfaceRectangle.js | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/shapes/SurfaceCircle.js b/src/shapes/SurfaceCircle.js index 7de744b44..40f76c18a 100644 --- a/src/shapes/SurfaceCircle.js +++ b/src/shapes/SurfaceCircle.js @@ -168,13 +168,13 @@ define(['../error/ArgumentError', }; // Internal use only. Intentionally not documented. - SurfaceCircle.prototype.moveTo = function (oldReferenceLocation, newReferenceLocation) { + SurfaceCircle.prototype.moveTo = function (oldReferenceLocation, position) { var heading = Location.greatCircleAzimuth(oldReferenceLocation, new Location(this.center.latitude, this.center.longitude)); var pathLength = Location.greatCircleDistance(oldReferenceLocation, new Location(this.center.latitude, this.center.longitude)); var location = new Location(0, 0); - Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + Location.greatCircleLocation(position, heading, pathLength, location); this.center = location; }; diff --git a/src/shapes/SurfaceEllipse.js b/src/shapes/SurfaceEllipse.js index c58ef60d9..994db812f 100644 --- a/src/shapes/SurfaceEllipse.js +++ b/src/shapes/SurfaceEllipse.js @@ -218,13 +218,13 @@ define([ }; // Internal use only. Intentionally not documented. - SurfaceEllipse.prototype.moveTo = function (oldReferenceLocation, newReferenceLocation) { + SurfaceEllipse.prototype.moveTo = function (oldReferenceLocation, position) { var heading = Location.greatCircleAzimuth(oldReferenceLocation, new Location(this.center.latitude, this.center.longitude)); var pathLength = Location.greatCircleDistance(oldReferenceLocation, new Location(this.center.latitude, this.center.longitude)); var location = new Location(0, 0); - Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + Location.greatCircleLocation(position, heading, pathLength, location); this.center = location; }; diff --git a/src/shapes/SurfacePolygon.js b/src/shapes/SurfacePolygon.js index 5a81690c3..f0ffef663 100644 --- a/src/shapes/SurfacePolygon.js +++ b/src/shapes/SurfacePolygon.js @@ -133,7 +133,7 @@ define([ }; // Internal use only. Intentionally not documented. - SurfacePolygon.prototype.moveTo = function (oldReferenceLocation, newReferenceLocation) { + SurfacePolygon.prototype.moveTo = function (oldReferenceLocation, position) { if(this.boundaries.length > 0 && this.boundaries[0].length > 2){ var boundaries = []; for (var i = 0; i < this._boundaries.length; i++){ @@ -144,7 +144,7 @@ define([ var pathLength = Location.greatCircleDistance(oldReferenceLocation, new Location(this._boundaries[i][j].latitude, this._boundaries[i][j].longitude)); var location = new Location(0, 0); - Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + Location.greatCircleLocation(position, heading, pathLength, location); locations.push(new Location(location.latitude, location.longitude)); } boundaries.push(locations); @@ -159,7 +159,7 @@ define([ var pathLength = Location.greatCircleDistance(oldReferenceLocation, new Location(this._boundaries[i].latitude, this._boundaries[i].longitude)); var location = new Location(0, 0); - Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + Location.greatCircleLocation(position, heading, pathLength, location); locations.push(new Location(location.latitude, location.longitude)); } this.boundaries = locations; diff --git a/src/shapes/SurfacePolyline.js b/src/shapes/SurfacePolyline.js index 0639fecf7..afc53cf13 100644 --- a/src/shapes/SurfacePolyline.js +++ b/src/shapes/SurfacePolyline.js @@ -123,7 +123,7 @@ define([ }; // Internal use only. Intentionally not documented. - SurfacePolyline.prototype.moveTo = function (oldReferenceLocation, newReferenceLocation) { + SurfacePolyline.prototype.moveTo = function (oldReferenceLocation, position) { var locations = []; for (var i = 0; i < this.boundaries.length; i++){ var heading = Location.greatCircleAzimuth(oldReferenceLocation, @@ -131,7 +131,7 @@ define([ var pathLength = Location.greatCircleDistance(oldReferenceLocation, new Location(this._boundaries[i].latitude, this._boundaries[i].longitude)); var location = new Location(0, 0); - Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + Location.greatCircleLocation(position, heading, pathLength, location); locations.push(new Location(location.latitude, location.longitude)); } this.boundaries = locations; diff --git a/src/shapes/SurfaceRectangle.js b/src/shapes/SurfaceRectangle.js index 227e3fb5c..b817a4ac4 100644 --- a/src/shapes/SurfaceRectangle.js +++ b/src/shapes/SurfaceRectangle.js @@ -198,13 +198,13 @@ define([ }; // Internal use only. Intentionally not documented. - SurfaceRectangle.prototype.moveTo = function (oldReferenceLocation, newReferenceLocation) { + SurfaceRectangle.prototype.moveTo = function (oldReferenceLocation, position) { var heading = Location.greatCircleAzimuth(oldReferenceLocation, new Location(this.center.latitude, this.center.longitude)); var pathLength = Location.greatCircleDistance(oldReferenceLocation, new Location(this.center.latitude, this.center.longitude)); var location = new Location(0, 0); - Location.greatCircleLocation(newReferenceLocation, heading, pathLength, location); + Location.greatCircleLocation(position, heading, pathLength, location); this.center = location; }; From 1bf754c838018a99c55cc1f424dd68d1e17a3159 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 26 Mar 2018 13:04:54 +0300 Subject: [PATCH 005/112] refactoring - moveTo methods for shapes --- src/geom/Location.js | 34 ++++++++++++++++++++++++++++++++++ src/shapes/SurfaceCircle.js | 14 +++++--------- src/shapes/SurfaceEllipse.js | 14 +++++--------- src/shapes/SurfacePolygon.js | 27 +++++---------------------- src/shapes/SurfacePolyline.js | 15 +++------------ src/shapes/SurfaceRectangle.js | 14 +++++--------- src/util/ShapeEditor.js | 7 +------ 7 files changed, 58 insertions(+), 67 deletions(-) diff --git a/src/geom/Location.js b/src/geom/Location.js index e8643c174..4896d7ce5 100644 --- a/src/geom/Location.js +++ b/src/geom/Location.js @@ -953,6 +953,40 @@ define([ return lat; }; + /** + * Computes a new set of locations translated from a specified location to a new location. + * + * @param {Globe} globe Globe used to compute translation. + * @param {Location} oldLocation The original reference location. + * @param {Location} newLocation The new reference location. + * @param {Location[]} locations The locations to translate. + * + * @return {Location[]} The translated locations. + */ + Location.computeShiftedLocations = function(globe, oldLocation, newLocation, locations) + { + var newLocations = []; + + var oldPoint = globe.computePointFromLocation(oldLocation.latitude, oldLocation.longitude, + new Vec3(0, 0, 0)); + var newPoint = globe.computePointFromLocation(newLocation.latitude, newLocation.longitude, + new Vec3(0, 0, 0)); + var delta = newPoint.subtract(oldPoint); + + for(var i =0; i < locations.length; i++) + { + var point = globe.computePointFromLocation(locations[i].latitude, locations[i].longitude, + new Vec3(0, 0, 0)); + point = point.add(delta); + var newPos = new WorldWind.Position(0, 0, 0); + globe.computePositionFromPoint(point[0], point[1], point[2], newPos); + + newLocations.push(newPos); + } + + return newLocations; + } + /** * A bit mask indicating which if any pole is being referenced. * This corresponds to Java WW's AVKey.NORTH and AVKey.SOUTH, diff --git a/src/shapes/SurfaceCircle.js b/src/shapes/SurfaceCircle.js index 40f76c18a..5133afd59 100644 --- a/src/shapes/SurfaceCircle.js +++ b/src/shapes/SurfaceCircle.js @@ -168,15 +168,11 @@ define(['../error/ArgumentError', }; // Internal use only. Intentionally not documented. - SurfaceCircle.prototype.moveTo = function (oldReferenceLocation, position) { - var heading = Location.greatCircleAzimuth(oldReferenceLocation, - new Location(this.center.latitude, this.center.longitude)); - var pathLength = Location.greatCircleDistance(oldReferenceLocation, - new Location(this.center.latitude, this.center.longitude)); - var location = new Location(0, 0); - Location.greatCircleLocation(position, heading, pathLength, location); - - this.center = location; + SurfaceCircle.prototype.moveTo = function (globe, position) { + var locations = []; + locations.push(new Location(this.center.latitude, this.center.longitude)); + + this.center = Location.computeShiftedLocations(globe, this.getReferencePosition(), position, locations)[0]; }; /** diff --git a/src/shapes/SurfaceEllipse.js b/src/shapes/SurfaceEllipse.js index 994db812f..9b254f03f 100644 --- a/src/shapes/SurfaceEllipse.js +++ b/src/shapes/SurfaceEllipse.js @@ -218,15 +218,11 @@ define([ }; // Internal use only. Intentionally not documented. - SurfaceEllipse.prototype.moveTo = function (oldReferenceLocation, position) { - var heading = Location.greatCircleAzimuth(oldReferenceLocation, - new Location(this.center.latitude, this.center.longitude)); - var pathLength = Location.greatCircleDistance(oldReferenceLocation, - new Location(this.center.latitude, this.center.longitude)); - var location = new Location(0, 0); - Location.greatCircleLocation(position, heading, pathLength, location); - - this.center = location; + SurfaceEllipse.prototype.moveTo = function (globe, position) { + var locations = []; + locations.push(new Location(this.center.latitude, this.center.longitude)); + + this.center = Location.computeShiftedLocations(globe, this.getReferencePosition(), position, locations)[0]; }; /** diff --git a/src/shapes/SurfacePolygon.js b/src/shapes/SurfacePolygon.js index f0ffef663..b7bcf3ae5 100644 --- a/src/shapes/SurfacePolygon.js +++ b/src/shapes/SurfacePolygon.js @@ -133,36 +133,19 @@ define([ }; // Internal use only. Intentionally not documented. - SurfacePolygon.prototype.moveTo = function (oldReferenceLocation, position) { + SurfacePolygon.prototype.moveTo = function (globe, position) { if(this.boundaries.length > 0 && this.boundaries[0].length > 2){ var boundaries = []; for (var i = 0; i < this._boundaries.length; i++){ - var locations = []; - for (var j = 0; j < this._boundaries[i].length; j++){ - var heading = Location.greatCircleAzimuth(oldReferenceLocation, - new Location(this._boundaries[i][j].latitude, this._boundaries[i][j].longitude)); - var pathLength = Location.greatCircleDistance(oldReferenceLocation, - new Location(this._boundaries[i][j].latitude, this._boundaries[i][j].longitude)); - var location = new Location(0, 0); - Location.greatCircleLocation(position, heading, pathLength, location); - locations.push(new Location(location.latitude, location.longitude)); - } + var locations = Location.computeShiftedLocations(globe, this.getReferencePosition(), + position, this._boundaries[i]); boundaries.push(locations); } this.boundaries = boundaries; } else if (this.boundaries.length > 2){ - var locations = []; - for (var i = 0; i < this._boundaries.length; i++){ - var heading = Location.greatCircleAzimuth(oldReferenceLocation, - new Location(this._boundaries[i].latitude, this._boundaries[i].longitude)); - var pathLength = Location.greatCircleDistance(oldReferenceLocation, - new Location(this._boundaries[i].latitude, this._boundaries[i].longitude)); - var location = new Location(0, 0); - Location.greatCircleLocation(position, heading, pathLength, location); - locations.push(new Location(location.latitude, location.longitude)); - } - this.boundaries = locations; + this.boundaries = Location.computeShiftedLocations(globe, this.getReferencePosition(), + position, this._boundaries); } else { return; diff --git a/src/shapes/SurfacePolyline.js b/src/shapes/SurfacePolyline.js index afc53cf13..98f034e7b 100644 --- a/src/shapes/SurfacePolyline.js +++ b/src/shapes/SurfacePolyline.js @@ -123,18 +123,9 @@ define([ }; // Internal use only. Intentionally not documented. - SurfacePolyline.prototype.moveTo = function (oldReferenceLocation, position) { - var locations = []; - for (var i = 0; i < this.boundaries.length; i++){ - var heading = Location.greatCircleAzimuth(oldReferenceLocation, - new Location(this.boundaries[i].latitude, this.boundaries[i].longitude)); - var pathLength = Location.greatCircleDistance(oldReferenceLocation, - new Location(this._boundaries[i].latitude, this._boundaries[i].longitude)); - var location = new Location(0, 0); - Location.greatCircleLocation(position, heading, pathLength, location); - locations.push(new Location(location.latitude, location.longitude)); - } - this.boundaries = locations; + SurfacePolyline.prototype.moveTo = function (globe, position) { + this.boundaries = Location.computeShiftedLocations(globe, this.getReferencePosition(), + position, this._boundaries); }; return SurfacePolyline; diff --git a/src/shapes/SurfaceRectangle.js b/src/shapes/SurfaceRectangle.js index b817a4ac4..1373096ea 100644 --- a/src/shapes/SurfaceRectangle.js +++ b/src/shapes/SurfaceRectangle.js @@ -198,15 +198,11 @@ define([ }; // Internal use only. Intentionally not documented. - SurfaceRectangle.prototype.moveTo = function (oldReferenceLocation, position) { - var heading = Location.greatCircleAzimuth(oldReferenceLocation, - new Location(this.center.latitude, this.center.longitude)); - var pathLength = Location.greatCircleDistance(oldReferenceLocation, - new Location(this.center.latitude, this.center.longitude)); - var location = new Location(0, 0); - Location.greatCircleLocation(position, heading, pathLength, location); - - this.center = location; + SurfaceRectangle.prototype.moveTo = function (globe, position) { + var locations = []; + locations.push(new Location(this.center.latitude, this.center.longitude)); + + this.center = Location.computeShiftedLocations(globe, this.getReferencePosition(), position, locations)[0]; }; return SurfaceRectangle; diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index c3d8bc41d..8eaf5859f 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -88,11 +88,6 @@ define([ "missingWorldWindow")); } - // if (!shape) { - // throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "ShapeEditor", "constructor", - // "missingShape")); - // } - /** * The World Window associated with the shape editor controller. * @type {WorldWindow} @@ -671,7 +666,7 @@ define([ var p = new Position(0, 0, 0); this.worldWindow.globe.computePositionFromPoint(intersection[0], intersection[1], intersection[2], p); - this.shape.moveTo(refPos, new WorldWind.Location(p.latitude, p.longitude)); + this.shape.moveTo(this.worldWindow.globe, new WorldWind.Location(p.latitude, p.longitude)); } }; From dad3d62a4ffdfaa93725bcfa72f2c211aa6ef852 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 2 Apr 2018 11:50:09 +0300 Subject: [PATCH 006/112] move computeShiftedLocations in Globe --- src/geom/Location.js | 34 -------- src/globe/Globe.js | 32 +++++++ src/shapes/ControlPointMarker.js | 139 ------------------------------- src/shapes/SurfaceCircle.js | 2 +- src/shapes/SurfaceEllipse.js | 2 +- src/shapes/SurfacePolygon.js | 4 +- src/shapes/SurfacePolyline.js | 2 +- src/shapes/SurfaceRectangle.js | 2 +- 8 files changed, 38 insertions(+), 179 deletions(-) delete mode 100644 src/shapes/ControlPointMarker.js diff --git a/src/geom/Location.js b/src/geom/Location.js index 4896d7ce5..e8643c174 100644 --- a/src/geom/Location.js +++ b/src/geom/Location.js @@ -953,40 +953,6 @@ define([ return lat; }; - /** - * Computes a new set of locations translated from a specified location to a new location. - * - * @param {Globe} globe Globe used to compute translation. - * @param {Location} oldLocation The original reference location. - * @param {Location} newLocation The new reference location. - * @param {Location[]} locations The locations to translate. - * - * @return {Location[]} The translated locations. - */ - Location.computeShiftedLocations = function(globe, oldLocation, newLocation, locations) - { - var newLocations = []; - - var oldPoint = globe.computePointFromLocation(oldLocation.latitude, oldLocation.longitude, - new Vec3(0, 0, 0)); - var newPoint = globe.computePointFromLocation(newLocation.latitude, newLocation.longitude, - new Vec3(0, 0, 0)); - var delta = newPoint.subtract(oldPoint); - - for(var i =0; i < locations.length; i++) - { - var point = globe.computePointFromLocation(locations[i].latitude, locations[i].longitude, - new Vec3(0, 0, 0)); - point = point.add(delta); - var newPos = new WorldWind.Position(0, 0, 0); - globe.computePositionFromPoint(point[0], point[1], point[2], newPos); - - newLocations.push(newPos); - } - - return newLocations; - } - /** * A bit mask indicating which if any pole is being referenced. * This corresponds to Java WW's AVKey.NORTH and AVKey.SOUTH, diff --git a/src/globe/Globe.js b/src/globe/Globe.js index 821f1642e..aa1f290bd 100644 --- a/src/globe/Globe.js +++ b/src/globe/Globe.js @@ -659,6 +659,38 @@ define([ return this.elevationModel.elevationsForGrid(sector, numLat, numLon, targetResolution, result); }; + /** + * Computes a new set of locations translated from a specified location to a new location for this globe. + * + * @param {Location} oldLocation The original reference location. + * @param {Location} newLocation The new reference location. + * @param {Location[]} locations The locations to translate. + * + * @return {Location[]} The translated locations. + */ + Globe.prototype.computeShiftedLocations = function(oldLocation, newLocation, locations) { + var newLocations = []; + + var oldPoint = this.computePointFromLocation(oldLocation.latitude, oldLocation.longitude, + new Vec3(0, 0, 0)); + var newPoint = this.computePointFromLocation(newLocation.latitude, newLocation.longitude, + new Vec3(0, 0, 0)); + var delta = newPoint.subtract(oldPoint); + + for(var i =0; i < locations.length; i++) + { + var point = this.computePointFromLocation(locations[i].latitude, locations[i].longitude, + new Vec3(0, 0, 0)); + point = point.add(delta); + var newPos = new WorldWind.Position(0, 0, 0); + this.computePositionFromPoint(point[0], point[1], point[2], newPos); + + newLocations.push(newPos); + } + + return newLocations; + }; + return Globe; } ) diff --git a/src/shapes/ControlPointMarker.js b/src/shapes/ControlPointMarker.js deleted file mode 100644 index 7d76fb86e..000000000 --- a/src/shapes/ControlPointMarker.js +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2014 United States Government as represented by the Administrator of the - * National Aeronautics and Space Administration. All Rights Reserved. - */ -/** - * @exports ControlPointMarker - */ -define([ - '../error/ArgumentError', - '../util/Logger', - '../shapes/Placemark' - ], - function (ArgumentError, - Logger, - Placemark) { - "use strict"; - - /** - * Constructs a control point marker. Applications typically do not call this constructor. It is called by - * {@link ShapeEditor} during the shape editing process. - * @alias ControlPointMarker - * @constructor - * @classdesc A visual marker with position and purpose, used by {@link ShapeEditor} during the shape editing. - * @param {Position} position The control point's position. - * @param {PlacemarkAttributes} attributes The control point's attributes. - * @param {Number} id The control point's ID. - * @param {string} purpose The control point's purpose. - * @throws {ArgumentError} If the specified position, id or purpose is null or undefined. - */ - var ControlPointMarker = function (position, attributes, id, purpose) { - if (!position) { - throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "ControlPointMarker", "constructor", "missingPosition")); - } - - if (id === null || id === undefined) { - throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "ControlPointMarker", "constructor", "missingId")); - } - - if (!purpose) { - throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "ControlPointMarker", "constructor", "missingPurpose")); - } - - Placemark.call(this, position, false, attributes); - - // Documented in defineProperties below. - this._id = id; - - // Documented in defineProperties below. - this._purpose = purpose; - - // Documented in defineProperties below. - this._size = null; - - // Documented in defineProperties below. - this._rotation = null; - }; - - ControlPointMarker.prototype = Object.create(Placemark.prototype); - - Object.defineProperties(ControlPointMarker.prototype, { - /** - * The control point's ID, which is typically its array index when the shape has an array of locations. - * @memberof ControlPointMarker.prototype - * @type {Number} - * @readonly - */ - id: { - get: function () { - return this._id; - } - }, - /** - * Indicates the feature the control point affects. - * @memberof ControlPointMarker.prototype - * @type {string} - * @readonly - */ - purpose: { - get: function () { - return this._purpose; - } - }, - /** - * Indicates size (in meters) if this control point affects a size of the shape, otherwise null. - * @memberof ControlPointMarker.prototype - * @type {Number} - */ - size: { - get: function () { - return this._size; - }, - set: function (value) { - this._size = value; - } - }, - - /** - * Indicates angle if this control point affects an angle associated with the shape, otherwise null. - * @memberof ControlPointMarker.prototype - * @type {Number} - */ - rotation: { - get: function () { - return this._rotation; - }, - set: function (value) { - this._rotation = value; - } - } - }); - - // Control points purposes - - // Indicates that a control point is associated with annotation. - ControlPointMarker.ANNOTATION = "annotation"; - - // Indicates a control point is associated with a location. - ControlPointMarker.LOCATION = "location"; - - // Indicates that a control point is associated with whole-shape rotation. - ControlPointMarker.ROTATION = "rotation"; - - // Indicates that a control point is associated with width change. - ControlPointMarker.WIDTH = "width"; - - // Indicates that a control point is associated with height change. - ControlPointMarker.HEIGHT = "height"; - - // Indicates that a control point is associated with the right width of a shape. - ControlPointMarker.RIGHT_WIDTH = "rightWidth"; - - // Indicates that a control point is associated with the outer radius of a shape. - ControlPointMarker.OUTER_RADIUS = "outerRadius"; - - return ControlPointMarker; - }); \ No newline at end of file diff --git a/src/shapes/SurfaceCircle.js b/src/shapes/SurfaceCircle.js index 5133afd59..9af6e8467 100644 --- a/src/shapes/SurfaceCircle.js +++ b/src/shapes/SurfaceCircle.js @@ -172,7 +172,7 @@ define(['../error/ArgumentError', var locations = []; locations.push(new Location(this.center.latitude, this.center.longitude)); - this.center = Location.computeShiftedLocations(globe, this.getReferencePosition(), position, locations)[0]; + this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, locations)[0]; }; /** diff --git a/src/shapes/SurfaceEllipse.js b/src/shapes/SurfaceEllipse.js index 9b254f03f..e7375a783 100644 --- a/src/shapes/SurfaceEllipse.js +++ b/src/shapes/SurfaceEllipse.js @@ -222,7 +222,7 @@ define([ var locations = []; locations.push(new Location(this.center.latitude, this.center.longitude)); - this.center = Location.computeShiftedLocations(globe, this.getReferencePosition(), position, locations)[0]; + this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, locations)[0]; }; /** diff --git a/src/shapes/SurfacePolygon.js b/src/shapes/SurfacePolygon.js index b7bcf3ae5..861b638cc 100644 --- a/src/shapes/SurfacePolygon.js +++ b/src/shapes/SurfacePolygon.js @@ -137,14 +137,14 @@ define([ if(this.boundaries.length > 0 && this.boundaries[0].length > 2){ var boundaries = []; for (var i = 0; i < this._boundaries.length; i++){ - var locations = Location.computeShiftedLocations(globe, this.getReferencePosition(), + var locations = globe.computeShiftedLocations(this.getReferencePosition(), position, this._boundaries[i]); boundaries.push(locations); } this.boundaries = boundaries; } else if (this.boundaries.length > 2){ - this.boundaries = Location.computeShiftedLocations(globe, this.getReferencePosition(), + this.boundaries = globe.computeShiftedLocations(this.getReferencePosition(), position, this._boundaries); } else { diff --git a/src/shapes/SurfacePolyline.js b/src/shapes/SurfacePolyline.js index 98f034e7b..8a2e874da 100644 --- a/src/shapes/SurfacePolyline.js +++ b/src/shapes/SurfacePolyline.js @@ -124,7 +124,7 @@ define([ // Internal use only. Intentionally not documented. SurfacePolyline.prototype.moveTo = function (globe, position) { - this.boundaries = Location.computeShiftedLocations(globe, this.getReferencePosition(), + this.boundaries = globe.computeShiftedLocations(this.getReferencePosition(), position, this._boundaries); }; diff --git a/src/shapes/SurfaceRectangle.js b/src/shapes/SurfaceRectangle.js index 1373096ea..e95e274aa 100644 --- a/src/shapes/SurfaceRectangle.js +++ b/src/shapes/SurfaceRectangle.js @@ -202,7 +202,7 @@ define([ var locations = []; locations.push(new Location(this.center.latitude, this.center.longitude)); - this.center = Location.computeShiftedLocations(globe, this.getReferencePosition(), position, locations)[0]; + this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, locations)[0]; }; return SurfaceRectangle; From d2b82baac924226a301f514f324e942c5a6678a5 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 2 Apr 2018 11:51:24 +0300 Subject: [PATCH 007/112] Refactoring - remove ControlPointMarker and use Placemark --- src/util/ShapeEditor.js | 246 +++++++++++++++++++++++++--------------- 1 file changed, 153 insertions(+), 93 deletions(-) diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index 8eaf5859f..cd4668d5c 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -22,12 +22,12 @@ define([ '../shapes/AnnotationAttributes', '../error/ArgumentError', '../util/Color', - '../shapes/ControlPointMarker', '../util/Font', '../util/Insets', '../geom/Location', '../util/Logger', '../shapes/Path', + '../shapes/Placemark', '../shapes/PlacemarkAttributes', '../geom/Position', '../layer/RenderableLayer', @@ -46,12 +46,12 @@ define([ AnnotationAttributes, ArgumentError, Color, - ControlPointMarker, Font, Insets, Location, Logger, Path, + Placemark, PlacemarkAttributes, Position, RenderableLayer, @@ -152,8 +152,8 @@ define([ this.previousPosition = null; /** - * The control point associated with the current sizing operation. - * @type {ControlPointMarker} + * The placemark associated with the current sizing operation. + * @type {Placemark} */ this.currentSizingMarker = null; @@ -238,7 +238,8 @@ define([ return; } - if (shapeEditor.currentSizingMarker instanceof ControlPointMarker) { + if (shapeEditor.currentSizingMarker instanceof Placemark && + shapeEditor.currentSizingMarker.userProperties.isControlPoint) { shapeEditor.reshapeShape(terrainObject); shapeEditor.updateControlPoints(); } @@ -280,7 +281,8 @@ define([ //set previous position shapeEditor.setPreviousPosition(event); } - else if (pickList.objects[p].userObject instanceof ControlPointMarker) { + else if (pickList.objects[p].userObject instanceof Placemark && + pickList.objects[p].userObject.userProperties.isControlPoint) { event.preventDefault(); shapeEditor.currentSizingMarker = pickList.objects[p].userObject; shapeEditor.isDragging = true; @@ -308,7 +310,8 @@ define([ shapeEditor.updateAnnotation(null); } - if (shapeEditor.currentSizingMarker instanceof ControlPointMarker) { + if (shapeEditor.currentSizingMarker instanceof Placemark && + shapeEditor.currentSizingMarker.userProperties.isControlPoint) { if (event.altKey) { var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); var terrainObject; @@ -485,9 +488,12 @@ define([ var center = this.getShapeCenter(); if (center != null) { - var dummyMarker = new ControlPointMarker( + var dummyMarker = new Placemark( new Position(center.latitude, center.longitude, 0), - null, 0, ControlPointMarker.ANNOTATION); + null); + dummyMarker.userProperties.isControlPoint = true; + dummyMarker.userProperties.id = 0; + dummyMarker.userProperties.purpose = ShapeEditor.ANNOTATION; this.updateAnnotation(dummyMarker); } else { @@ -691,7 +697,7 @@ define([ * Subclasses should override this method if they provide editing for shapes other than those supported by * the basic editor. * - * @param {ControlPointMarker} controlPoint The control point selected. + * @param {Placemark} controlPoint The control point selected. * @param {Position} terrainPosition The terrain position under the cursor. */ ShapeEditor.prototype.doReshapeShape = function (controlPoint, terrainPosition) { @@ -802,7 +808,7 @@ define([ /** * Updates the annotation associated with a specified control point. - * @param {ControlPointMarker} controlPoint The control point. + * @param {Placemark} controlPoint The control point. */ ShapeEditor.prototype.updateAnnotation = function (controlPoint) { if (!controlPoint) { @@ -818,11 +824,11 @@ define([ ); var annotationText; - if (controlPoint.size !== null) { - annotationText = this.formatLength(controlPoint.size); + if (controlPoint.userProperties.size !== undefined) { + annotationText = this.formatLength(controlPoint.userProperties.size); } - else if (controlPoint.rotation !== null) { - annotationText = this.formatRotation(controlPoint.rotation); + else if (controlPoint.userProperties.rotation !== undefined) { + annotationText = this.formatRotation(controlPoint.userProperties.rotation); } else { annotationText = this.formatLatitude(controlPoint.position.latitude) + " " + @@ -994,7 +1000,7 @@ define([ /** * Moves a control point location. - * @param {ControlPointMarker} controlPoint The control point being moved. + * @param {Placemark} controlPoint The control point being moved. * @param {Position} terrainPosition The position selected by the user. * @returns {Position} The position after move. */ @@ -1078,8 +1084,8 @@ define([ outer: for (var i = 0; i < boundaries.length; i++) { for (var j = 0; j < boundaries[i].length; j++) { - if (controlPoint.purpose == ControlPointMarker.LOCATION) { - if (controlPoint.id == k) { + if (controlPoint.userProperties.purpose == ShapeEditor.LOCATION) { + if (controlPoint.userProperties.id == k) { newPos = this.moveLocation(controlPoint, terrainPosition); boundaries[i][j] = newPos; this.shape.boundaries = boundaries; @@ -1087,7 +1093,7 @@ define([ break outer; } } - else if (controlPoint.purpose == ControlPointMarker.ROTATION) { + else if (controlPoint.userProperties.purpose == ShapeEditor.ROTATION) { this.rotateLocations(terrainPosition, boundaries); this.shape.boundaries = boundaries; break outer; @@ -1099,29 +1105,27 @@ define([ else if (boundaries.length >= 2) { //poly without whole for (var i = 0; i < boundaries.length; i++) { - if (controlPoint.id == k) { - if (controlPoint.purpose == ControlPointMarker.LOCATION) { - if (controlPoint.id == k) { - if (this.currentEvent.altKey) { - //remove location - var minSize = this.shape instanceof SurfacePolygon ? 3 : 2; - if (boundaries.length > minSize) { - // Delete the control point. - boundaries.splice(i, 1); - this.shape.boundaries = boundaries; - this.removeControlPoints(); - } - } - else { - newPos = this.moveLocation(controlPoint, terrainPosition); - boundaries[i] = newPos; + if (controlPoint.userProperties.purpose == ShapeEditor.LOCATION) { + if (controlPoint.userProperties.id == k) { + if (this.currentEvent.altKey) { + //remove location + var minSize = this.shape instanceof SurfacePolygon ? 3 : 2; + if (boundaries.length > minSize) { + // Delete the control point. + boundaries.splice(i, 1); this.shape.boundaries = boundaries; - controlPoint.position = newPos; + this.removeControlPoints(); } - break; } + else { + newPos = this.moveLocation(controlPoint, terrainPosition); + boundaries[i] = newPos; + this.shape.boundaries = boundaries; + controlPoint.position = newPos; + } + break; } - } else if (controlPoint.purpose == ControlPointMarker.ROTATION) { + } else if (controlPoint.userProperties.purpose == ShapeEditor.ROTATION) { this.rotateLocations(terrainPosition, boundaries); this.shape.boundaries = boundaries; break; @@ -1176,28 +1180,36 @@ define([ markers[i].position = locations[i]; } markers[locations.length].position = rotationPosition; - markers[locations.length].rotation = heading; + markers[locations.length].userProperties.rotation = heading; } else { var controlPointMarker; for (var i = 0; i < locations.length; i++) { - controlPointMarker = new ControlPointMarker( + controlPointMarker = new Placemark( locations[i], - this.locationControlPointAttributes, - i, - ControlPointMarker.LOCATION); + false, + this.locationControlPointAttributes); + controlPointMarker.userProperties.isControlPoint = true; + controlPointMarker.userProperties.id = i; + controlPointMarker.userProperties.purpose = ShapeEditor.LOCATION; + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; this.controlPointLayer.addRenderable(controlPointMarker); } - controlPointMarker = new ControlPointMarker( + controlPointMarker = new Placemark( rotationPosition, - this.angleControlPointAttributes, - locations.length, - ControlPointMarker.ROTATION + false, + this.angleControlPointAttributes ); + + controlPointMarker.userProperties.isControlPoint = true; + controlPointMarker.userProperties.id = locations.length; + controlPointMarker.userProperties.purpose = ShapeEditor.ROTATION; + controlPointMarker.userProperties.rotation = heading; + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPointMarker.rotation = heading; + this.controlPointLayer.addRenderable(controlPointMarker); } @@ -1252,16 +1264,20 @@ define([ markers[0].position = radiusLocation; } else { - var controlPointMarker = new ControlPointMarker( + var controlPointMarker = new Placemark( radiusLocation, - this.sizeControlPointAttributes, - 0, - ControlPointMarker.OUTER_RADIUS); + false, + this.sizeControlPointAttributes + ); + controlPointMarker.userProperties.isControlPoint = true; + controlPointMarker.userProperties.id = 0; + controlPointMarker.userProperties.purpose = ShapeEditor.OUTER_RADIUS; + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; this.controlPointLayer.addRenderable(controlPointMarker); } - markers[0].size = circle.radius; + markers[0].userProperties.size = circle.radius; }; //Internal use only. Intentionally not documented. @@ -1300,9 +1316,9 @@ define([ ); var vMarker = markerPoint.subtract(centerPoint).normalize(); - if (controlPoint.purpose == ControlPointMarker.WIDTH || controlPoint.purpose == ControlPointMarker.HEIGHT) { - var width = rectangle.width + (controlPoint.id == 0 ? delta.dot(vMarker) * 2 : 0); - var height = rectangle.height + (controlPoint.id == 1 ? delta.dot(vMarker) * 2 : 0); + if (controlPoint.userProperties.purpose == ShapeEditor.WIDTH || controlPoint.userProperties.purpose == ShapeEditor.HEIGHT) { + var width = rectangle.width + (controlPoint.userProperties.id == 0 ? delta.dot(vMarker) * 2 : 0); + var height = rectangle.height + (controlPoint.userProperties.id == 1 ? delta.dot(vMarker) * 2 : 0); if (width > 0 && height > 0) { rectangle.width = width; @@ -1350,37 +1366,48 @@ define([ markers[2].position = rotationLocation; } else { - var controlPointMarker = new ControlPointMarker( + var controlPointMarker = new Placemark( widthLocation, - this.sizeControlPointAttributes, - 0, - ControlPointMarker.WIDTH + false, + this.sizeControlPointAttributes ); + controlPointMarker.userProperties.isControlPoint = true; + controlPointMarker.userProperties.id = 0; + controlPointMarker.userProperties.purpose = ShapeEditor.WIDTH; + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; this.controlPointLayer.addRenderable(controlPointMarker); - controlPointMarker = new ControlPointMarker( + controlPointMarker = new Placemark( heightLocation, - this.sizeControlPointAttributes, - 1, - ControlPointMarker.HEIGHT); + false, + this.sizeControlPointAttributes + ); + controlPointMarker.userProperties.isControlPoint = true; + controlPointMarker.userProperties.id = 1; + controlPointMarker.userProperties.purpose = ShapeEditor.HEIGHT; + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; this.controlPointLayer.addRenderable(controlPointMarker); - controlPointMarker = new ControlPointMarker( + controlPointMarker = new Placemark( rotationLocation, - this.angleControlPointAttributes, - 1, - ControlPointMarker.ROTATION); + false, + this.angleControlPointAttributes + ); + controlPointMarker.userProperties.isControlPoint = true; + controlPointMarker.userProperties.id = 1; + controlPointMarker.userProperties.purpose = ShapeEditor.ROTATION; + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; this.controlPointLayer.addRenderable(controlPointMarker); } - markers[0].size = rectangle.width; - markers[1].size = rectangle.height; - markers[2].rotation = rectangle.heading; + markers[0].userProperties.size = rectangle.width; + markers[1].userProperties.size = rectangle.height; + markers[2].userProperties.rotation = rectangle.heading; - this.updateOrientationLine(rectangle.center, rotationLocation) + this.updateOrientationLine(rectangle.center, rotationLocation); }; //Internal use only. Intentionally not documented. @@ -1419,16 +1446,16 @@ define([ ); var vMarker = markerPoint.subtract(centerPoint).normalize(); - if (controlPoint.purpose == ControlPointMarker.WIDTH || controlPoint.purpose == ControlPointMarker.HEIGHT) { - var majorRadius = ellipse.majorRadius + (controlPoint.id == 0 ? delta.dot(vMarker) : 0); - var minorRadius = ellipse.minorRadius + (controlPoint.id == 1 ? delta.dot(vMarker) : 0); + if (controlPoint.userProperties.purpose == ShapeEditor.WIDTH || + controlPoint.userProperties.purpose == ShapeEditor.HEIGHT) { + var majorRadius = ellipse.majorRadius + (controlPoint.userProperties.id == 0 ? delta.dot(vMarker) : 0); + var minorRadius = ellipse.minorRadius + (controlPoint.userProperties.id == 1 ? delta.dot(vMarker) : 0); if (majorRadius > 0 && minorRadius > 0) { ellipse.majorRadius = majorRadius; ellipse.minorRadius = minorRadius; } - } - else { + } else { var oldHeading = Location.greatCircleAzimuth(ellipse.center, this.previousPosition); var deltaHeading = Location.greatCircleAzimuth(ellipse.center, terrainPosition) - oldHeading; ellipse.heading = this.normalizedHeading(ellipse.heading, deltaHeading); @@ -1468,38 +1495,71 @@ define([ markers[2].position = rotationLocation; } else { - var controlPointMarker = new ControlPointMarker( + var controlPointMarker = new Placemark( majorLocation, - this.sizeControlPointAttributes, - 0, - ControlPointMarker.WIDTH); + false, + this.sizeControlPointAttributes + ); + controlPointMarker.userProperties.isControlPoint = true; + controlPointMarker.userProperties.id = 0; + controlPointMarker.userProperties.purpose = ShapeEditor.WIDTH; + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; this.controlPointLayer.addRenderable(controlPointMarker); - controlPointMarker = new ControlPointMarker( + controlPointMarker = new Placemark( minorLocation, - this.sizeControlPointAttributes, - 1, - ControlPointMarker.HEIGHT); + false, + this.sizeControlPointAttributes + ); + controlPointMarker.userProperties.isControlPoint = true; + controlPointMarker.userProperties.id = 1; + controlPointMarker.userProperties.purpose = ShapeEditor.HEIGHT; + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; this.controlPointLayer.addRenderable(controlPointMarker); - controlPointMarker = new ControlPointMarker( + controlPointMarker = new Placemark( rotationLocation, - this.angleControlPointAttributes, - 2, - ControlPointMarker.ROTATION); + false, + this.angleControlPointAttributes + ); + controlPointMarker.userProperties.isControlPoint = true; + controlPointMarker.userProperties.id = 2; + controlPointMarker.userProperties.purpose = ShapeEditor.ROTATION; + controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; this.controlPointLayer.addRenderable(controlPointMarker); } - markers[0].size = ellipse.majorRadius; - markers[1].size = ellipse.minorRadius; - markers[2].rotation = ellipse.heading; + markers[0].userProperties.size = ellipse.majorRadius; + markers[1].userProperties.size = ellipse.minorRadius; + markers[2].userProperties.rotation = ellipse.heading; - this.updateOrientationLine(ellipse.center, rotationLocation) + this.updateOrientationLine(ellipse.center, rotationLocation); }; + // Indicates that a control point is associated with annotation. + ShapeEditor.ANNOTATION = "annotation"; + + // Indicates a control point is associated with a location. + ShapeEditor.LOCATION = "location"; + + // Indicates that a control point is associated with whole-shape rotation. + ShapeEditor.ROTATION = "rotation"; + + // Indicates that a control point is associated with width change. + ShapeEditor.WIDTH = "width"; + + // Indicates that a control point is associated with height change. + ShapeEditor.HEIGHT = "height"; + + // Indicates that a control point is associated with the right width of a shape. + ShapeEditor.RIGHT_WIDTH = "rightWidth"; + + // Indicates that a control point is associated with the outer radius of a shape. + ShapeEditor.OUTER_RADIUS = "outerRadius"; + return ShapeEditor; } ); \ No newline at end of file From 524f0b6529212e6cd339e0d8dc93e96c0e969ac2 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 4 Apr 2018 22:21:40 +0300 Subject: [PATCH 008/112] remove unused location --- src/shapes/SurfacePolygon.js | 2 -- src/shapes/SurfacePolyline.js | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/shapes/SurfacePolygon.js b/src/shapes/SurfacePolygon.js index 861b638cc..6692ba2f6 100644 --- a/src/shapes/SurfacePolygon.js +++ b/src/shapes/SurfacePolygon.js @@ -18,13 +18,11 @@ */ define([ '../error/ArgumentError', - '../geom/Location', '../util/Logger', '../shapes/ShapeAttributes', '../shapes/SurfaceShape' ], function (ArgumentError, - Location, Logger, ShapeAttributes, SurfaceShape) { diff --git a/src/shapes/SurfacePolyline.js b/src/shapes/SurfacePolyline.js index 8a2e874da..9562cbaca 100644 --- a/src/shapes/SurfacePolyline.js +++ b/src/shapes/SurfacePolyline.js @@ -18,13 +18,11 @@ */ define([ '../error/ArgumentError', - '../geom/Location', '../util/Logger', '../shapes/ShapeAttributes', '../shapes/SurfaceShape' ], function (ArgumentError, - Location, Logger, ShapeAttributes, SurfaceShape) { From 5abf8880bc73dace7955e1d1f924b9c86f5ed09e Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 4 Apr 2018 22:22:59 +0300 Subject: [PATCH 009/112] fix complexity issue --- src/globe/Globe.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globe/Globe.js b/src/globe/Globe.js index aa1f290bd..055e1ab87 100644 --- a/src/globe/Globe.js +++ b/src/globe/Globe.js @@ -677,7 +677,7 @@ define([ new Vec3(0, 0, 0)); var delta = newPoint.subtract(oldPoint); - for(var i =0; i < locations.length; i++) + for(var i = 0, len = locations.length; i < len; i++) { var point = this.computePointFromLocation(locations[i].latitude, locations[i].longitude, new Vec3(0, 0, 0)); From d97e6ee96d0d9a9dc951acf90e1cb71b9f7d4d71 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Fri, 6 Apr 2018 12:33:44 +0300 Subject: [PATCH 010/112] fix comments from review + bugfix shape editor - circle selection --- src/globe/Globe.js | 3 ++- src/shapes/SurfaceCircle.js | 6 ++---- src/shapes/SurfaceEllipse.js | 6 ++---- src/shapes/SurfaceRectangle.js | 6 ++---- src/util/ShapeEditor.js | 5 +++++ 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/globe/Globe.js b/src/globe/Globe.js index 055e1ab87..36354a9da 100644 --- a/src/globe/Globe.js +++ b/src/globe/Globe.js @@ -670,6 +670,7 @@ define([ */ Globe.prototype.computeShiftedLocations = function(oldLocation, newLocation, locations) { var newLocations = []; + var result = new Vec3(0, 0, 0); var oldPoint = this.computePointFromLocation(oldLocation.latitude, oldLocation.longitude, new Vec3(0, 0, 0)); @@ -680,7 +681,7 @@ define([ for(var i = 0, len = locations.length; i < len; i++) { var point = this.computePointFromLocation(locations[i].latitude, locations[i].longitude, - new Vec3(0, 0, 0)); + result); point = point.add(delta); var newPos = new WorldWind.Position(0, 0, 0); this.computePositionFromPoint(point[0], point[1], point[2], newPos); diff --git a/src/shapes/SurfaceCircle.js b/src/shapes/SurfaceCircle.js index 9af6e8467..9d0a6edb3 100644 --- a/src/shapes/SurfaceCircle.js +++ b/src/shapes/SurfaceCircle.js @@ -169,10 +169,8 @@ define(['../error/ArgumentError', // Internal use only. Intentionally not documented. SurfaceCircle.prototype.moveTo = function (globe, position) { - var locations = []; - locations.push(new Location(this.center.latitude, this.center.longitude)); - - this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, locations)[0]; + this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, + [new Location(this.center.latitude, this.center.longitude)])[0]; }; /** diff --git a/src/shapes/SurfaceEllipse.js b/src/shapes/SurfaceEllipse.js index e7375a783..e8775e023 100644 --- a/src/shapes/SurfaceEllipse.js +++ b/src/shapes/SurfaceEllipse.js @@ -219,10 +219,8 @@ define([ // Internal use only. Intentionally not documented. SurfaceEllipse.prototype.moveTo = function (globe, position) { - var locations = []; - locations.push(new Location(this.center.latitude, this.center.longitude)); - - this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, locations)[0]; + this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, + [new Location(this.center.latitude, this.center.longitude)])[0]; }; /** diff --git a/src/shapes/SurfaceRectangle.js b/src/shapes/SurfaceRectangle.js index e95e274aa..f24204277 100644 --- a/src/shapes/SurfaceRectangle.js +++ b/src/shapes/SurfaceRectangle.js @@ -199,10 +199,8 @@ define([ // Internal use only. Intentionally not documented. SurfaceRectangle.prototype.moveTo = function (globe, position) { - var locations = []; - locations.push(new Location(this.center.latitude, this.center.longitude)); - - this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, locations)[0]; + this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, + [new Location(this.center.latitude, this.center.longitude)])[0]; }; return SurfaceRectangle; diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index cd4668d5c..492feab08 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -405,6 +405,11 @@ define([ this.shape.minorRadius, this.shape.heading, this.shape.attributes); + } else if (this.shape && this.shape instanceof SurfaceCircle) { + return new SurfaceCircle( + this.shape.center, + this.shape.radius, + this.shape.attributes); } else if (this.shape && this.shape instanceof SurfaceRectangle) { return new SurfaceRectangle( this.shape.center, From 840311d0636ca4f073910eab2a66dacc1652eac4 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Tue, 10 Apr 2018 13:26:24 +0300 Subject: [PATCH 011/112] update moveto - use center --- src/shapes/SurfaceCircle.js | 2 +- src/shapes/SurfaceEllipse.js | 2 +- src/shapes/SurfacePolygon.js | 2 +- src/shapes/SurfaceRectangle.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shapes/SurfaceCircle.js b/src/shapes/SurfaceCircle.js index 9d0a6edb3..12007d33a 100644 --- a/src/shapes/SurfaceCircle.js +++ b/src/shapes/SurfaceCircle.js @@ -170,7 +170,7 @@ define(['../error/ArgumentError', // Internal use only. Intentionally not documented. SurfaceCircle.prototype.moveTo = function (globe, position) { this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, - [new Location(this.center.latitude, this.center.longitude)])[0]; + [this.center])[0]; }; /** diff --git a/src/shapes/SurfaceEllipse.js b/src/shapes/SurfaceEllipse.js index e8775e023..dc97cfd0e 100644 --- a/src/shapes/SurfaceEllipse.js +++ b/src/shapes/SurfaceEllipse.js @@ -220,7 +220,7 @@ define([ // Internal use only. Intentionally not documented. SurfaceEllipse.prototype.moveTo = function (globe, position) { this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, - [new Location(this.center.latitude, this.center.longitude)])[0]; + [this.center])[0]; }; /** diff --git a/src/shapes/SurfacePolygon.js b/src/shapes/SurfacePolygon.js index 6692ba2f6..a483edcde 100644 --- a/src/shapes/SurfacePolygon.js +++ b/src/shapes/SurfacePolygon.js @@ -134,7 +134,7 @@ define([ SurfacePolygon.prototype.moveTo = function (globe, position) { if(this.boundaries.length > 0 && this.boundaries[0].length > 2){ var boundaries = []; - for (var i = 0; i < this._boundaries.length; i++){ + for (var i = 0, len = this._boundaries.length; i < len; i++){ var locations = globe.computeShiftedLocations(this.getReferencePosition(), position, this._boundaries[i]); boundaries.push(locations); diff --git a/src/shapes/SurfaceRectangle.js b/src/shapes/SurfaceRectangle.js index f24204277..fc01d069a 100644 --- a/src/shapes/SurfaceRectangle.js +++ b/src/shapes/SurfaceRectangle.js @@ -200,7 +200,7 @@ define([ // Internal use only. Intentionally not documented. SurfaceRectangle.prototype.moveTo = function (globe, position) { this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, - [new Location(this.center.latitude, this.center.longitude)])[0]; + [this.center])[0]; }; return SurfaceRectangle; From 4c3aa1f667ce27b0037a47c512eb5c37ffac4ff2 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Tue, 10 Apr 2018 15:51:40 +0300 Subject: [PATCH 012/112] move computeShiftedLocations from globe to SurfaceShape --- src/globe/Globe.js | 36 +--------------------------------- src/shapes/SurfaceCircle.js | 2 +- src/shapes/SurfaceEllipse.js | 2 +- src/shapes/SurfacePolygon.js | 4 ++-- src/shapes/SurfacePolyline.js | 2 +- src/shapes/SurfaceRectangle.js | 2 +- src/shapes/SurfaceShape.js | 36 ++++++++++++++++++++++++++++++++++ 7 files changed, 43 insertions(+), 41 deletions(-) diff --git a/src/globe/Globe.js b/src/globe/Globe.js index 36354a9da..20efbc9b6 100644 --- a/src/globe/Globe.js +++ b/src/globe/Globe.js @@ -659,40 +659,6 @@ define([ return this.elevationModel.elevationsForGrid(sector, numLat, numLon, targetResolution, result); }; - /** - * Computes a new set of locations translated from a specified location to a new location for this globe. - * - * @param {Location} oldLocation The original reference location. - * @param {Location} newLocation The new reference location. - * @param {Location[]} locations The locations to translate. - * - * @return {Location[]} The translated locations. - */ - Globe.prototype.computeShiftedLocations = function(oldLocation, newLocation, locations) { - var newLocations = []; - var result = new Vec3(0, 0, 0); - - var oldPoint = this.computePointFromLocation(oldLocation.latitude, oldLocation.longitude, - new Vec3(0, 0, 0)); - var newPoint = this.computePointFromLocation(newLocation.latitude, newLocation.longitude, - new Vec3(0, 0, 0)); - var delta = newPoint.subtract(oldPoint); - - for(var i = 0, len = locations.length; i < len; i++) - { - var point = this.computePointFromLocation(locations[i].latitude, locations[i].longitude, - result); - point = point.add(delta); - var newPos = new WorldWind.Position(0, 0, 0); - this.computePositionFromPoint(point[0], point[1], point[2], newPos); - - newLocations.push(newPos); - } - - return newLocations; - }; - return Globe; } -) -; \ No newline at end of file +); diff --git a/src/shapes/SurfaceCircle.js b/src/shapes/SurfaceCircle.js index 12007d33a..1a9f31585 100644 --- a/src/shapes/SurfaceCircle.js +++ b/src/shapes/SurfaceCircle.js @@ -169,7 +169,7 @@ define(['../error/ArgumentError', // Internal use only. Intentionally not documented. SurfaceCircle.prototype.moveTo = function (globe, position) { - this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, + this.center = this.computeShiftedLocations(globe, this.getReferencePosition(), position, [this.center])[0]; }; diff --git a/src/shapes/SurfaceEllipse.js b/src/shapes/SurfaceEllipse.js index dc97cfd0e..cd25f0715 100644 --- a/src/shapes/SurfaceEllipse.js +++ b/src/shapes/SurfaceEllipse.js @@ -219,7 +219,7 @@ define([ // Internal use only. Intentionally not documented. SurfaceEllipse.prototype.moveTo = function (globe, position) { - this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, + this.center = this.computeShiftedLocations(globe, this.getReferencePosition(), position, [this.center])[0]; }; diff --git a/src/shapes/SurfacePolygon.js b/src/shapes/SurfacePolygon.js index a483edcde..dccd6c9ae 100644 --- a/src/shapes/SurfacePolygon.js +++ b/src/shapes/SurfacePolygon.js @@ -135,14 +135,14 @@ define([ if(this.boundaries.length > 0 && this.boundaries[0].length > 2){ var boundaries = []; for (var i = 0, len = this._boundaries.length; i < len; i++){ - var locations = globe.computeShiftedLocations(this.getReferencePosition(), + var locations = this.computeShiftedLocations(globe, this.getReferencePosition(), position, this._boundaries[i]); boundaries.push(locations); } this.boundaries = boundaries; } else if (this.boundaries.length > 2){ - this.boundaries = globe.computeShiftedLocations(this.getReferencePosition(), + this.boundaries = this.computeShiftedLocations(globe, this.getReferencePosition(), position, this._boundaries); } else { diff --git a/src/shapes/SurfacePolyline.js b/src/shapes/SurfacePolyline.js index 9562cbaca..60c3a6dcf 100644 --- a/src/shapes/SurfacePolyline.js +++ b/src/shapes/SurfacePolyline.js @@ -122,7 +122,7 @@ define([ // Internal use only. Intentionally not documented. SurfacePolyline.prototype.moveTo = function (globe, position) { - this.boundaries = globe.computeShiftedLocations(this.getReferencePosition(), + this.boundaries = this.computeShiftedLocations(globe, this.getReferencePosition(), position, this._boundaries); }; diff --git a/src/shapes/SurfaceRectangle.js b/src/shapes/SurfaceRectangle.js index fc01d069a..a703dd91f 100644 --- a/src/shapes/SurfaceRectangle.js +++ b/src/shapes/SurfaceRectangle.js @@ -199,7 +199,7 @@ define([ // Internal use only. Intentionally not documented. SurfaceRectangle.prototype.moveTo = function (globe, position) { - this.center = globe.computeShiftedLocations(this.getReferencePosition(), position, + this.center = this.computeShiftedLocations(globe, this.getReferencePosition(), position, [this.center])[0]; }; diff --git a/src/shapes/SurfaceShape.js b/src/shapes/SurfaceShape.js index 8e0e3b91e..cdac17a46 100644 --- a/src/shapes/SurfaceShape.js +++ b/src/shapes/SurfaceShape.js @@ -32,6 +32,7 @@ define([ '../geom/Sector', '../shapes/ShapeAttributes', '../error/UnsupportedOperationError', + '../geom/Vec3', '../util/WWMath' ], function (AbstractError, @@ -49,6 +50,7 @@ define([ Sector, ShapeAttributes, UnsupportedOperationError, + Vec3, WWMath) { "use strict"; @@ -773,6 +775,40 @@ define([ }; + /** + * Computes a new set of locations translated from a specified location to a new location for a shape. + * + * @param {Globe} globe The globe on which to compute a new set of locations. + * @param {Location} oldLocation The original reference location. + * @param {Location} newLocation The new reference location. + * @param {Location[]} locations The locations to translate. + * + * @return {Location[]} The translated locations. + */ + SurfaceShape.prototype.computeShiftedLocations = function(globe, oldLocation, newLocation, locations) { + var newLocations = []; + var result = new Vec3(0, 0, 0); + + var oldPoint = globe.computePointFromLocation(oldLocation.latitude, oldLocation.longitude, + new Vec3(0, 0, 0)); + var newPoint = globe.computePointFromLocation(newLocation.latitude, newLocation.longitude, + new Vec3(0, 0, 0)); + var delta = newPoint.subtract(oldPoint); + + for(var i = 0, len = locations.length; i < len; i++) + { + var point = globe.computePointFromLocation(locations[i].latitude, locations[i].longitude, + result); + point = point.add(delta); + var newPos = new WorldWind.Position(0, 0, 0); + globe.computePositionFromPoint(point[0], point[1], point[2], newPos); + + newLocations.push(new Location(newPos.latitude, newPos.longitude)); + } + + return newLocations; + }; + // Internal use only. Intentionally not documented. SurfaceShape.prototype.prepareSectors = function () { this.determineSectors(); From 747f4317bab2d20d857d20c019044c11ec39518e Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 18 Apr 2018 08:56:44 +0300 Subject: [PATCH 013/112] update example to use WorldWindShim --- examples/ShapeEditing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ShapeEditing.js b/examples/ShapeEditing.js index 7335bcb2d..217021dc8 100644 --- a/examples/ShapeEditing.js +++ b/examples/ShapeEditing.js @@ -18,7 +18,7 @@ * */ -requirejs(['../src/WorldWind', +requirejs(['./WorldWindShim', './LayerManager'], function (ww, LayerManager) { From be6c197fb9d27066345386cc9458883c5d85a0a4 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 23 Apr 2018 11:08:51 +0300 Subject: [PATCH 014/112] refactoring moveTo method for SurfaceCircle and SurfaceEllipse shapes --- src/shapes/SurfaceCircle.js | 4 ++-- src/shapes/SurfaceEllipse.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shapes/SurfaceCircle.js b/src/shapes/SurfaceCircle.js index 0c0942330..f9b66fd0c 100644 --- a/src/shapes/SurfaceCircle.js +++ b/src/shapes/SurfaceCircle.js @@ -168,8 +168,8 @@ define(['../error/ArgumentError', }; // Internal use only. Intentionally not documented. - SurfaceCircle.prototype.moveTo = function (globe, position) { - this.center = this.computeShiftedLocations(globe, this.getReferencePosition(), position, [this.center])[0]; + SurfaceCircle.prototype.moveTo = function (position) { + this.center = position; }; /** diff --git a/src/shapes/SurfaceEllipse.js b/src/shapes/SurfaceEllipse.js index f145117ff..79600c821 100644 --- a/src/shapes/SurfaceEllipse.js +++ b/src/shapes/SurfaceEllipse.js @@ -218,8 +218,8 @@ define([ }; // Internal use only. Intentionally not documented. - SurfaceEllipse.prototype.moveTo = function (globe, position) { - this.center = this.computeShiftedLocations(globe, this.getReferencePosition(), position, [this.center])[0]; + SurfaceEllipse.prototype.moveTo = function (position) { + this.center = position; }; /** From 9e39e67b4f3b97bc7476c2d453745c5f28cb4d93 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 23 Apr 2018 11:23:02 +0300 Subject: [PATCH 015/112] refactoring for moveTo method call --- src/util/ShapeEditor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index 492feab08..50652f558 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -677,7 +677,11 @@ define([ var p = new Position(0, 0, 0); this.worldWindow.globe.computePositionFromPoint(intersection[0], intersection[1], intersection[2], p); - this.shape.moveTo(this.worldWindow.globe, new WorldWind.Location(p.latitude, p.longitude)); + if (this.shape instanceof SurfaceCircle || this.shape instanceof SurfaceEllipse) { + this.shape.moveTo(new WorldWind.Location(p.latitude, p.longitude)); + } else { + this.shape.moveTo(this.worldWindow.globe, new WorldWind.Location(p.latitude, p.longitude)); + } } }; From bf7111af747307783d90e7cbad01baec475d7e20 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 23 Apr 2018 12:25:49 +0300 Subject: [PATCH 016/112] fix moveTo method call --- src/util/ShapeEditor.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index 50652f558..492feab08 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -677,11 +677,7 @@ define([ var p = new Position(0, 0, 0); this.worldWindow.globe.computePositionFromPoint(intersection[0], intersection[1], intersection[2], p); - if (this.shape instanceof SurfaceCircle || this.shape instanceof SurfaceEllipse) { - this.shape.moveTo(new WorldWind.Location(p.latitude, p.longitude)); - } else { - this.shape.moveTo(this.worldWindow.globe, new WorldWind.Location(p.latitude, p.longitude)); - } + this.shape.moveTo(this.worldWindow.globe, new WorldWind.Location(p.latitude, p.longitude)); } }; From 6689a7730ec30f20cd25467d9769628af44fcd83 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 23 Apr 2018 13:12:30 +0300 Subject: [PATCH 017/112] update and format copyright --- examples/ShapeEditing.js | 29 +++++++++++++++-------------- src/util/ShapeEditor.js | 29 +++++++++++++++-------------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/examples/ShapeEditing.js b/examples/ShapeEditing.js index 217021dc8..d93996684 100644 --- a/examples/ShapeEditing.js +++ b/examples/ShapeEditing.js @@ -1,18 +1,19 @@ /* -* Copyright 2015-2017 WorldWind Contributors -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright 2015-2018 WorldWind Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * Illustrates how to use ShapeEditor. * diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index 492feab08..60dad9ff2 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -1,18 +1,19 @@ /* -* Copyright 2015-2017 WorldWind Contributors -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright 2015-2018 WorldWind Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @exports ShapeEditor */ From 9eb017c76c10ad16acc94326e12f4bbb40170363 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 23 Apr 2018 13:17:22 +0300 Subject: [PATCH 018/112] rename example files for shape editor --- examples/{ShapeEditing.html => ShapeEditor.html} | 2 +- examples/{ShapeEditing.js => ShapeEditor.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename examples/{ShapeEditing.html => ShapeEditor.html} (94%) rename examples/{ShapeEditing.js => ShapeEditor.js} (100%) diff --git a/examples/ShapeEditing.html b/examples/ShapeEditor.html similarity index 94% rename from examples/ShapeEditing.html rename to examples/ShapeEditor.html index 54ec1f768..4edf834f1 100644 --- a/examples/ShapeEditing.html +++ b/examples/ShapeEditor.html @@ -7,7 +7,7 @@ - +

diff --git a/examples/ShapeEditing.js b/examples/ShapeEditor.js similarity index 100% rename from examples/ShapeEditing.js rename to examples/ShapeEditor.js From 26d528137da46d6b57cc79f69fc99b5933c5dfe1 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 14 May 2018 00:09:05 +0300 Subject: [PATCH 019/112] refactoring for shape editor - use recognizers --- src/util/ShapeEditor.js | 224 +++++++++++++++------------------------- 1 file changed, 86 insertions(+), 138 deletions(-) diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index 60dad9ff2..220a5dce6 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -22,7 +22,9 @@ define([ '../shapes/Annotation', '../shapes/AnnotationAttributes', '../error/ArgumentError', + '../gesture/ClickRecognizer', '../util/Color', + '../gesture/DragRecognizer', '../util/Font', '../util/Insets', '../geom/Location', @@ -46,7 +48,9 @@ define([ Annotation, AnnotationAttributes, ArgumentError, + ClickRecognizer, Color, + DragRecognizer, Font, Insets, Location, @@ -216,51 +220,12 @@ define([ this.lastY = null; //Internal use only. Intentionally not documented. - this.currentEvent = null; - - var shapeEditor = this; - - var handleMouseMove = function (event) { - if(this.shape === null) - return; - - if (shapeEditor.isDragging === false) { - return; - } - - var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); - var terrainObject; - - if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); - } - - if (!terrainObject) { + var handleClick = function (recognizer) { + if(this.shape === null || recognizer.state !== WorldWind.RECOGNIZED) return; - } - if (shapeEditor.currentSizingMarker instanceof Placemark && - shapeEditor.currentSizingMarker.userProperties.isControlPoint) { - shapeEditor.reshapeShape(terrainObject); - shapeEditor.updateControlPoints(); - } - else if (shapeEditor.shape instanceof SurfaceShape) { - shapeEditor.dragWholeShape(event); - shapeEditor.updateControlPoints(); - shapeEditor.updateShapeAnnotation(); - } - - event.preventDefault(); - }; - - var handleMouseDown = function (event) { - if(this.shape === null) - return; - - shapeEditor.currentEvent = event; - - var x = event.clientX, - y = event.clientY; + var x = recognizer._clientX, + y = recognizer._clientY; shapeEditor.startX = x; shapeEditor.startY = y; @@ -273,18 +238,16 @@ define([ for (var p = 0; p < pickList.objects.length; p++) { if (!pickList.objects[p].isTerrain) { if (shapeEditor.shape && pickList.objects[p].userObject === shapeEditor.shape) { - event.preventDefault(); shapeEditor.isDragging = true; shapeEditor.originalAttributes = shapeEditor.shape.attributes; shapeEditor.originalHighlightAttributes = shapeEditor.shape.highlightAttributes; shapeEditor.makeShadowShape(); //set previous position - shapeEditor.setPreviousPosition(event); + shapeEditor.setPreviousPosition(recognizer); } else if (pickList.objects[p].userObject instanceof Placemark && pickList.objects[p].userObject.userProperties.isControlPoint) { - event.preventDefault(); shapeEditor.currentSizingMarker = pickList.objects[p].userObject; shapeEditor.isDragging = true; shapeEditor.originalAttributes = shapeEditor.shape.attributes; @@ -292,95 +255,88 @@ define([ shapeEditor.makeShadowShape(); //set previous position - shapeEditor.setPreviousPosition(event); + shapeEditor.setPreviousPosition(recognizer); } } } } }; - var handleMouseUp = function (event) { - if(this.shape === null) + //Internal use only. Intentionally not documented. + var handleDrag = function (recognizer) { + if (shapeEditor.isDragging === false) { return; + } - var x = event.clientX, - y = event.clientY; + if (recognizer.state !== WorldWind.ENDED) { + var mousePoint = shapeEditor.worldWindow.canvasCoordinates(recognizer._clientX, recognizer._clientY); + var terrainObject; - if (shapeEditor.shape && shapeEditor.shadowLayer.renderables.length > 0) { - shapeEditor.removeShadowShape(); - shapeEditor.updateAnnotation(null); + if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); + } + + if (!terrainObject) { + return; + } + + if (shapeEditor.currentSizingMarker instanceof Placemark && + shapeEditor.currentSizingMarker.userProperties.isControlPoint) { + shapeEditor.reshapeShape(terrainObject); + shapeEditor.updateControlPoints(); + } + else if (shapeEditor.shape instanceof SurfaceShape) { + shapeEditor.dragWholeShape(recognizer); + shapeEditor.updateControlPoints(); + shapeEditor.updateShapeAnnotation(); + } } + else { + // move the shape to the new position and clean shadow + var x = recognizer._clientX, + y = recognizer._clientY; + + if (shapeEditor.shape && shapeEditor.shadowLayer.renderables.length > 0) { + shapeEditor.removeShadowShape(); + shapeEditor.updateAnnotation(null); + } - if (shapeEditor.currentSizingMarker instanceof Placemark && + if (shapeEditor.currentSizingMarker instanceof Placemark && shapeEditor.currentSizingMarker.userProperties.isControlPoint) { - if (event.altKey) { - var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); - var terrainObject; + shapeEditor.isDragging = false; + shapeEditor.currentSizingMarker = null; + return; + } - if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); - } + var redrawRequired = false; - if (terrainObject) { - shapeEditor.reshapeShape(terrainObject); - shapeEditor.updateControlPoints(); - shapeEditor.updateAnnotation(null); + var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); + if (pickList.objects.length > 0) { + for (var p = 0; p < pickList.objects.length; p++) { + if (!pickList.objects[p].isTerrain) { + redrawRequired = true; + break; + } } } + shapeEditor.isDragging = false; shapeEditor.currentSizingMarker = null; - return; - } - - var redrawRequired = false; - var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); - if (pickList.objects.length > 0) { - for (var p = 0; p < pickList.objects.length; p++) { - if (!pickList.objects[p].isTerrain) { - if (shapeEditor.startX === shapeEditor.lastX && - shapeEditor.startY === shapeEditor.lastY) { - if (event.shiftKey) { - var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, - event.clientY); - var terrainObject; - - if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint) - .terrainObject(); - } - - if (terrainObject) { - shapeEditor.addNearestLocation(terrainObject.position, 0, - shapeEditor.shape.boundaries); - } - } - } - - redrawRequired = true; - break; - } + // Update the window if we changed anything. + if (redrawRequired) { + shapeEditor.worldWindow.redraw(); } } + }; - shapeEditor.isDragging = false; - shapeEditor.currentSizingMarker = null; + // Intentionally not documented. + this.clickRecognizer = new ClickRecognizer(this.worldWindow, handleClick); - // Update the window if we changed anything. - if (redrawRequired) { - shapeEditor.worldWindow.redraw(); - } - }; + // Intentionally not documented. + this.dragRecognizer = new DragRecognizer(this.worldWindow, handleDrag); - if (window.PointerEvent) { - this.worldWindow.addEventListener("pointerup", handleMouseUp); - this.worldWindow.addEventListener("pointerdown", handleMouseDown); - this.worldWindow.addEventListener("pointermove", handleMouseMove, false); - } else { - this.worldWindow.addEventListener("mouseup", handleMouseUp); - this.worldWindow.addEventListener("mousedown", handleMouseDown); - this.worldWindow.addEventListener("mousemove", handleMouseMove, false); - } + var shapeEditor = this; }; /** @@ -644,10 +600,14 @@ define([ }; /** - * Moves the entire shape according to a specified event. - * @param {Event} event + * Moves the entire shape according to a specified recognizer. + * @param {DragRecognizer} recognizer */ - ShapeEditor.prototype.dragWholeShape = function (event) { + ShapeEditor.prototype.dragWholeShape = function (recognizer) { + if (recognizer !== this.dragRecognizer) { + return; + } + var refPos = this.shape.getReferencePosition(); if (refPos === null) { return; @@ -661,11 +621,11 @@ define([ this.worldWindow.drawContext.project(refPoint, screenRefPoint); // Compute screen-coord delta since last event. - var dx = event.clientX - this.lastX; - var dy = event.clientY - this.lastY; + var dx = recognizer._clientX - this.lastX; + var dy = recognizer._clientY - this.lastY; - this.lastX = event.clientX; - this.lastY = event.clientY; + this.lastX = recognizer._clientX; + this.lastY = recognizer._clientY; // Find intersection of screen coord ref-point with globe. var x = screenRefPoint[0] + dx; @@ -1063,9 +1023,9 @@ define([ } }; - ShapeEditor.prototype.setPreviousPosition = function (event) { - var mousePoint = this.worldWindow.canvasCoordinates(event.clientX, - event.clientY); + ShapeEditor.prototype.setPreviousPosition = function (recognizer) { + var mousePoint = this.worldWindow.canvasCoordinates(recognizer._clientX, + recognizer._clientY); if (this.worldWindow.viewport.containsPoint(mousePoint)) { var terrainObject = this.worldWindow.pickTerrain(mousePoint).terrainObject(); if (terrainObject) { @@ -1110,25 +1070,13 @@ define([ } else if (boundaries.length >= 2) { //poly without whole - for (var i = 0; i < boundaries.length; i++) { + for (var i = 0, len = boundaries.length; i < len; i++) { if (controlPoint.userProperties.purpose == ShapeEditor.LOCATION) { if (controlPoint.userProperties.id == k) { - if (this.currentEvent.altKey) { - //remove location - var minSize = this.shape instanceof SurfacePolygon ? 3 : 2; - if (boundaries.length > minSize) { - // Delete the control point. - boundaries.splice(i, 1); - this.shape.boundaries = boundaries; - this.removeControlPoints(); - } - } - else { - newPos = this.moveLocation(controlPoint, terrainPosition); - boundaries[i] = newPos; - this.shape.boundaries = boundaries; - controlPoint.position = newPos; - } + newPos = this.moveLocation(controlPoint, terrainPosition); + boundaries[i] = newPos; + this.shape.boundaries = boundaries; + controlPoint.position = newPos; break; } } else if (controlPoint.userProperties.purpose == ShapeEditor.ROTATION) { From 32e31ef3542778518b40a6ec8f6f7888e6239d57 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 14 May 2018 00:31:12 +0300 Subject: [PATCH 020/112] bugfix --- src/util/ShapeEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index 220a5dce6..40ef5c934 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -221,7 +221,7 @@ define([ //Internal use only. Intentionally not documented. var handleClick = function (recognizer) { - if(this.shape === null || recognizer.state !== WorldWind.RECOGNIZED) + if(this.shape === null || recognizer.state !== WorldWind.RECOGNIZED || shapeEditor.isDragging === true) return; var x = recognizer._clientX, From 36bce89c50bf24f203a4a4a823222ba19dc215f6 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 14 Jun 2018 23:59:25 +0300 Subject: [PATCH 021/112] handle events and remove recognizers --- src/util/ShapeEditor.js | 255 ++++++++++++++++++++++++---------------- 1 file changed, 153 insertions(+), 102 deletions(-) diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index 40ef5c934..8f8379c38 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -1,19 +1,18 @@ /* - * Copyright 2015-2018 WorldWind Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - +* Copyright 2015-2017 WorldWind Contributors +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ /** * @exports ShapeEditor */ @@ -22,9 +21,7 @@ define([ '../shapes/Annotation', '../shapes/AnnotationAttributes', '../error/ArgumentError', - '../gesture/ClickRecognizer', '../util/Color', - '../gesture/DragRecognizer', '../util/Font', '../util/Insets', '../geom/Location', @@ -48,9 +45,7 @@ define([ Annotation, AnnotationAttributes, ArgumentError, - ClickRecognizer, Color, - DragRecognizer, Font, Insets, Location, @@ -220,12 +215,51 @@ define([ this.lastY = null; //Internal use only. Intentionally not documented. - var handleClick = function (recognizer) { - if(this.shape === null || recognizer.state !== WorldWind.RECOGNIZED || shapeEditor.isDragging === true) + this.currentEvent = null; + + var shapeEditor = this; + + var handleMouseMove = function (event) { + if(this.shape === null) + return; + + if (shapeEditor.isDragging === false) { + return; + } + + var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); + var terrainObject; + + if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); + } + + if (!terrainObject) { + return; + } + + if (shapeEditor.currentSizingMarker instanceof Placemark && + shapeEditor.currentSizingMarker.userProperties.isControlPoint) { + shapeEditor.reshapeShape(terrainObject); + shapeEditor.updateControlPoints(); + } + else if (shapeEditor.shape instanceof SurfaceShape) { + shapeEditor.dragWholeShape(event); + shapeEditor.updateControlPoints(); + shapeEditor.updateShapeAnnotation(); + } + + event.preventDefault(); + }; + + var handleMouseDown = function (event) { + if(this.shape === null) return; - var x = recognizer._clientX, - y = recognizer._clientY; + shapeEditor.currentEvent = event; + + var x = event.clientX, + y = event.clientY; shapeEditor.startX = x; shapeEditor.startY = y; @@ -238,16 +272,18 @@ define([ for (var p = 0; p < pickList.objects.length; p++) { if (!pickList.objects[p].isTerrain) { if (shapeEditor.shape && pickList.objects[p].userObject === shapeEditor.shape) { + event.preventDefault(); shapeEditor.isDragging = true; shapeEditor.originalAttributes = shapeEditor.shape.attributes; shapeEditor.originalHighlightAttributes = shapeEditor.shape.highlightAttributes; shapeEditor.makeShadowShape(); //set previous position - shapeEditor.setPreviousPosition(recognizer); + shapeEditor.setPreviousPosition(event); } else if (pickList.objects[p].userObject instanceof Placemark && pickList.objects[p].userObject.userProperties.isControlPoint) { + event.preventDefault(); shapeEditor.currentSizingMarker = pickList.objects[p].userObject; shapeEditor.isDragging = true; shapeEditor.originalAttributes = shapeEditor.shape.attributes; @@ -255,88 +291,95 @@ define([ shapeEditor.makeShadowShape(); //set previous position - shapeEditor.setPreviousPosition(recognizer); + shapeEditor.setPreviousPosition(event); } } } } }; - //Internal use only. Intentionally not documented. - var handleDrag = function (recognizer) { - if (shapeEditor.isDragging === false) { + var handleMouseUp = function (event) { + if(this.shape === null) return; - } - - if (recognizer.state !== WorldWind.ENDED) { - var mousePoint = shapeEditor.worldWindow.canvasCoordinates(recognizer._clientX, recognizer._clientY); - var terrainObject; - - if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); - } - if (!terrainObject) { - return; - } + var x = event.clientX, + y = event.clientY; - if (shapeEditor.currentSizingMarker instanceof Placemark && - shapeEditor.currentSizingMarker.userProperties.isControlPoint) { - shapeEditor.reshapeShape(terrainObject); - shapeEditor.updateControlPoints(); - } - else if (shapeEditor.shape instanceof SurfaceShape) { - shapeEditor.dragWholeShape(recognizer); - shapeEditor.updateControlPoints(); - shapeEditor.updateShapeAnnotation(); - } + if (shapeEditor.shape && shapeEditor.shadowLayer.renderables.length > 0) { + shapeEditor.removeShadowShape(); + shapeEditor.updateAnnotation(null); } - else { - // move the shape to the new position and clean shadow - var x = recognizer._clientX, - y = recognizer._clientY; - - if (shapeEditor.shape && shapeEditor.shadowLayer.renderables.length > 0) { - shapeEditor.removeShadowShape(); - shapeEditor.updateAnnotation(null); - } - if (shapeEditor.currentSizingMarker instanceof Placemark && - shapeEditor.currentSizingMarker.userProperties.isControlPoint) { - shapeEditor.isDragging = false; - shapeEditor.currentSizingMarker = null; - return; - } + if (shapeEditor.currentSizingMarker instanceof Placemark && + shapeEditor.currentSizingMarker.userProperties.isControlPoint) { + if (event.altKey) { + var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); + var terrainObject; - var redrawRequired = false; + if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); + } - var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); - if (pickList.objects.length > 0) { - for (var p = 0; p < pickList.objects.length; p++) { - if (!pickList.objects[p].isTerrain) { - redrawRequired = true; - break; - } + if (terrainObject) { + shapeEditor.reshapeShape(terrainObject); + shapeEditor.updateControlPoints(); + shapeEditor.updateAnnotation(null); } } - shapeEditor.isDragging = false; shapeEditor.currentSizingMarker = null; + return; + } + + var redrawRequired = false; - // Update the window if we changed anything. - if (redrawRequired) { - shapeEditor.worldWindow.redraw(); + var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); + if (pickList.objects.length > 0) { + for (var p = 0; p < pickList.objects.length; p++) { + if (!pickList.objects[p].isTerrain) { + if (shapeEditor.startX === shapeEditor.lastX && + shapeEditor.startY === shapeEditor.lastY) { + if (event.shiftKey) { + var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, + event.clientY); + var terrainObject; + + if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint) + .terrainObject(); + } + + if (terrainObject) { + shapeEditor.addNearestLocation(terrainObject.position, 0, + shapeEditor.shape.boundaries); + } + } + } + + redrawRequired = true; + break; + } } } - }; - // Intentionally not documented. - this.clickRecognizer = new ClickRecognizer(this.worldWindow, handleClick); + shapeEditor.isDragging = false; + shapeEditor.currentSizingMarker = null; - // Intentionally not documented. - this.dragRecognizer = new DragRecognizer(this.worldWindow, handleDrag); + // Update the window if we changed anything. + if (redrawRequired) { + shapeEditor.worldWindow.redraw(); + } + }; - var shapeEditor = this; + if (window.PointerEvent) { + this.worldWindow.addEventListener("pointerup", handleMouseUp); + this.worldWindow.addEventListener("pointerdown", handleMouseDown); + this.worldWindow.addEventListener("pointermove", handleMouseMove, false); + } else { + this.worldWindow.addEventListener("mouseup", handleMouseUp); + this.worldWindow.addEventListener("mousedown", handleMouseDown); + this.worldWindow.addEventListener("mousemove", handleMouseMove, false); + } }; /** @@ -600,14 +643,10 @@ define([ }; /** - * Moves the entire shape according to a specified recognizer. - * @param {DragRecognizer} recognizer + * Moves the entire shape according to a specified event. + * @param {Event} event */ - ShapeEditor.prototype.dragWholeShape = function (recognizer) { - if (recognizer !== this.dragRecognizer) { - return; - } - + ShapeEditor.prototype.dragWholeShape = function (event) { var refPos = this.shape.getReferencePosition(); if (refPos === null) { return; @@ -621,11 +660,11 @@ define([ this.worldWindow.drawContext.project(refPoint, screenRefPoint); // Compute screen-coord delta since last event. - var dx = recognizer._clientX - this.lastX; - var dy = recognizer._clientY - this.lastY; + var dx = event.clientX - this.lastX; + var dy = event.clientY - this.lastY; - this.lastX = recognizer._clientX; - this.lastY = recognizer._clientY; + this.lastX = event.clientX; + this.lastY = event.clientY; // Find intersection of screen coord ref-point with globe. var x = screenRefPoint[0] + dx; @@ -1023,9 +1062,9 @@ define([ } }; - ShapeEditor.prototype.setPreviousPosition = function (recognizer) { - var mousePoint = this.worldWindow.canvasCoordinates(recognizer._clientX, - recognizer._clientY); + ShapeEditor.prototype.setPreviousPosition = function (event) { + var mousePoint = this.worldWindow.canvasCoordinates(event.clientX, + event.clientY); if (this.worldWindow.viewport.containsPoint(mousePoint)) { var terrainObject = this.worldWindow.pickTerrain(mousePoint).terrainObject(); if (terrainObject) { @@ -1070,13 +1109,25 @@ define([ } else if (boundaries.length >= 2) { //poly without whole - for (var i = 0, len = boundaries.length; i < len; i++) { + for (var i = 0; i < boundaries.length; i++) { if (controlPoint.userProperties.purpose == ShapeEditor.LOCATION) { if (controlPoint.userProperties.id == k) { - newPos = this.moveLocation(controlPoint, terrainPosition); - boundaries[i] = newPos; - this.shape.boundaries = boundaries; - controlPoint.position = newPos; + if (this.currentEvent.altKey) { + //remove location + var minSize = this.shape instanceof SurfacePolygon ? 3 : 2; + if (boundaries.length > minSize) { + // Delete the control point. + boundaries.splice(i, 1); + this.shape.boundaries = boundaries; + this.removeControlPoints(); + } + } + else { + newPos = this.moveLocation(controlPoint, terrainPosition); + boundaries[i] = newPos; + this.shape.boundaries = boundaries; + controlPoint.position = newPos; + } break; } } else if (controlPoint.userProperties.purpose == ShapeEditor.ROTATION) { From 7e38a470c3f9b09e8643ed449f7bfb6af8d6e664 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Sun, 17 Jun 2018 14:12:17 +0300 Subject: [PATCH 022/112] refactoring on event handling --- src/util/ShapeEditor.js | 276 ++++++++++++++++++++++------------------ 1 file changed, 149 insertions(+), 127 deletions(-) diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index 8f8379c38..d0ef85057 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -217,168 +217,190 @@ define([ //Internal use only. Intentionally not documented. this.currentEvent = null; + this.worldWindow.worldWindowController.addGestureListener(this); + }; + + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.handleMouseMove = function (event) { var shapeEditor = this; - var handleMouseMove = function (event) { - if(this.shape === null) - return; + if(this.shape === null) + return; - if (shapeEditor.isDragging === false) { - return; - } + if (shapeEditor.isDragging === false) { + return; + } - var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); - var terrainObject; + var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); + var terrainObject; - if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); - } + if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); + } - if (!terrainObject) { - return; - } + if (!terrainObject) { + return; + } - if (shapeEditor.currentSizingMarker instanceof Placemark && - shapeEditor.currentSizingMarker.userProperties.isControlPoint) { - shapeEditor.reshapeShape(terrainObject); - shapeEditor.updateControlPoints(); - } - else if (shapeEditor.shape instanceof SurfaceShape) { - shapeEditor.dragWholeShape(event); - shapeEditor.updateControlPoints(); - shapeEditor.updateShapeAnnotation(); - } + if (shapeEditor.currentSizingMarker instanceof Placemark && + shapeEditor.currentSizingMarker.userProperties.isControlPoint) { + shapeEditor.reshapeShape(terrainObject); + shapeEditor.updateControlPoints(); + } + else if (shapeEditor.shape instanceof SurfaceShape) { + shapeEditor.dragWholeShape(event); + shapeEditor.updateControlPoints(); + shapeEditor.updateShapeAnnotation(); + } - event.preventDefault(); - }; + event.preventDefault(); + }; - var handleMouseDown = function (event) { - if(this.shape === null) - return; + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.handleMouseDown = function (event) { + var shapeEditor = this; - shapeEditor.currentEvent = event; + if(this.shape === null) + return; - var x = event.clientX, - y = event.clientY; + shapeEditor.currentEvent = event; - shapeEditor.startX = x; - shapeEditor.startY = y; - shapeEditor.lastX = x; - shapeEditor.lastY = y; + var x = event.clientX, + y = event.clientY; - var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); + shapeEditor.startX = x; + shapeEditor.startY = y; + shapeEditor.lastX = x; + shapeEditor.lastY = y; - if (pickList.objects.length > 0) { - for (var p = 0; p < pickList.objects.length; p++) { - if (!pickList.objects[p].isTerrain) { - if (shapeEditor.shape && pickList.objects[p].userObject === shapeEditor.shape) { - event.preventDefault(); - shapeEditor.isDragging = true; - shapeEditor.originalAttributes = shapeEditor.shape.attributes; - shapeEditor.originalHighlightAttributes = shapeEditor.shape.highlightAttributes; - shapeEditor.makeShadowShape(); + var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); - //set previous position - shapeEditor.setPreviousPosition(event); - } - else if (pickList.objects[p].userObject instanceof Placemark && - pickList.objects[p].userObject.userProperties.isControlPoint) { - event.preventDefault(); - shapeEditor.currentSizingMarker = pickList.objects[p].userObject; - shapeEditor.isDragging = true; - shapeEditor.originalAttributes = shapeEditor.shape.attributes; - shapeEditor.originalHighlightAttributes = shapeEditor.shape.highlightAttributes; - shapeEditor.makeShadowShape(); - - //set previous position - shapeEditor.setPreviousPosition(event); - } + if (pickList.objects.length > 0) { + for (var p = 0; p < pickList.objects.length; p++) { + if (!pickList.objects[p].isTerrain) { + if (shapeEditor.shape && pickList.objects[p].userObject === shapeEditor.shape) { + event.preventDefault(); + shapeEditor.isDragging = true; + shapeEditor.originalAttributes = shapeEditor.shape.attributes; + shapeEditor.originalHighlightAttributes = shapeEditor.shape.highlightAttributes; + shapeEditor.makeShadowShape(); + + //set previous position + shapeEditor.setPreviousPosition(event); + } + else if (pickList.objects[p].userObject instanceof Placemark && + pickList.objects[p].userObject.userProperties.isControlPoint) { + event.preventDefault(); + shapeEditor.currentSizingMarker = pickList.objects[p].userObject; + shapeEditor.isDragging = true; + shapeEditor.originalAttributes = shapeEditor.shape.attributes; + shapeEditor.originalHighlightAttributes = shapeEditor.shape.highlightAttributes; + shapeEditor.makeShadowShape(); + + //set previous position + shapeEditor.setPreviousPosition(event); } } } - }; + } + }; - var handleMouseUp = function (event) { - if(this.shape === null) - return; + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.handleMouseUp = function (event) { + var shapeEditor = this; - var x = event.clientX, - y = event.clientY; + if(this.shape === null) + return; - if (shapeEditor.shape && shapeEditor.shadowLayer.renderables.length > 0) { - shapeEditor.removeShadowShape(); - shapeEditor.updateAnnotation(null); - } + var x = event.clientX, + y = event.clientY; - if (shapeEditor.currentSizingMarker instanceof Placemark && - shapeEditor.currentSizingMarker.userProperties.isControlPoint) { - if (event.altKey) { - var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); - var terrainObject; + if (shapeEditor.shape && shapeEditor.shadowLayer.renderables.length > 0) { + shapeEditor.removeShadowShape(); + shapeEditor.updateAnnotation(null); + } - if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); - } + if (shapeEditor.currentSizingMarker instanceof Placemark && + shapeEditor.currentSizingMarker.userProperties.isControlPoint) { + if (event.altKey) { + var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); + var terrainObject; - if (terrainObject) { - shapeEditor.reshapeShape(terrainObject); - shapeEditor.updateControlPoints(); - shapeEditor.updateAnnotation(null); - } + if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); + } + + if (terrainObject) { + shapeEditor.reshapeShape(terrainObject); + shapeEditor.updateControlPoints(); + shapeEditor.updateAnnotation(null); } - shapeEditor.isDragging = false; - shapeEditor.currentSizingMarker = null; - return; } + shapeEditor.isDragging = false; + shapeEditor.currentSizingMarker = null; + return; + } - var redrawRequired = false; - - var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); - if (pickList.objects.length > 0) { - for (var p = 0; p < pickList.objects.length; p++) { - if (!pickList.objects[p].isTerrain) { - if (shapeEditor.startX === shapeEditor.lastX && - shapeEditor.startY === shapeEditor.lastY) { - if (event.shiftKey) { - var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, - event.clientY); - var terrainObject; - - if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint) - .terrainObject(); - } - - if (terrainObject) { - shapeEditor.addNearestLocation(terrainObject.position, 0, - shapeEditor.shape.boundaries); - } + var redrawRequired = false; + + var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); + if (pickList.objects.length > 0) { + for (var p = 0; p < pickList.objects.length; p++) { + if (!pickList.objects[p].isTerrain) { + if (shapeEditor.startX === shapeEditor.lastX && + shapeEditor.startY === shapeEditor.lastY) { + if (event.shiftKey) { + var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, + event.clientY); + var terrainObject; + + if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint) + .terrainObject(); } - } - redrawRequired = true; - break; + if (terrainObject) { + shapeEditor.addNearestLocation(terrainObject.position, 0, + shapeEditor.shape.boundaries); + } + } } + + redrawRequired = true; + break; } } + } - shapeEditor.isDragging = false; - shapeEditor.currentSizingMarker = null; + shapeEditor.isDragging = false; + shapeEditor.currentSizingMarker = null; - // Update the window if we changed anything. - if (redrawRequired) { - shapeEditor.worldWindow.redraw(); - } - }; + // Update the window if we changed anything. + if (redrawRequired) { + shapeEditor.worldWindow.redraw(); + } + }; - if (window.PointerEvent) { - this.worldWindow.addEventListener("pointerup", handleMouseUp); - this.worldWindow.addEventListener("pointerdown", handleMouseDown); - this.worldWindow.addEventListener("pointermove", handleMouseMove, false); - } else { - this.worldWindow.addEventListener("mouseup", handleMouseUp); - this.worldWindow.addEventListener("mousedown", handleMouseDown); - this.worldWindow.addEventListener("mousemove", handleMouseMove, false); + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.onGestureEvent = function (event) { + if (!this.armed) { + return; + } + + try { + if (event.type === "pointerup" || event.type === "mouseup") { + this.handleMouseUp(event); + } else if (event.type === "pointerdown" || event.type === "mousedown") { + this.handleMouseDown(event); + } else if (event.type === "pointermove" || event.type === "mousemove") { + this.handleMouseMove(event); + } else { + Logger.logMessage(Logger.LEVEL_INFO, "ShapeEditor", "handleEvent", + "Unrecognized event type: " + event.type); + } + } catch (event) { + Logger.logMessage(Logger.LEVEL_SEVERE, "ShapeEditor", "handleEvent", + "Error handling event.\n" + event.toString()); } }; From ae05fb23686a6a183b9a8e59a3b09aef3f605b1d Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 21 Jun 2018 13:12:05 +0300 Subject: [PATCH 023/112] refactoring of public api --- examples/ShapeEditor.js | 18 +++++++----------- src/util/ShapeEditor.js | 37 +++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index d93996684..adaba13e7 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -83,13 +83,11 @@ requirejs(['./WorldWindShim', // Create a layer manager for controlling layer visibility. var layerManger = new LayerManager(wwd); - var shapeEditor = new WorldWind.ShapeEditor(wwd, null); + var shapeEditor = new WorldWind.ShapeEditor(wwd); document.getElementById("editPolyBtn").addEventListener("click", function(){ if(document.getElementById("editPolyBtn").innerHTML === "Start edit polygon"){ - shapeEditor.shape = polyShape; - shapeEditor.shape.highlighted = true; - shapeEditor.setArmed(true); + shapeEditor.edit(polyShape); document.getElementById("editPolyBtn").innerHTML = "Stop edit polygon"; document.getElementById("editCircleBtn").disabled = true; @@ -97,7 +95,7 @@ requirejs(['./WorldWindShim', } else{ shapeEditor.shape.highlighted = false; - shapeEditor.setArmed(false); + shapeEditor.stop(); document.getElementById("editPolyBtn").innerHTML = "Start edit polygon"; document.getElementById("editCircleBtn").disabled = false; @@ -107,9 +105,8 @@ requirejs(['./WorldWindShim', document.getElementById("editCircleBtn").addEventListener("click", function(){ if(document.getElementById("editCircleBtn").innerHTML === "Start edit circle"){ - shapeEditor.shape = circleShape; + shapeEditor.edit(circleShape); shapeEditor.shape.highlighted = true; - shapeEditor.setArmed(true); document.getElementById("editCircleBtn").innerHTML = "Stop edit circle"; document.getElementById("editPolyBtn").disabled = true; @@ -117,7 +114,7 @@ requirejs(['./WorldWindShim', } else{ shapeEditor.shape.highlighted = false; - shapeEditor.setArmed(false); + shapeEditor.stop(); document.getElementById("editCircleBtn").innerHTML = "Start edit circle"; document.getElementById("editPolyBtn").disabled = false; @@ -127,9 +124,8 @@ requirejs(['./WorldWindShim', document.getElementById("editEllipseBtn").addEventListener("click", function(){ if(document.getElementById("editEllipseBtn").innerHTML === "Start edit ellipse"){ - shapeEditor .shape = ellipseShape; + shapeEditor.edit(ellipseShape); shapeEditor.shape.highlighted = true; - shapeEditor.setArmed(true); document.getElementById("editEllipseBtn").innerHTML = "Stop edit ellipse"; document.getElementById("editCircleBtn").disabled = true; @@ -137,7 +133,7 @@ requirejs(['./WorldWindShim', } else{ shapeEditor.shape.highlighted = false; - shapeEditor.setArmed(false); + shapeEditor.stop(); document.getElementById("editEllipseBtn").innerHTML = "Start edit ellipse"; document.getElementById("editCircleBtn").disabled = false; diff --git a/src/util/ShapeEditor.js b/src/util/ShapeEditor.js index d0ef85057..9d4113373 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/ShapeEditor.js @@ -82,7 +82,7 @@ define([ * @param {WorldWindow} worldWindow The World Window to associate this shape editor controller with. * @throws {ArgumentError} If the specified world window is null or undefined. */ - var ShapeEditor = function (worldWindow, shape) { + var ShapeEditor = function (worldWindow) { if (!worldWindow) { throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "ShapeEditor", "constructor", "missingWorldWindow")); @@ -98,7 +98,7 @@ define([ * The shape associated with the editor. * @type {Object} */ - this.shape = shape; + this.shape = null; /** * The layer holding the editor's control points. @@ -546,18 +546,35 @@ define([ this.angleControlPointAttributes.imageScale = 6; }; - ShapeEditor.prototype.setArmed = function (armed) { - if (!this.armed && armed) { + /** + * Enables the ShapeEditor for the specified shape. + * @param {SurfaceShape} shape The shape that will be edited. + * @throws {ArgumentError} If the specified shape is null or not an instance of SurfaceShape. + */ + ShapeEditor.prototype.edit = function (shape) { + if (shape != null && shape instanceof SurfaceShape) { + this.shape = shape; this.enable(); + this.armed = true; + } else { + this.stop(); + throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "ShapeEditor", "edit", + "missingShape")); } - else if (this.armed && !armed) { - this.disable(); - this.shape = null; - } + }; - this.armed = armed; + /** + * Stops the editing action and cleans up the allocated resources. + */ + ShapeEditor.prototype.stop = function () { + this.disable(); + this.shape = null; + this.armed = false; }; + /** + * Called by {@link ShapeEditor#edit} to enable resources used for editing. + */ ShapeEditor.prototype.enable = function () { if (this.worldWindow.indexOfLayer(this.controlPointLayer) == -1) { this.worldWindow.addLayer(this.controlPointLayer); @@ -580,7 +597,7 @@ define([ }; /** - * Called by {@link ShapeEditorController#setArmed} to remove resources no longer needed after editing. + * Called by {@link ShapeEditor#stop} to remove resources no longer needed after editing. */ ShapeEditor.prototype.disable = function () { this.removeControlPoints(); From 9a13f3d199c8c4f3f43ab9d1c6a78cff7b975006 Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Fri, 22 Jun 2018 15:31:21 +0200 Subject: [PATCH 024/112] Move the shape editor to its own folder in util as it will get related classes --- src/WorldWind.js | 2 +- src/util/{ => editor}/ShapeEditor.js | 74 ++++++++++++++-------------- 2 files changed, 38 insertions(+), 38 deletions(-) rename src/util/{ => editor}/ShapeEditor.js (97%) diff --git a/src/WorldWind.js b/src/WorldWind.js index b60229622..33bd531cf 100644 --- a/src/WorldWind.js +++ b/src/WorldWind.js @@ -191,7 +191,7 @@ define([ // PLEASE KEEP ALL THIS IN ALPHABETICAL ORDER BY MODULE NAME (not direc './shapes/ScreenText', './geom/Sector', './shapes/ShapeAttributes', - './util/ShapeEditor', + './util/editor/ShapeEditor', './formats/shapefile/Shapefile', './layer/ShowTessellationLayer', './shaders/SkyProgram', diff --git a/src/util/ShapeEditor.js b/src/util/editor/ShapeEditor.js similarity index 97% rename from src/util/ShapeEditor.js rename to src/util/editor/ShapeEditor.js index 9d4113373..6ab670baa 100644 --- a/src/util/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -1,45 +1,45 @@ /* -* Copyright 2015-2017 WorldWind Contributors -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright 2015-2018 WorldWind Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @exports ShapeEditor */ define([ - '../geom/Angle', - '../shapes/Annotation', - '../shapes/AnnotationAttributes', - '../error/ArgumentError', - '../util/Color', - '../util/Font', - '../util/Insets', - '../geom/Location', - '../util/Logger', - '../shapes/Path', - '../shapes/Placemark', - '../shapes/PlacemarkAttributes', - '../geom/Position', - '../layer/RenderableLayer', - '../shapes/ShapeAttributes', - '../shapes/SurfaceEllipse', - '../shapes/SurfaceCircle', - '../shapes/SurfacePolygon', - '../shapes/SurfacePolyline', - '../shapes/SurfaceRectangle', - '../shapes/SurfaceShape', - '../geom/Vec2', - '../geom/Vec3' + '../../geom/Angle', + '../../shapes/Annotation', + '../../shapes/AnnotationAttributes', + '../../error/ArgumentError', + '../Color', + '../Font', + '../Insets', + '../../geom/Location', + '../Logger', + '../../shapes/Path', + '../../shapes/Placemark', + '../../shapes/PlacemarkAttributes', + '../../geom/Position', + '../../layer/RenderableLayer', + '../../shapes/ShapeAttributes', + '../../shapes/SurfaceEllipse', + '../../shapes/SurfaceCircle', + '../../shapes/SurfacePolygon', + '../../shapes/SurfacePolyline', + '../../shapes/SurfaceRectangle', + '../../shapes/SurfaceShape', + '../../geom/Vec2', + '../../geom/Vec3' ], function (Angle, Annotation, From 1764578e53e70dda7a4b0d5647fde00e7d2114bf Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Fri, 22 Jun 2018 17:24:48 +0200 Subject: [PATCH 025/112] First step in breaking the shape editor logic into multiple fragments --- src/util/editor/BaseSurfaceEditorFragment.js | 117 +++ src/util/editor/ShapeEditor.js | 807 ++---------------- src/util/editor/ShapeEditorConstants.js | 50 ++ .../editor/SurfaceCircleEditorFragment.js | 103 +++ .../editor/SurfaceEllipseEditorFragment.js | 174 ++++ .../editor/SurfacePolygonEditorFragment.js | 290 +++++++ .../editor/SurfacePolylineEditorFragment.js | 103 +++ .../editor/SurfaceRectangleEditorFragment.js | 174 ++++ 8 files changed, 1066 insertions(+), 752 deletions(-) create mode 100644 src/util/editor/BaseSurfaceEditorFragment.js create mode 100644 src/util/editor/ShapeEditorConstants.js create mode 100644 src/util/editor/SurfaceCircleEditorFragment.js create mode 100644 src/util/editor/SurfaceEllipseEditorFragment.js create mode 100644 src/util/editor/SurfacePolygonEditorFragment.js create mode 100644 src/util/editor/SurfacePolylineEditorFragment.js create mode 100644 src/util/editor/SurfaceRectangleEditorFragment.js diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js new file mode 100644 index 000000000..e39552515 --- /dev/null +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -0,0 +1,117 @@ +/* + * Copyright 2015-2018 WorldWind Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @exports BaseSurfaceEditorFragment + */ +define([ + '../../geom/Angle', + '../../geom/Vec3' + ], + function (Angle, + Vec3) { + "use strict"; + + //Internal use only. Intentionally not documented. + var BaseSurfaceEditorFragment = function () {}; + + /** + * Add a specified increment to an angle and normalize the result to be between 0 and 360 degrees. + * @param {Number} originalHeading The base angle. + * @param {Number} deltaHeading The increment to add prior to normalizing. + * @returns {Number} The normalized angle. + */ + BaseSurfaceEditorFragment.prototype.normalizedHeading = function (originalHeading, deltaHeading) { + var newHeading = originalHeading * Angle.DEGREES_TO_RADIANS + deltaHeading * Angle.DEGREES_TO_RADIANS; + + if (Math.abs(newHeading) > Angle.TWO_PI) { + newHeading = newHeading % Angle.TWO_PI; + } + + return Angle.RADIANS_TO_DEGREES * (newHeading >= 0 ? newHeading : newHeading + Angle.TWO_PI); + }; + + /** + * Computes the Cartesian difference between two control points. + * @param {Position} previousPosition The position of the previous control point. + * @param {Position} currentPosition The position of the current control point. + * @returns {Vec3} The Cartesian difference between the two control points. + */ + BaseSurfaceEditorFragment.prototype.computeControlPointDelta = function (globe, previousPosition, currentPosition) { + var terrainPoint = globe.computePointFromPosition( + currentPosition.latitude, + currentPosition.longitude, + currentPosition.altitude, + new Vec3(0, 0, 0) + ); + + var previousPoint = globe.computePointFromPosition( + previousPosition.latitude, + previousPosition.longitude, + previousPosition.altitude, + new Vec3(0, 0, 0) + ); + + return terrainPoint.subtract(previousPoint); + }; + + /** + * Updates the line designating the shape's central axis. + * @param {Position} centerPosition The shape's center location and altitude at which to place one of the line's + * end points. + * @param {Position} controlPointPosition The shape orientation control point's position. + */ + BaseSurfaceEditorFragment.prototype.updateOrientationLine = function (centerPosition, controlPointPosition, accessories) { + if (accessories.length == 0) { + return; + } + + var positions = []; + positions.push(centerPosition, controlPointPosition); + var rotationLine = accessories[0]; + rotationLine.positions = positions; + }; + + /** + * Computes the average distance between a specified center point and a list of locations. + * @param {Globe} globe The globe to use for the computations. + * @param {Location} center The center point. + * @param {Array} locations The locations. + * @returns {Number} The average distance. + */ + BaseSurfaceEditorFragment.prototype.getAverageDistance = function (globe, center, locations) { + var count = locations.length; + + var centerPoint = globe.computePointFromLocation( + center.latitude, + center.longitude, + new Vec3(0, 0, 0) + ); + + var totalDistance = 0; + for (var i = 0; i < locations.length; i++) { + var distance = globe.computePointFromLocation( + locations[i].latitude, + locations[i].longitude, + new Vec3(0, 0, 0)).distanceTo(centerPoint); + totalDistance += distance / count; + } + + return (count === 0) ? 0 : totalDistance / globe.equatorialRadius; + }; + + return BaseSurfaceEditorFragment; + } +); \ No newline at end of file diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 6ab670baa..c69268af1 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -33,10 +33,15 @@ define([ '../../layer/RenderableLayer', '../../shapes/ShapeAttributes', '../../shapes/SurfaceEllipse', + './SurfaceEllipseEditorFragment', '../../shapes/SurfaceCircle', + './SurfaceCircleEditorFragment', '../../shapes/SurfacePolygon', + './SurfacePolygonEditorFragment', '../../shapes/SurfacePolyline', + './SurfacePolylineEditorFragment', '../../shapes/SurfaceRectangle', + './SurfaceRectangleEditorFragment', '../../shapes/SurfaceShape', '../../geom/Vec2', '../../geom/Vec3' @@ -57,10 +62,15 @@ define([ RenderableLayer, ShapeAttributes, SurfaceEllipse, + SurfaceEllipseEditorFragment, SurfaceCircle, + SurfaceCircleEditorFragment, SurfacePolygon, + SurfacePolygonEditorFragment, SurfacePolyline, + SurfacePolylineEditorFragment, SurfaceRectangle, + SurfaceRectangleEditorFragment, SurfaceShape, Vec2, Vec3) { @@ -171,12 +181,6 @@ define([ */ this.originalHighlightAttributes = new ShapeAttributes(null); - /** - * For shapes without an inherent heading, the current heading established by the editor for the shape. - * @type {number} - */ - this.currentHeading = 0; - /** * Attributes used to represent shape vertices. * @type {PlacemarkAttributes} @@ -217,6 +221,17 @@ define([ //Internal use only. Intentionally not documented. this.currentEvent = null; + //Internal use only. Intentionally not documented. + this.activeEditorFragment = null; + + this.editorFragments = [ + new SurfaceCircleEditorFragment(), + new SurfaceEllipseEditorFragment(), + new SurfacePolygonEditorFragment(), + new SurfacePolylineEditorFragment(), + new SurfaceRectangleEditorFragment() + ]; + this.worldWindow.worldWindowController.addGestureListener(this); }; @@ -394,13 +409,11 @@ define([ this.handleMouseDown(event); } else if (event.type === "pointermove" || event.type === "mousemove") { this.handleMouseMove(event); - } else { - Logger.logMessage(Logger.LEVEL_INFO, "ShapeEditor", "handleEvent", - "Unrecognized event type: " + event.type); } - } catch (event) { + } catch (error) { + console.log(error); // FIXME Remove this Logger.logMessage(Logger.LEVEL_SEVERE, "ShapeEditor", "handleEvent", - "Error handling event.\n" + event.toString()); + "Error handling event.\n" + error.toString()); } }; @@ -416,37 +429,7 @@ define([ * @returns {SurfaceShape} The new shadow shape created, or null if the shape type is not recognized. */ ShapeEditor.prototype.doMakeShadowShape = function () { - if (this.shape && this.shape instanceof SurfacePolygon) { - return new SurfacePolygon( - this.shape.boundaries, - this.shape.attributes); - } else if (this.shape && this.shape instanceof SurfaceEllipse) { - return new SurfaceEllipse( - this.shape.center, - this.shape.majorRadius, - this.shape.minorRadius, - this.shape.heading, - this.shape.attributes); - } else if (this.shape && this.shape instanceof SurfaceCircle) { - return new SurfaceCircle( - this.shape.center, - this.shape.radius, - this.shape.attributes); - } else if (this.shape && this.shape instanceof SurfaceRectangle) { - return new SurfaceRectangle( - this.shape.center, - this.shape.width, - this.shape.height, - this.shape.heading, - this.shape.attributes); - } else if (this.shape && this.shape instanceof SurfacePolyline) { - return new SurfacePolyline( - this.shape.boundaries, - this.shape.attributes - ); - } - - return null; + return this.activeEditorFragment.createShadowShape(this.shape); }; /** @@ -552,7 +535,14 @@ define([ * @throws {ArgumentError} If the specified shape is null or not an instance of SurfaceShape. */ ShapeEditor.prototype.edit = function (shape) { - if (shape != null && shape instanceof SurfaceShape) { + this.activeEditorFragment = null; + for (var i = 0; i < this.editorFragments.length; i++) { + if (this.editorFragments[i].canEdit(shape)) { + this.activeEditorFragment = this.editorFragments[i]; + } + } + + if (this.activeEditorFragment != null) { this.shape = shape; this.enable(); this.armed = true; @@ -609,8 +599,6 @@ define([ this.worldWindow.removeLayer(this.annotationLayer); this.worldWindow.removeLayer(this.shadowLayer); - - this.currentHeading = 0; }; //Internal use only. Intentionally not documented. @@ -637,22 +625,15 @@ define([ }; ShapeEditor.prototype.updateControlPoints = function () { - if (this.shape && this.shape instanceof SurfaceShape) { - - if (this.shape instanceof SurfacePolygon || - this.shape instanceof SurfacePolyline) { - this.updateSurfacePolygonControlPoints(); - } - else if (this.shape instanceof SurfaceCircle) { - this.updateSurfaceCircleControlPoints(); - } - else if (this.shape instanceof SurfaceRectangle) { - this.updateSurfaceRectangleControlPoints(); - } - else if (this.shape instanceof SurfaceEllipse) { - this.updateSurfaceEllipseControlPoints(); - } - } + this.activeEditorFragment.updateControlPoints( + this.shape, + this.worldWindow.globe, + this.controlPointLayer.renderables, + this.accessoryLayer.renderables, + this.sizeControlPointAttributes, + this.angleControlPointAttributes, + this.locationControlPointAttributes + ); }; /** @@ -745,67 +726,20 @@ define([ * @param {Position} terrainPosition The terrain position under the cursor. */ ShapeEditor.prototype.doReshapeShape = function (controlPoint, terrainPosition) { - if (this.shape && this.shape instanceof SurfaceShape) { - if (this.shape instanceof SurfacePolygon || - this.shape instanceof SurfacePolyline - ) { - this.reshapeSurfacePolygon(controlPoint, terrainPosition); - } - else if (this.shape instanceof SurfaceCircle) { - this.reshapeSurfaceCircle(controlPoint, terrainPosition); - } - else if (this.shape instanceof SurfaceRectangle) { - this.reshapeSurfaceRectangle(controlPoint, terrainPosition); - } - else if (this.shape instanceof SurfaceEllipse) { - this.reshapeSurfaceEllipse(controlPoint, terrainPosition); - } - this.currentSizingMarker.position = terrainPosition; - this.worldWindow.redraw(); - } - }; - - /** - * Computes the average location of a specified array of locations. - * @param {Location[]} locations The array of locations for the shape. - * @return {Position} the average of the locations specified in the array. - */ - ShapeEditor.prototype.getCenter = function (locations) { - var count = 0; - var center = new Vec3(0, 0, 0); - var globe = this.worldWindow.globe; - - if (locations.length > 0 && locations[0].length > 2) { - for (var i = 0; i < locations.length; i++) { - for (var j = 0; j < locations[i].length; j++) { - center = center.add(globe.computePointFromPosition( - locations[i][j].latitude, - locations[i][j].longitude, - 0, - new Vec3(0, 0, 0))); - ++count; - } - } - } - else if (locations.length >= 2) { - for (var i = 0; i < locations.length; i++) { - center = center.add(globe.computePointFromPosition( - locations[i].latitude, - locations[i].longitude, - 0, - new Vec3(0, 0, 0))); - ++count; - } + if (!controlPoint) { + return; } - - center = center.divide(count); - - return globe.computePositionFromPoint( - center[0], - center[1], - center[2], - new Position(0, 0, 0) + this.activeEditorFragment.reshape( + this.shape, + this.worldWindow.globe, + controlPoint, + terrainPosition, + this.previousPosition, + this.currentEvent ); + this.updateAnnotation(controlPoint); + this.currentSizingMarker.position = terrainPosition; + this.worldWindow.redraw(); }; /** @@ -822,34 +756,6 @@ define([ return center; }; - /** - * Computes the average distance between a specified center point and a list of locations. - * @param {Globe} globe The globe to use for the computations. - * @param {Location} center The center point. - * @param {Array} locations The locations. - * @returns {Number} The average distance. - */ - ShapeEditor.prototype.getAverageDistance = function (globe, center, locations) { - var count = locations.length; - - var centerPoint = globe.computePointFromLocation( - center.latitude, - center.longitude, - new Vec3(0, 0, 0) - ); - - var totalDistance = 0; - for (var i = 0; i < locations.length; i++) { - var distance = globe.computePointFromLocation( - locations[i].latitude, - locations[i].longitude, - new Vec3(0, 0, 0)).distanceTo(centerPoint); - totalDistance += distance / count; - } - - return (count === 0) ? 0 : totalDistance / globe.equatorialRadius; - }; - /** * Updates the annotation associated with a specified control point. * @param {Placemark} controlPoint The control point. @@ -882,62 +788,6 @@ define([ this.annotation.text = annotationText; }; - /** - * Updates the line designating the shape's central axis. - * @param {Position} centerPosition The shape's center location and altitude at which to place one of the line's - * end points. - * @param {Position} controlPointPosition The shape orientation control point's position. - */ - ShapeEditor.prototype.updateOrientationLine = function (centerPosition, controlPointPosition) { - if (this.accessoryLayer.renderables.length == 0) { - return; - } - - var positions = []; - positions.push(centerPosition, controlPointPosition); - var rotationLine = this.accessoryLayer.renderables[0]; - rotationLine.positions = positions; - }; - - /** - * Computes the Cartesian difference between two control points. - * @param {Position} previousPosition The position of the previous control point. - * @param {Position} currentPosition The position of the current control point. - * @returns {Vec3} The Cartesian difference between the two control points. - */ - ShapeEditor.prototype.computeControlPointDelta = function (previousPosition, currentPosition) { - var terrainPoint = this.worldWindow.globe.computePointFromPosition( - currentPosition.latitude, - currentPosition.longitude, - currentPosition.altitude, - new Vec3(0, 0, 0) - ); - var previousPoint = this.worldWindow.globe.computePointFromPosition( - previousPosition.latitude, - previousPosition.longitude, - previousPosition.altitude, - new Vec3(0, 0, 0) - ); - - return terrainPoint.subtract(previousPoint); - }; - - /** - * Add a specified increment to an angle and normalize the result to be between 0 and 360 degrees. - * @param {Number} originalHeading The base angle. - * @param {Number} deltaHeading The increment to add prior to normalizing. - * @returns {Number} The normalized angle. - */ - ShapeEditor.prototype.normalizedHeading = function (originalHeading, deltaHeading) { - var newHeading = originalHeading * Angle.DEGREES_TO_RADIANS + deltaHeading * Angle.DEGREES_TO_RADIANS; - - if (Math.abs(newHeading) > Angle.TWO_PI) { - newHeading = newHeading % Angle.TWO_PI; - } - - return Angle.RADIANS_TO_DEGREES * (newHeading >= 0 ? newHeading : newHeading + Angle.TWO_PI); - }; - /** * Computes the point on a specified line segment that is nearest a specified point. * @@ -961,7 +811,7 @@ define([ return p2; } else { - return Vec3.fromLine(p1, dot, dir); + return Vec3.fromLine(p1, dot, dir); // FIXME This is broken } }; @@ -1042,65 +892,6 @@ define([ } }; - /** - * Moves a control point location. - * @param {Placemark} controlPoint The control point being moved. - * @param {Position} terrainPosition The position selected by the user. - * @returns {Position} The position after move. - */ - ShapeEditor.prototype.moveLocation = function (controlPoint, terrainPosition) { - var delta = this.computeControlPointDelta(this.previousPosition, terrainPosition); - var markerPoint = this.worldWindow.globe.computePointFromPosition( - controlPoint.position.latitude, - controlPoint.position.longitude, - 0, - new Vec3(0, 0, 0) - ); - - markerPoint.add(delta); - var markerPosition = this.worldWindow.globe.computePositionFromPoint( - markerPoint[0], - markerPoint[1], - markerPoint[2], - new Position(0, 0, 0) - ); - - return markerPosition; - }; - - /** - * Rotates a shape's locations. - * @param {Position} terrainPosition The position selected by the user. - * @param {Location[]} locations The array of locations for the shape. - */ - ShapeEditor.prototype.rotateLocations = function (terrainPosition, locations) { - var center = this.getCenter(locations); - var previousHeading = Location.greatCircleAzimuth(center, this.previousPosition); - var deltaHeading = Location.greatCircleAzimuth(center, terrainPosition) - previousHeading; - this.currentHeading = this.normalizedHeading(this.currentHeading, deltaHeading); - - if (locations.length > 0 && locations[0].length > 2) { - for (var i = 0; i < locations.length; i++) { - for (var j = 0; j < locations[i].length; j++) { - var heading = Location.greatCircleAzimuth(center, locations[i][j]); - var distance = Location.greatCircleDistance(center, locations[i][j]); - var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, - new Location(0, 0)); - locations[i][j] = newLocation; - } - } - } - else if (locations.length >= 2) { - for (var i = 0; i < locations.length; i++) { - var heading = Location.greatCircleAzimuth(center, locations[i]); - var distance = Location.greatCircleDistance(center, locations[i]); - var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, - new Location(0, 0)); - locations[i] = newLocation; - } - } - }; - ShapeEditor.prototype.setPreviousPosition = function (event) { var mousePoint = this.worldWindow.canvasCoordinates(event.clientX, event.clientY); @@ -1116,494 +907,6 @@ define([ } }; - //Internal use only. Intentionally not documented. - ShapeEditor.prototype.reshapeSurfacePolygon = function (controlPoint, terrainPosition) { - var boundaries = this.shape.boundaries; - var locations = []; - - var k = 0; - var newPos; - - if (boundaries.length > 0 && boundaries[0].length > 2) { - outer: - for (var i = 0; i < boundaries.length; i++) { - for (var j = 0; j < boundaries[i].length; j++) { - if (controlPoint.userProperties.purpose == ShapeEditor.LOCATION) { - if (controlPoint.userProperties.id == k) { - newPos = this.moveLocation(controlPoint, terrainPosition); - boundaries[i][j] = newPos; - this.shape.boundaries = boundaries; - controlPoint.position = newPos; - break outer; - } - } - else if (controlPoint.userProperties.purpose == ShapeEditor.ROTATION) { - this.rotateLocations(terrainPosition, boundaries); - this.shape.boundaries = boundaries; - break outer; - } - k++; - } - } - } - else if (boundaries.length >= 2) { - //poly without whole - for (var i = 0; i < boundaries.length; i++) { - if (controlPoint.userProperties.purpose == ShapeEditor.LOCATION) { - if (controlPoint.userProperties.id == k) { - if (this.currentEvent.altKey) { - //remove location - var minSize = this.shape instanceof SurfacePolygon ? 3 : 2; - if (boundaries.length > minSize) { - // Delete the control point. - boundaries.splice(i, 1); - this.shape.boundaries = boundaries; - this.removeControlPoints(); - } - } - else { - newPos = this.moveLocation(controlPoint, terrainPosition); - boundaries[i] = newPos; - this.shape.boundaries = boundaries; - controlPoint.position = newPos; - } - break; - } - } else if (controlPoint.userProperties.purpose == ShapeEditor.ROTATION) { - this.rotateLocations(terrainPosition, boundaries); - this.shape.boundaries = boundaries; - break; - } - k++; - } - } - - this.updateAnnotation(controlPoint); - }; - - //Internal use only. Intentionally not documented. - ShapeEditor.prototype.updateSurfacePolygonControlPoints = function () { - var locations = []; - - if (this.shape.boundaries.length > 0 && this.shape.boundaries[0].length > 2) { - for (var i = 0; i < this.shape.boundaries.length; i++) { - for (var j = 0; j < this.shape.boundaries[i].length; j++) { - locations.push(this.shape.boundaries[i][j]); - } - } - } - else if (this.shape.boundaries.length >= 2) { - for (var i = 0; i < this.shape.boundaries.length; i++) { - locations.push(this.shape.boundaries[i]); - } - } - - if (locations.length < 2) - return; - - var globe = this.worldWindow.globe; - var polygonCenter = this.getCenter(locations); - var shapeRadius = this.getAverageDistance(globe, polygonCenter, locations); - shapeRadius = shapeRadius * 1.2; - var heading = this.currentHeading; - var rotationControlLocation = Location.greatCircleLocation( - polygonCenter, - heading, - shapeRadius, - new Location(0, 0)); - - var rotationPosition = new Position( - rotationControlLocation.latitude, - rotationControlLocation.longitude, - 0); - - var markers = this.controlPointLayer.renderables; - - if (markers.length > 0) { - for (var i = 0; i < locations.length; i++) { - markers[i].position = locations[i]; - } - markers[locations.length].position = rotationPosition; - markers[locations.length].userProperties.rotation = heading; - } - else { - var controlPointMarker; - for (var i = 0; i < locations.length; i++) { - controlPointMarker = new Placemark( - locations[i], - false, - this.locationControlPointAttributes); - controlPointMarker.userProperties.isControlPoint = true; - controlPointMarker.userProperties.id = i; - controlPointMarker.userProperties.purpose = ShapeEditor.LOCATION; - - controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; - this.controlPointLayer.addRenderable(controlPointMarker); - } - - controlPointMarker = new Placemark( - rotationPosition, - false, - this.angleControlPointAttributes - ); - - controlPointMarker.userProperties.isControlPoint = true; - controlPointMarker.userProperties.id = locations.length; - controlPointMarker.userProperties.purpose = ShapeEditor.ROTATION; - controlPointMarker.userProperties.rotation = heading; - - controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; - - this.controlPointLayer.addRenderable(controlPointMarker); - } - - this.updateOrientationLine(polygonCenter, rotationPosition); - }; - - //Internal use only. Intentionally not documented. - ShapeEditor.prototype.reshapeSurfaceCircle = function (controlPoint, terrainPosition) { - if (!controlPoint) { - return; - } - - var circle = this.shape; - - var delta = this.computeControlPointDelta(this.previousPosition, terrainPosition); - var centerPoint = this.worldWindow.globe.computePointFromPosition( - circle.center.latitude, - circle.center.longitude, - 0, - new Vec3(0, 0, 0) - ); - var markerPoint = this.worldWindow.globe.computePointFromPosition( - controlPoint.position.latitude, - controlPoint.position.longitude, - 0, - new Vec3(0, 0, 0) - ); - - var vMarker = markerPoint.subtract(centerPoint).normalize(); - - var radius = circle.radius + delta.dot(vMarker); - if (radius > 0) { - circle.radius = radius; - } - - this.updateAnnotation(controlPoint); - }; - - //Internal use only. Intentionally not documented. - ShapeEditor.prototype.updateSurfaceCircleControlPoints = function () { - var circle = this.shape; - - var radiusLocation = Location.greatCircleLocation( - circle.center, - 90, - circle.radius / this.worldWindow.globe.equatorialRadius, - new Location(0, 0)); - - var markers = this.controlPointLayer.renderables; - - if (markers.length > 0) { - markers[0].position = radiusLocation; - } - else { - var controlPointMarker = new Placemark( - radiusLocation, - false, - this.sizeControlPointAttributes - ); - controlPointMarker.userProperties.isControlPoint = true; - controlPointMarker.userProperties.id = 0; - controlPointMarker.userProperties.purpose = ShapeEditor.OUTER_RADIUS; - - controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; - this.controlPointLayer.addRenderable(controlPointMarker); - } - - markers[0].userProperties.size = circle.radius; - }; - - //Internal use only. Intentionally not documented. - ShapeEditor.prototype.reshapeSurfaceRectangle = function (controlPoint, terrainPosition) { - if (!controlPoint) { - return; - } - - var rectangle = this.shape; - - var terrainPoint = this.worldWindow.globe.computePointFromPosition( - terrainPosition.latitude, - terrainPosition.longitude, - 0, - new Vec3(0, 0, 0) - ); - var previousPoint = this.worldWindow.globe.computePointFromPosition( - this.previousPosition.latitude, - this.previousPosition.longitude, - 0, - new Vec3(0, 0, 0) - ); - var delta = terrainPoint.subtract(previousPoint); - - var centerPoint = this.worldWindow.globe.computePointFromPosition( - this.shape.center.latitude, - this.shape.center.longitude, - 0, - new Vec3(0, 0, 0) - ); - var markerPoint = this.worldWindow.globe.computePointFromPosition( - controlPoint.position.latitude, - controlPoint.position.longitude, - 0, - new Vec3(0, 0, 0) - ); - var vMarker = markerPoint.subtract(centerPoint).normalize(); - - if (controlPoint.userProperties.purpose == ShapeEditor.WIDTH || controlPoint.userProperties.purpose == ShapeEditor.HEIGHT) { - var width = rectangle.width + (controlPoint.userProperties.id == 0 ? delta.dot(vMarker) * 2 : 0); - var height = rectangle.height + (controlPoint.userProperties.id == 1 ? delta.dot(vMarker) * 2 : 0); - - if (width > 0 && height > 0) { - rectangle.width = width; - rectangle.height = height; - } - } - else { - var oldHeading = Location.greatCircleAzimuth(rectangle.center, this.previousPosition); - var deltaHeading = Location.greatCircleAzimuth(rectangle.center, terrainPosition) - oldHeading; - rectangle.heading = this.normalizedHeading(rectangle.heading, deltaHeading); - } - - this.updateAnnotation(controlPoint); - }; - - //Internal use only. Intentionally not documented. - ShapeEditor.prototype.updateSurfaceRectangleControlPoints = function () { - var rectangle = this.shape; - - var widthLocation = Location.greatCircleLocation( - rectangle.center, - 90 + rectangle.heading, - 0.5 * rectangle.width / this.worldWindow.globe.equatorialRadius, - new Location(0, 0)); - - var heightLocation = Location.greatCircleLocation( - rectangle.center, - rectangle.heading, - 0.5 * rectangle.height / this.worldWindow.globe.equatorialRadius, - new Location(0, 0)); - - var rotationLocation = Location.greatCircleLocation( - rectangle.center, - rectangle.heading, - 0.7 * rectangle.height / this.worldWindow.globe.equatorialRadius, - new Location(0, 0)); - - var markers; - - markers = this.controlPointLayer.renderables; - - if (markers.length > 0) { - markers[0].position = widthLocation; - markers[1].position = heightLocation; - markers[2].position = rotationLocation; - } - else { - var controlPointMarker = new Placemark( - widthLocation, - false, - this.sizeControlPointAttributes - ); - controlPointMarker.userProperties.isControlPoint = true; - controlPointMarker.userProperties.id = 0; - controlPointMarker.userProperties.purpose = ShapeEditor.WIDTH; - - controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; - this.controlPointLayer.addRenderable(controlPointMarker); - - controlPointMarker = new Placemark( - heightLocation, - false, - this.sizeControlPointAttributes - ); - controlPointMarker.userProperties.isControlPoint = true; - controlPointMarker.userProperties.id = 1; - controlPointMarker.userProperties.purpose = ShapeEditor.HEIGHT; - - controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; - this.controlPointLayer.addRenderable(controlPointMarker); - - controlPointMarker = new Placemark( - rotationLocation, - false, - this.angleControlPointAttributes - ); - controlPointMarker.userProperties.isControlPoint = true; - controlPointMarker.userProperties.id = 1; - controlPointMarker.userProperties.purpose = ShapeEditor.ROTATION; - - controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; - this.controlPointLayer.addRenderable(controlPointMarker); - } - - markers[0].userProperties.size = rectangle.width; - markers[1].userProperties.size = rectangle.height; - markers[2].userProperties.rotation = rectangle.heading; - - this.updateOrientationLine(rectangle.center, rotationLocation); - }; - - //Internal use only. Intentionally not documented. - ShapeEditor.prototype.reshapeSurfaceEllipse = function (controlPoint, terrainPosition) { - if (!controlPoint) { - return; - } - - var ellipse = this.shape; - - var terrainPoint = this.worldWindow.globe.computePointFromPosition( - terrainPosition.latitude, - terrainPosition.longitude, - 0, - new Vec3(0, 0, 0) - ); - var previousPoint = this.worldWindow.globe.computePointFromPosition( - this.previousPosition.latitude, - this.previousPosition.longitude, - 0, - new Vec3(0, 0, 0) - ); - var delta = terrainPoint.subtract(previousPoint); - - var centerPoint = this.worldWindow.globe.computePointFromPosition( - ellipse.center.latitude, - ellipse.center.longitude, - 0, - new Vec3(0, 0, 0) - ); - var markerPoint = this.worldWindow.globe.computePointFromPosition( - controlPoint.position.latitude, - controlPoint.position.longitude, - 0, - new Vec3(0, 0, 0) - ); - var vMarker = markerPoint.subtract(centerPoint).normalize(); - - if (controlPoint.userProperties.purpose == ShapeEditor.WIDTH || - controlPoint.userProperties.purpose == ShapeEditor.HEIGHT) { - var majorRadius = ellipse.majorRadius + (controlPoint.userProperties.id == 0 ? delta.dot(vMarker) : 0); - var minorRadius = ellipse.minorRadius + (controlPoint.userProperties.id == 1 ? delta.dot(vMarker) : 0); - - if (majorRadius > 0 && minorRadius > 0) { - ellipse.majorRadius = majorRadius; - ellipse.minorRadius = minorRadius; - } - } else { - var oldHeading = Location.greatCircleAzimuth(ellipse.center, this.previousPosition); - var deltaHeading = Location.greatCircleAzimuth(ellipse.center, terrainPosition) - oldHeading; - ellipse.heading = this.normalizedHeading(ellipse.heading, deltaHeading); - } - - this.updateAnnotation(controlPoint); - }; - - //Internal use only. Intentionally not documented. - ShapeEditor.prototype.updateSurfaceEllipseControlPoints = function () { - var ellipse = this.shape; - - var majorLocation = Location.greatCircleLocation( - ellipse.center, - 90 + ellipse.heading, - ellipse.majorRadius / this.worldWindow.globe.equatorialRadius, - new Location(0, 0)); - - var minorLocation = Location.greatCircleLocation( - ellipse.center, - ellipse.heading, - ellipse.minorRadius / this.worldWindow.globe.equatorialRadius, - new Location(0, 0)); - - var rotationLocation = Location.greatCircleLocation( - ellipse.center, - ellipse.heading, - 1.15 * ellipse.minorRadius / this.worldWindow.globe.equatorialRadius, - new Location(0, 0) - ); - - var markers = this.controlPointLayer.renderables; - - if (markers.length > 0) { - markers[0].position = majorLocation; - markers[1].position = minorLocation; - markers[2].position = rotationLocation; - } - else { - var controlPointMarker = new Placemark( - majorLocation, - false, - this.sizeControlPointAttributes - ); - controlPointMarker.userProperties.isControlPoint = true; - controlPointMarker.userProperties.id = 0; - controlPointMarker.userProperties.purpose = ShapeEditor.WIDTH; - - controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; - this.controlPointLayer.addRenderable(controlPointMarker); - - controlPointMarker = new Placemark( - minorLocation, - false, - this.sizeControlPointAttributes - ); - controlPointMarker.userProperties.isControlPoint = true; - controlPointMarker.userProperties.id = 1; - controlPointMarker.userProperties.purpose = ShapeEditor.HEIGHT; - - controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; - this.controlPointLayer.addRenderable(controlPointMarker); - - controlPointMarker = new Placemark( - rotationLocation, - false, - this.angleControlPointAttributes - ); - controlPointMarker.userProperties.isControlPoint = true; - controlPointMarker.userProperties.id = 2; - controlPointMarker.userProperties.purpose = ShapeEditor.ROTATION; - - controlPointMarker.altitudeMode = WorldWind.CLAMP_TO_GROUND; - this.controlPointLayer.addRenderable(controlPointMarker); - } - - markers[0].userProperties.size = ellipse.majorRadius; - markers[1].userProperties.size = ellipse.minorRadius; - markers[2].userProperties.rotation = ellipse.heading; - - this.updateOrientationLine(ellipse.center, rotationLocation); - }; - - // Indicates that a control point is associated with annotation. - ShapeEditor.ANNOTATION = "annotation"; - - // Indicates a control point is associated with a location. - ShapeEditor.LOCATION = "location"; - - // Indicates that a control point is associated with whole-shape rotation. - ShapeEditor.ROTATION = "rotation"; - - // Indicates that a control point is associated with width change. - ShapeEditor.WIDTH = "width"; - - // Indicates that a control point is associated with height change. - ShapeEditor.HEIGHT = "height"; - - // Indicates that a control point is associated with the right width of a shape. - ShapeEditor.RIGHT_WIDTH = "rightWidth"; - - // Indicates that a control point is associated with the outer radius of a shape. - ShapeEditor.OUTER_RADIUS = "outerRadius"; - return ShapeEditor; } ); \ No newline at end of file diff --git a/src/util/editor/ShapeEditorConstants.js b/src/util/editor/ShapeEditorConstants.js new file mode 100644 index 000000000..2a9af2942 --- /dev/null +++ b/src/util/editor/ShapeEditorConstants.js @@ -0,0 +1,50 @@ +/* + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. + * + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +define([], + function () { + 'use strict'; + + /** + * Provides constants for the ShapeEditor. + * @exports ShapeEditorConstants + */ + var ShapeEditorConstants = { + + // Indicates that a control point is associated with annotation. + ANNOTATION: "annotation", + + // Indicates a control point is associated with a location. + LOCATION: "location", + + // Indicates that a control point is associated with whole-shape rotation. + ROTATION: "rotation", + + // Indicates that a control point is associated with width change. + WIDTH: "width", + + // Indicates that a control point is associated with height change. + HEIGHT: "height", + + // Indicates that a control point is associated with the right width of a shape. + RIGHT_WIDTH: "rightWidth", + + // Indicates that a control point is associated with the outer radius of a shape. + OUTER_RADIUS: "outerRadius" + }; + + return ShapeEditorConstants; + }); \ No newline at end of file diff --git a/src/util/editor/SurfaceCircleEditorFragment.js b/src/util/editor/SurfaceCircleEditorFragment.js new file mode 100644 index 000000000..04dad67c1 --- /dev/null +++ b/src/util/editor/SurfaceCircleEditorFragment.js @@ -0,0 +1,103 @@ +/* + * Copyright 2015-2018 WorldWind Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @exports SurfaceCircleEditorFragment + */ +define([ + './BaseSurfaceEditorFragment', + '../../geom/Location', + '../../shapes/Placemark', + './ShapeEditorConstants', + '../../shapes/SurfaceCircle', + '../../geom/Vec3' + ], + function (BaseSurfaceEditorFragment, + Location, + Placemark, + ShapeEditorConstants, + SurfaceCircle, + Vec3) { + "use strict"; + + //Internal use only. Intentionally not documented. + var SurfaceCircleEditorFragment = function () {}; + + SurfaceCircleEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); + + //Internal use only. Intentionally not documented. + SurfaceCircleEditorFragment.prototype.canEdit = function (shape) { + return shape instanceof SurfaceCircle; + }; + + //Internal use only. Intentionally not documented. + SurfaceCircleEditorFragment.prototype.createShadowShape = function (shape) { + return new SurfaceCircle(shape.center, shape.radius, shape.attributes); + }; + + //Internal use only. Intentionally not documented. + SurfaceCircleEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, currentEvent) { + var delta = this.computeControlPointDelta(globe, previousPosition, terrainPosition); + var centerPoint = globe.computePointFromPosition( + shape.center.latitude, + shape.center.longitude, + 0, + new Vec3(0, 0, 0) + ); + var markerPoint = globe.computePointFromPosition( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0, + new Vec3(0, 0, 0) + ); + + var vMarker = markerPoint.subtract(centerPoint).normalize(); + + var radius = shape.radius + delta.dot(vMarker); + if (radius > 0) { + shape.radius = radius; + } + }; + + //Internal use only. Intentionally not documented. + SurfaceCircleEditorFragment.prototype.updateControlPoints = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + var radiusLocation = Location.greatCircleLocation( + shape.center, + 90, + shape.radius / globe.equatorialRadius, + new Location(0, 0)); + + if (controlPoints.length > 0) { + controlPoints[0].position = radiusLocation; + } + else { + var controlPoint = new Placemark( + radiusLocation, + false, + sizeControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 0; + controlPoint.userProperties.purpose = ShapeEditorConstants.OUTER_RADIUS; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + } + + controlPoints[0].userProperties.size = shape.radius; + }; + + return SurfaceCircleEditorFragment; + } +); \ No newline at end of file diff --git a/src/util/editor/SurfaceEllipseEditorFragment.js b/src/util/editor/SurfaceEllipseEditorFragment.js new file mode 100644 index 000000000..91c21543f --- /dev/null +++ b/src/util/editor/SurfaceEllipseEditorFragment.js @@ -0,0 +1,174 @@ +/* + * Copyright 2015-2018 WorldWind Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @exports SurfaceEllipseEditorFragment + */ +define([ + './BaseSurfaceEditorFragment', + '../../geom/Location', + '../../shapes/Placemark', + './ShapeEditorConstants', + '../../shapes/SurfaceEllipse', + '../../geom/Vec3' + ], + function (BaseSurfaceEditorFragment, + Location, + Placemark, + ShapeEditorConstants, + SurfaceEllipse, + Vec3) { + "use strict"; + + //Internal use only. Intentionally not documented. + var SurfaceEllipseEditorFragment = function () {}; + + SurfaceEllipseEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); + + //Internal use only. Intentionally not documented. + SurfaceEllipseEditorFragment.prototype.canEdit = function (shape) { + return shape instanceof SurfaceEllipse; + }; + + //Internal use only. Intentionally not documented. + SurfaceEllipseEditorFragment.prototype.createShadowShape = function (shape) { + return new SurfaceEllipse( + shape.center, + shape.majorRadius, + shape.minorRadius, + shape.heading, + shape.attributes + ); + }; + + //Internal use only. Intentionally not documented. + SurfaceEllipseEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, currentEvent) { + var terrainPoint = globe.computePointFromPosition( + terrainPosition.latitude, + terrainPosition.longitude, + 0, + new Vec3(0, 0, 0) + ); + var previousPoint = globe.computePointFromPosition( + previousPosition.latitude, + previousPosition.longitude, + 0, + new Vec3(0, 0, 0) + ); + var delta = terrainPoint.subtract(previousPoint); + + var centerPoint = globe.computePointFromPosition( + shape.center.latitude, + shape.center.longitude, + 0, + new Vec3(0, 0, 0) + ); + var markerPoint = globe.computePointFromPosition( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0, + new Vec3(0, 0, 0) + ); + var vMarker = markerPoint.subtract(centerPoint).normalize(); + + if (controlPoint.userProperties.purpose === ShapeEditorConstants.WIDTH || + controlPoint.userProperties.purpose === ShapeEditorConstants.HEIGHT) { + var majorRadius = shape.majorRadius + (controlPoint.userProperties.id === 0 ? delta.dot(vMarker) : 0); + var minorRadius = shape.minorRadius + (controlPoint.userProperties.id === 1 ? delta.dot(vMarker) : 0); + + if (majorRadius > 0 && minorRadius > 0) { + shape.majorRadius = majorRadius; + shape.minorRadius = minorRadius; + } + } else { + var oldHeading = Location.greatCircleAzimuth(shape.center, previousPosition); + var deltaHeading = Location.greatCircleAzimuth(shape.center, terrainPosition) - oldHeading; + shape.heading = this.normalizedHeading(shape.heading, deltaHeading); + } + }; + + //Internal use only. Intentionally not documented. + SurfaceEllipseEditorFragment.prototype.updateControlPoints = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + var majorLocation = Location.greatCircleLocation( + shape.center, + 90 + shape.heading, + shape.majorRadius / globe.equatorialRadius, + new Location(0, 0)); + + var minorLocation = Location.greatCircleLocation( + shape.center, + shape.heading, + shape.minorRadius / globe.equatorialRadius, + new Location(0, 0)); + + var rotationLocation = Location.greatCircleLocation( + shape.center, + shape.heading, + 1.15 * shape.minorRadius / globe.equatorialRadius, + new Location(0, 0) + ); + + if (controlPoints.length > 0) { + controlPoints[0].position = majorLocation; + controlPoints[1].position = minorLocation; + controlPoints[2].position = rotationLocation; + } + else { + var controlPoint; + + controlPoint = new Placemark( + majorLocation, + false, + sizeControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 0; + controlPoint.userProperties.purpose = ShapeEditorConstants.WIDTH; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + + controlPoint = new Placemark( + minorLocation, + false, + sizeControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 1; + controlPoint.userProperties.purpose = ShapeEditorConstants.HEIGHT; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + + controlPoint = new Placemark( + rotationLocation, + false, + angleControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 2; + controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + } + + controlPoints[0].userProperties.size = shape.majorRadius; + controlPoints[1].userProperties.size = shape.minorRadius; + controlPoints[2].userProperties.rotation = shape.heading; + + this.updateOrientationLine(shape.center, rotationLocation, accessories); + }; + + return SurfaceEllipseEditorFragment; + } +); \ No newline at end of file diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js new file mode 100644 index 000000000..59d667810 --- /dev/null +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -0,0 +1,290 @@ +/* + * Copyright 2015-2018 WorldWind Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @exports SurfacePolygonEditorFragment + */ +define([ + './BaseSurfaceEditorFragment', + '../../geom/Location', + '../../shapes/Placemark', + '../../geom/Position', + './ShapeEditorConstants', + '../../shapes/SurfacePolygon', + '../../geom/Vec3' + ], + function (BaseSurfaceEditorFragment, + Location, + Placemark, + Position, + ShapeEditorConstants, + SurfacePolygon, + Vec3) { + "use strict"; + + //Internal use only. Intentionally not documented. + var SurfacePolygonEditorFragment = function () { + this.currentHeading = 0; + }; + + SurfacePolygonEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); + + //Internal use only. Intentionally not documented. + SurfacePolygonEditorFragment.prototype.canEdit = function (shape) { + return shape instanceof SurfacePolygon; + }; + + //Internal use only. Intentionally not documented. + SurfacePolygonEditorFragment.prototype.createShadowShape = function (shape) { + return new SurfacePolygon(shape.boundaries, shape.attributes); + }; + + //Internal use only. Intentionally not documented. + SurfacePolygonEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, currentEvent) { + var boundaries = shape.boundaries; + + var k = 0; + var newPos; + + if (boundaries.length > 0 && boundaries[0].length > 2) { + outer: + for (var i = 0; i < boundaries.length; i++) { + for (var j = 0; j < boundaries[i].length; j++) { + if (controlPoint.userProperties.purpose === ShapeEditor.LOCATION) { + if (controlPoint.userProperties.id === k) { + newPos = this.moveLocation(globe, controlPoint, terrainPosition, previousPosition); + boundaries[i][j] = newPos; + shape.boundaries = boundaries; + controlPoint.position = newPos; + break outer; + } + } + else if (controlPoint.userProperties.purpose === ShapeEditor.ROTATION) { + this.rotateLocations(terrainPosition, boundaries); + shape.boundaries = boundaries; + break outer; + } + k++; + } + } + } + else if (boundaries.length >= 2) { + //poly without whole + for (var i = 0; i < boundaries.length; i++) { + if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { + if (controlPoint.userProperties.id === k) { + if (currentEvent.altKey) { + //remove location + var minSize = shape instanceof SurfacePolygon ? 3 : 2; + if (boundaries.length > minSize) { + // Delete the control point. + boundaries.splice(i, 1); + shape.boundaries = boundaries; + this.removeControlPoints(); + } + } + else { + newPos = this.moveLocation(globe, controlPoint, terrainPosition, previousPosition); + boundaries[i] = newPos; + shape.boundaries = boundaries; + controlPoint.position = newPos; + } + break; + } + } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { + this.rotateLocations(globe, terrainPosition, previousPosition, boundaries); + shape.boundaries = boundaries; + break; + } + k++; + } + } + }; + + //Internal use only. Intentionally not documented. + SurfacePolygonEditorFragment.prototype.updateControlPoints = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + var locations = []; + + if (shape.boundaries.length > 0 && shape.boundaries[0].length > 2) { + for (var i = 0; i < shape.boundaries.length; i++) { + for (var j = 0; j < shape.boundaries[i].length; j++) { + locations.push(shape.boundaries[i][j]); + } + } + } + else if (shape.boundaries.length >= 2) { + for (var i = 0; i < shape.boundaries.length; i++) { + locations.push(shape.boundaries[i]); + } + } + + if (locations.length < 2) + return; + + var polygonCenter = this.getCenter(globe, locations); + var shapeRadius = this.getAverageDistance(globe, polygonCenter, locations); + shapeRadius = shapeRadius * 1.2; + var heading = this.currentHeading; + var rotationControlLocation = Location.greatCircleLocation( + polygonCenter, + heading, + shapeRadius, + new Location(0, 0)); + + var rotationPosition = new Position( + rotationControlLocation.latitude, + rotationControlLocation.longitude, + 0); + + if (controlPoints.length > 0) { + for (var i = 0; i < locations.length; i++) { + controlPoints[i].position = locations[i]; + } + controlPoints[locations.length].position = rotationPosition; + controlPoints[locations.length].userProperties.rotation = heading; + } + else { + var controlPoint; + + for (var i = 0; i < locations.length; i++) { + controlPoint = new Placemark( + locations[i], + false, + locationControlPointAttributes); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = i; + controlPoint.userProperties.purpose = ShapeEditorConstants.LOCATION; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + } + + controlPoint = new Placemark( + rotationPosition, + false, + angleControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = locations.length; + controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; + controlPoint.userProperties.rotation = heading; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + } + + this.updateOrientationLine(polygonCenter, rotationPosition, accessories); + }; + + /** + * Moves a control point location. + * @param {Placemark} controlPoint The control point being moved. + * @param {Position} terrainPosition The position selected by the user. + * @returns {Position} The position after move. + */ + SurfacePolygonEditorFragment.prototype.moveLocation = function (globe, controlPoint, terrainPosition, previousPosition) { + var delta = this.computeControlPointDelta(globe, previousPosition, terrainPosition); + var markerPoint = globe.computePointFromPosition( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0, + new Vec3(0, 0, 0) + ); + + markerPoint.add(delta); + return globe.computePositionFromPoint( + markerPoint[0], + markerPoint[1], + markerPoint[2], + new Position(0, 0, 0) + ); + }; + + /** + * Rotates a shape's locations. + * @param {Position} terrainPosition The position selected by the user. + * @param {Location[]} locations The array of locations for the shape. + */ + SurfacePolygonEditorFragment.prototype.rotateLocations = function (globe, terrainPosition, previousPosition, locations) { + var center = this.getCenter(globe, locations); + var previousHeading = Location.greatCircleAzimuth(center, previousPosition); + var deltaHeading = Location.greatCircleAzimuth(center, terrainPosition) - previousHeading; + this.currentHeading = this.normalizedHeading(this.currentHeading, deltaHeading); + + if (locations.length > 0 && locations[0].length > 2) { + for (var i = 0; i < locations.length; i++) { + for (var j = 0; j < locations[i].length; j++) { + var heading = Location.greatCircleAzimuth(center, locations[i][j]); + var distance = Location.greatCircleDistance(center, locations[i][j]); + var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, + new Location(0, 0)); + locations[i][j] = newLocation; + } + } + } + else if (locations.length >= 2) { + for (var i = 0; i < locations.length; i++) { + var heading = Location.greatCircleAzimuth(center, locations[i]); + var distance = Location.greatCircleDistance(center, locations[i]); + var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, + new Location(0, 0)); + locations[i] = newLocation; + } + } + }; + + /** + * Computes the average location of a specified array of locations. + * @param {Location[]} locations The array of locations for the shape. + * @return {Position} the average of the locations specified in the array. + */ + SurfacePolygonEditorFragment.prototype.getCenter = function (globe, locations) { + var count = 0; + var center = new Vec3(0, 0, 0); + + if (locations.length > 0 && locations[0].length > 2) { + for (var i = 0; i < locations.length; i++) { + for (var j = 0; j < locations[i].length; j++) { + center = center.add(globe.computePointFromPosition( + locations[i][j].latitude, + locations[i][j].longitude, + 0, + new Vec3(0, 0, 0))); + ++count; + } + } + } + else if (locations.length >= 2) { + for (var i = 0; i < locations.length; i++) { + center = center.add(globe.computePointFromPosition( + locations[i].latitude, + locations[i].longitude, + 0, + new Vec3(0, 0, 0))); + ++count; + } + } + + center = center.divide(count); + + return globe.computePositionFromPoint( + center[0], + center[1], + center[2], + new Position(0, 0, 0) + ); + }; + + return SurfacePolygonEditorFragment; + } +); \ No newline at end of file diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js new file mode 100644 index 000000000..15a9797bd --- /dev/null +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -0,0 +1,103 @@ +/* + * Copyright 2015-2018 WorldWind Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @exports SurfacePolylineEditorFragment + */ +define([ + './BaseSurfaceEditorFragment', + '../../geom/Location', + '../../shapes/Placemark', + './ShapeEditorConstants', + '../../shapes/SurfacePolyline', + '../../geom/Vec3' + ], + function (BaseSurfaceEditorFragment, + Location, + Placemark, + ShapeEditorConstants, + SurfacePolyline, + Vec3) { + "use strict"; + + //Internal use only. Intentionally not documented. + var SurfacePolylineEditorFragment = function () {}; + + SurfacePolylineEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); + + //Internal use only. Intentionally not documented. + SurfacePolylineEditorFragment.prototype.canEdit = function (shape) { + return shape instanceof SurfacePolyline; + }; + + //Internal use only. Intentionally not documented. + SurfacePolylineEditorFragment.prototype.createShadowShape = function (shape) { + return new SurfacePolyline(shape.boundaries, shape.attributes); + }; + + //Internal use only. Intentionally not documented. + SurfacePolylineEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, currentEvent) { + var delta = this.computeControlPointDelta(globe, previousPosition, terrainPosition); + var centerPoint = globe.computePointFromPosition( + shape.center.latitude, + shape.center.longitude, + 0, + new Vec3(0, 0, 0) + ); + var markerPoint = globe.computePointFromPosition( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0, + new Vec3(0, 0, 0) + ); + + var vMarker = markerPoint.subtract(centerPoint).normalize(); + + var radius = shape.radius + delta.dot(vMarker); + if (radius > 0) { + shape.radius = radius; + } + }; + + //Internal use only. Intentionally not documented. + SurfacePolylineEditorFragment.prototype.updateControlPoints = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + var radiusLocation = Location.greatCircleLocation( + shape.center, + 90, + shape.radius / globe.equatorialRadius, + new Location(0, 0)); + + if (controlPoints.length > 0) { + controlPoints[0].position = radiusLocation; + } + else { + var controlPoint = new Placemark( + radiusLocation, + false, + sizeControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 0; + controlPoint.userProperties.purpose = ShapeEditorConstants.OUTER_RADIUS; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + } + + controlPoints[0].userProperties.size = shape.radius; + }; + + return SurfacePolylineEditorFragment; + } +); \ No newline at end of file diff --git a/src/util/editor/SurfaceRectangleEditorFragment.js b/src/util/editor/SurfaceRectangleEditorFragment.js new file mode 100644 index 000000000..6cb7b69ed --- /dev/null +++ b/src/util/editor/SurfaceRectangleEditorFragment.js @@ -0,0 +1,174 @@ +/* + * Copyright 2015-2018 WorldWind Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @exports SurfaceRectangleEditorFragment + */ +define([ + './BaseSurfaceEditorFragment', + '../../geom/Location', + '../../shapes/Placemark', + './ShapeEditorConstants', + '../../shapes/SurfaceRectangle', + '../../geom/Vec3' + ], + function (BaseSurfaceEditorFragment, + Location, + Placemark, + ShapeEditorConstants, + SurfaceRectangle, + Vec3) { + "use strict"; + + //Internal use only. Intentionally not documented. + var SurfaceRectangleEditorFragment = function () {}; + + SurfaceRectangleEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); + + //Internal use only. Intentionally not documented. + SurfaceRectangleEditorFragment.prototype.canEdit = function (shape) { + return shape instanceof SurfaceRectangle; + }; + + //Internal use only. Intentionally not documented. + SurfaceRectangleEditorFragment.prototype.createShadowShape = function (shape) { + return new SurfaceRectangle( + shape.center, + shape.width, + shape.height, + shape.heading, + shape.attributes + ); + }; + + //Internal use only. Intentionally not documented. + SurfaceRectangleEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, currentEvent) { + var terrainPoint = globe.computePointFromPosition( + terrainPosition.latitude, + terrainPosition.longitude, + 0, + new Vec3(0, 0, 0) + ); + var previousPoint = globe.computePointFromPosition( + previousPosition.latitude, + previousPosition.longitude, + 0, + new Vec3(0, 0, 0) + ); + var delta = terrainPoint.subtract(previousPoint); + + var centerPoint = globe.computePointFromPosition( + shape.center.latitude, + shape.center.longitude, + 0, + new Vec3(0, 0, 0) + ); + var markerPoint = globe.computePointFromPosition( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0, + new Vec3(0, 0, 0) + ); + var vMarker = markerPoint.subtract(centerPoint).normalize(); + + if (controlPoint.userProperties.purpose === ShapeEditorConstants.WIDTH + || controlPoint.userProperties.purpose === ShapeEditorConstants.HEIGHT) { + var width = shape.width + (controlPoint.userProperties.id === 0 ? delta.dot(vMarker) * 2 : 0); + var height = shape.height + (controlPoint.userProperties.id === 1 ? delta.dot(vMarker) * 2 : 0); + + if (width > 0 && height > 0) { + shape.width = width; + shape.height = height; + } + } + else { + var oldHeading = Location.greatCircleAzimuth(shape.center, this.previousPosition); + var deltaHeading = Location.greatCircleAzimuth(shape.center, terrainPosition) - oldHeading; + shape.heading = this.normalizedHeading(shape.heading, deltaHeading); + } + }; + + //Internal use only. Intentionally not documented. + SurfaceRectangleEditorFragment.prototype.updateControlPoints = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + var widthLocation = Location.greatCircleLocation( + shape.center, + 90 + shape.heading, + 0.5 * shape.width / globe.equatorialRadius, + new Location(0, 0)); + + var heightLocation = Location.greatCircleLocation( + shape.center, + shape.heading, + 0.5 * shape.height / globe.equatorialRadius, + new Location(0, 0)); + + var rotationLocation = Location.greatCircleLocation( + shape.center, + shape.heading, + 0.7 * shape.height / globe.equatorialRadius, + new Location(0, 0)); + + if (controlPoints.length > 0) { + controlPoints[0].position = widthLocation; + controlPoints[1].position = heightLocation; + controlPoints[2].position = rotationLocation; + } + else { + var controlPoint; + + controlPoint = new Placemark( + widthLocation, + false, + sizeControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 0; + controlPoint.userProperties.purpose = ShapeEditorConstants.WIDTH; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + + controlPoint = new Placemark( + heightLocation, + false, + sizeControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 1; + controlPoint.userProperties.purpose = ShapeEditorConstants.HEIGHT; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + + controlPoint = new Placemark( + rotationLocation, + false, + angleControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 1; + controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + } + + controlPoints[0].userProperties.size = shape.width; + controlPoints[1].userProperties.size = shape.height; + controlPoints[2].userProperties.rotation = shape.heading; + + this.updateOrientationLine(shape.center, rotationLocation, accessories); + }; + + return SurfaceRectangleEditorFragment; + } +); \ No newline at end of file From db5f7e299b02c4c09c00a62c821d6f907cbd864c Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Fri, 22 Jun 2018 20:48:46 +0200 Subject: [PATCH 026/112] Intermediate state of the refactoring --- src/util/editor/BaseSurfaceEditorFragment.js | 29 +- src/util/editor/ShapeEditor.js | 1018 +++++++---------- src/util/editor/ShapeEditorConstants.js | 4 +- .../editor/SurfaceCircleEditorFragment.js | 45 +- .../editor/SurfaceEllipseEditorFragment.js | 98 +- .../editor/SurfacePolygonEditorFragment.js | 9 +- .../editor/SurfacePolylineEditorFragment.js | 9 +- .../editor/SurfaceRectangleEditorFragment.js | 98 +- 8 files changed, 616 insertions(+), 694 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index e39552515..7ca318518 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -18,9 +18,15 @@ */ define([ '../../geom/Angle', + '../../shapes/Path', + '../../geom/Position', + '../../shapes/ShapeAttributes', '../../geom/Vec3' ], function (Angle, + Path, + Position, + ShapeAttributes, Vec3) { "use strict"; @@ -80,8 +86,7 @@ define([ var positions = []; positions.push(centerPosition, controlPointPosition); - var rotationLine = accessories[0]; - rotationLine.positions = positions; + accessories[0].positions = positions; }; /** @@ -112,6 +117,26 @@ define([ return (count === 0) ? 0 : totalDistance / globe.equatorialRadius; }; + /** + * Set up the Path for the rotation line. + */ + BaseSurfaceEditorFragment.prototype.makeAccessory = function (accessories, attributes) { + var pathPositions = []; + pathPositions.push(new Position(0, 0, 0)); + pathPositions.push(new Position(0, 0, 0)); + var rotationLine = new Path(pathPositions, null); + rotationLine.altitudeMode = WorldWind.CLAMP_TO_GROUND; + rotationLine.followTerrain = true; + + var pathAttributes = new ShapeAttributes(null); + pathAttributes.outlineColor = attributes.imageColor; + pathAttributes.outlineWidth = 2; + + rotationLine.attributes = pathAttributes; + + accessories.push(rotationLine); + }; + return BaseSurfaceEditorFragment; } ); \ No newline at end of file diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index c69268af1..8d1735370 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -32,6 +32,7 @@ define([ '../../geom/Position', '../../layer/RenderableLayer', '../../shapes/ShapeAttributes', + './ShapeEditorConstants', '../../shapes/SurfaceEllipse', './SurfaceEllipseEditorFragment', '../../shapes/SurfaceCircle', @@ -61,6 +62,7 @@ define([ Position, RenderableLayer, ShapeAttributes, + ShapeEditorConstants, SurfaceEllipse, SurfaceEllipseEditorFragment, SurfaceCircle, @@ -73,7 +75,7 @@ define([ SurfaceRectangleEditorFragment, SurfaceShape, Vec2, - Vec3) { + Vec3) { // FIXME Remove unnecessary items from this list "use strict"; /** @@ -98,722 +100,568 @@ define([ "missingWorldWindow")); } - /** - * The World Window associated with the shape editor controller. - * @type {WorldWindow} - */ - this.worldWindow = worldWindow; + this._worldWindow = worldWindow; - /** - * The shape associated with the editor. - * @type {Object} - */ - this.shape = null; + this._shape = null; - /** - * The layer holding the editor's control points. - * @type {RenderableLayer} - */ - this.controlPointLayer = new RenderableLayer(); + this._moveControlPointAttributes = new PlacemarkAttributes(null); + this._moveControlPointAttributes.imageColor = WorldWind.Color.BLUE; + this._moveControlPointAttributes.imageScale = 6; - /** - * The layer holding the rotation line. - * @type {RenderableLayer} - */ - this.accessoryLayer = new RenderableLayer(); - this.accessoryLayer.pickEnabled = false; + this._resizeControlPointAttributes = new PlacemarkAttributes(null); + this._resizeControlPointAttributes.imageColor = WorldWind.Color.CYAN; + this._resizeControlPointAttributes.imageScale = 6; - /** - * The layer holding the control point's annotation. - * @type {RenderableLayer} - */ - this.annotationLayer = new RenderableLayer(); + this._rotateControlPointAttributes = new PlacemarkAttributes(null); + this._rotateControlPointAttributes.imageColor = WorldWind.Color.GREEN; + this._rotateControlPointAttributes.imageScale = 6; + + this._annotationAttributes = new AnnotationAttributes(null); + this._annotationAttributes.altitudeMode = WorldWind.CLAMP_TO_GROUND; + this._annotationAttributes.cornerRadius = 5; + this._annotationAttributes.backgroundColor = new Color(0.67, 0.67, 0.67, 0.8); + this._annotationAttributes._leaderGapHeight = 0; + this._annotationAttributes.drawLeader = false; + this._annotationAttributes.scale = 1; + this._annotationAttributes._textAttributes.color = Color.BLACK; + this._annotationAttributes._textAttributes.font = new Font(10); + this._annotationAttributes.insets = new Insets(5, 5, 5, 5); + + //Internal use only. Intentionally not documented. + this.annotation = new WorldWind.Annotation(new WorldWind.Position(0, 0, 0), this._annotationAttributes); + + //Internal use only. Intentionally not documented. + this.editorFragments = [ + new SurfaceCircleEditorFragment(), + new SurfaceEllipseEditorFragment(), + new SurfacePolygonEditorFragment(), + new SurfacePolylineEditorFragment(), + new SurfaceRectangleEditorFragment() + ]; + + //Internal use only. Intentionally not documented. + this.controlPointsLayer = new RenderableLayer("Shape Editor Control Points"); + + //Internal use only. Intentionally not documented. + this.accessoriesLayer = new RenderableLayer("Shape Editor Accessories"); + this.accessoriesLayer.pickEnabled = false; + + //Internal use only. Intentionally not documented. + this.annotationLayer = new RenderableLayer("Shape Editor Annotation"); this.annotationLayer.pickEnabled = false; + this.annotationLayer.enabled = false; + this.annotationLayer.addRenderable(this.annotation); - /** - * The layer holding a shadow copy of the shape while the shape is being moved or sized. - * @type {RenderableLayer} - */ - this.shadowLayer = new RenderableLayer(); - this.shadowLayer.pickEnabled = false; + //Internal use only. Intentionally not documented. + this.shadowShapeLayer = new RenderableLayer("Shape Editor Shadow Shape"); + this.shadowShapeLayer.pickEnabled = false; - /** - * The control point annotation. - * @type {Annotation} - */ - this.annotation = null; + //Internal use only. Intentionally not documented. + this.activeEditorFragment = null; - /** - * Indicates whether the editor is ready for editing. - * @type {boolean} - */ - this.armed = false; + //Internal use only. Intentionally not documented. + this.actionType = null; - /** - * Indicates whether the editor is in the midst of an editing operation. - * @type {boolean} - */ - this.active = false; + //Internal use only. Intentionally not documented. + this.actionControlPoint = null; - /** - * The terrain position associated with the cursor during the just previous drag event. - * @type {Position} - */ - this.previousPosition = null; + //Internal use only. Intentionally not documented. + this.actionControlPosition = null; + + //Internal use only. Intentionally not documented. + this.actionSecondaryBehavior = false; + + //Internal use only. Intentionally not documented. + this.actionStartX = null; + + //Internal use only. Intentionally not documented. + this.actionStartY = null; + + //Internal use only. Intentionally not documented. + this.actionCurrentX = null; + //Internal use only. Intentionally not documented. + this.actionCurrentY = null; + + //Internal use only. Intentionally not documented. + this.originalHighlightAttributes = new ShapeAttributes(null); + + this._worldWindow.worldWindowController.addGestureListener(this); + }; + + Object.defineProperties(ShapeEditor.prototype, { /** - * The placemark associated with the current sizing operation. - * @type {Placemark} + * The World Window associated with this shape editor. + * @memberof ShapeEditor.prototype + * @type {WorldWindow} + * @readonly */ - this.currentSizingMarker = null; + worldWindow: { + get: function () { + return this._worldWindow; + } + }, /** - * The attributes associated with the shape when the editor is constructed. These are swapped out during - * editing operations in order to make the shape semi-transparent. - * @type {ShapeAttributes} + * The shape currently being edited. + * @memberof ShapeEditor.prototype + * @type {Object} + * @readonly */ - this.originalAttributes = new ShapeAttributes(null); + shape: { + get: function () { + return this._shape; + } + }, /** - * The highlight attributes associated with the shape when the editor is constructed. These are swapped out - * during editing operations in order to make the shape semi-transparent. - * @type {ShapeAttributes} + * Attribuets used for the control points that move the boundaries of the shape. + * @memberof ShapeEditor.prototype + * @type {PlacemarkAttributes} */ - this.originalHighlightAttributes = new ShapeAttributes(null); + moveControlPointAttributes: { + get: function () { + return this._moveControlPointAttributes; + }, + set: function (value) { + this._moveControlPointAttributes = value; + } + }, /** - * Attributes used to represent shape vertices. + * Attributes used for the control points that resize the shape. + * @memberof ShapeEditor.prototype * @type {PlacemarkAttributes} */ - this.locationControlPointAttributes = new PlacemarkAttributes(null); + resizeControlPointAttributes: { + get: function () { + return this._resizeControlPointAttributes; + }, + set: function (value) { + this._resizeControlPointAttributes = value; + } + }, /** - * Attributes used to represent shape size. + * Attributes used for the control points that rotate the shape. + * @memberof ShapeEditor.prototype * @type {PlacemarkAttributes} */ - this.sizeControlPointAttributes = new PlacemarkAttributes(null); + rotateControlPointAttributes: { + get: function () { + return this._rotateControlPointAttributes; + }, + set: function (value) { + this._rotateControlPointAttributes = value; + } + }, /** - * Attributes used to represent shape rotation. - * @type {PlacemarkAttributes} + * Attributes used for the annotation. + * @memberof ShapeEditor.prototype + * @type {AnnotationAttributes} */ - this.angleControlPointAttributes = new PlacemarkAttributes(null); + annotationAttributes: { + get: function () { + return this._annotationAttributes; + }, + set: function (value) { + this._annotationAttributes = value; + this.annotation.attributes = value; + } + } + }); - this.makeControlPointAttributes(); + /** + * Edits the specified shape. Currently, only surface shapes are supported. + * @param {SurfaceShape} shape The shape to edit. + * @return {Boolean} true if the editor could start the edition of the specified shape; otherwise + * false. + */ + ShapeEditor.prototype.edit = function (shape) { + this.stop(); - this.makeAnnotation(); + // Look for a fragment that can handle the specified shape + for (var i = 0, len = this.editorFragments.length; i < len; i++) { + var editorFragment = this.editorFragments[i]; + if (editorFragment.canHandle(shape)) { + this.activeEditorFragment = editorFragment; + } + } - //Internal use only. Intentionally not documented. - this.isDragging = false; + // If we have a fragment for this shape, accept the shape and start the edition + if (this.activeEditorFragment != null) { + this._shape = shape; + this.initializeControlElements(); + return true; + } - //Internal use only. Intentionally not documented. - this.startX = null; + return false; + }; - //Internal use only. Intentionally not documented. - this.startY = null; + /** + * Stops the current edition activity if any. + * @return {SurfaceShape} The shape being edited if any; otherwise null. + */ + ShapeEditor.prototype.stop = function () { + this.removeControlElements(); - //Internal use only. Intentionally not documented. - this.lastX = null; + var currentShape = this._shape; + this._shape = null; + return currentShape; + }; - //Internal use only. Intentionally not documented. - this.lastY = null; + // Called by {@link ShapeEditor#edit} to initialize the control elements used for editing. + ShapeEditor.prototype.initializeControlElements = function () { + if (this._worldWindow.indexOfLayer(this.shadowShapeLayer) == -1) { + this._worldWindow.insertLayer(0, this.shadowShapeLayer); + } - //Internal use only. Intentionally not documented. - this.currentEvent = null; + if (this._worldWindow.indexOfLayer(this.controlPointsLayer) == -1) { + this._worldWindow.addLayer(this.controlPointsLayer); + } - //Internal use only. Intentionally not documented. - this.activeEditorFragment = null; + if (this._worldWindow.indexOfLayer(this.accessoriesLayer) == -1) { + this._worldWindow.addLayer(this.accessoriesLayer); + } - this.editorFragments = [ - new SurfaceCircleEditorFragment(), - new SurfaceEllipseEditorFragment(), - new SurfacePolygonEditorFragment(), - new SurfacePolylineEditorFragment(), - new SurfaceRectangleEditorFragment() - ]; + if (this._worldWindow.indexOfLayer(this.annotationLayer) == -1) { + this._worldWindow.addLayer(this.annotationLayer); + } + + this.activeEditorFragment.initializeControlElements( + this._shape, + this.controlPointsLayer.renderables, + this.accessoriesLayer.renderables, + this._resizeControlPointAttributes, + this._rotateControlPointAttributes, + this._moveControlPointAttributes + ); - this.worldWindow.worldWindowController.addGestureListener(this); + this.updateControlElements(); }; - //Internal use only. Intentionally not documented. - ShapeEditor.prototype.handleMouseMove = function (event) { - var shapeEditor = this; + // Called by {@link ShapeEditor#stop} to remove the control elements used for editing. + ShapeEditor.prototype.removeControlElements = function () { + this._worldWindow.removeLayer(this.controlPointsLayer); + this.controlPointsLayer.removeAllRenderables(); - if(this.shape === null) - return; + this._worldWindow.removeLayer(this.accessoriesLayer); + this.accessoriesLayer.removeAllRenderables(); - if (shapeEditor.isDragging === false) { - return; - } - - var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); - var terrainObject; + this._worldWindow.removeLayer(this.shadowShapeLayer); + this.shadowShapeLayer.removeAllRenderables(); - if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); - } + this._worldWindow.removeLayer(this.annotationLayer); + }; - if (!terrainObject) { + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.onGestureEvent = function (event) { + if(this._shape === null) { return; } - if (shapeEditor.currentSizingMarker instanceof Placemark && - shapeEditor.currentSizingMarker.userProperties.isControlPoint) { - shapeEditor.reshapeShape(terrainObject); - shapeEditor.updateControlPoints(); - } - else if (shapeEditor.shape instanceof SurfaceShape) { - shapeEditor.dragWholeShape(event); - shapeEditor.updateControlPoints(); - shapeEditor.updateShapeAnnotation(); + if (event.type === "pointerup" || event.type === "mouseup") { + this.handleMouseUp(event); + } else if (event.type === "pointerdown" || event.type === "mousedown") { + this.handleMouseDown(event); + } else if (event.type === "pointermove" || event.type === "mousemove") { + this.handleMouseMove(event); } - - event.preventDefault(); }; //Internal use only. Intentionally not documented. ShapeEditor.prototype.handleMouseDown = function (event) { - var shapeEditor = this; + var x = event.clientX, + y = event.clientY; - if(this.shape === null) - return; + this.actionStartX = x; + this.actionStartY = y; + this.actionCurrentX = x; + this.actionCurrentY = y; - shapeEditor.currentEvent = event; + var mousePoint = this._worldWindow.canvasCoordinates(x, y); + var pickList = this._worldWindow.pick(mousePoint); - var x = event.clientX, - y = event.clientY; + for (var p = 0, len = pickList.objects.length; p < len; p++) { + var object = pickList.objects[p]; - shapeEditor.startX = x; - shapeEditor.startY = y; - shapeEditor.lastX = x; - shapeEditor.lastY = y; - - var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); - - if (pickList.objects.length > 0) { - for (var p = 0; p < pickList.objects.length; p++) { - if (!pickList.objects[p].isTerrain) { - if (shapeEditor.shape && pickList.objects[p].userObject === shapeEditor.shape) { - event.preventDefault(); - shapeEditor.isDragging = true; - shapeEditor.originalAttributes = shapeEditor.shape.attributes; - shapeEditor.originalHighlightAttributes = shapeEditor.shape.highlightAttributes; - shapeEditor.makeShadowShape(); - - //set previous position - shapeEditor.setPreviousPosition(event); - } - else if (pickList.objects[p].userObject instanceof Placemark && - pickList.objects[p].userObject.userProperties.isControlPoint) { - event.preventDefault(); - shapeEditor.currentSizingMarker = pickList.objects[p].userObject; - shapeEditor.isDragging = true; - shapeEditor.originalAttributes = shapeEditor.shape.attributes; - shapeEditor.originalHighlightAttributes = shapeEditor.shape.highlightAttributes; - shapeEditor.makeShadowShape(); - - //set previous position - shapeEditor.setPreviousPosition(event); - } + if (!object.isTerrain) { + var userObject = object.userObject; + var terrainObject = pickList.terrainObject(); + + if (userObject === this._shape) { + this.beginAction(terrainObject.position, event.altKey); + event.preventDefault(); + break; + + } else if (userObject instanceof Placemark && userObject.userProperties.isControlPoint) { + this.beginAction(terrainObject.position, event.altKey, userObject); + event.preventDefault(); + break; } } } }; - //Internal use only. Intentionally not documented. - ShapeEditor.prototype.handleMouseUp = function (event) { - var shapeEditor = this; + // Internal use only. Intentionally not documented. + ShapeEditor.prototype.handleMouseMove = function (event) { + if (this.actionType) { - if(this.shape === null) - return; + var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); + var terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); - var x = event.clientX, - y = event.clientY; + if (terrainObject) { + if (this.actionType === ShapeEditorConstants.DRAG) { + this.drag(event.clientX, event.clientY); - if (shapeEditor.shape && shapeEditor.shadowLayer.renderables.length > 0) { - shapeEditor.removeShadowShape(); - shapeEditor.updateAnnotation(null); + } else { + this.reshape(terrainObject.position); + } + + event.preventDefault(); + } } + }; - if (shapeEditor.currentSizingMarker instanceof Placemark && - shapeEditor.currentSizingMarker.userProperties.isControlPoint) { - if (event.altKey) { - var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, event.clientY); - var terrainObject; + //Internal use only. Intentionally not documented. + ShapeEditor.prototype.handleMouseUp = function (event) { + var x = event.clientX, + y = event.clientY; - if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint).terrainObject(); - } + if (this.actionType) { + if (this.actionControlPoint) { + if (event.altKey) { // FIXME What is this for? + var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); + var terrainObject; - if (terrainObject) { - shapeEditor.reshapeShape(terrainObject); - shapeEditor.updateControlPoints(); - shapeEditor.updateAnnotation(null); + if (this._worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); + } + + if (terrainObject) { + this.reshape(terrainObject.position); + } } } - shapeEditor.isDragging = false; - shapeEditor.currentSizingMarker = null; - return; - } - var redrawRequired = false; - - var pickList = shapeEditor.worldWindow.pick(shapeEditor.worldWindow.canvasCoordinates(x, y)); - if (pickList.objects.length > 0) { - for (var p = 0; p < pickList.objects.length; p++) { - if (!pickList.objects[p].isTerrain) { - if (shapeEditor.startX === shapeEditor.lastX && - shapeEditor.startY === shapeEditor.lastY) { - if (event.shiftKey) { - var mousePoint = shapeEditor.worldWindow.canvasCoordinates(event.clientX, - event.clientY); - var terrainObject; - - if (shapeEditor.worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = shapeEditor.worldWindow.pickTerrain(mousePoint) - .terrainObject(); - } + this.endAction(); - if (terrainObject) { - shapeEditor.addNearestLocation(terrainObject.position, 0, - shapeEditor.shape.boundaries); + } else { + var pickList = this._worldWindow.pick(this._worldWindow.canvasCoordinates(x, y)); + if (pickList.objects.length > 0) { + for (var p = 0, len = pickList.objects.length; p < len; p++) { + if (!pickList.objects[p].isTerrain) { + if (this.actionStartX === this.actionCurrentX && + this.actionStartY === this.actionCurrentY) { // FIXME Is this check needed? + if (event.shiftKey) { + var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); + var terrainObject; + + if (this._worldWindow.viewport.containsPoint(mousePoint)) { + terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); + } + + if (terrainObject) { + this.addNewControlPoint(terrainObject.position, 0, this._shape.boundaries); + break; + } } } } - - redrawRequired = true; - break; } } } - - shapeEditor.isDragging = false; - shapeEditor.currentSizingMarker = null; - - // Update the window if we changed anything. - if (redrawRequired) { - shapeEditor.worldWindow.redraw(); - } }; - //Internal use only. Intentionally not documented. - ShapeEditor.prototype.onGestureEvent = function (event) { - if (!this.armed) { - return; + ShapeEditor.prototype.beginAction = function (initialPosition, alternateAction, controlPoint) { + // Define the active transformation + if (controlPoint) { + this.actionType = controlPoint.userProperties.purpose; + } else { + this.actionType = ShapeEditorConstants.DRAG; } + this.actionControlPoint = controlPoint; + this.actionControlPosition = initialPosition; + this.actionSecondaryBehavior = alternateAction; - try { - if (event.type === "pointerup" || event.type === "mouseup") { - this.handleMouseUp(event); - } else if (event.type === "pointerdown" || event.type === "mousedown") { - this.handleMouseDown(event); - } else if (event.type === "pointermove" || event.type === "mousemove") { - this.handleMouseMove(event); - } - } catch (error) { - console.log(error); // FIXME Remove this - Logger.logMessage(Logger.LEVEL_SEVERE, "ShapeEditor", "handleEvent", - "Error handling event.\n" + error.toString()); - } - }; + // Place a shadow shape at the original location of the shape + this.originalHighlightAttributes = this._shape.highlightAttributes; - /** - * Remove the control points. - */ - ShapeEditor.prototype.removeControlPoints = function () { - this.controlPointLayer.removeAllRenderables(); - }; + var editingAttributes = new ShapeAttributes(this.originalHighlightAttributes); + editingAttributes.interiorColor.alpha = editingAttributes.interiorColor.alpha * 0.7; - /** - * Creates and returns the stationary shape displayed during editing operations. - * @returns {SurfaceShape} The new shadow shape created, or null if the shape type is not recognized. - */ - ShapeEditor.prototype.doMakeShadowShape = function () { - return this.activeEditorFragment.createShadowShape(this.shape); - }; + var shadowShape = this.activeEditorFragment.createShadowShape(this._shape); + shadowShape.highlightAttributes = new ShapeAttributes(this.originalHighlightAttributes); + shadowShape.highlighted = true; - /** - * Creates the shape that will remain at the same location and is the same size as the shape to be edited. - */ - ShapeEditor.prototype.makeShadowShape = function () { - var shadowShape = this.doMakeShadowShape(); - if (shadowShape == null) { - return; - } + this.shadowShapeLayer.addRenderable(shadowShape); - var editingAttributes = new ShapeAttributes(this.originalHighlightAttributes); + this._worldWindow.redraw(); + }; - if (editingAttributes.interiorColor.alpha === 1) { - editingAttributes.interiorColor.alpha = 0.7; - } + ShapeEditor.prototype.endAction = function () { + this.shadowShapeLayer.removeAllRenderables(); - this.shape.highlightAttributes = editingAttributes; + this._shape.highlightAttributes = this.originalHighlightAttributes; + + this.hideAnnotation(); - shadowShape.highlighted = true; - shadowShape.highlightAttributes = new ShapeAttributes(this.originalHighlightAttributes); + this.actionControlPoint = null; + this.actionType = null; + this.actionControlPosition = null; - this.shadowLayer.addRenderable(shadowShape); - this.worldWindow.redraw(); + this._worldWindow.redraw(); }; - /** - * Remove the shadow shape. - */ - ShapeEditor.prototype.removeShadowShape = function () { - this.shadowLayer.removeAllRenderables(); + ShapeEditor.prototype.reshape = function (newPosition) { + this.activeEditorFragment.reshape( + this._shape, + this._worldWindow.globe, + this.actionControlPoint, + newPosition, + this.actionControlPosition, + this.actionSecondaryBehavior + ); - // Restore the original highlight attributes. - this.shape.highlightAttributes = this.originalHighlightAttributes; + this.actionControlPosition = newPosition; - this.worldWindow.redraw(); - }; + this.updateControlElements(); + this.updateAnnotation(this.actionControlPoint); - /** - * Set up the Annotation. - */ - ShapeEditor.prototype.makeAnnotation = function () { - var annotationAttributes = new AnnotationAttributes(null); - annotationAttributes.altitudeMode = WorldWind.CLAMP_TO_GROUND; - annotationAttributes.cornerRadius = 5; - annotationAttributes.backgroundColor = new Color(0.67, 0.67, 0.67, 0.8); - annotationAttributes._leaderGapHeight = 0; - annotationAttributes.drawLeader = false; - annotationAttributes.scale = 1; - annotationAttributes._textAttributes.color = Color.BLACK; - annotationAttributes._textAttributes.font = new Font(10); - annotationAttributes.insets = new Insets(5, 5, 5, 5); - - this.annotation = new WorldWind.Annotation( - new WorldWind.Position(0, 0, 0), annotationAttributes); - this.annotation.text = ""; - this.annotationLayer.addRenderable(this.annotation); - this.annotationLayer.enabled = false; + this._worldWindow.redraw(); }; - /** - * Updates the annotation indicating the edited shape's center. If the shape has no designated center, this - * method prevents the annotation from displaying. - */ - ShapeEditor.prototype.updateShapeAnnotation = function () { - var center = this.getShapeCenter(); + ShapeEditor.prototype.drag = function (clientX, clientY) { + // FIXME To be reviewed + var refPos = this._shape.getReferencePosition(); - if (center != null) { - var dummyMarker = new Placemark( - new Position(center.latitude, center.longitude, 0), - null); - dummyMarker.userProperties.isControlPoint = true; - dummyMarker.userProperties.id = 0; - dummyMarker.userProperties.purpose = ShapeEditor.ANNOTATION; - this.updateAnnotation(dummyMarker); - } - else { - this.updateAnnotation(null); - } - }; + var refPoint = this._worldWindow.globe.computePointFromPosition( + refPos.latitude, + refPos.longitude, + 0, + new Vec3(0, 0, 0) + ); - /** - * Remove the annotation. - */ - ShapeEditor.prototype.removeAnnotation = function () { - this.annotationLayer.removeAllRenderables(); - }; + var screenRefPoint = new Vec3(0, 0, 0); + this._worldWindow.drawContext.project(refPoint, screenRefPoint); - ShapeEditor.prototype.makeControlPointAttributes = function () { - this.locationControlPointAttributes.imageColor = WorldWind.Color.BLUE; - this.locationControlPointAttributes.imageScale = 6; + var dx = clientX - this.actionCurrentX; + var dy = clientY - this.actionCurrentY; - this.sizeControlPointAttributes.imageColor = WorldWind.Color.CYAN; - this.sizeControlPointAttributes.imageScale = 6; + this.actionCurrentX = clientX; + this.actionCurrentY = clientY; - this.angleControlPointAttributes.imageColor = WorldWind.Color.GREEN; - this.angleControlPointAttributes.imageScale = 6; - }; + // Find intersection of the screen coordinates ref-point with globe + var x = screenRefPoint[0] + dx; + var y = this._worldWindow.canvas.height - screenRefPoint[1] + dy; - /** - * Enables the ShapeEditor for the specified shape. - * @param {SurfaceShape} shape The shape that will be edited. - * @throws {ArgumentError} If the specified shape is null or not an instance of SurfaceShape. - */ - ShapeEditor.prototype.edit = function (shape) { - this.activeEditorFragment = null; - for (var i = 0; i < this.editorFragments.length; i++) { - if (this.editorFragments[i].canEdit(shape)) { - this.activeEditorFragment = this.editorFragments[i]; - } - } + var ray = this._worldWindow.rayThroughScreenPoint(new Vec2(x, y)); - if (this.activeEditorFragment != null) { - this.shape = shape; - this.enable(); - this.armed = true; - } else { - this.stop(); - throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "ShapeEditor", "edit", - "missingShape")); + var intersection = new Vec3(0, 0, 0); + if (this._worldWindow.globe.intersectsLine(ray, intersection)) { + var p = new Position(0, 0, 0); + this._worldWindow.globe.computePositionFromPoint(intersection[0], intersection[1], + intersection[2], p); + this._shape.moveTo(this._worldWindow.globe, new WorldWind.Location(p.latitude, p.longitude)); } + + this.updateControlElements(); + this.updateShapeAnnotation(); + + this._worldWindow.redraw(); }; - /** - * Stops the editing action and cleans up the allocated resources. - */ - ShapeEditor.prototype.stop = function () { - this.disable(); - this.shape = null; - this.armed = false; + ShapeEditor.prototype.updateControlElements = function () { + this.activeEditorFragment.updateControlElements( + this._shape, + this._worldWindow.globe, + this.controlPointsLayer.renderables, + this.accessoriesLayer.renderables + ); }; - /** - * Called by {@link ShapeEditor#edit} to enable resources used for editing. - */ - ShapeEditor.prototype.enable = function () { - if (this.worldWindow.indexOfLayer(this.controlPointLayer) == -1) { - this.worldWindow.addLayer(this.controlPointLayer); - } + ShapeEditor.prototype.updateAnnotation = function (controlPoint) { + this.annotationLayer.enabled = true; - if (this.worldWindow.indexOfLayer(this.accessoryLayer) == -1) { - this.worldWindow.addLayer(this.accessoryLayer); - } - this.makeAccessory(); + this.annotation.position = new Position( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0 + ); - if (this.worldWindow.indexOfLayer(this.annotationLayer) == -1) { - this.worldWindow.addLayer(this.annotationLayer); + var annotationText; + if (controlPoint.userProperties.size !== undefined) { + annotationText = this.formatLength(controlPoint.userProperties.size); } - - if (this.worldWindow.indexOfLayer(this.shadowLayer) == -1) { - this.worldWindow.insertLayer(0, this.shadowLayer); + else if (controlPoint.userProperties.rotation !== undefined) { + annotationText = this.formatRotation(controlPoint.userProperties.rotation); } - - this.updateControlPoints(); + else { + annotationText = this.formatLatitude(controlPoint.position.latitude) + + " " + + this.formatLongitude(controlPoint.position.longitude); + } + this.annotation.text = annotationText; }; - /** - * Called by {@link ShapeEditor#stop} to remove resources no longer needed after editing. - */ - ShapeEditor.prototype.disable = function () { - this.removeControlPoints(); - this.worldWindow.removeLayer(this.controlPointLayer); + ShapeEditor.prototype.hideAnnotation = function (controlPoint) { + this.annotationLayer.enabled = false; + }; - this.removeAccessory(); - this.worldWindow.removeLayer(this.accessoryLayer); + ShapeEditor.prototype.updateShapeAnnotation = function () { + var center = this.activeEditorFragment.getShapeCenter(this._shape); - this.worldWindow.removeLayer(this.annotationLayer); + if (center !== null) { + var dummyMarker = new Placemark( + new Position(center.latitude, center.longitude, 0), + null + ); + dummyMarker.userProperties.isControlPoint = true; + dummyMarker.userProperties.id = 0; + dummyMarker.userProperties.purpose = ShapeEditor.ANNOTATION; + this.updateAnnotation(dummyMarker); - this.worldWindow.removeLayer(this.shadowLayer); + } else { + this.hideAnnotation(); + } }; - //Internal use only. Intentionally not documented. ShapeEditor.prototype.formatLatitude = function (number) { var suffix = number < 0 ? "\u00b0S" : "\u00b0N"; return Math.abs(number).toFixed(4) + suffix; }; - //Internal use only. Intentionally not documented. ShapeEditor.prototype.formatLongitude = function (number) { var suffix = number < 0 ? "\u00b0W" : "\u00b0E"; return Math.abs(number).toFixed(4) + suffix; }; - //Internal use only. Intentionally not documented. ShapeEditor.prototype.formatLength = function (number) { var suffix = " km"; return Math.abs(number / 1000.0).toFixed(3) + suffix; }; - //Internal use only. Intentionally not documented. ShapeEditor.prototype.formatRotation = function (rotation) { return rotation.toFixed(4) + "°"; }; - ShapeEditor.prototype.updateControlPoints = function () { - this.activeEditorFragment.updateControlPoints( - this.shape, - this.worldWindow.globe, - this.controlPointLayer.renderables, - this.accessoryLayer.renderables, - this.sizeControlPointAttributes, - this.angleControlPointAttributes, - this.locationControlPointAttributes - ); - }; - /** - * Set up the Path for the rotation line. - */ - ShapeEditor.prototype.makeAccessory = function () { - var pathPositions = []; - pathPositions.push(new Position(0, 0, 0)); - pathPositions.push(new Position(0, 0, 0)); - var rotationLine = new Path(pathPositions, null); - rotationLine.altitudeMode = WorldWind.CLAMP_TO_GROUND; - rotationLine.followTerrain = true; - - var pathAttributes = new ShapeAttributes(null); - pathAttributes.outlineColor = Color.GREEN; - pathAttributes.outlineWidth = 2; - rotationLine.attributes = pathAttributes; - - this.accessoryLayer.addRenderable(rotationLine); - }; - /** - * Remove the orientation line. - */ - ShapeEditor.prototype.removeAccessory = function () { - this.accessoryLayer.removeAllRenderables(); - }; - /** - * Moves the entire shape according to a specified event. - * @param {Event} event - */ - ShapeEditor.prototype.dragWholeShape = function (event) { - var refPos = this.shape.getReferencePosition(); - if (refPos === null) { - return; - } - var refPoint = new Vec3(0, 0, 0); - this.worldWindow.globe.computePointFromPosition(refPos.latitude, refPos.longitude, 0, - refPoint); - var screenRefPoint = new Vec3(0, 0, 0); - this.worldWindow.drawContext.project(refPoint, screenRefPoint); - // Compute screen-coord delta since last event. - var dx = event.clientX - this.lastX; - var dy = event.clientY - this.lastY; - this.lastX = event.clientX; - this.lastY = event.clientY; - // Find intersection of screen coord ref-point with globe. - var x = screenRefPoint[0] + dx; - var y = this.worldWindow.canvas.height - screenRefPoint[1] + dy; - var ray = this.worldWindow.rayThroughScreenPoint(new Vec2(x, y)); - var intersection = new Vec3(0, 0, 0); - if (this.worldWindow.globe.intersectsLine(ray, intersection)) { - var p = new Position(0, 0, 0); - this.worldWindow.globe.computePositionFromPoint(intersection[0], intersection[1], - intersection[2], p); - this.shape.moveTo(this.worldWindow.globe, new WorldWind.Location(p.latitude, p.longitude)); - } - }; - /** - * Modifies the shape's locations, size or rotation. This method is called when a control point is dragged. - * - * @param {PickedObject} terrainObject The terrain object. - */ - ShapeEditor.prototype.reshapeShape = function (terrainObject) { - if (!this.previousPosition) { - this.previousPosition = terrainObject.position; - return; - } - this.doReshapeShape(this.currentSizingMarker, terrainObject.position); - this.previousPosition = terrainObject.position; - }; - /** - * Called by {@link ShapeEditor#reshapeShape} to perform the actual shape modification. - * Subclasses should override this method if they provide editing for shapes other than those supported by - * the basic editor. - * - * @param {Placemark} controlPoint The control point selected. - * @param {Position} terrainPosition The terrain position under the cursor. - */ - ShapeEditor.prototype.doReshapeShape = function (controlPoint, terrainPosition) { - if (!controlPoint) { - return; - } - this.activeEditorFragment.reshape( - this.shape, - this.worldWindow.globe, - controlPoint, - terrainPosition, - this.previousPosition, - this.currentEvent - ); - this.updateAnnotation(controlPoint); - this.currentSizingMarker.position = terrainPosition; - this.worldWindow.redraw(); - }; - /** - * - * @returns {Location} The shape's center location, or null if the shape has no designated center. - */ - ShapeEditor.prototype.getShapeCenter = function () { - var center = null; - if (this.shape instanceof SurfaceEllipse || this.shape instanceof SurfaceRectangle) { - center = this.shape.center; - } - - return center; - }; - - /** - * Updates the annotation associated with a specified control point. - * @param {Placemark} controlPoint The control point. - */ - ShapeEditor.prototype.updateAnnotation = function (controlPoint) { - if (!controlPoint) { - this.annotationLayer.enabled = false; - return; - } - - this.annotationLayer.enabled = true; - this.annotation.position = new Position( - controlPoint.position.latitude, - controlPoint.position.longitude, - 0 - ); - - var annotationText; - if (controlPoint.userProperties.size !== undefined) { - annotationText = this.formatLength(controlPoint.userProperties.size); - } - else if (controlPoint.userProperties.rotation !== undefined) { - annotationText = this.formatRotation(controlPoint.userProperties.rotation); - } - else { - annotationText = this.formatLatitude(controlPoint.position.latitude) + " " + - this.formatLongitude(controlPoint.position.longitude); - } - - this.annotation.text = annotationText; - }; - - /** - * Computes the point on a specified line segment that is nearest a specified point. - * - * @param {Vec3} p1 The line's first point. - * @param {Vec3} p2 The line's second point. - * @param {Vec3} point The point for which to determine a nearest point on the line segment. - * @returns {Vec3} The nearest point on the line segment. - */ - ShapeEditor.prototype.nearestPointOnSegment = function (p1, p2, point) { - var segment = p2.subtract(p1); - - var segmentCopy = new Vec3(0, 0, 0); - segmentCopy.copy(segment); - var dir = segmentCopy.normalize(); - - var dot = point.subtract(p1).dot(dir); - if (dot < 0.0) { - return p1; - } - else if (dot > segment.magnitude()) { - return p2; - } - else { - return Vec3.fromLine(p1, dot, dir); // FIXME This is broken - } - }; /** * Inserts the location nearest to a specified position on an edge of a specified list of locations into the @@ -824,8 +672,8 @@ define([ * @param {Location[]} locations The list of locations. This list is modified by this method to contain the new * location on an edge nearest the specified terrain position. */ - ShapeEditor.prototype.addNearestLocation = function (terrainPosition, altitude, locations) { - var globe = this.worldWindow.globe; + ShapeEditor.prototype.addNewControlPoint = function (terrainPosition, altitude, locations) { + var globe = this._worldWindow.globe; // Find the nearest edge to the picked point and insert a new position on that edge. var pointPicked = globe.computePointFromPosition( @@ -841,7 +689,7 @@ define([ for (var i = 1; i <= locations.length; i++) // <= is intentional, to handle the closing segment { // Skip the closing segment if the shape is not a polygon. - if (!(this.shape instanceof SurfacePolygon ) && i == locations.length) { + if (!(this._shape instanceof SurfacePolygon ) && i == locations.length) { continue; } @@ -855,7 +703,7 @@ define([ new Vec3(0, 0, 0) ); - var pointB = this.worldWindow.globe.computePointFromPosition( + var pointB = this._worldWindow.globe.computePointFromPosition( locationB.latitude, locationB.longitude, altitude, @@ -874,7 +722,7 @@ define([ if (nearestPoint) { // Compute the location of the nearest point and add it to the shape. - var nearestLocation = this.worldWindow.globe.computePositionFromPoint( + var nearestLocation = this._worldWindow.globe.computePositionFromPoint( nearestPoint[0], nearestPoint[1], nearestPoint[2], @@ -887,23 +735,37 @@ define([ locations.splice(nearestSegmentIndex, 0, nearestLocation); this.removeControlPoints(); - this.shape.boundaries = locations; - this.updateControlPoints(); + this._shape.boundaries = locations; + this.updateControlElements(); } }; - ShapeEditor.prototype.setPreviousPosition = function (event) { - var mousePoint = this.worldWindow.canvasCoordinates(event.clientX, - event.clientY); - if (this.worldWindow.viewport.containsPoint(mousePoint)) { - var terrainObject = this.worldWindow.pickTerrain(mousePoint).terrainObject(); - if (terrainObject) { - this.previousPosition = new Position( - terrainObject.position.latitude, - terrainObject.position.longitude, - terrainObject.position.altitude - ); - } + + + /** + * Computes the point on a specified line segment that is nearest a specified point. + * + * @param {Vec3} p1 The line's first point. + * @param {Vec3} p2 The line's second point. + * @param {Vec3} point The point for which to determine a nearest point on the line segment. + * @returns {Vec3} The nearest point on the line segment. + */ + ShapeEditor.prototype.nearestPointOnSegment = function (p1, p2, point) { + var segment = p2.subtract(p1); + + var segmentCopy = new Vec3(0, 0, 0); + segmentCopy.copy(segment); + var dir = segmentCopy.normalize(); + + var dot = point.subtract(p1).dot(dir); + if (dot < 0.0) { + return p1; + } + else if (dot > segment.magnitude()) { + return p2; + } + else { + return Vec3.fromLine(p1, dot, dir); // FIXME This is broken } }; diff --git a/src/util/editor/ShapeEditorConstants.js b/src/util/editor/ShapeEditorConstants.js index 2a9af2942..f8a6cda2d 100644 --- a/src/util/editor/ShapeEditorConstants.js +++ b/src/util/editor/ShapeEditorConstants.js @@ -43,7 +43,9 @@ define([], RIGHT_WIDTH: "rightWidth", // Indicates that a control point is associated with the outer radius of a shape. - OUTER_RADIUS: "outerRadius" + OUTER_RADIUS: "outerRadius", + + DRAG: "drag" }; return ShapeEditorConstants; diff --git a/src/util/editor/SurfaceCircleEditorFragment.js b/src/util/editor/SurfaceCircleEditorFragment.js index 04dad67c1..65d4548b1 100644 --- a/src/util/editor/SurfaceCircleEditorFragment.js +++ b/src/util/editor/SurfaceCircleEditorFragment.js @@ -38,7 +38,7 @@ define([ SurfaceCircleEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); //Internal use only. Intentionally not documented. - SurfaceCircleEditorFragment.prototype.canEdit = function (shape) { + SurfaceCircleEditorFragment.prototype.canHandle = function (shape) { return shape instanceof SurfaceCircle; }; @@ -48,7 +48,29 @@ define([ }; //Internal use only. Intentionally not documented. - SurfaceCircleEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, currentEvent) { + SurfaceCircleEditorFragment.prototype.getShapeCenter = function (shape) { + return shape.center; + }; + + //Internal use only. Intentionally not documented. + SurfaceCircleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + var controlPoint = new Placemark( + Location.ZERO, + false, + sizeControlPointAttributes + ); + + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.size = shape.radius; + controlPoint.userProperties.id = 0; + controlPoint.userProperties.purpose = ShapeEditorConstants.OUTER_RADIUS; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + + controlPoints.push(controlPoint); + }; + + //Internal use only. Intentionally not documented. + SurfaceCircleEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, alternateAction) { var delta = this.computeControlPointDelta(globe, previousPosition, terrainPosition); var centerPoint = globe.computePointFromPosition( shape.center.latitude, @@ -72,29 +94,14 @@ define([ }; //Internal use only. Intentionally not documented. - SurfaceCircleEditorFragment.prototype.updateControlPoints = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + SurfaceCircleEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, accessories) { var radiusLocation = Location.greatCircleLocation( shape.center, 90, shape.radius / globe.equatorialRadius, new Location(0, 0)); - if (controlPoints.length > 0) { - controlPoints[0].position = radiusLocation; - } - else { - var controlPoint = new Placemark( - radiusLocation, - false, - sizeControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 0; - controlPoint.userProperties.purpose = ShapeEditorConstants.OUTER_RADIUS; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - } - + controlPoints[0].position = radiusLocation; controlPoints[0].userProperties.size = shape.radius; }; diff --git a/src/util/editor/SurfaceEllipseEditorFragment.js b/src/util/editor/SurfaceEllipseEditorFragment.js index 91c21543f..4561c0acc 100644 --- a/src/util/editor/SurfaceEllipseEditorFragment.js +++ b/src/util/editor/SurfaceEllipseEditorFragment.js @@ -38,7 +38,7 @@ define([ SurfaceEllipseEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); //Internal use only. Intentionally not documented. - SurfaceEllipseEditorFragment.prototype.canEdit = function (shape) { + SurfaceEllipseEditorFragment.prototype.canHandle = function (shape) { return shape instanceof SurfaceEllipse; }; @@ -54,7 +54,52 @@ define([ }; //Internal use only. Intentionally not documented. - SurfaceEllipseEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, currentEvent) { + SurfaceEllipseEditorFragment.prototype.getShapeCenter = function (shape) { + return shape.center; + }; + + //Internal use only. Intentionally not documented. + SurfaceEllipseEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + var controlPoint; + + controlPoint = new Placemark( + Location.ZERO, + false, + sizeControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 0; + controlPoint.userProperties.purpose = ShapeEditorConstants.WIDTH; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + + controlPoint = new Placemark( + Location.ZERO, + false, + sizeControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 1; + controlPoint.userProperties.purpose = ShapeEditorConstants.HEIGHT; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + + controlPoint = new Placemark( + Location.ZERO, + false, + angleControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 2; + controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + + this.makeAccessory(accessories, angleControlPointAttributes); + }; + + //Internal use only. Intentionally not documented. + SurfaceEllipseEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, alternateAction) { var terrainPoint = globe.computePointFromPosition( terrainPosition.latitude, terrainPosition.longitude, @@ -100,7 +145,7 @@ define([ }; //Internal use only. Intentionally not documented. - SurfaceEllipseEditorFragment.prototype.updateControlPoints = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + SurfaceEllipseEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, accessories) { var majorLocation = Location.greatCircleLocation( shape.center, 90 + shape.heading, @@ -120,50 +165,13 @@ define([ new Location(0, 0) ); - if (controlPoints.length > 0) { - controlPoints[0].position = majorLocation; - controlPoints[1].position = minorLocation; - controlPoints[2].position = rotationLocation; - } - else { - var controlPoint; - - controlPoint = new Placemark( - majorLocation, - false, - sizeControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 0; - controlPoint.userProperties.purpose = ShapeEditorConstants.WIDTH; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - - controlPoint = new Placemark( - minorLocation, - false, - sizeControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 1; - controlPoint.userProperties.purpose = ShapeEditorConstants.HEIGHT; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - - controlPoint = new Placemark( - rotationLocation, - false, - angleControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 2; - controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - } - + controlPoints[0].position = majorLocation; controlPoints[0].userProperties.size = shape.majorRadius; + + controlPoints[1].position = minorLocation; controlPoints[1].userProperties.size = shape.minorRadius; + + controlPoints[2].position = rotationLocation; controlPoints[2].userProperties.rotation = shape.heading; this.updateOrientationLine(shape.center, rotationLocation, accessories); diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index 59d667810..93d1bffab 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -42,7 +42,7 @@ define([ SurfacePolygonEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); //Internal use only. Intentionally not documented. - SurfacePolygonEditorFragment.prototype.canEdit = function (shape) { + SurfacePolygonEditorFragment.prototype.canHandle = function (shape) { return shape instanceof SurfacePolygon; }; @@ -52,7 +52,12 @@ define([ }; //Internal use only. Intentionally not documented. - SurfacePolygonEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, currentEvent) { + SurfacePolygonEditorFragment.prototype.getShapeCenter = function (shape) { + return null; + }; + + //Internal use only. Intentionally not documented. + SurfacePolygonEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, alternateAction) { var boundaries = shape.boundaries; var k = 0; diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index 15a9797bd..a5aad5b73 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -38,7 +38,7 @@ define([ SurfacePolylineEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); //Internal use only. Intentionally not documented. - SurfacePolylineEditorFragment.prototype.canEdit = function (shape) { + SurfacePolylineEditorFragment.prototype.canHandle = function (shape) { return shape instanceof SurfacePolyline; }; @@ -48,7 +48,12 @@ define([ }; //Internal use only. Intentionally not documented. - SurfacePolylineEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, currentEvent) { + SurfacePolylineEditorFragment.prototype.getShapeCenter = function (shape) { + return null; + }; + + //Internal use only. Intentionally not documented. + SurfacePolylineEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, alternateAction) { var delta = this.computeControlPointDelta(globe, previousPosition, terrainPosition); var centerPoint = globe.computePointFromPosition( shape.center.latitude, diff --git a/src/util/editor/SurfaceRectangleEditorFragment.js b/src/util/editor/SurfaceRectangleEditorFragment.js index 6cb7b69ed..45f460e0d 100644 --- a/src/util/editor/SurfaceRectangleEditorFragment.js +++ b/src/util/editor/SurfaceRectangleEditorFragment.js @@ -38,7 +38,7 @@ define([ SurfaceRectangleEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); //Internal use only. Intentionally not documented. - SurfaceRectangleEditorFragment.prototype.canEdit = function (shape) { + SurfaceRectangleEditorFragment.prototype.canHandle = function (shape) { return shape instanceof SurfaceRectangle; }; @@ -54,7 +54,52 @@ define([ }; //Internal use only. Intentionally not documented. - SurfaceRectangleEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, currentEvent) { + SurfaceRectangleEditorFragment.prototype.getShapeCenter = function (shape) { + return null; + }; + + //Internal use only. Intentionally not documented. + SurfaceRectangleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + var controlPoint; + + controlPoint = new Placemark( + Location.ZERO, + false, + sizeControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 0; + controlPoint.userProperties.purpose = ShapeEditorConstants.WIDTH; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + + controlPoint = new Placemark( + Location.ZERO, + false, + sizeControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 1; + controlPoint.userProperties.purpose = ShapeEditorConstants.HEIGHT; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + + controlPoint = new Placemark( + Location.ZERO, + false, + angleControlPointAttributes + ); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = 1; + controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + + this.makeAccessory(accessories, angleControlPointAttributes); + }; + + //Internal use only. Intentionally not documented. + SurfaceRectangleEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, alternateAction) { var terrainPoint = globe.computePointFromPosition( terrainPosition.latitude, terrainPosition.longitude, @@ -101,7 +146,7 @@ define([ }; //Internal use only. Intentionally not documented. - SurfaceRectangleEditorFragment.prototype.updateControlPoints = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + SurfaceRectangleEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { var widthLocation = Location.greatCircleLocation( shape.center, 90 + shape.heading, @@ -120,50 +165,13 @@ define([ 0.7 * shape.height / globe.equatorialRadius, new Location(0, 0)); - if (controlPoints.length > 0) { - controlPoints[0].position = widthLocation; - controlPoints[1].position = heightLocation; - controlPoints[2].position = rotationLocation; - } - else { - var controlPoint; - - controlPoint = new Placemark( - widthLocation, - false, - sizeControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 0; - controlPoint.userProperties.purpose = ShapeEditorConstants.WIDTH; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - - controlPoint = new Placemark( - heightLocation, - false, - sizeControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 1; - controlPoint.userProperties.purpose = ShapeEditorConstants.HEIGHT; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - - controlPoint = new Placemark( - rotationLocation, - false, - angleControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 1; - controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - } - + controlPoints[0].position = widthLocation; controlPoints[0].userProperties.size = shape.width; + + controlPoints[1].position = heightLocation; controlPoints[1].userProperties.size = shape.height; + + controlPoints[2].position = rotationLocation; controlPoints[2].userProperties.rotation = shape.heading; this.updateOrientationLine(shape.center, rotationLocation, accessories); From a682c1adef09aeb09b0b74cf18907636268581df Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Sat, 23 Jun 2018 13:35:53 +0200 Subject: [PATCH 027/112] Rework the documentation --- src/util/editor/ShapeEditor.js | 72 ++++++++++++---------------------- 1 file changed, 25 insertions(+), 47 deletions(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 8d1735370..b51f84cf9 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -17,7 +17,6 @@ * @exports ShapeEditor */ define([ - '../../geom/Angle', '../../shapes/Annotation', '../../shapes/AnnotationAttributes', '../../error/ArgumentError', @@ -26,29 +25,22 @@ define([ '../Insets', '../../geom/Location', '../Logger', - '../../shapes/Path', '../../shapes/Placemark', '../../shapes/PlacemarkAttributes', '../../geom/Position', '../../layer/RenderableLayer', '../../shapes/ShapeAttributes', './ShapeEditorConstants', - '../../shapes/SurfaceEllipse', './SurfaceEllipseEditorFragment', - '../../shapes/SurfaceCircle', './SurfaceCircleEditorFragment', '../../shapes/SurfacePolygon', './SurfacePolygonEditorFragment', - '../../shapes/SurfacePolyline', './SurfacePolylineEditorFragment', - '../../shapes/SurfaceRectangle', './SurfaceRectangleEditorFragment', - '../../shapes/SurfaceShape', '../../geom/Vec2', '../../geom/Vec3' ], - function (Angle, - Annotation, + function (Annotation, AnnotationAttributes, ArgumentError, Color, @@ -56,43 +48,46 @@ define([ Insets, Location, Logger, - Path, Placemark, PlacemarkAttributes, Position, RenderableLayer, ShapeAttributes, ShapeEditorConstants, - SurfaceEllipse, SurfaceEllipseEditorFragment, - SurfaceCircle, SurfaceCircleEditorFragment, SurfacePolygon, SurfacePolygonEditorFragment, - SurfacePolyline, SurfacePolylineEditorFragment, - SurfaceRectangle, SurfaceRectangleEditorFragment, SurfaceShape, Vec2, - Vec3) { // FIXME Remove unnecessary items from this list + Vec3) { "use strict"; /** + * Constructs a new shape editor attached to the specified World Window. * @alias ShapeEditor - * @constructor - * @classdesc Provides a user interface for editing a shape and performs editing. Depending on the shape type, - * the shape is shown with control points for vertex locations and size. All shapes are shown with a handle that - * provides rotation. - *

- * Drag on the shape's body moves the whole shape. Drag on a control point performs the action - * associated with that control point. The editor provides vertex insertion and removal for SurfacePolygon and - * SurfacePolyline. Shift-click when the cursor is over the shape inserts a control - * point at the cursor's position. Alt-click when the cursor is over a control point removes that control point. - *

- * This editor supports all surface shapes except SurfaceImage. + * @classdesc Provides a controller for editing shapes. Depending on the type of shape, the following actions + * are available: + *

    + *
  • Edit the location and size of its vertexes using control points;
  • + *
  • Rotate the shape using a handle;
  • + *
  • Drag the shape on the surface of the globe.
  • + *
+ *

+ * To start editing a shape, pass it to the {@link ShapeEditor#edit} method. To end the edition, call the + * {@link ShapeEditor#stop} method. + *

+ * Dragging the body of the shape moves the whole shape. Dragging a control point performs the action associated + * with that control point. The editor provides vertex insertion and removal for SurfacePolygon and + * SurfacePolyline. Shift-clicking when the cursor is over the shape inserts a control point near the position + * of the cursor. Alt-clicking when the cursor is over a control point removes that particular control point. + *

+ * This editor currently supports all surface shapes except SurfaceImage. * @param {WorldWindow} worldWindow The World Window to associate this shape editor controller with. - * @throws {ArgumentError} If the specified world window is null or undefined. + * @throws {ArgumentError} If the specified World Window is null or undefined. + * @constructor */ var ShapeEditor = function (worldWindow) { if (!worldWindow) { @@ -215,7 +210,7 @@ define([ }, /** - * Attribuets used for the control points that move the boundaries of the shape. + * Attributes used for the control points that move the boundaries of the shape. * @memberof ShapeEditor.prototype * @type {PlacemarkAttributes} */ @@ -257,7 +252,7 @@ define([ }, /** - * Attributes used for the annotation. + * Attributes used for the annotation that displays hints during the actions. * @memberof ShapeEditor.prototype * @type {AnnotationAttributes} */ @@ -563,7 +558,7 @@ define([ var p = new Position(0, 0, 0); this._worldWindow.globe.computePositionFromPoint(intersection[0], intersection[1], intersection[2], p); - this._shape.moveTo(this._worldWindow.globe, new WorldWind.Location(p.latitude, p.longitude)); + this._shape.moveTo(this._worldWindow.globe, new Location(p.latitude, p.longitude)); } this.updateControlElements(); @@ -663,15 +658,6 @@ define([ - /** - * Inserts the location nearest to a specified position on an edge of a specified list of locations into the - * appropriate place in that list. - * @param {Position} terrainPosition The position to find a nearest point for. - * @param {Number} altitude The altitude to use when determining the nearest point. Can be approximate and is - * not necessarily the altitude of the terrain position. - * @param {Location[]} locations The list of locations. This list is modified by this method to contain the new - * location on an edge nearest the specified terrain position. - */ ShapeEditor.prototype.addNewControlPoint = function (terrainPosition, altitude, locations) { var globe = this._worldWindow.globe; @@ -742,14 +728,6 @@ define([ - /** - * Computes the point on a specified line segment that is nearest a specified point. - * - * @param {Vec3} p1 The line's first point. - * @param {Vec3} p2 The line's second point. - * @param {Vec3} point The point for which to determine a nearest point on the line segment. - * @returns {Vec3} The nearest point on the line segment. - */ ShapeEditor.prototype.nearestPointOnSegment = function (p1, p2, point) { var segment = p2.subtract(p1); From 818f22a5427387283e0880e8151ef1e322fe43bb Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Sat, 23 Jun 2018 14:23:01 +0200 Subject: [PATCH 028/112] Add more documentation --- src/util/editor/BaseSurfaceEditorFragment.js | 87 +++++++ src/util/editor/ShapeEditor.js | 258 ++++++------------- 2 files changed, 172 insertions(+), 173 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index 7ca318518..a827e9e2e 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -137,6 +137,93 @@ define([ accessories.push(rotationLine); }; + BaseSurfaceEditorFragment.prototype.addNewControlPoint = function (globe, terrainPosition, altitude, locations) { + // Find the nearest edge to the picked point and insert a new position on that edge. + var pointPicked = globe.computePointFromPosition( + terrainPosition.latitude, + terrainPosition.longitude, + altitude, + new Vec3(0, 0, 0) + ); + + var nearestPoint = null; + var nearestSegmentIndex = 0; + var nearestDistance = Number.MAX_VALUE; + for (var i = 1; i <= locations.length; i++) // <= is intentional, to handle the closing segment + { + // Skip the closing segment if the shape is not a polygon. + if (!(this._shape instanceof SurfacePolygon ) && i == locations.length) { + continue; + } + + var locationA = locations[i - 1]; + var locationB = locations[i == locations.length ? 0 : i]; + + var pointA = globe.computePointFromPosition( + locationA.latitude, + locationA.longitude, + altitude, + new Vec3(0, 0, 0) + ); + + var pointB = this._worldWindow.globe.computePointFromPosition( + locationB.latitude, + locationB.longitude, + altitude, + new Vec3(0, 0, 0) + ); + + var pointOnEdge = this.nearestPointOnSegment(pointA, pointB, new Vec3(pointPicked[0], pointPicked[1], pointPicked[2])); + + var distance = pointOnEdge.distanceTo(pointPicked); + if (distance < nearestDistance) { + nearestPoint = pointOnEdge; + nearestSegmentIndex = i; + nearestDistance = distance; + } + } + + if (nearestPoint) { + // Compute the location of the nearest point and add it to the shape. + var nearestLocation = globe.computePositionFromPoint( + nearestPoint[0], + nearestPoint[1], + nearestPoint[2], + new Position(0, 0, 0) + ); + + if (nearestSegmentIndex == locations.length) + locations.push(nearestLocation); + else + locations.splice(nearestSegmentIndex, 0, nearestLocation); + + this.removeControlPoints(); + this._shape.boundaries = locations; + this.updateControlElements(); + } + }; + + + + BaseSurfaceEditorFragment.prototype.nearestPointOnSegment = function (p1, p2, point) { + var segment = p2.subtract(p1); + + var segmentCopy = new Vec3(0, 0, 0); + segmentCopy.copy(segment); + var dir = segmentCopy.normalize(); + + var dot = point.subtract(p1).dot(dir); + if (dot < 0.0) { + return p1; + } + else if (dot > segment.magnitude()) { + return p2; + } + else { + return Vec3.fromLine(p1, dot, dir); // FIXME This is broken + } + }; + return BaseSurfaceEditorFragment; } ); \ No newline at end of file diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index b51f84cf9..74e1c0573 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -95,22 +95,28 @@ define([ "missingWorldWindow")); } + // Documented in defineProperties below. this._worldWindow = worldWindow; + // Documented in defineProperties below. this._shape = null; + // Documented in defineProperties below. this._moveControlPointAttributes = new PlacemarkAttributes(null); this._moveControlPointAttributes.imageColor = WorldWind.Color.BLUE; this._moveControlPointAttributes.imageScale = 6; + // Documented in defineProperties below. this._resizeControlPointAttributes = new PlacemarkAttributes(null); this._resizeControlPointAttributes.imageColor = WorldWind.Color.CYAN; this._resizeControlPointAttributes.imageScale = 6; + // Documented in defineProperties below. this._rotateControlPointAttributes = new PlacemarkAttributes(null); this._rotateControlPointAttributes.imageColor = WorldWind.Color.GREEN; this._rotateControlPointAttributes.imageScale = 6; + // Documented in defineProperties below. this._annotationAttributes = new AnnotationAttributes(null); this._annotationAttributes.altitudeMode = WorldWind.CLAMP_TO_GROUND; this._annotationAttributes.cornerRadius = 5; @@ -122,7 +128,8 @@ define([ this._annotationAttributes._textAttributes.font = new Font(10); this._annotationAttributes.insets = new Insets(5, 5, 5, 5); - //Internal use only. Intentionally not documented. + // Internal use only. + // The annotation that displays hints during the actions on the shape. this.annotation = new WorldWind.Annotation(new WorldWind.Position(0, 0, 0), this._annotationAttributes); //Internal use only. Intentionally not documented. @@ -134,51 +141,65 @@ define([ new SurfaceRectangleEditorFragment() ]; - //Internal use only. Intentionally not documented. + // Internal use only. + // The layer that holds the control points created by the editor fragment. this.controlPointsLayer = new RenderableLayer("Shape Editor Control Points"); - //Internal use only. Intentionally not documented. + // Internal use only. + // The layers that holds the additional accessories created by the editor fragment. this.accessoriesLayer = new RenderableLayer("Shape Editor Accessories"); this.accessoriesLayer.pickEnabled = false; - //Internal use only. Intentionally not documented. + // Internal use only. + // The layer that holds the above-mentioned annotation. this.annotationLayer = new RenderableLayer("Shape Editor Annotation"); this.annotationLayer.pickEnabled = false; this.annotationLayer.enabled = false; this.annotationLayer.addRenderable(this.annotation); - //Internal use only. Intentionally not documented. + // Internal use only. + // The layer that holds the shadow of the shape during the actions. this.shadowShapeLayer = new RenderableLayer("Shape Editor Shadow Shape"); this.shadowShapeLayer.pickEnabled = false; - //Internal use only. Intentionally not documented. + // Internal use only. + // The editor fragment selected for the shape being edited or null. this.activeEditorFragment = null; - //Internal use only. Intentionally not documented. + // Internal use only. + // The type of action being conducted or null. this.actionType = null; - //Internal use only. Intentionally not documented. + // Internal use only. + // The control point that triggered the current action or null. this.actionControlPoint = null; - //Internal use only. Intentionally not documented. + // Internal use only. + // The lat/lon/alt position that is currently involved with the action or null. this.actionControlPosition = null; - //Internal use only. Intentionally not documented. + // Internal use only. + // Flag indicating whether the action should trigger the secondary behavior in the editor fragment. this.actionSecondaryBehavior = false; - //Internal use only. Intentionally not documented. + // Internal use only. + // The client X position at the start of the action. this.actionStartX = null; - //Internal use only. Intentionally not documented. + //Internal use only. + // The client Y position at the start of the action. this.actionStartY = null; - //Internal use only. Intentionally not documented. + // Internal use only. + // The current client X position for the action. this.actionCurrentX = null; - //Internal use only. Intentionally not documented. + // Internal use only. + // The current client Y position for the action. this.actionCurrentY = null; - //Internal use only. Intentionally not documented. + // Internal use only. + // The original highlight attributes of the shape in order to restore them after the action. this.originalHighlightAttributes = new ShapeAttributes(null); this._worldWindow.worldWindowController.addGestureListener(this); @@ -252,7 +273,7 @@ define([ }, /** - * Attributes used for the annotation that displays hints during the actions. + * Attributes used for the annotation that displays hints during the actions on the shape. * @memberof ShapeEditor.prototype * @type {AnnotationAttributes} */ @@ -301,11 +322,14 @@ define([ ShapeEditor.prototype.stop = function () { this.removeControlElements(); + this.activeEditorFragment = null; + var currentShape = this._shape; this._shape = null; return currentShape; }; + // Internal use only. // Called by {@link ShapeEditor#edit} to initialize the control elements used for editing. ShapeEditor.prototype.initializeControlElements = function () { if (this._worldWindow.indexOfLayer(this.shadowShapeLayer) == -1) { @@ -336,6 +360,7 @@ define([ this.updateControlElements(); }; + // Internal use only. // Called by {@link ShapeEditor#stop} to remove the control elements used for editing. ShapeEditor.prototype.removeControlElements = function () { this._worldWindow.removeLayer(this.controlPointsLayer); @@ -350,12 +375,26 @@ define([ this._worldWindow.removeLayer(this.annotationLayer); }; - //Internal use only. Intentionally not documented. + // Internal use only. + // Updates the position of the control elements. + ShapeEditor.prototype.updateControlElements = function () { + this.activeEditorFragment.updateControlElements( + this._shape, + this._worldWindow.globe, + this.controlPointsLayer.renderables, + this.accessoriesLayer.renderables + ); + }; + + // Internal use only. + // Dispatches the events relevant to the shape editor. ShapeEditor.prototype.onGestureEvent = function (event) { if(this._shape === null) { return; } + // TODO Add support for touch devices + if (event.type === "pointerup" || event.type === "mouseup") { this.handleMouseUp(event); } else if (event.type === "pointerdown" || event.type === "mousedown") { @@ -365,7 +404,8 @@ define([ } }; - //Internal use only. Intentionally not documented. + // Internal use only. + // Triggers an action if the shape below the mouse is the shape being edited or a control point. ShapeEditor.prototype.handleMouseDown = function (event) { var x = event.clientX, y = event.clientY; @@ -390,7 +430,7 @@ define([ event.preventDefault(); break; - } else if (userObject instanceof Placemark && userObject.userProperties.isControlPoint) { + } else if (this.controlPointsLayer.renderables.indexOf(userObject) ) { this.beginAction(terrainObject.position, event.altKey, userObject); event.preventDefault(); break; @@ -399,7 +439,8 @@ define([ } }; - // Internal use only. Intentionally not documented. + // Internal use only. + // Updates the current action if any. ShapeEditor.prototype.handleMouseMove = function (event) { if (this.actionType) { @@ -419,51 +460,37 @@ define([ } }; - //Internal use only. Intentionally not documented. + // Internal use only. + // Terminates the current action if any; otherwise handles other click responses. ShapeEditor.prototype.handleMouseUp = function (event) { - var x = event.clientX, - y = event.clientY; + var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); + var terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); if (this.actionType) { - if (this.actionControlPoint) { - if (event.altKey) { // FIXME What is this for? - var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); - var terrainObject; - - if (this._worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); - } - - if (terrainObject) { - this.reshape(terrainObject.position); - } - } + if (this.actionControlPoint + && terrainObject + && event.altKey) { // FIXME What is this for? + this.reshape(terrainObject.position); } this.endAction(); - } else { - var pickList = this._worldWindow.pick(this._worldWindow.canvasCoordinates(x, y)); - if (pickList.objects.length > 0) { - for (var p = 0, len = pickList.objects.length; p < len; p++) { - if (!pickList.objects[p].isTerrain) { - if (this.actionStartX === this.actionCurrentX && - this.actionStartY === this.actionCurrentY) { // FIXME Is this check needed? - if (event.shiftKey) { - var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); - var terrainObject; - - if (this._worldWindow.viewport.containsPoint(mousePoint)) { - terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); - } - - if (terrainObject) { - this.addNewControlPoint(terrainObject.position, 0, this._shape.boundaries); - break; - } - } - } - } + } else if (terrainObject + && this.actionStartX === this.actionCurrentX // FIXME Is this check needed? + && this.actionStartY === this.actionCurrentY // FIXME Is this check needed? + && event.shiftKey) { + + var pickList = this._worldWindow.pick(mousePoint); + for (var p = 0, len = pickList.objects.length; p < len; p++) { + + if (!pickList.objects[p].isTerrain) { // FIXME Shouldn't it check that we are on the shape instead of any object? + this.activeEditorFragment.addNewControlPoint( + this._worldWindow.globe, + terrainObject.position, + 0, + this._shape.boundaries + ); + break; } } } @@ -567,15 +594,6 @@ define([ this._worldWindow.redraw(); }; - ShapeEditor.prototype.updateControlElements = function () { - this.activeEditorFragment.updateControlElements( - this._shape, - this._worldWindow.globe, - this.controlPointsLayer.renderables, - this.accessoriesLayer.renderables - ); - }; - ShapeEditor.prototype.updateAnnotation = function (controlPoint) { this.annotationLayer.enabled = true; @@ -641,112 +659,6 @@ define([ return rotation.toFixed(4) + "°"; }; - - - - - - - - - - - - - - - - - - ShapeEditor.prototype.addNewControlPoint = function (terrainPosition, altitude, locations) { - var globe = this._worldWindow.globe; - - // Find the nearest edge to the picked point and insert a new position on that edge. - var pointPicked = globe.computePointFromPosition( - terrainPosition.latitude, - terrainPosition.longitude, - altitude, - new Vec3(0, 0, 0) - ); - - var nearestPoint = null; - var nearestSegmentIndex = 0; - var nearestDistance = Number.MAX_VALUE; - for (var i = 1; i <= locations.length; i++) // <= is intentional, to handle the closing segment - { - // Skip the closing segment if the shape is not a polygon. - if (!(this._shape instanceof SurfacePolygon ) && i == locations.length) { - continue; - } - - var locationA = locations[i - 1]; - var locationB = locations[i == locations.length ? 0 : i]; - - var pointA = globe.computePointFromPosition( - locationA.latitude, - locationA.longitude, - altitude, - new Vec3(0, 0, 0) - ); - - var pointB = this._worldWindow.globe.computePointFromPosition( - locationB.latitude, - locationB.longitude, - altitude, - new Vec3(0, 0, 0) - ); - - var pointOnEdge = this.nearestPointOnSegment(pointA, pointB, new Vec3(pointPicked[0], pointPicked[1], pointPicked[2])); - - var distance = pointOnEdge.distanceTo(pointPicked); - if (distance < nearestDistance) { - nearestPoint = pointOnEdge; - nearestSegmentIndex = i; - nearestDistance = distance; - } - } - - if (nearestPoint) { - // Compute the location of the nearest point and add it to the shape. - var nearestLocation = this._worldWindow.globe.computePositionFromPoint( - nearestPoint[0], - nearestPoint[1], - nearestPoint[2], - new Position(0, 0, 0) - ); - - if (nearestSegmentIndex == locations.length) - locations.push(nearestLocation); - else - locations.splice(nearestSegmentIndex, 0, nearestLocation); - - this.removeControlPoints(); - this._shape.boundaries = locations; - this.updateControlElements(); - } - }; - - - - ShapeEditor.prototype.nearestPointOnSegment = function (p1, p2, point) { - var segment = p2.subtract(p1); - - var segmentCopy = new Vec3(0, 0, 0); - segmentCopy.copy(segment); - var dir = segmentCopy.normalize(); - - var dot = point.subtract(p1).dot(dir); - if (dot < 0.0) { - return p1; - } - else if (dot > segment.magnitude()) { - return p2; - } - else { - return Vec3.fromLine(p1, dot, dir); // FIXME This is broken - } - }; - return ShapeEditor; } ); \ No newline at end of file From 9ab0651c5772486e0c7b8aead5d907785c1a0264 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Sun, 24 Jun 2018 11:29:41 +0300 Subject: [PATCH 029/112] highlight polygon active --- examples/ShapeEditor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index adaba13e7..c2d2241a8 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -88,6 +88,7 @@ requirejs(['./WorldWindShim', document.getElementById("editPolyBtn").addEventListener("click", function(){ if(document.getElementById("editPolyBtn").innerHTML === "Start edit polygon"){ shapeEditor.edit(polyShape); + shapeEditor.shape.highlighted = true; document.getElementById("editPolyBtn").innerHTML = "Stop edit polygon"; document.getElementById("editCircleBtn").disabled = true; From e56739e8e65132b5efc843b6da0ce14b9f0468d0 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Sun, 24 Jun 2018 11:31:08 +0300 Subject: [PATCH 030/112] remove unused imports after reorganize fragments --- src/util/editor/ShapeEditor.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index c69268af1..e5d99260f 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -34,11 +34,9 @@ define([ '../../shapes/ShapeAttributes', '../../shapes/SurfaceEllipse', './SurfaceEllipseEditorFragment', - '../../shapes/SurfaceCircle', './SurfaceCircleEditorFragment', '../../shapes/SurfacePolygon', './SurfacePolygonEditorFragment', - '../../shapes/SurfacePolyline', './SurfacePolylineEditorFragment', '../../shapes/SurfaceRectangle', './SurfaceRectangleEditorFragment', @@ -63,11 +61,9 @@ define([ ShapeAttributes, SurfaceEllipse, SurfaceEllipseEditorFragment, - SurfaceCircle, SurfaceCircleEditorFragment, SurfacePolygon, SurfacePolygonEditorFragment, - SurfacePolyline, SurfacePolylineEditorFragment, SurfaceRectangle, SurfaceRectangleEditorFragment, From 723e2c6686482a53b60463c1c5d7913549688734 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Sun, 24 Jun 2018 11:44:50 +0300 Subject: [PATCH 031/112] update copyright --- src/util/editor/ShapeEditorConstants.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/util/editor/ShapeEditorConstants.js b/src/util/editor/ShapeEditorConstants.js index 2a9af2942..d8ecbf297 100644 --- a/src/util/editor/ShapeEditorConstants.js +++ b/src/util/editor/ShapeEditorConstants.js @@ -1,12 +1,11 @@ /* - * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the - * National Aeronautics and Space Administration. All rights reserved. + * Copyright 2015-2018 WorldWind Contributors * - * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, From a15959d3a669e4e9b839f492bffdb34187948e91 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Sun, 24 Jun 2018 12:12:20 +0300 Subject: [PATCH 032/112] fix shape editor constants --- src/util/editor/SurfacePolygonEditorFragment.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index 59d667810..4fd840430 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -62,7 +62,7 @@ define([ outer: for (var i = 0; i < boundaries.length; i++) { for (var j = 0; j < boundaries[i].length; j++) { - if (controlPoint.userProperties.purpose === ShapeEditor.LOCATION) { + if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { if (controlPoint.userProperties.id === k) { newPos = this.moveLocation(globe, controlPoint, terrainPosition, previousPosition); boundaries[i][j] = newPos; @@ -71,7 +71,7 @@ define([ break outer; } } - else if (controlPoint.userProperties.purpose === ShapeEditor.ROTATION) { + else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { this.rotateLocations(terrainPosition, boundaries); shape.boundaries = boundaries; break outer; From 6bcb17433264a9c9977beddb8b91f96237e04a23 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Sun, 24 Jun 2018 12:23:08 +0300 Subject: [PATCH 033/112] update rotateLocations call --- src/util/editor/SurfacePolygonEditorFragment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index 4fd840430..e0231e604 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -72,7 +72,7 @@ define([ } } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { - this.rotateLocations(terrainPosition, boundaries); + this.rotateLocations(globe, terrainPosition, previousPosition, boundaries); shape.boundaries = boundaries; break outer; } From b5aad09b6647db7df6a6d3215460643214dc4649 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Sun, 24 Jun 2018 12:49:02 +0300 Subject: [PATCH 034/112] bugfix --- src/util/editor/SurfaceRectangleEditorFragment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/editor/SurfaceRectangleEditorFragment.js b/src/util/editor/SurfaceRectangleEditorFragment.js index 6cb7b69ed..d6d269d0b 100644 --- a/src/util/editor/SurfaceRectangleEditorFragment.js +++ b/src/util/editor/SurfaceRectangleEditorFragment.js @@ -94,7 +94,7 @@ define([ } } else { - var oldHeading = Location.greatCircleAzimuth(shape.center, this.previousPosition); + var oldHeading = Location.greatCircleAzimuth(shape.center, previousPosition); var deltaHeading = Location.greatCircleAzimuth(shape.center, terrainPosition) - oldHeading; shape.heading = this.normalizedHeading(shape.heading, deltaHeading); } From 78ce79a1a080e374d655b78cca721a9b139056a4 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Sun, 24 Jun 2018 14:07:19 +0300 Subject: [PATCH 035/112] fix polyline editing --- src/util/editor/BaseSurfaceEditorFragment.js | 103 ++++++++++++ .../editor/SurfacePolygonEditorFragment.js | 99 ------------ .../editor/SurfacePolylineEditorFragment.js | 146 ++++++++++++++---- 3 files changed, 219 insertions(+), 129 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index e39552515..9b51890cb 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -18,9 +18,13 @@ */ define([ '../../geom/Angle', + '../../geom/Location', + '../../geom/Position', '../../geom/Vec3' ], function (Angle, + Location, + Position, Vec3) { "use strict"; @@ -84,6 +88,48 @@ define([ rotationLine.positions = positions; }; + /** + * Computes the average location of a specified array of locations. + * @param {Location[]} locations The array of locations for the shape. + * @return {Position} the average of the locations specified in the array. + */ + BaseSurfaceEditorFragment.prototype.getCenter = function (globe, locations) { + var count = 0; + var center = new Vec3(0, 0, 0); + + if (locations.length > 0 && locations[0].length > 2) { + for (var i = 0; i < locations.length; i++) { + for (var j = 0; j < locations[i].length; j++) { + center = center.add(globe.computePointFromPosition( + locations[i][j].latitude, + locations[i][j].longitude, + 0, + new Vec3(0, 0, 0))); + ++count; + } + } + } + else if (locations.length >= 2) { + for (var i = 0; i < locations.length; i++) { + center = center.add(globe.computePointFromPosition( + locations[i].latitude, + locations[i].longitude, + 0, + new Vec3(0, 0, 0))); + ++count; + } + } + + center = center.divide(count); + + return globe.computePositionFromPoint( + center[0], + center[1], + center[2], + new Position(0, 0, 0) + ); + }; + /** * Computes the average distance between a specified center point and a list of locations. * @param {Globe} globe The globe to use for the computations. @@ -112,6 +158,63 @@ define([ return (count === 0) ? 0 : totalDistance / globe.equatorialRadius; }; + /** + * Moves a control point location. + * @param {Placemark} controlPoint The control point being moved. + * @param {Position} terrainPosition The position selected by the user. + * @returns {Position} The position after move. + */ + BaseSurfaceEditorFragment.prototype.moveLocation = function (globe, controlPoint, terrainPosition, previousPosition) { + var delta = this.computeControlPointDelta(globe, previousPosition, terrainPosition); + var markerPoint = globe.computePointFromPosition( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0, + new Vec3(0, 0, 0) + ); + + markerPoint.add(delta); + return globe.computePositionFromPoint( + markerPoint[0], + markerPoint[1], + markerPoint[2], + new Position(0, 0, 0) + ); + }; + + /** + * Rotates a shape's locations. + * @param {Position} terrainPosition The position selected by the user. + * @param {Location[]} locations The array of locations for the shape. + */ + BaseSurfaceEditorFragment.prototype.rotateLocations = function (globe, terrainPosition, previousPosition, locations) { + var center = this.getCenter(globe, locations); + var previousHeading = Location.greatCircleAzimuth(center, previousPosition); + var deltaHeading = Location.greatCircleAzimuth(center, terrainPosition) - previousHeading; + this.currentHeading = this.normalizedHeading(this.currentHeading, deltaHeading); + + if (locations.length > 0 && locations[0].length > 2) { + for (var i = 0; i < locations.length; i++) { + for (var j = 0; j < locations[i].length; j++) { + var heading = Location.greatCircleAzimuth(center, locations[i][j]); + var distance = Location.greatCircleDistance(center, locations[i][j]); + var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, + new Location(0, 0)); + locations[i][j] = newLocation; + } + } + } + else if (locations.length >= 2) { + for (var i = 0; i < locations.length; i++) { + var heading = Location.greatCircleAzimuth(center, locations[i]); + var distance = Location.greatCircleDistance(center, locations[i]); + var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, + new Location(0, 0)); + locations[i] = newLocation; + } + } + }; + return BaseSurfaceEditorFragment; } ); \ No newline at end of file diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index e0231e604..0e15669bb 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -186,105 +186,6 @@ define([ this.updateOrientationLine(polygonCenter, rotationPosition, accessories); }; - /** - * Moves a control point location. - * @param {Placemark} controlPoint The control point being moved. - * @param {Position} terrainPosition The position selected by the user. - * @returns {Position} The position after move. - */ - SurfacePolygonEditorFragment.prototype.moveLocation = function (globe, controlPoint, terrainPosition, previousPosition) { - var delta = this.computeControlPointDelta(globe, previousPosition, terrainPosition); - var markerPoint = globe.computePointFromPosition( - controlPoint.position.latitude, - controlPoint.position.longitude, - 0, - new Vec3(0, 0, 0) - ); - - markerPoint.add(delta); - return globe.computePositionFromPoint( - markerPoint[0], - markerPoint[1], - markerPoint[2], - new Position(0, 0, 0) - ); - }; - - /** - * Rotates a shape's locations. - * @param {Position} terrainPosition The position selected by the user. - * @param {Location[]} locations The array of locations for the shape. - */ - SurfacePolygonEditorFragment.prototype.rotateLocations = function (globe, terrainPosition, previousPosition, locations) { - var center = this.getCenter(globe, locations); - var previousHeading = Location.greatCircleAzimuth(center, previousPosition); - var deltaHeading = Location.greatCircleAzimuth(center, terrainPosition) - previousHeading; - this.currentHeading = this.normalizedHeading(this.currentHeading, deltaHeading); - - if (locations.length > 0 && locations[0].length > 2) { - for (var i = 0; i < locations.length; i++) { - for (var j = 0; j < locations[i].length; j++) { - var heading = Location.greatCircleAzimuth(center, locations[i][j]); - var distance = Location.greatCircleDistance(center, locations[i][j]); - var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, - new Location(0, 0)); - locations[i][j] = newLocation; - } - } - } - else if (locations.length >= 2) { - for (var i = 0; i < locations.length; i++) { - var heading = Location.greatCircleAzimuth(center, locations[i]); - var distance = Location.greatCircleDistance(center, locations[i]); - var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, - new Location(0, 0)); - locations[i] = newLocation; - } - } - }; - - /** - * Computes the average location of a specified array of locations. - * @param {Location[]} locations The array of locations for the shape. - * @return {Position} the average of the locations specified in the array. - */ - SurfacePolygonEditorFragment.prototype.getCenter = function (globe, locations) { - var count = 0; - var center = new Vec3(0, 0, 0); - - if (locations.length > 0 && locations[0].length > 2) { - for (var i = 0; i < locations.length; i++) { - for (var j = 0; j < locations[i].length; j++) { - center = center.add(globe.computePointFromPosition( - locations[i][j].latitude, - locations[i][j].longitude, - 0, - new Vec3(0, 0, 0))); - ++count; - } - } - } - else if (locations.length >= 2) { - for (var i = 0; i < locations.length; i++) { - center = center.add(globe.computePointFromPosition( - locations[i].latitude, - locations[i].longitude, - 0, - new Vec3(0, 0, 0))); - ++count; - } - } - - center = center.divide(count); - - return globe.computePositionFromPoint( - center[0], - center[1], - center[2], - new Position(0, 0, 0) - ); - }; - return SurfacePolygonEditorFragment; } ); \ No newline at end of file diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index 15a9797bd..837f15c40 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -20,6 +20,7 @@ define([ './BaseSurfaceEditorFragment', '../../geom/Location', '../../shapes/Placemark', + '../../geom/Position', './ShapeEditorConstants', '../../shapes/SurfacePolyline', '../../geom/Vec3' @@ -27,6 +28,7 @@ define([ function (BaseSurfaceEditorFragment, Location, Placemark, + Position, ShapeEditorConstants, SurfacePolyline, Vec3) { @@ -49,53 +51,137 @@ define([ //Internal use only. Intentionally not documented. SurfacePolylineEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, currentEvent) { - var delta = this.computeControlPointDelta(globe, previousPosition, terrainPosition); - var centerPoint = globe.computePointFromPosition( - shape.center.latitude, - shape.center.longitude, - 0, - new Vec3(0, 0, 0) - ); - var markerPoint = globe.computePointFromPosition( - controlPoint.position.latitude, - controlPoint.position.longitude, - 0, - new Vec3(0, 0, 0) - ); - - var vMarker = markerPoint.subtract(centerPoint).normalize(); - - var radius = shape.radius + delta.dot(vMarker); - if (radius > 0) { - shape.radius = radius; + var boundaries = shape.boundaries; + + var k = 0; + var newPos; + + if (boundaries.length > 0 && boundaries[0].length > 2) { + outer: + for (var i = 0; i < boundaries.length; i++) { + for (var j = 0; j < boundaries[i].length; j++) { + if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { + if (controlPoint.userProperties.id === k) { + newPos = this.moveLocation(globe, controlPoint, terrainPosition, previousPosition); + boundaries[i][j] = newPos; + shape.boundaries = boundaries; + controlPoint.position = newPos; + break outer; + } + } + else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { + this.rotateLocations(globe, terrainPosition, previousPosition, boundaries); + shape.boundaries = boundaries; + break outer; + } + k++; + } + } + } + else if (boundaries.length >= 2) { + //poly without whole + for (var i = 0; i < boundaries.length; i++) { + if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { + if (controlPoint.userProperties.id === k) { + if (currentEvent.altKey) { + //remove location + var minSize = shape instanceof SurfacePolygon ? 3 : 2; + if (boundaries.length > minSize) { + // Delete the control point. + boundaries.splice(i, 1); + shape.boundaries = boundaries; + this.removeControlPoints(); + } + } + else { + newPos = this.moveLocation(globe, controlPoint, terrainPosition, previousPosition); + boundaries[i] = newPos; + shape.boundaries = boundaries; + controlPoint.position = newPos; + } + break; + } + } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { + this.rotateLocations(globe, terrainPosition, previousPosition, boundaries); + shape.boundaries = boundaries; + break; + } + k++; + } } }; //Internal use only. Intentionally not documented. SurfacePolylineEditorFragment.prototype.updateControlPoints = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { - var radiusLocation = Location.greatCircleLocation( - shape.center, - 90, - shape.radius / globe.equatorialRadius, + var locations = []; + + if (shape.boundaries.length > 0 && shape.boundaries[0].length > 2) { + for (var i = 0; i < shape.boundaries.length; i++) { + for (var j = 0; j < shape.boundaries[i].length; j++) { + locations.push(shape.boundaries[i][j]); + } + } + } + else if (shape.boundaries.length >= 2) { + for (var i = 0; i < shape.boundaries.length; i++) { + locations.push(shape.boundaries[i]); + } + } + + if (locations.length < 2) + return; + + var polygonCenter = this.getCenter(globe, locations); + var shapeRadius = this.getAverageDistance(globe, polygonCenter, locations); + shapeRadius = shapeRadius * 1.2; + var heading = this.currentHeading; + var rotationControlLocation = Location.greatCircleLocation( + polygonCenter, + heading, + shapeRadius, new Location(0, 0)); + var rotationPosition = new Position( + rotationControlLocation.latitude, + rotationControlLocation.longitude, + 0); + if (controlPoints.length > 0) { - controlPoints[0].position = radiusLocation; + for (var i = 0; i < locations.length; i++) { + controlPoints[i].position = locations[i]; + } + controlPoints[locations.length].position = rotationPosition; + controlPoints[locations.length].userProperties.rotation = heading; } else { - var controlPoint = new Placemark( - radiusLocation, + var controlPoint; + + for (var i = 0; i < locations.length; i++) { + controlPoint = new Placemark( + locations[i], + false, + locationControlPointAttributes); + controlPoint.userProperties.isControlPoint = true; + controlPoint.userProperties.id = i; + controlPoint.userProperties.purpose = ShapeEditorConstants.LOCATION; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + } + + controlPoint = new Placemark( + rotationPosition, false, - sizeControlPointAttributes + angleControlPointAttributes ); controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 0; - controlPoint.userProperties.purpose = ShapeEditorConstants.OUTER_RADIUS; + controlPoint.userProperties.id = locations.length; + controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; + controlPoint.userProperties.rotation = heading; controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; controlPoints.push(controlPoint); } - controlPoints[0].userProperties.size = shape.radius; + this.updateOrientationLine(polygonCenter, rotationPosition, accessories); }; return SurfacePolylineEditorFragment; From a0e36e1e3b7c767b96e3e7fe531520b26b57355c Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Mon, 25 Jun 2018 12:54:34 +0200 Subject: [PATCH 036/112] Apply some of the fixes from Claudia --- src/util/editor/ShapeEditor.js | 11 +++++++++++ src/util/editor/ShapeEditorConstants.js | 7 +++---- src/util/editor/SurfacePolygonEditorFragment.js | 6 +++--- src/util/editor/SurfaceRectangleEditorFragment.js | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 74e1c0573..d9078957b 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -496,6 +496,7 @@ define([ } }; + // Internal use only. ShapeEditor.prototype.beginAction = function (initialPosition, alternateAction, controlPoint) { // Define the active transformation if (controlPoint) { @@ -522,6 +523,7 @@ define([ this._worldWindow.redraw(); }; + // Internal use only. ShapeEditor.prototype.endAction = function () { this.shadowShapeLayer.removeAllRenderables(); @@ -536,6 +538,7 @@ define([ this._worldWindow.redraw(); }; + // Internal use only. ShapeEditor.prototype.reshape = function (newPosition) { this.activeEditorFragment.reshape( this._shape, @@ -554,6 +557,7 @@ define([ this._worldWindow.redraw(); }; + // Internal use only. ShapeEditor.prototype.drag = function (clientX, clientY) { // FIXME To be reviewed var refPos = this._shape.getReferencePosition(); @@ -594,6 +598,7 @@ define([ this._worldWindow.redraw(); }; + // Internal use only. ShapeEditor.prototype.updateAnnotation = function (controlPoint) { this.annotationLayer.enabled = true; @@ -618,10 +623,12 @@ define([ this.annotation.text = annotationText; }; + // Internal use only. ShapeEditor.prototype.hideAnnotation = function (controlPoint) { this.annotationLayer.enabled = false; }; + // Internal use only. ShapeEditor.prototype.updateShapeAnnotation = function () { var center = this.activeEditorFragment.getShapeCenter(this._shape); @@ -640,21 +647,25 @@ define([ } }; + // Internal use only. ShapeEditor.prototype.formatLatitude = function (number) { var suffix = number < 0 ? "\u00b0S" : "\u00b0N"; return Math.abs(number).toFixed(4) + suffix; }; + // Internal use only. ShapeEditor.prototype.formatLongitude = function (number) { var suffix = number < 0 ? "\u00b0W" : "\u00b0E"; return Math.abs(number).toFixed(4) + suffix; }; + // Internal use only. ShapeEditor.prototype.formatLength = function (number) { var suffix = " km"; return Math.abs(number / 1000.0).toFixed(3) + suffix; }; + // Internal use only. ShapeEditor.prototype.formatRotation = function (rotation) { return rotation.toFixed(4) + "°"; }; diff --git a/src/util/editor/ShapeEditorConstants.js b/src/util/editor/ShapeEditorConstants.js index f8a6cda2d..a4e083498 100644 --- a/src/util/editor/ShapeEditorConstants.js +++ b/src/util/editor/ShapeEditorConstants.js @@ -1,12 +1,11 @@ /* - * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the - * National Aeronautics and Space Administration. All rights reserved. + * Copyright 2015-2018 WorldWind Contributors * - * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index 93d1bffab..219a61fd9 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -67,7 +67,7 @@ define([ outer: for (var i = 0; i < boundaries.length; i++) { for (var j = 0; j < boundaries[i].length; j++) { - if (controlPoint.userProperties.purpose === ShapeEditor.LOCATION) { + if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { if (controlPoint.userProperties.id === k) { newPos = this.moveLocation(globe, controlPoint, terrainPosition, previousPosition); boundaries[i][j] = newPos; @@ -76,8 +76,8 @@ define([ break outer; } } - else if (controlPoint.userProperties.purpose === ShapeEditor.ROTATION) { - this.rotateLocations(terrainPosition, boundaries); + else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { + this.rotateLocations(globe, terrainPosition, previousPosition, boundaries); shape.boundaries = boundaries; break outer; } diff --git a/src/util/editor/SurfaceRectangleEditorFragment.js b/src/util/editor/SurfaceRectangleEditorFragment.js index 45f460e0d..79663e593 100644 --- a/src/util/editor/SurfaceRectangleEditorFragment.js +++ b/src/util/editor/SurfaceRectangleEditorFragment.js @@ -139,7 +139,7 @@ define([ } } else { - var oldHeading = Location.greatCircleAzimuth(shape.center, this.previousPosition); + var oldHeading = Location.greatCircleAzimuth(shape.center, previousPosition); var deltaHeading = Location.greatCircleAzimuth(shape.center, terrainPosition) - oldHeading; shape.heading = this.normalizedHeading(shape.heading, deltaHeading); } From 5d5e6a35514ee842f620f41f1860c50437a49c7b Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Mon, 25 Jun 2018 13:45:09 +0200 Subject: [PATCH 037/112] Add more example shapes so that we can test all functionality of the editor --- examples/ShapeEditor.html | 9 ++- examples/ShapeEditor.js | 106 ++++++++++++++++----------------- src/util/editor/ShapeEditor.js | 33 +++++----- 3 files changed, 75 insertions(+), 73 deletions(-) diff --git a/examples/ShapeEditor.html b/examples/ShapeEditor.html index 4edf834f1..3679ef212 100644 --- a/examples/ShapeEditor.html +++ b/examples/ShapeEditor.html @@ -27,9 +27,12 @@

Layers

Shape editing

- - - + + + + + +

Destination

diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index c2d2241a8..c69fd6895 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -50,12 +50,6 @@ requirejs(['./WorldWindShim', var shapesLayer = new WorldWind.RenderableLayer("Surface Shapes"); wwd.addLayer(shapesLayer); - // Create a simple surface polygon, a triangle. - var boundary = []; - boundary.push(new WorldWind.Location(40, -100)); - boundary.push(new WorldWind.Location(42, -105)); - boundary.push(new WorldWind.Location(40, -110)); - // Create and set attributes for it. The shapes below except the surface polyline use this same attributes // object. Real apps typically create new attributes objects for each shape unless they know the attributes // can be shared among shapes. @@ -66,10 +60,6 @@ requirejs(['./WorldWindShim', var highlightAttributes = new WorldWind.ShapeAttributes(attributes); highlightAttributes.outlineColor = WorldWind.Color.RED; - var polyShape = new WorldWind.SurfacePolygon(boundary, attributes); - polyShape.highlightAttributes = highlightAttributes; - shapesLayer.addRenderable(polyShape); - var circleShape = new WorldWind.SurfaceCircle(new WorldWind.Location(35, -110), 200e3, attributes); circleShape.highlightAttributes = highlightAttributes; shapesLayer.addRenderable(circleShape); @@ -78,67 +68,77 @@ requirejs(['./WorldWindShim', ellipseShape.highlightAttributes = highlightAttributes; shapesLayer.addRenderable(ellipseShape); + var polygonBoundaries = []; + polygonBoundaries.push(new WorldWind.Location(40, -100)); + polygonBoundaries.push(new WorldWind.Location(42, -105)); + polygonBoundaries.push(new WorldWind.Location(40, -110)); + var polygonShape = new WorldWind.SurfacePolygon(polygonBoundaries, attributes); + polygonShape.highlightAttributes = highlightAttributes; + shapesLayer.addRenderable(polygonShape); + + var polylineBoundaries = []; + polylineBoundaries.push(new WorldWind.Location(45, -118)); + polylineBoundaries.push(new WorldWind.Location(40, -115)); + polylineBoundaries.push(new WorldWind.Location(43, -110)); + polylineBoundaries.push(new WorldWind.Location(50, -120)); + var polylineShape = new WorldWind.SurfacePolyline(polylineBoundaries, attributes); + polylineShape.highlightAttributes = highlightAttributes; + shapesLayer.addRenderable(polylineShape); + + var rectangleShape = new WorldWind.SurfaceRectangle(new WorldWind.Location(33, -105), 300e3, 200e3, 70, attributes); + rectangleShape.highlightAttributes = highlightAttributes; + shapesLayer.addRenderable(rectangleShape); + + var sectorShape = new WorldWind.SurfaceSector(new WorldWind.Sector(45, 47, -100, -110), attributes); + sectorShape.highlightAttributes = highlightAttributes; + shapesLayer.addRenderable(sectorShape); + wwd.goTo(new WorldWind.Position(40.42, -104.60, 2417000)); // Create a layer manager for controlling layer visibility. - var layerManger = new LayerManager(wwd); + new LayerManager(wwd); var shapeEditor = new WorldWind.ShapeEditor(wwd); - document.getElementById("editPolyBtn").addEventListener("click", function(){ - if(document.getElementById("editPolyBtn").innerHTML === "Start edit polygon"){ - shapeEditor.edit(polyShape); - shapeEditor.shape.highlighted = true; - - document.getElementById("editPolyBtn").innerHTML = "Stop edit polygon"; - document.getElementById("editCircleBtn").disabled = true; - document.getElementById("editEllipseBtn").disabled = true; + document.getElementById("editCircleBtn").addEventListener("click", function(){ + var shape = shapeEditor.stop(); + if (shape !== circleShape) { + shapeEditor.edit(circleShape); } - else{ - shapeEditor.shape.highlighted = false; - shapeEditor.stop(); + }); - document.getElementById("editPolyBtn").innerHTML = "Start edit polygon"; - document.getElementById("editCircleBtn").disabled = false; - document.getElementById("editEllipseBtn").disabled = false; + document.getElementById("editEllipseBtn").addEventListener("click", function(){ + var shape = shapeEditor.stop(); + if (shape !== ellipseShape) { + shapeEditor.edit(ellipseShape); } }); - document.getElementById("editCircleBtn").addEventListener("click", function(){ - if(document.getElementById("editCircleBtn").innerHTML === "Start edit circle"){ - shapeEditor.edit(circleShape); - shapeEditor.shape.highlighted = true; - - document.getElementById("editCircleBtn").innerHTML = "Stop edit circle"; - document.getElementById("editPolyBtn").disabled = true; - document.getElementById("editEllipseBtn").disabled = true; + document.getElementById("editPolygonBtn").addEventListener("click", function(){ + var shape = shapeEditor.stop(); + if (shape !== polygonShape) { + shapeEditor.edit(polygonShape); } - else{ - shapeEditor.shape.highlighted = false; - shapeEditor.stop(); + }); - document.getElementById("editCircleBtn").innerHTML = "Start edit circle"; - document.getElementById("editPolyBtn").disabled = false; - document.getElementById("editEllipseBtn").disabled = false; + document.getElementById("editPolylineBtn").addEventListener("click", function(){ + var shape = shapeEditor.stop(); + if (shape !== polylineShape) { + shapeEditor.edit(polylineShape); } }); - document.getElementById("editEllipseBtn").addEventListener("click", function(){ - if(document.getElementById("editEllipseBtn").innerHTML === "Start edit ellipse"){ - shapeEditor.edit(ellipseShape); - shapeEditor.shape.highlighted = true; - - document.getElementById("editEllipseBtn").innerHTML = "Stop edit ellipse"; - document.getElementById("editCircleBtn").disabled = true; - document.getElementById("editPolyBtn").disabled = true; + document.getElementById("editRectangleBtn").addEventListener("click", function(){ + var shape = shapeEditor.stop(); + if (shape !== rectangleShape) { + shapeEditor.edit(rectangleShape); } - else{ - shapeEditor.shape.highlighted = false; - shapeEditor.stop(); + }); - document.getElementById("editEllipseBtn").innerHTML = "Start edit ellipse"; - document.getElementById("editCircleBtn").disabled = false; - document.getElementById("editPolyBtn").disabled = false; + document.getElementById("editSectorBtn").addEventListener("click", function(){ + var shape = shapeEditor.stop(); + if (shape !== sectorShape) { + shapeEditor.edit(sectorShape); } }); } diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index d9078957b..2645be46f 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -121,11 +121,11 @@ define([ this._annotationAttributes.altitudeMode = WorldWind.CLAMP_TO_GROUND; this._annotationAttributes.cornerRadius = 5; this._annotationAttributes.backgroundColor = new Color(0.67, 0.67, 0.67, 0.8); - this._annotationAttributes._leaderGapHeight = 0; + this._annotationAttributes.leaderGapHeight = 0; this._annotationAttributes.drawLeader = false; this._annotationAttributes.scale = 1; - this._annotationAttributes._textAttributes.color = Color.BLACK; - this._annotationAttributes._textAttributes.font = new Font(10); + this._annotationAttributes.textAttributes.color = Color.BLACK; + this._annotationAttributes.textAttributes.font = new Font(10); this._annotationAttributes.insets = new Insets(5, 5, 5, 5); // Internal use only. @@ -308,6 +308,7 @@ define([ // If we have a fragment for this shape, accept the shape and start the edition if (this.activeEditorFragment != null) { this._shape = shape; + this._shape.highlighted = true; this.initializeControlElements(); return true; } @@ -326,6 +327,11 @@ define([ var currentShape = this._shape; this._shape = null; + + if (currentShape !== null) { + currentShape.highlighted = false; + } + return currentShape; }; @@ -417,20 +423,20 @@ define([ var mousePoint = this._worldWindow.canvasCoordinates(x, y); var pickList = this._worldWindow.pick(mousePoint); + var terrainObject = pickList.terrainObject(); for (var p = 0, len = pickList.objects.length; p < len; p++) { var object = pickList.objects[p]; if (!object.isTerrain) { var userObject = object.userObject; - var terrainObject = pickList.terrainObject(); if (userObject === this._shape) { this.beginAction(terrainObject.position, event.altKey); event.preventDefault(); break; - } else if (this.controlPointsLayer.renderables.indexOf(userObject) ) { + } else if (this.controlPointsLayer.renderables.indexOf(userObject) !== -1) { this.beginAction(terrainObject.position, event.altKey, userObject); event.preventDefault(); break; @@ -559,7 +565,6 @@ define([ // Internal use only. ShapeEditor.prototype.drag = function (clientX, clientY) { - // FIXME To be reviewed var refPos = this._shape.getReferencePosition(); var refPoint = this._worldWindow.globe.computePointFromPosition( @@ -587,8 +592,7 @@ define([ var intersection = new Vec3(0, 0, 0); if (this._worldWindow.globe.intersectsLine(ray, intersection)) { var p = new Position(0, 0, 0); - this._worldWindow.globe.computePositionFromPoint(intersection[0], intersection[1], - intersection[2], p); + this._worldWindow.globe.computePositionFromPoint(intersection[0], intersection[1], intersection[2], p); this._shape.moveTo(this._worldWindow.globe, new Location(p.latitude, p.longitude)); } @@ -611,11 +615,9 @@ define([ var annotationText; if (controlPoint.userProperties.size !== undefined) { annotationText = this.formatLength(controlPoint.userProperties.size); - } - else if (controlPoint.userProperties.rotation !== undefined) { + } else if (controlPoint.userProperties.rotation !== undefined) { annotationText = this.formatRotation(controlPoint.userProperties.rotation); - } - else { + } else { annotationText = this.formatLatitude(controlPoint.position.latitude) + " " + this.formatLongitude(controlPoint.position.longitude); @@ -633,14 +635,11 @@ define([ var center = this.activeEditorFragment.getShapeCenter(this._shape); if (center !== null) { - var dummyMarker = new Placemark( + var temporaryMarker = new Placemark( new Position(center.latitude, center.longitude, 0), null ); - dummyMarker.userProperties.isControlPoint = true; - dummyMarker.userProperties.id = 0; - dummyMarker.userProperties.purpose = ShapeEditor.ANNOTATION; - this.updateAnnotation(dummyMarker); + this.updateAnnotation(temporaryMarker); } else { this.hideAnnotation(); From def1b3e0f8584e8b0f919f7494716e6b277d5c0b Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Mon, 25 Jun 2018 15:54:07 +0200 Subject: [PATCH 038/112] Clean up fragments for Circle, Ellipse and Rectangle --- src/util/editor/BaseSurfaceEditorFragment.js | 39 ++-- src/util/editor/ShapeEditor.js | 8 +- src/util/editor/ShapeEditorConstants.js | 3 - .../editor/SurfaceCircleEditorFragment.js | 84 ++++----- .../editor/SurfaceEllipseEditorFragment.js | 167 ++++++----------- .../editor/SurfaceRectangleEditorFragment.js | 171 +++++++----------- 6 files changed, 185 insertions(+), 287 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index 273cd8777..0c9491d8e 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -20,6 +20,7 @@ define([ '../../geom/Angle', '../../geom/Location', '../../shapes/Path', + '../../shapes/Placemark', '../../geom/Position', '../../shapes/ShapeAttributes', '../../geom/Vec3' @@ -27,6 +28,7 @@ define([ function (Angle, Location, Path, + Placemark, Position, ShapeAttributes, Vec3) { @@ -57,22 +59,22 @@ define([ * @param {Position} currentPosition The position of the current control point. * @returns {Vec3} The Cartesian difference between the two control points. */ - BaseSurfaceEditorFragment.prototype.computeControlPointDelta = function (globe, previousPosition, currentPosition) { - var terrainPoint = globe.computePointFromPosition( - currentPosition.latitude, - currentPosition.longitude, - currentPosition.altitude, + BaseSurfaceEditorFragment.prototype.computeControlPointDelta = function (globe, positionA, positionB) { + var pointA = globe.computePointFromPosition( + positionA.latitude, + positionA.longitude, + 0, new Vec3(0, 0, 0) ); - var previousPoint = globe.computePointFromPosition( - previousPosition.latitude, - previousPosition.longitude, - previousPosition.altitude, + var pointB = globe.computePointFromPosition( + positionB.latitude, + positionB.longitude, + 0, new Vec3(0, 0, 0) ); - return terrainPoint.subtract(previousPoint); + return pointA.subtract(pointB); }; /** @@ -81,7 +83,7 @@ define([ * end points. * @param {Position} controlPointPosition The shape orientation control point's position. */ - BaseSurfaceEditorFragment.prototype.updateOrientationLine = function (centerPosition, controlPointPosition, accessories) { + BaseSurfaceEditorFragment.prototype.updateRotationAccessory = function (centerPosition, controlPointPosition, accessories) { if (accessories.length == 0) { return; } @@ -161,10 +163,21 @@ define([ return (count === 0) ? 0 : totalDistance / globe.equatorialRadius; }; + BaseSurfaceEditorFragment.prototype.createControlPoint = function(attributes, purpose, controlPoints) { + var controlPoint = new Placemark( + new Location(0, 0), + false, + attributes + ); + controlPoint.userProperties.purpose = purpose; + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + controlPoints.push(controlPoint); + }; + /** * Set up the Path for the rotation line. */ - BaseSurfaceEditorFragment.prototype.makeAccessory = function (accessories, attributes) { + BaseSurfaceEditorFragment.prototype.initializeRotationAccessory = function (accessories, attributes) { var pathPositions = []; pathPositions.push(new Position(0, 0, 0)); pathPositions.push(new Position(0, 0, 0)); @@ -267,7 +280,7 @@ define([ return Vec3.fromLine(p1, dot, dir); // FIXME This is broken } }; - + /** * Moves a control point location. * @param {Placemark} controlPoint The control point being moved. diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 2645be46f..d2a3bc5fa 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -37,6 +37,7 @@ define([ './SurfacePolygonEditorFragment', './SurfacePolylineEditorFragment', './SurfaceRectangleEditorFragment', + './SurfaceSectorEditorFragment', '../../geom/Vec2', '../../geom/Vec3' ], @@ -60,7 +61,7 @@ define([ SurfacePolygonEditorFragment, SurfacePolylineEditorFragment, SurfaceRectangleEditorFragment, - SurfaceShape, + SurfaceSectorEditorFragment, Vec2, Vec3) { "use strict"; @@ -138,7 +139,8 @@ define([ new SurfaceEllipseEditorFragment(), new SurfacePolygonEditorFragment(), new SurfacePolylineEditorFragment(), - new SurfaceRectangleEditorFragment() + new SurfaceRectangleEditorFragment(), + new SurfaceSectorEditorFragment() ]; // Internal use only. @@ -632,7 +634,7 @@ define([ // Internal use only. ShapeEditor.prototype.updateShapeAnnotation = function () { - var center = this.activeEditorFragment.getShapeCenter(this._shape); + var center = this.activeEditorFragment.getShapeCenter(this._shape, this._worldWindow.globe); if (center !== null) { var temporaryMarker = new Placemark( diff --git a/src/util/editor/ShapeEditorConstants.js b/src/util/editor/ShapeEditorConstants.js index a4e083498..aa39012fe 100644 --- a/src/util/editor/ShapeEditorConstants.js +++ b/src/util/editor/ShapeEditorConstants.js @@ -23,9 +23,6 @@ define([], */ var ShapeEditorConstants = { - // Indicates that a control point is associated with annotation. - ANNOTATION: "annotation", - // Indicates a control point is associated with a location. LOCATION: "location", diff --git a/src/util/editor/SurfaceCircleEditorFragment.js b/src/util/editor/SurfaceCircleEditorFragment.js index 65d4548b1..85c7ec66f 100644 --- a/src/util/editor/SurfaceCircleEditorFragment.js +++ b/src/util/editor/SurfaceCircleEditorFragment.js @@ -19,92 +19,72 @@ define([ './BaseSurfaceEditorFragment', '../../geom/Location', - '../../shapes/Placemark', './ShapeEditorConstants', - '../../shapes/SurfaceCircle', - '../../geom/Vec3' + '../../shapes/SurfaceCircle' ], function (BaseSurfaceEditorFragment, Location, - Placemark, ShapeEditorConstants, - SurfaceCircle, - Vec3) { + SurfaceCircle) { "use strict"; - //Internal use only. Intentionally not documented. + // Internal use only. var SurfaceCircleEditorFragment = function () {}; SurfaceCircleEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); - //Internal use only. Intentionally not documented. + // Internal use only. SurfaceCircleEditorFragment.prototype.canHandle = function (shape) { return shape instanceof SurfaceCircle; }; - //Internal use only. Intentionally not documented. + // Internal use only. SurfaceCircleEditorFragment.prototype.createShadowShape = function (shape) { return new SurfaceCircle(shape.center, shape.radius, shape.attributes); }; - //Internal use only. Intentionally not documented. + // Internal use only. SurfaceCircleEditorFragment.prototype.getShapeCenter = function (shape) { return shape.center; }; - //Internal use only. Intentionally not documented. - SurfaceCircleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { - var controlPoint = new Placemark( - Location.ZERO, - false, - sizeControlPointAttributes - ); - - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.size = shape.radius; - controlPoint.userProperties.id = 0; - controlPoint.userProperties.purpose = ShapeEditorConstants.OUTER_RADIUS; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; + // Internal use only. + SurfaceCircleEditorFragment.prototype.initializeControlElements = function (shape, + controlPoints, + accessories, + sizeControlPointAttributes) { - controlPoints.push(controlPoint); + this.createControlPoint(sizeControlPointAttributes, ShapeEditorConstants.OUTER_RADIUS, controlPoints); }; - //Internal use only. Intentionally not documented. - SurfaceCircleEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, alternateAction) { - var delta = this.computeControlPointDelta(globe, previousPosition, terrainPosition); - var centerPoint = globe.computePointFromPosition( - shape.center.latitude, - shape.center.longitude, - 0, - new Vec3(0, 0, 0) - ); - var markerPoint = globe.computePointFromPosition( - controlPoint.position.latitude, - controlPoint.position.longitude, - 0, - new Vec3(0, 0, 0) + // Internal use only. + SurfaceCircleEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints) { + Location.greatCircleLocation( + shape.center, + 90, + shape.radius / globe.equatorialRadius, + controlPoints[0].position ); - var vMarker = markerPoint.subtract(centerPoint).normalize(); + controlPoints[0].userProperties.size = shape.radius; + }; + + // Internal use only. + SurfaceCircleEditorFragment.prototype.reshape = function (shape, + globe, + controlPoint, + currentPosition, + previousPosition) { - var radius = shape.radius + delta.dot(vMarker); + var delta = this.computeControlPointDelta(globe, currentPosition, previousPosition); + var vector = this.computeControlPointDelta(globe, controlPoint.position, shape.center).normalize(); + + var radius = shape.radius + delta.dot(vector); if (radius > 0) { shape.radius = radius; } }; - //Internal use only. Intentionally not documented. - SurfaceCircleEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, accessories) { - var radiusLocation = Location.greatCircleLocation( - shape.center, - 90, - shape.radius / globe.equatorialRadius, - new Location(0, 0)); - - controlPoints[0].position = radiusLocation; - controlPoints[0].userProperties.size = shape.radius; - }; - return SurfaceCircleEditorFragment; } ); \ No newline at end of file diff --git a/src/util/editor/SurfaceEllipseEditorFragment.js b/src/util/editor/SurfaceEllipseEditorFragment.js index 4561c0acc..85cbbcecc 100644 --- a/src/util/editor/SurfaceEllipseEditorFragment.js +++ b/src/util/editor/SurfaceEllipseEditorFragment.js @@ -19,30 +19,26 @@ define([ './BaseSurfaceEditorFragment', '../../geom/Location', - '../../shapes/Placemark', './ShapeEditorConstants', - '../../shapes/SurfaceEllipse', - '../../geom/Vec3' + '../../shapes/SurfaceEllipse' ], function (BaseSurfaceEditorFragment, Location, - Placemark, ShapeEditorConstants, - SurfaceEllipse, - Vec3) { + SurfaceEllipse) { "use strict"; - //Internal use only. Intentionally not documented. + // Internal use only. var SurfaceEllipseEditorFragment = function () {}; SurfaceEllipseEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); - //Internal use only. Intentionally not documented. + // Internal use only. SurfaceEllipseEditorFragment.prototype.canHandle = function (shape) { return shape instanceof SurfaceEllipse; }; - //Internal use only. Intentionally not documented. + // Internal use only. SurfaceEllipseEditorFragment.prototype.createShadowShape = function (shape) { return new SurfaceEllipse( shape.center, @@ -53,128 +49,85 @@ define([ ); }; - //Internal use only. Intentionally not documented. + // Internal use only. SurfaceEllipseEditorFragment.prototype.getShapeCenter = function (shape) { return shape.center; }; - //Internal use only. Intentionally not documented. - SurfaceEllipseEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { - var controlPoint; + // Internal use only. + SurfaceEllipseEditorFragment.prototype.initializeControlElements = function (shape, + controlPoints, + accessories, + sizeControlPointAttributes, + angleControlPointAttributes) { - controlPoint = new Placemark( - Location.ZERO, - false, - sizeControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 0; - controlPoint.userProperties.purpose = ShapeEditorConstants.WIDTH; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - - controlPoint = new Placemark( - Location.ZERO, - false, - sizeControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 1; - controlPoint.userProperties.purpose = ShapeEditorConstants.HEIGHT; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - - controlPoint = new Placemark( - Location.ZERO, - false, - angleControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 2; - controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - - this.makeAccessory(accessories, angleControlPointAttributes); - }; - - //Internal use only. Intentionally not documented. - SurfaceEllipseEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, alternateAction) { - var terrainPoint = globe.computePointFromPosition( - terrainPosition.latitude, - terrainPosition.longitude, - 0, - new Vec3(0, 0, 0) - ); - var previousPoint = globe.computePointFromPosition( - previousPosition.latitude, - previousPosition.longitude, - 0, - new Vec3(0, 0, 0) - ); - var delta = terrainPoint.subtract(previousPoint); - - var centerPoint = globe.computePointFromPosition( - shape.center.latitude, - shape.center.longitude, - 0, - new Vec3(0, 0, 0) - ); - var markerPoint = globe.computePointFromPosition( - controlPoint.position.latitude, - controlPoint.position.longitude, - 0, - new Vec3(0, 0, 0) - ); - var vMarker = markerPoint.subtract(centerPoint).normalize(); - - if (controlPoint.userProperties.purpose === ShapeEditorConstants.WIDTH || - controlPoint.userProperties.purpose === ShapeEditorConstants.HEIGHT) { - var majorRadius = shape.majorRadius + (controlPoint.userProperties.id === 0 ? delta.dot(vMarker) : 0); - var minorRadius = shape.minorRadius + (controlPoint.userProperties.id === 1 ? delta.dot(vMarker) : 0); + this.createControlPoint(sizeControlPointAttributes, ShapeEditorConstants.WIDTH, controlPoints); + this.createControlPoint(sizeControlPointAttributes, ShapeEditorConstants.HEIGHT, controlPoints); + this.createControlPoint(angleControlPointAttributes, ShapeEditorConstants.ROTATION, controlPoints); - if (majorRadius > 0 && minorRadius > 0) { - shape.majorRadius = majorRadius; - shape.minorRadius = minorRadius; - } - } else { - var oldHeading = Location.greatCircleAzimuth(shape.center, previousPosition); - var deltaHeading = Location.greatCircleAzimuth(shape.center, terrainPosition) - oldHeading; - shape.heading = this.normalizedHeading(shape.heading, deltaHeading); - } + this.initializeRotationAccessory(accessories, angleControlPointAttributes); }; - //Internal use only. Intentionally not documented. - SurfaceEllipseEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, accessories) { - var majorLocation = Location.greatCircleLocation( + // Internal use only. + SurfaceEllipseEditorFragment.prototype.updateControlElements = function (shape, + globe, + controlPoints, + accessories) { + Location.greatCircleLocation( shape.center, 90 + shape.heading, shape.majorRadius / globe.equatorialRadius, - new Location(0, 0)); + controlPoints[0].position + ); - var minorLocation = Location.greatCircleLocation( + Location.greatCircleLocation( shape.center, shape.heading, shape.minorRadius / globe.equatorialRadius, - new Location(0, 0)); + controlPoints[1].position + ); - var rotationLocation = Location.greatCircleLocation( + Location.greatCircleLocation( shape.center, shape.heading, - 1.15 * shape.minorRadius / globe.equatorialRadius, - new Location(0, 0) + 1.6 * shape.minorRadius / globe.equatorialRadius, + controlPoints[2].position ); - controlPoints[0].position = majorLocation; controlPoints[0].userProperties.size = shape.majorRadius; - - controlPoints[1].position = minorLocation; controlPoints[1].userProperties.size = shape.minorRadius; - - controlPoints[2].position = rotationLocation; controlPoints[2].userProperties.rotation = shape.heading; - this.updateOrientationLine(shape.center, rotationLocation, accessories); + this.updateRotationAccessory(shape.center, controlPoints[2].position, accessories); + }; + + // Internal use only. + SurfaceEllipseEditorFragment.prototype.reshape = function (shape, + globe, + controlPoint, + currentPosition, + previousPosition) { + + var delta = this.computeControlPointDelta(globe, currentPosition, previousPosition); + var vector = this.computeControlPointDelta(globe, controlPoint.position, shape.center).normalize(); + + if (controlPoint.userProperties.purpose === ShapeEditorConstants.WIDTH) { + var majorRadius = shape.majorRadius + delta.dot(vector) * 2 ; + if (majorRadius > 0) { + shape.majorRadius = majorRadius; + } + + } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.HEIGHT) { + var minorRadius = shape.minorRadius + delta.dot(vector) * 2; + if (minorRadius > 0) { + shape.minorRadius = minorRadius; + } + + } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { + var oldHeading = Location.greatCircleAzimuth(shape.center, previousPosition); + var deltaHeading = Location.greatCircleAzimuth(shape.center, currentPosition) - oldHeading; + shape.heading = this.normalizedHeading(shape.heading, deltaHeading); + } }; return SurfaceEllipseEditorFragment; diff --git a/src/util/editor/SurfaceRectangleEditorFragment.js b/src/util/editor/SurfaceRectangleEditorFragment.js index 79663e593..17f5baff6 100644 --- a/src/util/editor/SurfaceRectangleEditorFragment.js +++ b/src/util/editor/SurfaceRectangleEditorFragment.js @@ -19,30 +19,26 @@ define([ './BaseSurfaceEditorFragment', '../../geom/Location', - '../../shapes/Placemark', './ShapeEditorConstants', - '../../shapes/SurfaceRectangle', - '../../geom/Vec3' + '../../shapes/SurfaceRectangle' ], function (BaseSurfaceEditorFragment, Location, - Placemark, ShapeEditorConstants, - SurfaceRectangle, - Vec3) { + SurfaceRectangle) { "use strict"; - //Internal use only. Intentionally not documented. + // Internal use only. var SurfaceRectangleEditorFragment = function () {}; SurfaceRectangleEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); - //Internal use only. Intentionally not documented. + // Internal use only. SurfaceRectangleEditorFragment.prototype.canHandle = function (shape) { return shape instanceof SurfaceRectangle; }; - //Internal use only. Intentionally not documented. + // Internal use only. SurfaceRectangleEditorFragment.prototype.createShadowShape = function (shape) { return new SurfaceRectangle( shape.center, @@ -53,128 +49,85 @@ define([ ); }; - //Internal use only. Intentionally not documented. + // Internal use only. SurfaceRectangleEditorFragment.prototype.getShapeCenter = function (shape) { - return null; + return shape.center; }; - //Internal use only. Intentionally not documented. - SurfaceRectangleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { - var controlPoint; + // Internal use only. + SurfaceRectangleEditorFragment.prototype.initializeControlElements = function (shape, + controlPoints, + accessories, + sizeControlPointAttributes, + angleControlPointAttributes) { - controlPoint = new Placemark( - Location.ZERO, - false, - sizeControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 0; - controlPoint.userProperties.purpose = ShapeEditorConstants.WIDTH; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - - controlPoint = new Placemark( - Location.ZERO, - false, - sizeControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 1; - controlPoint.userProperties.purpose = ShapeEditorConstants.HEIGHT; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - - controlPoint = new Placemark( - Location.ZERO, - false, - angleControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = 1; - controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - - this.makeAccessory(accessories, angleControlPointAttributes); - }; + this.createControlPoint(sizeControlPointAttributes, ShapeEditorConstants.WIDTH, controlPoints); + this.createControlPoint(sizeControlPointAttributes, ShapeEditorConstants.HEIGHT, controlPoints); + this.createControlPoint(angleControlPointAttributes, ShapeEditorConstants.ROTATION, controlPoints); - //Internal use only. Intentionally not documented. - SurfaceRectangleEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, alternateAction) { - var terrainPoint = globe.computePointFromPosition( - terrainPosition.latitude, - terrainPosition.longitude, - 0, - new Vec3(0, 0, 0) - ); - var previousPoint = globe.computePointFromPosition( - previousPosition.latitude, - previousPosition.longitude, - 0, - new Vec3(0, 0, 0) - ); - var delta = terrainPoint.subtract(previousPoint); - - var centerPoint = globe.computePointFromPosition( - shape.center.latitude, - shape.center.longitude, - 0, - new Vec3(0, 0, 0) - ); - var markerPoint = globe.computePointFromPosition( - controlPoint.position.latitude, - controlPoint.position.longitude, - 0, - new Vec3(0, 0, 0) - ); - var vMarker = markerPoint.subtract(centerPoint).normalize(); - - if (controlPoint.userProperties.purpose === ShapeEditorConstants.WIDTH - || controlPoint.userProperties.purpose === ShapeEditorConstants.HEIGHT) { - var width = shape.width + (controlPoint.userProperties.id === 0 ? delta.dot(vMarker) * 2 : 0); - var height = shape.height + (controlPoint.userProperties.id === 1 ? delta.dot(vMarker) * 2 : 0); - - if (width > 0 && height > 0) { - shape.width = width; - shape.height = height; - } - } - else { - var oldHeading = Location.greatCircleAzimuth(shape.center, previousPosition); - var deltaHeading = Location.greatCircleAzimuth(shape.center, terrainPosition) - oldHeading; - shape.heading = this.normalizedHeading(shape.heading, deltaHeading); - } + this.initializeRotationAccessory(accessories, angleControlPointAttributes); }; - //Internal use only. Intentionally not documented. - SurfaceRectangleEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { - var widthLocation = Location.greatCircleLocation( + // Internal use only. + SurfaceRectangleEditorFragment.prototype.updateControlElements = function (shape, + globe, + controlPoints, + accessories) { + Location.greatCircleLocation( shape.center, 90 + shape.heading, 0.5 * shape.width / globe.equatorialRadius, - new Location(0, 0)); + controlPoints[0].position + ); - var heightLocation = Location.greatCircleLocation( + Location.greatCircleLocation( shape.center, shape.heading, 0.5 * shape.height / globe.equatorialRadius, - new Location(0, 0)); + controlPoints[1].position + ); - var rotationLocation = Location.greatCircleLocation( + Location.greatCircleLocation( shape.center, shape.heading, - 0.7 * shape.height / globe.equatorialRadius, - new Location(0, 0)); + 0.8 * shape.height / globe.equatorialRadius, + controlPoints[2].position + ); - controlPoints[0].position = widthLocation; controlPoints[0].userProperties.size = shape.width; - - controlPoints[1].position = heightLocation; controlPoints[1].userProperties.size = shape.height; - - controlPoints[2].position = rotationLocation; controlPoints[2].userProperties.rotation = shape.heading; - this.updateOrientationLine(shape.center, rotationLocation, accessories); + this.updateRotationAccessory(shape.center, controlPoints[2].position, accessories); + }; + + // Internal use only. + SurfaceRectangleEditorFragment.prototype.reshape = function (shape, + globe, + controlPoint, + currentPosition, + previousPosition) { + + var delta = this.computeControlPointDelta(globe, currentPosition, previousPosition); + var vector = this.computeControlPointDelta(globe, controlPoint.position, shape.center).normalize(); + + if (controlPoint.userProperties.purpose === ShapeEditorConstants.WIDTH) { + var width = shape.width + delta.dot(vector) * 2 ; + if (width > 0) { + shape.width = width; + } + + } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.HEIGHT) { + var height = shape.height + delta.dot(vector) * 2; + if (height > 0) { + shape.height = height; + } + + } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { + var oldHeading = Location.greatCircleAzimuth(shape.center, previousPosition); + var deltaHeading = Location.greatCircleAzimuth(shape.center, currentPosition) - oldHeading; + shape.heading = this.normalizedHeading(shape.heading, deltaHeading); + } }; return SurfaceRectangleEditorFragment; From b59e2e460bfb3f843b901b27a6cbc85529af9234 Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Mon, 25 Jun 2018 16:58:11 +0200 Subject: [PATCH 039/112] Clean up fragments for Polygon and Polyline --- src/util/editor/BaseSurfaceEditorFragment.js | 25 +- src/util/editor/ShapeEditor.js | 4 +- .../editor/SurfaceCircleEditorFragment.js | 2 +- .../editor/SurfaceEllipseEditorFragment.js | 6 +- .../editor/SurfacePolygonEditorFragment.js | 233 ++++++++---------- .../editor/SurfacePolylineEditorFragment.js | 217 +++++++--------- .../editor/SurfaceRectangleEditorFragment.js | 6 +- 7 files changed, 221 insertions(+), 272 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index 0c9491d8e..e6fde2a2f 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -163,13 +163,16 @@ define([ return (count === 0) ? 0 : totalDistance / globe.equatorialRadius; }; - BaseSurfaceEditorFragment.prototype.createControlPoint = function(attributes, purpose, controlPoints) { + BaseSurfaceEditorFragment.prototype.createControlPoint = function(controlPoints, attributes, purpose, index) { var controlPoint = new Placemark( new Location(0, 0), false, attributes ); controlPoint.userProperties.purpose = purpose; + if (typeof index !== "undefined") { + controlPoint.userProperties.index = index; + } controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; controlPoints.push(controlPoint); }; @@ -260,7 +263,23 @@ define([ } }; + BaseSurfaceEditorFragment.prototype.deepCopyLocations = function(locations) { + var newLocations = []; + + if (locations.length > 0 && locations[0].length > 2) { + for (var i = 0, ilen = locations.length; i < ilen; i++) { + for (var j = 0, jlen = locations[i].length; j < jlen; j++) { + newLocations.push(new Location(locations[i][j].latitude, locations[i][j].longitude)); + } + } + } else { + for (var i = 0, len = locations.length; i < len; i++) { + newLocations.push(new Location(locations[i].latitude, locations[i].longitude)); + } + } + return newLocations; + } BaseSurfaceEditorFragment.prototype.nearestPointOnSegment = function (p1, p2, point) { var segment = p2.subtract(p1); @@ -287,7 +306,7 @@ define([ * @param {Position} terrainPosition The position selected by the user. * @returns {Position} The position after move. */ - BaseSurfaceEditorFragment.prototype.moveLocation = function (globe, controlPoint, terrainPosition, previousPosition) { + BaseSurfaceEditorFragment.prototype.moveLocation = function (globe, controlPoint, terrainPosition, previousPosition, result) { var delta = this.computeControlPointDelta(globe, previousPosition, terrainPosition); var markerPoint = globe.computePointFromPosition( controlPoint.position.latitude, @@ -301,7 +320,7 @@ define([ markerPoint[0], markerPoint[1], markerPoint[2], - new Position(0, 0, 0) + result ); }; diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index d2a3bc5fa..e402dc0fc 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -139,8 +139,7 @@ define([ new SurfaceEllipseEditorFragment(), new SurfacePolygonEditorFragment(), new SurfacePolylineEditorFragment(), - new SurfaceRectangleEditorFragment(), - new SurfaceSectorEditorFragment() + new SurfaceRectangleEditorFragment() ]; // Internal use only. @@ -521,6 +520,7 @@ define([ var editingAttributes = new ShapeAttributes(this.originalHighlightAttributes); editingAttributes.interiorColor.alpha = editingAttributes.interiorColor.alpha * 0.7; + this._shape.highlightAttributes = editingAttributes; var shadowShape = this.activeEditorFragment.createShadowShape(this._shape); shadowShape.highlightAttributes = new ShapeAttributes(this.originalHighlightAttributes); diff --git a/src/util/editor/SurfaceCircleEditorFragment.js b/src/util/editor/SurfaceCircleEditorFragment.js index 85c7ec66f..b76d5725c 100644 --- a/src/util/editor/SurfaceCircleEditorFragment.js +++ b/src/util/editor/SurfaceCircleEditorFragment.js @@ -54,7 +54,7 @@ define([ accessories, sizeControlPointAttributes) { - this.createControlPoint(sizeControlPointAttributes, ShapeEditorConstants.OUTER_RADIUS, controlPoints); + this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.OUTER_RADIUS); }; // Internal use only. diff --git a/src/util/editor/SurfaceEllipseEditorFragment.js b/src/util/editor/SurfaceEllipseEditorFragment.js index 85cbbcecc..b098e19fe 100644 --- a/src/util/editor/SurfaceEllipseEditorFragment.js +++ b/src/util/editor/SurfaceEllipseEditorFragment.js @@ -61,9 +61,9 @@ define([ sizeControlPointAttributes, angleControlPointAttributes) { - this.createControlPoint(sizeControlPointAttributes, ShapeEditorConstants.WIDTH, controlPoints); - this.createControlPoint(sizeControlPointAttributes, ShapeEditorConstants.HEIGHT, controlPoints); - this.createControlPoint(angleControlPointAttributes, ShapeEditorConstants.ROTATION, controlPoints); + this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.WIDTH); + this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.HEIGHT); + this.createControlPoint(controlPoints, angleControlPointAttributes, ShapeEditorConstants.ROTATION); this.initializeRotationAccessory(accessories, angleControlPointAttributes); }; diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index 07a11371c..c3fcd6f2c 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -19,107 +19,136 @@ define([ './BaseSurfaceEditorFragment', '../../geom/Location', - '../../shapes/Placemark', '../../geom/Position', './ShapeEditorConstants', - '../../shapes/SurfacePolygon', - '../../geom/Vec3' + '../../shapes/SurfacePolygon' ], function (BaseSurfaceEditorFragment, Location, - Placemark, Position, ShapeEditorConstants, - SurfacePolygon, - Vec3) { + SurfacePolygon) { "use strict"; - //Internal use only. Intentionally not documented. + // Internal use only. var SurfacePolygonEditorFragment = function () { this.currentHeading = 0; + this.locationControlPointAttributes = null; }; SurfacePolygonEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); - //Internal use only. Intentionally not documented. + // Internal use only. SurfacePolygonEditorFragment.prototype.canHandle = function (shape) { return shape instanceof SurfacePolygon; }; - //Internal use only. Intentionally not documented. + // Internal use only. SurfacePolygonEditorFragment.prototype.createShadowShape = function (shape) { - return new SurfacePolygon(shape.boundaries, shape.attributes); + return new SurfacePolygon(this.deepCopyLocations(shape.boundaries), shape.attributes); }; - //Internal use only. Intentionally not documented. - SurfacePolygonEditorFragment.prototype.getShapeCenter = function (shape) { - return null; + // Internal use only. + SurfacePolygonEditorFragment.prototype.getShapeCenter = function (shape, globe) { + return this.getCenter(globe, shape.boundaries); }; - //Internal use only. Intentionally not documented. - SurfacePolygonEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, alternateAction) { - var boundaries = shape.boundaries; - - var k = 0; - var newPos; - - if (boundaries.length > 0 && boundaries[0].length > 2) { - outer: - for (var i = 0; i < boundaries.length; i++) { - for (var j = 0; j < boundaries[i].length; j++) { - if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { - if (controlPoint.userProperties.id === k) { - newPos = this.moveLocation(globe, controlPoint, terrainPosition, previousPosition); - boundaries[i][j] = newPos; - shape.boundaries = boundaries; - controlPoint.position = newPos; - break outer; - } - } - else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { - this.rotateLocations(globe, terrainPosition, previousPosition, boundaries); - shape.boundaries = boundaries; - break outer; - } - k++; - } - } + // Internal use only. + SurfacePolygonEditorFragment.prototype.initializeControlElements = function (shape, + controlPoints, + accessories, + sizeControlPointAttributes, + angleControlPointAttributes, + locationControlPointAttributes) { + this.currentHeading = 0; + this.locationControlPointAttributes = locationControlPointAttributes; + + var locations = this.getLocations(shape); + + for (var i = 0, len = locations.length; i < len; i++) { + this.createControlPoint( + controlPoints, + locationControlPointAttributes, + ShapeEditorConstants.LOCATION, + i + ); } - else if (boundaries.length >= 2) { - //poly without whole - for (var i = 0; i < boundaries.length; i++) { - if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { - if (controlPoint.userProperties.id === k) { - if (currentEvent.altKey) { - //remove location - var minSize = shape instanceof SurfacePolygon ? 3 : 2; - if (boundaries.length > minSize) { - // Delete the control point. - boundaries.splice(i, 1); - shape.boundaries = boundaries; - this.removeControlPoints(); - } - } - else { - newPos = this.moveLocation(globe, controlPoint, terrainPosition, previousPosition); - boundaries[i] = newPos; - shape.boundaries = boundaries; - controlPoint.position = newPos; - } - break; - } - } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { - this.rotateLocations(globe, terrainPosition, previousPosition, boundaries); - shape.boundaries = boundaries; - break; - } - k++; + + this.createControlPoint(controlPoints, angleControlPointAttributes, ShapeEditorConstants.ROTATION); + + this.initializeRotationAccessory(accessories, angleControlPointAttributes); + }; + + // Internal use only. + SurfacePolygonEditorFragment.prototype.updateControlElements = function (shape, + globe, + controlPoints, + accessories) { + var locations = this.getLocations(shape); + + var rotationControlPoint = controlPoints.pop(); + + var lenControlPoints = controlPoints.length; + + for (var i = 0, len = locations.length; i < len; i++) { + if (i >= lenControlPoints) { + this.createControlPoint( + controlPoints, + this.locationControlPointAttributes, + ShapeEditorConstants.LOCATION, + i + ); + } + controlPoints[i].position = locations[i]; + } + + var polygonCenter = this.getCenter(globe, locations); + var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); + + Location.greatCircleLocation( + polygonCenter, + this.currentHeading, + polygonRadius, + rotationControlPoint.position + ); + + rotationControlPoint.userProperties.rotation = this.currentHeading; + + controlPoints.push(rotationControlPoint); + + this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); + }; + + // Internal use only. + SurfacePolygonEditorFragment.prototype.reshape = function (shape, + globe, + controlPoint, + newPosition, + previousPosition, + alternateAction) { + var locations = this.getLocations(shape); + + if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { + this.rotateLocations(globe, newPosition, previousPosition, locations); + shape.resetBoundaries(); + shape._stateId = SurfacePolygon.stateId++; + shape.stateKeyInvalid = true; + + } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { + var index = controlPoint.userProperties.index; + if (alternateAction) { + // TODO Implement removal of the control point + } else { + this.moveLocation(globe, controlPoint, previousPosition, newPosition, locations[index]); } + shape.resetBoundaries(); + shape._stateId = SurfacePolygon.stateId++; + shape.stateKeyInvalid = true; } }; - //Internal use only. Intentionally not documented. - SurfacePolygonEditorFragment.prototype.updateControlPoints = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { + // Internal use only. + SurfacePolygonEditorFragment.prototype.getLocations = function (shape) { var locations = []; if (shape.boundaries.length > 0 && shape.boundaries[0].length > 2) { @@ -128,69 +157,15 @@ define([ locations.push(shape.boundaries[i][j]); } } - } - else if (shape.boundaries.length >= 2) { + } else if (shape.boundaries.length >= 2) { for (var i = 0; i < shape.boundaries.length; i++) { locations.push(shape.boundaries[i]); } } - if (locations.length < 2) - return; - - var polygonCenter = this.getCenter(globe, locations); - var shapeRadius = this.getAverageDistance(globe, polygonCenter, locations); - shapeRadius = shapeRadius * 1.2; - var heading = this.currentHeading; - var rotationControlLocation = Location.greatCircleLocation( - polygonCenter, - heading, - shapeRadius, - new Location(0, 0)); - - var rotationPosition = new Position( - rotationControlLocation.latitude, - rotationControlLocation.longitude, - 0); - - if (controlPoints.length > 0) { - for (var i = 0; i < locations.length; i++) { - controlPoints[i].position = locations[i]; - } - controlPoints[locations.length].position = rotationPosition; - controlPoints[locations.length].userProperties.rotation = heading; - } - else { - var controlPoint; - - for (var i = 0; i < locations.length; i++) { - controlPoint = new Placemark( - locations[i], - false, - locationControlPointAttributes); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = i; - controlPoint.userProperties.purpose = ShapeEditorConstants.LOCATION; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - } - - controlPoint = new Placemark( - rotationPosition, - false, - angleControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = locations.length; - controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; - controlPoint.userProperties.rotation = heading; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - } - - this.updateOrientationLine(polygonCenter, rotationPosition, accessories); + return locations; }; return SurfacePolygonEditorFragment; } -); \ No newline at end of file +); diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index 59223af62..85961f4b6 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -19,19 +19,15 @@ define([ './BaseSurfaceEditorFragment', '../../geom/Location', - '../../shapes/Placemark', '../../geom/Position', './ShapeEditorConstants', '../../shapes/SurfacePolyline', - '../../geom/Vec3' ], function (BaseSurfaceEditorFragment, Location, - Placemark, Position, ShapeEditorConstants, - SurfacePolyline, - Vec3) { + SurfacePolyline) { "use strict"; //Internal use only. Intentionally not documented. @@ -46,147 +42,106 @@ define([ //Internal use only. Intentionally not documented. SurfacePolylineEditorFragment.prototype.createShadowShape = function (shape) { - return new SurfacePolyline(shape.boundaries, shape.attributes); + return new SurfacePolyline(this.deepCopyLocations(shape.boundaries), shape.attributes); }; //Internal use only. Intentionally not documented. - SurfacePolylineEditorFragment.prototype.getShapeCenter = function (shape) { - return null; + SurfacePolylineEditorFragment.prototype.getShapeCenter = function (shape, globe) { + return this.getCenter(globe, shape.boundaries); }; - //Internal use only. Intentionally not documented. - SurfacePolylineEditorFragment.prototype.reshape = function (shape, globe, controlPoint, terrainPosition, previousPosition, alternateAction) { - var boundaries = shape.boundaries; - - var k = 0; - var newPos; - - if (boundaries.length > 0 && boundaries[0].length > 2) { - outer: - for (var i = 0; i < boundaries.length; i++) { - for (var j = 0; j < boundaries[i].length; j++) { - if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { - if (controlPoint.userProperties.id === k) { - newPos = this.moveLocation(globe, controlPoint, terrainPosition, previousPosition); - boundaries[i][j] = newPos; - shape.boundaries = boundaries; - controlPoint.position = newPos; - break outer; - } - } - else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { - this.rotateLocations(globe, terrainPosition, previousPosition, boundaries); - shape.boundaries = boundaries; - break outer; - } - k++; - } - } - } - else if (boundaries.length >= 2) { - //poly without whole - for (var i = 0; i < boundaries.length; i++) { - if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { - if (controlPoint.userProperties.id === k) { - if (alternateAction) { - //remove location - var minSize = shape instanceof SurfacePolygon ? 3 : 2; - if (boundaries.length > minSize) { - // Delete the control point. - boundaries.splice(i, 1); - shape.boundaries = boundaries; - this.removeControlPoints(); - } - } - else { - newPos = this.moveLocation(globe, controlPoint, terrainPosition, previousPosition); - boundaries[i] = newPos; - shape.boundaries = boundaries; - controlPoint.position = newPos; - } - break; - } - } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { - this.rotateLocations(globe, terrainPosition, previousPosition, boundaries); - shape.boundaries = boundaries; - break; - } - k++; - } + // Internal use only. + SurfacePolylineEditorFragment.prototype.initializeControlElements = function (shape, + controlPoints, + accessories, + sizeControlPointAttributes, + angleControlPointAttributes, + locationControlPointAttributes) { + this.currentHeading = 0; + this.locationControlPointAttributes = locationControlPointAttributes; + + var locations = shape.boundaries; + + for (var i = 0, len = locations.length; i < len; i++) { + this.createControlPoint( + controlPoints, + locationControlPointAttributes, + ShapeEditorConstants.LOCATION, + i + ); } + + this.createControlPoint(controlPoints, angleControlPointAttributes, ShapeEditorConstants.ROTATION); + + this.initializeRotationAccessory(accessories, angleControlPointAttributes); }; - //Internal use only. Intentionally not documented. - SurfacePolylineEditorFragment.prototype.updateControlPoints = function (shape, globe, controlPoints, accessories, sizeControlPointAttributes, angleControlPointAttributes, locationControlPointAttributes) { - var locations = []; - - if (shape.boundaries.length > 0 && shape.boundaries[0].length > 2) { - for (var i = 0; i < shape.boundaries.length; i++) { - for (var j = 0; j < shape.boundaries[i].length; j++) { - locations.push(shape.boundaries[i][j]); - } - } - } - else if (shape.boundaries.length >= 2) { - for (var i = 0; i < shape.boundaries.length; i++) { - locations.push(shape.boundaries[i]); + // Internal use only. + SurfacePolylineEditorFragment.prototype.updateControlElements = function (shape, + globe, + controlPoints, + accessories) { + var locations = shape.boundaries; + + var rotationControlPoint = controlPoints.pop(); + + var lenControlPoints = controlPoints.length; + + for (var i = 0, len = locations.length; i < len; i++) { + if (i >= lenControlPoints) { + this.createControlPoint( + controlPoints, + this.locationControlPointAttributes, + ShapeEditorConstants.LOCATION, + i + ); } + controlPoints[i].position = locations[i]; } - if (locations.length < 2) - return; - var polygonCenter = this.getCenter(globe, locations); - var shapeRadius = this.getAverageDistance(globe, polygonCenter, locations); - shapeRadius = shapeRadius * 1.2; - var heading = this.currentHeading; - var rotationControlLocation = Location.greatCircleLocation( + var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); + + Location.greatCircleLocation( polygonCenter, - heading, - shapeRadius, - new Location(0, 0)); - - var rotationPosition = new Position( - rotationControlLocation.latitude, - rotationControlLocation.longitude, - 0); - - if (controlPoints.length > 0) { - for (var i = 0; i < locations.length; i++) { - controlPoints[i].position = locations[i]; - } - controlPoints[locations.length].position = rotationPosition; - controlPoints[locations.length].userProperties.rotation = heading; - } - else { - var controlPoint; - - for (var i = 0; i < locations.length; i++) { - controlPoint = new Placemark( - locations[i], - false, - locationControlPointAttributes); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = i; - controlPoint.userProperties.purpose = ShapeEditorConstants.LOCATION; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - } + this.currentHeading, + polygonRadius, + rotationControlPoint.position + ); - controlPoint = new Placemark( - rotationPosition, - false, - angleControlPointAttributes - ); - controlPoint.userProperties.isControlPoint = true; - controlPoint.userProperties.id = locations.length; - controlPoint.userProperties.purpose = ShapeEditorConstants.ROTATION; - controlPoint.userProperties.rotation = heading; - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - } + rotationControlPoint.userProperties.rotation = this.currentHeading; - this.updateOrientationLine(polygonCenter, rotationPosition, accessories); + controlPoints.push(rotationControlPoint); + + this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); + }; + + // Internal use only. + SurfacePolylineEditorFragment.prototype.reshape = function (shape, + globe, + controlPoint, + newPosition, + previousPosition, + alternateAction) { + var locations = shape.boundaries; + + if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { + this.rotateLocations(globe, newPosition, previousPosition, locations); + shape.resetBoundaries(); + shape._stateId = SurfacePolyline.stateId++; + shape.stateKeyInvalid = true; + + } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { + var index = controlPoint.userProperties.index; + if (alternateAction) { + // TODO Implement removal of the control point + } else { + this.moveLocation(globe, controlPoint, previousPosition, newPosition, locations[index]); + } + shape.resetBoundaries(); + shape._stateId = SurfacePolyline.stateId++; + shape.stateKeyInvalid = true; + } }; return SurfacePolylineEditorFragment; diff --git a/src/util/editor/SurfaceRectangleEditorFragment.js b/src/util/editor/SurfaceRectangleEditorFragment.js index 17f5baff6..5a53a5e9b 100644 --- a/src/util/editor/SurfaceRectangleEditorFragment.js +++ b/src/util/editor/SurfaceRectangleEditorFragment.js @@ -61,9 +61,9 @@ define([ sizeControlPointAttributes, angleControlPointAttributes) { - this.createControlPoint(sizeControlPointAttributes, ShapeEditorConstants.WIDTH, controlPoints); - this.createControlPoint(sizeControlPointAttributes, ShapeEditorConstants.HEIGHT, controlPoints); - this.createControlPoint(angleControlPointAttributes, ShapeEditorConstants.ROTATION, controlPoints); + this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.WIDTH); + this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.HEIGHT); + this.createControlPoint(controlPoints, angleControlPointAttributes, ShapeEditorConstants.ROTATION); this.initializeRotationAccessory(accessories, angleControlPointAttributes); }; From 4c92733b4425e66045fa33779d50c5eb147695b3 Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Mon, 25 Jun 2018 22:11:40 +0200 Subject: [PATCH 040/112] Address issues in the edition of polygons and polylines --- examples/ShapeEditor.html | 1 + examples/ShapeEditor.js | 32 ++++++++++++- src/util/editor/BaseSurfaceEditorFragment.js | 17 +++---- src/util/editor/ShapeEditorConstants.js | 16 +++---- .../editor/SurfaceCircleEditorFragment.js | 14 +++--- .../editor/SurfacePolygonEditorFragment.js | 47 +++++++++++++++++-- .../editor/SurfacePolylineEditorFragment.js | 45 +++++++++++------- 7 files changed, 128 insertions(+), 44 deletions(-) diff --git a/examples/ShapeEditor.html b/examples/ShapeEditor.html index 3679ef212..18d3317f2 100644 --- a/examples/ShapeEditor.html +++ b/examples/ShapeEditor.html @@ -30,6 +30,7 @@

Shape editing

+ diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index c69fd6895..4bad338a6 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -71,11 +71,34 @@ requirejs(['./WorldWindShim', var polygonBoundaries = []; polygonBoundaries.push(new WorldWind.Location(40, -100)); polygonBoundaries.push(new WorldWind.Location(42, -105)); - polygonBoundaries.push(new WorldWind.Location(40, -110)); + polygonBoundaries.push(new WorldWind.Location(42, -110)); + polygonBoundaries.push(new WorldWind.Location(40, -112)); var polygonShape = new WorldWind.SurfacePolygon(polygonBoundaries, attributes); polygonShape.highlightAttributes = highlightAttributes; shapesLayer.addRenderable(polygonShape); + var multiPolygonOuterBoundaries = []; + multiPolygonOuterBoundaries.push(new WorldWind.Location(40, -80)); + multiPolygonOuterBoundaries.push(new WorldWind.Location(42, -85)); + multiPolygonOuterBoundaries.push(new WorldWind.Location(42, -90)); + multiPolygonOuterBoundaries.push(new WorldWind.Location(40, -92)); + var multiPolygonInner1Boundaries = []; + multiPolygonInner1Boundaries.push(new WorldWind.Location(40.5, -86)); + multiPolygonInner1Boundaries.push(new WorldWind.Location(41.5, -86)); + multiPolygonInner1Boundaries.push(new WorldWind.Location(41.5, -85)); + multiPolygonInner1Boundaries.push(new WorldWind.Location(40.5, -83)); + var multiPolygonInner2Boundaries = []; + multiPolygonInner2Boundaries.push(new WorldWind.Location(41.5, -87)); + multiPolygonInner2Boundaries.push(new WorldWind.Location(40.5, -91)); + multiPolygonInner2Boundaries.push(new WorldWind.Location(41.5, -90)); + var multiPolygonBoundaries = []; + multiPolygonBoundaries.push(multiPolygonOuterBoundaries); + multiPolygonBoundaries.push(multiPolygonInner1Boundaries); + multiPolygonBoundaries.push(multiPolygonInner2Boundaries); + var multiPolygonShape = new WorldWind.SurfacePolygon(multiPolygonBoundaries, attributes); + multiPolygonShape.highlightAttributes = highlightAttributes; + shapesLayer.addRenderable(multiPolygonShape); + var polylineBoundaries = []; polylineBoundaries.push(new WorldWind.Location(45, -118)); polylineBoundaries.push(new WorldWind.Location(40, -115)); @@ -121,6 +144,13 @@ requirejs(['./WorldWindShim', } }); + document.getElementById("editMultiPolygonBtn").addEventListener("click", function(){ + var shape = shapeEditor.stop(); + if (shape !== multiPolygonShape) { + shapeEditor.edit(multiPolygonShape); + } + }); + document.getElementById("editPolylineBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== polylineShape) { diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index e6fde2a2f..3a5ec9733 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -268,9 +268,11 @@ define([ if (locations.length > 0 && locations[0].length > 2) { for (var i = 0, ilen = locations.length; i < ilen; i++) { + var ring = []; for (var j = 0, jlen = locations[i].length; j < jlen; j++) { - newLocations.push(new Location(locations[i][j].latitude, locations[i][j].longitude)); + ring.push(new Location(locations[i][j].latitude, locations[i][j].longitude)); } + newLocations.push(ring); } } else { for (var i = 0, len = locations.length; i < len; i++) { @@ -333,16 +335,14 @@ define([ var center = this.getCenter(globe, locations); var previousHeading = Location.greatCircleAzimuth(center, previousPosition); var deltaHeading = Location.greatCircleAzimuth(center, terrainPosition) - previousHeading; - this.currentHeading = this.normalizedHeading(this.currentHeading, deltaHeading); if (locations.length > 0 && locations[0].length > 2) { for (var i = 0; i < locations.length; i++) { for (var j = 0; j < locations[i].length; j++) { var heading = Location.greatCircleAzimuth(center, locations[i][j]); var distance = Location.greatCircleDistance(center, locations[i][j]); - var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, - new Location(0, 0)); - locations[i][j] = newLocation; + Location.greatCircleLocation(center, heading + deltaHeading, distance, + locations[i][j]); } } } @@ -350,11 +350,12 @@ define([ for (var i = 0; i < locations.length; i++) { var heading = Location.greatCircleAzimuth(center, locations[i]); var distance = Location.greatCircleDistance(center, locations[i]); - var newLocation = Location.greatCircleLocation(center, heading + deltaHeading, distance, - new Location(0, 0)); - locations[i] = newLocation; + Location.greatCircleLocation(center, heading + deltaHeading, distance, + locations[i]); } } + + return deltaHeading; }; return BaseSurfaceEditorFragment; diff --git a/src/util/editor/ShapeEditorConstants.js b/src/util/editor/ShapeEditorConstants.js index aa39012fe..f5171e6f9 100644 --- a/src/util/editor/ShapeEditorConstants.js +++ b/src/util/editor/ShapeEditorConstants.js @@ -23,24 +23,22 @@ define([], */ var ShapeEditorConstants = { - // Indicates a control point is associated with a location. + // Indicates a control point controlling a location. LOCATION: "location", - // Indicates that a control point is associated with whole-shape rotation. + // Indicates a control point controlling the rotation of shape. ROTATION: "rotation", - // Indicates that a control point is associated with width change. + // Indicates a control point controlling the width of a shape. WIDTH: "width", - // Indicates that a control point is associated with height change. + // Indicates a control point controlling the height of a shape. HEIGHT: "height", - // Indicates that a control point is associated with the right width of a shape. - RIGHT_WIDTH: "rightWidth", - - // Indicates that a control point is associated with the outer radius of a shape. - OUTER_RADIUS: "outerRadius", + // Indicates a control point controlling the radius of a shape. + RADIUS: "radius", + // Indicates that an entire shape is being dragged. DRAG: "drag" }; diff --git a/src/util/editor/SurfaceCircleEditorFragment.js b/src/util/editor/SurfaceCircleEditorFragment.js index b76d5725c..6dfbc0660 100644 --- a/src/util/editor/SurfaceCircleEditorFragment.js +++ b/src/util/editor/SurfaceCircleEditorFragment.js @@ -54,7 +54,7 @@ define([ accessories, sizeControlPointAttributes) { - this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.OUTER_RADIUS); + this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.RADIUS); }; // Internal use only. @@ -76,12 +76,14 @@ define([ currentPosition, previousPosition) { - var delta = this.computeControlPointDelta(globe, currentPosition, previousPosition); - var vector = this.computeControlPointDelta(globe, controlPoint.position, shape.center).normalize(); + if (controlPoint.userProperties.purpose === ShapeEditorConstants.RADIUS) { + var delta = this.computeControlPointDelta(globe, currentPosition, previousPosition); + var vector = this.computeControlPointDelta(globe, controlPoint.position, shape.center).normalize(); - var radius = shape.radius + delta.dot(vector); - if (radius > 0) { - shape.radius = radius; + var radius = shape.radius + delta.dot(vector); + if (radius > 0) { + shape.radius = radius; + } } }; diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index c3fcd6f2c..dcb88ced9 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -89,8 +89,9 @@ define([ var rotationControlPoint = controlPoints.pop(); var lenControlPoints = controlPoints.length; + var lenLocations = locations.length; - for (var i = 0, len = locations.length; i < len; i++) { + for (var i = 0; i < lenLocations; i++) { if (i >= lenControlPoints) { this.createControlPoint( controlPoints, @@ -102,6 +103,10 @@ define([ controlPoints[i].position = locations[i]; } + if (lenControlPoints > lenLocations) { + controlPoints.splice(lenLocations, lenControlPoints - lenLocations) + } + var polygonCenter = this.getCenter(globe, locations); var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); @@ -129,15 +134,51 @@ define([ var locations = this.getLocations(shape); if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { - this.rotateLocations(globe, newPosition, previousPosition, locations); + var deltaHeading = this.rotateLocations(globe, newPosition, previousPosition, locations); + this.currentHeading = this.normalizedHeading(this.currentHeading, deltaHeading); shape.resetBoundaries(); shape._stateId = SurfacePolygon.stateId++; shape.stateKeyInvalid = true; } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { var index = controlPoint.userProperties.index; + if (alternateAction) { - // TODO Implement removal of the control point + var boundaries = shape.boundaries; + var lenBoundaries = boundaries.length; + + if (lenBoundaries > 0 && Array.isArray(boundaries[0])) { + var ringIndex = -1; + var locationOffset = 0; + var locationIndex = -1; + + for (var i = 0; i < lenBoundaries && ringIndex == -1; i++) { + var len = boundaries[i].length; + if (locationOffset + len > index) { + ringIndex = i; + locationIndex = index - locationOffset; + } + locationOffset += len; + } + + console.log(ringIndex); + console.log(locationIndex); + + if (ringIndex !== -1) { + var ring = boundaries[ringIndex]; + if (ring.length > 3) { + ring.splice(locationIndex, 1); + } else if (lenBoundaries > 2) { + boundaries.splice(ringIndex, 1); + } + } + + } else { + if (boundaries.length > 3) { + boundaries.splice(index, 1); + } + } + } else { this.moveLocation(globe, controlPoint, previousPosition, newPosition, locations[index]); } diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index 85961f4b6..22a047b8f 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -31,7 +31,10 @@ define([ "use strict"; //Internal use only. Intentionally not documented. - var SurfacePolylineEditorFragment = function () {}; + var SurfacePolylineEditorFragment = function () { + this.currentHeading = 0; + this.locationControlPointAttributes = null; + }; SurfacePolylineEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); @@ -52,11 +55,11 @@ define([ // Internal use only. SurfacePolylineEditorFragment.prototype.initializeControlElements = function (shape, - controlPoints, - accessories, - sizeControlPointAttributes, - angleControlPointAttributes, - locationControlPointAttributes) { + controlPoints, + accessories, + sizeControlPointAttributes, + angleControlPointAttributes, + locationControlPointAttributes) { this.currentHeading = 0; this.locationControlPointAttributes = locationControlPointAttributes; @@ -78,16 +81,17 @@ define([ // Internal use only. SurfacePolylineEditorFragment.prototype.updateControlElements = function (shape, - globe, - controlPoints, - accessories) { + globe, + controlPoints, + accessories) { var locations = shape.boundaries; var rotationControlPoint = controlPoints.pop(); var lenControlPoints = controlPoints.length; + var lenLocations = locations.length; - for (var i = 0, len = locations.length; i < len; i++) { + for (var i = 0; i < lenLocations; i++) { if (i >= lenControlPoints) { this.createControlPoint( controlPoints, @@ -99,6 +103,10 @@ define([ controlPoints[i].position = locations[i]; } + if (lenControlPoints > lenLocations) { + controlPoints.splice(lenLocations, lenControlPoints - lenLocations) + } + var polygonCenter = this.getCenter(globe, locations); var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); @@ -118,15 +126,16 @@ define([ // Internal use only. SurfacePolylineEditorFragment.prototype.reshape = function (shape, - globe, - controlPoint, - newPosition, - previousPosition, - alternateAction) { + globe, + controlPoint, + newPosition, + previousPosition, + alternateAction) { var locations = shape.boundaries; if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { - this.rotateLocations(globe, newPosition, previousPosition, locations); + var deltaHeading = this.rotateLocations(globe, newPosition, previousPosition, locations); + this.currentHeading = this.normalizedHeading(this.currentHeading, deltaHeading); shape.resetBoundaries(); shape._stateId = SurfacePolyline.stateId++; shape.stateKeyInvalid = true; @@ -134,7 +143,9 @@ define([ } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { var index = controlPoint.userProperties.index; if (alternateAction) { - // TODO Implement removal of the control point + if (locations.length > 2) { + locations.splice(index, 1); + } } else { this.moveLocation(globe, controlPoint, previousPosition, newPosition, locations[index]); } From a3439040907f1d5c6633be67972af079063d00a3 Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Mon, 25 Jun 2018 22:51:11 +0200 Subject: [PATCH 041/112] Start cleaning the base class up --- src/util/editor/BaseSurfaceEditorFragment.js | 231 +++++++++++++----- src/util/editor/ShapeEditor.js | 16 +- .../editor/SurfaceCircleEditorFragment.js | 4 +- .../editor/SurfaceEllipseEditorFragment.js | 12 +- .../editor/SurfacePolygonEditorFragment.js | 32 +-- .../editor/SurfacePolylineEditorFragment.js | 28 +-- .../editor/SurfaceRectangleEditorFragment.js | 12 +- 7 files changed, 220 insertions(+), 115 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index 3a5ec9733..12726fe91 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -19,46 +19,170 @@ define([ '../../geom/Angle', '../../geom/Location', + '../Logger', '../../shapes/Path', '../../shapes/Placemark', '../../geom/Position', '../../shapes/ShapeAttributes', + '../../error/UnsupportedOperationError', '../../geom/Vec3' ], function (Angle, Location, + Logger, Path, Placemark, Position, ShapeAttributes, + UnsupportedOperationError, Vec3) { "use strict"; - //Internal use only. Intentionally not documented. + // Internal use only. var BaseSurfaceEditorFragment = function () {}; /** - * Add a specified increment to an angle and normalize the result to be between 0 and 360 degrees. - * @param {Number} originalHeading The base angle. - * @param {Number} deltaHeading The increment to add prior to normalizing. - * @returns {Number} The normalized angle. + * Returns a value indicating whether this fragment can handle the specified shape. + * + * @param {SurfaceShape} shape The shape to test. + * @return {Boolean} true if this fragment can handle the specified shape; otherwise + * false. */ - BaseSurfaceEditorFragment.prototype.normalizedHeading = function (originalHeading, deltaHeading) { - var newHeading = originalHeading * Angle.DEGREES_TO_RADIANS + deltaHeading * Angle.DEGREES_TO_RADIANS; + BaseSurfaceEditorFragment.prototype.canHandle = function (shape) { + throw new UnsupportedOperationError(Logger.logMessage( + Logger.LEVEL_SEVERE, + "BaseSurfaceEditorFragment", + "canHandle", + "abstractInvocation") + ); + }; - if (Math.abs(newHeading) > Angle.TWO_PI) { - newHeading = newHeading % Angle.TWO_PI; - } + /** + * Creates and return a shadow shape from the specified shape. + * + * The shadow shape must be a deep copy, i.e. acting on the properties of the specified shape afterwards must + * not alter the appearance of the shadow shape. + * + * @param {SurfaceShape} shape The base shape to create a shadow from. + * @return {SurfaceShape} The shadow shape created from the specified base shape. + */ + BaseSurfaceEditorFragment.prototype.createShadowShape = function (shape) { + throw new UnsupportedOperationError(Logger.logMessage( + Logger.LEVEL_SEVERE, + "BaseSurfaceEditorFragment", + "createShadowShape", + "abstractInvocation") + ); + }; - return Angle.RADIANS_TO_DEGREES * (newHeading >= 0 ? newHeading : newHeading + Angle.TWO_PI); + /** + * Returns the location at the center of the specified shape. + * + * @param {SurfaceShape} shape The shape to get the center from. + * @param {Globe} globe The globe on which the shape is edited. + * @return {Location} The location at the center of the specified shape. + */ + BaseSurfaceEditorFragment.prototype.getShapeCenter = function (shape, globe) { + throw new UnsupportedOperationError(Logger.logMessage( + Logger.LEVEL_SEVERE, + "BaseSurfaceEditorFragment", + "getShapeCenter", + "abstractInvocation") + ); + }; + + /** + * Initializes the control elements required to edit the specified shape. + * + * This method must create the elements, but not position them. Their positioning is handled by + * {@link BaseSurfaceEditorFragment#updateControlElements}. + * + * @param {SurfaceShape} shape The shape being edited. + * @param {Renderable[]} controlPoints The array to store control points in. + * @param {Renderable[]} accessories The array to store additional accessories in. + * @param {PlacemarkAttributes} resizeControlPointAttributes The attributes to use for control points that + * resize the shape. + * @param {PlacemarkAttributes} rotateControlPointAttributes The attributes to use for control points that + * rotate the shape. + * @param {PlacemarkAttributes} moveControlPointAttributes The attributes to use for control points that move + * the boundaries of the shape. + */ + BaseSurfaceEditorFragment.prototype.initializeControlElements = function (shape, + controlPoints, + accessories, + resizeControlPointAttributes, + rotateControlPointAttributes, + moveControlPointAttributes) { + throw new UnsupportedOperationError(Logger.logMessage( + Logger.LEVEL_SEVERE, + "BaseSurfaceEditorFragment", + "initializeControlElements", + "abstractInvocation") + ); + }; + + /** + * Updates the control elements required to edit the specified shape. + * + * @param {SurfaceShape} shape The shape being edited. + * @param {Globe} globe The globe on which the shape is edited. + * @param {Renderable[]} controlPoints The array that stores the control points. + * @param {Renderable[]} accessories The array that stores the additional accessories. + */ + BaseSurfaceEditorFragment.prototype.updateControlElements = function (shape, + globe, + controlPoints, + accessories) { + throw new UnsupportedOperationError(Logger.logMessage( + Logger.LEVEL_SEVERE, + "BaseSurfaceEditorFragment", + "updateControlElements", + "abstractInvocation") + ); }; /** - * Computes the Cartesian difference between two control points. - * @param {Position} previousPosition The position of the previous control point. - * @param {Position} currentPosition The position of the current control point. - * @returns {Vec3} The Cartesian difference between the two control points. + * Reshapes the specified shape by applying the appropriate effect when the given control point is moved from + * the previous location to the current location. + * + * @param {SurfaceShape} shape The shape being edited. + * @param {Globe} globe The globe on which the shape is edited. + * @param {Renderable} controlPoint The control point being acted on. + * @param {Position} currentPosition The current position for this action. + * @param {Position} previousPosition The previous position for this action. + * @param {Boolean} secondaryBehavior A value indicating whether the secondary behavior of this action should be + * performed or not. */ + BaseSurfaceEditorFragment.prototype.reshape = function (shape, + globe, + controlPoint, + currentPosition, + previousPosition, + secondaryBehavior) { + throw new UnsupportedOperationError(Logger.logMessage( + Logger.LEVEL_SEVERE, + "BaseSurfaceEditorFragment", + "reshape", + "abstractInvocation") + ); + }; + + // Creates a control point and adds it to the array of control points. + BaseSurfaceEditorFragment.prototype.createControlPoint = function(controlPoints, attributes, purpose, index) { + var controlPoint = new Placemark(new Location(0, 0), false, attributes); + + controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND + + controlPoint.userProperties.purpose = purpose; + + if (typeof index !== "undefined") { + controlPoint.userProperties.index = index; + } + + controlPoints.push(controlPoint); + }; + + // Computes the cartesian difference between two positions such as control points. BaseSurfaceEditorFragment.prototype.computeControlPointDelta = function (globe, positionA, positionB) { var pointA = globe.computePointFromPosition( positionA.latitude, @@ -77,22 +201,43 @@ define([ return pointA.subtract(pointB); }; - /** - * Updates the line designating the shape's central axis. - * @param {Position} centerPosition The shape's center location and altitude at which to place one of the line's - * end points. - * @param {Position} controlPointPosition The shape orientation control point's position. - */ + // Creates an accessory showing the rotation of a shape and adds it to the array of accessories. + BaseSurfaceEditorFragment.prototype.createRotationAccessory = function (accessories, attributes) { + var positions = []; + positions.push(new Position(0, 0, 0)); + positions.push(new Position(0, 0, 0)); + + var shapeAttributes = new ShapeAttributes(null); + shapeAttributes.outlineColor = attributes.imageColor; + shapeAttributes.outlineWidth = 2; + + var rotationLine = new Path(positions, shapeAttributes); + rotationLine.altitudeMode = WorldWind.CLAMP_TO_GROUND; + rotationLine.followTerrain = true; + + accessories.push(rotationLine); + }; + + // Updates the heading of the accessory showing the rotation of the shape. BaseSurfaceEditorFragment.prototype.updateRotationAccessory = function (centerPosition, controlPointPosition, accessories) { - if (accessories.length == 0) { - return; + accessories[0].positions = [centerPosition, controlPointPosition]; + }; + + // Applies a delta to a heading and normalizes it. + BaseSurfaceEditorFragment.prototype.normalizedHeading = function (currentHeading, deltaHeading) { + var newHeading = currentHeading * Angle.DEGREES_TO_RADIANS + deltaHeading * Angle.DEGREES_TO_RADIANS; + + if (Math.abs(newHeading) > Angle.TWO_PI) { + newHeading = newHeading % Angle.TWO_PI; } - var positions = []; - positions.push(centerPosition, controlPointPosition); - accessories[0].positions = positions; + return Angle.RADIANS_TO_DEGREES * (newHeading >= 0 ? newHeading : newHeading + Angle.TWO_PI); }; + + + + /** * Computes the average location of a specified array of locations. * @param {Location[]} locations The array of locations for the shape. @@ -163,40 +308,6 @@ define([ return (count === 0) ? 0 : totalDistance / globe.equatorialRadius; }; - BaseSurfaceEditorFragment.prototype.createControlPoint = function(controlPoints, attributes, purpose, index) { - var controlPoint = new Placemark( - new Location(0, 0), - false, - attributes - ); - controlPoint.userProperties.purpose = purpose; - if (typeof index !== "undefined") { - controlPoint.userProperties.index = index; - } - controlPoint.altitudeMode = WorldWind.CLAMP_TO_GROUND; - controlPoints.push(controlPoint); - }; - - /** - * Set up the Path for the rotation line. - */ - BaseSurfaceEditorFragment.prototype.initializeRotationAccessory = function (accessories, attributes) { - var pathPositions = []; - pathPositions.push(new Position(0, 0, 0)); - pathPositions.push(new Position(0, 0, 0)); - var rotationLine = new Path(pathPositions, null); - rotationLine.altitudeMode = WorldWind.CLAMP_TO_GROUND; - rotationLine.followTerrain = true; - - var pathAttributes = new ShapeAttributes(null); - pathAttributes.outlineColor = attributes.imageColor; - pathAttributes.outlineWidth = 2; - - rotationLine.attributes = pathAttributes; - - accessories.push(rotationLine); - }; - BaseSurfaceEditorFragment.prototype.addNewControlPoint = function (globe, terrainPosition, altitude, locations) { // Find the nearest edge to the picked point and insert a new position on that edge. var pointPicked = globe.computePointFromPosition( diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index e402dc0fc..a8166b413 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -37,7 +37,6 @@ define([ './SurfacePolygonEditorFragment', './SurfacePolylineEditorFragment', './SurfaceRectangleEditorFragment', - './SurfaceSectorEditorFragment', '../../geom/Vec2', '../../geom/Vec3' ], @@ -61,7 +60,6 @@ define([ SurfacePolygonEditorFragment, SurfacePolylineEditorFragment, SurfaceRectangleEditorFragment, - SurfaceSectorEditorFragment, Vec2, Vec3) { "use strict"; @@ -636,16 +634,12 @@ define([ ShapeEditor.prototype.updateShapeAnnotation = function () { var center = this.activeEditorFragment.getShapeCenter(this._shape, this._worldWindow.globe); - if (center !== null) { - var temporaryMarker = new Placemark( - new Position(center.latitude, center.longitude, 0), - null - ); - this.updateAnnotation(temporaryMarker); + var temporaryMarker = new Placemark( + new Position(center.latitude, center.longitude, 0), + null + ); - } else { - this.hideAnnotation(); - } + this.updateAnnotation(temporaryMarker); }; // Internal use only. diff --git a/src/util/editor/SurfaceCircleEditorFragment.js b/src/util/editor/SurfaceCircleEditorFragment.js index 6dfbc0660..e5573ed85 100644 --- a/src/util/editor/SurfaceCircleEditorFragment.js +++ b/src/util/editor/SurfaceCircleEditorFragment.js @@ -52,9 +52,9 @@ define([ SurfaceCircleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, accessories, - sizeControlPointAttributes) { + resizeControlPointAttributes) { - this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.RADIUS); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.RADIUS); }; // Internal use only. diff --git a/src/util/editor/SurfaceEllipseEditorFragment.js b/src/util/editor/SurfaceEllipseEditorFragment.js index b098e19fe..3ba3bbcea 100644 --- a/src/util/editor/SurfaceEllipseEditorFragment.js +++ b/src/util/editor/SurfaceEllipseEditorFragment.js @@ -58,14 +58,14 @@ define([ SurfaceEllipseEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, accessories, - sizeControlPointAttributes, - angleControlPointAttributes) { + resizeControlPointAttributes, + rotateControlPointAttributes) { - this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.WIDTH); - this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.HEIGHT); - this.createControlPoint(controlPoints, angleControlPointAttributes, ShapeEditorConstants.ROTATION); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.WIDTH); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.HEIGHT); + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); - this.initializeRotationAccessory(accessories, angleControlPointAttributes); + this.createRotationAccessory(accessories, rotateControlPointAttributes); }; // Internal use only. diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index dcb88ced9..af44f0558 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -33,7 +33,7 @@ define([ // Internal use only. var SurfacePolygonEditorFragment = function () { this.currentHeading = 0; - this.locationControlPointAttributes = null; + this.moveControlPointAttributes = null; }; SurfacePolygonEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); @@ -55,28 +55,28 @@ define([ // Internal use only. SurfacePolygonEditorFragment.prototype.initializeControlElements = function (shape, - controlPoints, - accessories, - sizeControlPointAttributes, - angleControlPointAttributes, - locationControlPointAttributes) { + controlPoints, + accessories, + resizeControlPointAttributes, + rotateControlPointAttributes, + moveControlPointAttributes) { this.currentHeading = 0; - this.locationControlPointAttributes = locationControlPointAttributes; + this.moveControlPointAttributes = moveControlPointAttributes; var locations = this.getLocations(shape); for (var i = 0, len = locations.length; i < len; i++) { this.createControlPoint( controlPoints, - locationControlPointAttributes, + moveControlPointAttributes, ShapeEditorConstants.LOCATION, i ); } - this.createControlPoint(controlPoints, angleControlPointAttributes, ShapeEditorConstants.ROTATION); + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); - this.initializeRotationAccessory(accessories, angleControlPointAttributes); + this.createRotationAccessory(accessories, rotateControlPointAttributes); }; // Internal use only. @@ -95,7 +95,7 @@ define([ if (i >= lenControlPoints) { this.createControlPoint( controlPoints, - this.locationControlPointAttributes, + this.moveControlPointAttributes, ShapeEditorConstants.LOCATION, i ); @@ -128,13 +128,13 @@ define([ SurfacePolygonEditorFragment.prototype.reshape = function (shape, globe, controlPoint, - newPosition, + currentPosition, previousPosition, - alternateAction) { + secondaryBehavior) { var locations = this.getLocations(shape); if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { - var deltaHeading = this.rotateLocations(globe, newPosition, previousPosition, locations); + var deltaHeading = this.rotateLocations(globe, currentPosition, previousPosition, locations); this.currentHeading = this.normalizedHeading(this.currentHeading, deltaHeading); shape.resetBoundaries(); shape._stateId = SurfacePolygon.stateId++; @@ -143,7 +143,7 @@ define([ } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { var index = controlPoint.userProperties.index; - if (alternateAction) { + if (secondaryBehavior) { var boundaries = shape.boundaries; var lenBoundaries = boundaries.length; @@ -180,7 +180,7 @@ define([ } } else { - this.moveLocation(globe, controlPoint, previousPosition, newPosition, locations[index]); + this.moveLocation(globe, controlPoint, previousPosition, currentPosition, locations[index]); } shape.resetBoundaries(); shape._stateId = SurfacePolygon.stateId++; diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index 22a047b8f..85f399895 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -33,7 +33,7 @@ define([ //Internal use only. Intentionally not documented. var SurfacePolylineEditorFragment = function () { this.currentHeading = 0; - this.locationControlPointAttributes = null; + this.moveControlPointAttributes = null; }; SurfacePolylineEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); @@ -57,26 +57,26 @@ define([ SurfacePolylineEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, accessories, - sizeControlPointAttributes, - angleControlPointAttributes, - locationControlPointAttributes) { + resizeControlPointAttributes, + rotateControlPointAttributes, + moveControlPointAttributes) { this.currentHeading = 0; - this.locationControlPointAttributes = locationControlPointAttributes; + this.moveControlPointAttributes = moveControlPointAttributes; var locations = shape.boundaries; for (var i = 0, len = locations.length; i < len; i++) { this.createControlPoint( controlPoints, - locationControlPointAttributes, + moveControlPointAttributes, ShapeEditorConstants.LOCATION, i ); } - this.createControlPoint(controlPoints, angleControlPointAttributes, ShapeEditorConstants.ROTATION); + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); - this.initializeRotationAccessory(accessories, angleControlPointAttributes); + this.createRotationAccessory(accessories, rotateControlPointAttributes); }; // Internal use only. @@ -95,7 +95,7 @@ define([ if (i >= lenControlPoints) { this.createControlPoint( controlPoints, - this.locationControlPointAttributes, + this.moveControlPointAttributes, ShapeEditorConstants.LOCATION, i ); @@ -128,13 +128,13 @@ define([ SurfacePolylineEditorFragment.prototype.reshape = function (shape, globe, controlPoint, - newPosition, + currentPosition, previousPosition, - alternateAction) { + secondaryBehavior) { var locations = shape.boundaries; if (controlPoint.userProperties.purpose === ShapeEditorConstants.ROTATION) { - var deltaHeading = this.rotateLocations(globe, newPosition, previousPosition, locations); + var deltaHeading = this.rotateLocations(globe, currentPosition, previousPosition, locations); this.currentHeading = this.normalizedHeading(this.currentHeading, deltaHeading); shape.resetBoundaries(); shape._stateId = SurfacePolyline.stateId++; @@ -142,12 +142,12 @@ define([ } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.LOCATION) { var index = controlPoint.userProperties.index; - if (alternateAction) { + if (secondaryBehavior) { if (locations.length > 2) { locations.splice(index, 1); } } else { - this.moveLocation(globe, controlPoint, previousPosition, newPosition, locations[index]); + this.moveLocation(globe, controlPoint, previousPosition, currentPosition, locations[index]); } shape.resetBoundaries(); shape._stateId = SurfacePolyline.stateId++; diff --git a/src/util/editor/SurfaceRectangleEditorFragment.js b/src/util/editor/SurfaceRectangleEditorFragment.js index 5a53a5e9b..93661591b 100644 --- a/src/util/editor/SurfaceRectangleEditorFragment.js +++ b/src/util/editor/SurfaceRectangleEditorFragment.js @@ -58,14 +58,14 @@ define([ SurfaceRectangleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, accessories, - sizeControlPointAttributes, - angleControlPointAttributes) { + resizeControlPointAttributes, + rotateControlPointAttributes) { - this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.WIDTH); - this.createControlPoint(controlPoints, sizeControlPointAttributes, ShapeEditorConstants.HEIGHT); - this.createControlPoint(controlPoints, angleControlPointAttributes, ShapeEditorConstants.ROTATION); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.WIDTH); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.HEIGHT); + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); - this.initializeRotationAccessory(accessories, angleControlPointAttributes); + this.createRotationAccessory(accessories, rotateControlPointAttributes); }; // Internal use only. From 370f334355279426a92bb255a428d823f6909994 Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Mon, 25 Jun 2018 23:13:04 +0200 Subject: [PATCH 042/112] Continue clean up of base class --- src/util/editor/BaseSurfaceEditorFragment.js | 243 +++++++++--------- src/util/editor/ShapeEditor.js | 1 + .../editor/SurfacePolygonEditorFragment.js | 14 +- .../editor/SurfacePolylineEditorFragment.js | 4 +- 4 files changed, 133 insertions(+), 129 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index 12726fe91..7e2e6f29b 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -234,80 +234,159 @@ define([ return Angle.RADIANS_TO_DEGREES * (newHeading >= 0 ? newHeading : newHeading + Angle.TWO_PI); }; + // Creates and returns a deep copy of a set of locations, which can include multiple rings. + BaseSurfaceEditorFragment.prototype.deepCopyLocations = function(locations) { + var newLocations = []; + if (locations.length > 0 && Array.isArray(locations[0])) { + for (var i = 0, ilen = locations.length; i < ilen; i++) { + var ring = []; + for (var j = 0, jlen = locations[i].length; j < jlen; j++) { + ring.push(new Location(locations[i][j].latitude, locations[i][j].longitude)); + } + newLocations.push(ring); + } + } else { + for (var i = 0, len = locations.length; i < len; i++) { + newLocations.push(new Location(locations[i].latitude, locations[i].longitude)); + } + } + return newLocations; + }; - - /** - * Computes the average location of a specified array of locations. - * @param {Location[]} locations The array of locations for the shape. - * @return {Position} the average of the locations specified in the array. - */ - BaseSurfaceEditorFragment.prototype.getCenter = function (globe, locations) { + // Returns the center of a set of locations, which can include multiple rings. + BaseSurfaceEditorFragment.prototype.getCenterFromLocations = function (globe, locations) { var count = 0; var center = new Vec3(0, 0, 0); + var tmpVector = new Vec3(0, 0, 0); - if (locations.length > 0 && locations[0].length > 2) { - for (var i = 0; i < locations.length; i++) { - for (var j = 0; j < locations[i].length; j++) { - center = center.add(globe.computePointFromPosition( - locations[i][j].latitude, - locations[i][j].longitude, - 0, - new Vec3(0, 0, 0))); - ++count; + if (locations.length > 0 && Array.isArray(locations[0])) { + for (var i = 0, ilen = locations.length; i < ilen; i++) { + for (var j = 0, jlen = locations[i].length; j < jlen; j++) { + center.add( + globe.computePointFromPosition( + locations[i][j].latitude, + locations[i][j].longitude, + 0, + tmpVector + ) + ); + count++; } } - } - else if (locations.length >= 2) { - for (var i = 0; i < locations.length; i++) { - center = center.add(globe.computePointFromPosition( - locations[i].latitude, - locations[i].longitude, - 0, - new Vec3(0, 0, 0))); - ++count; + } else { + for (var i = 0, len = locations.length; i < len; i++) { + center.add( + globe.computePointFromPosition( + locations[i].latitude, + locations[i].longitude, + 0, + tmpVector + ) + ); + count++; } } - center = center.divide(count); + center.divide(count); - return globe.computePositionFromPoint( - center[0], - center[1], - center[2], - new Position(0, 0, 0) - ); + return globe.computePositionFromPoint(center[0], center[1], center[2], new Position(0, 0, 0)); }; - /** - * Computes the average distance between a specified center point and a list of locations. - * @param {Globe} globe The globe to use for the computations. - * @param {Location} center The center point. - * @param {Array} locations The locations. - * @returns {Number} The average distance. - */ + // Computes the average distance between the specified center point and the locations in the specified list. BaseSurfaceEditorFragment.prototype.getAverageDistance = function (globe, center, locations) { - var count = locations.length; - var centerPoint = globe.computePointFromLocation( center.latitude, center.longitude, new Vec3(0, 0, 0) ); + var count = locations.length; var totalDistance = 0; - for (var i = 0; i < locations.length; i++) { + var tmpVector = new Vec3(0, 0, 0); + for (var i = 0; i < count; i++) { var distance = globe.computePointFromLocation( locations[i].latitude, locations[i].longitude, - new Vec3(0, 0, 0)).distanceTo(centerPoint); + tmpVector + ).distanceTo(centerPoint); totalDistance += distance / count; } - return (count === 0) ? 0 : totalDistance / globe.equatorialRadius; + return totalDistance / globe.equatorialRadius; + }; + + // Moves the location of a control point. + BaseSurfaceEditorFragment.prototype.moveLocation = function (globe, + controlPoint, + currentPosition, + previousPosition, + result) { + // FIXME Is this needed? + + var delta = this.computeControlPointDelta(globe, previousPosition, currentPosition); + + var controlPointPoint = globe.computePointFromPosition( + controlPoint.position.latitude, + controlPoint.position.longitude, + 0, + new Vec3(0, 0, 0) + ); + + controlPointPoint.add(delta); + + return globe.computePositionFromPoint( + controlPointPoint[0], + controlPointPoint[1], + controlPointPoint[2], + result + ); + }; + + // Rotates a set of locations, which can include multiple rings, around their center and returns the delta in + // heading that was applied. + BaseSurfaceEditorFragment.prototype.rotateLocations = function (globe, newPosition, previousPosition, locations) { + var center = this.getCenterFromLocations(globe, locations); + var previousHeading = Location.greatCircleAzimuth(center, previousPosition); + var deltaHeading = Location.greatCircleAzimuth(center, newPosition) - previousHeading; + + if (locations.length > 0 && Array.isArray(locations[0])) { + for (var i = 0, ilen = locations.length; i < ilen; i++) { + for (var j = 0, jlen = locations[i].length; j < jlen; j++) { + var heading = Location.greatCircleAzimuth(center, locations[i][j]); + var distance = Location.greatCircleDistance(center, locations[i][j]); + Location.greatCircleLocation( + center, + heading + deltaHeading, + distance, + locations[i][j] + ); + } + } + } else { + for (var i = 0, len = locations.length; i < len; i++) { + var heading = Location.greatCircleAzimuth(center, locations[i]); + var distance = Location.greatCircleDistance(center, locations[i]); + Location.greatCircleLocation( + center, + heading + deltaHeading, + distance, + locations[i] + ); + } + } + + return deltaHeading; }; + + + + + + + BaseSurfaceEditorFragment.prototype.addNewControlPoint = function (globe, terrainPosition, altitude, locations) { // Find the nearest edge to the picked point and insert a new position on that edge. var pointPicked = globe.computePointFromPosition( @@ -374,26 +453,6 @@ define([ } }; - BaseSurfaceEditorFragment.prototype.deepCopyLocations = function(locations) { - var newLocations = []; - - if (locations.length > 0 && locations[0].length > 2) { - for (var i = 0, ilen = locations.length; i < ilen; i++) { - var ring = []; - for (var j = 0, jlen = locations[i].length; j < jlen; j++) { - ring.push(new Location(locations[i][j].latitude, locations[i][j].longitude)); - } - newLocations.push(ring); - } - } else { - for (var i = 0, len = locations.length; i < len; i++) { - newLocations.push(new Location(locations[i].latitude, locations[i].longitude)); - } - } - - return newLocations; - } - BaseSurfaceEditorFragment.prototype.nearestPointOnSegment = function (p1, p2, point) { var segment = p2.subtract(p1); @@ -413,62 +472,6 @@ define([ } }; - /** - * Moves a control point location. - * @param {Placemark} controlPoint The control point being moved. - * @param {Position} terrainPosition The position selected by the user. - * @returns {Position} The position after move. - */ - BaseSurfaceEditorFragment.prototype.moveLocation = function (globe, controlPoint, terrainPosition, previousPosition, result) { - var delta = this.computeControlPointDelta(globe, previousPosition, terrainPosition); - var markerPoint = globe.computePointFromPosition( - controlPoint.position.latitude, - controlPoint.position.longitude, - 0, - new Vec3(0, 0, 0) - ); - - markerPoint.add(delta); - return globe.computePositionFromPoint( - markerPoint[0], - markerPoint[1], - markerPoint[2], - result - ); - }; - - /** - * Rotates a shape's locations. - * @param {Position} terrainPosition The position selected by the user. - * @param {Location[]} locations The array of locations for the shape. - */ - BaseSurfaceEditorFragment.prototype.rotateLocations = function (globe, terrainPosition, previousPosition, locations) { - var center = this.getCenter(globe, locations); - var previousHeading = Location.greatCircleAzimuth(center, previousPosition); - var deltaHeading = Location.greatCircleAzimuth(center, terrainPosition) - previousHeading; - - if (locations.length > 0 && locations[0].length > 2) { - for (var i = 0; i < locations.length; i++) { - for (var j = 0; j < locations[i].length; j++) { - var heading = Location.greatCircleAzimuth(center, locations[i][j]); - var distance = Location.greatCircleDistance(center, locations[i][j]); - Location.greatCircleLocation(center, heading + deltaHeading, distance, - locations[i][j]); - } - } - } - else if (locations.length >= 2) { - for (var i = 0; i < locations.length; i++) { - var heading = Location.greatCircleAzimuth(center, locations[i]); - var distance = Location.greatCircleDistance(center, locations[i]); - Location.greatCircleLocation(center, heading + deltaHeading, distance, - locations[i]); - } - } - - return deltaHeading; - }; - return BaseSurfaceEditorFragment; } ); \ No newline at end of file diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index a8166b413..4d6a98e02 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -565,6 +565,7 @@ define([ // Internal use only. ShapeEditor.prototype.drag = function (clientX, clientY) { + // TODO Understand and review var refPos = this._shape.getReferencePosition(); var refPoint = this._worldWindow.globe.computePointFromPosition( diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index af44f0558..ec5af4aba 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -50,7 +50,7 @@ define([ // Internal use only. SurfacePolygonEditorFragment.prototype.getShapeCenter = function (shape, globe) { - return this.getCenter(globe, shape.boundaries); + return this.getCenterFromLocations(globe, shape.boundaries); }; // Internal use only. @@ -107,7 +107,7 @@ define([ controlPoints.splice(lenLocations, lenControlPoints - lenLocations) } - var polygonCenter = this.getCenter(globe, locations); + var polygonCenter = this.getCenterFromLocations(globe, locations); var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); Location.greatCircleLocation( @@ -192,14 +192,14 @@ define([ SurfacePolygonEditorFragment.prototype.getLocations = function (shape) { var locations = []; - if (shape.boundaries.length > 0 && shape.boundaries[0].length > 2) { - for (var i = 0; i < shape.boundaries.length; i++) { - for (var j = 0; j < shape.boundaries[i].length; j++) { + if (shape.boundaries.length > 0 && Array.isArray(shape.boundaries[0])) { + for (var i = 0, ilen = shape.boundaries.length; i < ilen; i++) { + for (var j = 0, jlen = shape.boundaries[i].length; j < jlen; j++) { locations.push(shape.boundaries[i][j]); } } - } else if (shape.boundaries.length >= 2) { - for (var i = 0; i < shape.boundaries.length; i++) { + } else { + for (var i = 0, len = shape.boundaries.length; i < len; i++) { locations.push(shape.boundaries[i]); } } diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index 85f399895..2daee0f3f 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -50,7 +50,7 @@ define([ //Internal use only. Intentionally not documented. SurfacePolylineEditorFragment.prototype.getShapeCenter = function (shape, globe) { - return this.getCenter(globe, shape.boundaries); + return this.getCenterFromLocations(globe, shape.boundaries); }; // Internal use only. @@ -107,7 +107,7 @@ define([ controlPoints.splice(lenLocations, lenControlPoints - lenLocations) } - var polygonCenter = this.getCenter(globe, locations); + var polygonCenter = this.getCenterFromLocations(globe, locations); var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); Location.greatCircleLocation( From 7d36e6e1f32bf2fca1a8d562caf7510de168621d Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Tue, 26 Jun 2018 18:02:09 +0200 Subject: [PATCH 043/112] Clean up the logic to add vertex --- src/util/editor/BaseSurfaceEditorFragment.js | 108 ++++-------------- src/util/editor/ShapeEditor.js | 33 +++--- .../editor/SurfacePolygonEditorFragment.js | 69 ++++++++++- .../editor/SurfacePolylineEditorFragment.js | 64 ++++++++++- 4 files changed, 167 insertions(+), 107 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index 7e2e6f29b..ce2b5f56c 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -18,6 +18,7 @@ */ define([ '../../geom/Angle', + '../../geom/Line', '../../geom/Location', '../Logger', '../../shapes/Path', @@ -28,6 +29,7 @@ define([ '../../geom/Vec3' ], function (Angle, + Line, Location, Logger, Path, @@ -167,6 +169,17 @@ define([ ); }; + /** + * Adds a new vertex to the specified shape at the closest point to the given position. + * + * This is an optional action for the editor fragments. + * + * @param {SurfaceShape} shape The shape being edited. + * @param {Globe} globe The globe on which the shape is edited. + * @param {Position} position The position for this action. + */ + BaseSurfaceEditorFragment.prototype.addNewVertex = function (shape, globe, position) {}; + // Creates a control point and adds it to the array of control points. BaseSurfaceEditorFragment.prototype.createControlPoint = function(controlPoints, attributes, purpose, index) { var controlPoint = new Placemark(new Location(0, 0), false, attributes); @@ -380,95 +393,24 @@ define([ return deltaHeading; }; - - - - - - - - BaseSurfaceEditorFragment.prototype.addNewControlPoint = function (globe, terrainPosition, altitude, locations) { - // Find the nearest edge to the picked point and insert a new position on that edge. - var pointPicked = globe.computePointFromPosition( - terrainPosition.latitude, - terrainPosition.longitude, - altitude, - new Vec3(0, 0, 0) - ); - - var nearestPoint = null; - var nearestSegmentIndex = 0; - var nearestDistance = Number.MAX_VALUE; - for (var i = 1; i <= locations.length; i++) // <= is intentional, to handle the closing segment - { - // Skip the closing segment if the shape is not a polygon. - if (!(this._shape instanceof SurfacePolygon ) && i == locations.length) { - continue; - } - - var locationA = locations[i - 1]; - var locationB = locations[i == locations.length ? 0 : i]; - - var pointA = globe.computePointFromPosition( - locationA.latitude, - locationA.longitude, - altitude, - new Vec3(0, 0, 0) - ); - - var pointB = this._worldWindow.globe.computePointFromPosition( - locationB.latitude, - locationB.longitude, - altitude, - new Vec3(0, 0, 0) - ); - - var pointOnEdge = this.nearestPointOnSegment(pointA, pointB, new Vec3(pointPicked[0], pointPicked[1], pointPicked[2])); - - var distance = pointOnEdge.distanceTo(pointPicked); - if (distance < nearestDistance) { - nearestPoint = pointOnEdge; - nearestSegmentIndex = i; - nearestDistance = distance; - } - } - - if (nearestPoint) { - // Compute the location of the nearest point and add it to the shape. - var nearestLocation = globe.computePositionFromPoint( - nearestPoint[0], - nearestPoint[1], - nearestPoint[2], - new Position(0, 0, 0) - ); - - if (nearestSegmentIndex == locations.length) - locations.push(nearestLocation); - else - locations.splice(nearestSegmentIndex, 0, nearestLocation); - - this.removeControlPoints(); - this._shape.boundaries = locations; - this.updateControlElements(); - } - }; - - BaseSurfaceEditorFragment.prototype.nearestPointOnSegment = function (p1, p2, point) { - var segment = p2.subtract(p1); + // Returns the point on a segment that is closest to the specified point. + BaseSurfaceEditorFragment.prototype.closestPointOnSegment = function (segmentStart, segmentEnd, point) { + var segment = segmentEnd.subtract(segmentStart); var segmentCopy = new Vec3(0, 0, 0); segmentCopy.copy(segment); var dir = segmentCopy.normalize(); - var dot = point.subtract(p1).dot(dir); + var pointCopy = new Vec3(0, 0, 0); + pointCopy.copy(point); + var dot = pointCopy.subtract(segmentStart).dot(dir); + if (dot < 0.0) { - return p1; - } - else if (dot > segment.magnitude()) { - return p2; - } - else { - return Vec3.fromLine(p1, dot, dir); // FIXME This is broken + return segmentCopy.copy(segmentStart); + } else if (dot > segment.magnitude()) { + return segmentCopy.copy(segmentEnd); + } else { + return new Line(segmentStart, dir).pointAt(dot, segmentCopy); } }; diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 4d6a98e02..6b4dd182a 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -480,24 +480,21 @@ define([ this.endAction(); - } else if (terrainObject - && this.actionStartX === this.actionCurrentX // FIXME Is this check needed? - && this.actionStartY === this.actionCurrentY // FIXME Is this check needed? - && event.shiftKey) { - - var pickList = this._worldWindow.pick(mousePoint); - for (var p = 0, len = pickList.objects.length; p < len; p++) { - - if (!pickList.objects[p].isTerrain) { // FIXME Shouldn't it check that we are on the shape instead of any object? - this.activeEditorFragment.addNewControlPoint( - this._worldWindow.globe, - terrainObject.position, - 0, - this._shape.boundaries - ); - break; - } - } + } + + if (terrainObject + && this.actionStartX === this.actionCurrentX // FIXME Is this check needed? + && this.actionStartY === this.actionCurrentY // FIXME Is this check needed? + && event.shiftKey) { + + this.activeEditorFragment.addNewVertex( + this._shape, + this._worldWindow.globe, + terrainObject.position + ); + + this.updateControlElements(); + this._worldWindow.redraw(); } }; diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index ec5af4aba..2074efa29 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -21,13 +21,15 @@ define([ '../../geom/Location', '../../geom/Position', './ShapeEditorConstants', - '../../shapes/SurfacePolygon' + '../../shapes/SurfacePolygon', + '../../geom/Vec3' ], function (BaseSurfaceEditorFragment, Location, Position, ShapeEditorConstants, - SurfacePolygon) { + SurfacePolygon, + Vec3) { "use strict"; // Internal use only. @@ -161,9 +163,6 @@ define([ locationOffset += len; } - console.log(ringIndex); - console.log(locationIndex); - if (ringIndex !== -1) { var ring = boundaries[ringIndex]; if (ring.length > 3) { @@ -188,6 +187,66 @@ define([ } }; + // Internal use only. + SurfacePolygonEditorFragment.prototype.addNewVertex = function (shape, globe, position) { + var pointA = new Vec3(0, 0, 0); + var pointB = new Vec3(0, 0, 0); + var pointOnEdge = new Vec3(0, 0, 0); + + var locations = shape.boundaries; + + var pointPicked = globe.computePointFromPosition( + position.latitude, + position.longitude, + 0, + new Vec3(0, 0, 0) + ); + + var nearestPoint = new Vec3(0, 0 , 0); + var nearestSegmentIndex = -1; + var nearestDistance = Number.MAX_VALUE; + for (var i = 1, len = locations.length; i <= len; i++) { + var locationA = locations[i - 1]; + var locationB = locations[i == len ? 0 : i]; + + globe.computePointFromPosition(locationA.latitude, locationA.longitude, 0, pointA); + globe.computePointFromPosition(locationB.latitude, locationB.longitude, 0, pointB); + + pointOnEdge.copy(pointPicked); + pointOnEdge = this.closestPointOnSegment( + pointA, + pointB, + pointPicked + ); + + var distance = pointOnEdge.distanceTo(pointPicked); + if (distance < nearestDistance) { + nearestPoint.copy(pointOnEdge); + nearestSegmentIndex = i; + nearestDistance = distance; + } + } + + if (nearestDistance < 20000) { + var nearestLocation = globe.computePositionFromPoint( + nearestPoint[0], + nearestPoint[1], + nearestPoint[2], + new Position(0, 0, 0) + ); + + if (nearestSegmentIndex == locations.length) { + locations.push(nearestLocation); + } else { + locations.splice(nearestSegmentIndex, 0, nearestLocation); + } + + shape.resetBoundaries(); + shape._stateId = SurfacePolygon.stateId++; + shape.stateKeyInvalid = true; + } + }; + // Internal use only. SurfacePolygonEditorFragment.prototype.getLocations = function (shape) { var locations = []; diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index 2daee0f3f..5f1fada8c 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -22,12 +22,14 @@ define([ '../../geom/Position', './ShapeEditorConstants', '../../shapes/SurfacePolyline', + '../../geom/Vec3' ], function (BaseSurfaceEditorFragment, Location, Position, ShapeEditorConstants, - SurfacePolyline) { + SurfacePolyline, + Vec3) { "use strict"; //Internal use only. Intentionally not documented. @@ -155,6 +157,66 @@ define([ } }; + // Internal use only. + SurfacePolylineEditorFragment.prototype.addNewVertex = function (shape, globe, position) { + var pointA = new Vec3(0, 0, 0); + var pointB = new Vec3(0, 0, 0); + var pointOnEdge = new Vec3(0, 0, 0); + + var locations = shape.boundaries; + + var pointPicked = globe.computePointFromPosition( + position.latitude, + position.longitude, + 0, + new Vec3(0, 0, 0) + ); + + var nearestPoint = new Vec3(0, 0 , 0); + var nearestSegmentIndex = -1; + var nearestDistance = Number.MAX_VALUE; + for (var i = 1, len = locations.length; i < len; i++) { + var locationA = locations[i - 1]; + var locationB = locations[i]; + + globe.computePointFromPosition(locationA.latitude, locationA.longitude, 0, pointA); + globe.computePointFromPosition(locationB.latitude, locationB.longitude, 0, pointB); + + pointOnEdge.copy(pointPicked); + pointOnEdge = this.closestPointOnSegment( + pointA, + pointB, + pointPicked + ); + + var distance = pointOnEdge.distanceTo(pointPicked); + if (distance < nearestDistance) { + nearestPoint.copy(pointOnEdge); + nearestSegmentIndex = i; + nearestDistance = distance; + } + } + + if (nearestDistance < 20000) { + var nearestLocation = globe.computePositionFromPoint( + nearestPoint[0], + nearestPoint[1], + nearestPoint[2], + new Position(0, 0, 0) + ); + + if (nearestSegmentIndex == locations.length) { + locations.push(nearestLocation); + } else { + locations.splice(nearestSegmentIndex, 0, nearestLocation); + } + + shape.resetBoundaries(); + shape._stateId = SurfacePolyline.stateId++; + shape.stateKeyInvalid = true; + } + }; + return SurfacePolylineEditorFragment; } ); \ No newline at end of file From 28feb90051bd4ecd1c25521563736174396e7dcd Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Tue, 26 Jun 2018 18:13:09 +0200 Subject: [PATCH 044/112] Add comments for the next step of the review --- src/util/editor/BaseSurfaceEditorFragment.js | 12 +++++------- src/util/editor/ShapeEditor.js | 11 ++++++----- src/util/editor/SurfacePolygonEditorFragment.js | 3 +++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index ce2b5f56c..f7d09dc0a 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -178,7 +178,9 @@ define([ * @param {Globe} globe The globe on which the shape is edited. * @param {Position} position The position for this action. */ - BaseSurfaceEditorFragment.prototype.addNewVertex = function (shape, globe, position) {}; + BaseSurfaceEditorFragment.prototype.addNewVertex = function (shape, globe, position) { + // Not supported by default. + }; // Creates a control point and adds it to the array of control points. BaseSurfaceEditorFragment.prototype.createControlPoint = function(controlPoints, attributes, purpose, index) { @@ -216,15 +218,11 @@ define([ // Creates an accessory showing the rotation of a shape and adds it to the array of accessories. BaseSurfaceEditorFragment.prototype.createRotationAccessory = function (accessories, attributes) { - var positions = []; - positions.push(new Position(0, 0, 0)); - positions.push(new Position(0, 0, 0)); - var shapeAttributes = new ShapeAttributes(null); shapeAttributes.outlineColor = attributes.imageColor; shapeAttributes.outlineWidth = 2; - var rotationLine = new Path(positions, shapeAttributes); + var rotationLine = new Path([], shapeAttributes); rotationLine.altitudeMode = WorldWind.CLAMP_TO_GROUND; rotationLine.followTerrain = true; @@ -336,7 +334,7 @@ define([ currentPosition, previousPosition, result) { - // FIXME Is this needed? + // FIXME Is this complexity needed? var delta = this.computeControlPointDelta(globe, previousPosition, currentPosition); diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 6b4dd182a..2a240daeb 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -474,17 +474,17 @@ define([ if (this.actionType) { if (this.actionControlPoint && terrainObject - && event.altKey) { // FIXME What is this for? + && event.altKey) { + // FIXME What is this for? this.reshape(terrainObject.position); } this.endAction(); - } if (terrainObject - && this.actionStartX === this.actionCurrentX // FIXME Is this check needed? - && this.actionStartY === this.actionCurrentY // FIXME Is this check needed? + && this.actionStartX === this.actionCurrentX + && this.actionStartY === this.actionCurrentY && event.shiftKey) { this.activeEditorFragment.addNewVertex( @@ -562,7 +562,8 @@ define([ // Internal use only. ShapeEditor.prototype.drag = function (clientX, clientY) { - // TODO Understand and review + // FIXME Is this complexity needed? + var refPos = this._shape.getReferencePosition(); var refPoint = this._worldWindow.globe.computePointFromPosition( diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index 2074efa29..f84bc7f13 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -189,6 +189,9 @@ define([ // Internal use only. SurfacePolygonEditorFragment.prototype.addNewVertex = function (shape, globe, position) { + + // TODO Add support for polygons with multiple rings + var pointA = new Vec3(0, 0, 0); var pointB = new Vec3(0, 0, 0); var pointOnEdge = new Vec3(0, 0, 0); From 761ebfea9478f76bfdd1975a7c05ea6befc541a8 Mon Sep 17 00:00:00 2001 From: AkeluX <374540+AkeluX@users.noreply.github.com> Date: Tue, 26 Jun 2018 18:15:33 +0200 Subject: [PATCH 045/112] Add a bit of transparency to the outline color of the shadow shapes --- src/util/editor/ShapeEditor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 2a240daeb..d9a508756 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -515,6 +515,7 @@ define([ var editingAttributes = new ShapeAttributes(this.originalHighlightAttributes); editingAttributes.interiorColor.alpha = editingAttributes.interiorColor.alpha * 0.7; + editingAttributes.outlineColor.alpha = editingAttributes.outlineColor.alpha * 0.7; this._shape.highlightAttributes = editingAttributes; var shadowShape = this.activeEditorFragment.createShadowShape(this._shape); From 7761bd95271f6c57ba525507882790d0ef83c880 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 9 Jul 2018 00:13:59 +0300 Subject: [PATCH 046/112] bugfix add/remove control points and add info box in example file --- examples/ShapeEditor.html | 10 ++++++++++ src/util/editor/ShapeEditor.js | 14 ++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/examples/ShapeEditor.html b/examples/ShapeEditor.html index 18d3317f2..34c00d2d7 100644 --- a/examples/ShapeEditor.html +++ b/examples/ShapeEditor.html @@ -14,6 +14,16 @@ +
+
+
+ Dragging the body of the shape moves the whole shape. Dragging a control point performs the action associated + with that control point. The editor provides vertex insertion and removal for SurfacePolygon and + SurfacePolyline. Shift-clicking when the cursor is over the shape inserts a control point near the position + of the cursor. Ctrl-clicking when the cursor is over a control point removes that particular control point. +
+
+

Projection

diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index d9a508756..5b8bdfe71 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -81,7 +81,7 @@ define([ * Dragging the body of the shape moves the whole shape. Dragging a control point performs the action associated * with that control point. The editor provides vertex insertion and removal for SurfacePolygon and * SurfacePolyline. Shift-clicking when the cursor is over the shape inserts a control point near the position - * of the cursor. Alt-clicking when the cursor is over a control point removes that particular control point. + * of the cursor. Ctrl-clicking when the cursor is over a control point removes that particular control point. *

* This editor currently supports all surface shapes except SurfaceImage. * @param {WorldWindow} worldWindow The World Window to associate this shape editor controller with. @@ -431,12 +431,12 @@ define([ var userObject = object.userObject; if (userObject === this._shape) { - this.beginAction(terrainObject.position, event.altKey); + this.beginAction(terrainObject.position, event.ctrlKey); event.preventDefault(); break; } else if (this.controlPointsLayer.renderables.indexOf(userObject) !== -1) { - this.beginAction(terrainObject.position, event.altKey, userObject); + this.beginAction(terrainObject.position, event.ctrlKey, userObject); event.preventDefault(); break; } @@ -471,11 +471,14 @@ define([ var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); var terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); + + // The editor provides vertex insertion and removal for SurfacePolygon and + // SurfacePolyline. Shift-clicking when the cursor is over the shape inserts a control point near the position + // of the cursor. Ctrl-clicking when the cursor is over a control point removes that particular control point. if (this.actionType) { if (this.actionControlPoint && terrainObject - && event.altKey) { - // FIXME What is this for? + && event.ctrlKey) { this.reshape(terrainObject.position); } @@ -486,7 +489,6 @@ define([ && this.actionStartX === this.actionCurrentX && this.actionStartY === this.actionCurrentY && event.shiftKey) { - this.activeEditorFragment.addNewVertex( this._shape, this._worldWindow.globe, From de7b7334c06d640654f39c0f2d4fb629eea6ed6d Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 9 Jul 2018 00:33:07 +0300 Subject: [PATCH 047/112] refactoring moveLocation --- src/util/editor/BaseSurfaceEditorFragment.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index f7d09dc0a..70ec2d105 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -334,19 +334,14 @@ define([ currentPosition, previousPosition, result) { - // FIXME Is this complexity needed? - - var delta = this.computeControlPointDelta(globe, previousPosition, currentPosition); var controlPointPoint = globe.computePointFromPosition( - controlPoint.position.latitude, - controlPoint.position.longitude, + currentPosition.latitude, + currentPosition.longitude, 0, new Vec3(0, 0, 0) ); - controlPointPoint.add(delta); - return globe.computePositionFromPoint( controlPointPoint[0], controlPointPoint[1], From 65ab36b0ffc449b86e7f9adbacb4114cdb343d5b Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 18 Jul 2018 00:44:37 +0300 Subject: [PATCH 048/112] update license --- examples/ShapeEditor.js | 7 ++++--- src/util/editor/BaseSurfaceEditorFragment.js | 7 ++++--- src/util/editor/ShapeEditor.js | 7 ++++--- src/util/editor/ShapeEditorConstants.js | 7 ++++--- src/util/editor/SurfaceCircleEditorFragment.js | 7 ++++--- src/util/editor/SurfaceEllipseEditorFragment.js | 7 ++++--- src/util/editor/SurfacePolygonEditorFragment.js | 7 ++++--- src/util/editor/SurfacePolylineEditorFragment.js | 7 ++++--- src/util/editor/SurfaceRectangleEditorFragment.js | 7 ++++--- 9 files changed, 36 insertions(+), 27 deletions(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index 4bad338a6..5d2615393 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -1,11 +1,12 @@ /* - * Copyright 2015-2018 WorldWind Contributors + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index 70ec2d105..0a5e2fe22 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -1,11 +1,12 @@ /* - * Copyright 2015-2018 WorldWind Contributors + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 5b8bdfe71..a0caffcb7 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -1,11 +1,12 @@ /* - * Copyright 2015-2018 WorldWind Contributors + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/util/editor/ShapeEditorConstants.js b/src/util/editor/ShapeEditorConstants.js index f5171e6f9..4e256bd41 100644 --- a/src/util/editor/ShapeEditorConstants.js +++ b/src/util/editor/ShapeEditorConstants.js @@ -1,11 +1,12 @@ /* - * Copyright 2015-2018 WorldWind Contributors + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/util/editor/SurfaceCircleEditorFragment.js b/src/util/editor/SurfaceCircleEditorFragment.js index e5573ed85..b2378f484 100644 --- a/src/util/editor/SurfaceCircleEditorFragment.js +++ b/src/util/editor/SurfaceCircleEditorFragment.js @@ -1,11 +1,12 @@ /* - * Copyright 2015-2018 WorldWind Contributors + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/util/editor/SurfaceEllipseEditorFragment.js b/src/util/editor/SurfaceEllipseEditorFragment.js index 3ba3bbcea..520ab9540 100644 --- a/src/util/editor/SurfaceEllipseEditorFragment.js +++ b/src/util/editor/SurfaceEllipseEditorFragment.js @@ -1,11 +1,12 @@ /* - * Copyright 2015-2018 WorldWind Contributors + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index f84bc7f13..c3fff9a53 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -1,11 +1,12 @@ /* - * Copyright 2015-2018 WorldWind Contributors + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index 5f1fada8c..4fb035c97 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -1,11 +1,12 @@ /* - * Copyright 2015-2018 WorldWind Contributors + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/util/editor/SurfaceRectangleEditorFragment.js b/src/util/editor/SurfaceRectangleEditorFragment.js index 93661591b..46634128c 100644 --- a/src/util/editor/SurfaceRectangleEditorFragment.js +++ b/src/util/editor/SurfaceRectangleEditorFragment.js @@ -1,11 +1,12 @@ /* - * Copyright 2015-2018 WorldWind Contributors + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, From 0233577da5c13c7a28bc808fc8696f25dcf6fb78 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 18 Jul 2018 00:52:06 +0300 Subject: [PATCH 049/112] add vertex - add support for multiple rings --- .../editor/SurfacePolygonEditorFragment.js | 119 ++++++++++++------ 1 file changed, 83 insertions(+), 36 deletions(-) diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index c3fff9a53..b12050f5e 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -190,9 +190,6 @@ define([ // Internal use only. SurfacePolygonEditorFragment.prototype.addNewVertex = function (shape, globe, position) { - - // TODO Add support for polygons with multiple rings - var pointA = new Vec3(0, 0, 0); var pointB = new Vec3(0, 0, 0); var pointOnEdge = new Vec3(0, 0, 0); @@ -209,46 +206,96 @@ define([ var nearestPoint = new Vec3(0, 0 , 0); var nearestSegmentIndex = -1; var nearestDistance = Number.MAX_VALUE; - for (var i = 1, len = locations.length; i <= len; i++) { - var locationA = locations[i - 1]; - var locationB = locations[i == len ? 0 : i]; - - globe.computePointFromPosition(locationA.latitude, locationA.longitude, 0, pointA); - globe.computePointFromPosition(locationB.latitude, locationB.longitude, 0, pointB); - - pointOnEdge.copy(pointPicked); - pointOnEdge = this.closestPointOnSegment( - pointA, - pointB, - pointPicked - ); - var distance = pointOnEdge.distanceTo(pointPicked); - if (distance < nearestDistance) { - nearestPoint.copy(pointOnEdge); - nearestSegmentIndex = i; - nearestDistance = distance; + if(Array.isArray(shape.boundaries[0])){ + var nearestPolyIndex = -1; + for (var i = 0, lenPoly = locations.length; i < lenPoly; i++) { + for (var j = 1, lenVertices = locations[i].length; j <= lenVertices; j++){ + var locationA = locations[i][j - 1]; + var locationB = locations[i][j == lenVertices ? 0 : j]; + + globe.computePointFromPosition(locationA.latitude, locationA.longitude, 0, pointA); + globe.computePointFromPosition(locationB.latitude, locationB.longitude, 0, pointB); + + pointOnEdge.copy(pointPicked); + pointOnEdge = this.closestPointOnSegment( + pointA, + pointB, + pointPicked + ); + + var distance = pointOnEdge.distanceTo(pointPicked); + if (distance < nearestDistance) { + nearestPoint.copy(pointOnEdge); + nearestPolyIndex = i; + nearestSegmentIndex = j; + nearestDistance = distance; + } + } } - } - if (nearestDistance < 20000) { - var nearestLocation = globe.computePositionFromPoint( - nearestPoint[0], - nearestPoint[1], - nearestPoint[2], - new Position(0, 0, 0) - ); + if (nearestDistance < 20000) { + var nearestLocation = globe.computePositionFromPoint( + nearestPoint[0], + nearestPoint[1], + nearestPoint[2], + new Position(0, 0, 0) + ); - if (nearestSegmentIndex == locations.length) { - locations.push(nearestLocation); - } else { - locations.splice(nearestSegmentIndex, 0, nearestLocation); + if (nearestSegmentIndex == locations[nearestPolyIndex].length) { + locations[nearestPolyIndex].push(nearestLocation); + } else { + locations[nearestPolyIndex].splice(nearestSegmentIndex, 0, nearestLocation); + } + + shape.resetBoundaries(); + shape._stateId = SurfacePolygon.stateId++; + shape.stateKeyInvalid = true; } + } + else{ + for (var i = 1, len = locations.length; i <= len; i++) { + var locationA = locations[i - 1]; + var locationB = locations[i == len ? 0 : i]; + + globe.computePointFromPosition(locationA.latitude, locationA.longitude, 0, pointA); + globe.computePointFromPosition(locationB.latitude, locationB.longitude, 0, pointB); + + pointOnEdge.copy(pointPicked); + pointOnEdge = this.closestPointOnSegment( + pointA, + pointB, + pointPicked + ); - shape.resetBoundaries(); - shape._stateId = SurfacePolygon.stateId++; - shape.stateKeyInvalid = true; + var distance = pointOnEdge.distanceTo(pointPicked); + if (distance < nearestDistance) { + nearestPoint.copy(pointOnEdge); + nearestSegmentIndex = i; + nearestDistance = distance; + } + } + + if (nearestDistance < 20000) { + var nearestLocation = globe.computePositionFromPoint( + nearestPoint[0], + nearestPoint[1], + nearestPoint[2], + new Position(0, 0, 0) + ); + + if (nearestSegmentIndex == locations.length) { + locations.push(nearestLocation); + } else { + locations.splice(nearestSegmentIndex, 0, nearestLocation); + } + + shape.resetBoundaries(); + shape._stateId = SurfacePolygon.stateId++; + shape.stateKeyInvalid = true; + } } + }; // Internal use only. From c19999323961049168b62d2cb625138ec2a1f189 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 18 Jul 2018 00:58:32 +0300 Subject: [PATCH 050/112] drag refactoring + comment --- src/util/editor/ShapeEditor.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index a0caffcb7..ea89cde4a 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -564,12 +564,28 @@ define([ this._worldWindow.redraw(); }; + // TODO: To be discussed with Yann + // ShapeEditor.prototype.drag = function (clientX, clientY) { + // var mousePoint = this._worldWindow.canvasCoordinates(clientX, clientY); + // var pickList = this._worldWindow.pick(mousePoint); + // var terrainObject = pickList.terrainObject(); + // + // if(terrainObject){ + // this._shape.moveTo(this._worldWindow.globe, new Location(terrainObject.position.latitude, + // terrainObject.position.longitude)); + // } + // + // this.updateControlElements(); + // this.updateShapeAnnotation(); + // this._worldWindow.redraw(); + // }; + // Internal use only. ShapeEditor.prototype.drag = function (clientX, clientY) { - // FIXME Is this complexity needed? - + // Get reference position for the shape that is dragged var refPos = this._shape.getReferencePosition(); + // Get point for referenced position var refPoint = this._worldWindow.globe.computePointFromPosition( refPos.latitude, refPos.longitude, @@ -580,9 +596,11 @@ define([ var screenRefPoint = new Vec3(0, 0, 0); this._worldWindow.drawContext.project(refPoint, screenRefPoint); + // Check drag distance var dx = clientX - this.actionCurrentX; var dy = clientY - this.actionCurrentY; + // Get the latest position of mouse to calculate drag distance this.actionCurrentX = clientX; this.actionCurrentY = clientY; @@ -592,6 +610,7 @@ define([ var ray = this._worldWindow.rayThroughScreenPoint(new Vec2(x, y)); + // Check if the mouse is over the globe and move shape var intersection = new Vec3(0, 0, 0); if (this._worldWindow.globe.intersectsLine(ray, intersection)) { var p = new Position(0, 0, 0); @@ -599,6 +618,7 @@ define([ this._shape.moveTo(this._worldWindow.globe, new Location(p.latitude, p.longitude)); } + // Update control points and shape annotation this.updateControlElements(); this.updateShapeAnnotation(); From 15126bff65027d4753cd31f3064f74e84632d470 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 23 Jul 2018 16:51:27 +0300 Subject: [PATCH 051/112] add constants for surface sector --- src/util/editor/ShapeEditorConstants.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util/editor/ShapeEditorConstants.js b/src/util/editor/ShapeEditorConstants.js index 4e256bd41..9b2503303 100644 --- a/src/util/editor/ShapeEditorConstants.js +++ b/src/util/editor/ShapeEditorConstants.js @@ -40,7 +40,13 @@ define([], RADIUS: "radius", // Indicates that an entire shape is being dragged. - DRAG: "drag" + DRAG: "drag", + + // Indicates the corner with min latitude for a surface sector + MIN_CORNER: "min_corner", + + // Indicates the corner with max latitude for a surface sector + MAX_CORNER: "max_corner" }; return ShapeEditorConstants; From e4d4bb7090b4d8dca07cd1048917c4d1bb6ae649 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 23 Jul 2018 16:52:16 +0300 Subject: [PATCH 052/112] add fragment class for surface sector --- .../editor/SurfaceSectorEditorFragment.js | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/util/editor/SurfaceSectorEditorFragment.js diff --git a/src/util/editor/SurfaceSectorEditorFragment.js b/src/util/editor/SurfaceSectorEditorFragment.js new file mode 100644 index 000000000..0b3066c18 --- /dev/null +++ b/src/util/editor/SurfaceSectorEditorFragment.js @@ -0,0 +1,98 @@ +/* + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. + * + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @exports SurfaceSectorEditorFragment + */ +define([ + './BaseSurfaceEditorFragment', + '../../geom/Location', + '../../geom/Position', + '../../geom/Sector', + './ShapeEditorConstants', + '../../shapes/SurfaceSector' + ], + function (BaseSurfaceEditorFragment, + Location, + Position, + Sector, + ShapeEditorConstants, + SurfaceSector) { + "use strict"; + + // Internal use only. + var SurfaceSectorEditorFragment = function () { + }; + + SurfaceSectorEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); + + // Internal use only. + SurfaceSectorEditorFragment.prototype.canHandle = function (shape) { + return shape instanceof SurfaceSector; + }; + + // Internal use only. + SurfaceSectorEditorFragment.prototype.createShadowShape = function (shape) { + return new SurfaceSector( + new Sector(shape._boundaries[0].latitude, shape._boundaries[1].latitude, shape._boundaries[0].longitude, + shape._boundaries[2].longitude ), + shape.attributes + ); + }; + + // Internal use only. + SurfaceSectorEditorFragment.prototype.getShapeCenter = function (shape, globe) { + return this.getCenterFromLocations(globe, shape._boundaries); + }; + + // Internal use only. + SurfaceSectorEditorFragment.prototype.initializeControlElements = function (shape, + controlPoints, + accessories, + resizeControlPointAttributes) { + + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.MIN_CORNER); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.MAX_CORNER); + }; + + // Internal use only. + SurfaceSectorEditorFragment.prototype.updateControlElements = function (shape, + globe, + controlPoints) { + + controlPoints[0].position = shape._boundaries[0]; + controlPoints[1].position = shape._boundaries[2]; + }; + + // Internal use only. + SurfaceSectorEditorFragment.prototype.reshape = function (shape, + globe, + controlPoint, + currentPosition, + previousPosition) { + + if (controlPoint.userProperties.purpose === ShapeEditorConstants.MIN_CORNER) { + shape.sector = new Sector(currentPosition.latitude, shape._boundaries[1].latitude, + currentPosition.longitude, shape._boundaries[2].longitude); + } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.MAX_CORNER) { + shape.sector = new Sector(shape._boundaries[0].latitude, currentPosition.latitude, + shape._boundaries[0].longitude, currentPosition.longitude); + } + }; + + return SurfaceSectorEditorFragment; + } +); From bcad1814a04524c4868866cf4fd1441138759676 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 8 Aug 2018 16:06:58 +0300 Subject: [PATCH 053/112] update reshape method for surface sector --- src/util/editor/SurfaceSectorEditorFragment.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/util/editor/SurfaceSectorEditorFragment.js b/src/util/editor/SurfaceSectorEditorFragment.js index 0b3066c18..edccde2d4 100644 --- a/src/util/editor/SurfaceSectorEditorFragment.js +++ b/src/util/editor/SurfaceSectorEditorFragment.js @@ -83,13 +83,20 @@ define([ controlPoint, currentPosition, previousPosition) { - if (controlPoint.userProperties.purpose === ShapeEditorConstants.MIN_CORNER) { - shape.sector = new Sector(currentPosition.latitude, shape._boundaries[1].latitude, - currentPosition.longitude, shape._boundaries[2].longitude); + shape.sector = new Sector( + currentPosition.latitude, + shape._sector.maxLatitude, + currentPosition.longitude, + shape._sector.maxLongitude + ); } else if (controlPoint.userProperties.purpose === ShapeEditorConstants.MAX_CORNER) { - shape.sector = new Sector(shape._boundaries[0].latitude, currentPosition.latitude, - shape._boundaries[0].longitude, currentPosition.longitude); + shape.sector = new Sector( + shape._sector.minLatitude, + currentPosition.latitude, + shape._sector.minLongitude, + currentPosition.longitude + ); } }; From 8ba8e8e34bf5bbd4528a9a572b7e2696dfd9ac5c Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 13 Aug 2018 13:41:32 +0300 Subject: [PATCH 054/112] fix sector instance --- examples/ShapeEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index 5d2615393..1941dc15b 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -113,7 +113,7 @@ requirejs(['./WorldWindShim', rectangleShape.highlightAttributes = highlightAttributes; shapesLayer.addRenderable(rectangleShape); - var sectorShape = new WorldWind.SurfaceSector(new WorldWind.Sector(45, 47, -100, -110), attributes); + var sectorShape = new WorldWind.SurfaceSector(new WorldWind.Sector(45, 47, -110, -100), attributes); sectorShape.highlightAttributes = highlightAttributes; shapesLayer.addRenderable(sectorShape); From fc7cc7d099b78217b23d16a6145cb2fc2796d518 Mon Sep 17 00:00:00 2001 From: Yann Voumard <374540+AkeluX@users.noreply.github.com> Date: Wed, 5 Sep 2018 21:15:30 +0200 Subject: [PATCH 055/112] Recenter view and add missing metadata for new GeoTIFF example file (#779) --- examples/GeoTiff.js | 2 +- src/formats/geotiff/GeoTiffMetadata.js | 36 ++++++++++++++++++++++++++ src/formats/geotiff/GeoTiffReader.js | 6 +++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/examples/GeoTiff.js b/examples/GeoTiff.js index 4f70c9ddd..0087e5f87 100644 --- a/examples/GeoTiff.js +++ b/examples/GeoTiff.js @@ -78,7 +78,7 @@ requirejs(['./WorldWindShim', // Redraw the WorldWindow and point the camera towards the imagery location. wwd.redraw(); - wwd.goTo(new WorldWind.Position(43.69, 28.54, 55000)); + wwd.goTo(new WorldWind.Position(43.80, 28.57, 30000)); }); // Create a layer manager for controlling layer visibility. diff --git a/src/formats/geotiff/GeoTiffMetadata.js b/src/formats/geotiff/GeoTiffMetadata.js index d6bc83552..62dd4d7bb 100644 --- a/src/formats/geotiff/GeoTiffMetadata.js +++ b/src/formats/geotiff/GeoTiffMetadata.js @@ -42,6 +42,9 @@ define([ // Documented in defineProperties below. this._extraSamples = null; + // Documented in defineProperties below. + this._imageDescription = null; + // Documented in defineProperties below. this._imageLength = null; @@ -123,6 +126,9 @@ define([ // Documented in defineProperties below. this._noData = null; + // Documented in defineProperties below. + this._metaData = null; + // Documented in defineProperties below. this._bbox = null; @@ -223,6 +229,21 @@ define([ } }, + /** + * Contains the image description. + * @memberof GeoTiffMetadata.prototype + * @type {String} + */ + imageDescription: { + get: function () { + return this._imageDescription; + }, + + set: function(value){ + this._imageDescription = value; + } + }, + /** * Contains the number of rows in the image. * @memberof GeoTiffMetadata.prototype @@ -595,6 +616,21 @@ define([ } }, + /** + * Contains the METADATA value. + * @memberof GeoTiffMetadata.prototype + * @type {String} + */ + metaData: { + get: function () { + return this._metaData; + }, + + set: function(value){ + this._metaData = value; + } + }, + /** * Contains the extent of the geotiff. * @memberof GeoTiffMetadata.prototype diff --git a/src/formats/geotiff/GeoTiffReader.js b/src/formats/geotiff/GeoTiffReader.js index 50ea47da4..add1d29dd 100644 --- a/src/formats/geotiff/GeoTiffReader.js +++ b/src/formats/geotiff/GeoTiffReader.js @@ -813,6 +813,9 @@ define([ case TiffConstants.Tag.EXTRA_SAMPLES: this.metadata.extraSamples = this.imageFileDirectories[0][i].getIFDEntryValue(); break; + case TiffConstants.Tag.IMAGE_DESCRIPTION: + this.metadata.imageDescription = this.imageFileDirectories[0][i].getIFDEntryValue()[0]; + break; case TiffConstants.Tag.IMAGE_LENGTH: this.metadata.imageLength = this.imageFileDirectories[0][i].getIFDEntryValue()[0]; break; @@ -890,6 +893,9 @@ define([ case GeoTiffConstants.Tag.MODEL_TIEPOINT: this.metadata.modelTiepoint = this.imageFileDirectories[0][i].getIFDEntryValue(); break; + case GeoTiffConstants.Tag.GDAL_METADATA: + this.metadata.metaData = this.imageFileDirectories[0][i].getIFDEntryValue(); + break; case GeoTiffConstants.Tag.GDAL_NODATA: this.metadata.noData = this.imageFileDirectories[0][i].getIFDEntryValue(); break; From bf6f498843284e21cc69da1fa3332c14166a4513 Mon Sep 17 00:00:00 2001 From: strikerM Date: Wed, 5 Sep 2018 22:23:40 +0300 Subject: [PATCH 056/112] Improved Collada rendering (#766) * added frustum culling for collada 3d model * flatten node tree and merge gpu buffers added support for large models via the OES_element_index_uint extension * initialize the OES_element_index_uint extension once per drawContext rather than once per model * use the drawContext getExtension method for handling extensions --- src/formats/collada/ColladaMesh.js | 20 +- src/formats/collada/ColladaScene.js | 555 ++++++++++++++-------------- 2 files changed, 296 insertions(+), 279 deletions(-) diff --git a/src/formats/collada/ColladaMesh.js b/src/formats/collada/ColladaMesh.js index 92e62501e..e2c97decc 100644 --- a/src/formats/collada/ColladaMesh.js +++ b/src/formats/collada/ColladaMesh.js @@ -167,6 +167,7 @@ define(['./ColladaUtils'], function (ColladaUtils) { var indicesArray = []; var pos = 0; var indexedRendering = false; + var is32BitIndices = false; for (var i = 0; i < count; i++) { @@ -216,11 +217,17 @@ define(['./ColladaUtils'], function (ColladaUtils) { firstIndex = currentIndex; } if (k > 2 * maxOffset) { + if (firstIndex > 65535 || prevIndex > 65535) { + is32BitIndices = true; + } indicesArray.push(firstIndex); indicesArray.push(prevIndex); } } + if (currentIndex > 65535) { + is32BitIndices = true; + } indicesArray.push(currentIndex); pos += maxOffset; @@ -233,7 +240,11 @@ define(['./ColladaUtils'], function (ColladaUtils) { material: material }; - this.transformMeshInfo(mesh, inputs, indicesArray); + if (mesh.indexedRendering) { + mesh.indices = is32BitIndices ? new Uint32Array(indicesArray) : new Uint16Array(indicesArray); + } + + this.transformMeshInfo(mesh, inputs); return mesh; @@ -295,9 +306,8 @@ define(['./ColladaUtils'], function (ColladaUtils) { * Internal. Applications should not call this function. * @param {Object} mesh The mesh that will be returned. * @param {Array} inputs The array containing the inputs of the mesh. - * @param {Number[]} indicesArray An array containing the indices. */ - ColladaMesh.prototype.transformMeshInfo = function (mesh, inputs, indicesArray) { + ColladaMesh.prototype.transformMeshInfo = function (mesh, inputs) { var translator = { "normal": "normals", "texcoord": "uvs" @@ -327,10 +337,6 @@ define(['./ColladaUtils'], function (ColladaUtils) { } } - if (mesh.indexedRendering) { - mesh.indices = new Uint16Array(indicesArray); - } - return mesh; }; diff --git a/src/formats/collada/ColladaScene.js b/src/formats/collada/ColladaScene.js index 3e0f6321e..576b745e5 100644 --- a/src/formats/collada/ColladaScene.js +++ b/src/formats/collada/ColladaScene.js @@ -51,7 +51,6 @@ define([ * info needed to render the scene. */ var ColladaScene = function (position, sceneData) { - if (!position) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "ColladaScene", "constructor", "missingPosition")); @@ -96,21 +95,33 @@ define([ this._nodesToHide = []; this._hideNodes = false; - this.setSceneData(sceneData); - // 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); }; ColladaScene.prototype = Object.create(Renderable.prototype); @@ -443,19 +454,76 @@ define([ // Internal. Intentionally not documented. ColladaScene.prototype.setSceneData = function (sceneData) { if (sceneData) { - this.nodes = sceneData.root.children; - this.meshes = sceneData.meshes; - this.materials = sceneData.materials; - this.images = sceneData.images; - this.upAxis = sceneData.metadata.up_axis; - this.dirPath = sceneData.dirPath; + this._nodes = sceneData.root.children; + this._meshes = sceneData.meshes; + this._materials = sceneData.materials; + this._images = sceneData.images; + this._upAxis = sceneData.metadata.up_axis; + this._dirPath = sceneData.dirPath; + + this.flattenModel(); } }; // Internal. Intentionally not documented. - ColladaScene.prototype.render = function (dc) { + ColladaScene.prototype.flattenModel = function () { + for (var i = 0, nodesLen = this._nodes.length; i < nodesLen; i++) { + this.flattenNode(this._nodes[i]); + } + this._entities.sort(function (a, b) { + var va = (a.imageKey === null) ? "" : "" + a, + vb = (b.imageKey === null) ? "" : "" + b; + return va > vb ? 1 : (va === vb ? 0 : -1); + }); + }; + + // Internal. Intentionally not documented. + ColladaScene.prototype.flattenNode = function (node) { + if (node.mesh) { + var meshKey = node.mesh; + var buffers = this._meshes[meshKey].buffers; + + for (var i = 0, bufLen = buffers.length; i < bufLen; i++) { + var materialBuf = buffers[i].material; + + for (var j = 0; j < node.materials.length; j++) { + if (materialBuf === node.materials[j].symbol) { + var materialKey = node.materials[j].id; + break; + } + } + + var material = this._materials[materialKey]; + var imageKey = null; + var hasTexture = material && material.textures && buffers[i].uvs && buffers[i].uvs.length > 0; + if (hasTexture) { + if (material.textures.diffuse) { + imageKey = material.textures.diffuse.mapId; + } + else if (material.textures.reflective) { + imageKey = material.textures.reflective.mapId; + } + } + + this._entities.push({ + mesh: buffers[i], + material: material, + node: node, + imageKey: imageKey + }); + } + } + + for (var k = 0; k < node.children.length; k++) { + this.flattenNode(node.children[k]); + } + }; + + // Internal. Intentionally not documented. + ColladaScene.prototype.render = function (dc) { var orderedScene; + var frustum = dc.frustumInModelCoordinates; if (!this.enabled) { return; @@ -469,6 +537,10 @@ define([ return; } + if (!frustum.containsPoint(this._placePoint)) { + return; + } + orderedScene.layer = dc.currentLayer; this.lastFrameTime = dc.timestamp; @@ -478,56 +550,55 @@ define([ // Internal. Intentionally not documented. ColladaScene.prototype.makeOrderedRenderable = function (dc) { + dc.surfacePointForMode(this._position.latitude, this._position.longitude, this._position.altitude, + this._altitudeMode, this._placePoint); - dc.surfacePointForMode(this.position.latitude, this.position.longitude, this.position.altitude, - this.altitudeMode, this.placePoint); - - this.eyeDistance = dc.eyePoint.distanceTo(this.placePoint); + this.eyeDistance = dc.eyePoint.distanceTo(this._placePoint); return this; - }; // Internal. Intentionally not documented. ColladaScene.prototype.renderOrdered = function (dc) { - this.drawOrderedScene(dc); if (dc.pickingMode) { - var po = new PickedObject(this.pickColor.clone(), this, - this.position, this.layer, false); - + var po = new PickedObject(this.pickColor.clone(), this, this._position, this.layer, false); dc.resolvePick(po); } }; // Internal. Intentionally not documented. ColladaScene.prototype.drawOrderedScene = function (dc) { - - this.beginDrawing(dc); - try { - this.doDrawOrderedScene(dc); + this.beginDrawing(dc); } finally { this.endDrawing(dc); } - }; // Internal. Intentionally not documented. ColladaScene.prototype.beginDrawing = function (dc) { - var gl = dc.currentGlContext; + var gpuResourceCache = dc.gpuResourceCache; - dc.findAndBindProgram(BasicTextureProgram); + var vboId = gpuResourceCache.resourceForKey(this._vboCacheKey); + var iboId = gpuResourceCache.resourceForKey(this._iboCacheKey); - gl.enable(gl.CULL_FACE); - gl.enable(gl.DEPTH_TEST); - }; + if (!vboId) { + this.setupBuffers(dc); + vboId = gpuResourceCache.resourceForKey(this._vboCacheKey); + iboId = gpuResourceCache.resourceForKey(this._iboCacheKey); + } - // Internal. Intentionally not documented. - ColladaScene.prototype.doDrawOrderedScene = function (dc) { + gl.bindBuffer(gl.ARRAY_BUFFER, vboId); + if (iboId) { + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, iboId); + } + + dc.findAndBindProgram(BasicTextureProgram); + gl.enableVertexAttribArray(0); if (dc.pickingMode) { this.pickColor = dc.uniquePickColor(); @@ -535,117 +606,193 @@ define([ this.computeTransformationMatrix(dc.globe); - for (var i = 0, nodesLen = this.nodes.length; i < nodesLen; i++) { - this.traverseNodeTree(dc, this.nodes[i]); + for (var i = 0, len = this._entities.length; i < len; i++) { + var mustRenderNode = this.mustRenderNode(this._entities[i].node.id); + if (mustRenderNode) { + this.draw(dc, this._entities[i]); + } } }; // Internal. Intentionally not documented. - ColladaScene.prototype.traverseNodeTree = function (dc, node) { + ColladaScene.prototype.setupBuffers = function (dc) { + var gl = dc.currentGlContext; + var sizeOfFloat32 = Float32Array.BYTES_PER_ELEMENT || 4; + var sizeOfUint16 = Uint16Array.BYTES_PER_ELEMENT || 2; + var sizeOfUint32 = Uint32Array.BYTES_PER_ELEMENT || 4; + var is32BitIndices = false; + var numIndices = 0; + var numVertices = 0; + + for (var i = 0, len = this._entities.length; i < len; i++) { + var mesh = this._entities[i].mesh; + if (mesh.indexedRendering) { + numIndices += mesh.indices.length; + if (mesh.indices instanceof Uint32Array) { + is32BitIndices = true; + } + } + numVertices += mesh.vertices.length; + if (this._entities[i].imageKey) { + numVertices += mesh.uvs.length; + } + if (mesh.normals && mesh.normals.length) { + numVertices += mesh.normals.length; + } + } - var renderNode = this.mustRenderNode(node.id); + var vbo = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, vbo); + gl.bufferData(gl.ARRAY_BUFFER, numVertices * sizeOfFloat32, gl.STATIC_DRAW); - if (renderNode) { + var offset = 0; + for (i = 0, len = this._entities.length; i < len; i++) { + var data = this._entities[i].mesh.vertices; + this._entities[i].vertexOffset = offset; + gl.bufferSubData(gl.ARRAY_BUFFER, offset * sizeOfFloat32, data); + offset += data.length; + } - if (node.mesh) { - var meshKey = node.mesh; - var buffers = this.meshes[meshKey].buffers; + for (i = 0, len = this._entities.length; i < len; i++) { + if (this._entities[i].imageKey) { + data = this._entities[i].mesh.uvs; + this._entities[i].uvOffset = offset; + gl.bufferSubData(gl.ARRAY_BUFFER, offset * sizeOfFloat32, data); + offset += data.length; + } + } - for (var i = 0, bufLen = buffers.length; i < bufLen; i++) { + for (i = 0, len = this._entities.length; i < len; i++) { + data = data = this._entities[i].mesh.normals; + if (data && data.length) { + this._entities[i].normalOffset = offset; + gl.bufferSubData(gl.ARRAY_BUFFER, offset * sizeOfFloat32, data); + offset += data.length; + } + } - var materialBuf = buffers[i].material; + var indexSize = sizeOfUint16; + var indexBufferSize = numIndices * indexSize; + var uIntExt; + if (is32BitIndices) { + uIntExt = dc.getExtension('OES_element_index_uint'); - for (var j = 0; j < node.materials.length; j++) { - if (materialBuf === node.materials[j].symbol) { - var materialKey = node.materials[j].id; - break; - } - } + if (!uIntExt) { + Logger.log(Logger.LEVEL_SEVERE, + 'The 3D model is too big and might not render properly. \n' + + 'Your browser does not support the "OES_element_index_uint" extension, ' + + 'required to render large models.' + ); + } + else { + indexSize = sizeOfUint32; + indexBufferSize = numIndices * indexSize; + } + } - var material = this.materials[materialKey]; + if (numIndices) { + var ibo = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ibo); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indexBufferSize, gl.STATIC_DRAW); - this.draw(dc, buffers[i], material, node.worldMatrix, node.normalMatrix); + offset = 0; + for (i = 0, len = this._entities.length; i < len; i++) { + mesh = this._entities[i].mesh; + if (mesh.indexedRendering) { + data = mesh.indices; + if (data instanceof Uint32Array && !uIntExt) { + data = new Uint16Array(data); + } + this._entities[i].indexOffset = offset; + this._entities[i].indexSize = indexSize; + gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, offset * indexSize, data); + offset += data.length; } } - - for (var k = 0; k < node.children.length; k++) { - this.traverseNodeTree(dc, node.children[k]); - } } + this._vboCacheKey = dc.gpuResourceCache.generateCacheKey(); + dc.gpuResourceCache.putResource(this._vboCacheKey, vbo, numVertices * sizeOfFloat32); + + if (numIndices) { + this._iboCacheKey = dc.gpuResourceCache.generateCacheKey(); + dc.gpuResourceCache.putResource(this._iboCacheKey, ibo, indexBufferSize); + } }; // Internal. Intentionally not documented. - ColladaScene.prototype.draw = function (dc, buffers, material, nodeWorldMatrix, nodeNormalMatrix) { + ColladaScene.prototype.draw = function (dc, entity) { + var gl = dc.currentGlContext; + var program = dc.currentProgram; + var gpuResourceCache = dc.gpuResourceCache; - var gl = dc.currentGlContext, - program = dc.currentProgram, - vboId; + var buffers = entity.mesh; + var material = entity.material; - this.applyVertices(dc, buffers); + var nodeWorldMatrix = entity.node.worldMatrix; + var nodeNormalMatrix = entity.node.normalMatrix; - program.loadTextureEnabled(gl, false); + var hasLighting = buffers.normals && buffers.normals.length; + + var imageKey = entity.imageKey; this.applyColor(dc, material); - var hasTexture = (material && material.textures != null && buffers.uvs && buffers.uvs.length > 0); - if (hasTexture) { - this.applyTexture(dc, buffers, material); + if (imageKey) { + var imagePath = this._useTexturePaths ? this._images[imageKey].path : this._images[imageKey].filename; + var textureCacheKey = this._dirPath + imagePath; + this._activeTexture = gpuResourceCache.resourceForKey(textureCacheKey); + if (!this._activeTexture) { + var wrapMode = buffers.isClamp ? gl.CLAMP_TO_EDGE : gl.REPEAT; + this._activeTexture = gpuResourceCache.retrieveTexture(gl, textureCacheKey, wrapMode); + } + var textureBound = this._activeTexture && this._activeTexture.bind(dc); + if (textureBound) { + program.loadTextureEnabled(gl, true); + gl.vertexAttribPointer(2, 2, gl.FLOAT, false, 8, entity.uvOffset * 4); + gl.enableVertexAttribArray(2); + program.loadModulateColor(gl, dc.pickingMode); + } + else { + program.loadTextureEnabled(gl, false); + gl.disableVertexAttribArray(2); + } } - - var hasLighting = (buffers.normals != null && buffers.normals.length > 0); - if (hasLighting && !dc.pickingMode) { - this.applyLighting(dc, buffers); + else { + program.loadTextureEnabled(gl, false); + gl.disableVertexAttribArray(2); } - this.applyMatrix(dc, hasLighting, hasTexture, nodeWorldMatrix, nodeNormalMatrix); - - if (buffers.indexedRendering) { - this.applyIndices(dc, buffers); - gl.drawElements(gl.TRIANGLES, buffers.indices.length, gl.UNSIGNED_SHORT, 0); + if (hasLighting && !dc.pickingMode) { + program.loadApplyLighting(gl, 1); + gl.vertexAttribPointer(1, 3, gl.FLOAT, false, 12, entity.normalOffset * 4); + gl.enableVertexAttribArray(1); } else { - gl.drawArrays(gl.TRIANGLES, 0, Math.floor(buffers.vertices.length / 3)); + program.loadApplyLighting(gl, 0); + gl.disableVertexAttribArray(1); } - this.resetDraw(dc, hasLighting, hasTexture); - - }; - - // Internal. Intentionally not documented. - ColladaScene.prototype.applyVertices = function (dc, buffers) { - - var gl = dc.currentGlContext, - program = dc.currentProgram, - vboId; + this.applyMatrix(dc, hasLighting, textureCacheKey, nodeWorldMatrix, nodeNormalMatrix); - if (!buffers.verticesVboCacheKey) { - buffers.verticesVboCacheKey = dc.gpuResourceCache.generateCacheKey(); - } + gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 12, entity.vertexOffset * 4); - vboId = dc.gpuResourceCache.resourceForKey(buffers.verticesVboCacheKey); - if (!vboId) { - vboId = gl.createBuffer(); - dc.gpuResourceCache.putResource(buffers.verticesVboCacheKey, vboId, - buffers.vertices.length); - buffers.refreshVertexBuffer = true; + if (buffers.indexedRendering) { + var indexOffsetBytes = entity.indexOffset * entity.indexSize; + if (buffers.indices instanceof Uint32Array && dc.getExtension('OES_element_index_uint')) { + gl.drawElements(gl.TRIANGLES, buffers.indices.length, gl.UNSIGNED_INT, indexOffsetBytes); + } + else { + gl.drawElements(gl.TRIANGLES, buffers.indices.length, gl.UNSIGNED_SHORT, indexOffsetBytes); + } } - - gl.bindBuffer(gl.ARRAY_BUFFER, vboId); - if (buffers.refreshVertexBuffer) { - gl.bufferData(gl.ARRAY_BUFFER, buffers.vertices, gl.STATIC_DRAW); - dc.frameStatistics.incrementVboLoadCount(1); - buffers.refreshVertexBuffer = false; + else { + gl.drawArrays(gl.TRIANGLES, 0, Math.floor(buffers.vertices.length / 3)); } - - gl.enableVertexAttribArray(program.vertexPointLocation); - gl.vertexAttribPointer(program.vertexPointLocation, 3, gl.FLOAT, false, 0, 0); - }; // Internal. Intentionally not documented. ColladaScene.prototype.applyColor = function (dc, material) { - var gl = dc.currentGlContext, program = dc.currentProgram; @@ -668,120 +815,30 @@ define([ a = diffuse[3] != null ? diffuse[3] : 1; } - var color = new Color(r, g, b, a); + this._tmpColor.set(r, g, b, a); opacity = a * this.layer.opacity; gl.depthMask(opacity >= 1 || dc.pickingMode); - program.loadColor(gl, dc.pickingMode ? this.pickColor : color); + program.loadColor(gl, dc.pickingMode ? this.pickColor : this._tmpColor); program.loadOpacity(gl, dc.pickingMode ? (opacity > 0 ? 1 : 0) : opacity); }; - // Internal. Intentionally not documented. - ColladaScene.prototype.applyTexture = function (dc, buffers, material) { - - var textureBound, vboId, - gl = dc.currentGlContext, - program = dc.currentProgram, - wrapMode; - - if (material.textures.diffuse) { - var imageKey = material.textures.diffuse.mapId; - } - else { - imageKey = material.textures.reflective.mapId; - } - - var image = this.useTexturePaths ? this.images[imageKey].path : this.images[imageKey].filename; - - this._activeTexture = dc.gpuResourceCache.resourceForKey(this.dirPath + image + ""); - if (!this._activeTexture) { - wrapMode = buffers.isClamp ? gl.CLAMP_TO_EDGE : gl.REPEAT; - this._activeTexture = dc.gpuResourceCache.retrieveTexture(gl, this.dirPath + image + "", wrapMode); - } - textureBound = this._activeTexture && this._activeTexture.bind(dc); - - if (textureBound) { - if (!buffers.texCoordsVboCacheKey) { - buffers.texCoordsVboCacheKey = dc.gpuResourceCache.generateCacheKey(); - } - - vboId = dc.gpuResourceCache.resourceForKey(buffers.texCoordsVboCacheKey); - if (!vboId) { - vboId = gl.createBuffer(); - dc.gpuResourceCache.putResource(buffers.texCoordsVboCacheKey, vboId, buffers.uvs.length); - buffers.refreshTexCoordBuffer = true; - } - - gl.bindBuffer(gl.ARRAY_BUFFER, vboId); - if (buffers.refreshTexCoordBuffer) { - gl.bufferData(gl.ARRAY_BUFFER, buffers.uvs, gl.STATIC_DRAW); - dc.frameStatistics.incrementVboLoadCount(1); - buffers.refreshTexCoordBuffer = false; - } - - program.loadTextureEnabled(gl, true); - gl.enableVertexAttribArray(program.vertexTexCoordLocation); - gl.vertexAttribPointer(program.vertexTexCoordLocation, 2, gl.FLOAT, false, 0, 0); - program.loadTextureUnit(gl, gl.TEXTURE0); - program.loadModulateColor(gl, dc.pickingMode); - } - }; - - // Internal. Intentionally not documented. - ColladaScene.prototype.applyLighting = function (dc, buffers) { - - var vboId, - gl = dc.currentGlContext, - program = dc.currentProgram; - - program.loadApplyLighting(gl, true); - if (!buffers.normalsVboCacheKey) { - buffers.normalsVboCacheKey = dc.gpuResourceCache.generateCacheKey(); - } - - vboId = dc.gpuResourceCache.resourceForKey(buffers.normalsVboCacheKey); - if (!vboId) { - vboId = gl.createBuffer(); - dc.gpuResourceCache.putResource(buffers.normalsVboCacheKey, vboId, buffers.normals.length); - buffers.refreshNormalBuffer = true; - } - - gl.bindBuffer(gl.ARRAY_BUFFER, vboId); - if (buffers.refreshNormalBuffer) { - gl.bufferData(gl.ARRAY_BUFFER, buffers.normals, gl.STATIC_DRAW); - dc.frameStatistics.incrementVboLoadCount(1); - buffers.refreshNormalBuffer = false; - } - - gl.enableVertexAttribArray(program.normalVectorLocation); - gl.vertexAttribPointer(program.normalVectorLocation, 3, gl.FLOAT, false, 0, 0); - }; - // Internal. Intentionally not documented. ColladaScene.prototype.applyMatrix = function (dc, hasLighting, hasTexture, nodeWorldMatrix, nodeNormalMatrix) { + this._mvpMatrix.copy(dc.modelviewProjection); + this._mvpMatrix.multiplyMatrix(this._transformationMatrix); - var mvpMatrix = Matrix.fromIdentity(); - - mvpMatrix.copy(dc.modelviewProjection); - - mvpMatrix.multiplyMatrix(this.transformationMatrix); - - if (nodeWorldMatrix && this.localTransforms) { - mvpMatrix.multiplyMatrix(nodeWorldMatrix); + if (nodeWorldMatrix && this._localTransforms) { + this._mvpMatrix.multiplyMatrix(nodeWorldMatrix); } if (hasLighting && !dc.pickingMode) { - - var normalMatrix = Matrix.fromIdentity(); - - normalMatrix.copy(dc.modelviewNormalTransform); - - normalMatrix.multiplyMatrix(this.normalMatrix); - - if (nodeNormalMatrix && this.localTransforms) { - normalMatrix.multiplyMatrix(nodeNormalMatrix); + this._normalMatrix.copy(dc.modelviewNormalTransform); + this._normalMatrix.multiplyMatrix(this._normalTransformMatrix); + if (nodeNormalMatrix && this._localTransforms) { + this._normalMatrix.multiplyMatrix(nodeNormalMatrix); } - dc.currentProgram.loadModelviewInverse(dc.currentGlContext, normalMatrix); + dc.currentProgram.loadModelviewInverse(dc.currentGlContext, this._normalMatrix); } if (hasTexture && this._activeTexture) { @@ -789,97 +846,51 @@ define([ this._activeTexture = null; } - dc.currentProgram.loadModelviewProjection(dc.currentGlContext, mvpMatrix); - - }; - - // Internal. Intentionally not documented. - ColladaScene.prototype.applyIndices = function (dc, buffers) { - - var gl = dc.currentGlContext, - vboId; - - if (!buffers.indicesVboCacheKey) { - buffers.indicesVboCacheKey = dc.gpuResourceCache.generateCacheKey(); - } - - vboId = dc.gpuResourceCache.resourceForKey(buffers.indicesVboCacheKey); - if (!vboId) { - vboId = gl.createBuffer(); - dc.gpuResourceCache.putResource(buffers.indicesVboCacheKey, vboId, buffers.indices.length); - buffers.refreshIndicesBuffer = true; - } - - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, vboId); - if (buffers.refreshIndicesBuffer) { - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, buffers.indices, gl.STATIC_DRAW); - dc.frameStatistics.incrementVboLoadCount(1); - buffers.refreshIndicesBuffer = false; - } - - }; - - // Internal. Intentionally not documented. - ColladaScene.prototype.resetDraw = function (dc, hasLighting, hasTexture) { - - var gl = dc.currentGlContext, - program = dc.currentProgram; - - if (hasLighting && !dc.pickingMode) { - program.loadApplyLighting(gl, false); - gl.disableVertexAttribArray(program.normalVectorLocation); - } - - if (hasTexture) { - gl.disableVertexAttribArray(program.vertexTexCoordLocation); - } - - gl.disableVertexAttribArray(program.vertexPointLocation); + dc.currentProgram.loadModelviewProjection(dc.currentGlContext, this._mvpMatrix); }; // Internal. Intentionally not documented. ColladaScene.prototype.endDrawing = function (dc) { - dc.bindProgram(null); + var gl = dc.currentGlContext; + var program = dc.currentProgram; + + gl.disableVertexAttribArray(1); + gl.disableVertexAttribArray(2); + program.loadApplyLighting(gl, 0); + program.loadTextureEnabled(gl, false); }; // Internal. Intentionally not documented. ColladaScene.prototype.computeTransformationMatrix = function (globe) { + this._transformationMatrix.setToIdentity(); - this.transformationMatrix = Matrix.fromIdentity(); - - this.transformationMatrix.multiplyByLocalCoordinateTransform(this.placePoint, globe); + this._transformationMatrix.multiplyByLocalCoordinateTransform(this._placePoint, globe); - this.transformationMatrix.multiplyByRotation(1, 0, 0, this.xRotation); - this.transformationMatrix.multiplyByRotation(0, 1, 0, this.yRotation); - this.transformationMatrix.multiplyByRotation(0, 0, 1, this.zRotation); + this._transformationMatrix.multiplyByRotation(1, 0, 0, this._xRotation); + this._transformationMatrix.multiplyByRotation(0, 1, 0, this._yRotation); + this._transformationMatrix.multiplyByRotation(0, 0, 1, this._zRotation); - this.transformationMatrix.multiplyByScale(this.scale, this.scale, this.scale); + this._transformationMatrix.multiplyByScale(this._scale, this._scale, this._scale); - this.transformationMatrix.multiplyByTranslation(this.xTranslation, this.yTranslation, this.zTranslation); + this._transformationMatrix.multiplyByTranslation(this._xTranslation, this._yTranslation, this._zTranslation); this.computeNormalMatrix(); - }; // Internal. Intentionally not documented. ColladaScene.prototype.computeNormalMatrix = function () { - - var rotAngles = new Vec3(0, 0, 0); - - this.transformationMatrix.extractRotationAngles(rotAngles); - - this.normalMatrix = Matrix.fromIdentity(); - - this.normalMatrix.multiplyByRotation(-1, 0, 0, rotAngles[0]); - this.normalMatrix.multiplyByRotation(0, -1, 0, rotAngles[1]); - this.normalMatrix.multiplyByRotation(0, 0, -1, rotAngles[2]); + this._transformationMatrix.extractRotationAngles(this._tmpVector); + this._normalTransformMatrix.setToIdentity(); + this._normalTransformMatrix.multiplyByRotation(-1, 0, 0, this._tmpVector[0]); + this._normalTransformMatrix.multiplyByRotation(0, -1, 0, this._tmpVector[1]); + this._normalTransformMatrix.multiplyByRotation(0, 0, -1, this._tmpVector[2]); }; // Internal. Intentionally not documented. ColladaScene.prototype.mustRenderNode = function (nodeId) { var draw = true; - if (this.hideNodes) { - var pos = this.nodesToHide.indexOf(nodeId); + if (this._hideNodes) { + var pos = this._nodesToHide.indexOf(nodeId); draw = (pos === -1); } return draw; From e7aa3c6c74d48ef0808ff81dc3422c8143460f00 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 5 Sep 2018 22:41:38 +0300 Subject: [PATCH 057/112] Add getReferencePosition and moveTo to SurfaceSector (#776) --- src/shapes/SurfaceSector.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/shapes/SurfaceSector.js b/src/shapes/SurfaceSector.js index 8078c9712..ce5e335ba 100644 --- a/src/shapes/SurfaceSector.js +++ b/src/shapes/SurfaceSector.js @@ -113,5 +113,30 @@ define([ this._boundaries[3] = new Location(sector.minLatitude, sector.maxLongitude); }; + // Internal use only. Intentionally not documented. + SurfaceSector.prototype.getReferencePosition = function () { + return new Location(this.sector.centroidLatitude(), this.sector.centroidLongitude()); + }; + + // Internal use only. Intentionally not documented. + SurfaceSector.prototype.moveTo = function (globe, position) { + var sector = this._sector; + + var locations = new Array(3); + + locations[0] = new Location(sector.minLatitude, sector.minLongitude); + locations[1] = new Location(sector.maxLatitude, sector.minLongitude); + locations[2] = new Location(sector.maxLatitude, sector.maxLongitude); + + locations = this.computeShiftedLocations(globe, this.getReferencePosition(), position, locations); + + this.sector = new WorldWind.Sector( + locations[0].latitude, + locations[1].latitude, + locations[1].longitude, + locations[2].longitude + ); + }; + return SurfaceSector; - }); \ No newline at end of file + }); From deff241989f9a5999d13150d1029c012e536ec6a Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 10 Sep 2018 15:34:26 +0300 Subject: [PATCH 058/112] add sector editing feature --- src/util/editor/ShapeEditor.js | 26 +++++-------------- .../editor/SurfaceSectorEditorFragment.js | 5 ++-- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index ea89cde4a..881c45c18 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -38,6 +38,7 @@ define([ './SurfacePolygonEditorFragment', './SurfacePolylineEditorFragment', './SurfaceRectangleEditorFragment', + './SurfaceSectorEditorFragment', '../../geom/Vec2', '../../geom/Vec3' ], @@ -61,6 +62,7 @@ define([ SurfacePolygonEditorFragment, SurfacePolylineEditorFragment, SurfaceRectangleEditorFragment, + SurfaceSectorEditorFragment, Vec2, Vec3) { "use strict"; @@ -138,7 +140,8 @@ define([ new SurfaceEllipseEditorFragment(), new SurfacePolygonEditorFragment(), new SurfacePolylineEditorFragment(), - new SurfaceRectangleEditorFragment() + new SurfaceRectangleEditorFragment(), + new SurfaceSectorEditorFragment() ]; // Internal use only. @@ -456,7 +459,6 @@ define([ if (terrainObject) { if (this.actionType === ShapeEditorConstants.DRAG) { this.drag(event.clientX, event.clientY); - } else { this.reshape(terrainObject.position); } @@ -535,7 +537,7 @@ define([ this.shadowShapeLayer.removeAllRenderables(); this._shape.highlightAttributes = this.originalHighlightAttributes; - + this.hideAnnotation(); this.actionControlPoint = null; @@ -564,25 +566,9 @@ define([ this._worldWindow.redraw(); }; - // TODO: To be discussed with Yann - // ShapeEditor.prototype.drag = function (clientX, clientY) { - // var mousePoint = this._worldWindow.canvasCoordinates(clientX, clientY); - // var pickList = this._worldWindow.pick(mousePoint); - // var terrainObject = pickList.terrainObject(); - // - // if(terrainObject){ - // this._shape.moveTo(this._worldWindow.globe, new Location(terrainObject.position.latitude, - // terrainObject.position.longitude)); - // } - // - // this.updateControlElements(); - // this.updateShapeAnnotation(); - // this._worldWindow.redraw(); - // }; - // Internal use only. ShapeEditor.prototype.drag = function (clientX, clientY) { - // Get reference position for the shape that is dragged + // Get refecence position for the shape that is dragged var refPos = this._shape.getReferencePosition(); // Get point for referenced position diff --git a/src/util/editor/SurfaceSectorEditorFragment.js b/src/util/editor/SurfaceSectorEditorFragment.js index edccde2d4..a78f91dec 100644 --- a/src/util/editor/SurfaceSectorEditorFragment.js +++ b/src/util/editor/SurfaceSectorEditorFragment.js @@ -72,9 +72,8 @@ define([ SurfaceSectorEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints) { - - controlPoints[0].position = shape._boundaries[0]; - controlPoints[1].position = shape._boundaries[2]; + controlPoints[0].position = new Location(shape._sector.minLatitude, shape._sector.minLongitude); + controlPoints[1].position = new Location(shape._sector.maxLatitude, shape._sector.maxLongitude); }; // Internal use only. From 4c835f04024479b036fdc753c9fcb0e1d4d67db1 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 10 Sep 2018 15:44:43 +0300 Subject: [PATCH 059/112] fix typo --- src/util/editor/ShapeEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 881c45c18..2b72c5152 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -568,7 +568,7 @@ define([ // Internal use only. ShapeEditor.prototype.drag = function (clientX, clientY) { - // Get refecence position for the shape that is dragged + // Get reference position for the shape that is dragged var refPos = this._shape.getReferencePosition(); // Get point for referenced position From 1fdbb44c6a855c973224a0d1fe8548faad68c082 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 10 Sep 2018 18:12:56 +0300 Subject: [PATCH 060/112] polygon move 3d issue --- src/shapes/SurfaceShape.js | 59 ++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/src/shapes/SurfaceShape.js b/src/shapes/SurfaceShape.js index ccb5a24fc..bc5311a7f 100644 --- a/src/shapes/SurfaceShape.js +++ b/src/shapes/SurfaceShape.js @@ -793,18 +793,65 @@ define([ new Vec3(0, 0, 0)); var newPoint = globe.computePointFromLocation(newLocation.latitude, newLocation.longitude, new Vec3(0, 0, 0)); - var delta = newPoint.subtract(oldPoint); - for (var i = 0, len = locations.length; i < len; i++) { - globe.computePointFromLocation(locations[i].latitude, locations[i].longitude, result); - result.add(delta); - globe.computePositionFromPoint(result[0], result[1], result[2], newPos); - newLocations.push(new Location(newPos.latitude, newPos.longitude)); + if(globe.is2D()){ + var delta = newPoint.subtract(oldPoint); + + for (var i = 0, len = locations.length; i < len; i++) { + globe.computePointFromLocation(locations[i].latitude, locations[i].longitude, result); + result.add(delta); + globe.computePositionFromPoint(result[0], result[1], result[2], newPos); + newLocations.push(new Location(newPos.latitude, newPos.longitude)); + } + } else { + var delta_lat = newLocation.latitude - oldLocation.latitude; + var delta_long = newLocation.longitude - oldLocation.longitude; + var max = -90; + var min = 90; + + for (var i = 0, len = locations.length; i < len; i++) { + var new_lat = locations[i].latitude + delta_lat; + var new_long = locations[i].longitude + delta_long; + + + if (new_lat > 90) { + new_lat = 180 - new_lat; + new_long += 180; + } else if (new_lat < -90) { + new_lat = -180 - new_lat; + new_long += 180; + } + + if (new_long < -180) { + new_long += 360; + } else if (new_long > 180) { + new_long -= 360; + } + + + if (new_lat > max) { + max = new_lat; + } + + if (new_lat < min) { + min = new_lat; + } + + newLocations.push(new Location(new_lat, new_long)); + } + + if (max > 87) { + var delta = max - 87; + for (var i = 0, len = newLocations.length; i < len; i++) { + newLocations[i].latitude -= delta; + } + } } return newLocations; }; + // Internal use only. Intentionally not documented. SurfaceShape.prototype.prepareSectors = function () { this.determineSectors(); From 44aca8c37ff7d287f6f2ed3eb4c08c191eb3db46 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 17 Sep 2018 16:35:12 +0300 Subject: [PATCH 061/112] update example for shape creation - circle --- examples/ShapeEditor.html | 11 +++++++++++ examples/ShapeEditor.js | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/examples/ShapeEditor.html b/examples/ShapeEditor.html index 34c00d2d7..1b367a385 100644 --- a/examples/ShapeEditor.html +++ b/examples/ShapeEditor.html @@ -35,6 +35,17 @@

Layers


+

Shape creator

+
+ + + + + + + +
+

Shape editing

diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index 1941dc15b..c49fc3af0 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -124,6 +124,21 @@ requirejs(['./WorldWindShim', var shapeEditor = new WorldWind.ShapeEditor(wwd); + document.getElementById("createCircleBtn").addEventListener("click", function(){ + shapeEditor.create(WorldWind.SurfaceCircle, attributes).then( + function (shape) { + shapesLayer.addRenderable(shape); + }, + function (error) { + if (error) { + console.log("Error in shape creation: " + error); + } else { + console.log("No shape created."); + } + } + ); + }); + document.getElementById("editCircleBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== circleShape) { From aa6ecba7b78a37836b724eea41c8ef9af9489838 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 20 Sep 2018 00:09:53 +0300 Subject: [PATCH 062/112] update shape fragments --- src/util/editor/SurfaceCircleEditorFragment.js | 8 ++++++++ src/util/editor/SurfaceEllipseEditorFragment.js | 8 ++++++++ src/util/editor/SurfacePolygonEditorFragment.js | 8 ++++++++ src/util/editor/SurfacePolylineEditorFragment.js | 8 ++++++++ src/util/editor/SurfaceRectangleEditorFragment.js | 8 ++++++++ src/util/editor/SurfaceSectorEditorFragment.js | 8 ++++++++ 6 files changed, 48 insertions(+) diff --git a/src/util/editor/SurfaceCircleEditorFragment.js b/src/util/editor/SurfaceCircleEditorFragment.js index b2378f484..062632d7b 100644 --- a/src/util/editor/SurfaceCircleEditorFragment.js +++ b/src/util/editor/SurfaceCircleEditorFragment.js @@ -36,6 +36,9 @@ define([ // Internal use only. SurfaceCircleEditorFragment.prototype.canHandle = function (shape) { + if (shape instanceof Function) { + return shape.name === "SurfaceCircle"; + } return shape instanceof SurfaceCircle; }; @@ -49,6 +52,11 @@ define([ return shape.center; }; + // Internal use only. + SurfaceCircleEditorFragment.prototype.isRegularShape = function () { + return true; + }; + // Internal use only. SurfaceCircleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, diff --git a/src/util/editor/SurfaceEllipseEditorFragment.js b/src/util/editor/SurfaceEllipseEditorFragment.js index 520ab9540..28d570036 100644 --- a/src/util/editor/SurfaceEllipseEditorFragment.js +++ b/src/util/editor/SurfaceEllipseEditorFragment.js @@ -36,6 +36,9 @@ define([ // Internal use only. SurfaceEllipseEditorFragment.prototype.canHandle = function (shape) { + if (shape instanceof Function) { + return shape.name === "SurfaceEllipse"; + } return shape instanceof SurfaceEllipse; }; @@ -55,6 +58,11 @@ define([ return shape.center; }; + // Internal use only. + SurfaceEllipseEditorFragment.prototype.isRegularShape = function () { + return true; + }; + // Internal use only. SurfaceEllipseEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index b12050f5e..1cedf7ef9 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -43,6 +43,9 @@ define([ // Internal use only. SurfacePolygonEditorFragment.prototype.canHandle = function (shape) { + if (shape instanceof Function) { + return shape.name === "SurfacePolygon"; + } return shape instanceof SurfacePolygon; }; @@ -56,6 +59,11 @@ define([ return this.getCenterFromLocations(globe, shape.boundaries); }; + // Internal use only. + SurfacePolygonEditorFragment.prototype.isRegularShape = function () { + return false; + }; + // Internal use only. SurfacePolygonEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index 4fb035c97..13bceb92d 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -43,6 +43,9 @@ define([ //Internal use only. Intentionally not documented. SurfacePolylineEditorFragment.prototype.canHandle = function (shape) { + if (shape instanceof Function) { + return shape.name === "SurfacePolyline"; + } return shape instanceof SurfacePolyline; }; @@ -56,6 +59,11 @@ define([ return this.getCenterFromLocations(globe, shape.boundaries); }; + // Internal use only. + SurfacePolylineEditorFragment.prototype.isRegularShape = function () { + return false; + }; + // Internal use only. SurfacePolylineEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, diff --git a/src/util/editor/SurfaceRectangleEditorFragment.js b/src/util/editor/SurfaceRectangleEditorFragment.js index 46634128c..44f465139 100644 --- a/src/util/editor/SurfaceRectangleEditorFragment.js +++ b/src/util/editor/SurfaceRectangleEditorFragment.js @@ -36,6 +36,9 @@ define([ // Internal use only. SurfaceRectangleEditorFragment.prototype.canHandle = function (shape) { + if (shape instanceof Function) { + return shape.name === "SurfaceRectangle"; + } return shape instanceof SurfaceRectangle; }; @@ -55,6 +58,11 @@ define([ return shape.center; }; + // Internal use only. + SurfaceRectangleEditorFragment.prototype.isRegularShape = function () { + return true; + }; + // Internal use only. SurfaceRectangleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, diff --git a/src/util/editor/SurfaceSectorEditorFragment.js b/src/util/editor/SurfaceSectorEditorFragment.js index a78f91dec..1a14546a1 100644 --- a/src/util/editor/SurfaceSectorEditorFragment.js +++ b/src/util/editor/SurfaceSectorEditorFragment.js @@ -41,6 +41,9 @@ define([ // Internal use only. SurfaceSectorEditorFragment.prototype.canHandle = function (shape) { + if (shape instanceof Function) { + return shape.name === "SurfaceSector"; + } return shape instanceof SurfaceSector; }; @@ -58,6 +61,11 @@ define([ return this.getCenterFromLocations(globe, shape._boundaries); }; + // Internal use only. + SurfaceSectorEditorFragment.prototype.isRegularShape = function () { + return true; + }; + // Internal use only. SurfaceSectorEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, From b77f9e79547e071c54e36bb8216d1fadf9cb29a5 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 20 Sep 2018 00:10:24 +0300 Subject: [PATCH 063/112] create regular shapes --- src/util/editor/ShapeEditor.js | 125 ++++++++++++++++++++++++++++++++- 1 file changed, 124 insertions(+), 1 deletion(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 2b72c5152..3dd05fcd7 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -29,6 +29,7 @@ define([ '../../shapes/Placemark', '../../shapes/PlacemarkAttributes', '../../geom/Position', + '../Promise', '../../layer/RenderableLayer', '../../shapes/ShapeAttributes', './ShapeEditorConstants', @@ -53,6 +54,7 @@ define([ Placemark, PlacemarkAttributes, Position, + Promise, RenderableLayer, ShapeAttributes, ShapeEditorConstants, @@ -131,6 +133,15 @@ define([ this._annotationAttributes.insets = new Insets(5, 5, 5, 5); // Internal use only. + // Used for shape creation + this.creatorEnabled = false; + this.creatorShapeProperties = null; + + // Internal use only. + // The layer that holds the new created shape using shape creator. + this.newCreatedShapeLayer = new RenderableLayer("Shape Editor Shadow Shape"); + + // The annotation that displays hints during the actions on the shape. this.annotation = new WorldWind.Annotation(new WorldWind.Position(0, 0, 0), this._annotationAttributes); @@ -291,6 +302,62 @@ define([ } }); + /** + * Creates the specified shape. + * @param {SurfaceShape} shape The shape that will be created. + * @param {ShapeAttributes} attributes The attributes of the shape that will be created. + * @return {Promise} The shape created if any; otherwise null. + * false. + */ + ShapeEditor.prototype.enableCreator = function (shape, properties, layer) { + this.stop(); + this.setCreatorEnabled(true); + + for (var i = 0, len = this.editorFragments.length; i < len; i++) { + var editorFragment = this.editorFragments[i]; + if (editorFragment.canHandle(shape)) { + this.activeEditorFragment = editorFragment; + this.creatorShapeProperties = properties; + this.newCreatedShapeLayer = layer; + } + } + + }; + // ShapeEditor.prototype.create = function (shape, attributes) { + // this.stop(); + // this.setArmed(true); + // + // var fragments = this.editorFragments; + // var newShape = null; + // + // return new Promise(function(resolve, reject) { + // // Look for a fragment that can create the specified shape + // for (var i = 0, len = fragments.length; i < len; i++) { + // var editorFragment = fragments[i]; + // if (editorFragment.canHandle(shape)) { + // newShape = editorFragment.createShape(shape, currentPosition, attributes); + // // this.activeEditorFragment = editorFragment; + // } + // } + // + // return newShape; + // + // // If we have a fragment for this shape, accept the shape and start the creation + // // if (this.activeEditorFragment != null) { + // // var currentPosition = this.wwd.getReferencePosition(); + // // console.dir(currentPosition); + // // + // // this._shape = this.activeEditorFragment.createShape(shape, currentPosition, attributes); + // // this._shape.highlighted = true; + // // this._shape.setAttributes(attributes); + // // + // // return this._shape; + // // } else { + // // return null; + // // } + // }); + // }; + /** * Edits the specified shape. Currently, only surface shapes are supported. * @param {SurfaceShape} shape The shape to edit. @@ -327,6 +394,8 @@ define([ this.removeControlElements(); this.activeEditorFragment = null; + this.creatorShapeProperties = null; + this.newCreatedShapeLayer = null; var currentShape = this._shape; this._shape = null; @@ -338,6 +407,27 @@ define([ return currentShape; }; + /** + * Identifies whether the shape editor create mode is armed. + * @return true if armed, false if not armed. + */ + ShapeEditor.prototype.isCreatorEnabled = function() { + return this.creatorEnabled; + } + + /** + * Arms and disarms the shape editor create mode. When armed, editor monitors user input and builds the + * shape in response to user actions. When disarmed, the shape editor ignores all user input for creation of a + * new shape. + * + * @param armed true to arm the shape editor create mode, false to disarm it. + */ + ShapeEditor.prototype.setCreatorEnabled = function(creatorEnabled) { + if (this.creatorEnabled != creatorEnabled) { + this.creatorEnabled = creatorEnabled; + } + } + // Internal use only. // Called by {@link ShapeEditor#edit} to initialize the control elements used for editing. ShapeEditor.prototype.initializeControlElements = function () { @@ -398,7 +488,7 @@ define([ // Internal use only. // Dispatches the events relevant to the shape editor. ShapeEditor.prototype.onGestureEvent = function (event) { - if(this._shape === null) { + if(this._shape === null && !this.isCreatorEnabled()) { return; } @@ -428,6 +518,35 @@ define([ var pickList = this._worldWindow.pick(mousePoint); var terrainObject = pickList.terrainObject(); + if (terrainObject && this.isCreatorEnabled() && this.activeEditorFragment !== null && this._shape === null) { + + if (this.activeEditorFragment.isRegularShape()) { + this.creatorShapeProperties.center = terrainObject.position; + this.creatorShapeProperties._boundaries = [ + { + latitude: terrainObject.position.latitude - 1, + longitude: terrainObject.position.longitude - 1 + }, + { + latitude: terrainObject.position.latitude + 1, + longitude: terrainObject.position.longitude - 1 + }, + { + latitude: terrainObject.position.latitude + 1, + longitude: terrainObject.position.longitude + 1 + } + ]; + } else { + + } + + this._shape = this.activeEditorFragment.createShadowShape(this.creatorShapeProperties); + + this.newCreatedShapeLayer.addRenderable(this._shape); + this.edit(this._shape); + event.preventDefault(); + } + for (var p = 0, len = pickList.objects.length; p < len; p++) { var object = pickList.objects[p]; @@ -475,6 +594,10 @@ define([ var terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); + if (this.isCreatorEnabled() && this.activeEditorFragment.isRegularShape()) { + this.setCreatorEnabled(false); + } + // The editor provides vertex insertion and removal for SurfacePolygon and // SurfacePolyline. Shift-clicking when the cursor is over the shape inserts a control point near the position // of the cursor. Ctrl-clicking when the cursor is over a control point removes that particular control point. From b58f44be10cebd078900b24484baaf0ce16bd0dc Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 20 Sep 2018 00:10:41 +0300 Subject: [PATCH 064/112] update example --- examples/ShapeEditor.html | 6 +-- examples/ShapeEditor.js | 94 ++++++++++++++++++++++++++++++++++----- 2 files changed, 85 insertions(+), 15 deletions(-) diff --git a/examples/ShapeEditor.html b/examples/ShapeEditor.html index 1b367a385..dfcccc6e3 100644 --- a/examples/ShapeEditor.html +++ b/examples/ShapeEditor.html @@ -38,12 +38,12 @@

Layers

Shape creator

- + - - + +

Shape editing

diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index c49fc3af0..831fbea5a 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -47,6 +47,10 @@ requirejs(['./WorldWindShim', wwd.addLayer(layers[l].layer); } + // A layer to hold the new created surface shapes. + var newCreatedShapesLayer = new WorldWind.RenderableLayer("New Created Surface Shapes"); + wwd.addLayer(newCreatedShapesLayer); + // Create a layer to hold the surface shapes. var shapesLayer = new WorldWind.RenderableLayer("Surface Shapes"); wwd.addLayer(shapesLayer); @@ -125,18 +129,84 @@ requirejs(['./WorldWindShim', var shapeEditor = new WorldWind.ShapeEditor(wwd); document.getElementById("createCircleBtn").addEventListener("click", function(){ - shapeEditor.create(WorldWind.SurfaceCircle, attributes).then( - function (shape) { - shapesLayer.addRenderable(shape); - }, - function (error) { - if (error) { - console.log("Error in shape creation: " + error); - } else { - console.log("No shape created."); - } - } - ); + var properties = { + center: null, + radius: 200e3, + attributes: attributes + }; + + shapeEditor.enableCreator(WorldWind.SurfaceCircle, properties, newCreatedShapesLayer); + // shapeEditor.create(WorldWind.SurfaceCircle, attributes).then( + // function (shape) { + // if (shape !== null) { + // shapesLayer.addRenderable(shape); + // } else { + // console.log("No shape created - null shape returned."); + // } + // + // }, + // function (error) { + // if (error) { + // console.log("Error in shape creation: " + error); + // } else { + // console.log("No shape created."); + // } + // } + // ); + }); + + document.getElementById("createEllipseBtn").addEventListener("click", function(){ + var properties = { + majorRadius: 300e3, + minorRadius: 200e3, + heading: 0, + attributes: attributes + }; + + shapeEditor.enableCreator(WorldWind.SurfaceEllipse, properties, newCreatedShapesLayer); + }); + // + // document.getElementById("createPolygonBtn").addEventListener("click", function(){ + // var properties = { + // + // }; + // + // shapeEditor.enableCreator(WorldWind.SurfacePolygon, properties, newCreatedShapesLayer); + // }); + // + // document.getElementById("createMultiPolygonBtn").addEventListener("click", function(){ + // var properties = { + // + // }; + // + // shapeEditor.enableCreator(WorldWind.SurfacePolygon, properties, newCreatedShapesLayer); + // }); + // + // document.getElementById("createPolylineBtn").addEventListener("click", function(){ + // var properties = { + // + // }; + // + // shapeEditor.enableCreator(WorldWind.SurfacePolyline, properties, newCreatedShapesLayer); + // }); + + document.getElementById("createRectangleBtn").addEventListener("click", function(){ + var properties = { + width: 300e3, + height: 200e3, + heading: 0, + attributes: attributes + }; + + shapeEditor.enableCreator(WorldWind.SurfaceRectangle, properties, newCreatedShapesLayer); + }); + + document.getElementById("createSectorBtn").addEventListener("click", function(){ + var properties = { + attributes: attributes + }; + + shapeEditor.enableCreator(WorldWind.SurfaceSector, properties, newCreatedShapesLayer); }); document.getElementById("editCircleBtn").addEventListener("click", function(){ From 652cb4d81703fbd928ffd4e5cfab829b84472b92 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Fri, 5 Oct 2018 13:38:29 +0300 Subject: [PATCH 065/112] add placemark editor fragment --- src/util/editor/PlacemarkEditorFragment.js | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/util/editor/PlacemarkEditorFragment.js diff --git a/src/util/editor/PlacemarkEditorFragment.js b/src/util/editor/PlacemarkEditorFragment.js new file mode 100644 index 000000000..c687f43a2 --- /dev/null +++ b/src/util/editor/PlacemarkEditorFragment.js @@ -0,0 +1,79 @@ +/* + * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the + * National Aeronautics and Space Administration. All rights reserved. + * + * The NASAWorldWind/WebWorldWind platform is licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @exports PlacemarkEditorFragment + */ +define([ + './BaseSurfaceEditorFragment', + '../../geom/Location', + './ShapeEditorConstants', + '../../shapes/Placemark' + ], + function (BaseSurfaceEditorFragment, + Location, + ShapeEditorConstants, + Placemark) { + "use strict"; + + // Internal use only. + var PlacemarkEditorFragment = function () {}; + + PlacemarkEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); + + // Internal use only. + PlacemarkEditorFragment.prototype.canHandle = function (shape) { + return shape instanceof Placemark; + }; + + // Internal use only. + PlacemarkEditorFragment.prototype.createShadowShape = function (shape) { + return new Placemark(shape.position, null, shape.attributes); + }; + + // Internal use only. + PlacemarkEditorFragment.prototype.getShapeCenter = function (shape) { + return shape.position; + }; + + // Internal use only. + PlacemarkEditorFragment.prototype.initializeControlElements = function (shape, + controlPoints, + accessories, + resizeControlPointAttributes, + rotateControlPointAttributes, + moveControlPointAttributes) { + + this.createControlPoint(controlPoints, moveControlPointAttributes, ShapeEditorConstants.DRAG); + }; + + // Internal use only. + PlacemarkEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints) { + controlPoints[0].position = shape.position; + }; + + // Internal use only. + PlacemarkEditorFragment.prototype.reshape = function (shape, + globe, + controlPoint, + currentPosition, + previousPosition) { + return false; + }; + + return PlacemarkEditorFragment; + } +); \ No newline at end of file From 99739bd7cb9aea09d4e0d1d8d94951efc1aab02d Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Fri, 5 Oct 2018 13:39:41 +0300 Subject: [PATCH 066/112] update shape editor to enable placemark editing --- src/util/editor/ShapeEditor.js | 41 +++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 2b72c5152..0aef6811d 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -28,6 +28,7 @@ define([ '../Logger', '../../shapes/Placemark', '../../shapes/PlacemarkAttributes', + './PlacemarkEditorFragment', '../../geom/Position', '../../layer/RenderableLayer', '../../shapes/ShapeAttributes', @@ -52,6 +53,7 @@ define([ Logger, Placemark, PlacemarkAttributes, + PlacemarkEditorFragment, Position, RenderableLayer, ShapeAttributes, @@ -136,6 +138,7 @@ define([ //Internal use only. Intentionally not documented. this.editorFragments = [ + new PlacemarkEditorFragment(), new SurfaceCircleEditorFragment(), new SurfaceEllipseEditorFragment(), new SurfacePolygonEditorFragment(), @@ -204,6 +207,7 @@ define([ // Internal use only. // The original highlight attributes of the shape in order to restore them after the action. this.originalHighlightAttributes = new ShapeAttributes(null); + this.originalPlacemarkHighlightAttributes = new PlacemarkAttributes(null); this._worldWindow.worldWindowController.addGestureListener(this); }; @@ -515,16 +519,37 @@ define([ this.actionControlPosition = initialPosition; this.actionSecondaryBehavior = alternateAction; + + + var editingAttributes = null; + // Place a shadow shape at the original location of the shape - this.originalHighlightAttributes = this._shape.highlightAttributes; + if (this.activeEditorFragment instanceof PlacemarkEditorFragment) { + this.originalHighlightAttributes = null; + this.originalPlacemarkHighlightAttributes = this._shape.highlightAttributes; + + editingAttributes = new PlacemarkAttributes(this.originalPlacemarkHighlightAttributes); + editingAttributes.imageColor.alpha = editingAttributes.imageColor.alpha * 0.7; + } else { + this.originalHighlightAttributes = this._shape.highlightAttributes; + this.originalPlacemarkHighlightAttributes = null; + + editingAttributes = new ShapeAttributes(this.originalHighlightAttributes); + editingAttributes.interiorColor.alpha = editingAttributes.interiorColor.alpha * 0.7; + editingAttributes.outlineColor.alpha = editingAttributes.outlineColor.alpha * 0.7; + } - var editingAttributes = new ShapeAttributes(this.originalHighlightAttributes); - editingAttributes.interiorColor.alpha = editingAttributes.interiorColor.alpha * 0.7; - editingAttributes.outlineColor.alpha = editingAttributes.outlineColor.alpha * 0.7; this._shape.highlightAttributes = editingAttributes; var shadowShape = this.activeEditorFragment.createShadowShape(this._shape); - shadowShape.highlightAttributes = new ShapeAttributes(this.originalHighlightAttributes); + + if (this.activeEditorFragment instanceof PlacemarkEditorFragment) { + shadowShape.altitudeMode = WorldWind.CLAMP_TO_GROUND; + shadowShape.highlightAttributes = new PlacemarkAttributes(this.originalHighlightAttributes); + } else { + shadowShape.highlightAttributes = new ShapeAttributes(this.originalHighlightAttributes); + } + shadowShape.highlighted = true; this.shadowShapeLayer.addRenderable(shadowShape); @@ -536,7 +561,11 @@ define([ ShapeEditor.prototype.endAction = function () { this.shadowShapeLayer.removeAllRenderables(); - this._shape.highlightAttributes = this.originalHighlightAttributes; + if (this.activeEditorFragment instanceof PlacemarkEditorFragment) { + this._shape.highlightAttributes = this.originalPlacemarkHighlightAttributes; + } else { + this._shape.highlightAttributes = this.originalHighlightAttributes; + } this.hideAnnotation(); From 7ff7a412fea47c5080d377b661cac909f46d7a90 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Fri, 5 Oct 2018 13:40:08 +0300 Subject: [PATCH 067/112] update example for placemark --- examples/ShapeEditor.html | 3 ++- examples/ShapeEditor.js | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/examples/ShapeEditor.html b/examples/ShapeEditor.html index 34c00d2d7..b1c644e89 100644 --- a/examples/ShapeEditor.html +++ b/examples/ShapeEditor.html @@ -35,10 +35,11 @@

Layers


-

Shape editing

+

Shape Editor

+ diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index 1941dc15b..cc4c43be0 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -117,6 +117,23 @@ requirejs(['./WorldWindShim', sectorShape.highlightAttributes = highlightAttributes; shapesLayer.addRenderable(sectorShape); + // Create a placemark. + var placemark = new WorldWind.Placemark(new WorldWind.Position(41, -95, 0), false, null); + placemark.altitudeMode = WorldWind.CLAMP_TO_GROUND; + + var placemarkAttributes = new WorldWind.PlacemarkAttributes(null); + placemarkAttributes.imageColor = WorldWind.Color.WHITE; + placemarkAttributes.imageScale = 20; + + var highlightPlacemarkAttributes = new WorldWind.PlacemarkAttributes(null); + highlightPlacemarkAttributes.imageColor = WorldWind.Color.RED; + highlightPlacemarkAttributes.imageScale = 20; + + placemark.attributes = placemarkAttributes; + placemark.highlightAttributes = highlightPlacemarkAttributes; + + shapesLayer.addRenderable(placemark); + wwd.goTo(new WorldWind.Position(40.42, -104.60, 2417000)); // Create a layer manager for controlling layer visibility. @@ -138,6 +155,13 @@ requirejs(['./WorldWindShim', } }); + document.getElementById("editPlacemarkBtn").addEventListener("click", function(){ + var shape = shapeEditor.stop(); + if (shape !== placemark) { + shapeEditor.edit(placemark); + } + }); + document.getElementById("editPolygonBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== polygonShape) { From c6bbd7b4595b92306bb5478a20fe34f5d0659e37 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Fri, 5 Oct 2018 13:46:55 +0300 Subject: [PATCH 068/112] add moveTo and getReferencePosition methods - used in Shape Editor --- src/shapes/Placemark.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/shapes/Placemark.js b/src/shapes/Placemark.js index 8d3c16da4..967b9ca0f 100644 --- a/src/shapes/Placemark.js +++ b/src/shapes/Placemark.js @@ -794,5 +794,15 @@ define([ && (!dc.pickingMode || this.enableLeaderLinePicking); }; + // Internal use only. Intentionally not documented. + Placemark.prototype.getReferencePosition = function () { + return this.position; + }; + + // Internal use only. Intentionally not documented. + Placemark.prototype.moveTo = function (globe, position) { + this.position = position; + }; + return Placemark; }); \ No newline at end of file From 376535c3413a9327b023cf35fe932d0b7ec22f62 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 15 Oct 2018 10:52:05 +0300 Subject: [PATCH 069/112] flags for move, reshape and rotate actions --- examples/ShapeEditor.js | 16 ++++---- src/util/editor/ShapeEditor.js | 70 +++++++++++++++++++++++++--------- 2 files changed, 61 insertions(+), 25 deletions(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index cc4c43be0..192e614ec 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -144,56 +144,56 @@ requirejs(['./WorldWindShim', document.getElementById("editCircleBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== circleShape) { - shapeEditor.edit(circleShape); + shapeEditor.edit(circleShape, true, true, true, true); } }); document.getElementById("editEllipseBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== ellipseShape) { - shapeEditor.edit(ellipseShape); + shapeEditor.edit(ellipseShape, false, true, false, true); } }); document.getElementById("editPlacemarkBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== placemark) { - shapeEditor.edit(placemark); + shapeEditor.edit(placemark, true, true, true, true); } }); document.getElementById("editPolygonBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== polygonShape) { - shapeEditor.edit(polygonShape); + shapeEditor.edit(polygonShape, true, false, true, true); } }); document.getElementById("editMultiPolygonBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== multiPolygonShape) { - shapeEditor.edit(multiPolygonShape); + shapeEditor.edit(multiPolygonShape, true, true, true, true); } }); document.getElementById("editPolylineBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== polylineShape) { - shapeEditor.edit(polylineShape); + shapeEditor.edit(polylineShape, true, true, true, true); } }); document.getElementById("editRectangleBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== rectangleShape) { - shapeEditor.edit(rectangleShape); + shapeEditor.edit(rectangleShape, true, false, false, true); } }); document.getElementById("editSectorBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== sectorShape) { - shapeEditor.edit(sectorShape); + shapeEditor.edit(sectorShape, true, true, true, true); } }); } diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 0aef6811d..2b7b0e031 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -105,6 +105,13 @@ define([ // Documented in defineProperties below. this._shape = null; + // Internal use only. + // Flags indicating whether the specific action is allowed or not. + this._allowMove = false; + this._allowReshape = false; + this._allowRotate = false; + this._allowManageControlPoint = false; + // Documented in defineProperties below. this._moveControlPointAttributes = new PlacemarkAttributes(null); this._moveControlPointAttributes.imageColor = WorldWind.Color.BLUE; @@ -298,12 +305,22 @@ define([ /** * Edits the specified shape. Currently, only surface shapes are supported. * @param {SurfaceShape} shape The shape to edit. + * @param {Boolean} move true to enable move action on shape, false to disable move action on shape. + * @param {Boolean} reshape true to enable reshape action on shape, false to disable reshape action on shape. + * @param {Boolean} rotate true to enable rotate action on shape, false to disable rotate action on shape. + * @param {Boolean} manageControlPoint true to enable the action to manage the control points of the shape, + * false to disable it. * @return {Boolean} true if the editor could start the edition of the specified shape; otherwise * false. */ - ShapeEditor.prototype.edit = function (shape) { + ShapeEditor.prototype.edit = function (shape, move, reshape, rotate, manageControlPoint) { this.stop(); + this._allowMove = move; + this._allowReshape = reshape; + this._allowRotate = rotate; + this._allowManageControlPoint = manageControlPoint; + // Look for a fragment that can handle the specified shape for (var i = 0, len = this.editorFragments.length; i < len; i++) { var editorFragment = this.editorFragments[i]; @@ -332,6 +349,11 @@ define([ this.activeEditorFragment = null; + this._allowMove = false; + this._allowReshape = false; + this._allowRotate = false; + this._allowManageControlPoint = false; + var currentShape = this._shape; this._shape = null; @@ -462,9 +484,19 @@ define([ if (terrainObject) { if (this.actionType === ShapeEditorConstants.DRAG) { - this.drag(event.clientX, event.clientY); + if (this._allowMove) { + this.drag(event.clientX, event.clientY); + } else { + Logger.logMessage(Logger.LEVEL_INFO, "ShapeEditor", "handleMouseMove", + "Disabled action for selected shape."); + } } else { - this.reshape(terrainObject.position); + if (this._allowReshape || this._allowRotate) { + this.reshape(terrainObject.position); + } else { + Logger.logMessage(Logger.LEVEL_INFO, "ShapeEditor", "handleMouseMove", + "Disabled action for selected shape."); + } } event.preventDefault(); @@ -515,12 +547,11 @@ define([ } else { this.actionType = ShapeEditorConstants.DRAG; } + this.actionControlPoint = controlPoint; this.actionControlPosition = initialPosition; this.actionSecondaryBehavior = alternateAction; - - var editingAttributes = null; // Place a shadow shape at the original location of the shape @@ -578,21 +609,26 @@ define([ // Internal use only. ShapeEditor.prototype.reshape = function (newPosition) { - this.activeEditorFragment.reshape( - this._shape, - this._worldWindow.globe, - this.actionControlPoint, - newPosition, - this.actionControlPosition, - this.actionSecondaryBehavior - ); + var purpose = this.actionControlPoint.userProperties.purpose; - this.actionControlPosition = newPosition; + if ((purpose === ShapeEditorConstants.ROTATION && this._allowRotate) || + (purpose !== ShapeEditorConstants.ROTATION) && this._allowReshape) { + this.activeEditorFragment.reshape( + this._shape, + this._worldWindow.globe, + this.actionControlPoint, + newPosition, + this.actionControlPosition, + this.actionSecondaryBehavior + ); - this.updateControlElements(); - this.updateAnnotation(this.actionControlPoint); + this.actionControlPosition = newPosition; - this._worldWindow.redraw(); + this.updateControlElements(); + this.updateAnnotation(this.actionControlPoint); + + this._worldWindow.redraw(); + } }; // Internal use only. From d7f9c99c47a0f2ca335302b34492fd5a3cfc2201 Mon Sep 17 00:00:00 2001 From: pdavidc Date: Tue, 16 Oct 2018 15:31:32 -0700 Subject: [PATCH 070/112] Initial update of npm devDependencies on Oct 16, 2018 --- package-lock.json | 7765 +++++++++++++++++++++++++-------------------- package.json | 22 +- 2 files changed, 4339 insertions(+), 3448 deletions(-) diff --git a/package-lock.json b/package-lock.json index 19ce880cd..d675902d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,18 +5,37 @@ "requires": true, "dependencies": { "abbrev": { - "version": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", - "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "dev": true, + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=", "dev": true }, "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" } }, "ansi-regex": { @@ -31,21 +50,31 @@ "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", "dev": true }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, "archiver": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/archiver/-/archiver-1.3.0.tgz", "integrity": "sha1-TyGU1tj5nfP1MeaIHxTxXVX6ryI=", "dev": true, "requires": { - "archiver-utils": "1.3.0", - "async": "2.5.0", - "buffer-crc32": "0.2.13", - "glob": "7.1.2", - "lodash": "4.17.4", - "readable-stream": "2.3.3", - "tar-stream": "1.5.4", - "walkdir": "0.0.11", - "zip-stream": "1.2.0" + "archiver-utils": "^1.3.0", + "async": "^2.0.0", + "buffer-crc32": "^0.2.1", + "glob": "^7.0.0", + "lodash": "^4.8.0", + "readable-stream": "^2.0.0", + "tar-stream": "^1.5.0", + "walkdir": "^0.0.11", + "zip-stream": "^1.1.0" }, "dependencies": { "isarray": { @@ -60,13 +89,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "isarray": "1.0.0", - "process-nextick-args": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "safe-buffer": { @@ -81,7 +110,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } } } @@ -92,12 +121,12 @@ "integrity": "sha1-5QtMCccL89aA4y/xt5lOn52JUXQ=", "dev": true, "requires": { - "glob": "7.1.2", - "graceful-fs": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "lazystream": "1.0.0", - "lodash": "4.17.4", - "normalize-path": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "readable-stream": "2.3.3" + "glob": "^7.0.0", + "graceful-fs": "^4.1.0", + "lazystream": "^1.0.0", + "lodash": "^4.8.0", + "normalize-path": "^2.0.0", + "readable-stream": "^2.0.0" }, "dependencies": { "isarray": { @@ -112,13 +141,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "isarray": "1.0.0", - "process-nextick-args": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "safe-buffer": { @@ -133,35 +162,237 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } } } }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + }, + "dependencies": { + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + } + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", "dev": true }, + "array-slice": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz", + "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "arraybuffer.slice": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==", + "dev": true + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, "async": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", "dev": true, "requires": { - "lodash": "4.17.4" + "lodash": "^4.14.0" } }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "dev": true + }, "babylon": { "version": "7.0.0-beta.19", "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.19.tgz", "integrity": "sha512-Vg0C9s/REX6/WIXN37UKpv5ZhRi6A4pjHlpkE34+8/a6c2W1Q692n3hmc+SZG5lKRnaExLUbxtJ1SVT+KaCQ/A==", "dev": true }, - "balanced-match": { - "version": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", - "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=", + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", + "dev": true + }, + "base64id": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", + "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "dev": true, + "requires": { + "callsite": "1.0.0" + } + }, + "binary-extensions": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.12.0.tgz", + "integrity": "sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==", "dev": true }, "bl": { @@ -170,7 +401,7 @@ "integrity": "sha1-ysMo977kVzDUBLaSID/LWQ4XLV4=", "dev": true, "requires": { - "readable-stream": "2.3.3" + "readable-stream": "^2.0.5" }, "dependencies": { "isarray": { @@ -185,13 +416,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "isarray": "1.0.0", - "process-nextick-args": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "safe-buffer": { @@ -206,32 +437,150 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" + } + } + } + }, + "blob": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", + "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=", + "dev": true + }, + "bluebird": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.2.tgz", + "integrity": "sha512-dhHTWMI7kMx5whMQntl7Vr9C6BvV10lFXDAasnqnrMYhXVCzzk6IO9Fo2L75jXHT07WrOngL1WDXOp+yYS91Yg==", + "dev": true + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "dev": true, + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" } } } }, - "brace-expansion": { - "version": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", - "integrity": "sha1-Pv/DxQ4ABTH7cg6v+A8K6O8jz1k=", + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", "dev": true, "requires": { - "balanced-match": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", - "concat-map": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" } }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, "buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", "dev": true }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "dev": true + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", + "dev": true + }, "camelcase": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", @@ -244,8 +593,23 @@ "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { - "camelcase": "2.1.1", - "map-obj": "1.0.1" + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "catharsis": { + "version": "0.8.9", + "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.9.tgz", + "integrity": "sha1-mMyJDKZS3S7w5ws3klMQ/56Q/Is=", + "dev": true, + "requires": { + "underscore-contrib": "~0.3.0" } }, "chalk": { @@ -254,11 +618,61 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "chokidar": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", + "integrity": "sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.0", + "braces": "^2.3.0", + "fsevents": "^1.2.2", + "glob-parent": "^3.1.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "lodash.debounce": "^4.0.8", + "normalize-path": "^2.1.1", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0", + "upath": "^1.0.5" + } + }, + "circular-json": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.7.tgz", + "integrity": "sha512-/pXoV1JA847qRKPrHbBK6YIBGFF8GOP4wzSgUOA7q0ew0vAv0iJswP+2/nZQ9uzA3Azi7eTrg9L2yzXc/7ZMIA==", + "dev": true + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } } }, "co": { @@ -267,6 +681,37 @@ "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", "dev": true }, + "coffeescript": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-1.10.0.tgz", + "integrity": "sha1-56qDAZF+9iGzXYo580jc3R234z4=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, "colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", @@ -279,19 +724,46 @@ "integrity": "sha1-RYwH4J4NkA/Ci3Cj/sLazR0st/Y=", "dev": true, "requires": { - "lodash": "4.17.4" + "lodash": "^4.5.0" + } + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" } }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=", + "dev": true + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", + "dev": true + }, "compress-commons": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-1.2.0.tgz", "integrity": "sha1-WFhwku8g03y1i68AARLJJ4/3O58=", "dev": true, "requires": { - "buffer-crc32": "0.2.13", - "crc32-stream": "2.0.0", - "normalize-path": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "readable-stream": "2.3.3" + "buffer-crc32": "^0.2.1", + "crc32-stream": "^2.0.0", + "normalize-path": "^2.0.0", + "readable-stream": "^2.0.0" }, "dependencies": { "isarray": { @@ -306,13 +778,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "isarray": "1.0.0", - "process-nextick-args": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "safe-buffer": { @@ -327,18 +799,62 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } } } }, - "concat-map": { - "version": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "connect": { + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/connect/-/connect-3.6.6.tgz", + "integrity": "sha1-Ce/2xVr3I24TcTWnJXSFi2eG9SQ=", + "dev": true, + "requires": { + "debug": "2.6.9", + "finalhandler": "1.1.0", + "parseurl": "~1.3.2", + "utils-merge": "1.0.1" + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", + "dev": true + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", "dev": true }, "core-util-is": { - "version": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, @@ -354,8 +870,8 @@ "integrity": "sha1-483TtN8xaN10494/u8t7KX/pCPQ=", "dev": true, "requires": { - "crc": "3.4.4", - "readable-stream": "2.3.3" + "crc": "^3.4.4", + "readable-stream": "^2.0.0" }, "dependencies": { "isarray": { @@ -370,13 +886,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "isarray": "1.0.0", - "process-nextick-args": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "safe-buffer": { @@ -391,19 +907,22 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } } } }, "cross-spawn": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", - "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "requires": { - "lru-cache": "4.1.1", - "which": "1.2.14" + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" } }, "currently-unhandled": { @@ -412,3637 +931,3062 @@ "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", "dev": true, "requires": { - "array-find-index": "1.0.2" + "array-find-index": "^1.0.1" } }, - "decamelize": { + "custom-event": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", + "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=", + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "date-format": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-1.2.0.tgz", + "integrity": "sha1-YV6CjiM90aubua4JUODOzPpuytg=", "dev": true }, - "end-of-stream": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.0.tgz", - "integrity": "sha1-epDYM+/abPpurA9JSduw+tOmMgY=", + "dateformat": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", + "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", "dev": true, "requires": { - "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + "get-stdin": "^4.0.1", + "meow": "^3.3.0" } }, - "engine.io": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.8.3.tgz", - "integrity": "sha1-jef5eJXSDTm4X4ju7nd7K9QrE9Q=", + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "requires": { - "accepts": "1.3.3", - "base64id": "1.0.0", - "cookie": "0.3.1", - "debug": "2.3.3", - "engine.io-parser": "1.3.2", - "ws": "1.1.2" + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" }, "dependencies": { - "accepts": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz", - "integrity": "sha1-w8p0NJOGSMPg2cHjKN1otiLChMo=", + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { - "mime-types": "2.1.17", - "negotiator": "0.6.1" + "kind-of": "^6.0.0" } }, - "after": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", - "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=", - "dev": true + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } }, - "arraybuffer.slice": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz", - "integrity": "sha1-8zshWfBTKj8xB6JywMz70a0peco=", - "dev": true - }, - "base64-arraybuffer": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", - "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", - "dev": true - }, - "base64id": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", - "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=", - "dev": true - }, - "blob": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", - "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=", - "dev": true - }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", - "dev": true - }, - "debug": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", - "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", - "dev": true, - "requires": { - "ms": "0.7.2" - } - }, - "engine.io-parser": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.3.2.tgz", - "integrity": "sha1-k3sHnwAH0Ik+xW1GyyILjLQ1Igo=", - "dev": true, - "requires": { - "after": "0.8.2", - "arraybuffer.slice": "0.0.6", - "base64-arraybuffer": "0.1.5", - "blob": "0.0.4", - "has-binary": "0.1.7", - "wtf-8": "1.0.0" - } - }, - "has-binary": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz", - "integrity": "sha1-aOYesWIQyVRaClzOBqhzkS/h5ow=", + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { - "isarray": "0.0.1" + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" } - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "mime-db": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", - "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", - "dev": true - }, - "mime-types": { - "version": "2.1.17", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", - "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, + "di": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", + "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", + "dev": true + }, + "dom-serialize": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz", + "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=", + "dev": true, + "requires": { + "custom-event": "~1.0.0", + "ent": "~2.2.0", + "extend": "^3.0.0", + "void-elements": "^2.0.0" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true + }, + "end-of-stream": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.0.tgz", + "integrity": "sha1-epDYM+/abPpurA9JSduw+tOmMgY=", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "engine.io": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.2.0.tgz", + "integrity": "sha512-mRbgmAtQ4GAlKwuPnnAvXXwdPhEx+jkc0OBCLrXuD/CRvwNK3AxRSnqK4FSqmAMRRHryVJP8TopOvmEaA64fKw==", + "dev": true, + "requires": { + "accepts": "~1.3.4", + "base64id": "1.0.0", + "cookie": "0.3.1", + "debug": "~3.1.0", + "engine.io-parser": "~2.1.0", + "ws": "~3.3.1" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { - "mime-db": "1.30.0" + "ms": "2.0.0" } - }, - "ms": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", - "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", - "dev": true - }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", - "dev": true - }, - "wtf-8": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wtf-8/-/wtf-8-1.0.0.tgz", - "integrity": "sha1-OS2LotDxw00e4tYw8V0O+2jhBIo=", - "dev": true } } }, "engine.io-client": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.8.3.tgz", - "integrity": "sha1-F5jtk0USRkU9TG9jXXogH+lA1as=", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.2.1.tgz", + "integrity": "sha512-y5AbkytWeM4jQr7m/koQLc5AxpRKC1hEVUb/s1FUAWEJq5AzJJ4NLvzuKPuxtDi5Mq755WuDvZ6Iv2rXj4PTzw==", "dev": true, "requires": { "component-emitter": "1.2.1", "component-inherit": "0.0.3", - "debug": "2.3.3", - "engine.io-parser": "1.3.2", + "debug": "~3.1.0", + "engine.io-parser": "~2.1.1", "has-cors": "1.1.0", "indexof": "0.0.1", - "parsejson": "0.0.3", "parseqs": "0.0.5", "parseuri": "0.0.5", - "ws": "1.1.2", - "xmlhttprequest-ssl": "1.5.3", + "ws": "~3.3.1", + "xmlhttprequest-ssl": "~1.5.4", "yeast": "0.1.2" }, "dependencies": { - "after": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", - "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=", - "dev": true - }, - "arraybuffer.slice": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz", - "integrity": "sha1-8zshWfBTKj8xB6JywMz70a0peco=", - "dev": true - }, - "base64-arraybuffer": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", - "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", - "dev": true - }, - "better-assert": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", - "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { - "callsite": "1.0.0" + "ms": "2.0.0" } - }, - "blob": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", - "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=", - "dev": true - }, - "callsite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", - "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", - "dev": true - }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true - }, - "component-inherit": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", - "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", + } + } + }, + "engine.io-parser": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.1.2.tgz", + "integrity": "sha512-dInLFzr80RijZ1rGpx1+56/uFoH7/7InhH3kZt+Ms6hT8tNx3NGW/WNSA/f8As1WkOfkuyb3tnRyuXGxusclMw==", + "dev": true, + "requires": { + "after": "0.8.2", + "arraybuffer.slice": "~0.0.7", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.4", + "has-binary2": "~1.0.2" + } + }, + "ent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", + "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", + "dev": true + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es6-promise": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz", + "integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg==", + "dev": true + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "eventemitter2": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", + "integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=", + "dev": true + }, + "eventemitter3": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==", + "dev": true + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "expand-braces": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/expand-braces/-/expand-braces-0.1.2.tgz", + "integrity": "sha1-SIsdHSRRyz06axks/AMPRMWFX+o=", + "dev": true, + "requires": { + "array-slice": "^0.2.3", + "array-unique": "^0.2.1", + "braces": "^0.1.2" + }, + "dependencies": { + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", "dev": true }, - "debug": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", - "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "braces": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-0.1.5.tgz", + "integrity": "sha1-wIVxEIUpHYt1/ddOqw+FlygHEeY=", "dev": true, "requires": { - "ms": "0.7.2" + "expand-range": "^0.1.0" } - }, - "engine.io-parser": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.3.2.tgz", - "integrity": "sha1-k3sHnwAH0Ik+xW1GyyILjLQ1Igo=", + } + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "after": "0.8.2", - "arraybuffer.slice": "0.0.6", - "base64-arraybuffer": "0.1.5", - "blob": "0.0.4", - "has-binary": "0.1.7", - "wtf-8": "1.0.0" + "is-descriptor": "^0.1.0" } }, - "has-binary": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz", - "integrity": "sha1-aOYesWIQyVRaClzOBqhzkS/h5ow=", + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "isarray": "0.0.1" + "is-extendable": "^0.1.0" } - }, - "has-cors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", - "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=", - "dev": true - }, - "indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", - "dev": true - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + } + } + }, + "expand-range": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-0.1.1.tgz", + "integrity": "sha1-TLjtoJk8pW+k9B/ELzy7TMrf8EQ=", + "dev": true, + "requires": { + "is-number": "^0.1.1", + "repeat-string": "^0.2.2" + }, + "dependencies": { + "is-number": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-0.1.1.tgz", + "integrity": "sha1-aaevEWlj1HIG7JvZtIoUIW8eOAY=", "dev": true }, - "ms": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", - "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "repeat-string": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-0.2.2.tgz", + "integrity": "sha1-x6jTI2BoNiBZp+RlH8aITosftK4=", "dev": true - }, - "parsejson": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/parsejson/-/parsejson-0.0.3.tgz", - "integrity": "sha1-q343WfIJ7OmUN5c/fQ8fZK4OZKs=", + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { - "better-assert": "1.0.2" + "is-plain-object": "^2.0.4" } - }, - "parseqs": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", - "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { - "better-assert": "1.0.2" + "is-descriptor": "^1.0.0" } }, - "parseuri": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", - "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "better-assert": "1.0.2" + "is-extendable": "^0.1.0" } }, - "wtf-8": { + "is-accessor-descriptor": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wtf-8/-/wtf-8-1.0.0.tgz", - "integrity": "sha1-OS2LotDxw00e4tYw8V0O+2jhBIo=", - "dev": true + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } }, - "xmlhttprequest-ssl": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz", - "integrity": "sha1-GFqIjATspGw+QHDZn3tJ3jUomS0=", - "dev": true + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } }, - "yeast": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", - "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=", - "dev": true + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } } } }, - "error-ex": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", - "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "extract-zip": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", + "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", "dev": true, "requires": { - "is-arrayish": "0.2.1" + "concat-stream": "1.6.2", + "debug": "2.6.9", + "mkdirp": "0.5.1", + "yauzl": "2.4.1" } }, - "escape-string-regexp": { - "version": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true }, - "eventemitter2": { - "version": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", - "integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=", + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, - "exit": { - "version": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "dev": true }, + "fd-slicer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", + "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "dev": true, + "requires": { + "pend": "~1.2.0" + } + }, "file-sync-cmp": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/file-sync-cmp/-/file-sync-cmp-0.1.1.tgz", "integrity": "sha1-peeo/7+kk7Q7kju9TKiaU7Y7YSs=", "dev": true }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", "dev": true, "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz" - } + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } }, - "fs-access": { - "version": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", - "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", + "finalhandler": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz", + "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", "dev": true, "requires": { - "null-check": "https://registry.npmjs.org/null-check/-/null-check-1.0.0.tgz" + "debug": "2.6.9", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", + "dev": true + } } }, - "fs.realpath": { - "version": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "findup-sync": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", + "integrity": "sha1-N5MKpdgWt3fANEXhlmzGeQpMCxY=", + "dev": true, + "requires": { + "glob": "~5.0.0" + }, + "dependencies": { + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "follow-redirects": { + "version": "1.5.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.9.tgz", + "integrity": "sha512-Bh65EZI/RU8nx0wbYF9shkFZlqLP+6WT/5FnA3cE/djNSuKNHJEinGGZgu/cQEkeeb2GdFOgenAmn8qaqYke2w==", + "dev": true, + "requires": { + "debug": "=3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", "dev": true }, - "getobject": { - "version": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", - "integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=", + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", "dev": true }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" }, "dependencies": { - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "inflight": { + "combined-stream": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "delayed-stream": "~1.0.0" } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + } + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fs-access": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", + "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", + "dev": true, + "requires": { + "null-check": "^1.0.0" + } + }, + "fs-extra": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", + "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "klaw": "^1.0.0" + }, + "dependencies": { + "klaw": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", + "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", "dev": true, "requires": { - "wrappy": "1.0.2" + "graceful-fs": "^4.1.9" } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true } } }, - "graceful-fs": { - "version": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "grunt": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.1.tgz", - "integrity": "sha1-6HeHZOlEsY8yuw8QuQeEdcnftWs=", - "dev": true, - "requires": { - "coffee-script": "1.10.0", - "dateformat": "1.0.12", - "eventemitter2": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", - "exit": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "findup-sync": "0.3.0", - "glob": "7.0.6", - "grunt-cli": "1.2.0", - "grunt-known-options": "1.1.0", - "grunt-legacy-log": "1.0.0", - "grunt-legacy-util": "1.0.0", - "iconv-lite": "0.4.18", - "js-yaml": "3.5.5", - "minimatch": "3.0.4", - "nopt": "3.0.6", - "path-is-absolute": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "rimraf": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz" + "fsevents": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "dev": true, + "optional": true, + "requires": { + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" }, "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, "ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "bundled": true, "dev": true }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true }, - "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, "dev": true, + "optional": true, "requires": { - "sprintf-js": "1.0.3" + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" } }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "balanced-match": { + "version": "1.0.0", + "bundled": true, "dev": true }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "brace-expansion": { + "version": "1.1.11", + "bundled": true, "dev": true, "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "coffee-script": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.10.0.tgz", - "integrity": "sha1-EpOLz5vhlI+gBvkuDEyegXBRCMA=", - "dev": true + "chownr": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "code-point-at": { + "version": "1.1.0", + "bundled": true, "dev": true }, - "dateformat": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", - "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", - "dev": true, - "requires": { - "get-stdin": "4.0.1", - "meow": "3.7.0" - } + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "console-control-strings": { + "version": "1.1.0", + "bundled": true, "dev": true }, - "findup-sync": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", - "integrity": "sha1-N5MKpdgWt3fANEXhlmzGeQpMCxY=", + "core-util-is": { + "version": "1.0.2", + "bundled": true, "dev": true, - "requires": { - "glob": "5.0.15" - }, - "dependencies": { - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "requires": { - "inflight": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "minimatch": "3.0.4", - "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "path-is-absolute": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" - } - } - } + "optional": true }, - "glob": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", - "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", + "debug": { + "version": "2.6.9", + "bundled": true, "dev": true, + "optional": true, "requires": { - "fs.realpath": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "inflight": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "minimatch": "3.0.4", - "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "path-is-absolute": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + "ms": "2.0.0" } }, - "grunt-cli": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz", - "integrity": "sha1-VisRnrsGndtGSs4oRVAb6Xs1tqg=", + "deep-extend": { + "version": "0.5.1", + "bundled": true, "dev": true, - "requires": { - "findup-sync": "0.3.0", - "grunt-known-options": "1.1.0", - "nopt": "3.0.6", - "resolve": "1.1.7" - } + "optional": true }, - "grunt-legacy-log": { + "delegates": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-1.0.0.tgz", - "integrity": "sha1-+4bxgJhHvAfcR4Q/ns1srLYt8tU=", + "bundled": true, "dev": true, - "requires": { - "colors": "1.1.2", - "grunt-legacy-log-utils": "1.0.0", - "hooker": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", - "lodash": "3.10.1", - "underscore.string": "3.2.3" - } + "optional": true }, - "grunt-legacy-log-utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-1.0.0.tgz", - "integrity": "sha1-p7ji0Ps1taUPSvmG/BEnSevJbz0=", + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, "dev": true, + "optional": true, "requires": { - "chalk": "1.1.3", - "lodash": "4.3.0" - }, - "dependencies": { - "lodash": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz", - "integrity": "sha1-79nEpuxT87BUEkKZFcPkgk5NJaQ=", - "dev": true - } + "minipass": "^2.2.1" } }, - "grunt-legacy-util": { + "fs.realpath": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-1.0.0.tgz", - "integrity": "sha1-OGqnjcbtUJhsKxiVcmWxtIq7m4Y=", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, "dev": true, + "optional": true, "requires": { - "async": "1.5.2", - "exit": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "getobject": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", - "hooker": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", - "lodash": "4.3.0", - "underscore.string": "3.2.3", - "which": "1.2.14" - }, - "dependencies": { - "lodash": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz", - "integrity": "sha1-79nEpuxT87BUEkKZFcPkgk5NJaQ=", - "dev": true - } + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" } }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "glob": { + "version": "7.1.2", + "bundled": true, "dev": true, + "optional": true, "requires": { - "ansi-regex": "2.1.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, - "iconv-lite": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz", - "integrity": "sha512-sr1ZQph3UwHTR0XftSbK85OvBbxe/abLGzEnPENCQwmHf7sck8Oyu4ob3LgBxWWxRoM+QszeUyl7jbqapu2TqA==", - "dev": true + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true }, - "js-yaml": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz", - "integrity": "sha1-A3fDgBfKvHMisNH7zSWkkWQfL74=", + "iconv-lite": { + "version": "0.4.21", + "bundled": true, "dev": true, + "optional": true, "requires": { - "argparse": "1.0.9", - "esprima": "2.7.3" + "safer-buffer": "^2.1.0" } }, - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "ignore-walk": { + "version": "3.0.1", + "bundled": true, "dev": true, + "optional": true, "requires": { - "brace-expansion": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz" + "minimatch": "^3.0.4" } }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "inflight": { + "version": "1.0.6", + "bundled": true, "dev": true, + "optional": true, "requires": { - "abbrev": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz" + "once": "^1.3.0", + "wrappy": "1" } }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "inherits": { + "version": "2.0.3", + "bundled": true, "dev": true }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "ini": { + "version": "1.3.5", + "bundled": true, "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, - "underscore.string": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.2.3.tgz", - "integrity": "sha1-gGmSYzZl1eX8tNsfs6hi62jp5to=", - "dev": true + "optional": true }, - "which": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", - "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, "dev": true, "requires": { - "isexe": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" + "number-is-nan": "^1.0.0" } - } - } - }, - "grunt-contrib-clean": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-clean/-/grunt-contrib-clean-1.1.0.tgz", - "integrity": "sha1-Vkq/LQN4qYOhW54/MO51tzjEBjg=", - "dev": true, - "requires": { - "async": "1.5.2", - "rimraf": "2.6.2" - }, - "dependencies": { - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "isarray": { + "version": "1.0.0", + "bundled": true, "dev": true, - "requires": { - "glob": "7.1.2" - } - } - } - }, - "grunt-contrib-compress": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/grunt-contrib-compress/-/grunt-contrib-compress-1.4.3.tgz", - "integrity": "sha1-Ac7/ucY39S5wgfRjdQmD0KOw+nM=", - "dev": true, - "requires": { - "archiver": "1.3.0", - "chalk": "1.1.3", - "iltorb": "1.3.5", - "lodash": "4.17.4", - "pretty-bytes": "4.0.2", - "stream-buffers": "2.2.0" - } - }, - "grunt-contrib-copy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-1.0.0.tgz", - "integrity": "sha1-cGDGWB6QS4qw0A8HbgqPbj58NXM=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "file-sync-cmp": "0.1.1" - } - }, - "grunt-contrib-requirejs": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-requirejs/-/grunt-contrib-requirejs-1.0.0.tgz", - "integrity": "sha1-7BZwyvwycTkC7lNWlFRxWy48utU=", - "dev": true, - "requires": { - "requirejs": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.3.tgz" - } - }, - "grunt-jsdoc": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/grunt-jsdoc/-/grunt-jsdoc-2.2.0.tgz", - "integrity": "sha512-3/HzvzcG7gxlm4YefR5ELbsUB/bIFCeX3CbUeAANKGMfNUZ2tDQ+Pp0YRb/VWHjyu+v8wG6n1PD8yIjubjEDeg==", - "dev": true, - "requires": { - "cross-spawn": "3.0.1", - "jsdoc": "3.5.5" - }, - "dependencies": { - "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", - "dev": true + "optional": true }, - "catharsis": { - "version": "0.8.9", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.9.tgz", - "integrity": "sha1-mMyJDKZS3S7w5ws3klMQ/56Q/Is=", + "minimatch": { + "version": "3.0.4", + "bundled": true, "dev": true, "requires": { - "underscore-contrib": "0.3.0" + "brace-expansion": "^1.1.7" } }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "minimist": { + "version": "0.0.8", + "bundled": true, "dev": true }, - "js2xmlparser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-3.0.0.tgz", - "integrity": "sha1-P7YOqgicVED5MZ9RdgzNB+JJlzM=", - "dev": true, - "requires": { - "xmlcreate": "1.0.2" - } - }, - "jsdoc": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.5.5.tgz", - "integrity": "sha512-6PxB65TAU4WO0Wzyr/4/YhlGovXl0EVYfpKbpSroSj0qBxT4/xod/l40Opkm38dRHRdQgdeY836M0uVnJQG7kg==", + "minipass": { + "version": "2.2.4", + "bundled": true, "dev": true, "requires": { - "babylon": "7.0.0-beta.19", - "bluebird": "3.5.1", - "catharsis": "0.8.9", - "escape-string-regexp": "1.0.5", - "js2xmlparser": "3.0.0", - "klaw": "2.0.0", - "marked": "0.3.6", - "mkdirp": "0.5.1", - "requizzle": "0.2.1", - "strip-json-comments": "2.0.1", - "taffydb": "2.6.2", - "underscore": "1.8.3" + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" } }, - "klaw": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-2.0.0.tgz", - "integrity": "sha1-WcEo4Nxc5BAgEVEZTuucv4WGUPY=", + "minizlib": { + "version": "1.1.0", + "bundled": true, "dev": true, + "optional": true, "requires": { - "graceful-fs": "4.1.11" + "minipass": "^2.2.1" } }, - "marked": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.6.tgz", - "integrity": "sha1-ssbGGPzOzk74bE/Gy4p8v1rtqNc=", - "dev": true - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "bundled": true, "dev": true, "requires": { "minimist": "0.0.8" } }, - "requizzle": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.1.tgz", - "integrity": "sha1-aUPDUwxNmn5G8c3dUcFY/GcM294=", + "ms": { + "version": "2.0.0", + "bundled": true, "dev": true, - "requires": { - "underscore": "1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } - } - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "taffydb": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", - "integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=", - "dev": true + "optional": true }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", - "dev": true + "nan": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz", + "integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA==", + "dev": true, + "optional": true }, - "underscore-contrib": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/underscore-contrib/-/underscore-contrib-0.3.0.tgz", - "integrity": "sha1-ZltmwkeD+PorGMn4y7Dix9SMJsc=", + "needle": { + "version": "2.2.0", + "bundled": true, "dev": true, + "optional": true, "requires": { - "underscore": "1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" } - } - } - }, - "grunt-karma": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/grunt-karma/-/grunt-karma-2.0.0.tgz", - "integrity": "sha1-dTWD0RXf3AVf5X5Y+W1rPH5hIRg=", - "dev": true, - "requires": { - "lodash": "3.10.1" - }, - "dependencies": { - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", - "dev": true - } - } - }, - "grunt-known-options": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.0.tgz", - "integrity": "sha1-pCdO6zL6dl2lp6OxcSYXzjsUQUk=", - "dev": true - }, - "har-schema": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", - "dev": true - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "hooker": { - "version": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", - "integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=", - "dev": true - }, - "hosted-git-info": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha1-bWDjSzq7yDEwYsO3mO+NkBoHrzw=", - "dev": true - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", - "dev": true - }, - "iltorb": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/iltorb/-/iltorb-1.3.5.tgz", - "integrity": "sha512-ICC02apBTK7ganmU9nEBiHGaeEnlUP0wsBfdyRqnZLaxjt2iRkPin/Pft7ig75gjwoAjtlwFrELqIp8UoAz0mw==", - "dev": true, - "optional": true, - "requires": { - "nan": "2.6.2", - "node-pre-gyp": "0.6.36" - }, - "dependencies": { - "abbrev": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true }, - "ajv": { - "version": "4.11.8", + "node-pre-gyp": { + "version": "0.10.0", "bundled": true, "dev": true, "optional": true, "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" } }, - "ansi-regex": { - "version": "2.1.1", + "nopt": { + "version": "4.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } }, - "aproba": { - "version": "1.1.2", + "npm-bundled": { + "version": "1.0.3", "bundled": true, "dev": true, "optional": true }, - "are-we-there-yet": { - "version": "1.1.4", + "npm-packlist": { + "version": "1.1.10", "bundled": true, "dev": true, "optional": true, "requires": { - "delegates": "1.0.0", - "readable-stream": "2.3.1" + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" } }, - "asn1": { - "version": "0.2.3", + "npmlog": { + "version": "4.1.2", "bundled": true, "dev": true, - "optional": true + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } }, - "assert-plus": { - "version": "1.0.0", + "number-is-nan": { + "version": "1.0.1", "bundled": true, "dev": true }, - "asynckit": { - "version": "0.4.0", + "object-assign": { + "version": "4.1.1", "bundled": true, "dev": true, "optional": true }, - "aws-sign2": { - "version": "0.6.0", + "once": { + "version": "1.4.0", "bundled": true, "dev": true, - "optional": true + "requires": { + "wrappy": "1" + } }, - "aws4": { - "version": "1.6.0", + "os-homedir": { + "version": "1.0.2", "bundled": true, "dev": true, "optional": true }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "tweetnacl": "0.14.5" - } - }, - "block-stream": { - "version": "0.0.9", - "bundled": true, - "dev": true, - "requires": { - "inherits": "2.0.3" - } - }, - "boom": { - "version": "2.10.1", + "os-tmpdir": { + "version": "1.0.2", "bundled": true, "dev": true, - "requires": { - "hoek": "2.16.3" - } + "optional": true }, - "brace-expansion": { - "version": "1.1.8", + "osenv": { + "version": "0.1.5", "bundled": true, "dev": true, + "optional": true, "requires": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, - "caseless": { - "version": "0.12.0", + "path-is-absolute": { + "version": "1.0.1", "bundled": true, "dev": true, "optional": true }, - "co": { - "version": "4.6.0", + "process-nextick-args": { + "version": "2.0.0", "bundled": true, "dev": true, "optional": true }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "combined-stream": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "requires": { - "delayed-stream": "1.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "cryptiles": { - "version": "2.0.5", + "rc": { + "version": "1.2.7", "bundled": true, "dev": true, "optional": true, "requires": { - "boom": "2.10.1" + "deep-extend": "^0.5.1", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } } }, - "dashdash": { - "version": "1.14.1", + "readable-stream": { + "version": "2.3.6", "bundled": true, "dev": true, "optional": true, "requires": { - "assert-plus": "1.0.0" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "debug": { - "version": "2.6.0", + "rimraf": { + "version": "2.6.2", "bundled": true, "dev": true, "optional": true, "requires": { - "ms": "0.7.2" + "glob": "^7.0.5" } }, - "deep-extend": { - "version": "0.4.2", - "bundled": true, - "dev": true, - "optional": true - }, - "delayed-stream": { - "version": "1.0.0", + "safe-buffer": { + "version": "5.1.1", "bundled": true, "dev": true }, - "delegates": { - "version": "1.0.0", + "safer-buffer": { + "version": "2.1.2", "bundled": true, "dev": true, "optional": true }, - "ecc-jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsbn": "0.1.1" - } - }, - "extend": { - "version": "3.0.1", + "sax": { + "version": "1.2.4", "bundled": true, "dev": true, "optional": true }, - "extsprintf": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "forever-agent": { - "version": "0.6.1", + "semver": { + "version": "5.5.0", "bundled": true, "dev": true, "optional": true }, - "form-data": { - "version": "2.1.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.15" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "fstream": { - "version": "1.0.11", + "set-blocking": { + "version": "2.0.0", "bundled": true, "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.6.1" - } + "optional": true }, - "fstream-ignore": { - "version": "1.0.5", + "signal-exit": { + "version": "3.0.2", "bundled": true, "dev": true, - "optional": true, - "requires": { - "fstream": "1.0.11", - "inherits": "2.0.3", - "minimatch": "3.0.4" - } + "optional": true }, - "gauge": { - "version": "2.7.4", + "string-width": { + "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { - "aproba": "1.1.2", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, - "getpass": { - "version": "0.1.7", + "string_decoder": { + "version": "1.1.1", "bundled": true, "dev": true, "optional": true, "requires": { - "assert-plus": "1.0.0" + "safe-buffer": "~5.1.0" } }, - "glob": { - "version": "7.1.1", + "strip-ansi": { + "version": "3.0.1", "bundled": true, "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "ansi-regex": "^2.0.0" } }, - "graceful-fs": { - "version": "4.1.11", - "bundled": true, - "dev": true - }, - "har-schema": { - "version": "1.0.5", + "strip-json-comments": { + "version": "2.0.1", "bundled": true, "dev": true, "optional": true }, - "har-validator": { - "version": "4.2.1", + "tar": { + "version": "4.4.1", "bundled": true, "dev": true, "optional": true, "requires": { - "ajv": "4.11.8", - "har-schema": "1.0.5" + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1", + "yallist": "^3.0.2" } }, - "has-unicode": { - "version": "2.0.1", + "util-deprecate": { + "version": "1.0.2", "bundled": true, "dev": true, "optional": true }, - "hawk": { - "version": "3.1.3", + "wide-align": { + "version": "1.1.2", "bundled": true, "dev": true, "optional": true, "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" + "string-width": "^1.0.2" } }, - "hoek": { - "version": "2.16.3", + "wrappy": { + "version": "1.0.2", "bundled": true, "dev": true }, - "http-signature": { - "version": "1.1.1", + "yallist": { + "version": "3.0.2", "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.0", - "sshpk": "1.13.1" - }, - "dependencies": { - "assert-plus": { - "version": "0.2.0", - "bundled": true, - "dev": true, - "optional": true - } - } + "dev": true + } + } + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getobject": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", + "integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { "version": "2.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, - "ini": { - "version": "1.3.4", - "bundled": true, - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "wrappy": "1" } }, - "is-typedarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "isarray": { - "version": "1.0.0", - "bundled": true, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "isstream": { - "version": "0.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "bundled": true, - "dev": true, - "optional": true - }, - "json-stable-stringify": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsonify": "0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "jsonify": { - "version": "0.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "jsprim": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.0.2", - "json-schema": "0.2.3", - "verror": "1.3.6" - } - }, - "mime-db": { - "version": "1.27.0", - "bundled": true, - "dev": true - }, - "mime-types": { - "version": "2.1.15", - "bundled": true, - "dev": true, - "requires": { - "mime-db": "1.27.0" - } - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "1.1.8" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "0.7.2", - "bundled": true, - "dev": true, - "optional": true - }, - "node-pre-gyp": { - "version": "0.6.36", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "mkdirp": "0.5.1", - "nopt": "4.0.1", - "npmlog": "4.1.0", - "rc": "1.2.1", - "request": "2.81.0", - "rimraf": "2.6.1", - "semver": "5.3.0", - "tar": "2.2.1", - "tar-pack": "3.4.0" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "abbrev": "1.1.0", - "osenv": "0.1.4" - } - }, - "npmlog": { - "version": "4.1.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "oauth-sign": { - "version": "0.8.2", - "bundled": true, - "dev": true, - "optional": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "wrappy": "1.0.2" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "performance-now": { - "version": "0.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "1.0.7", - "bundled": true, - "dev": true - }, - "qs": { - "version": "6.4.0", - "bundled": true, - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "deep-extend": "0.4.2", - "ini": "1.3.4", - "minimist": "1.2.0", - "strip-json-comments": "2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.3.1", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.2", - "util-deprecate": "1.0.2" - } - }, - "request": { - "version": "2.81.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "4.2.1", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.15", - "oauth-sign": "0.8.2", - "performance-now": "0.2.0", - "qs": "6.4.0", - "safe-buffer": "5.1.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.2", - "tunnel-agent": "0.6.0", - "uuid": "3.0.1" - } - }, - "rimraf": { - "version": "2.6.1", - "bundled": true, - "dev": true, - "requires": { - "glob": "7.1.1" - } - }, - "safe-buffer": { - "version": "5.1.1", - "bundled": true, - "dev": true - }, - "semver": { - "version": "5.3.0", - "bundled": true, - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "sntp": { - "version": "1.0.9", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "hoek": "2.16.3" - } - }, - "sshpk": { - "version": "1.13.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" - } - }, - "string_decoder": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "5.0.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.0.1", - "bundled": true, - "dev": true - } - } - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - }, - "stringstream": { - "version": "0.0.5", - "bundled": true, - "dev": true, - "optional": true - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "tar": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" - } - }, - "tar-pack": { - "version": "3.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "2.6.0", - "fstream": "1.0.11", - "fstream-ignore": "1.0.5", - "once": "1.4.0", - "readable-stream": "2.3.1", - "rimraf": "2.6.1", - "tar": "2.2.1", - "uid-number": "0.0.6" - } - }, - "tough-cookie": { - "version": "2.3.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "punycode": "1.4.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "tunnel-agent": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "bundled": true, - "dev": true, - "optional": true - }, - "uid-number": { - "version": "0.0.6", - "bundled": true, - "dev": true, - "optional": true - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "uuid": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "verror": { - "version": "1.3.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "extsprintf": "1.0.2" - } - }, - "wide-align": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "string-width": "1.0.2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true - } - } - }, - "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "dev": true, - "requires": { - "repeating": "2.0.1" - } - }, - "inflight": { - "version": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "wrappy": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" - } - }, - "inherits": { - "version": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "1.1.1" - } - }, - "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, - "isexe": { - "version": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "jasmine-core": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.8.0.tgz", - "integrity": "sha1-vMl5rh+f0FcB5F5S5l06XWPxok4=", - "dev": true - }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "requires": { - "jsonify": "0.0.0" - } - }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true - }, - "karma": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/karma/-/karma-1.7.1.tgz", - "integrity": "sha512-k5pBjHDhmkdaUccnC7gE3mBzZjcxyxYsYVaqiL2G5AqlfLyBO5nw2VdNK+O16cveEPd/gIOWULH7gkiYYwVNHg==", - "dev": true, - "requires": { - "bluebird": "3.5.1", - "body-parser": "1.18.2", - "chokidar": "1.7.0", - "colors": "1.1.2", - "combine-lists": "1.0.1", - "connect": "3.6.5", - "core-js": "2.5.1", - "di": "0.0.1", - "dom-serialize": "2.2.1", - "expand-braces": "0.1.2", - "glob": "7.1.2", - "graceful-fs": "4.1.11", - "http-proxy": "1.16.2", - "isbinaryfile": "3.0.2", - "lodash": "3.10.1", - "log4js": "0.6.38", - "mime": "1.4.1", - "minimatch": "3.0.4", - "optimist": "0.6.1", - "qjobs": "1.1.5", - "range-parser": "1.2.0", - "rimraf": "2.6.2", - "safe-buffer": "5.1.1", - "socket.io": "1.7.3", - "source-map": "0.5.7", - "tmp": "0.0.31", - "useragent": "2.2.1" - }, - "dependencies": { - "anymatch": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", - "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", - "dev": true, - "requires": { - "micromatch": "2.3.11", - "normalize-path": "2.1.1" - } - }, - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true, - "requires": { - "arr-flatten": "1.1.0" - } - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "array-slice": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz", - "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", - "dev": true - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", - "dev": true - }, - "async-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", - "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", - "dev": true - }, - "binary-extensions": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.10.0.tgz", - "integrity": "sha1-muuabF6IY4qtFx4Wf1kAq+JINdA=", - "dev": true - }, - "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", - "dev": true - }, - "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "dev": true, - "requires": { - "bytes": "3.0.0", - "content-type": "1.0.4", - "debug": "2.6.9", - "depd": "1.1.1", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "1.6.15" - } - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true, - "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.2" - } - }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", - "dev": true - }, - "chokidar": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", - "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", - "dev": true, - "requires": { - "anymatch": "1.3.2", - "async-each": "1.0.1", - "glob-parent": "2.0.0", - "inherits": "2.0.3", - "is-binary-path": "1.0.1", - "is-glob": "2.0.1", - "path-is-absolute": "1.0.1", - "readdirp": "2.1.0" - } - }, - "connect": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/connect/-/connect-3.6.5.tgz", - "integrity": "sha1-+43ee6B2OHfQ7J352sC0tA5yx9o=", - "dev": true, - "requires": { - "debug": "2.6.9", - "finalhandler": "1.0.6", - "parseurl": "1.3.2", - "utils-merge": "1.0.1" - } - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "dev": true - }, - "core-js": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", - "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "custom-event": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", - "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=", - "dev": true - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=", - "dev": true - }, - "di": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", - "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", - "dev": true - }, - "dom-serialize": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz", - "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=", - "dev": true, - "requires": { - "custom-event": "1.0.1", - "ent": "2.2.0", - "extend": "3.0.1", - "void-elements": "2.0.1" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", - "dev": true - }, - "encodeurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz", - "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=", - "dev": true - }, - "ent": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", - "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", - "dev": true - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", - "dev": true - }, - "eventemitter3": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz", - "integrity": "sha1-HIaZHYFq0eUEdQ5zh0Ik7PO+xQg=", - "dev": true - }, - "expand-braces": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/expand-braces/-/expand-braces-0.1.2.tgz", - "integrity": "sha1-SIsdHSRRyz06axks/AMPRMWFX+o=", - "dev": true, - "requires": { - "array-slice": "0.2.3", - "array-unique": "0.2.1", - "braces": "0.1.5" - }, - "dependencies": { - "braces": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-0.1.5.tgz", - "integrity": "sha1-wIVxEIUpHYt1/ddOqw+FlygHEeY=", - "dev": true, - "requires": { - "expand-range": "0.1.1" - } - }, - "expand-range": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-0.1.1.tgz", - "integrity": "sha1-TLjtoJk8pW+k9B/ELzy7TMrf8EQ=", - "dev": true, - "requires": { - "is-number": "0.1.1", - "repeat-string": "0.2.2" - } - }, - "is-number": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-0.1.1.tgz", - "integrity": "sha1-aaevEWlj1HIG7JvZtIoUIW8eOAY=", - "dev": true - }, - "repeat-string": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-0.2.2.tgz", - "integrity": "sha1-x6jTI2BoNiBZp+RlH8aITosftK4=", - "dev": true - } - } - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true, - "requires": { - "is-posix-bracket": "0.1.1" - } - }, - "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", - "dev": true, - "requires": { - "fill-range": "2.2.3" - } - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", - "dev": true - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true - }, - "fill-range": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", - "dev": true, - "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "1.1.7", - "repeat-element": "1.1.2", - "repeat-string": "1.6.1" - } - }, - "finalhandler": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.6.tgz", - "integrity": "sha1-AHrqM9Gk0+QgF/YkhIrVjSEvgU8=", - "dev": true, - "requires": { - "debug": "2.6.9", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "statuses": "1.3.1", - "unpipe": "1.0.0" - }, - "dependencies": { - "statuses": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", - "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", - "dev": true - } - } - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", - "dev": true, - "requires": { - "for-in": "1.0.2" - } - }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", - "dev": true, - "requires": { - "glob-parent": "2.0.0", - "is-glob": "2.0.1" - } - }, - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true, - "requires": { - "is-glob": "2.0.1" - } - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "dev": true, - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": "1.4.0" - } - }, - "http-proxy": { - "version": "1.16.2", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.16.2.tgz", - "integrity": "sha1-Bt/ykpUr9k2+hHH6nfcwZtTzd0I=", - "dev": true, - "requires": { - "eventemitter3": "1.2.0", - "requires-port": "1.0.0" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", - "dev": true, - "requires": { - "binary-extensions": "1.10.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", - "dev": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", - "dev": true, - "requires": { - "is-primitive": "2.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - }, - "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - } - }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isbinaryfile": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.2.tgz", - "integrity": "sha1-Sj6XTsDLqQBNP8bN5yCeppNopiE=", - "dev": true - }, - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - }, - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", - "dev": true - }, - "log4js": { - "version": "0.6.38", - "resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz", - "integrity": "sha1-LElBFmldb7JUgJQ9P8hy5mKlIv0=", - "dev": true, - "requires": { - "readable-stream": "1.0.34", - "semver": "4.3.6" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - } - } - }, - "lru-cache": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.2.4.tgz", - "integrity": "sha1-bGWGGb7PFAMdDQtZSxYELOTcBj0=", - "dev": true - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", - "dev": true - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.1", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.2", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.4" - } - }, - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==", - "dev": true - }, - "mime-db": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", - "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", - "dev": true - }, - "mime-types": { - "version": "2.1.17", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", - "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", - "dev": true, - "requires": { - "mime-db": "1.30.0" - } - }, - "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", - "dev": true - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "1.1.0" - } - }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", - "dev": true, - "requires": { - "for-own": "0.1.5", - "is-extendable": "0.1.1" - } - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "dev": true, - "requires": { - "ee-first": "1.1.1" - } - }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "requires": { - "minimist": "0.0.10", - "wordwrap": "0.0.3" - } - }, - "os-tmpdir": { + "wrappy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", - "dev": true, - "requires": { - "glob-base": "0.3.0", - "is-dotfile": "1.0.3", - "is-extglob": "1.0.0", - "is-glob": "2.0.1" - } - }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", - "dev": true - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true - }, - "randomatic": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", - "dev": true, - "requires": { - "is-number": "3.0.0", - "kind-of": "4.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + } + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" + "is-extglob": "^2.1.0" } - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + } + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "grunt": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.3.tgz", + "integrity": "sha512-/JzmZNPfKorlCrrmxWqQO4JVodO+DVd5XX4DkocL/1WlLlKVLE9+SdEIempOAxDhWPysLle6afvn/hg7Ck2k9g==", + "dev": true, + "requires": { + "coffeescript": "~1.10.0", + "dateformat": "~1.0.12", + "eventemitter2": "~0.4.13", + "exit": "~0.1.1", + "findup-sync": "~0.3.0", + "glob": "~7.0.0", + "grunt-cli": "~1.2.0", + "grunt-known-options": "~1.1.0", + "grunt-legacy-log": "~2.0.0", + "grunt-legacy-util": "~1.1.1", + "iconv-lite": "~0.4.13", + "js-yaml": "~3.5.2", + "minimatch": "~3.0.2", + "mkdirp": "~0.5.1", + "nopt": "~3.0.6", + "path-is-absolute": "~1.0.0", + "rimraf": "~2.6.2" + }, + "dependencies": { + "glob": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", + "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, - "readdirp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", - "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "grunt-cli": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz", + "integrity": "sha1-VisRnrsGndtGSs4oRVAb6Xs1tqg=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "minimatch": "3.0.4", - "readable-stream": "2.3.3", - "set-immediate-shim": "1.0.1" + "findup-sync": "~0.3.0", + "grunt-known-options": "~1.1.0", + "nopt": "~3.0.6", + "resolve": "~1.1.0" } - }, - "regex-cache": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + } + } + }, + "grunt-contrib-clean": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/grunt-contrib-clean/-/grunt-contrib-clean-2.0.0.tgz", + "integrity": "sha512-g5ZD3ORk6gMa5ugZosLDQl3dZO7cI3R14U75hTM+dVLVxdMNJCPVmwf9OUt4v4eWgpKKWWoVK9DZc1amJp4nQw==", + "dev": true, + "requires": { + "async": "^2.6.1", + "rimraf": "^2.6.2" + }, + "dependencies": { + "async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", "dev": true, "requires": { - "is-equal-shallow": "0.1.3" + "lodash": "^4.17.10" } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, - "repeat-element": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", - "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + } + } + }, + "grunt-contrib-compress": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/grunt-contrib-compress/-/grunt-contrib-compress-1.4.3.tgz", + "integrity": "sha1-Ac7/ucY39S5wgfRjdQmD0KOw+nM=", + "dev": true, + "requires": { + "archiver": "^1.3.0", + "chalk": "^1.1.1", + "iltorb": "^1.0.13", + "lodash": "^4.7.0", + "pretty-bytes": "^4.0.2", + "stream-buffers": "^2.1.0" + } + }, + "grunt-contrib-copy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-1.0.0.tgz", + "integrity": "sha1-cGDGWB6QS4qw0A8HbgqPbj58NXM=", + "dev": true, + "requires": { + "chalk": "^1.1.1", + "file-sync-cmp": "^0.1.0" + } + }, + "grunt-contrib-requirejs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/grunt-contrib-requirejs/-/grunt-contrib-requirejs-1.0.0.tgz", + "integrity": "sha1-7BZwyvwycTkC7lNWlFRxWy48utU=", + "dev": true, + "requires": { + "requirejs": "^2.1.0" + } + }, + "grunt-jsdoc": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/grunt-jsdoc/-/grunt-jsdoc-2.3.0.tgz", + "integrity": "sha512-gC66TCRXeQMj3HIyqVSBJm8zdUz43e5vaG/PLO/627A1edbJnzxhJV7nF0KqLwMM0RDNu1istC6fvfnYqFKi3w==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.5", + "jsdoc": "~3.5.5", + "marked": "^0.5.0" + } + }, + "grunt-karma": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/grunt-karma/-/grunt-karma-3.0.0.tgz", + "integrity": "sha512-E111KL3o5v2aoc4w0CkCSdd/MzA3sB7xHeUw5b/hRW3LwRgJWUrsP8BTX3nsOshi1yHhws1st9jFSKHYI2bY+g==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + }, + "grunt-known-options": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.1.tgz", + "integrity": "sha512-cHwsLqoighpu7TuYj5RonnEuxGVFnztcUqTqp5rXFGYL4OuPFofwC4Ycg7n9fYwvK6F5WbYgeVOwph9Crs2fsQ==", + "dev": true + }, + "grunt-legacy-log": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-2.0.0.tgz", + "integrity": "sha512-1m3+5QvDYfR1ltr8hjiaiNjddxGdQWcH0rw1iKKiQnF0+xtgTazirSTGu68RchPyh1OBng1bBUjLmX8q9NpoCw==", + "dev": true, + "requires": { + "colors": "~1.1.2", + "grunt-legacy-log-utils": "~2.0.0", + "hooker": "~0.2.3", + "lodash": "~4.17.5" + }, + "dependencies": { + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "dev": true - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + } + } + }, + "grunt-legacy-log-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.0.1.tgz", + "integrity": "sha512-o7uHyO/J+i2tXG8r2bZNlVk20vlIFJ9IEYyHMCQGfWYru8Jv3wTqKZzvV30YW9rWEjq0eP3cflQ1qWojIe9VFA==", + "dev": true, + "requires": { + "chalk": "~2.4.1", + "lodash": "~4.17.10" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { - "glob": "7.1.2" + "color-convert": "^1.9.0" } }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "semver": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", - "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", - "dev": true - }, - "set-immediate-shim": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", - "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", - "dev": true - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", - "dev": true - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, - "tmp": { - "version": "0.0.31", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz", - "integrity": "sha1-jzirlDjhcxXl29izZX6L+yd65Kc=", - "dev": true, - "requires": { - "os-tmpdir": "1.0.2" - } + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true }, - "type-is": { - "version": "1.6.15", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", - "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { - "media-typer": "0.3.0", - "mime-types": "2.1.17" + "has-flag": "^3.0.0" } + } + } + }, + "grunt-legacy-util": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-1.1.1.tgz", + "integrity": "sha512-9zyA29w/fBe6BIfjGENndwoe1Uy31BIXxTH3s8mga0Z5Bz2Sp4UCjkeyv2tI449ymkx3x26B+46FV4fXEddl5A==", + "dev": true, + "requires": { + "async": "~1.5.2", + "exit": "~0.1.1", + "getobject": "~0.1.0", + "hooker": "~0.2.3", + "lodash": "~4.17.10", + "underscore.string": "~3.3.4", + "which": "~1.3.0" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "dev": true }, - "useragent": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/useragent/-/useragent-2.2.1.tgz", - "integrity": "sha1-z1k+9PLRdYdei7ZY6pLhik/QbY4=", + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { - "lru-cache": "2.2.4", - "tmp": "0.0.31" + "isexe": "^2.0.0" } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", - "dev": true - }, - "void-elements": { + } + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "dev": true, + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-binary2": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", + "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", + "dev": true, + "requires": { + "isarray": "2.0.1" + }, + "dependencies": { + "isarray": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", - "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", - "dev": true - }, - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", "dev": true } } }, - "karma-chrome-launcher": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", - "integrity": "sha1-zxudBxNswY/iOTJ9JGVMPbw2is8=", + "has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", "dev": true, "requires": { - "fs-access": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", - "which": "1.2.14" + "is-number": "^3.0.0", + "kind-of": "^4.0.0" }, "dependencies": { - "which": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", - "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "isexe": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" + "is-buffer": "^1.1.5" } } } }, - "karma-htmlfile-reporter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/karma-htmlfile-reporter/-/karma-htmlfile-reporter-0.3.5.tgz", - "integrity": "sha1-CavKmRCj6x27onqadmAmlIyWygQ=", + "hasha": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", + "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=", "dev": true, "requires": { - "xmlbuilder": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-3.1.0.tgz" + "is-stream": "^1.0.1", + "pinkie-promise": "^2.0.0" } }, - "karma-jasmine": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-1.1.0.tgz", - "integrity": "sha1-IuTAa/mhguUpTR9wXjczgRuBCs8=", + "hooker": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", + "integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=", "dev": true }, - "karma-junit-reporter": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/karma-junit-reporter/-/karma-junit-reporter-1.2.0.tgz", - "integrity": "sha1-T5xAzt+xo5X4rvh2q/lhiZF8Y5Y=", + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "dev": true, "requires": { - "path-is-absolute": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "xmlbuilder": "8.2.2" - }, - "dependencies": { - "xmlbuilder": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-8.2.2.tgz", - "integrity": "sha1-aSSGc0ELS6QuGmE2VR0pIjNap3M=", - "dev": true - } + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-proxy": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", + "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", + "dev": true, + "requires": { + "eventemitter3": "^3.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, - "karma-phantomjs-launcher": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/karma-phantomjs-launcher/-/karma-phantomjs-launcher-1.0.4.tgz", - "integrity": "sha1-0jyjSAG9qYY60xjju0vUBisTrNI=", + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "dev": true + }, + "iltorb": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/iltorb/-/iltorb-1.3.5.tgz", + "integrity": "sha512-ICC02apBTK7ganmU9nEBiHGaeEnlUP0wsBfdyRqnZLaxjt2iRkPin/Pft7ig75gjwoAjtlwFrELqIp8UoAz0mw==", "dev": true, + "optional": true, "requires": { - "lodash": "4.17.4", - "phantomjs-prebuilt": "2.1.15" + "nan": "^2.6.1", + "node-pre-gyp": "^0.6.34" }, "dependencies": { + "abbrev": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "ajv": { + "version": "4.11.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" + } + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, "asn1": { "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true + "bundled": true, + "dev": true, + "optional": true }, "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "version": "1.0.0", + "bundled": true, "dev": true }, "asynckit": { "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true + "bundled": true, + "dev": true, + "optional": true }, "aws-sign2": { "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", - "dev": true + "bundled": true, + "dev": true, + "optional": true }, "aws4": { "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", + "bundled": true, + "dev": true, + "optional": true + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, "dev": true }, "bcrypt-pbkdf": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "bundled": true, "dev": true, "optional": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" + } + }, + "block-stream": { + "version": "0.0.9", + "bundled": true, + "dev": true, + "requires": { + "inherits": "~2.0.0" } }, "boom": { "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.x.x" + } + }, + "brace-expansion": { + "version": "1.1.8", + "bundled": true, "dev": true, "requires": { - "hoek": "2.16.3" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, "caseless": { "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "bundled": true, + "dev": true, + "optional": true + }, + "co": { + "version": "4.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, "dev": true }, "combined-stream": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "bundled": true, "dev": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, - "concat-stream": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", - "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "typedarray": "0.0.6" - } + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true }, "core-util-is": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "bundled": true, "dev": true }, "cryptiles": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "bundled": true, "dev": true, + "optional": true, "requires": { - "boom": "2.10.1" + "boom": "2.x.x" } }, "dashdash": { "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "bundled": true, "dev": true, + "optional": true, "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } + "assert-plus": "^1.0.0" } }, "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", + "version": "2.6.0", + "bundled": true, "dev": true, + "optional": true, "requires": { - "ms": "0.7.1" + "ms": "0.7.2" } }, + "deep-extend": { + "version": "0.4.2", + "bundled": true, + "dev": true, + "optional": true + }, "delayed-stream": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "bundled": true, "dev": true }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, "ecc-jsbn": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "bundled": true, "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "~0.1.0" } }, - "es6-promise": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz", - "integrity": "sha1-eILzCt3lskDM+n99eMVIMwlRrkI=", - "dev": true - }, "extend": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "bundled": true, + "dev": true, + "optional": true + }, + "extsprintf": { + "version": "1.0.2", + "bundled": true, "dev": true }, - "extract-zip": { - "version": "1.6.5", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.5.tgz", - "integrity": "sha1-maBnNbbqIOqbcF13ms/8yHz/BEA=", + "forever-agent": { + "version": "0.6.1", + "bundled": true, + "dev": true, + "optional": true + }, + "form-data": { + "version": "2.1.4", + "bundled": true, "dev": true, + "optional": true, "requires": { - "concat-stream": "1.6.0", - "debug": "2.2.0", - "mkdirp": "0.5.0", - "yauzl": "2.4.1" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" } }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "fs.realpath": { + "version": "1.0.0", + "bundled": true, "dev": true }, - "fd-slicer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", - "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "fstream": { + "version": "1.0.11", + "bundled": true, "dev": true, "requires": { - "pend": "1.2.0" + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" } }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "fstream-ignore": { + "version": "1.0.5", + "bundled": true, "dev": true, + "optional": true, "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.17" + "fstream": "^1.0.0", + "inherits": "2", + "minimatch": "^3.0.0" } }, - "fs-extra": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", - "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", + "gauge": { + "version": "2.7.4", + "bundled": true, "dev": true, + "optional": true, "requires": { - "graceful-fs": "4.1.11", - "jsonfile": "2.4.0", - "klaw": "1.3.1" + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" } }, "getpass": { "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "bundled": true, "dev": true, + "optional": true, "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.1", + "bundled": true, + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "graceful-fs": { "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "bundled": true, "dev": true }, + "har-schema": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true + }, "har-validator": { "version": "4.2.1", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", + "bundled": true, "dev": true, + "optional": true, "requires": { - "ajv": "4.11.8", - "har-schema": "1.0.5" + "ajv": "^4.9.1", + "har-schema": "^1.0.5" } }, - "hasha": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", - "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=", + "has-unicode": { + "version": "2.0.1", + "bundled": true, "dev": true, - "requires": { - "is-stream": "1.1.0", - "pinkie-promise": "2.0.1" - } + "optional": true }, "hawk": { "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "bundled": true, "dev": true, + "optional": true, "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" } }, "hoek": { "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "bundled": true, "dev": true }, "http-signature": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "dependencies": { + "assert-plus": { + "version": "0.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.4", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, "dev": true, "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.1", - "sshpk": "1.13.1" + "number-is-nan": "^1.0.0" } }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, "is-typedarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true + "bundled": true, + "dev": true, + "optional": true }, "isarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "bundled": true, "dev": true }, "isstream": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true + "bundled": true, + "dev": true, + "optional": true }, "jsbn": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "bundled": true, "dev": true, "optional": true }, "json-schema": { "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true + "bundled": true, + "dev": true, + "optional": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsonify": "~0.0.0" + } }, "json-stringify-safe": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true + "bundled": true, + "dev": true, + "optional": true }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "jsonify": { + "version": "0.0.0", + "bundled": true, "dev": true, - "requires": { - "graceful-fs": "4.1.11" - } + "optional": true }, "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "version": "1.4.0", + "bundled": true, "dev": true, + "optional": true, "requires": { "assert-plus": "1.0.0", - "extsprintf": "1.3.0", + "extsprintf": "1.0.2", "json-schema": "0.2.3", - "verror": "1.10.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } + "verror": "1.3.6" } }, - "kew": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", - "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", + "mime-db": { + "version": "1.27.0", + "bundled": true, "dev": true }, - "klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "mime-types": { + "version": "2.1.15", + "bundled": true, "dev": true, "requires": { - "graceful-fs": "4.1.11" + "mime-db": "~1.27.0" } }, - "mime-db": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", - "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", - "dev": true - }, - "mime-types": { - "version": "2.1.17", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", - "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "minimatch": { + "version": "3.0.4", + "bundled": true, "dev": true, "requires": { - "mime-db": "1.30.0" + "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "bundled": true, "dev": true }, "mkdirp": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz", - "integrity": "sha1-HXMHam35hs2TROFecfzAWkyavxI=", + "version": "0.5.1", + "bundled": true, "dev": true, "requires": { "minimist": "0.0.8" } }, "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", + "version": "0.7.2", + "bundled": true, + "dev": true, + "optional": true + }, + "node-pre-gyp": { + "version": "0.6.36", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "mkdirp": "^0.5.1", + "nopt": "^4.0.1", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "request": "^2.81.0", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^2.2.1", + "tar-pack": "^3.4.0" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npmlog": { + "version": "4.1.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, "dev": true }, "oauth-sign": { "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", - "dev": true + "bundled": true, + "dev": true, + "optional": true }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true }, - "phantomjs-prebuilt": { - "version": "2.1.15", - "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.15.tgz", - "integrity": "sha1-IPhugtM0nFBZF1J3RbekEeCLOQM=", + "once": { + "version": "1.4.0", + "bundled": true, "dev": true, "requires": { - "es6-promise": "4.0.5", - "extract-zip": "1.6.5", - "fs-extra": "1.0.0", - "hasha": "2.2.0", - "kew": "0.7.0", - "progress": "1.1.8", - "request": "2.81.0", - "request-progress": "2.0.1", - "which": "1.2.14" + "wrappy": "1" } }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.4", + "bundled": true, "dev": true, + "optional": true, "requires": { - "pinkie": "2.0.4" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, "dev": true }, - "progress": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", - "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", - "dev": true + "performance-now": { + "version": "0.2.0", + "bundled": true, + "dev": true, + "optional": true }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, "dev": true }, "qs": { "version": "6.4.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", - "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", - "dev": true + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "~0.4.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } }, "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "version": "2.3.1", + "bundled": true, "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.0", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" } }, "request": { "version": "2.81.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", - "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", - "dev": true, - "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "4.2.1", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.17", - "oauth-sign": "0.8.2", - "performance-now": "0.2.0", - "qs": "6.4.0", - "safe-buffer": "5.1.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.3", - "tunnel-agent": "0.6.0", - "uuid": "3.1.0" - } - }, - "request-progress": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", - "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~2.1.1", + "har-validator": "~4.2.1", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "oauth-sign": "~0.8.1", + "performance-now": "^0.2.0", + "qs": "~6.4.0", + "safe-buffer": "^5.0.1", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.0.0" + } + }, + "rimraf": { + "version": "2.6.1", + "bundled": true, "dev": true, "requires": { - "throttleit": "1.0.0" + "glob": "^7.0.5" } }, "safe-buffer": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "bundled": true, "dev": true }, + "semver": { + "version": "5.3.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, "sntp": { "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "bundled": true, "dev": true, + "optional": true, "requires": { - "hoek": "2.16.3" + "hoek": "2.x.x" } }, "sshpk": { "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "bundled": true, "dev": true, + "optional": true, "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "tweetnacl": "~0.14.0" + } + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "~5.0.1" }, "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "safe-buffer": { + "version": "5.0.1", + "bundled": true, "dev": true } } }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "stringstream": { + "version": "0.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "dev": true, + "requires": { + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" + } + }, + "tar-pack": { + "version": "3.4.0", + "bundled": true, "dev": true, + "optional": true, "requires": { - "safe-buffer": "5.1.1" + "debug": "^2.2.0", + "fstream": "^1.0.10", + "fstream-ignore": "^1.0.5", + "once": "^1.3.3", + "readable-stream": "^2.1.4", + "rimraf": "^2.5.1", + "tar": "^2.2.1", + "uid-number": "^0.0.6" } }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", - "dev": true - }, - "throttleit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", - "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=", - "dev": true - }, "tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "version": "2.3.2", + "bundled": true, "dev": true, + "optional": true, "requires": { - "punycode": "1.4.1" + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "bundled": true, + "dev": true, + "optional": true + } } }, "tunnel-agent": { "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "bundled": true, "dev": true, + "optional": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "^5.0.1" } }, "tweetnacl": { "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "bundled": true, "dev": true, "optional": true }, - "typedarray": { + "uid-number": { "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true + "bundled": true, + "dev": true, + "optional": true }, "util-deprecate": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "bundled": true, "dev": true }, "uuid": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==", - "dev": true + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true }, "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "version": "1.3.6", + "bundled": true, "dev": true, + "optional": true, "requires": { - "assert-plus": "1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "1.3.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } + "extsprintf": "1.0.2" } }, - "yauzl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", - "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isbinaryfile": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.3.tgz", + "integrity": "sha512-8cJBL5tTd2OS0dM4jz07wQd5g0dCCqIhUxPIGtZfa5L6hWlvV5MHTITy/DBAsF+Oe2LS1X3krBUhNwaGUWpWxw==", + "dev": true, + "requires": { + "buffer-alloc": "^1.2.0" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "jasmine-core": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.2.1.tgz", + "integrity": "sha512-pa9tbBWgU0EE4SWgc85T4sa886ufuQdsgruQANhECYjwqgV4z7Vw/499aCaP8ZH79JDS4vhm8doDG9HO4+e4sA==", + "dev": true + }, + "js-yaml": { + "version": "3.5.5", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz", + "integrity": "sha1-A3fDgBfKvHMisNH7zSWkkWQfL74=", + "dev": true, + "requires": { + "argparse": "^1.0.2", + "esprima": "^2.6.0" + } + }, + "js2xmlparser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-3.0.0.tgz", + "integrity": "sha1-P7YOqgicVED5MZ9RdgzNB+JJlzM=", + "dev": true, + "requires": { + "xmlcreate": "^1.0.1" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, + "jsdoc": { + "version": "3.5.5", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.5.5.tgz", + "integrity": "sha512-6PxB65TAU4WO0Wzyr/4/YhlGovXl0EVYfpKbpSroSj0qBxT4/xod/l40Opkm38dRHRdQgdeY836M0uVnJQG7kg==", + "dev": true, + "requires": { + "babylon": "7.0.0-beta.19", + "bluebird": "~3.5.0", + "catharsis": "~0.8.9", + "escape-string-regexp": "~1.0.5", + "js2xmlparser": "~3.0.0", + "klaw": "~2.0.0", + "marked": "~0.3.6", + "mkdirp": "~0.5.1", + "requizzle": "~0.2.1", + "strip-json-comments": "~2.0.1", + "taffydb": "2.6.2", + "underscore": "~1.8.3" + }, + "dependencies": { + "marked": { + "version": "0.3.19", + "resolved": "http://registry.npmjs.org/marked/-/marked-0.3.19.tgz", + "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", + "dev": true + } + } + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "karma": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/karma/-/karma-3.0.0.tgz", + "integrity": "sha512-ZTjyuDXVXhXsvJ1E4CnZzbCjSxD6sEdzEsFYogLuZM0yqvg/mgz+O+R1jb0J7uAQeuzdY8kJgx6hSNXLwFuHIQ==", + "dev": true, + "requires": { + "bluebird": "^3.3.0", + "body-parser": "^1.16.1", + "chokidar": "^2.0.3", + "colors": "^1.1.0", + "combine-lists": "^1.0.0", + "connect": "^3.6.0", + "core-js": "^2.2.0", + "di": "^0.0.1", + "dom-serialize": "^2.2.0", + "expand-braces": "^0.1.1", + "glob": "^7.1.1", + "graceful-fs": "^4.1.2", + "http-proxy": "^1.13.0", + "isbinaryfile": "^3.0.0", + "lodash": "^4.17.4", + "log4js": "^3.0.0", + "mime": "^2.3.1", + "minimatch": "^3.0.2", + "optimist": "^0.6.1", + "qjobs": "^1.1.4", + "range-parser": "^1.2.0", + "rimraf": "^2.6.0", + "safe-buffer": "^5.0.1", + "socket.io": "2.1.1", + "source-map": "^0.6.1", + "tmp": "0.0.33", + "useragent": "2.2.1" + } + }, + "karma-chrome-launcher": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", + "integrity": "sha1-zxudBxNswY/iOTJ9JGVMPbw2is8=", + "dev": true, + "requires": { + "fs-access": "^1.0.0", + "which": "^1.2.1" + }, + "dependencies": { + "which": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", + "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", "dev": true, "requires": { - "fd-slicer": "1.0.1" + "isexe": "^2.0.0" } } } }, + "karma-htmlfile-reporter": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/karma-htmlfile-reporter/-/karma-htmlfile-reporter-0.3.7.tgz", + "integrity": "sha512-1Ryh11QJinRGf3BTUOYaPsjVtz8tK87grhOQCtdq8bt7z0sYd1lxTwC6QmH+aQS7T2pe/qfdoDdFF/Vo/96dRA==", + "dev": true, + "requires": { + "xmlbuilder": "^10.0.0" + } + }, + "karma-jasmine": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-1.1.2.tgz", + "integrity": "sha1-OU8rJf+0pkS5rabyLUQ+L9CIhsM=", + "dev": true + }, + "karma-junit-reporter": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/karma-junit-reporter/-/karma-junit-reporter-1.2.0.tgz", + "integrity": "sha1-T5xAzt+xo5X4rvh2q/lhiZF8Y5Y=", + "dev": true, + "requires": { + "path-is-absolute": "^1.0.0", + "xmlbuilder": "8.2.2" + }, + "dependencies": { + "xmlbuilder": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-8.2.2.tgz", + "integrity": "sha1-aSSGc0ELS6QuGmE2VR0pIjNap3M=", + "dev": true + } + } + }, + "karma-phantomjs-launcher": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/karma-phantomjs-launcher/-/karma-phantomjs-launcher-1.0.4.tgz", + "integrity": "sha1-0jyjSAG9qYY60xjju0vUBisTrNI=", + "dev": true, + "requires": { + "lodash": "^4.0.1", + "phantomjs-prebuilt": "^2.1.7" + } + }, "karma-requirejs": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/karma-requirejs/-/karma-requirejs-1.1.0.tgz", "integrity": "sha1-/driy4fX68FvsCIok1ZNf+5Xh5g=", "dev": true }, + "kew": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", + "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "klaw": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-2.0.0.tgz", + "integrity": "sha1-WcEo4Nxc5BAgEVEZTuucv4WGUPY=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.9" + } + }, "lazystream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", "dev": true, "requires": { - "readable-stream": "2.3.3" + "readable-stream": "^2.0.5" }, "dependencies": { "isarray": { @@ -4057,13 +4001,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "isarray": "1.0.0", - "process-nextick-args": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "safe-buffer": { @@ -4078,7 +4022,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } } } @@ -4089,38 +4033,76 @@ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "graceful-fs": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "strip-bom": "2.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" } }, "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", "dev": true }, + "log4js": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-3.0.6.tgz", + "integrity": "sha512-ezXZk6oPJCWL483zj64pNkMuY/NcRX5MPiB0zE6tjZM137aeusrOnW1ecxgF9cmwMWkBMhjteQxBPoZBh9FDxQ==", + "dev": true, + "requires": { + "circular-json": "^0.5.5", + "date-format": "^1.2.0", + "debug": "^3.1.0", + "rfdc": "^1.1.2", + "streamroller": "0.7.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, "loud-rejection": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", "dev": true, "requires": { - "currently-unhandled": "0.4.1", - "signal-exit": "3.0.2" + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" } }, "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", - "dev": true, - "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" - } + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.2.4.tgz", + "integrity": "sha1-bGWGGb7PFAMdDQtZSxYELOTcBj0=", + "dev": true + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true }, "map-obj": { "version": "1.0.1", @@ -4128,30 +4110,85 @@ "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", "dev": true }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "marked": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.5.1.tgz", + "integrity": "sha512-iUkBZegCZou4AdwbKTwSW/lNDcz5OuRSl3qdcl31Ia0B2QPG0Jn+tKblh/9/eP9/6+4h27vpoh8wel/vQOV0vw==", + "dev": true + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "dev": true + }, "meow": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { - "camelcase-keys": "2.1.0", - "decamelize": "1.2.0", - "loud-rejection": "1.6.0", - "map-obj": "1.0.1", - "minimist": "1.2.0", - "normalize-package-data": "2.4.0", - "object-assign": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", - "read-pkg-up": "1.0.1", - "redent": "1.0.0", - "trim-newlines": "1.0.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + } + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "mime": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", + "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", + "dev": true + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", + "dev": true + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "dev": true, + "requires": { + "mime-db": "~1.36.0" } }, "minimatch": { @@ -4160,7 +4197,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.8" + "brace-expansion": "^1.1.7" }, "dependencies": { "balanced-match": { @@ -4175,7 +4212,7 @@ "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -4187,6 +4224,56 @@ } } }, + "minimist": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, "nan": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz", @@ -4194,28 +4281,70 @@ "dev": true, "optional": true }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "dev": true, "requires": { - "hosted-git-info": "2.5.0", - "is-builtin-module": "1.0.0", - "semver": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", - "validate-npm-package-license": "3.0.1" + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" } }, "normalize-path": { - "version": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.0.1.tgz" + "remove-trailing-separator": "^1.0.1" } }, "null-check": { - "version": "https://registry.npmjs.org/null-check/-/null-check-1.0.0.tgz", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/null-check/-/null-check-1.0.0.tgz", "integrity": "sha1-l33/1xdgErnsMNKjnbXPcqBDnt0=", "dev": true }, @@ -4225,59 +4354,221 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, "object-assign": { - "version": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", - "integrity": "sha1-ejs9DpgGPUP0wD8uiubNUahog6A=", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", "dev": true }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, + "requires": { + "ee-first": "1.1.1" + } + }, "once": { - "version": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + "wrappy": "1" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + } } }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, "parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "1.3.1" + "error-ex": "^1.2.0" } }, + "parseqs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "dev": true, + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseuri": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "dev": true, + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=", + "dev": true + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, "path-exists": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz" + "pinkie-promise": "^2.0.0" } }, "path-is-absolute": { - "version": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, "path-type": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { - "graceful-fs": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "pify": "2.3.0", - "pinkie-promise": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz" + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, "performance-now": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, + "phantomjs-prebuilt": { + "version": "2.1.16", + "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz", + "integrity": "sha1-79ISpKOWbTZHaE6ouniFSb4q7+8=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3", + "extract-zip": "^1.6.5", + "fs-extra": "^1.0.0", + "hasha": "^2.2.0", + "kew": "^0.7.0", + "progress": "^1.1.8", + "request": "^2.81.0", + "request-progress": "^2.0.1", + "which": "^1.2.10" + } + }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -4285,18 +4576,26 @@ "dev": true }, "pinkie": { - "version": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", "dev": true }, "pinkie-promise": { - "version": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz" + "pinkie": "^2.0.0" } }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, "pretty-bytes": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz", @@ -4304,20 +4603,39 @@ "dev": true }, "process-nextick-args": { - "version": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", "dev": true }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "progress": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", + "dev": true + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", "dev": true }, "qjobs": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.1.5.tgz", - "integrity": "sha1-ZZ3p8s+NzCehSBJ28gU3cnI4LnM=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", + "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==", + "dev": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true }, "range-parser": { @@ -4326,15 +4644,38 @@ "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=", "dev": true }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "dev": true, + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } + } + }, "read-pkg": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, "requires": { - "load-json-file": "1.1.0", - "normalize-package-data": "2.4.0", - "path-type": "1.1.0" + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" } }, "read-pkg-up": { @@ -4343,89 +4684,268 @@ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { - "find-up": "1.1.2", - "read-pkg": "1.1.0" + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" } }, - "recursive-readdir": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.1.tgz", - "integrity": "sha1-kO8jHQd4xc4JPJpI105cVCLROpk=", + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "minimatch": "3.0.3" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" }, "dependencies": { - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true, - "requires": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true - }, - "minimatch": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha1-Kk5AkLlrLbBqnX3wEFWmKnfJt3Q=", - "dev": true, - "requires": { - "brace-expansion": "1.1.8" - } } } }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + } + }, + "recursive-readdir": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz", + "integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==", + "dev": true, + "requires": { + "minimatch": "3.0.4" + } + }, "redent": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", "dev": true, "requires": { - "indent-string": "2.1.0", - "strip-indent": "1.0.1" + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" } }, "remove-trailing-separator": { - "version": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.0.1.tgz", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.0.1.tgz", "integrity": "sha1-YV67lq9VlVLUv0BXyENtSGq2PMQ=", "dev": true }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, "repeating": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true, "requires": { - "is-finite": "1.0.2" + "is-finite": "^1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "request-progress": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", + "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=", + "dev": true, + "requires": { + "throttleit": "^1.0.0" } }, "requirejs": { - "version": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.3.tgz", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.3.tgz", "integrity": "sha1-qln9OgKH6vQHlZoTgigES13WpqM=", "dev": true }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true + }, + "requizzle": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.1.tgz", + "integrity": "sha1-aUPDUwxNmn5G8c3dUcFY/GcM294=", + "dev": true, + "requires": { + "underscore": "~1.6.0" + }, + "dependencies": { + "underscore": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", + "dev": true + } + } + }, + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "rfdc": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.2.tgz", + "integrity": "sha512-92ktAgvZhBzYTIK0Mja9uen5q5J3NRVMoDkJL2VMwq6SXjVCgqvQeVP2XAaUY6HT+XpQYeLSjb3UoitBryKmdA==", + "dev": true + }, "rimraf": { - "version": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, "semver": { - "version": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", - "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "signal-exit": { @@ -4434,287 +4954,325 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, - "socket.io": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-1.7.3.tgz", - "integrity": "sha1-uK+cq6AJSeVo42nxMn6pvp6iRhs=", - "dev": true, - "requires": { - "debug": "2.3.3", - "engine.io": "1.8.3", - "has-binary": "0.1.7", - "object-assign": "4.1.0", - "socket.io-adapter": "0.5.0", - "socket.io-client": "1.7.3", - "socket.io-parser": "2.3.1" + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" }, "dependencies": { - "component-emitter": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz", - "integrity": "sha1-KWWU8nU9qmOZbSrwjRWpURbJrsM=", - "dev": true - }, - "debug": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", - "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "ms": "0.7.2" + "is-descriptor": "^0.1.0" } }, - "has-binary": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz", - "integrity": "sha1-aOYesWIQyVRaClzOBqhzkS/h5ow=", + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "isarray": "0.0.1" + "is-extendable": "^0.1.0" } }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, - "ms": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", - "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } }, - "object-assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", - "integrity": "sha1-ejs9DpgGPUP0wD8uiubNUahog6A=", - "dev": true + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } }, - "socket.io-adapter": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.5.0.tgz", - "integrity": "sha1-y21LuL7IHhB4uZZ3+c7QBGBmu4s=", + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { - "debug": "2.3.3", - "socket.io-parser": "2.3.1" + "kind-of": "^6.0.0" } }, - "socket.io-parser": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.3.1.tgz", - "integrity": "sha1-3VMgJRA85Clpcya+/WQAX8/ltKA=", + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { - "component-emitter": "1.1.2", - "debug": "2.2.0", - "isarray": "0.0.1", - "json3": "3.3.2" - }, - "dependencies": { - "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", - "dev": true, - "requires": { - "ms": "0.7.1" - } - }, - "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", - "dev": true - } + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "socket.io": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.1.1.tgz", + "integrity": "sha512-rORqq9c+7W0DAK3cleWNSyfv/qKXV99hV4tZe+gGLfBECw3XEhBy7x85F3wypA9688LKjtwO9pX9L33/xQI8yA==", + "dev": true, + "requires": { + "debug": "~3.1.0", + "engine.io": "~3.2.0", + "has-binary2": "~1.0.2", + "socket.io-adapter": "~1.1.0", + "socket.io-client": "2.1.1", + "socket.io-parser": "~3.2.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" } } } }, + "socket.io-adapter": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.1.tgz", + "integrity": "sha1-KoBeihTWNyEk3ZFZrUUC+MsH8Gs=", + "dev": true + }, "socket.io-client": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.7.3.tgz", - "integrity": "sha1-sw6GqhDV7zVGYBwJzeR2Xjgdo3c=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.1.1.tgz", + "integrity": "sha512-jxnFyhAuFxYfjqIgduQlhzqTcOEQSn+OHKVfAxWaNWa7ecP7xSNk2Dx/3UEsDcY7NcFafxvNvKPmmO7HTwTxGQ==", "dev": true, "requires": { "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", "component-bind": "1.0.0", "component-emitter": "1.2.1", - "debug": "2.3.3", - "engine.io-client": "1.8.3", - "has-binary": "0.1.7", + "debug": "~3.1.0", + "engine.io-client": "~3.2.0", + "has-binary2": "~1.0.2", + "has-cors": "1.1.0", "indexof": "0.0.1", "object-component": "0.0.3", + "parseqs": "0.0.5", "parseuri": "0.0.5", - "socket.io-parser": "2.3.1", + "socket.io-parser": "~3.2.0", "to-array": "0.1.4" }, "dependencies": { - "backo2": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", - "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=", - "dev": true - }, - "better-assert": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", - "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", - "dev": true, - "requires": { - "callsite": "1.0.0" - } - }, - "callsite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", - "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", - "dev": true - }, - "component-bind": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", - "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=", - "dev": true - }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true - }, "debug": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", - "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", - "dev": true, - "requires": { - "ms": "0.7.2" - } - }, - "has-binary": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz", - "integrity": "sha1-aOYesWIQyVRaClzOBqhzkS/h5ow=", - "dev": true, - "requires": { - "isarray": "0.0.1" - } - }, - "indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", - "dev": true - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, - "ms": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", - "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", - "dev": true - }, - "object-component": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", - "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", - "dev": true - }, - "parseuri": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", - "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { - "better-assert": "1.0.2" + "ms": "2.0.0" } - }, - "socket.io-parser": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.3.1.tgz", - "integrity": "sha1-3VMgJRA85Clpcya+/WQAX8/ltKA=", + } + } + }, + "socket.io-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.2.0.tgz", + "integrity": "sha512-FYiBx7rc/KORMJlgsXysflWx/RIvtqZbyGLlHZvjfmPTPeuD/I8MaW7cfFrj5tRltICJdgwflhfZ3NVVbVLFQA==", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "isarray": "2.0.1" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { - "component-emitter": "1.1.2", - "debug": "2.2.0", - "isarray": "0.0.1", - "json3": "3.3.2" - }, - "dependencies": { - "component-emitter": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz", - "integrity": "sha1-KWWU8nU9qmOZbSrwjRWpURbJrsM=", - "dev": true - }, - "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", - "dev": true, - "requires": { - "ms": "0.7.1" - } - }, - "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", - "dev": true - } + "ms": "2.0.0" } }, - "to-array": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", - "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=", + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", "dev": true } } }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, "spdx-correct": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", - "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz", + "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==", "dev": true, "requires": { - "spdx-license-ids": "1.2.2" + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" } }, - "spdx-expression-parse": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", - "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", "dev": true }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, "spdx-license-ids": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", - "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", + "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", "dev": true }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.1.tgz", + "integrity": "sha1-Nr54Mgr+WAH2zqPueLblqrlA6gw=", + "dev": true + }, + "sshpk": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", + "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", "dev": true }, "stream-buffers": { @@ -4723,13 +5281,51 @@ "integrity": "sha1-kdX1Ew0c75bc+n9yaUUYh0HQnuQ=", "dev": true }, + "streamroller": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-0.7.0.tgz", + "integrity": "sha512-WREzfy0r0zUqp3lGO096wRuUp7ho1X6uo/7DJfTlEi0Iv/4gT7YHqXDjKC2ioVGBZtE8QzsQD9nx1nIuoZ57jQ==", + "dev": true, + "requires": { + "date-format": "^1.2.0", + "debug": "^3.1.0", + "mkdirp": "^0.5.1", + "readable-stream": "^2.3.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "strip-bom": { @@ -4738,7 +5334,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "0.2.1" + "is-utf8": "^0.2.0" } }, "strip-indent": { @@ -4747,25 +5343,37 @@ "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", "dev": true, "requires": { - "get-stdin": "4.0.1" + "get-stdin": "^4.0.1" } }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, + "taffydb": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", + "integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=", + "dev": true + }, "tar-stream": { "version": "1.5.4", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.5.4.tgz", "integrity": "sha1-NlSc8E7RrumyowwBQyUiONr5QBY=", "dev": true, "requires": { - "bl": "1.2.1", - "end-of-stream": "1.4.0", - "readable-stream": "2.3.3", - "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + "bl": "^1.0.0", + "end-of-stream": "^1.0.0", + "readable-stream": "^2.0.0", + "xtend": "^4.0.0" }, "dependencies": { "isarray": { @@ -4780,13 +5388,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "isarray": "1.0.0", - "process-nextick-args": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "safe-buffer": { @@ -4801,32 +5409,314 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" + } + } + } + }, + "throttleit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", + "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" } } } }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, "trim-newlines": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", "dev": true }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "dev": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==", + "dev": true + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "dev": true + }, + "underscore-contrib": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/underscore-contrib/-/underscore-contrib-0.3.0.tgz", + "integrity": "sha1-ZltmwkeD+PorGMn4y7Dix9SMJsc=", + "dev": true, + "requires": { + "underscore": "1.6.0" + }, + "dependencies": { + "underscore": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", + "dev": true + } + } + }, + "underscore.string": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.5.tgz", + "integrity": "sha512-g+dpmgn+XBneLmXXo+sGlW5xQEt4ErkS3mgeN2GFbremYeMBSJKr9Wf2KJplQVaiPY/f7FN6atosWYNm9ovrYg==", + "dev": true, + "requires": { + "sprintf-js": "^1.0.3", + "util-deprecate": "^1.0.2" + } + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "upath": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", + "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", + "dev": true + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "useragent": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/useragent/-/useragent-2.2.1.tgz", + "integrity": "sha1-z1k+9PLRdYdei7ZY6pLhik/QbY4=", + "dev": true, + "requires": { + "lru-cache": "2.2.x", + "tmp": "0.0.x" + } + }, "util-deprecate": { - "version": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true + }, "validate-npm-package-license": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", - "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "dev": true, "requires": { - "spdx-correct": "1.0.2", - "spdx-expression-parse": "1.0.4" + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" } }, + "void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", + "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", + "dev": true + }, "walkdir": { "version": "0.0.11", "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.0.11.tgz", @@ -4839,7 +5729,7 @@ "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", "dev": true, "requires": { - "isexe": "2.0.0" + "isexe": "^2.0.0" }, "dependencies": { "isexe": { @@ -4850,49 +5740,34 @@ } } }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + }, "wrappy": { - "version": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "ws": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-1.1.2.tgz", - "integrity": "sha1-iiRPoFJAHgjJiGz0SoUYnh/UBn8=", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", "dev": true, "requires": { - "options": "0.0.6", - "ultron": "1.0.2" - }, - "dependencies": { - "options": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz", - "integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=", - "dev": true - }, - "ultron": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz", - "integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po=", - "dev": true - } + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" } }, "xmlbuilder": { - "version": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-3.1.0.tgz", - "integrity": "sha1-LIaIjy1OrehQ+jjKf3Ij9yCVFuE=", - "dev": true, - "requires": { - "lodash": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz" - }, - "dependencies": { - "lodash": { - "version": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", - "dev": true - } - } + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-10.1.0.tgz", + "integrity": "sha512-In21jFWiaulS7Cmw1fPT1Lm7g7L6ml/uwZNAaKlDZc78szm3pn5oH9gizH7sh1h2GGRb3OkL5kLCeMEENEnZwA==", + "dev": true }, "xmlcreate": { "version": "1.0.2", @@ -4900,15 +5775,31 @@ "integrity": "sha1-+mv3YqYKQT+z3Y9LA8WyaSONMI8=", "dev": true }, + "xmlhttprequest-ssl": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", + "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=", + "dev": true + }, "xtend": { - "version": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", "dev": true }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "yauzl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", + "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "dev": true, + "requires": { + "fd-slicer": "~1.0.1" + } + }, + "yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=", "dev": true }, "zip-stream": { @@ -4917,10 +5808,10 @@ "integrity": "sha1-qLxF9MG0lpnGuQGYuqyqzbzUugQ=", "dev": true, "requires": { - "archiver-utils": "1.3.0", - "compress-commons": "1.2.0", - "lodash": "4.17.4", - "readable-stream": "2.3.3" + "archiver-utils": "^1.3.0", + "compress-commons": "^1.2.0", + "lodash": "^4.8.0", + "readable-stream": "^2.0.0" }, "dependencies": { "isarray": { @@ -4935,13 +5826,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "isarray": "1.0.0", - "process-nextick-args": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "safe-buffer": { @@ -4956,7 +5847,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } } } diff --git a/package.json b/package.json index 68da44304..2dd318b0b 100644 --- a/package.json +++ b/package.json @@ -30,22 +30,22 @@ "build/dist/worldwind.min.js" ], "devDependencies": { - "grunt": "^1.0.1", - "grunt-contrib-clean": "^1.1.0", + "grunt": "^1.0.3", + "grunt-contrib-clean": "^2.0.0", "grunt-contrib-compress": "^1.4.3", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-requirejs": "^1.0.0", - "grunt-jsdoc": "^2.2.0", - "grunt-karma": "^2.0.0", - "jasmine-core": "^2.8.0", - "karma": "^1.7.1", - "karma-chrome-launcher": "^2.0.0", - "karma-htmlfile-reporter": "^0.3.4", - "karma-jasmine": "^1.1.0", + "grunt-jsdoc": "^2.3.0", + "grunt-karma": "^3.0.0", + "jasmine-core": "^3.2.1", + "karma": "^3.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-htmlfile-reporter": "^0.3.7", + "karma-jasmine": "^1.1.2", "karma-junit-reporter": "^1.2.0", - "karma-phantomjs-launcher": "^1.0.2", + "karma-phantomjs-launcher": "^1.0.4", "karma-requirejs": "^1.1.0", - "recursive-readdir": "^2.2.1" + "recursive-readdir": "^2.2.2" }, "keywords": [ "sdk", From a6f9bbf196dec899e0531d061beb510a93b1e151 Mon Sep 17 00:00:00 2001 From: pdavidc Date: Tue, 16 Oct 2018 16:27:22 -0700 Subject: [PATCH 071/112] Corrected erroneous geom unit tests --- test/geom/Location.test.js | 46 +++++++++++++++++++------------------- test/geom/Matrix.test.js | 19 +++++----------- test/geom/Matrix3.test.js | 9 +------- test/geom/Position.test.js | 28 +++++++++++------------ test/geom/Sector.test.js | 8 +++---- 5 files changed, 48 insertions(+), 62 deletions(-) diff --git a/test/geom/Location.test.js b/test/geom/Location.test.js index c46c467d1..7d9b9978b 100644 --- a/test/geom/Location.test.js +++ b/test/geom/Location.test.js @@ -49,7 +49,7 @@ define([ describe("Copies this location to the latitude and longitude of a specified location", function () { it("Copies the location successfully", function () { - var location = Location.ZERO; + var location = new Location(0, 0); var locationTarget = new Location(37.52, 15.08); location.copy(locationTarget); @@ -59,14 +59,14 @@ define([ it("Should throw an exception on missing location input", function () { expect(function () { - var location = Location.ZERO; + var location = new Location(0, 0); location.copy(null); }).toThrow(); }); }); it('Sets latitude and longitude of a location', function () { - var location = Location.ZERO; + var location = new Location(0, 0); location.set(37.52, 15.08); expect(location.latitude).toEqual(37.52); expect(location.longitude).toEqual(15.08); @@ -98,7 +98,7 @@ define([ 0.5, locationA, locationB, - Location.ZERO); + new Location()); expect(resultLocation.latitude).toBeCloseTo(41.537, 2); expect(resultLocation.longitude).toBeCloseTo(12.227, 2); }); @@ -109,7 +109,7 @@ define([ 0.5, locationA, locationB, - Location.ZERO); + new Location()); expect(resultLocation.latitude).toBeCloseTo(41.5, 2); expect(resultLocation.longitude).toBeCloseTo(12.135, 2); }); @@ -120,7 +120,7 @@ define([ 0.5, locationA, locationB, - Location.ZERO); + new Location()); expect(resultLocation.latitude).toBeCloseTo(41.5, 2); expect(resultLocation.longitude).toBeCloseTo(12.044, 2); }); @@ -131,7 +131,7 @@ define([ 4.5, locationA, locationB, - Location.ZERO); + new Location()); expect(resultLocation.latitude).toBeCloseTo(45.48, 2); expect(resultLocation.longitude).toBeCloseTo(9.089, 2); }); @@ -142,13 +142,13 @@ define([ 0.5, locationA, locationB, - Location.ZERO); + new Location()); expect(resultLocation.latitude).toBeCloseTo(41.5, 2); expect(resultLocation.longitude).toBeCloseTo(12.044, 2); }); it('Store result in the provided variable', function () { - var resultLocation = Location.ZERO; + var resultLocation = new Location(0, 0); Location.interpolateAlongPath( WorldWind.LINEAR, 0.5, @@ -168,7 +168,7 @@ define([ 0.5, null, locationB, - Location.ZERO); + new Location()); }).toThrow(); }); @@ -179,7 +179,7 @@ define([ 0.5, locationA, null, - Location.ZERO); + new Location()); }).toThrow(); }); @@ -206,7 +206,7 @@ define([ 0.5, locationA, locationB, - Location.ZERO); + new Location()); expect(resultLocation.latitude).toBeCloseTo(41.537, 2); expect(resultLocation.longitude).toBeCloseTo(12.227, 2); }); @@ -216,7 +216,7 @@ define([ 0.5, locationA, locationA, - Location.ZERO); + new Location()); expect(resultLocation).toEqual(locationA); }); @@ -228,7 +228,7 @@ define([ 0.5, null, locationB, - Location.ZERO); + new Location()); }).toThrow(); }); @@ -238,7 +238,7 @@ define([ 0.5, locationA, null, - Location.ZERO); + new Location()); }).toThrow(); }); @@ -264,7 +264,7 @@ define([ 0.5, locationA, locationB, - Location.ZERO); + new Location()); expect(resultLocation.latitude).toBeCloseTo(41.5, 2); expect(resultLocation.longitude).toBeCloseTo(12.135, 2); }); @@ -274,7 +274,7 @@ define([ 0.5, locationA, locationA, - Location.ZERO); + new Location()); expect(resultLocation).toEqual(locationA); }); @@ -286,7 +286,7 @@ define([ 0.5, null, locationB, - Location.ZERO); + new Location()); }).toThrow(); }); @@ -296,7 +296,7 @@ define([ 0.5, locationA, null, - Location.ZERO); + new Location()); }).toThrow(); }); @@ -322,7 +322,7 @@ define([ 0.5, locationA, locationB, - Location.ZERO); + new Location()); expect(resultLocation.latitude).toBeCloseTo(41.5, 2); expect(resultLocation.longitude).toBeCloseTo(12.044, 2); }); @@ -332,7 +332,7 @@ define([ 0.5, locationA, locationA, - Location.ZERO); + new Location()); expect(resultLocation).toEqual(locationA); }); @@ -344,7 +344,7 @@ define([ 0.5, null, locationB, - Location.ZERO); + new Location()); }).toThrow(); }); @@ -354,7 +354,7 @@ define([ 0.5, locationA, null, - Location.ZERO); + new Location()); }).toThrow(); }); diff --git a/test/geom/Matrix.test.js b/test/geom/Matrix.test.js index 8fd66f146..fbcc9364a 100644 --- a/test/geom/Matrix.test.js +++ b/test/geom/Matrix.test.js @@ -36,13 +36,6 @@ define([ } }); - it("Matrix prototype", function () { - var matrix = Matrix.prototype; - for (var i = 0; i < 16; i++) { - expect(matrix[i]).toEqual(0); - } - }); - it("Should create an identity Matrix", function () { var identity = Matrix.fromIdentity(); @@ -273,7 +266,7 @@ define([ describe("Sets this matrix to the matrix product of two specified matrices", function () { it("Sets the matrix correctly", function () { - var targetMatrix = Matrix.prototype; + var targetMatrix = new Matrix(); var matrixA = new Matrix(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); var matrixB = new Matrix(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); @@ -301,7 +294,7 @@ define([ it("Missing matrix A", function () { expect(function () { - var targetMatrix = Matrix.prototype; + var targetMatrix = new Matrix(); var matrixB = new Matrix(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); targetMatrix.setToMultiply(null, matrixB); }).toThrow(); @@ -309,7 +302,7 @@ define([ it("Missing matrix B", function () { expect(function () { - var targetMatrix = Matrix.prototype; + var targetMatrix = new Matrix(); var matrixA = new Matrix(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); targetMatrix.setToMultiply(matrixA, null); }).toThrow(); @@ -320,7 +313,7 @@ define([ describe("Sets this matrix to the symmetric covariance Matrix computed from a point array", function () { it("Sets the matrix correctly", function () { - var targetMatrix = Matrix.prototype; + var targetMatrix = new Matrix(); targetMatrix.setToCovarianceOfPoints([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]); expect(targetMatrix[0]).toEqual(26.25); @@ -343,7 +336,7 @@ define([ it("Should throw an exception on missing points", function () { expect(function () { - var targetMatrix = Matrix.prototype; + var targetMatrix = new Matrix(); targetMatrix.setToCovarianceOfPoints(null); }).toThrow(); }); @@ -417,7 +410,7 @@ define([ }); it("Sets this matrix to one that flips and shifts the y-axis", function () { - var matrix = Matrix.prototype; + var matrix = new Matrix(); matrix.setToUnitYFlip(); expect(matrix[0]).toEqual(1); diff --git a/test/geom/Matrix3.test.js b/test/geom/Matrix3.test.js index 4be9f01d7..b35b889d9 100644 --- a/test/geom/Matrix3.test.js +++ b/test/geom/Matrix3.test.js @@ -30,13 +30,6 @@ define([ } }); - it("Matrix prototype", function () { - var matrix = Matrix3.prototype; - for (var i = 0; i < 9; i++) { - expect(matrix[i]).toEqual(0); - } - }); - it("Should create an identity Matrix", function () { var identity = Matrix3.fromIdentity(); @@ -52,7 +45,7 @@ define([ }); it("Sets this matrix to one that flips and shifts the y-axis", function () { - var matrix = Matrix3.prototype; + var matrix = new Matrix3(); matrix.setToUnitYFlip(); expect(matrix[0]).toEqual(1); diff --git a/test/geom/Position.test.js b/test/geom/Position.test.js index 385cebbbc..89d3b91cf 100644 --- a/test/geom/Position.test.js +++ b/test/geom/Position.test.js @@ -50,7 +50,7 @@ define([ describe("Copies this position to the latitude and longitude of a specified position", function () { it("Copies the position successfully", function () { - var position = Position.ZERO; + var position = new Position(0, 0, 0); var positionTarget = new Position(37.52, 15.08, 150); position.copy(positionTarget); @@ -61,7 +61,7 @@ define([ it("Should throw an exception on missing position input", function () { expect(function () { - var position = Position.ZERO; + var position = new Position(0, 0, 0); position.copy(null); }).toThrow(); }); @@ -92,7 +92,7 @@ define([ 0.5, positionA, positionB, - Position.ZERO); + new Position()); expect(resultPosition.latitude).toBeCloseTo(41.537); expect(resultPosition.longitude).toBeCloseTo(12.227); expect(resultPosition.altitude).toBeCloseTo(135); @@ -103,7 +103,7 @@ define([ 0.5, positionA, positionA, - Position.ZERO); + new Position()); expect(resultPosition).toEqual(positionA); }); @@ -115,7 +115,7 @@ define([ 0.5, null, positionB, - Position.ZERO); + new Position()); }).toThrow(); }); @@ -125,7 +125,7 @@ define([ 0.5, positionA, null, - Position.ZERO); + new Position()); }).toThrow(); }); @@ -151,7 +151,7 @@ define([ 0.5, positionA, positionB, - Position.ZERO); + new Position()); expect(resultPosition.latitude).toBeCloseTo(41.5); expect(resultPosition.longitude).toBeCloseTo(12.135); expect(resultPosition.altitude).toBeCloseTo(135); @@ -162,7 +162,7 @@ define([ 0.5, positionA, positionA, - Position.ZERO); + new Position()); expect(resultPosition).toEqual(positionA); }); @@ -174,7 +174,7 @@ define([ 0.5, null, positionB, - Position.ZERO); + new Position()); }).toThrow(); }); @@ -184,7 +184,7 @@ define([ 0.5, positionA, null, - Position.ZERO); + new Position()); }).toThrow(); }); @@ -210,7 +210,7 @@ define([ 0.5, positionA, positionB, - Position.ZERO); + new Position()); expect(resultPosition.latitude).toBeCloseTo(41.5); expect(resultPosition.longitude).toBeCloseTo(12.044); expect(resultPosition.altitude).toBeCloseTo(135); @@ -221,7 +221,7 @@ define([ 0.5, positionA, positionA, - Position.ZERO); + new Position()); expect(resultPosition).toEqual(positionA); }); @@ -233,7 +233,7 @@ define([ 0.5, null, positionB, - Position.ZERO); + new Position()); }).toThrow(); }); @@ -243,7 +243,7 @@ define([ 0.5, positionA, null, - Position.ZERO); + new Position()); }).toThrow(); }); diff --git a/test/geom/Sector.test.js b/test/geom/Sector.test.js index 76a5b5e52..6306d5a22 100644 --- a/test/geom/Sector.test.js +++ b/test/geom/Sector.test.js @@ -57,7 +57,7 @@ define([ describe("Copies this sector to the latitude and longitude of a specified sector", function () { it("Copies the sector successfully", function () { - var sector = Sector.ZERO; + var sector = new Sector(0, 0, 0, 0); var sectorTarget = new Sector(37, 39, 13, 18); sector.copy(sectorTarget); @@ -69,7 +69,7 @@ define([ it("Should throw an exception on missing sector input", function () { expect(function () { - var sector = Sector.ZERO; + var sector = new Sector(0, 0, 0, 0); sector.copy(null); }).toThrow(); }); @@ -325,7 +325,7 @@ define([ it("Should throw an exception on missing sector input", function () { expect(function () { - var sector = Sector.ZERO; + var sector = new Sector(0, 0, 0, 0); sector.intersection(null); }).toThrow(); }); @@ -506,7 +506,7 @@ define([ it("Should throw an exception on missing sector input", function () { expect(function () { - var sector = Sector.ZERO; + var sector = new Sector(0, 0, 0, 0); sector.union(null); }).toThrow(); }); From 6a143db225469cf6e148c7bc9c057d18a774242f Mon Sep 17 00:00:00 2001 From: pdavidc Date: Tue, 16 Oct 2018 16:27:46 -0700 Subject: [PATCH 072/112] Replaced build dependency grunt-contrib-compress with grunt-zip --- Gruntfile.js | 37 +- package-lock.json | 1461 +++------------------------------------------ package.json | 2 +- 3 files changed, 87 insertions(+), 1413 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 2109735eb..2daa566ab 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -77,27 +77,6 @@ module.exports = function (grunt) { 'build/' ], - compress: { - images: { - options: { - archive: 'build/dist/images.zip' - }, - files: [ - {src: ['images/**']} - ] - }, - dist: { - options: { - archive: 'build/WebWorldWind-Distribution-<%= pkg.version %>.zip' - }, - files: [{ - expand: true, - cwd: 'build/dist/', - src: ['**/*'] - }] - } - }, - copy: { main: { files: [ @@ -119,15 +98,27 @@ module.exports = function (grunt) { } ] } + }, + + zip: { + images: { + src: ['images/**'], + dest: 'build/dist/images.zip' + }, + dist: { + cwd: 'build/dist', + src: ['build/dist/**'], + dest: 'build/WebWorldWind-Distribution-<%= pkg.version %>.zip' + } } }); grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-contrib-compress'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.loadNpmTasks('grunt-jsdoc'); grunt.loadNpmTasks('grunt-karma'); + grunt.loadNpmTasks('grunt-zip'); - grunt.registerTask('default', ['clean', 'karma', 'jsdoc', 'requirejs', 'copy', 'compress']); + grunt.registerTask('default', ['clean', 'karma', 'jsdoc', 'requirejs', 'copy', 'zip']); }; diff --git a/package-lock.json b/package-lock.json index d675902d8..db174ad05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,113 +60,6 @@ "normalize-path": "^2.1.1" } }, - "archiver": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-1.3.0.tgz", - "integrity": "sha1-TyGU1tj5nfP1MeaIHxTxXVX6ryI=", - "dev": true, - "requires": { - "archiver-utils": "^1.3.0", - "async": "^2.0.0", - "buffer-crc32": "^0.2.1", - "glob": "^7.0.0", - "lodash": "^4.8.0", - "readable-stream": "^2.0.0", - "tar-stream": "^1.5.0", - "walkdir": "^0.0.11", - "zip-stream": "^1.1.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "archiver-utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-1.3.0.tgz", - "integrity": "sha1-5QtMCccL89aA4y/xt5lOn52JUXQ=", - "dev": true, - "requires": { - "glob": "^7.0.0", - "graceful-fs": "^4.1.0", - "lazystream": "^1.0.0", - "lodash": "^4.8.0", - "normalize-path": "^2.0.0", - "readable-stream": "^2.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -247,15 +140,6 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, - "async": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", - "dev": true, - "requires": { - "lodash": "^4.14.0" - } - }, "async-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", @@ -395,53 +279,6 @@ "integrity": "sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==", "dev": true }, - "bl": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.1.tgz", - "integrity": "sha1-ysMo977kVzDUBLaSID/LWQ4XLV4=", - "dev": true, - "requires": { - "readable-stream": "^2.0.5" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "blob": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", @@ -528,12 +365,6 @@ "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", "dev": true }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true - }, "buffer-fill": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", @@ -754,56 +585,6 @@ "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", "dev": true }, - "compress-commons": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-1.2.0.tgz", - "integrity": "sha1-WFhwku8g03y1i68AARLJJ4/3O58=", - "dev": true, - "requires": { - "buffer-crc32": "^0.2.1", - "crc32-stream": "^2.0.0", - "normalize-path": "^2.0.0", - "readable-stream": "^2.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "concat-stream": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", @@ -858,60 +639,6 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, - "crc": { - "version": "3.4.4", - "resolved": "https://registry.npmjs.org/crc/-/crc-3.4.4.tgz", - "integrity": "sha1-naHpgOO9RPxck79as9ozeNheRms=", - "dev": true - }, - "crc32-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-2.0.0.tgz", - "integrity": "sha1-483TtN8xaN10494/u8t7KX/pCPQ=", - "dev": true, - "requires": { - "crc": "^3.4.4", - "readable-stream": "^2.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -1079,15 +806,6 @@ "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", "dev": true }, - "end-of-stream": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.0.tgz", - "integrity": "sha1-epDYM+/abPpurA9JSduw+tOmMgY=", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, "engine.io": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.2.0.tgz", @@ -2340,20 +2058,6 @@ } } }, - "grunt-contrib-compress": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/grunt-contrib-compress/-/grunt-contrib-compress-1.4.3.tgz", - "integrity": "sha1-Ac7/ucY39S5wgfRjdQmD0KOw+nM=", - "dev": true, - "requires": { - "archiver": "^1.3.0", - "chalk": "^1.1.1", - "iltorb": "^1.0.13", - "lodash": "^4.7.0", - "pretty-bytes": "^4.0.2", - "stream-buffers": "^2.1.0" - } - }, "grunt-contrib-copy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-1.0.0.tgz", @@ -2504,6 +2208,22 @@ } } }, + "grunt-retro": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/grunt-retro/-/grunt-retro-0.6.4.tgz", + "integrity": "sha1-8mqEj2pHl6X/foUOYCIMDea+jnI=", + "dev": true + }, + "grunt-zip": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/grunt-zip/-/grunt-zip-0.18.1.tgz", + "integrity": "sha512-5LJ5/m1T2yun2PBG3Wtv9WJkp23MSVRL025is94Mptl1qBShy7JU5CBXaS958yafTBXxAbfi4lvES/KwshJ6cA==", + "dev": true, + "requires": { + "grunt-retro": "~0.6.0", + "jszip": "~2.5.0" + } + }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -2652,921 +2372,53 @@ "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", "dev": true }, - "iltorb": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/iltorb/-/iltorb-1.3.5.tgz", - "integrity": "sha512-ICC02apBTK7ganmU9nEBiHGaeEnlUP0wsBfdyRqnZLaxjt2iRkPin/Pft7ig75gjwoAjtlwFrELqIp8UoAz0mw==", + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, - "optional": true, "requires": { - "nan": "^2.6.1", - "node-pre-gyp": "^0.6.34" + "kind-of": "^3.0.2" }, "dependencies": { - "abbrev": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true - }, - "ajv": { - "version": "4.11.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "co": "^4.6.0", - "json-stable-stringify": "^1.0.1" - } - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "aproba": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.4", - "bundled": true, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, - "optional": true, "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "asn1": { - "version": "0.2.3", - "bundled": true, - "dev": true, - "optional": true - }, - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "bundled": true, - "dev": true, - "optional": true - }, - "aws-sign2": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "aws4": { - "version": "1.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "block-stream": { - "version": "0.0.9", - "bundled": true, - "dev": true, - "requires": { - "inherits": "~2.0.0" - } - }, - "boom": { - "version": "2.10.1", - "bundled": true, - "dev": true, - "requires": { - "hoek": "2.x.x" - } - }, - "brace-expansion": { - "version": "1.1.8", - "bundled": true, - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "caseless": { - "version": "0.12.0", - "bundled": true, - "dev": true, - "optional": true - }, - "co": { - "version": "4.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "combined-stream": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "cryptiles": { - "version": "2.0.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "boom": "2.x.x" - } - }, - "dashdash": { - "version": "1.14.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "debug": { - "version": "2.6.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ms": "0.7.2" - } - }, - "deep-extend": { - "version": "0.4.2", - "bundled": true, - "dev": true, - "optional": true - }, - "delayed-stream": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "ecc-jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsbn": "~0.1.0" - } - }, - "extend": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "extsprintf": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "forever-agent": { - "version": "0.6.1", - "bundled": true, - "dev": true, - "optional": true - }, - "form-data": { - "version": "2.1.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.12" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "fstream": { - "version": "1.0.11", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - } - }, - "fstream-ignore": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "fstream": "^1.0.0", - "inherits": "2", - "minimatch": "^3.0.0" - } - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "getpass": { - "version": "0.1.7", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.1.1", - "bundled": true, - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.2", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "graceful-fs": { - "version": "4.1.11", - "bundled": true, - "dev": true - }, - "har-schema": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "optional": true - }, - "har-validator": { - "version": "4.2.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ajv": "^4.9.1", - "har-schema": "^1.0.5" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "hawk": { - "version": "3.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "boom": "2.x.x", - "cryptiles": "2.x.x", - "hoek": "2.x.x", - "sntp": "1.x.x" - } - }, - "hoek": { - "version": "2.16.3", - "bundled": true, - "dev": true - }, - "http-signature": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "dependencies": { - "assert-plus": { - "version": "0.2.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true, - "dev": true - }, - "ini": { - "version": "1.3.4", - "bundled": true, - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-typedarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "isstream": { - "version": "0.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "bundled": true, - "dev": true, - "optional": true - }, - "json-stable-stringify": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsonify": "~0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "jsonify": { - "version": "0.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "jsprim": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.0.2", - "json-schema": "0.2.3", - "verror": "1.3.6" - } - }, - "mime-db": { - "version": "1.27.0", - "bundled": true, - "dev": true - }, - "mime-types": { - "version": "2.1.15", - "bundled": true, - "dev": true, - "requires": { - "mime-db": "~1.27.0" - } - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "0.7.2", - "bundled": true, - "dev": true, - "optional": true - }, - "node-pre-gyp": { - "version": "0.6.36", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "mkdirp": "^0.5.1", - "nopt": "^4.0.1", - "npmlog": "^4.0.2", - "rc": "^1.1.7", - "request": "^2.81.0", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^2.2.1", - "tar-pack": "^3.4.0" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npmlog": { - "version": "4.1.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "oauth-sign": { - "version": "0.8.2", - "bundled": true, - "dev": true, - "optional": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "performance-now": { - "version": "0.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "1.0.7", - "bundled": true, - "dev": true - }, - "qs": { - "version": "6.4.0", - "bundled": true, - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "deep-extend": "~0.4.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.3.1", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.0", - "string_decoder": "~1.0.0", - "util-deprecate": "~1.0.1" - } - }, - "request": { - "version": "2.81.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~2.1.1", - "har-validator": "~4.2.1", - "hawk": "~3.1.3", - "http-signature": "~1.1.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.7", - "oauth-sign": "~0.8.1", - "performance-now": "^0.2.0", - "qs": "~6.4.0", - "safe-buffer": "^5.0.1", - "stringstream": "~0.0.4", - "tough-cookie": "~2.3.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.0.0" - } - }, - "rimraf": { - "version": "2.6.1", - "bundled": true, - "dev": true, - "requires": { - "glob": "^7.0.5" - } - }, - "safe-buffer": { - "version": "5.1.1", - "bundled": true, - "dev": true - }, - "semver": { - "version": "5.3.0", - "bundled": true, - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "sntp": { - "version": "1.0.9", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "hoek": "2.x.x" - } - }, - "sshpk": { - "version": "1.13.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "tweetnacl": "~0.14.0" - } - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "~5.0.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.0.1", - "bundled": true, - "dev": true - } - } - }, - "stringstream": { - "version": "0.0.5", - "bundled": true, - "dev": true, - "optional": true - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "tar": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "block-stream": "*", - "fstream": "^1.0.2", - "inherits": "2" - } - }, - "tar-pack": { - "version": "3.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "^2.2.0", - "fstream": "^1.0.10", - "fstream-ignore": "^1.0.5", - "once": "^1.3.3", - "readable-stream": "^2.1.4", - "rimraf": "^2.5.1", - "tar": "^2.2.1", - "uid-number": "^0.0.6" - } - }, - "tough-cookie": { - "version": "2.3.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "punycode": "^1.4.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "tunnel-agent": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "bundled": true, - "dev": true, - "optional": true - }, - "uid-number": { - "version": "0.0.6", - "bundled": true, - "dev": true, - "optional": true - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "uuid": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "verror": { - "version": "1.3.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "extsprintf": "1.0.2" - } - }, - "wide-align": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "string-width": "^1.0.2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true - } - } - }, - "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "dev": true, - "requires": { - "repeating": "^2.0.0" - } - }, - "indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "^1.1.5" } } } @@ -3854,6 +2706,15 @@ "verror": "1.10.0" } }, + "jszip": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-2.5.0.tgz", + "integrity": "sha1-dET9hVHd8+XacZj+oMkbyDCMwnQ=", + "dev": true, + "requires": { + "pako": "~0.2.5" + } + }, "karma": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/karma/-/karma-3.0.0.tgz", @@ -3980,53 +2841,6 @@ "graceful-fs": "^4.1.9" } }, - "lazystream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", - "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", - "dev": true, - "requires": { - "readable-stream": "^2.0.5" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -4274,13 +3088,6 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "nan": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz", - "integrity": "sha1-5P805slf37WuzAjeZZb0NgWn20U=", - "dev": true, - "optional": true - }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -4463,6 +3270,12 @@ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, + "pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=", + "dev": true + }, "parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", @@ -4596,18 +3409,6 @@ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", "dev": true }, - "pretty-bytes": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz", - "integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=", - "dev": true - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true - }, "progress": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", @@ -5275,12 +4076,6 @@ "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", "dev": true }, - "stream-buffers": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/stream-buffers/-/stream-buffers-2.2.0.tgz", - "integrity": "sha1-kdX1Ew0c75bc+n9yaUUYh0HQnuQ=", - "dev": true - }, "streamroller": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-0.7.0.tgz", @@ -5364,56 +4159,6 @@ "integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=", "dev": true }, - "tar-stream": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.5.4.tgz", - "integrity": "sha1-NlSc8E7RrumyowwBQyUiONr5QBY=", - "dev": true, - "requires": { - "bl": "^1.0.0", - "end-of-stream": "^1.0.0", - "readable-stream": "^2.0.0", - "xtend": "^4.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "throttleit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", @@ -5717,12 +4462,6 @@ "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", "dev": true }, - "walkdir": { - "version": "0.0.11", - "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.0.11.tgz", - "integrity": "sha1-oW0CXrkxvQO1LzCMrtD0D86+lTI=", - "dev": true - }, "which": { "version": "1.2.14", "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", @@ -5781,12 +4520,6 @@ "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=", "dev": true }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, "yauzl": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", @@ -5801,56 +4534,6 @@ "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=", "dev": true - }, - "zip-stream": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-1.2.0.tgz", - "integrity": "sha1-qLxF9MG0lpnGuQGYuqyqzbzUugQ=", - "dev": true, - "requires": { - "archiver-utils": "^1.3.0", - "compress-commons": "^1.2.0", - "lodash": "^4.8.0", - "readable-stream": "^2.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } } } } diff --git a/package.json b/package.json index 2dd318b0b..a22b435a0 100644 --- a/package.json +++ b/package.json @@ -32,11 +32,11 @@ "devDependencies": { "grunt": "^1.0.3", "grunt-contrib-clean": "^2.0.0", - "grunt-contrib-compress": "^1.4.3", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-requirejs": "^1.0.0", "grunt-jsdoc": "^2.3.0", "grunt-karma": "^3.0.0", + "grunt-zip": "^0.18.1", "jasmine-core": "^3.2.1", "karma": "^3.0.0", "karma-chrome-launcher": "^2.2.0", From 07bfe9d0c078bfb638fd876a8667dbb6b24becf1 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 17 Oct 2018 17:54:56 +0300 Subject: [PATCH 073/112] manage control points and detect double click event --- src/util/editor/ShapeEditor.js | 74 ++++++++++++++++++++++++++++------ 1 file changed, 62 insertions(+), 12 deletions(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 2b7b0e031..19b5c451b 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -216,6 +216,17 @@ define([ this.originalHighlightAttributes = new ShapeAttributes(null); this.originalPlacemarkHighlightAttributes = new PlacemarkAttributes(null); + // Internal use only. + // counters used to detect double click + this._clicked0X = null; + this._clicked0Y = null; + this._clicked1X = null; + this._clicked1Y = null; + this._click0Time = 0; + this._click1Time = 0; + this._dbclickTimeout = 0; + this._clickDelay = 500; + this._worldWindow.worldWindowController.addGestureListener(this); }; @@ -454,6 +465,22 @@ define([ var pickList = this._worldWindow.pick(mousePoint); var terrainObject = pickList.terrainObject(); + if (this._click0Time && !this._click1Time) { + this._clicked1X = x; + this._clicked1Y = y; + this._click1Time = Date.now() - this._click0Time; + } else { + this._clicked0X = x; + this._clicked0Y = y; + this._click0Time = Date.now(); + this._click1Time = 0; + clearTimeout(this._dbclickTimeout); + this._dbclickTimeout = setTimeout(function () { + this._click0Time = 0; + }, this._clickDelay + ); + } + for (var p = 0, len = pickList.objects.length; p < len; p++) { var object = pickList.objects[p]; @@ -461,12 +488,12 @@ define([ var userObject = object.userObject; if (userObject === this._shape) { - this.beginAction(terrainObject.position, event.ctrlKey); + this.beginAction(terrainObject.position, this._allowManageControlPoint); event.preventDefault(); break; } else if (this.controlPointsLayer.renderables.indexOf(userObject) !== -1) { - this.beginAction(terrainObject.position, event.ctrlKey, userObject); + this.beginAction(terrainObject.position, this._allowManageControlPoint, userObject); event.preventDefault(); break; } @@ -477,6 +504,19 @@ define([ // Internal use only. // Updates the current action if any. ShapeEditor.prototype.handleMouseMove = function (event) { + + if (this._click0Time && !this._click1Time) { + this._clicked1X = event.clientX; + this._clicked1Y = event.clientY; + } + + if (!(this._clicked0X === this._clicked1X + && this._clicked0Y === this._clicked1Y)) { + clearTimeout(this._dbclickTimeout); + this._click0Time = 0; + this._click1Time = 0; + } + if (this.actionType) { var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); @@ -492,6 +532,7 @@ define([ } } else { if (this._allowReshape || this._allowRotate) { + this.actionSecondaryBehavior = false; this.reshape(terrainObject.position); } else { Logger.logMessage(Logger.LEVEL_INFO, "ShapeEditor", "handleMouseMove", @@ -510,15 +551,22 @@ define([ var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); var terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); - - // The editor provides vertex insertion and removal for SurfacePolygon and - // SurfacePolyline. Shift-clicking when the cursor is over the shape inserts a control point near the position - // of the cursor. Ctrl-clicking when the cursor is over a control point removes that particular control point. + // The editor provides vertex insertion and removal for SurfacePolygon and SurfacePolyline. + // Shift-clicking when the cursor is over the shape inserts a control point near the position + // of the cursor. if (this.actionType) { - if (this.actionControlPoint - && terrainObject - && event.ctrlKey) { - this.reshape(terrainObject.position); + if (this._click0Time && this._click1Time) { + if (this._click1Time <= this._clickDelay) { + if (this.actionControlPoint + && terrainObject + && this._allowManageControlPoint) { + this.actionSecondaryBehavior = true; + this.reshape(terrainObject.position); + } + } + clearTimeout(this._dbclickTimeout); + this._click0Time = 0; + this._click1Time = 0; } this.endAction(); @@ -527,7 +575,8 @@ define([ if (terrainObject && this.actionStartX === this.actionCurrentX && this.actionStartY === this.actionCurrentY - && event.shiftKey) { + && event.shiftKey + && this._allowManageControlPoint) { this.activeEditorFragment.addNewVertex( this._shape, this._worldWindow.globe, @@ -612,7 +661,8 @@ define([ var purpose = this.actionControlPoint.userProperties.purpose; if ((purpose === ShapeEditorConstants.ROTATION && this._allowRotate) || - (purpose !== ShapeEditorConstants.ROTATION) && this._allowReshape) { + (purpose !== ShapeEditorConstants.ROTATION && this._allowReshape) || + (purpose === ShapeEditorConstants.LOCATION && this._allowManageControlPoint && this.actionSecondaryBehavior)) { this.activeEditorFragment.reshape( this._shape, this._worldWindow.globe, From 778e7f12eafdf44f82a47ec3cd906094595f8816 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 22 Oct 2018 13:33:55 +0300 Subject: [PATCH 074/112] long press to add new vertex --- src/util/editor/ShapeEditor.js | 56 +++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 19b5c451b..d7b319a9e 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -217,7 +217,7 @@ define([ this.originalPlacemarkHighlightAttributes = new PlacemarkAttributes(null); // Internal use only. - // counters used to detect double click + // counters used to detect double click (time measured in ms) this._clicked0X = null; this._clicked0Y = null; this._clicked1X = null; @@ -227,6 +227,12 @@ define([ this._dbclickTimeout = 0; this._clickDelay = 500; + // Internal use only. + // counters used to detect long press event (time measured in ms) + this._longPressTimeout = 0; + this._longPressDelay = 1500; + + this._worldWindow.worldWindowController.addGestureListener(this); }; @@ -481,6 +487,34 @@ define([ ); } + var allowVertex = terrainObject + && this.actionStartX === this.actionCurrentX + && this.actionStartY === this.actionCurrentY + && this._allowManageControlPoint; + + // counter for long-press detection + clearTimeout(this._longPressTimeout); + + var context = this; + + + // The editor provides vertex insertion and removal for SurfacePolygon and SurfacePolyline. + // Long press when the cursor is over the shape inserts a control point near the position + // of the cursor. + this._longPressTimeout = setTimeout(function () { + if (allowVertex) { + context.activeEditorFragment.addNewVertex( + context._shape, + context._worldWindow.globe, + terrainObject.position + ); + + context.updateControlElements(); + context._worldWindow.redraw(); + } + }, this._longPressDelay + ); + for (var p = 0, len = pickList.objects.length; p < len; p++) { var object = pickList.objects[p]; @@ -517,6 +551,8 @@ define([ this._click1Time = 0; } + clearTimeout(this._longPressTimeout); + if (this.actionType) { var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); @@ -552,8 +588,7 @@ define([ var terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); // The editor provides vertex insertion and removal for SurfacePolygon and SurfacePolyline. - // Shift-clicking when the cursor is over the shape inserts a control point near the position - // of the cursor. + // Double clicking when the cursor is over a control point will remove it. if (this.actionType) { if (this._click0Time && this._click1Time) { if (this._click1Time <= this._clickDelay) { @@ -572,20 +607,7 @@ define([ this.endAction(); } - if (terrainObject - && this.actionStartX === this.actionCurrentX - && this.actionStartY === this.actionCurrentY - && event.shiftKey - && this._allowManageControlPoint) { - this.activeEditorFragment.addNewVertex( - this._shape, - this._worldWindow.globe, - terrainObject.position - ); - - this.updateControlElements(); - this._worldWindow.redraw(); - } + clearTimeout(this._longPressTimeout); }; // Internal use only. From 6bf09e2dce1ee22cd4b89047a1f3819372bcbe76 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Tue, 30 Oct 2018 18:25:16 +0200 Subject: [PATCH 075/112] Add moveTo and getReferencePosition methods - used in Shape Editor (#789) --- src/shapes/Placemark.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/shapes/Placemark.js b/src/shapes/Placemark.js index 8d3c16da4..967b9ca0f 100644 --- a/src/shapes/Placemark.js +++ b/src/shapes/Placemark.js @@ -794,5 +794,15 @@ define([ && (!dc.pickingMode || this.enableLeaderLinePicking); }; + // Internal use only. Intentionally not documented. + Placemark.prototype.getReferencePosition = function () { + return this.position; + }; + + // Internal use only. Intentionally not documented. + Placemark.prototype.moveTo = function (globe, position) { + this.position = position; + }; + return Placemark; }); \ No newline at end of file From 14a70fa81a3eebd925fb9824a6d9c03096a94f81 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 31 Oct 2018 17:00:51 +0200 Subject: [PATCH 076/112] update polyline attributes - increase value of outlineWidth --- examples/ShapeEditor.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index 192e614ec..052765eba 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -61,6 +61,14 @@ requirejs(['./WorldWindShim', var highlightAttributes = new WorldWind.ShapeAttributes(attributes); highlightAttributes.outlineColor = WorldWind.Color.RED; + var polylineAttributes = new WorldWind.ShapeAttributes(null); + polylineAttributes.outlineColor = WorldWind.Color.BLACK; + polylineAttributes.interiorColor = new WorldWind.Color(1, 1, 1, 1.0); + polylineAttributes.outlineWidth = 5; + + var polylineHighlightAttributes = new WorldWind.ShapeAttributes(polylineAttributes); + polylineHighlightAttributes.outlineColor = WorldWind.Color.RED; + var circleShape = new WorldWind.SurfaceCircle(new WorldWind.Location(35, -110), 200e3, attributes); circleShape.highlightAttributes = highlightAttributes; shapesLayer.addRenderable(circleShape); @@ -105,8 +113,8 @@ requirejs(['./WorldWindShim', polylineBoundaries.push(new WorldWind.Location(40, -115)); polylineBoundaries.push(new WorldWind.Location(43, -110)); polylineBoundaries.push(new WorldWind.Location(50, -120)); - var polylineShape = new WorldWind.SurfacePolyline(polylineBoundaries, attributes); - polylineShape.highlightAttributes = highlightAttributes; + var polylineShape = new WorldWind.SurfacePolyline(polylineBoundaries, polylineAttributes); + polylineShape.highlightAttributes = polylineHighlightAttributes; shapesLayer.addRenderable(polylineShape); var rectangleShape = new WorldWind.SurfaceRectangle(new WorldWind.Location(33, -105), 300e3, 200e3, 70, attributes); From 4f293f5ed822d18b7a29f3b94d514d5fd75dd8e7 Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Wed, 31 Oct 2018 10:30:32 -0700 Subject: [PATCH 077/112] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 5fcc7951c..9657ee9a3 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,21 @@ [![NPM](https://img.shields.io/npm/v/worldwindjs.svg)](https://www.npmjs.com/package/worldwindjs) ## A community supported and enhanced Web WorldWind library +___Note: This is personal project and is not the official Web WorldWind library from NASA___ __WorldWindJS__ is a fork of the popular [Web WorldWind](https://github.com/NASAWorldWind/WebWorldWind) library from NASA and ESA. This fork provides a release channel for builds based on the latest fixes and features from WebWorldWind's develop branch plus several enhancements from the WorldWind community. +This fork exists to support the development of several personal projects, including: + +- [Explorer](https://worldwind.earth/explorer) - the WorldWind Explorer +- [WMT v2.0](https://worldwind.earth/wildfire) - Wildfire Management Tool v2.0 _under development_ +- [Bible Atlas](https://viewer.earth/bible) - _under development_ +- [worldwind-react-globe](https://github.com/emxsys/worldwind-react-globe) - A React component for Web WorldWind +- [worldwind-react-globe-bs4](https://github.com/emxsys/worldwind-react-globe-bs4) - React Bootstrap4 UI components for Web WorldWind +- [worldwind-react-app](https://github.com/emxsys/worldwind-react-app) - A geo-browser web app using Web WorldWind with React and Bootstrap 4 + Show your support for this project by giving it a [star](https://github.com/emxsys/worldwindjs/stargazers)! ### Enhancements include: From aee3659c46ed4afe2ddada1952ad562af027f21c Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Wed, 31 Oct 2018 10:34:13 -0700 Subject: [PATCH 078/112] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9657ee9a3..508852c58 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ and features from WebWorldWind's develop branch plus several enhancements from t This fork exists to support the development of several personal projects, including: - [Explorer](https://worldwind.earth/explorer) - the WorldWind Explorer -- [WMT v2.0](https://worldwind.earth/wildfire) - Wildfire Management Tool v2.0 _under development_ -- [Bible Atlas](https://viewer.earth/bible) - _under development_ -- [worldwind-react-globe](https://github.com/emxsys/worldwind-react-globe) - A React component for Web WorldWind -- [worldwind-react-globe-bs4](https://github.com/emxsys/worldwind-react-globe-bs4) - React Bootstrap4 UI components for Web WorldWind -- [worldwind-react-app](https://github.com/emxsys/worldwind-react-app) - A geo-browser web app using Web WorldWind with React and Bootstrap 4 +- [WMT v2.0](https://worldwind.earth/wildfire) - Wildfire Management Tool v2.0 (_under development_) +- [Bible Atlas](https://viewer.earth/bible-atlas) - Geography and cartography of the Holy Land (_under development_) +- [worldwind-react-globe](https://emxsys.github.io/worldwind-react-globe/) - A React component for Web WorldWind +- [worldwind-react-globe-bs4](https://emxsys.github.io/worldwind-react-globe-bs4/) - React Bootstrap4 UI components for Web WorldWind +- [worldwind-react-app](https://emxsys.github.io/worldwind-react-app/) - A geo-browser web app using Web WorldWind with React and Bootstrap 4 Show your support for this project by giving it a [star](https://github.com/emxsys/worldwindjs/stargazers)! From 24758a78fa0e8307e48b097deddd1dfdce2230a0 Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Wed, 31 Oct 2018 10:40:35 -0700 Subject: [PATCH 079/112] Add files via upload --- docs/emxsys_logo.png | Bin 0 -> 14644 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/emxsys_logo.png diff --git a/docs/emxsys_logo.png b/docs/emxsys_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..00d0739b31c01899030b0976935ac5e7786e37a7 GIT binary patch literal 14644 zcmV-4Im^b0P)XA%)>_fN;tUEFZM9ZFv06Y8Q7AFYQvxA@3}m>u_de4(XYaLs zf9&&|Jh?ZCQQFVveRuMCKIficpS|~5d#&#p_CBQI0Vos#5Qs@dK~OM3RY?e}N=ix~ zKnbJ(0ji`B5~va}i2@2DFjPs%cvWRmg%DH~M8+$JdISuG5?A$wm#G#Oj)@dt5MTfW zse%aVLqlO0hE!CUSw)12MOhUDB2{$?Vlw5^DBq}r@F$=IQ3VkL1OP+;0H|m=0_BYW zgNRg>h{9EfKvakrKxj278$cjsM~K2}2h}2UfVez(7DZL}dA@4ov#H#cbp=wFBcq~B z94aObSBMaF0Z0Ym8Bv8Q69iyl9WWgRodA=DdzeJ3K`gsjb{&H* zl;ac5E0Ge2%KCJ0I*@`$044w=gDU=?DJ3_ANl-RE^a^3Fg8@Z3u@p4m9115(l7#ud zCH;t$RG2^#E(UH;Z;U5q5Hp~Go3)($8UzwpiBt&^xB(!jmIoAOdYHO|a11aM1OW^J zTQNwLSP&kn+COM<=mn&#aCkn^wBKpx%Z?KU+)&Pe(6+L{Q=k8Tqgch>k|zvLNvF_9 z73HdzL}V&)7l;f6P*7kNB_ay}DIkDX^$@2jfP*H42uhxngIW?Iuo4IiB``xseW1Mz z^pS@OIJ}2~hEg)B3TB9aSyf0?iIoHr1Q1viq$pJth+wGH002M?AoOJ);&&kA24jM1 zoCtwC2fU$BQUul~RboI?XduR_VGVzm{P=%ov89l%dP@~Uly^{=U_;VV_L8gR05e31 z!ccVjP(7{#hEP@P)n+YqgaTo*l~S?fg%S~X01TrbQGy1s%}lIdg<*(NtU;U$ zi3*iif~c&qq);h@Da<$skp!xdD5-$hdlm^8Bp^1`0bRl6%vCC(K}m|eyEujUf0H2# z%r<}x1J>37)9FBwR-Fm&8EE0(88`+jS9maG7PR6PL5V7>?d5mg?{SOOf;V5|um zke7ohF)>tC38d5$bxf&H>>L5C1|IN4s_Fp`symIt^r-N4puLpl2o#=5YXSrj5Ks*0 z={-OKrc_)c9)^gF3V|RX44`Ld5wlvA0VF|~ILb_-%B6N=kO2vlf9nY=5LPHy7^DMG zqFT-o0TW;d5{!!9ocDgSQrbTImmddy-0n3;Fc7YTpHi+;Wi17;EHtp8f;9~<>YfBuSSVjSx55Qp52xS=FaQi2z(OrJ0jJOyh>Zjevy4a~$_!O9M8xU^3Nj`%TvUlc zqCqM!Rd!G40ZMQTC1O>rY=GaM1|^u>`)ma?OM^}SOH})Tal`PzKJPhjfo0^TDq<(>p%(0N&WN)uZ+o9NgviL)fpwCU4^k85397fOs}m$DPDqJnMoC5qe#`S(nG~QBB@BGD1KJGPm%|hH*--1hyVz==2Hn)sHV=5b@+$zr30OLd1fT#R z!5}#2*qA7a0qh>%v0?q@`|jTO@LhItb4#|@OnXK{nz7X87O+JcNn%}MoZ&8z6PS#~ zkw?j99ij$|7i;^@!Hglt5TY5Lt@1VOdbR!v{773lKb{dwdH)r<8vV$gKg1C^SG;RSm8;lw+tvqgFn; z_pCigt#M#fxX=5iziWEg-`lD0OP`Hpf=c)wumX`F_>p=YRi#=w!Hqtch#E@9Y3v9V zIf^2R((bmgM;{qmdw=(ipKrbQo{{eEIW=uI(3r_Q+n5pNdeWP_)wMdD)}&6nG-rNv!YW?% zyxGf-vGW!PMJftwJqXTO@4?DtM*)zMA!1MLAOiM;g0v}QMA&%|0t*{)%t}neR=6PF zVHayKDb)iGR47}bNU5O~83>|jK|(^r%1Wvf91si`B7|5<>G9x$r0j1~4$`KmZkxgo zmPrXvQdO{0X>El-Pib0cH>z83q&D$n7=@EQvKTfpU{B_mF}>%0ck3;?*Z%66jhhme zFE-SQXP8JWMTJfJ(99DMOFk1B#Zlc*YB?rj*+goMCnuUa>3Qkx^6*|f3T6R&CTCg5 zIA&*Ajg@|+Nh?<0N7kR%)Y)>+z53mo794-#VW&KQ^rTaD!J$4DLkcEOAYyNA?i{OH zHefbH1Xv*`9Kjo~3WcZ!6Bx?yWP%;#39MW%EK4aSEWwI4C zC9VLGk}9|q2CAy?Oso(<2|dvQNSG36zI)e5YA`Xm?dNyy{O(QJukMQ`dQG*~QkG|3 zmlutiUv#J*aoD_7E9M-%G+Dmb&Y!Ds)CM=YHFhx)fEDmy5fX?paRC1$lG(oFJOW~P zAV=24#IF99r*}NLVQk|D_srJ*_@tTK-YVLSu1%it@ph?A#7b$#=@!MdMB}5EEPl~x z%@?0Ly5e|c^fTvElQ9ZKq*`Z0l3UHS$i>7GHH;?~h!-~Om@+1>3L;BLJpdF2i3bE) z0HneYgWLqfMOKL6EqpM$D{g=akwNf51y&=_KvPUH?1!mdS#nd(91H^8=WWyV!gTg3 z+u*$mQDXrq4&EG}Z00zn5^0X25szEhhOBRLI_lUZFMrMA zvtA&FFUi?xte!b|tRfV#79<%c5;Rys?gNQIL7cOyl2wgWIFp<)o=9EDD#gmdvJ{3l zq=11~VS*AD2tH9|AysAu0D_RR2Bj+uu5joyvS}IqrD1AK^#%=|`i%|_z$;VEkhmh8 z@WEQDjB6!An0#8ZA?&14?^{@Xr{^OgQPd?N1NXTp+Nur|;pZCI3l9P^a9l3a9 z-U3DB;0thusDO2_q28P@8?H{?gItO9Ee}G#mN){dXrCw}SOpV|B4Us#Bv+RONXx`J zzNxe6k?uX~cKvK^?}3f!Q@dw48d2jlLrgss-sVro^^H+u-m%B6e9eV3p8o z^Y_RGt_%_e4g8-|OCs$m(TB>cmI9&-T1w+JMS9lOwQ_cn|VHBjb>RtsqZrBrot!7k306&uWns% zfgU=iU9sn^+2bh7hf$CGP?o&2Q ztx!ZXWR3v@Wfh1gf%XdWKtF$c?b^rx{G>2A#Ai3D(f0HW}WSP*;U z9MA^X!}u)Qy=&~2Ten{KEq(OST2{>Nw&!O3K1FEE=-6bV@Xk1yd)C=2FTI40T8c(A z&XTYuAT5J1a0aA4^11FF$F?0m`k#MJPi|g3nJwS6b0Ud5anc?ceSrM3SDt&^hyO$y zMp=9kc_|2#piz1sgRh!dm9)y99HRFgv3x+>5T^1loIDs5Ii;Q{=PO3pFEKu!duIDX*WY;Kb>Dif)aI^Sam4SOJNNmkwAJb&O$u+-AXlGq#@NMth)1kY zz#9m`6J#K21R)!U8eStAWZOc^feUhg5TXkN4=VkJN+42!5i0%50mpa;D4c}{yr@7D zktEAm6gzi6_PrbLzv-sru}6<{{WPu>6B8-eru9i1J>z_P(P775dfDj9UWR5utfzO=$3gC*#e52+s6^rdaW7jAntjqR(`RA_ilQ2A@c4E04qG?G|I#P~u* zx$t9m|LW$iUHjyH4?O<`XC86hi$KE@C2yDHlr+II$@!oEH}po6vh=2nk3- zCT#h76{1MgXc-JZ$XzofC<_^N5>f@qG$G}nMN}CI_~12X9e7OH5F1ejS#lCVkUM~h zj6CxAFj6yjWqamNK zv>Nu}hCtU!c~^*Gm~sIDR0JCqBo%-d)&c=W4C96XJN73_hPBUdW2%>0uSx(jld5`0 z#3b&4AN~6eufBTOtofH-{=ON@m$z3g?Lb(FB{j;{OP@72aFLC*UsK4}bGpPd)y4WX(+YG|!?Op1g_ap6`5XV(aFWZ+sJ- zaca@aO=LlUI-|OE&6;2R+xMDTF(Z?ae%6U~bAz&^zRC4g{N5kh^Urcr*Y;D(kvJn-BE?V%8_sxCL>8_DxiH%k1$xXNY)nEJD@0?foSwcB! z3|sf<-7TGW&I_LNq4(&#L!g$_rjgnHh*f9R$H)O!5L?qan3pCtXj3od%u1A_RBB7eAljB&N*XDnB|vWe)&sY@{(S! zM?`TPJLjyms#+99nx@;gZ(qH7_13LhqbLebwcG6veBcA;op+vd?)KYnzxn2y*REar zh z{_TqY^RJ)&$DI#9rlOK(-er<^ebHB+i!W3%@tOLp$U5FXsTefrN;`WjiTMu2f=7{5NTzUGo&wWXs+FW$o#WUM} z`k@bhW%+S;ELr~8l4G7+bo3)jmOs37)tW`myWAI!#V>yP>8G7@d7k(CeG!58J@5KjMKGo9>e?%c$LWPRW76h%k86Ys=%@r6h(KJ!J-<=rCdJa^>@%v_6Y8rg_BVy-7q z#GF`4EG3p>%i%YQ*fKZLn3@0dJ%21kPeg9I@!y)YG_st;)-V}nB5F2jhUuv1EZzL{ zlioX*cfHTVXW}x~@3_40^8V?ko(v!|oF=g`Y>lyoTlJKgzIE-_L^N+ts`t`qyNNL! z-#PZr*WLBn*WR-1m?w@}xoy$0yAN6J=dakdXvLk!obb&RCqDYW{z^BjzvF-Z?Ug62 z{K4|$9(vBP4JNVKgTQui95ZvcdVrRMJHzWf@PQ8m*-#XPbIyvw z5bxf(b9b+I+KXRUZ_dbzzKxlz1%plOe9kIFtPmzv5einB3dB1R5h)y)jRIbT961ro zR=ih8h~m;9p*Sm?h~$NL9+4%G6@_yG2y@6=M5o&$;zu7_|G6ta|5tzY(ZZ2cmQu@V zoFrer>MM8Nb+<7jAYZsRNwR(qicT*VRe=D?kyW2bOopSv<)g1U@1zrs`}a>>vG%9` zxxCSsJ-Mq{=*+~WD4I6i{jG03c<$Q#mRWPqp507(4S;e960s{BGrOWV=9puMSo~h*IKV<0M^RDastUrDSAOA- z-hAodOAhzWgIGXOTHCUD%cnm584!UuilTnM*YEXAWPRa`A#rd{iAa0_a%$q7A{Rw{ zQG3|o=dAwFqjRo)?7QD@%%9!cHR+3fl=bHzGM)bT+6QKGL`7lqyofk&*0;vdjwC(p zwXa$9igP8k-g{%xqT5aDnB2aDGN0#JRI^1c&C$lk{^Fyrc+IPmI1ZUt&U<2nH8!{2 zddoZC`Oe+DcZW`T?>BAQ1RzlN6QB6R`t|E?yz$03jsvEU<)G3^L*jLg$tH#Ro*v5$T1nrp5BFgZC1px^I5{q)mE9C1Y82}_1WrPipsyiih(EdX@|r3sW6 zD7=rDXprPr0$n0z&T>a3uv24ts~#|)<&8>_VsUSD;n*ZxR9cs&967=xh9r+xmTERgPn}6 zL`zMnUPzJ0WL)kA+G@4VKmWW%ix1ytPcOds;%(cutzEme z*=)Ak?S8+%a^=ckXaq;Xm%j9+SHJqzciwrYwSni%CqMbgqmMrN&2N75`t|Go=#Tzr zVq(G=Qxt`&CP{MTl~H&}; z0I z#b;mk4vfqxMA=#*G?~d-B{cO9 zWMt&T6Hh$jj5B7=oO#$`ht+DeEXxAbgTkIafBu)h{N;1cJ$Liw%|W4v$cH}kp^=f1 zFMs*V>(;FcR1d84@sEG}6|Z;i{^_i}T)zbK;yjr_PIW-aGNG@UBo-s1JXtcoFd;PQ3Hp ztM-dx#qq}jU?vy_quy-PTg{Qt(bkL^^+u!FYBgHTW~ml z*9TmE{q@%e)DuM!fKyI6<(X%mIsLTL0VHvpBnf~^F1aMn^T|$IRWJYGYGW-x*2Vyi zS+U}YO`Fbp<*NXIV5|l3^{-#0s=cB!DHC3D@0`oj71Hbb%&YV}`Hro+?aB3@{lrh6 zf7;WFmOgR#iVX{o-?Z?=t&3J}Sa{6FqgMTB>GEG*d~xUDM`d^0b@M{idGTJI_pa~M z>AJh_KXT3?Eix@O2{2=ScF|CYqG;j5h3B7t{x#QJQxruo6S6Gp^?F&Bsp<_k+%R|U z+~5faFe{8nus_3@KmF4`4FEGd)$Mjw^^!|2!N7P4Xyey5CP|W&D_35A`Q;Bh@PKo! z*Xsq#g;@=QDP#tP6@_GiRwgnbC`VvY)^gdTk|>wUaZ6950uUkMZoe zbUU41r`zpxx}8pUaC#qBih$5F0fO@{I6ow_876Sk^0EE0qlcwtWjl0udoz3jMSkDXKx z(ZpJHnnqEpUT@WF&3bLt=x9An8_mY(=tz>J&1N&Wl{RnQ{DU9-;EiwBPcDZ502tg! zL_t)1<2Bb@6DS?LQUJQ$?gbZI@bQm-Jb(!d;+a7n1ZTiS7hUwxkAAe%=>(-vQT?Ke zE(${@BCS@-7?Y-Hnx;vTq(i0AXoQ1c*4}f^J%9IifA@}eydyX;N++0iB3?v9yr`)9 z;Ix!5cf+MpHuwOROW7bQc~-1AVFds-4B#M5-Xo4U^6|$X4-)Lg8^0d}UFh4Xr=GfN z*Dmke>tFXe07(>wrk{J>d3l~+`qsAqFp-Uu6u>E`oVI&>B6I$NSHB7XF|0KJuKn6q zRJG&!W8Qo3B~w2s($}K!J?EV7Ymsfc?j}KKtxvo_Qu% zgU-32VpO%;?dEy@*MI%jixw?9a71djB}9~_>FDSvfNy-`8>-sx_nmVVds67jqE&9^ zo*fhd_NQ_`1^~eDlH(vE@;radYhHcUS!Z>-yxn;LZm=)+s)P<>J+NV5ivVMOG7(VN-eO}n0HB#o`V zT65p0K7IWA|3pTb9NeH%0K~EBX!e2^oOScfx8AvC&HZ<+X-`aU-uBew#6*-NAnNz} zwMIJG?&P`a^?F;kZe6oxO_pUM5)j|Ib?csf`so0kM8ta^jLG1ReEjjpzx?GdhZ$n6 z?RLAz9COUoS6@AA)~w*A2#gY}fFNBy{NWG3;~np~^Ugchty{N!`}T>6iC(XVL4eyi z7jQ(2|BN8~bg*1a%2nrs)gsEGVe=ju$^bTz zafN@~>n{BL-~Ypd;m|DWB}om~E8qse7?bz2lTSV6_kQ-BoQfB5@P z5f9crE6#b@d9S$O0`Db_qgs*%CKxa^RlgyVLP)`dH)@D}eAD-@|A#NNp4fGC(P*Wn zqhqlz`jEnTA{Ud_ESs4`)>6^yJ@(`O(Agu)KlnE5gyRTWh_OV;yWRfmXFnSzeZYDX6BA=&V}~Dp_;73~7!*+y z{pDZ&<&8JqxOMARV@#mghd=z`!w)~a-|xq999+)9;1rQ0Nxt>1Z*ADHp;oIk8Vyx_ z&1+t>YSpSKqaBQhPNy?AHg@*eXFv7SQ*d&CP*g(a?S&I=9wK^w{Fd{tkQW?;;JG(iegorIddieBCc-0Ah(CD@!r4l-S7J6 zZ-0C1wrv3gSYt(%Rfu5Yc=iAMGaK8WkWPqGNB*u6HqvP$LUVF{W zS6wqJceCrJpxzUS-_$gVeXZ3lmd}_w*7s4CTlL~HOPDA9Be=iypRRdy#)9L2|3a5} z%o^E}<@1;ySiAnC@BUwr&po^Y=8d!tIpl`Z&Nz#s7yvj#p$vd#v)ODm4?Xly3?i0+ zA*#S*mEjVK_kLt#Bq)?1P5`878aN;Xx~e#2Q1)N^;unAX;~!Uqzxd*duf6u#Dcleg z@#yI2=;&zhI~il92RZHDrv@l2z{7HmQR#guT~8pOa4wGHcDo(oZ&lwu^O?_l^PAu7 z_xr<{8dbM3Fq0N9Ui|sbe}3M)c_Cy6AdcgrD1rcNwp#7U$)k>1{wME!@9Nd7Z4`<3 zg?HANIEs2%{?{h5_OskZRuqvnK@4axxV9DO_A{Og^#x>Q7&B_pLu2 zb)szgDkkELHBCpi?3!G4{&{D<=6BY8@oNwLOzyJO3zvV4& zIqImRLSn>laznr0U%Phg!w)|k$PvbT{`~pjDl^+DnN;DYOzzy1-Wym&2@DcaFi{Xz z!&*N{k_{U+Y}l{?zpiZCwk>GTAnq#fX`bgvl6dDDjYhB6yX2BfuD<%}2OoUUS`)BI z?);*K3*UeF`@EE`vWC?;0Fkx6$N_lgRAE$Io+U|yDE-yVKmMoBUAgX_`{vY}#I|p_sjkwKj?(V@#{n3XT!yTnM5BaT3@( z$d5RVXU&@Rk&k?YnGM^>M!`pa*=3h3S#kua#Mb(vP#?k|Gb+-S7d3t-KsQaT=w2SJLiwz#UqU|o3~Cq?zH#6qkqI< zn(wDtNMGEiYSuHkb#L-BzHltZ< zHX5x~Gfk34tI=#VYqeUl*{s*=VX zzyuN9lZvB6@T&ECJ%C|V4G1=P$A&pq_m(_W5s`MgJ$LTh(6PPTVL%AISZkeguYBbz z&pGFun{K)Z0E3S?diguw`7ZCgs(M#gYoVI=dqInKI$Z!+yG=w%+I;NJpM3sPpIQ6! zU$!`!88;GRihdp?2{qEkwr@M}q!Zu#)^{yDdNt~ zs3S$+C51GjVsV^2b?<$5U-`u|-ha8N)fxVO|MmYjXU?o|fA>2Z*F6rPjRJYGS0@LZ zs>&gU9I|4?iVH8i@UqJ;>-YQB;8ZvuXpL^S8x%pHJu?Rm2tXl8k}5?iAiC{1A~m&ug{X#*G`Fc;X4mhL~o}ntjx==dd;HPP<-D#fy5se*Lc@wxS8T}|u_RBQEmpV9Wki(dQ6i{JIunTIX) z^K^?DCI^iaFqPLd=H^0H;i=FXiPhSxb)p#&ldj1ooB#KgoSk37~@=n z&imcBzvcY@aS`ty5^>PP5~qn34T(yP@rd+`hB zzy8nuEI#=pr>fRO_1`SVq?+!P@UJGi4y~@4{$P;1m1-WYFbrDd&p!APOq(k6iuNhY zhZ(k_dcea0^o7}9-C4DDist}(FYK!1Vd!v0@8KlRaB@lw-iI}_T#a3x_v0iYVkU?< z5;956b=o&wf5X*Z{L-)1-0hs7)vPxyv6Gl=Gp@V5$i19#)|qc!{l3GVyUKSb3rk{S zXVQk(u&~ctRhEKsllPOyHeGw^dzS3*HMp#nb#tFbiK{ms?M^N}>BI~E{3Epm^YeZ` zYBrn~A~jT$W?0zIu-sCS_UsU+s-)%iGkdR#(!JMOVQ2x&FpCV&oa*ZEfQP}HPKD}` zVcj%5&eid+kqu#;MGy&Ljs}GnQ0^2Pa!MnnG-&w#sv8G*yt+q1W-OZl+mZJfAjBNU zHGq2KV>jLO!*5*m)wOrsJ-%yqGp&t|w2EG@5ycE*GQRMKFFE{o|KRt}f72V|R$a0# znzeqOXHZRqQfMLJS$x!|TYZ$syA=cph$g zbx){D%cO5nMUtif1I5NC*8Sjy8?OD@HTSQ*r|bMkn#`Qhba^o`F`mYCr%CSfw3eKG z{!8EX?sqLcaYfPVDa0kQFT62P;q!!J7zV_r*|~Mq&S&N~mWV-Q!Zs-2lDuIHY$8&Tu=#fI;+9)H49|yQVoc|QeR9VB zMr?og4==}Vwr3#+U~lc;MDsZ(YBBeVV4Ho_gxpXP+Hn9vD(TQv}x@`Lp-B zfa*X8F8ApRNGeGfE-{fSoH2&20kCuDGe7&;Pk;R5A7B67>z{mTGXo8xdK|@Z?6W)} zQ%jTGS{fS_q1SqDz6g`=j8#W^;Kx*?#O;cB1Ry6v`~{p{a=@WWsH=NBL`2>>0bX#@*>8T++h2Im%Ug%ET;CT))f%s&B8fHd4oZvS=MG>4y>J|T7BoZbsh96&ZqX+dyT0cf||-}~P8zVel? z+;!JolarG(XU=^7^PhkE>8Gz)v0~Y>Wg{aaGiS~Wp7!ZAS7R}SA@+Im`1ttP*x2Kb zKfY$onp#lIdTDxr7vgON{FI~EH-n@Bp=gyryd-mw)=plz360$AA?=bm`qUd(Jola+b ze0*YJV(ZqeyLRo`x^?Sgk3IItBab}z;Dc3uDF6Z)V`6J^=R_oqY+kqkbz9BmdFPz- zJ8!t?{FlGH-kPD_Iq#Ujh6nMu0X{|rtApqrmjhX@Al3j5 z29N+KgE)Z&h{_!*i7P~*dqd{^5wE(Z(xKA{bnvCBp;~KIy`A>9Q?O6jP&E|O777ku zEs7!}Vr<^L`QCf)z4g{xzxTcGJ@UvSQv_F%B&}9!WMsq`6P%-!3J4rp6h*(^@AZ0} zPN&!Fg@q-K4HuYCrV36sRhfB8G@mNkqA1i;^1x-*CxCQ;1PkKV((y z&rCS5mGNs!Rm1*d(q4b=Q&Z?PI}p=cAAyj;ogSz=Ha7Oa0}tGI%NQ>s8tNC~eR9mG;~+vv!QWlNWydFGifKmYvao^;Zz*>eCCdFG13SQ|KjOJkwj z06e7Y4wlO*sLX`{4J@cKBVsTzNa2OfCf;fEjIuwla!PdrhPHWVHd z4BRFdfT<}isj9S^&7+T6{+y$iuRQ+vv(7qm#qq~CTQdMa)fI)RurbCM?_Ai-)J6fv zl`BAqsoYq4cotS>bRfwP{;#Y-lnP_;RC%dXE`yB)DC7YIH!Tq%Y`Kl_36?<|7{Ihi zKON}p^S0lvJX_gNaYH2xD(0AiCoq7fI>@{rqLBPvxs$UjTfct&mMvSJe){Q$9(rig zrcIkRZQ8tf^R8XHCMG7Put-&`wWFh>^XAPv^w2|>En9Zvkw-2&a_OSQix(|gG;jXA zK}X?Tp(@0dnZmlSAQ+0gASPo?g`oyXxhy*L1+(B6Dw9wGi|=9gp-EgWwXP;Z`1D2K z4^<62gKEer)PY6_%h8xY426nRAF=o^0R;Oj!?gb`*l52t#hyF%<3p^_uk5`OfDTF( z>>h4b$nXp(q0{N~`~3hR^E|iKCP`AS*TZipA+vP2hOjO%ke0(Yj9?TZ-c?h4XhaYY z;GppXEfG+Qs)Sv`fdDe8+Hg8xgz#;=YEOp2JshYW1O{o?l?W)es!<*6bzU{Q)FWl% z4nWA^c|2w0r+|zD5Os?DJ9y4GSf57q0-3fBe2Va>&J6QP_0<0C$pgGMWPo9yM>yze z4X!;^fS7~Ra?t0{`2jfvl_@0>b{ZOdrYu+u)rK2`4_fRc#-W2v@=B;lU_(KoV2^pC z;l)bj&TtBm@Bx+5ykyewok-rdH)$B;SDxHTPEX;6{f%L`VK{;4H!AyBiBZ)ug`tLd z4TGGvVOHJeZ_p#dZm*EB87@_@WB8@RI4c|n9Yhr3?`7TPzw&P;n(DPxRRuBc(fVap zSNU-TBIv+P5c&n8!H2R?>66lhL<$Bfi=%8$$#f`p_Yo!X17-zKS(rKis#Aw(xJ+sP z0S5NKWy+lgFB|s34Z}}XEU807a4`Kjz{!xi03hUJRjWjX8(kfQd-nKGXlUbqQl+3N z_IBt7`4k|2Nd6BWzN6~vXW<__Gq-VSzy9A{{o$hehHru~jvs z-bk3N<>p~D)Y{-=0yC?Wf0gr+!Y8nRuy7RRmsR(C=oEt~9a>&?p!{SNm5WKsFA;=2 zRyFKw$y~ZKs$J%Tj(}8u3=aMqxnZ9u@*o8Rel0gldDHOml=n^Xu1q;oF~l&*D^00; zFu$o{7D0XlMH8-8>X5;u{THNmxx+IJ$2))$^f9p@gqh0@P}ou341fcH%a5=OuB!qx zfJLfMuAGx7;|}FgjlH#JDMjsxwm#rZeVr1T@^eO7Bb&BpBj0-q+@M1JEDPeE5jfK0JLGfQzt62nHXR z*#inNkP3tDVo-B=HFS^$7b_n?xylE74rt)OuD-ihzI3Q|8hE{?d7`Fwe|UJOm;F(9 zpY%FFnKEd<4e~rd)jEV}r?+^R4~E-a9ZX@P1K=iAopND1H(5M6UGA5@#JjFVDHcp7?Z$C)wAVV9^;#tauDQEU48>UnU{2GZje8Vtq zm{KY#9(Xnki-Wz|PuLSy7;eLm)R;b`2RZXfF5kP_s)ju`JPX-yfMy&#H%z(n*WiYO zu^kRXiT#@x757Y;dBgoY01lcW8}>PU_nes~8_K`-{Ot7@22QK}wQ$NSrmN}!!yQOA qOdpnm={Tkh`1Fn+JZzlu$o~(->e@vqx3AFv0000 Date: Wed, 31 Oct 2018 10:41:47 -0700 Subject: [PATCH 080/112] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 508852c58..0c6064128 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![Emxsys](docs/emxsys_logo.png) + # WorldWindJS [![NPM](https://img.shields.io/npm/v/worldwindjs.svg)](https://www.npmjs.com/package/worldwindjs) From c6bdbeae1ec9ee97e9b2b7c06e1f2376bbed32b6 Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Wed, 31 Oct 2018 10:44:08 -0700 Subject: [PATCH 081/112] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c6064128..ddcf8dcc1 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ___Note: This is personal project and is not the official Web WorldWind library __WorldWindJS__ is a fork of the popular [Web WorldWind](https://github.com/NASAWorldWind/WebWorldWind) library from NASA and ESA. This fork provides a release channel for builds based on the latest fixes -and features from WebWorldWind's develop branch plus several enhancements from the WorldWind community. +and features from WebWorldWind's develop branch plus several "cherry-picked" enhancements from the WorldWind community. This fork exists to support the development of several personal projects, including: From e33b68cd66751e02e5f5e6ee7f4b162193c5e271 Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Wed, 31 Oct 2018 11:04:06 -0700 Subject: [PATCH 082/112] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ddcf8dcc1..c5e571c67 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ___Note: This is personal project and is not the official Web WorldWind library from NASA___ __WorldWindJS__ is a fork of the popular [Web WorldWind](https://github.com/NASAWorldWind/WebWorldWind) -library from NASA and ESA. This fork provides a release channel for builds based on the latest fixes +library from NASA (with contributions from ESA). This fork provides a release channel for builds based on the latest fixes and features from WebWorldWind's develop branch plus several "cherry-picked" enhancements from the WorldWind community. This fork exists to support the development of several personal projects, including: From 248f2e0be03492b7ee5c1d93e90f932a0a2e5839 Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Wed, 31 Oct 2018 11:11:28 -0700 Subject: [PATCH 083/112] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5e571c67..c2c640322 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ This fork exists to support the development of several personal projects, includ - [worldwind-react-globe-bs4](https://emxsys.github.io/worldwind-react-globe-bs4/) - React Bootstrap4 UI components for Web WorldWind - [worldwind-react-app](https://emxsys.github.io/worldwind-react-app/) - A geo-browser web app using Web WorldWind with React and Bootstrap 4 -Show your support for this project by giving it a [star](https://github.com/emxsys/worldwindjs/stargazers)! +WorldWindJS made available in the spirit of the NASA motto: _For the benefit of all._ Show your support for this project by giving it a [star](https://github.com/emxsys/worldwindjs/stargazers)! ### Enhancements include: From 253861d7c13760bf8be49abc20d3fd67706fa924 Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Wed, 31 Oct 2018 11:19:35 -0700 Subject: [PATCH 084/112] Update index.md --- docs/index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 5a1e418df..b8077e2a6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,7 +1,8 @@ # Overview +___Note: WorldWindJS is not the official Web WorldWind library from NASA___ [__WorldWindJS__](https://github.com/emxsys/worldwindjs) is a fork of the popular [Web WorldWind](https://github.com/NASAWorldWind/WebWorldWind) -library from NASA and ESA. This fork provides a release channel for builds based on the latest fixes +library from NASA (with contributions from ESA). This fork provides a release channel for builds based on the latest fixes and features from the WebWorldWind develop branch integrated with several enhancements from the WorldWind community. From f80eb9beb002fb18ac9bb27539aa0c4423fa3978 Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Wed, 31 Oct 2018 11:22:12 -0700 Subject: [PATCH 085/112] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c2c640322..5a153270d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ This fork exists to support the development of several personal projects, includ - [worldwind-react-globe-bs4](https://emxsys.github.io/worldwind-react-globe-bs4/) - React Bootstrap4 UI components for Web WorldWind - [worldwind-react-app](https://emxsys.github.io/worldwind-react-app/) - A geo-browser web app using Web WorldWind with React and Bootstrap 4 -WorldWindJS made available in the spirit of the NASA motto: _For the benefit of all._ Show your support for this project by giving it a [star](https://github.com/emxsys/worldwindjs/stargazers)! +WorldWindJS is made available in the spirit of the NASA motto: _For the benefit of all._ Show your support for this project by giving it a [star](https://github.com/emxsys/worldwindjs/stargazers)! ### Enhancements include: From fafa2b6a2fd47965d719b7aaa1d58a180cd865dd Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Wed, 31 Oct 2018 22:41:50 +0200 Subject: [PATCH 086/112] update placemark - use image pin --- examples/ShapeEditor.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index 052765eba..ca0685221 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -130,12 +130,18 @@ requirejs(['./WorldWindShim', placemark.altitudeMode = WorldWind.CLAMP_TO_GROUND; var placemarkAttributes = new WorldWind.PlacemarkAttributes(null); + placemarkAttributes.imageSource = WorldWind.configuration.baseUrl + "images/pushpins/plain-red.png"; + placemarkAttributes.imageScale = 1; + placemarkAttributes.imageOffset = new WorldWind.Offset( + WorldWind.OFFSET_FRACTION, 0.3, + WorldWind.OFFSET_FRACTION, 0.0); placemarkAttributes.imageColor = WorldWind.Color.WHITE; - placemarkAttributes.imageScale = 20; + placemarkAttributes.drawLeaderLine = true; + placemarkAttributes.leaderLineAttributes.outlineColor = WorldWind.Color.RED; var highlightPlacemarkAttributes = new WorldWind.PlacemarkAttributes(null); highlightPlacemarkAttributes.imageColor = WorldWind.Color.RED; - highlightPlacemarkAttributes.imageScale = 20; + highlightPlacemarkAttributes.imageScale = 1.2; placemark.attributes = placemarkAttributes; placemark.highlightAttributes = highlightPlacemarkAttributes; From c8539ec2f684e8a38e8ddf1750e9f37c75e02522 Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Sat, 3 Nov 2018 06:13:37 -0700 Subject: [PATCH 087/112] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5a153270d..aee593880 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,8 @@ WorldWindJS is made available in the spirit of the NASA motto: _For the benefit #### Changes from WebWorldWind release 0.9.0 - `NavigatorState` has been deprecated. Its properties have migrated to `DrawContext`. -#### From the WebWorldWind develop branch -- WorldWindJS is a drop in replacement for the WebWorldWind __worldwindjs__ and __worldwind.min.js__ libraries built from the WebWorldWind develop branch +#### Changes from the WebWorldWind develop branch +- WorldWindJS is a drop in replacement for WebWorldWind's __worldwind.js__ and __worldwind.min.js__ libraries built from the WebWorldWind develop branch. There are no changes to the API other than additions. ### Additional Resources #### Tutorials From fa5a86417e47c8b720c317fc655d3ddc6098c9ec Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Fri, 9 Nov 2018 15:14:28 +0200 Subject: [PATCH 088/112] update help text --- examples/ShapeEditor.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ShapeEditor.html b/examples/ShapeEditor.html index b1c644e89..6f8ec0bfc 100644 --- a/examples/ShapeEditor.html +++ b/examples/ShapeEditor.html @@ -19,8 +19,8 @@

World Wind Shape Editor

Dragging the body of the shape moves the whole shape. Dragging a control point performs the action associated with that control point. The editor provides vertex insertion and removal for SurfacePolygon and - SurfacePolyline. Shift-clicking when the cursor is over the shape inserts a control point near the position - of the cursor. Ctrl-clicking when the cursor is over a control point removes that particular control point. + SurfacePolyline. Long click when the cursor is over the shape inserts a control point near the position + of the cursor. Double when the cursor is over a control point removes that particular control point.
From 65c57c8d4cba0324b91b79d0d9e23bf04b75864d Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 15 Nov 2018 12:52:29 +0200 Subject: [PATCH 089/112] make all actions (move, reshape, rotate, manage control points) available default --- examples/ShapeEditor.js | 2 +- src/util/editor/ShapeEditor.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index ca0685221..65178e29e 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -186,7 +186,7 @@ requirejs(['./WorldWindShim', document.getElementById("editMultiPolygonBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== multiPolygonShape) { - shapeEditor.edit(multiPolygonShape, true, true, true, true); + shapeEditor.edit(multiPolygonShape, false, true, true, true); } }); diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index d7b319a9e..8da153e15 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -107,10 +107,10 @@ define([ // Internal use only. // Flags indicating whether the specific action is allowed or not. - this._allowMove = false; - this._allowReshape = false; - this._allowRotate = false; - this._allowManageControlPoint = false; + this._allowMove = true; + this._allowReshape = true; + this._allowRotate = true; + this._allowManageControlPoint = true; // Documented in defineProperties below. this._moveControlPointAttributes = new PlacemarkAttributes(null); @@ -366,10 +366,10 @@ define([ this.activeEditorFragment = null; - this._allowMove = false; - this._allowReshape = false; - this._allowRotate = false; - this._allowManageControlPoint = false; + this._allowMove = true; + this._allowReshape = true; + this._allowRotate = true; + this._allowManageControlPoint = true; var currentShape = this._shape; this._shape = null; From d150d52083725fecc9711af9857b9adbc9e21843 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 15 Nov 2018 15:42:15 +0200 Subject: [PATCH 090/112] update shape attribute interior color --- examples/ShapeEditor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index 65178e29e..873f8f2a8 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -56,14 +56,14 @@ requirejs(['./WorldWindShim', // can be shared among shapes. var attributes = new WorldWind.ShapeAttributes(null); attributes.outlineColor = WorldWind.Color.BLACK; - attributes.interiorColor = new WorldWind.Color(1, 1, 1, 1.0); + attributes.interiorColor = new WorldWind.Color(0.8, 0.9, 0.9, 1.0); var highlightAttributes = new WorldWind.ShapeAttributes(attributes); highlightAttributes.outlineColor = WorldWind.Color.RED; var polylineAttributes = new WorldWind.ShapeAttributes(null); polylineAttributes.outlineColor = WorldWind.Color.BLACK; - polylineAttributes.interiorColor = new WorldWind.Color(1, 1, 1, 1.0); + polylineAttributes.interiorColor = new WorldWind.Color(0.8, 0.9, 0.9, 1.0); polylineAttributes.outlineWidth = 5; var polylineHighlightAttributes = new WorldWind.ShapeAttributes(polylineAttributes); From 4e5312ffad8b6c8f336ea923a9564359667d3213 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 15 Nov 2018 16:36:24 +0200 Subject: [PATCH 091/112] cleanup and add outlineWidth to highlighted attributes --- examples/ShapeEditor.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index 873f8f2a8..74596a5c3 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -60,14 +60,7 @@ requirejs(['./WorldWindShim', var highlightAttributes = new WorldWind.ShapeAttributes(attributes); highlightAttributes.outlineColor = WorldWind.Color.RED; - - var polylineAttributes = new WorldWind.ShapeAttributes(null); - polylineAttributes.outlineColor = WorldWind.Color.BLACK; - polylineAttributes.interiorColor = new WorldWind.Color(0.8, 0.9, 0.9, 1.0); - polylineAttributes.outlineWidth = 5; - - var polylineHighlightAttributes = new WorldWind.ShapeAttributes(polylineAttributes); - polylineHighlightAttributes.outlineColor = WorldWind.Color.RED; + highlightAttributes.outlineWidth = 5; var circleShape = new WorldWind.SurfaceCircle(new WorldWind.Location(35, -110), 200e3, attributes); circleShape.highlightAttributes = highlightAttributes; @@ -113,8 +106,8 @@ requirejs(['./WorldWindShim', polylineBoundaries.push(new WorldWind.Location(40, -115)); polylineBoundaries.push(new WorldWind.Location(43, -110)); polylineBoundaries.push(new WorldWind.Location(50, -120)); - var polylineShape = new WorldWind.SurfacePolyline(polylineBoundaries, polylineAttributes); - polylineShape.highlightAttributes = polylineHighlightAttributes; + var polylineShape = new WorldWind.SurfacePolyline(polylineBoundaries, attributes); + polylineShape.highlightAttributes = highlightAttributes; shapesLayer.addRenderable(polylineShape); var rectangleShape = new WorldWind.SurfaceRectangle(new WorldWind.Location(33, -105), 300e3, 200e3, 70, attributes); From ee3733eec6a84dac1b0adce03616409326bf5237 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 15 Nov 2018 16:47:49 +0200 Subject: [PATCH 092/112] fix outline width before picking --- src/util/editor/ShapeEditor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 8da153e15..e5e262b16 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -468,7 +468,10 @@ define([ this.actionCurrentY = y; var mousePoint = this._worldWindow.canvasCoordinates(x, y); + var tmpOutlineWidth = this._shape.highlightAttributes.outlineWidth; + this._shape.highlightAttributes.outlineWidth = 5; var pickList = this._worldWindow.pick(mousePoint); + this._shape.highlightAttributes.outlineWidth = tmpOutlineWidth; var terrainObject = pickList.terrainObject(); if (this._click0Time && !this._click1Time) { From 15b4fd80c4a60db51d69df938599b04681eaecd6 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 22 Nov 2018 11:41:13 +0200 Subject: [PATCH 093/112] use the placemark shape as control point and update attributes --- examples/ShapeEditor.js | 4 +++- src/util/editor/PlacemarkEditorFragment.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index 74596a5c3..68c6b979e 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -134,7 +134,9 @@ requirejs(['./WorldWindShim', var highlightPlacemarkAttributes = new WorldWind.PlacemarkAttributes(null); highlightPlacemarkAttributes.imageColor = WorldWind.Color.RED; - highlightPlacemarkAttributes.imageScale = 1.2; + highlightPlacemarkAttributes.imageOffset = new WorldWind.Offset( + WorldWind.OFFSET_FRACTION, 0.3, + WorldWind.OFFSET_FRACTION, 0.0); placemark.attributes = placemarkAttributes; placemark.highlightAttributes = highlightPlacemarkAttributes; diff --git a/src/util/editor/PlacemarkEditorFragment.js b/src/util/editor/PlacemarkEditorFragment.js index c687f43a2..4c557ced2 100644 --- a/src/util/editor/PlacemarkEditorFragment.js +++ b/src/util/editor/PlacemarkEditorFragment.js @@ -57,7 +57,9 @@ define([ rotateControlPointAttributes, moveControlPointAttributes) { - this.createControlPoint(controlPoints, moveControlPointAttributes, ShapeEditorConstants.DRAG); + // we will use the same Placemark as control point + shape.userProperties.purpose = ShapeEditorConstants.DRAG; + controlPoints.push(shape); }; // Internal use only. From 63526f838ec794d2cde85ed87568c89f2add0a21 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 22 Nov 2018 17:47:49 +0200 Subject: [PATCH 094/112] add custom images for control points --- images/blue-dot.png | Bin 0 -> 2816 bytes images/green-dot.png | Bin 0 -> 2378 bytes images/yellow-dot.png | Bin 0 -> 2536 bytes src/util/editor/ShapeEditor.js | 11 ++++++----- 4 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 images/blue-dot.png create mode 100644 images/green-dot.png create mode 100644 images/yellow-dot.png diff --git a/images/blue-dot.png b/images/blue-dot.png new file mode 100644 index 0000000000000000000000000000000000000000..55c174ea467426ab5eba3f1ac2172ed531795e3a GIT binary patch literal 2816 zcmV+b3;*zksc>R*Fc;!pfT1Fg@oPHIg~EbI<2~?>(n`&jm$I>1nGX z0O^cvhQ~tw*|~Xt)f2Te<3piA(=B5vGOAM6-f!`^@w(fsRsP(+R=X6lbnsLQ59x+! z3y%v=uGoglTf$9xQd<%}5$-bOg2Feh9xd{-%ZVa?x@@Z9VNe=`{fS>3{l$9HObg4) zX-}te`pO3>q1cZ=s2$(P_+q#yyJWvI8NaZybo}m zDdlJPVc<>ld`WBH1K&EFUX--xHk@rh%e|qQ+PCBtSK@JaIfnWQ_lMqzW^MqXT-a-!Z82<010qNS#tmY3ljhU3ljkVnw%H_00|^XL_t(| zoaLK)kW|GL#($^p%s#7Gs6RB8*Mq`2| zsRB%*7GgyKQ}I#8m|z5rfCeMJ2#BJrP`n?zJeGa$?9ALg`D5nJorPWYjl08FH8p)t z_w738>(h_h-ACwRsHy{;51bu!^~~xJg{pilJxKqIAbkL>YoIFZa?rKxOAD|wJDvXp z9a#ZjZ6_-0Y-n?-U30M7-lMAdU$tE=LRHT_RAc`c zirD(r8K@eHw2q8W#JV4Ewf}v6y*s`$b(YSkL{*1Y)akt3EV=sVJXpU|S@nhT-ezTY zxl&pQWtB=O0wR!;3H@?~zB#e~!KcCaa}1*g3#JJTH)j*&!Nu7y|ETK>95dHV}Xd2RdZ&+io@V&Vwlsv<*vug3YG?ba<7b$b0p zh0Z7KwV_=EsH)V2bY^;xc|k`4o_v25EL>%IYL#Vod50S2D5M48){6|Yiw$Sw`)Y@y zsw+0?a$w5Dkxo@x>uoaus+v_*uZvI0lm-e470B> z6y*8p?>MNnCHwT^D~p`9ZKuEIssyZng)tAx&k_k{&3DXutd28eGHT+178YsMc zm&2e_W2RWEyi=kJE*)m>Y|Q}KDgq)=J04+Kz=#1@yIuM2V{WJS^Y$V)3l{&-q4->r zkgeEg-@M{%=gOAeZIJ*~Jue*9)oB4qgP6Xw1D&mn7`ce^XFZ(do+BL_}K)*+^J6D`JGMn{!4~AbDAsP zECH%o5OMXxpd)<&{_>vXmZw~7H#Qz(3#%t@arn_?vF;Fcm5qD2apXYrLX+j25~`|+ zyZsn|vwkZPJaw+Kd8)G?r$dy>o1R~YF=`gBR$|c zpcr7|9%arydXV2YgWvzlbV^yaB>^ZEw^g++thinN;*IDY~GeSYWXl5!T7gQZG)a}fNu~te$zfpS>pjJ>R{#Pz88GBRi_%@Tb^Le z<`f$Go56od{4Q>UQH=@MlKKSfI^?H&XUJIw80iU41Ok$`@p7{mV1P7FP+FP#1nesJ z)45sX86dIZZ|WE-)vzaN``#D=21qP>oaVMiQV8{7I8+l$i^NP$@_-Y-1%QS~%nJf0 zwh~Nuz=_ZW0P=dp3^jr_@_-Ye3uLB|I7+Lkr?!y?1Ov^yl|snN_T9WXM7aT~J;6Bx zQoj$J*~d@UHc)1OcRj(l!qg{V%n;wkhN$i^zzR<=?(3;fz}TU_jS-g>65kps1x{6s zeGXUDeP#M}DMX;`@gS%4PKfeN{0x1iS0I_8RKv(KBw_sC3f(Uv<=({ScZ0&zoeQUr z^KA=-c^mvKu>=9%8P)XFw4RR4G?+HlC!ipoKR}!S5!nW80~mI?@V)a>&kL^orXe>g zmflyPhl7r+fyU;i%e?1Le0~UcyQdsRj}UhYwzBNKb*KadtY)nd~>_!5W?xky7vZ$Yx#u>;yO? zU%36!p6>;-COY&#IoA5M4H`NZvu(yv}KjL_p}@tBq9yT<&N@k z5s3oV1C;>h4HBN2;orUM2`~an?(mHdMKqe5#pOpD56xVX5|K^76u<&ZxxnziH9ccI z5P`?0IZPape50J(Gt$harph;Km53|{W_i!Qy3XOJSDJ3^2_i6ms>5C1_RXrO)8}%s z%%W!BIaY=7FU4noTRqvrRhF4c+-`S-E&}tW#u~}P?s8o^AWyCpk!H1R&0XPi;0@qn zPqy-NW%8e*?T!TLZ1m26h0`6TT;LnOrA(I%K20XI6m`}rhmMo5fFw`YT&mo>(B=KF z_&9BNf8lR;I~4ZwP1#?iFP?gmOl?ibU0dP>1o#Osm!z>{@w=A$UUVs~Y@6a8g=1jG z#fEt|Ib_8T_o7y{rk;m$v*qE|#v8ULWM;foeaVRAc(UpcJp8K5AK$cukHgiv%ZCf| zraBZA`05|1){5+OuF6g~@3*C{_6AK20bT}*lI6S0l|`$SXIERc?(f{LVFWH5D$Kgt zVbaLPYVSCx%Lew58{*$HZ9=;zHI0SDP6K`o6dakq>I>zWcPvZSTPi!S$5>P#+%(2; z<7jCVBn7a)N=x#xnHdb2x7u5Ohi7$F%>eGSs`nd_lbb42vQPPFoAU8C<)f|2wga)C z$xs9uB49NZ4L0Z$VQ4>LXkRGoD~ui@4DWxmilr60Gb^2$CuPcO9Sxl9G^lEhs?Jf> z1FZ{&_0bSfb!|&!Y2RXt0UplflXE>?t)W2kowC61Bxz=rs5OZ?-k%kY0URI)PM Sn=0P`0000(p@@Tj6{ zIpGQ6skNMH^0sihl8P=1p9=SCazWu+Q;(JT#pGm}zf9I5p#WH0gk8xhj#aUe(lWyG za@?78UirO``4UGwI~$hRE#8Grh#-DkOfp7*AqE(cc?d5)`ea3o{QjT(8CE4%ky)jH z#tKPN#k} zt>mvB!0@~1#fs+M2j>QyT~@T%4xDd7=Yty6qCb*N+?q(h>j^Z^L)$epEtY%syU+1G zMAqf2u3&c$dgQ!w=^JhcXX$SC<$?eJ010qNS#tmY3ljhU3ljkVnw%H_00(YKL_t(| zoaLKaY!ufW#=n{M6=JislL`|m5lBK>Hwm%j~%rDzE_oNl!@n`G`iA4QOB`;(>CN-(R7MdnGZf;aF11 z8!4rJC{tP2LM^;ds?w8^E*plCF0_w%H=rE&ZH(CAVTSw3(fa96bkK3`1~>i+)cVb9 zS_6L3N8bkt67d-lBtc?EVkAhUT4_DgMAOE6`fTJQ6X4;fqWgjh{%*oOp^LhxPxYzJ z>a4oet&l}4rSb0&Q&lu^b@yu?+mW{F^7rJHDKYNDySSmYP<)Bi8869Wve zlbw`Po_FGt3DHO+U36s$(Mjjv2~Pa7(BvN)WU#|q@VmUr5|$L4_;{34&da<^oU#5k zN;Gwx<1ZG9{L>cJuv1uw5F6M~bmHT&n$>*AcdiI2Qnb)=5XeghFG;eoH`>@Kr;t`! z3)0SWMUWuJIF{8UKH-xSc_9z{+QPEDRlbr+-${>$iODW@k!EZ_I?nO8=Su#k7FNv3 za3A|HFnlLF6?U>St0tV{)ZcO?|C1!iADoPia0C<6cY@Qwz~CSUT>)%tE^=|xY{{Dz z))^<0W|}Fb)OT_-MF}M|)9i|HlbgxYoL({;0UDi$+i2q+?(v<}Y*9@$m$>ALaE3GO zGbMk&jXmg8pH-~#olLG+#xjO+M{dq?wsAW028@j-uko7iB<70OdEFHtLL?5sjx+^ZCLyws|{5tBbD6$pm=9Npyh= zxBYlO8gN^_ohf$0Nr%oQDgp0 zQAs6340$`m^^)BArmd#TGD$k5L$YO0Ia=I_7FS%&YId(X)%j;>On~1zH%{wxaXl-d zy|4G(aE)pUP6H z1(%wV%AAOhLVoyERP)w=pn^4~q!A}#vSp~d&3e@1hE16zrlgb;5m3MnpNeX6#nq=i zNs=KWFz;%BBw4Z~NhK;#Rt=ah0@P@9PQ;W+Rt=aBO`uYhs!)X_DW=#^Rt<1I5$|Sm z-o7LaXyB$PX~2niRFC@MQ&DZ1mbu{}4TVi9uW@eL7i<7{s(A{RMw8|xa zUDtaJ!?@`T{PUt2Y}HmboKWJFdjUM)Ocs8_H+RG;a4wUg5hCuSXp-dGEOmhYIyX15 z$#;kIjm>O!$zSLCO~!Ab0d_kHu5g7CN_=-ZUobJbfV=3$SA2C~Li+%!U~Ca>D_ebc zJYU$t7MHw*l>!z|+DQOAoP<}odRHutE@UCybh`rd&@=hsXhwhv7~6`uo$bC8m@D?M z$0a|=U>pceIaB~IIuC>iQ%9ZeByvRq4cLtB<_!^gbxQIX0ZM?&&O=}D#cjDQZaUOb zo3))bM5qTSpH_g32#)|!=i#Fqy`z@PO-w%GBbR)fxSb&J$c)H)MEDKh?hf6}Zr_Q` z1O^6g@+MyEr~gm0BJU9)YuDipcHGuA!NA}E2eQaVh#by|d`18Rc-x!dTfB8!?jJBP z*w6kf^4GZb0i%buayLc~K%Mete3FxMIth|*R8hrIj%JbXprZ-M&n$07gshtIE#I<+ zHNKOtr#@@{4?vjkKl4W3BZ9%`mtx9W*gL$#Vip&jcz^(nG-hpkv9Z$;B75>qew+{+ zQ>3C^5n{x6g;yw}tSIE4;wjo_%X;g*^hSmlT2nCM<3xA}#(6N>>9Ci*EN6M%Nt>9g zV;vvz;rL?dq_YXADhhdz2mxRVj61!Qu@+i*ffrcBqB#+NjK_F`HzpjC%Cz-%8+*fC zc+B}+4NxIzTUzN?O_@KMEX@^N(RrO$t6Ftl=k>k5S0V#TmeNYAOl4ZG<$5@Sm0GC= zHK<iw)U`khwpXkA-@YE4^ct`T_&e~w$!f$@W?_-a?pr5IlkB1AV;lQv@_8UC z-wx`0=WNCBT9Rb4kG>PYAAyC1@VB5!X5Q4}8r_Do!uh3@UV$i0DU}-0NZOE* w2q+K_C~zg9z(q-yGQa;AhB0#M66S9I2bV)EoHUUL^Z)<=07*qoM6N<$g0!)Ik^lez literal 0 HcmV?d00001 diff --git a/images/yellow-dot.png b/images/yellow-dot.png new file mode 100644 index 0000000000000000000000000000000000000000..7c708eea7a68945032eb717980893bf36d99d754 GIT binary patch literal 2536 zcmVP)zksc>R*Fc;!pfT1Fg@oPHIg~EbI<2~?>(n`&jm$I>1nGX z0O^cvhQ~tw*|~Xt)f2Te<3piA(=B5vGOAM6-f!`^@w(fsRsP(+R=X6lbnsLQ59x+! z3y%v=uGoglTf$9xQd<%}5$-bOg2Feh9xd{-%ZVa?x@@Z9VNe=`{fS>3{l$9HObg4) zX-}te`pO3>q1cZ=s2$(P_+q#yyJWvI8NaZybo}m zDdlJPVc<>ld`WBH1K&EFUX--xHk@rh%e|qQ+PCBtSK@JaIfnWQ_lMqzW^MqXT-a-!Z82<010qNS#tmY3ljhU3ljkVnw%H_00<08L_t(| zoaLK)j8u0O$3N%ZdG7A)Qr;~k7AfMRLLn{HQd^&3Tf|f`62xj7hy*d!qOFPiQK@L7 z5nBIHOk<@Fqmq_HF@@GbO`o<1q1Ym%)FMXSEX&UB%+B1o_xQ(e_TIbio!OmXAKzp$ zzw`T@-|wDt?zz9``3V(k z;7t+nDlOxnLsjFddb7GMkEz#oLCb~P(x%R_SJiF$j;fBk*n0H|Rh_Hug+Hs8%l1n_ zuSM0%_0Jey-qqZ}mo@v+g29wo2BQ&GeIH(WBUb9xZc4#947qfqM?TbD()6 zf>j6Bc(BKt|HxE`e*|K)0IO@0g=42s=U$@I9}^KBi0lJ0fT~`O*ZLDA`4z+pwdFzE z^N`sA`Muy>DDMGQ1H?ZHi5nn3-_T(=?;OEvULuLPZ-Q%o&xt&xiWPRi9+&okXixu=D~tt$wLLUM7@5R-!Z!iiQ2M{knk^?OTdt`uffoq?Bq8Y_9FpPAhW&6~hIQ%X|< zhs2=fi%@@;NdtH-9{B?+Bsu@L{cfhejHGM=^*=M0QCwBfE|c!x@6~H(0KRYf9K`GO2L@*khm$x%f0@rB(7W7 zSJgfZpsMpw=S3uH{4Bc@ntlkH8-T=>fCY88L;bh#)oOcXizMgY(Oa!v4WOzYK%Li+ zXbOOq-$C<6U_e7}Wl^^r>hBKd+}?GPxMo97?A^>V3{-V0TG;I?pMBbNc0*ZtFfXa~ z$$*Z{{*mSnFYSrFTMtlGtLXOE1CVTl z1rj%O{=h1U&;E6orGp2kssO(<$^+>~hOhDf?r~^&BA_GF9#qw_VV2IHz!!kU02JPV zmfuuZ!YZI;3wY;E+DavG-u`j8*f)Tx3aUTwOD_Dh^7Hy?KwBXl@_KvH9a=brD;T-bk1z`iM_ERlSFyzPkQlJG$|0r9T0I2i%Di*Ob}q!)(m&Co~7Smjl{8z5)UR zEcOd>`>QEdb&-8ONLvk`2C!5$0?hRboPSnZtm+~6V&L8O^%C+g} z0fTc`JoM3i$SRh0@&Nmy$Wv8FJbaYa+NlqSbYE#CA$-KHnMMmp`x%idyH*%!urCYJ znmuI!FZmhqxm_!aG{j~HX?6Z%0lR|2QDy)NyQH`^bP|{d3MW5qR!t)k0+XKu>yq}2 zaaQpReYejLySj(UBLLBvf%5K|(<0K?KJytJpFz#%gS6)V2Eo)XFhJr)M&yi8;*h*0 zpzTQyK~Yl?c^7yWfXFmRex~{YRvL*J z=LcAZ4X_C?pqK+U2m3Rq#(+-icU0Mzk_&U~P~$Txt9q=DezF!haK&ODqUNl1M& zpuMJtMa16~>D=3G295zH8nfoMDo9vi)ZGsDM3eTiZP*jOA1>}-01;^e?(;KJD@_3N za7ApEi70J{W;TdOQ<$Z@2$2Y|ANUXe`8VO*${`pQ*9WWynDB=noYrkTjy?9hBGN&T zE(5-Z6o4gw**A(^1!L}Gcx{$gFy{V1dCeEF>OR$3`66dmh{z#eDPXRvBo~^`VOT(* z;kzcpz8&hU6f1tHJMJE*d?K0_fncF_tMl1;7MRshXVJM@rcZy!2Mr2 zP4@!J>{iu%4H6&gSX4N%gUF>{F0N-vLfK=Qnk%u(f%}1}T^MqEj3II_fY(y)W6WDl z-U7+bcDy77;5Ht{s$U~k^tp1IAMl{AstI5^{ zc;+^kJ;f}=+kdfHrjzRo_v|qwxdyBDF9W?eIcQMT236gls%QFl7q-K-SXFiV;>l~_ z^k3C0ENTyO9FkB~TUBpV)lI5;v}9v+P}<3>+w_d8eo0kpDf)BT_7 ybkHccF1Q}h26h&#!-%~fI8gi@DK5?`hW`UXNCi8st9+gS0000 Date: Sun, 25 Nov 2018 16:05:08 -0800 Subject: [PATCH 095/112] Improved accurancy of radius used in EPSG 3857 to 4326 conversion. - Changed radius from 6,378,100 to 6,378,137 - Re: https://github.com/NASAWorldWind/WebWorldWind/issues/793 --- src/util/WWMath.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/WWMath.js b/src/util/WWMath.js index b7380f26c..17e3993a0 100644 --- a/src/util/WWMath.js +++ b/src/util/WWMath.js @@ -771,7 +771,7 @@ define([ }, epsg3857ToEpsg4326: function (easting, northing) { - var r = 6.3781e6, + var r = 6.378137e6, latRadians = (Math.PI / 2) - 2 * Math.atan(Math.exp(-northing / r)), lonRadians = easting / r; From 5e0a80a3944417d08e621cd9855709b330a918d0 Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Sun, 25 Nov 2018 16:42:22 -0800 Subject: [PATCH 096/112] Enabled conditional auto-sizing of Annotations - New behavior: if width is not defined, then the annotation is auto-sized to fit the text. - If the width is defined then the previous behavior of wrapping the text and (optionally) constraining height is invoked. --- src/shapes/Annotation.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/shapes/Annotation.js b/src/shapes/Annotation.js index 057755a4f..82759f69d 100644 --- a/src/shapes/Annotation.js +++ b/src/shapes/Annotation.js @@ -13,6 +13,9 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * NOTICE: This file was modified from the original NASAWorldWind/WebWorldWind distribution. + * NOTICE: This file contains changes made by Bruce Schubert (bruce@emxsys.com) */ define([ '../shapes/AnnotationAttributes', @@ -265,11 +268,13 @@ define([ var w, h, s, iLeft, iRight, iTop, iBottom, offset, leaderGapHeight; - // Wraps the text based and the width and height that were set for the - // annotation - this.label = dc.textRenderer.wrap( - this.label, - this.attributes.width, this.attributes.height); + // Conditionally wraps the text to the width defined in the attributes. + // Also conditionally truncates the wrapped text to the height, if defined. + if (this.attributes.width > 0) { + this.label = dc.textRenderer.wrap( + this.label, + this.attributes.width, this.attributes.height); + } // Compute the annotation's model point. dc.surfacePointForMode(this.position.latitude, this.position.longitude, this.position.altitude, From ac0088ad28ebe16fe8824d2332011a46e59bc33d Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 26 Nov 2018 15:44:17 +0200 Subject: [PATCH 097/112] add shadow control points --- images/gray-dot.png | Bin 0 -> 2572 bytes src/util/editor/BaseSurfaceEditorFragment.js | 5 ++- src/util/editor/ShapeEditor.js | 22 +++++++++++- src/util/editor/ShapeEditorConstants.js | 5 ++- .../editor/SurfacePolygonEditorFragment.js | 33 +++++++++++++++++- .../editor/SurfacePolylineEditorFragment.js | 21 +++++++++-- 6 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 images/gray-dot.png diff --git a/images/gray-dot.png b/images/gray-dot.png new file mode 100644 index 0000000000000000000000000000000000000000..6ede01b18559d781ba1884e2143b21c6e272035c GIT binary patch literal 2572 zcmV+n3iI`eP)| z`4U?^J3l9}Tf7UMAQJ>|GQ}99_~~azWg;+8}L-p{}uhPGR1St|9cywB+) zgf`@>ZeafadgZ)h`4^KVXZp21mooqW010qNS#tmY3ljhU3ljkVnw%H_00=NiL_t(| zoaI|hj3Y-C{$7>aZF~GPGi!T2JI)B$4G}*A5{V#jAVQ!;5vxd`MJ#~>i4q~LRze&Q z2Xa6`3#SCQph!rtESG@b0*Fn3jgTM;Ab|qPAu9z9Se~89{Mj>h+wPyL$HDI2w%4=c z@z|cfPqNhYs=DUYH?OLzUcE;cGniQd_y~aaGxIyN)(-%9ClSpPQ5FDet+$zZ9l$aX zm4p!gB%+%D-XJ19ZXHJsW;U7mQP1{E+8) zzg9{$2N|GJinZ1Qk)f1QjYi|u?d|RJqtuy3(FrrZTPgLtl=9R4>RYWA>h(GrjRsuT zh39$jJP*ta0FY855{V!ZiNG)nM59q8lSw2JiN1f&w(Yl>`5UoV>^c$gestd#0nA)f zN_|%d@kJt{kQ}vI4b^HDmSsUHHB|pnN+gp>q*5uQQYlC&yXsr5)>}%ci^*j2U&D@J zC<2(7lu}oO5YH1)#Fu-Xhf1Y_&CN}?t~;zweL+N+nVCT@mxEy#VO_XhufGJ~QaYX9 z-gCcueSw)1N~xbpDKGjmtu-wqtSROolgH`;C=>e$jld*`4>bK z2ioRdE|*cS*Y~XaC=rXru&}UzXf*2U3CprxNG6k)2U#EoB0y_>9>5JE5&+O_Hc={- zMn2Dng_IJ-ViBoSDv;Id_1~vbsZZ_p?ydwd^TW*iXCjIMZIfSGT7uSxZ-bW0<#77+ z>7ZPz)vl$}=_l^>&OHfW=Jzo3--sv$0PE}PSXo&aiL&EDHk(DEPzcJFWj&KjCa><) zen$eB`95a;I}sHCpjxe>TrQ7P*>T~_nKPK3odwWd6Kvc5LOdRSv0q!!Psq%InP2n= zU$57(w6rufg-4C$<>g>;CL$PyalKxzpXt}OF986aCZdl5?QLwSR2uvDeUxBklu9ME zS}g#8l+qxgSNgTRivVVxXXfYpj>_fopKxEde@Kz#n#r= zfhamo)M~Zhi(nW=Mk)1i;En}6>F@Qc)#|aB`@PUwcb!}v$9W34L%?HxMWfM}tY#C$ z_Vyizk(Bb203et-0^lLP;y4pftJMPQjz*(7rPQ1N@Lm9Mp#AM1)`58xpp@$Rx-}Y& z#|3~7hXeFoSL9^LB2%RR1Fac7^q5u%>S9x5~V*#@Q zK;X{~UG5xPgx&W<6cGT9@3P+qTI=waPM$am01)g2hzKXn0sw?BS^30SfDj@Wr`Fm! zaTXB1VpmFS3IH`<5R1hQLZ^wM=W6|J0pKsbU}|dWAat52!ciw$>;DM=H+{iLBY>H2 z3IJ~aSOwZspf?QVxFJly)YR0kMCT6um3|G58)C5-B9V4PkL$XtM6~I9gigdXn3 z^7%XfKx^F+Ld+3S)vxcm9w(v}fN%NbTrL-UH;*C`i3D=FTu|0pUkwi)=o2K>xhQ!Z z!25u1;J^38s2cZw1N z5xoT9>wY<(&*Rjo!=JS>H#gU%r&8)?kx1m)PVIM#6eR#Z2JmHHwz;{9<>lo=d4=9P zc-M7*V;II~h-gQz*C4UNCV-a#JmSkN%R;GCIy4ulLI}*y&v$L%ZQH(Kn&ySwvd#wD z>2yeV0U=9p90%oc`M~cJP1D4}!U9aw3}l|?{X7zhJU&Ru-Cptq2*6hXJcrQQQLR?7 zva)g@2@^9jGbj`a5JLDmvex=pDdn?+<{J)^GIPF@I1$*}BvWPpAel^}P$+acaXrtg z3LzeqQvP)>eGQv5bw7Y#0{B2!?z%3j)ha5L3LM87rt5oRYHAAEZ1ygnh2uCkqS5H* zJLj1_Vd&Eiw^L%j1mN2M?(40$EDM!N1+`jjUyEfd7Q^)PG%}e?mrEM}JkPr&rMx19 z_~Wqs@B6sdIY3=z=4Xg#re7P|w$W@hgP-F#U}i9Lu*D`KM59qeqfwZq3DY!@NF=%z zHy^I+mV^*jq?EtiZ{p<0z|0wDzRJvN1LeYoFi85W*4l9#=MP%z3x1H}p#(EaX8ss6 ze~+2}yH_%L2kpA<%gp>aW*&>TcC1Wx{!<@BI}GQn|6}H}01N<%nKghGfF=>$BBIv; i{JZmet8+LT8~zU|`{0) lenLocations) { - controlPoints.splice(lenLocations, lenControlPoints - lenLocations) + controlPoints.splice(lenLocations, lenControlPoints - lenLocations); + } + + for (var i = 0; i < lenLocations - 1; i++) { + this.createControlPoint( + controlPoints, + this.shadowControlPointAttributes, + ShapeEditorConstants.SHADOW, + lenLocations + i + ); + + controlPoints[lenLocations + i].position = new Location( + (locations[i].latitude + locations[i+1].latitude)/2, + (locations[i].longitude + locations[i+1].longitude)/2 + ); } var polygonCenter = this.getCenterFromLocations(globe, locations); From 0ce49b6d3e399fb88d70a092087f9cdc90d5b74f Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 3 Dec 2018 14:44:33 +0200 Subject: [PATCH 098/112] bugfix - hightlight attributes for placemark --- examples/ShapeEditor.js | 4 +++- src/util/editor/ShapeEditor.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index 68c6b979e..9e8fd9af8 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -133,10 +133,12 @@ requirejs(['./WorldWindShim', placemarkAttributes.leaderLineAttributes.outlineColor = WorldWind.Color.RED; var highlightPlacemarkAttributes = new WorldWind.PlacemarkAttributes(null); - highlightPlacemarkAttributes.imageColor = WorldWind.Color.RED; + highlightPlacemarkAttributes.imageSource = WorldWind.configuration.baseUrl + "images/pushpins/plain-red.png"; + highlightPlacemarkAttributes.imageScale = 1; highlightPlacemarkAttributes.imageOffset = new WorldWind.Offset( WorldWind.OFFSET_FRACTION, 0.3, WorldWind.OFFSET_FRACTION, 0.0); + highlightPlacemarkAttributes.imageColor = WorldWind.Color.RED; placemark.attributes = placemarkAttributes; placemark.highlightAttributes = highlightPlacemarkAttributes; diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 86165fd14..392e064a7 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -671,7 +671,7 @@ define([ if (this.activeEditorFragment instanceof PlacemarkEditorFragment) { shadowShape.altitudeMode = WorldWind.CLAMP_TO_GROUND; - shadowShape.highlightAttributes = new PlacemarkAttributes(this.originalHighlightAttributes); + shadowShape.highlightAttributes = new PlacemarkAttributes(this.originalPlacemarkHighlightAttributes); } else { shadowShape.highlightAttributes = new ShapeAttributes(this.originalHighlightAttributes); } From 50fc4c25b64b41abd2b40795379d9416adf58a82 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Tue, 11 Dec 2018 01:03:25 +0200 Subject: [PATCH 099/112] update shadow control points and hide elements if actions are disabled --- src/util/editor/BaseSurfaceEditorFragment.js | 33 +++++ src/util/editor/ShapeEditor.js | 22 ++- .../editor/SurfaceCircleEditorFragment.js | 21 +-- .../editor/SurfaceEllipseEditorFragment.js | 77 ++++++----- .../editor/SurfacePolygonEditorFragment.js | 102 ++++++++------ .../editor/SurfacePolylineEditorFragment.js | 127 +++++++++++------- .../editor/SurfaceRectangleEditorFragment.js | 81 ++++++----- .../editor/SurfaceSectorEditorFragment.js | 12 +- 8 files changed, 306 insertions(+), 169 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index 53ad4647b..ddede0116 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -411,6 +411,39 @@ define([ } }; + // Computes the location for a shadow control point for two given locations. + BaseSurfaceEditorFragment.prototype.computeShadowPointLocations = function (shape, + shadowControlPoint, + startLocation, + endLocation) { + var segmentAzimuth = null; + var segmentDistance = null; + + if (shape.pathType === WorldWind.LINEAR) { + shadowControlPoint.position = new Location( + (startLocation.latitude + endLocation.latitude)/2, + (startLocation.longitude + endLocation.longitude)/2 + ); + } else if (shape.pathType === WorldWind.RHUMB_LINE) { + if (segmentAzimuth == null) { + segmentAzimuth = Location.rhumbAzimuth(startLocation, endLocation); + segmentDistance = Location.rhumbDistance(startLocation, endLocation); + } + shadowControlPoint.position = Location.rhumbLocation(startLocation, segmentAzimuth, 0.5 * segmentDistance, + shadowControlPoint.position); + } else { + // Great Circle + if (segmentAzimuth == null) { + segmentAzimuth = Location.greatCircleAzimuth(startLocation, endLocation); //degrees + segmentDistance = Location.greatCircleDistance(startLocation, endLocation); //radians + } + //Location, degrees, radians, Location + shadowControlPoint.position = Location.greatCircleLocation(startLocation, segmentAzimuth, 0.5 * segmentDistance, + shadowControlPoint.position); + } + + } + return BaseSurfaceEditorFragment; } ); \ No newline at end of file diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 392e064a7..a3a298e0c 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -404,6 +404,22 @@ define([ // Internal use only. // Called by {@link ShapeEditor#edit} to initialize the control elements used for editing. ShapeEditor.prototype.initializeControlElements = function () { + var moveControlAttributes = this._moveControlPointAttributes; + var resizeControlAttributes = this._resizeControlPointAttributes; + var rotateControlAttributes = this._rotateControlPointAttributes; + + if (!this._allowMove) { + moveControlAttributes = null; + } + + if (!this._allowReshape) { + resizeControlAttributes = null; + } + + if (!this._allowRotate) { + rotateControlAttributes = null; + } + if (this._worldWindow.indexOfLayer(this.shadowShapeLayer) == -1) { this._worldWindow.insertLayer(0, this.shadowShapeLayer); } @@ -424,9 +440,9 @@ define([ this._shape, this.controlPointsLayer.renderables, this.accessoriesLayer.renderables, - this._resizeControlPointAttributes, - this._rotateControlPointAttributes, - this._moveControlPointAttributes, + resizeControlAttributes, + rotateControlAttributes, + moveControlAttributes, this._shadowControlPointAttributes ); diff --git a/src/util/editor/SurfaceCircleEditorFragment.js b/src/util/editor/SurfaceCircleEditorFragment.js index b2378f484..3381dc4cd 100644 --- a/src/util/editor/SurfaceCircleEditorFragment.js +++ b/src/util/editor/SurfaceCircleEditorFragment.js @@ -54,20 +54,23 @@ define([ controlPoints, accessories, resizeControlPointAttributes) { - - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.RADIUS); + if (resizeControlPointAttributes) { + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.RADIUS); + } }; // Internal use only. SurfaceCircleEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints) { - Location.greatCircleLocation( - shape.center, - 90, - shape.radius / globe.equatorialRadius, - controlPoints[0].position - ); + if (controlPoints.length > 0) { + Location.greatCircleLocation( + shape.center, + 90, + shape.radius / globe.equatorialRadius, + controlPoints[0].position + ); - controlPoints[0].userProperties.size = shape.radius; + controlPoints[0].userProperties.size = shape.radius; + } }; // Internal use only. diff --git a/src/util/editor/SurfaceEllipseEditorFragment.js b/src/util/editor/SurfaceEllipseEditorFragment.js index 520ab9540..8ae9d80a1 100644 --- a/src/util/editor/SurfaceEllipseEditorFragment.js +++ b/src/util/editor/SurfaceEllipseEditorFragment.js @@ -62,11 +62,16 @@ define([ resizeControlPointAttributes, rotateControlPointAttributes) { - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.WIDTH); - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.HEIGHT); - this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); + if (resizeControlPointAttributes) { + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.WIDTH); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.HEIGHT); + } + + if (rotateControlPointAttributes) { + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); - this.createRotationAccessory(accessories, rotateControlPointAttributes); + this.createRotationAccessory(accessories, rotateControlPointAttributes); + } }; // Internal use only. @@ -74,32 +79,44 @@ define([ globe, controlPoints, accessories) { - Location.greatCircleLocation( - shape.center, - 90 + shape.heading, - shape.majorRadius / globe.equatorialRadius, - controlPoints[0].position - ); - - Location.greatCircleLocation( - shape.center, - shape.heading, - shape.minorRadius / globe.equatorialRadius, - controlPoints[1].position - ); - - Location.greatCircleLocation( - shape.center, - shape.heading, - 1.6 * shape.minorRadius / globe.equatorialRadius, - controlPoints[2].position - ); - - controlPoints[0].userProperties.size = shape.majorRadius; - controlPoints[1].userProperties.size = shape.minorRadius; - controlPoints[2].userProperties.rotation = shape.heading; - - this.updateRotationAccessory(shape.center, controlPoints[2].position, accessories); + var length = controlPoints.length; + + if (length > 0) { + for (var i = 0; i < length; i++) { + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.WIDTH) { + Location.greatCircleLocation( + shape.center, + 90 + shape.heading, + shape.majorRadius / globe.equatorialRadius, + controlPoints[i].position + ); + controlPoints[i].userProperties.size = shape.majorRadius; + } + + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.HEIGHT) { + Location.greatCircleLocation( + shape.center, + shape.heading, + shape.minorRadius / globe.equatorialRadius, + controlPoints[i].position + ); + controlPoints[i].userProperties.size = shape.minorRadius; + } + + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { + Location.greatCircleLocation( + shape.center, + shape.heading, + 1.6 * shape.minorRadius / globe.equatorialRadius, + controlPoints[i].position + ); + + controlPoints[i].userProperties.rotation = shape.heading; + + this.updateRotationAccessory(shape.center, controlPoints[i].position, accessories); + } + } + } }; // Internal use only. diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index acf546ff2..dae899c97 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -66,23 +66,28 @@ define([ moveControlPointAttributes, shadowControlPointAttributes) { this.currentHeading = 0; - this.moveControlPointAttributes = moveControlPointAttributes; - this.shadowControlPointAttributes = shadowControlPointAttributes; - var locations = this.getLocations(shape); + if (moveControlPointAttributes) { + this.moveControlPointAttributes = moveControlPointAttributes; + this.shadowControlPointAttributes = shadowControlPointAttributes; - for (var i = 0, len = locations.length; i < len; i++) { - this.createControlPoint( - controlPoints, - moveControlPointAttributes, - ShapeEditorConstants.LOCATION, - i - ); + var locations = this.getLocations(shape); + + for (var i = 0, len = locations.length; i < len; i++) { + this.createControlPoint( + controlPoints, + moveControlPointAttributes, + ShapeEditorConstants.LOCATION, + i + ); + } } - this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); + if (rotateControlPointAttributes) { + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); - this.createRotationAccessory(accessories, rotateControlPointAttributes); + this.createRotationAccessory(accessories, rotateControlPointAttributes); + } }; // Internal use only. @@ -91,26 +96,60 @@ define([ controlPoints, accessories) { var locations = this.getLocations(shape); + var lenLocations = locations.length; + var lenControlPoints = controlPoints.length; + var locationControlPoints = []; + var rotationControlPoint = null; + + if (lenControlPoints > 0) { + for (var i = lenControlPoints - 1; i > -1; i--) { + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { + rotationControlPoint = controlPoints[i]; + + var polygonCenter = this.getCenterFromLocations(globe, locations); + var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); + + Location.greatCircleLocation( + polygonCenter, + this.currentHeading, + polygonRadius, + rotationControlPoint.position + ); - var rotationControlPoint = controlPoints.pop(); + rotationControlPoint.userProperties.rotation = this.currentHeading; - var lenControlPoints = controlPoints.length; - var lenLocations = locations.length; + this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); + } + + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.LOCATION) { + locationControlPoints.push(controlPoints[i]); + } + + controlPoints.pop(); + } + } + + locationControlPoints.reverse(); + var lenLocationControlPoints = locationControlPoints.length; for (var i = 0; i < lenLocations; i++) { - if (i >= lenControlPoints) { + if (i >= lenLocationControlPoints) { this.createControlPoint( - controlPoints, + locationControlPoints, this.moveControlPointAttributes, ShapeEditorConstants.LOCATION, i ); } - controlPoints[i].position = locations[i]; + locationControlPoints[i].position = locations[i]; } - if (lenControlPoints > lenLocations) { - controlPoints.splice(lenLocations, lenControlPoints - lenLocations) + if (locationControlPoints.length > lenLocations) { + locationControlPoints.splice(lenLocations, locationControlPoints.length - lenLocations) + } + + for (var i = 0; i < locationControlPoints.length; i++) { + controlPoints.push(locationControlPoints[i]); } for (var i = 0; i < lenLocations - 1; i++) { @@ -121,10 +160,7 @@ define([ lenLocations + i ); - controlPoints[lenLocations + i].position = new Location( - (locations[i].latitude + locations[i+1].latitude)/2, - (locations[i].longitude + locations[i+1].longitude)/2 - ); + this.computeShadowPointLocations(shape, controlPoints[lenLocations + i], locations[i], locations[i + 1]); if (i == lenLocations - 2) { this.createControlPoint( @@ -134,28 +170,12 @@ define([ lenLocations + i + 1 ); - controlPoints[lenLocations + i + 1].position = new Location( - (locations[i+1].latitude + locations[0].latitude)/2, - (locations[i+1].longitude + locations[0].longitude)/2 - ); + this.computeShadowPointLocations(shape, controlPoints[lenLocations + i + 1], locations[i + 1], locations[0]); } } - var polygonCenter = this.getCenterFromLocations(globe, locations); - var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); - - Location.greatCircleLocation( - polygonCenter, - this.currentHeading, - polygonRadius, - rotationControlPoint.position - ); - - rotationControlPoint.userProperties.rotation = this.currentHeading; controlPoints.push(rotationControlPoint); - - this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); }; // Internal use only. diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index 541e9d510..d77bb05a4 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -66,23 +66,28 @@ define([ moveControlPointAttributes, shadowControlPointAttributes) { this.currentHeading = 0; - this.moveControlPointAttributes = moveControlPointAttributes; - this.shadowControlPointAttributes = shadowControlPointAttributes; - var locations = shape.boundaries; + if (moveControlPointAttributes) { + this.moveControlPointAttributes = moveControlPointAttributes; + this.shadowControlPointAttributes = shadowControlPointAttributes; - for (var i = 0, len = locations.length; i < len; i++) { - this.createControlPoint( - controlPoints, - moveControlPointAttributes, - ShapeEditorConstants.LOCATION, - i - ); + var locations = shape.boundaries; + + for (var i = 0, len = locations.length; i < len; i++) { + this.createControlPoint( + controlPoints, + moveControlPointAttributes, + ShapeEditorConstants.LOCATION, + i + ); + } } - this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); + if (rotateControlPointAttributes) { + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); - this.createRotationAccessory(accessories, rotateControlPointAttributes); + this.createRotationAccessory(accessories, rotateControlPointAttributes); + } }; // Internal use only. @@ -91,57 +96,75 @@ define([ controlPoints, accessories) { var locations = shape.boundaries; + var lenLocations = locations.length; + var lenControlPoints = controlPoints.length; + var locationControlPoints = []; + var rotationControlPoint = null; - var rotationControlPoint = controlPoints.pop(); + console.dir(shape.pathType); - var lenControlPoints = controlPoints.length; - var lenLocations = locations.length; + if (lenControlPoints > 0) { + for (var i = lenControlPoints - 1; i > -1; i--) { + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { + rotationControlPoint = controlPoints[i]; - for (var i = 0; i < lenLocations; i++) { - if (i >= lenControlPoints) { - this.createControlPoint( - controlPoints, - this.moveControlPointAttributes, - ShapeEditorConstants.LOCATION, - i - ); - } - controlPoints[i].position = locations[i]; - } + var polygonCenter = this.getCenterFromLocations(globe, locations); + var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); - if (lenControlPoints > lenLocations) { - controlPoints.splice(lenLocations, lenControlPoints - lenLocations); - } + Location.greatCircleLocation( + polygonCenter, + this.currentHeading, + polygonRadius, + rotationControlPoint.position + ); - for (var i = 0; i < lenLocations - 1; i++) { - this.createControlPoint( - controlPoints, - this.shadowControlPointAttributes, - ShapeEditorConstants.SHADOW, - lenLocations + i - ); + rotationControlPoint.userProperties.rotation = this.currentHeading; - controlPoints[lenLocations + i].position = new Location( - (locations[i].latitude + locations[i+1].latitude)/2, - (locations[i].longitude + locations[i+1].longitude)/2 - ); - } + this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); + } - var polygonCenter = this.getCenterFromLocations(globe, locations); - var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.LOCATION) { + locationControlPoints.push(controlPoints[i]); + } + controlPoints.pop(); + } - Location.greatCircleLocation( - polygonCenter, - this.currentHeading, - polygonRadius, - rotationControlPoint.position - ); + locationControlPoints.reverse(); + var lenLocationControlPoints = locationControlPoints.length; + + for (var i = 0; i < lenLocations; i++) { + if (i >= lenLocationControlPoints) { + this.createControlPoint( + locationControlPoints, + this.moveControlPointAttributes, + ShapeEditorConstants.LOCATION, + i + ); + } + locationControlPoints[i].position = locations[i]; + } + + if (locationControlPoints.length > lenLocations) { + locationControlPoints.splice(lenLocations, locationControlPoints.length - lenLocations); + } + + for (var i = 0; i < locationControlPoints.length; i++) { + controlPoints.push(locationControlPoints[i]); + } - rotationControlPoint.userProperties.rotation = this.currentHeading; + for (var i = 0; i < lenLocations - 1; i++) { + this.createControlPoint( + controlPoints, + this.shadowControlPointAttributes, + ShapeEditorConstants.SHADOW, + lenLocations + i + ); - controlPoints.push(rotationControlPoint); + this.computeShadowPointLocations(shape, controlPoints[lenLocations + i], locations[i], locations[i + 1]); + } - this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); + controlPoints.push(rotationControlPoint); + } }; // Internal use only. diff --git a/src/util/editor/SurfaceRectangleEditorFragment.js b/src/util/editor/SurfaceRectangleEditorFragment.js index 46634128c..02312410e 100644 --- a/src/util/editor/SurfaceRectangleEditorFragment.js +++ b/src/util/editor/SurfaceRectangleEditorFragment.js @@ -62,11 +62,18 @@ define([ resizeControlPointAttributes, rotateControlPointAttributes) { - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.WIDTH); - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.HEIGHT); - this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); + console.dir(resizeControlPointAttributes) - this.createRotationAccessory(accessories, rotateControlPointAttributes); + if (resizeControlPointAttributes) { + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.WIDTH); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.HEIGHT); + } + + if (rotateControlPointAttributes) { + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); + + this.createRotationAccessory(accessories, rotateControlPointAttributes); + } }; // Internal use only. @@ -74,32 +81,46 @@ define([ globe, controlPoints, accessories) { - Location.greatCircleLocation( - shape.center, - 90 + shape.heading, - 0.5 * shape.width / globe.equatorialRadius, - controlPoints[0].position - ); - - Location.greatCircleLocation( - shape.center, - shape.heading, - 0.5 * shape.height / globe.equatorialRadius, - controlPoints[1].position - ); - - Location.greatCircleLocation( - shape.center, - shape.heading, - 0.8 * shape.height / globe.equatorialRadius, - controlPoints[2].position - ); - - controlPoints[0].userProperties.size = shape.width; - controlPoints[1].userProperties.size = shape.height; - controlPoints[2].userProperties.rotation = shape.heading; - - this.updateRotationAccessory(shape.center, controlPoints[2].position, accessories); + var length = controlPoints.length; + + if (length > 0) { + for (var i = 0; i < length; i++) { + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.WIDTH) { + Location.greatCircleLocation( + shape.center, + 90 + shape.heading, + 0.5 * shape.width / globe.equatorialRadius, + controlPoints[i].position + ); + + controlPoints[i].userProperties.size = shape.width; + } + + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.HEIGHT) { + Location.greatCircleLocation( + shape.center, + shape.heading, + 0.5 * shape.height / globe.equatorialRadius, + controlPoints[i].position + ); + + controlPoints[i].userProperties.size = shape.height; + } + + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { + Location.greatCircleLocation( + shape.center, + shape.heading, + 0.8 * shape.height / globe.equatorialRadius, + controlPoints[i].position + ); + + controlPoints[i].userProperties.rotation = shape.heading; + + this.updateRotationAccessory(shape.center, controlPoints[i].position, accessories); + } + } + } }; // Internal use only. diff --git a/src/util/editor/SurfaceSectorEditorFragment.js b/src/util/editor/SurfaceSectorEditorFragment.js index a78f91dec..bb5e0d00b 100644 --- a/src/util/editor/SurfaceSectorEditorFragment.js +++ b/src/util/editor/SurfaceSectorEditorFragment.js @@ -64,16 +64,20 @@ define([ accessories, resizeControlPointAttributes) { - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.MIN_CORNER); - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.MAX_CORNER); + if (resizeControlPointAttributes) { + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.MIN_CORNER); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.MAX_CORNER); + } }; // Internal use only. SurfaceSectorEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints) { - controlPoints[0].position = new Location(shape._sector.minLatitude, shape._sector.minLongitude); - controlPoints[1].position = new Location(shape._sector.maxLatitude, shape._sector.maxLongitude); + if (controlPoints.length > 0) { + controlPoints[0].position = new Location(shape._sector.minLatitude, shape._sector.minLongitude); + controlPoints[1].position = new Location(shape._sector.maxLatitude, shape._sector.maxLongitude); + } }; // Internal use only. From baf41b32f44dcac63d3038231605716302d32811 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 7 Jan 2019 16:05:01 +0200 Subject: [PATCH 100/112] add euler method to calculate new shape position --- src/shapes/SurfaceShape.js | 54 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/src/shapes/SurfaceShape.js b/src/shapes/SurfaceShape.js index bc5311a7f..a41ceed8b 100644 --- a/src/shapes/SurfaceShape.js +++ b/src/shapes/SurfaceShape.js @@ -804,6 +804,56 @@ define([ newLocations.push(new Location(newPos.latitude, newPos.longitude)); } } else { + // Euler method + + // var xVecOld = new Vec3(0, oldPoint[1], oldPoint[2]); + // var yVecOld = new Vec3(oldPoint[0], 0, oldPoint[2]); + // var zVecOld = new Vec3(oldPoint[0], oldPoint[1], 0); + // var xVecNew = new Vec3(0, newPoint[1], newPoint[2]); + // var yVecNew = new Vec3(newPoint[0], 0, newPoint[2]); + // var zVecNew = new Vec3(newPoint[0], newPoint[1], 0); + // + // + // var alpha = Math.acos(xVecOld.dot(xVecNew) / (xVecOld.magnitude() * xVecNew.magnitude())); + // var beta = Math.acos(yVecOld.dot(yVecNew) / (yVecOld.magnitude() * yVecNew.magnitude())); + // var gama = Math.acos(zVecOld.dot(zVecNew) / (zVecOld.magnitude() * zVecNew.magnitude())); + // + // var alpha = Math.atan2() + // + // var crossX = xVecOld.cross(xVecNew); + // var crossY = yVecOld.cross(yVecNew); + // var crossZ = zVecOld.cross(zVecNew); + // + // if(new Vec3(1, 0, 0).dot(crossX) < 0){ + // alpha = -alpha; + // } + // + // if(new Vec3(0, 1, 0).dot(crossY) < 0){ + // beta = -beta; + // } + // + // if(new Vec3(0, 0, 1).dot(crossZ) < 0){ + // gama = -gama; + // } + // + // for (var i = 0, len = locations.length; i < len; i++) { + // globe.computePointFromLocation(locations[i].latitude, locations[i].longitude, result); + // var newX = result[0] * Math.cos(beta) * Math.cos(gama) + + // result[1] * (Math.cos(beta) * (-Math.sin(gama))) + + // result[2] * Math.sin(beta); + // + // var newY = result[0] * ((-Math.sin(alpha)) * (-Math.sin(beta)) * (Math.cos(gama)) + Math.cos(alpha) * Math.sin(gama)) + + // result[1] * ( (-Math.sin(alpha)) * (-Math.sin(beta)) * (-Math.sin(gama)) + Math.cos(alpha) * Math.cos(gama) ) + + // result[2] * Math.sin(alpha) * Math.cos(beta); + // + // var newZ = result[0] * (Math.cos(alpha) * (-Math.sin(beta)) * Math.cos(gama) + Math.sin(alpha) * Math.sin(gama)) + + // result[1] * (Math.cos(alpha) * (-Math.sin(beta)) * (-Math.sin(gama)) + Math.sin(alpha) * Math.cos(gama)) + + // result[2] * Math.cos(alpha) * Math.cos(beta); + // + // globe.computePositionFromPoint(newX, newY, newZ, newPos); + // newLocations.push(new Location(newPos.latitude, newPos.longitude)); + // } + var delta_lat = newLocation.latitude - oldLocation.latitude; var delta_long = newLocation.longitude - oldLocation.longitude; var max = -90; @@ -840,8 +890,8 @@ define([ newLocations.push(new Location(new_lat, new_long)); } - if (max > 87) { - var delta = max - 87; + if (max > 90) { + var delta = max - 90; for (var i = 0, len = newLocations.length; i < len; i++) { newLocations[i].latitude -= delta; } From cb996701a490f1d4f0c8e7d5568937ad83ed03f6 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 10 Jan 2019 06:53:35 +0200 Subject: [PATCH 101/112] add shadow control poins layer --- src/util/editor/BaseSurfaceEditorFragment.js | 2 + src/util/editor/PlacemarkEditorFragment.js | 9 +- src/util/editor/ShapeEditor.js | 47 +++++++- .../editor/SurfaceCircleEditorFragment.js | 1 + .../editor/SurfaceEllipseEditorFragment.js | 2 + .../editor/SurfacePolygonEditorFragment.js | 12 ++ .../editor/SurfacePolylineEditorFragment.js | 108 ++++++++++-------- .../editor/SurfaceRectangleEditorFragment.js | 4 +- .../editor/SurfaceSectorEditorFragment.js | 1 + 9 files changed, 128 insertions(+), 58 deletions(-) diff --git a/src/util/editor/BaseSurfaceEditorFragment.js b/src/util/editor/BaseSurfaceEditorFragment.js index ddede0116..71017d9bd 100644 --- a/src/util/editor/BaseSurfaceEditorFragment.js +++ b/src/util/editor/BaseSurfaceEditorFragment.js @@ -114,6 +114,7 @@ define([ */ BaseSurfaceEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes, @@ -138,6 +139,7 @@ define([ BaseSurfaceEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, + shadowControlPoints, accessories) { throw new UnsupportedOperationError(Logger.logMessage( Logger.LEVEL_SEVERE, diff --git a/src/util/editor/PlacemarkEditorFragment.js b/src/util/editor/PlacemarkEditorFragment.js index 4c557ced2..0d980323e 100644 --- a/src/util/editor/PlacemarkEditorFragment.js +++ b/src/util/editor/PlacemarkEditorFragment.js @@ -52,14 +52,17 @@ define([ // Internal use only. PlacemarkEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes, moveControlPointAttributes) { - // we will use the same Placemark as control point - shape.userProperties.purpose = ShapeEditorConstants.DRAG; - controlPoints.push(shape); + if (moveControlPointAttributes) { + // we will use the same Placemark as control point + shape.userProperties.purpose = ShapeEditorConstants.DRAG; + controlPoints.push(shape); + } }; // Internal use only. diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index a3a298e0c..1ab3aa2fa 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -164,6 +164,10 @@ define([ // The layer that holds the control points created by the editor fragment. this.controlPointsLayer = new RenderableLayer("Shape Editor Control Points"); + // Internal use only. + // The layer that holds the shadow control points created by the editor fragment. + this.shadowControlPointsLayer = new RenderableLayer("Shape Editor Shadow Control Points"); + // Internal use only. // The layers that holds the additional accessories created by the editor fragment. this.accessoriesLayer = new RenderableLayer("Shape Editor Accessories"); @@ -407,6 +411,7 @@ define([ var moveControlAttributes = this._moveControlPointAttributes; var resizeControlAttributes = this._resizeControlPointAttributes; var rotateControlAttributes = this._rotateControlPointAttributes; + var shadowControlAttributes = this._shadowControlPointAttributes; if (!this._allowMove) { moveControlAttributes = null; @@ -420,6 +425,10 @@ define([ rotateControlAttributes = null; } + if (!this._allowManageControlPoint) { + shadowControlAttributes = null; + } + if (this._worldWindow.indexOfLayer(this.shadowShapeLayer) == -1) { this._worldWindow.insertLayer(0, this.shadowShapeLayer); } @@ -428,6 +437,11 @@ define([ this._worldWindow.addLayer(this.controlPointsLayer); } + if (this._worldWindow.indexOfLayer(this.shadowControlPointsLayer) == -1) { + this._worldWindow.addLayer(this.shadowControlPointsLayer); + } + + if (this._worldWindow.indexOfLayer(this.accessoriesLayer) == -1) { this._worldWindow.addLayer(this.accessoriesLayer); } @@ -439,11 +453,12 @@ define([ this.activeEditorFragment.initializeControlElements( this._shape, this.controlPointsLayer.renderables, + this.shadowControlPointsLayer.renderables, this.accessoriesLayer.renderables, resizeControlAttributes, rotateControlAttributes, moveControlAttributes, - this._shadowControlPointAttributes + shadowControlAttributes ); this.updateControlElements(); @@ -455,6 +470,9 @@ define([ this._worldWindow.removeLayer(this.controlPointsLayer); this.controlPointsLayer.removeAllRenderables(); + this._worldWindow.removeLayer(this.shadowControlPointsLayer); + this.shadowControlPointsLayer.removeAllRenderables(); + this._worldWindow.removeLayer(this.accessoriesLayer); this.accessoriesLayer.removeAllRenderables(); @@ -471,6 +489,7 @@ define([ this._shape, this._worldWindow.globe, this.controlPointsLayer.renderables, + this.shadowControlPointsLayer.renderables, this.accessoriesLayer.renderables ); }; @@ -539,7 +558,7 @@ define([ // The editor provides vertex insertion and removal for SurfacePolygon and SurfacePolyline. - // Long press when the cursor is over the shape inserts a control point near the position + // Single click when the cursor is over a shadow control point inserts a control point near the position // of the cursor. this._longPressTimeout = setTimeout(function () { if (allowVertex) { @@ -570,6 +589,10 @@ define([ this.beginAction(terrainObject.position, this._allowManageControlPoint, userObject); event.preventDefault(); break; + } else if (this.shadowControlPointsLayer.renderables.indexOf(userObject) !== -1) { + this.beginAction(terrainObject.position, this._allowManageControlPoint, userObject); + event.preventDefault(); + break; } } } @@ -628,11 +651,14 @@ define([ var terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); // The editor provides vertex insertion and removal for SurfacePolygon and SurfacePolyline. - // Double clicking when the cursor is over a control point will remove it. + // Double click when the cursor is over a control point will remove it. + // Single click when the cursor is over a shadow control point will add it. + console.dir(this.actionType) if (this.actionType) { if (this._click0Time && this._click1Time) { if (this._click1Time <= this._clickDelay) { if (this.actionControlPoint + && this.actionType == 'location' && terrainObject && this._allowManageControlPoint) { this.actionSecondaryBehavior = true; @@ -642,6 +668,18 @@ define([ clearTimeout(this._dbclickTimeout); this._click0Time = 0; this._click1Time = 0; + + } else { + if (this.actionType == 'shadow' && this._allowManageControlPoint) { + this.activeEditorFragment.addNewVertex( + this._shape, + this._worldWindow.globe, + terrainObject.position + ); + + this.updateControlElements(); + this._worldWindow.redraw(); + } } this.endAction(); @@ -724,7 +762,8 @@ define([ if ((purpose === ShapeEditorConstants.ROTATION && this._allowRotate) || (purpose !== ShapeEditorConstants.ROTATION && this._allowReshape) || - (purpose === ShapeEditorConstants.LOCATION && this._allowManageControlPoint && this.actionSecondaryBehavior)) { + (purpose === ShapeEditorConstants.LOCATION && this._allowManageControlPoint && this.actionSecondaryBehavior) || + (purpose === ShapeEditorConstants.SHADOW && this._allowManageControlPoint && this.actionSecondaryBehavior)) { this.activeEditorFragment.reshape( this._shape, this._worldWindow.globe, diff --git a/src/util/editor/SurfaceCircleEditorFragment.js b/src/util/editor/SurfaceCircleEditorFragment.js index 3381dc4cd..651aa0711 100644 --- a/src/util/editor/SurfaceCircleEditorFragment.js +++ b/src/util/editor/SurfaceCircleEditorFragment.js @@ -52,6 +52,7 @@ define([ // Internal use only. SurfaceCircleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes) { if (resizeControlPointAttributes) { diff --git a/src/util/editor/SurfaceEllipseEditorFragment.js b/src/util/editor/SurfaceEllipseEditorFragment.js index 8ae9d80a1..57da160a9 100644 --- a/src/util/editor/SurfaceEllipseEditorFragment.js +++ b/src/util/editor/SurfaceEllipseEditorFragment.js @@ -58,6 +58,7 @@ define([ // Internal use only. SurfaceEllipseEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes) { @@ -78,6 +79,7 @@ define([ SurfaceEllipseEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, + shadowControlPoints, accessories) { var length = controlPoints.length; diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index dae899c97..8d520e453 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -60,6 +60,7 @@ define([ // Internal use only. SurfacePolygonEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes, @@ -88,6 +89,17 @@ define([ this.createRotationAccessory(accessories, rotateControlPointAttributes); } + + if (shadowControlPointAttributes) { + for (var i = 0, len = locations.length - 1; i < len; i++) { + this.createControlPoint( + shadowControlPoints, + shadowControlPointAttributes, + ShapeEditorConstants.SHADOW, + i + ); + } + } }; // Internal use only. diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index d77bb05a4..a5822e1a0 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -60,6 +60,7 @@ define([ // Internal use only. SurfacePolylineEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes, @@ -88,12 +89,24 @@ define([ this.createRotationAccessory(accessories, rotateControlPointAttributes); } + + // if (shadowControlPointAttributes) { + // for (var i = 0, len = locations.length - 1; i < len; i++) { + // this.createControlPoint( + // shadowControlPoints, + // shadowControlPointAttributes, + // ShapeEditorConstants.SHADOW, + // i + // ); + // } + // } }; // Internal use only. SurfacePolylineEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, + shadowControlPoints, accessories) { var locations = shape.boundaries; var lenLocations = locations.length; @@ -101,70 +114,67 @@ define([ var locationControlPoints = []; var rotationControlPoint = null; - console.dir(shape.pathType); - - if (lenControlPoints > 0) { - for (var i = lenControlPoints - 1; i > -1; i--) { - if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { - rotationControlPoint = controlPoints[i]; - var polygonCenter = this.getCenterFromLocations(globe, locations); - var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); + for (var i = lenControlPoints - 1; i > -1; i--) { + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { + rotationControlPoint = controlPoints[i]; - Location.greatCircleLocation( - polygonCenter, - this.currentHeading, - polygonRadius, - rotationControlPoint.position - ); + var polygonCenter = this.getCenterFromLocations(globe, locations); + var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); - rotationControlPoint.userProperties.rotation = this.currentHeading; + Location.greatCircleLocation( + polygonCenter, + this.currentHeading, + polygonRadius, + rotationControlPoint.position + ); - this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); - } + rotationControlPoint.userProperties.rotation = this.currentHeading; - if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.LOCATION) { - locationControlPoints.push(controlPoints[i]); - } - controlPoints.pop(); + this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); } - locationControlPoints.reverse(); - var lenLocationControlPoints = locationControlPoints.length; - - for (var i = 0; i < lenLocations; i++) { - if (i >= lenLocationControlPoints) { - this.createControlPoint( - locationControlPoints, - this.moveControlPointAttributes, - ShapeEditorConstants.LOCATION, - i - ); - } - locationControlPoints[i].position = locations[i]; + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.LOCATION) { + locationControlPoints.push(controlPoints[i]); } + controlPoints.pop(); + } - if (locationControlPoints.length > lenLocations) { - locationControlPoints.splice(lenLocations, locationControlPoints.length - lenLocations); - } + locationControlPoints.reverse(); + var lenLocationControlPoints = locationControlPoints.length; - for (var i = 0; i < locationControlPoints.length; i++) { - controlPoints.push(locationControlPoints[i]); - } - - for (var i = 0; i < lenLocations - 1; i++) { + for (var i = 0; i < lenLocations; i++) { + if (i >= lenLocationControlPoints) { this.createControlPoint( - controlPoints, - this.shadowControlPointAttributes, - ShapeEditorConstants.SHADOW, - lenLocations + i + locationControlPoints, + this.moveControlPointAttributes, + ShapeEditorConstants.LOCATION, + i ); - - this.computeShadowPointLocations(shape, controlPoints[lenLocations + i], locations[i], locations[i + 1]); } + locationControlPoints[i].position = locations[i]; + } + + if (locationControlPoints.length > lenLocations) { + locationControlPoints.splice(lenLocations, locationControlPoints.length - lenLocations); + } - controlPoints.push(rotationControlPoint); + for (var i = 0; i < locationControlPoints.length; i++) { + controlPoints.push(locationControlPoints[i]); } + + for (var i = 0; i < lenLocations - 1; i++) { + this.createControlPoint( + shadowControlPoints, + this.shadowControlPointAttributes, + ShapeEditorConstants.SHADOW, + lenLocations + i + ); + + this.computeShadowPointLocations(shape, shadowControlPoints[i], locations[i], locations[i + 1]); + } + + controlPoints.push(rotationControlPoint); }; // Internal use only. diff --git a/src/util/editor/SurfaceRectangleEditorFragment.js b/src/util/editor/SurfaceRectangleEditorFragment.js index 02312410e..c5326ed20 100644 --- a/src/util/editor/SurfaceRectangleEditorFragment.js +++ b/src/util/editor/SurfaceRectangleEditorFragment.js @@ -58,12 +58,11 @@ define([ // Internal use only. SurfaceRectangleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes) { - console.dir(resizeControlPointAttributes) - if (resizeControlPointAttributes) { this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.WIDTH); this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.HEIGHT); @@ -80,6 +79,7 @@ define([ SurfaceRectangleEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, + shadowControlPoints, accessories) { var length = controlPoints.length; diff --git a/src/util/editor/SurfaceSectorEditorFragment.js b/src/util/editor/SurfaceSectorEditorFragment.js index bb5e0d00b..9e6bdf6bb 100644 --- a/src/util/editor/SurfaceSectorEditorFragment.js +++ b/src/util/editor/SurfaceSectorEditorFragment.js @@ -61,6 +61,7 @@ define([ // Internal use only. SurfaceSectorEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes) { From 032723ed05ac937f664935f00fea37b946763db3 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 10 Jan 2019 13:27:37 +0200 Subject: [PATCH 102/112] add shadow control points layer to polygon --- src/util/editor/SurfacePolygonEditorFragment.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index 8d520e453..c78bbbd5a 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -106,6 +106,7 @@ define([ SurfacePolygonEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, + shadowControlPoints, accessories) { var locations = this.getLocations(shape); var lenLocations = locations.length; From 36e972b2822ae88b772e3c6b224dd50bbb8f3a26 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Thu, 10 Jan 2019 13:45:28 +0200 Subject: [PATCH 103/112] clear long press action --- src/util/editor/ShapeEditor.js | 48 ---------------------------------- 1 file changed, 48 deletions(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 1ab3aa2fa..63d131057 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -205,14 +205,6 @@ define([ // Flag indicating whether the action should trigger the secondary behavior in the editor fragment. this.actionSecondaryBehavior = false; - // Internal use only. - // The client X position at the start of the action. - this.actionStartX = null; - - //Internal use only. - // The client Y position at the start of the action. - this.actionStartY = null; - // Internal use only. // The current client X position for the action. this.actionCurrentX = null; @@ -237,12 +229,6 @@ define([ this._dbclickTimeout = 0; this._clickDelay = 500; - // Internal use only. - // counters used to detect long press event (time measured in ms) - this._longPressTimeout = 0; - this._longPressDelay = 1500; - - this._worldWindow.worldWindowController.addGestureListener(this); }; @@ -518,8 +504,6 @@ define([ var x = event.clientX, y = event.clientY; - this.actionStartX = x; - this.actionStartY = y; this.actionCurrentX = x; this.actionCurrentY = y; @@ -546,34 +530,6 @@ define([ ); } - var allowVertex = terrainObject - && this.actionStartX === this.actionCurrentX - && this.actionStartY === this.actionCurrentY - && this._allowManageControlPoint; - - // counter for long-press detection - clearTimeout(this._longPressTimeout); - - var context = this; - - - // The editor provides vertex insertion and removal for SurfacePolygon and SurfacePolyline. - // Single click when the cursor is over a shadow control point inserts a control point near the position - // of the cursor. - this._longPressTimeout = setTimeout(function () { - if (allowVertex) { - context.activeEditorFragment.addNewVertex( - context._shape, - context._worldWindow.globe, - terrainObject.position - ); - - context.updateControlElements(); - context._worldWindow.redraw(); - } - }, this._longPressDelay - ); - for (var p = 0, len = pickList.objects.length; p < len; p++) { var object = pickList.objects[p]; @@ -614,8 +570,6 @@ define([ this._click1Time = 0; } - clearTimeout(this._longPressTimeout); - if (this.actionType) { var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); @@ -684,8 +638,6 @@ define([ this.endAction(); } - - clearTimeout(this._longPressTimeout); }; // Internal use only. From 9c657880e9d696b08736906bff4e39e06c2e12ec Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Sun, 13 Jan 2019 07:53:04 -0800 Subject: [PATCH 104/112] Updated README --- build/dist/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/dist/README.md b/build/dist/README.md index 2405cf7bd..5fcc7951c 100644 --- a/build/dist/README.md +++ b/build/dist/README.md @@ -7,6 +7,8 @@ __WorldWindJS__ is a fork of the popular [Web WorldWind](https://github.com/NASA library from NASA and ESA. This fork provides a release channel for builds based on the latest fixes and features from WebWorldWind's develop branch plus several enhancements from the WorldWind community. +Show your support for this project by giving it a [star](https://github.com/emxsys/worldwindjs/stargazers)! + ### Enhancements include: - A template for creating geo-browser web apps with Bootstrap and Knockout (apps/worldwind-app-template). @@ -18,7 +20,8 @@ and features from WebWorldWind's develop branch plus several enhancements from t ### Migrating from NASA WebWorldWind - The WorldWindJS npm package is available in the [npm repository](https://www.npmjs.com/package/worldwindjs). -- The project supports npm dependencies on its git repository: See [npm dependencies](https://github.com/emxsys/worldwindjs/wiki/npm-dependencies)is in the wiki. +- WorldWindJS is available on the __unpkg__ and __jsDelivr__ CDNs. See [CDN providers](https://github.com/emxsys/worldwindjs/wiki/CDN-providers) in the wiki for examples. +- The project supports npm dependencies on its git repository: See [npm dependencies](https://github.com/emxsys/worldwindjs/wiki/npm-dependencies) in the wiki for examples. - The JS libraries (production and debug) and the image resources are available in the [GitHub releases](https://github.com/emxsys/worldwindjs/releases/latest). From 4be9c95a92092bde9f442d46d62c489f5966723d Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Sun, 13 Jan 2019 07:53:52 -0800 Subject: [PATCH 105/112] Added words to spellchecker word list --- nbproject/project.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nbproject/project.xml b/nbproject/project.xml index 8c7daba6d..6d3ea0126 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -5,5 +5,14 @@ WorldWindJS + + API + JavaScript + NodeJS + npm + WebWorldWind + WorldWind + WorldWindJS + From 3fe8a3deb9231fc66f01555600e2eb244bd72d98 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 14 Jan 2019 14:41:43 +0200 Subject: [PATCH 106/112] cleanup --- .../editor/SurfacePolygonEditorFragment.js | 56 +++++++++---------- .../editor/SurfacePolylineEditorFragment.js | 29 +++++----- 2 files changed, 40 insertions(+), 45 deletions(-) diff --git a/src/util/editor/SurfacePolygonEditorFragment.js b/src/util/editor/SurfacePolygonEditorFragment.js index c78bbbd5a..10a3ef881 100644 --- a/src/util/editor/SurfacePolygonEditorFragment.js +++ b/src/util/editor/SurfacePolygonEditorFragment.js @@ -114,32 +114,28 @@ define([ var locationControlPoints = []; var rotationControlPoint = null; - if (lenControlPoints > 0) { - for (var i = lenControlPoints - 1; i > -1; i--) { - if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { - rotationControlPoint = controlPoints[i]; - - var polygonCenter = this.getCenterFromLocations(globe, locations); - var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); - - Location.greatCircleLocation( - polygonCenter, - this.currentHeading, - polygonRadius, - rotationControlPoint.position - ); - - rotationControlPoint.userProperties.rotation = this.currentHeading; - - this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); - } + for (var i = lenControlPoints - 1; i > -1; i--) { + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { + rotationControlPoint = controlPoints[i]; + + var polygonCenter = this.getCenterFromLocations(globe, locations); + var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); + + Location.greatCircleLocation( + polygonCenter, + this.currentHeading, + polygonRadius, + rotationControlPoint.position + ); - if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.LOCATION) { - locationControlPoints.push(controlPoints[i]); - } + rotationControlPoint.userProperties.rotation = this.currentHeading; - controlPoints.pop(); + this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); + } else { + locationControlPoints.push(controlPoints[i]); } + + controlPoints.pop(); } locationControlPoints.reverse(); @@ -165,25 +161,25 @@ define([ controlPoints.push(locationControlPoints[i]); } - for (var i = 0; i < lenLocations - 1; i++) { + for (var i = 0; i < controlPoints.length - 1; i++) { this.createControlPoint( - controlPoints, + shadowControlPoints, this.shadowControlPointAttributes, ShapeEditorConstants.SHADOW, - lenLocations + i + i ); - this.computeShadowPointLocations(shape, controlPoints[lenLocations + i], locations[i], locations[i + 1]); + this.computeShadowPointLocations(shape, shadowControlPoints[i], locations[i], locations[i + 1]); if (i == lenLocations - 2) { this.createControlPoint( - controlPoints, + shadowControlPoints, this.shadowControlPointAttributes, ShapeEditorConstants.SHADOW, - lenLocations + i + 1 + i + 1 ); - this.computeShadowPointLocations(shape, controlPoints[lenLocations + i + 1], locations[i + 1], locations[0]); + this.computeShadowPointLocations(shape, shadowControlPoints[i + 1], locations[i + 1], locations[0]); } } diff --git a/src/util/editor/SurfacePolylineEditorFragment.js b/src/util/editor/SurfacePolylineEditorFragment.js index a5822e1a0..53374d46a 100644 --- a/src/util/editor/SurfacePolylineEditorFragment.js +++ b/src/util/editor/SurfacePolylineEditorFragment.js @@ -90,16 +90,16 @@ define([ this.createRotationAccessory(accessories, rotateControlPointAttributes); } - // if (shadowControlPointAttributes) { - // for (var i = 0, len = locations.length - 1; i < len; i++) { - // this.createControlPoint( - // shadowControlPoints, - // shadowControlPointAttributes, - // ShapeEditorConstants.SHADOW, - // i - // ); - // } - // } + if (shadowControlPointAttributes) { + for (var i = 0, len = locations.length - 1; i < len; i++) { + this.createControlPoint( + shadowControlPoints, + shadowControlPointAttributes, + ShapeEditorConstants.SHADOW, + i + ); + } + } }; // Internal use only. @@ -132,11 +132,10 @@ define([ rotationControlPoint.userProperties.rotation = this.currentHeading; this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); - } - - if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.LOCATION) { + } else { locationControlPoints.push(controlPoints[i]); } + controlPoints.pop(); } @@ -163,12 +162,12 @@ define([ controlPoints.push(locationControlPoints[i]); } - for (var i = 0; i < lenLocations - 1; i++) { + for (var i = 0; i < controlPoints.length - 1; i++) { this.createControlPoint( shadowControlPoints, this.shadowControlPointAttributes, ShapeEditorConstants.SHADOW, - lenLocations + i + i ); this.computeShadowPointLocations(shape, shadowControlPoints[i], locations[i], locations[i + 1]); From 39857d9641b9c56185bd54a188cd8eaad9264bb9 Mon Sep 17 00:00:00 2001 From: Claudia Ifrim Date: Mon, 14 Jan 2019 15:21:52 +0200 Subject: [PATCH 107/112] cleanup debug message --- src/util/editor/ShapeEditor.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/util/editor/ShapeEditor.js b/src/util/editor/ShapeEditor.js index 63d131057..20fc141bd 100644 --- a/src/util/editor/ShapeEditor.js +++ b/src/util/editor/ShapeEditor.js @@ -607,7 +607,6 @@ define([ // The editor provides vertex insertion and removal for SurfacePolygon and SurfacePolyline. // Double click when the cursor is over a control point will remove it. // Single click when the cursor is over a shadow control point will add it. - console.dir(this.actionType) if (this.actionType) { if (this._click0Time && this._click1Time) { if (this._click1Time <= this._clickDelay) { From ef5681770e2dfbbbebda9bd62b5c9c68b8b2324e Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Mon, 14 Jan 2019 06:29:46 -0800 Subject: [PATCH 108/112] Enabled all editing features (move, reshape, rotate, manageControlPoint) - Enabled all the editing features for all the shapes in the example. --- examples/ShapeEditor.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/ShapeEditor.js b/examples/ShapeEditor.js index 0a19fa495..ea71fc520 100644 --- a/examples/ShapeEditor.js +++ b/examples/ShapeEditor.js @@ -247,7 +247,7 @@ requirejs(['./WorldWindShim', document.getElementById("editEllipseBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== ellipseShape) { - shapeEditor.edit(ellipseShape, false, true, false, true); + shapeEditor.edit(ellipseShape, true, true, true, true); } }); @@ -261,14 +261,14 @@ requirejs(['./WorldWindShim', document.getElementById("editPolygonBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== polygonShape) { - shapeEditor.edit(polygonShape, true, false, true, true); + shapeEditor.edit(polygonShape, true, true, true, true); } }); document.getElementById("editMultiPolygonBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== multiPolygonShape) { - shapeEditor.edit(multiPolygonShape, false, true, true, true); + shapeEditor.edit(multiPolygonShape, true, true, true, true); } }); @@ -282,7 +282,7 @@ requirejs(['./WorldWindShim', document.getElementById("editRectangleBtn").addEventListener("click", function(){ var shape = shapeEditor.stop(); if (shape !== rectangleShape) { - shapeEditor.edit(rectangleShape, true, false, false, true); + shapeEditor.edit(rectangleShape, true, true, true, true); } }); From f4078974bd2c90971f626cbffbabf68cee254d89 Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Mon, 14 Jan 2019 06:33:36 -0800 Subject: [PATCH 109/112] Added vertex/control-point images used by ShapeEditor. - Added images to /build/dist/images --- build/dist/images/blue-dot.png | Bin 0 -> 2816 bytes build/dist/images/gray-dot.png | Bin 0 -> 2572 bytes build/dist/images/green-dot.png | Bin 0 -> 2378 bytes build/dist/images/yellow-dot.png | Bin 0 -> 2536 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 build/dist/images/blue-dot.png create mode 100644 build/dist/images/gray-dot.png create mode 100644 build/dist/images/green-dot.png create mode 100644 build/dist/images/yellow-dot.png diff --git a/build/dist/images/blue-dot.png b/build/dist/images/blue-dot.png new file mode 100644 index 0000000000000000000000000000000000000000..55c174ea467426ab5eba3f1ac2172ed531795e3a GIT binary patch literal 2816 zcmV+b3;*zksc>R*Fc;!pfT1Fg@oPHIg~EbI<2~?>(n`&jm$I>1nGX z0O^cvhQ~tw*|~Xt)f2Te<3piA(=B5vGOAM6-f!`^@w(fsRsP(+R=X6lbnsLQ59x+! z3y%v=uGoglTf$9xQd<%}5$-bOg2Feh9xd{-%ZVa?x@@Z9VNe=`{fS>3{l$9HObg4) zX-}te`pO3>q1cZ=s2$(P_+q#yyJWvI8NaZybo}m zDdlJPVc<>ld`WBH1K&EFUX--xHk@rh%e|qQ+PCBtSK@JaIfnWQ_lMqzW^MqXT-a-!Z82<010qNS#tmY3ljhU3ljkVnw%H_00|^XL_t(| zoaLK)kW|GL#($^p%s#7Gs6RB8*Mq`2| zsRB%*7GgyKQ}I#8m|z5rfCeMJ2#BJrP`n?zJeGa$?9ALg`D5nJorPWYjl08FH8p)t z_w738>(h_h-ACwRsHy{;51bu!^~~xJg{pilJxKqIAbkL>YoIFZa?rKxOAD|wJDvXp z9a#ZjZ6_-0Y-n?-U30M7-lMAdU$tE=LRHT_RAc`c zirD(r8K@eHw2q8W#JV4Ewf}v6y*s`$b(YSkL{*1Y)akt3EV=sVJXpU|S@nhT-ezTY zxl&pQWtB=O0wR!;3H@?~zB#e~!KcCaa}1*g3#JJTH)j*&!Nu7y|ETK>95dHV}Xd2RdZ&+io@V&Vwlsv<*vug3YG?ba<7b$b0p zh0Z7KwV_=EsH)V2bY^;xc|k`4o_v25EL>%IYL#Vod50S2D5M48){6|Yiw$Sw`)Y@y zsw+0?a$w5Dkxo@x>uoaus+v_*uZvI0lm-e470B> z6y*8p?>MNnCHwT^D~p`9ZKuEIssyZng)tAx&k_k{&3DXutd28eGHT+178YsMc zm&2e_W2RWEyi=kJE*)m>Y|Q}KDgq)=J04+Kz=#1@yIuM2V{WJS^Y$V)3l{&-q4->r zkgeEg-@M{%=gOAeZIJ*~Jue*9)oB4qgP6Xw1D&mn7`ce^XFZ(do+BL_}K)*+^J6D`JGMn{!4~AbDAsP zECH%o5OMXxpd)<&{_>vXmZw~7H#Qz(3#%t@arn_?vF;Fcm5qD2apXYrLX+j25~`|+ zyZsn|vwkZPJaw+Kd8)G?r$dy>o1R~YF=`gBR$|c zpcr7|9%arydXV2YgWvzlbV^yaB>^ZEw^g++thinN;*IDY~GeSYWXl5!T7gQZG)a}fNu~te$zfpS>pjJ>R{#Pz88GBRi_%@Tb^Le z<`f$Go56od{4Q>UQH=@MlKKSfI^?H&XUJIw80iU41Ok$`@p7{mV1P7FP+FP#1nesJ z)45sX86dIZZ|WE-)vzaN``#D=21qP>oaVMiQV8{7I8+l$i^NP$@_-Y-1%QS~%nJf0 zwh~Nuz=_ZW0P=dp3^jr_@_-Ye3uLB|I7+Lkr?!y?1Ov^yl|snN_T9WXM7aT~J;6Bx zQoj$J*~d@UHc)1OcRj(l!qg{V%n;wkhN$i^zzR<=?(3;fz}TU_jS-g>65kps1x{6s zeGXUDeP#M}DMX;`@gS%4PKfeN{0x1iS0I_8RKv(KBw_sC3f(Uv<=({ScZ0&zoeQUr z^KA=-c^mvKu>=9%8P)XFw4RR4G?+HlC!ipoKR}!S5!nW80~mI?@V)a>&kL^orXe>g zmflyPhl7r+fyU;i%e?1Le0~UcyQdsRj}UhYwzBNKb*KadtY)nd~>_!5W?xky7vZ$Yx#u>;yO? zU%36!p6>;-COY&#IoA5M4H`NZvu(yv}KjL_p}@tBq9yT<&N@k z5s3oV1C;>h4HBN2;orUM2`~an?(mHdMKqe5#pOpD56xVX5|K^76u<&ZxxnziH9ccI z5P`?0IZPape50J(Gt$harph;Km53|{W_i!Qy3XOJSDJ3^2_i6ms>5C1_RXrO)8}%s z%%W!BIaY=7FU4noTRqvrRhF4c+-`S-E&}tW#u~}P?s8o^AWyCpk!H1R&0XPi;0@qn zPqy-NW%8e*?T!TLZ1m26h0`6TT;LnOrA(I%K20XI6m`}rhmMo5fFw`YT&mo>(B=KF z_&9BNf8lR;I~4ZwP1#?iFP?gmOl?ibU0dP>1o#Osm!z>{@w=A$UUVs~Y@6a8g=1jG z#fEt|Ib_8T_o7y{rk;m$v*qE|#v8ULWM;foeaVRAc(UpcJp8K5AK$cukHgiv%ZCf| zraBZA`05|1){5+OuF6g~@3*C{_6AK20bT}*lI6S0l|`$SXIERc?(f{LVFWH5D$Kgt zVbaLPYVSCx%Lew58{*$HZ9=;zHI0SDP6K`o6dakq>I>zWcPvZSTPi!S$5>P#+%(2; z<7jCVBn7a)N=x#xnHdb2x7u5Ohi7$F%>eGSs`nd_lbb42vQPPFoAU8C<)f|2wga)C z$xs9uB49NZ4L0Z$VQ4>LXkRGoD~ui@4DWxmilr60Gb^2$CuPcO9Sxl9G^lEhs?Jf> z1FZ{&_0bSfb!|&!Y2RXt0UplflXE>?t)W2kowC61Bxz=rs5OZ?-k%kY0URI)PM Sn=0P`0000| z`4U?^J3l9}Tf7UMAQJ>|GQ}99_~~azWg;+8}L-p{}uhPGR1St|9cywB+) zgf`@>ZeafadgZ)h`4^KVXZp21mooqW010qNS#tmY3ljhU3ljkVnw%H_00=NiL_t(| zoaI|hj3Y-C{$7>aZF~GPGi!T2JI)B$4G}*A5{V#jAVQ!;5vxd`MJ#~>i4q~LRze&Q z2Xa6`3#SCQph!rtESG@b0*Fn3jgTM;Ab|qPAu9z9Se~89{Mj>h+wPyL$HDI2w%4=c z@z|cfPqNhYs=DUYH?OLzUcE;cGniQd_y~aaGxIyN)(-%9ClSpPQ5FDet+$zZ9l$aX zm4p!gB%+%D-XJ19ZXHJsW;U7mQP1{E+8) zzg9{$2N|GJinZ1Qk)f1QjYi|u?d|RJqtuy3(FrrZTPgLtl=9R4>RYWA>h(GrjRsuT zh39$jJP*ta0FY855{V!ZiNG)nM59q8lSw2JiN1f&w(Yl>`5UoV>^c$gestd#0nA)f zN_|%d@kJt{kQ}vI4b^HDmSsUHHB|pnN+gp>q*5uQQYlC&yXsr5)>}%ci^*j2U&D@J zC<2(7lu}oO5YH1)#Fu-Xhf1Y_&CN}?t~;zweL+N+nVCT@mxEy#VO_XhufGJ~QaYX9 z-gCcueSw)1N~xbpDKGjmtu-wqtSROolgH`;C=>e$jld*`4>bK z2ioRdE|*cS*Y~XaC=rXru&}UzXf*2U3CprxNG6k)2U#EoB0y_>9>5JE5&+O_Hc={- zMn2Dng_IJ-ViBoSDv;Id_1~vbsZZ_p?ydwd^TW*iXCjIMZIfSGT7uSxZ-bW0<#77+ z>7ZPz)vl$}=_l^>&OHfW=Jzo3--sv$0PE}PSXo&aiL&EDHk(DEPzcJFWj&KjCa><) zen$eB`95a;I}sHCpjxe>TrQ7P*>T~_nKPK3odwWd6Kvc5LOdRSv0q!!Psq%InP2n= zU$57(w6rufg-4C$<>g>;CL$PyalKxzpXt}OF986aCZdl5?QLwSR2uvDeUxBklu9ME zS}g#8l+qxgSNgTRivVVxXXfYpj>_fopKxEde@Kz#n#r= zfhamo)M~Zhi(nW=Mk)1i;En}6>F@Qc)#|aB`@PUwcb!}v$9W34L%?HxMWfM}tY#C$ z_Vyizk(Bb203et-0^lLP;y4pftJMPQjz*(7rPQ1N@Lm9Mp#AM1)`58xpp@$Rx-}Y& z#|3~7hXeFoSL9^LB2%RR1Fac7^q5u%>S9x5~V*#@Q zK;X{~UG5xPgx&W<6cGT9@3P+qTI=waPM$am01)g2hzKXn0sw?BS^30SfDj@Wr`Fm! zaTXB1VpmFS3IH`<5R1hQLZ^wM=W6|J0pKsbU}|dWAat52!ciw$>;DM=H+{iLBY>H2 z3IJ~aSOwZspf?QVxFJly)YR0kMCT6um3|G58)C5-B9V4PkL$XtM6~I9gigdXn3 z^7%XfKx^F+Ld+3S)vxcm9w(v}fN%NbTrL-UH;*C`i3D=FTu|0pUkwi)=o2K>xhQ!Z z!25u1;J^38s2cZw1N z5xoT9>wY<(&*Rjo!=JS>H#gU%r&8)?kx1m)PVIM#6eR#Z2JmHHwz;{9<>lo=d4=9P zc-M7*V;II~h-gQz*C4UNCV-a#JmSkN%R;GCIy4ulLI}*y&v$L%ZQH(Kn&ySwvd#wD z>2yeV0U=9p90%oc`M~cJP1D4}!U9aw3}l|?{X7zhJU&Ru-Cptq2*6hXJcrQQQLR?7 zva)g@2@^9jGbj`a5JLDmvex=pDdn?+<{J)^GIPF@I1$*}BvWPpAel^}P$+acaXrtg z3LzeqQvP)>eGQv5bw7Y#0{B2!?z%3j)ha5L3LM87rt5oRYHAAEZ1ygnh2uCkqS5H* zJLj1_Vd&Eiw^L%j1mN2M?(40$EDM!N1+`jjUyEfd7Q^)PG%}e?mrEM}JkPr&rMx19 z_~Wqs@B6sdIY3=z=4Xg#re7P|w$W@hgP-F#U}i9Lu*D`KM59qeqfwZq3DY!@NF=%z zHy^I+mV^*jq?EtiZ{p<0z|0wDzRJvN1LeYoFi85W*4l9#=MP%z3x1H}p#(EaX8ss6 ze~+2}yH_%L2kpA<%gp>aW*&>TcC1Wx{!<@BI}GQn|6}H}01N<%nKghGfF=>$BBIv; i{JZmet8+LT8~zU|`{0)(p@@Tj6{ zIpGQ6skNMH^0sihl8P=1p9=SCazWu+Q;(JT#pGm}zf9I5p#WH0gk8xhj#aUe(lWyG za@?78UirO``4UGwI~$hRE#8Grh#-DkOfp7*AqE(cc?d5)`ea3o{QjT(8CE4%ky)jH z#tKPN#k} zt>mvB!0@~1#fs+M2j>QyT~@T%4xDd7=Yty6qCb*N+?q(h>j^Z^L)$epEtY%syU+1G zMAqf2u3&c$dgQ!w=^JhcXX$SC<$?eJ010qNS#tmY3ljhU3ljkVnw%H_00(YKL_t(| zoaLKaY!ufW#=n{M6=JislL`|m5lBK>Hwm%j~%rDzE_oNl!@n`G`iA4QOB`;(>CN-(R7MdnGZf;aF11 z8!4rJC{tP2LM^;ds?w8^E*plCF0_w%H=rE&ZH(CAVTSw3(fa96bkK3`1~>i+)cVb9 zS_6L3N8bkt67d-lBtc?EVkAhUT4_DgMAOE6`fTJQ6X4;fqWgjh{%*oOp^LhxPxYzJ z>a4oet&l}4rSb0&Q&lu^b@yu?+mW{F^7rJHDKYNDySSmYP<)Bi8869Wve zlbw`Po_FGt3DHO+U36s$(Mjjv2~Pa7(BvN)WU#|q@VmUr5|$L4_;{34&da<^oU#5k zN;Gwx<1ZG9{L>cJuv1uw5F6M~bmHT&n$>*AcdiI2Qnb)=5XeghFG;eoH`>@Kr;t`! z3)0SWMUWuJIF{8UKH-xSc_9z{+QPEDRlbr+-${>$iODW@k!EZ_I?nO8=Su#k7FNv3 za3A|HFnlLF6?U>St0tV{)ZcO?|C1!iADoPia0C<6cY@Qwz~CSUT>)%tE^=|xY{{Dz z))^<0W|}Fb)OT_-MF}M|)9i|HlbgxYoL({;0UDi$+i2q+?(v<}Y*9@$m$>ALaE3GO zGbMk&jXmg8pH-~#olLG+#xjO+M{dq?wsAW028@j-uko7iB<70OdEFHtLL?5sjx+^ZCLyws|{5tBbD6$pm=9Npyh= zxBYlO8gN^_ohf$0Nr%oQDgp0 zQAs6340$`m^^)BArmd#TGD$k5L$YO0Ia=I_7FS%&YId(X)%j;>On~1zH%{wxaXl-d zy|4G(aE)pUP6H z1(%wV%AAOhLVoyERP)w=pn^4~q!A}#vSp~d&3e@1hE16zrlgb;5m3MnpNeX6#nq=i zNs=KWFz;%BBw4Z~NhK;#Rt=ah0@P@9PQ;W+Rt=aBO`uYhs!)X_DW=#^Rt<1I5$|Sm z-o7LaXyB$PX~2niRFC@MQ&DZ1mbu{}4TVi9uW@eL7i<7{s(A{RMw8|xa zUDtaJ!?@`T{PUt2Y}HmboKWJFdjUM)Ocs8_H+RG;a4wUg5hCuSXp-dGEOmhYIyX15 z$#;kIjm>O!$zSLCO~!Ab0d_kHu5g7CN_=-ZUobJbfV=3$SA2C~Li+%!U~Ca>D_ebc zJYU$t7MHw*l>!z|+DQOAoP<}odRHutE@UCybh`rd&@=hsXhwhv7~6`uo$bC8m@D?M z$0a|=U>pceIaB~IIuC>iQ%9ZeByvRq4cLtB<_!^gbxQIX0ZM?&&O=}D#cjDQZaUOb zo3))bM5qTSpH_g32#)|!=i#Fqy`z@PO-w%GBbR)fxSb&J$c)H)MEDKh?hf6}Zr_Q` z1O^6g@+MyEr~gm0BJU9)YuDipcHGuA!NA}E2eQaVh#by|d`18Rc-x!dTfB8!?jJBP z*w6kf^4GZb0i%buayLc~K%Mete3FxMIth|*R8hrIj%JbXprZ-M&n$07gshtIE#I<+ zHNKOtr#@@{4?vjkKl4W3BZ9%`mtx9W*gL$#Vip&jcz^(nG-hpkv9Z$;B75>qew+{+ zQ>3C^5n{x6g;yw}tSIE4;wjo_%X;g*^hSmlT2nCM<3xA}#(6N>>9Ci*EN6M%Nt>9g zV;vvz;rL?dq_YXADhhdz2mxRVj61!Qu@+i*ffrcBqB#+NjK_F`HzpjC%Cz-%8+*fC zc+B}+4NxIzTUzN?O_@KMEX@^N(RrO$t6Ftl=k>k5S0V#TmeNYAOl4ZG<$5@Sm0GC= zHK<iw)U`khwpXkA-@YE4^ct`T_&e~w$!f$@W?_-a?pr5IlkB1AV;lQv@_8UC z-wx`0=WNCBT9Rb4kG>PYAAyC1@VB5!X5Q4}8r_Do!uh3@UV$i0DU}-0NZOE* w2q+K_C~zg9z(q-yGQa;AhB0#M66S9I2bV)EoHUUL^Z)<=07*qoM6N<$g0!)Ik^lez literal 0 HcmV?d00001 diff --git a/build/dist/images/yellow-dot.png b/build/dist/images/yellow-dot.png new file mode 100644 index 0000000000000000000000000000000000000000..7c708eea7a68945032eb717980893bf36d99d754 GIT binary patch literal 2536 zcmVP)zksc>R*Fc;!pfT1Fg@oPHIg~EbI<2~?>(n`&jm$I>1nGX z0O^cvhQ~tw*|~Xt)f2Te<3piA(=B5vGOAM6-f!`^@w(fsRsP(+R=X6lbnsLQ59x+! z3y%v=uGoglTf$9xQd<%}5$-bOg2Feh9xd{-%ZVa?x@@Z9VNe=`{fS>3{l$9HObg4) zX-}te`pO3>q1cZ=s2$(P_+q#yyJWvI8NaZybo}m zDdlJPVc<>ld`WBH1K&EFUX--xHk@rh%e|qQ+PCBtSK@JaIfnWQ_lMqzW^MqXT-a-!Z82<010qNS#tmY3ljhU3ljkVnw%H_00<08L_t(| zoaLK)j8u0O$3N%ZdG7A)Qr;~k7AfMRLLn{HQd^&3Tf|f`62xj7hy*d!qOFPiQK@L7 z5nBIHOk<@Fqmq_HF@@GbO`o<1q1Ym%)FMXSEX&UB%+B1o_xQ(e_TIbio!OmXAKzp$ zzw`T@-|wDt?zz9``3V(k z;7t+nDlOxnLsjFddb7GMkEz#oLCb~P(x%R_SJiF$j;fBk*n0H|Rh_Hug+Hs8%l1n_ zuSM0%_0Jey-qqZ}mo@v+g29wo2BQ&GeIH(WBUb9xZc4#947qfqM?TbD()6 zf>j6Bc(BKt|HxE`e*|K)0IO@0g=42s=U$@I9}^KBi0lJ0fT~`O*ZLDA`4z+pwdFzE z^N`sA`Muy>DDMGQ1H?ZHi5nn3-_T(=?;OEvULuLPZ-Q%o&xt&xiWPRi9+&okXixu=D~tt$wLLUM7@5R-!Z!iiQ2M{knk^?OTdt`uffoq?Bq8Y_9FpPAhW&6~hIQ%X|< zhs2=fi%@@;NdtH-9{B?+Bsu@L{cfhejHGM=^*=M0QCwBfE|c!x@6~H(0KRYf9K`GO2L@*khm$x%f0@rB(7W7 zSJgfZpsMpw=S3uH{4Bc@ntlkH8-T=>fCY88L;bh#)oOcXizMgY(Oa!v4WOzYK%Li+ zXbOOq-$C<6U_e7}Wl^^r>hBKd+}?GPxMo97?A^>V3{-V0TG;I?pMBbNc0*ZtFfXa~ z$$*Z{{*mSnFYSrFTMtlGtLXOE1CVTl z1rj%O{=h1U&;E6orGp2kssO(<$^+>~hOhDf?r~^&BA_GF9#qw_VV2IHz!!kU02JPV zmfuuZ!YZI;3wY;E+DavG-u`j8*f)Tx3aUTwOD_Dh^7Hy?KwBXl@_KvH9a=brD;T-bk1z`iM_ERlSFyzPkQlJG$|0r9T0I2i%Di*Ob}q!)(m&Co~7Smjl{8z5)UR zEcOd>`>QEdb&-8ONLvk`2C!5$0?hRboPSnZtm+~6V&L8O^%C+g} z0fTc`JoM3i$SRh0@&Nmy$Wv8FJbaYa+NlqSbYE#CA$-KHnMMmp`x%idyH*%!urCYJ znmuI!FZmhqxm_!aG{j~HX?6Z%0lR|2QDy)NyQH`^bP|{d3MW5qR!t)k0+XKu>yq}2 zaaQpReYejLySj(UBLLBvf%5K|(<0K?KJytJpFz#%gS6)V2Eo)XFhJr)M&yi8;*h*0 zpzTQyK~Yl?c^7yWfXFmRex~{YRvL*J z=LcAZ4X_C?pqK+U2m3Rq#(+-icU0Mzk_&U~P~$Txt9q=DezF!haK&ODqUNl1M& zpuMJtMa16~>D=3G295zH8nfoMDo9vi)ZGsDM3eTiZP*jOA1>}-01;^e?(;KJD@_3N za7ApEi70J{W;TdOQ<$Z@2$2Y|ANUXe`8VO*${`pQ*9WWynDB=noYrkTjy?9hBGN&T zE(5-Z6o4gw**A(^1!L}Gcx{$gFy{V1dCeEF>OR$3`66dmh{z#eDPXRvBo~^`VOT(* z;kzcpz8&hU6f1tHJMJE*d?K0_fncF_tMl1;7MRshXVJM@rcZy!2Mr2 zP4@!J>{iu%4H6&gSX4N%gUF>{F0N-vLfK=Qnk%u(f%}1}T^MqEj3II_fY(y)W6WDl z-U7+bcDy77;5Ht{s$U~k^tp1IAMl{AstI5^{ zc;+^kJ;f}=+kdfHrjzRo_v|qwxdyBDF9W?eIcQMT236gls%QFl7q-K-SXFiV;>l~_ z^k3C0ENTyO9FkB~TUBpV)lI5;v}9v+P}<3>+w_d8eo0kpDf)BT_7 ybkHccF1Q}h26h&#!-%~fI8gi@DK5?`hW`UXNCi8st9+gS0000 Date: Mon, 14 Jan 2019 06:45:24 -0800 Subject: [PATCH 110/112] Development build with ShapeEditor and updated dev dependancies. --- build/dist/worldwind.js | 697 +++++++++++++++++++++++++----------- build/dist/worldwind.min.js | 54 +-- 2 files changed, 518 insertions(+), 233 deletions(-) diff --git a/build/dist/worldwind.js b/build/dist/worldwind.js index 2a077185b..750353637 100644 --- a/build/dist/worldwind.js +++ b/build/dist/worldwind.js @@ -47080,6 +47080,56 @@ define('shapes/SurfaceShape',[ newLocations.push(new Location(newPos.latitude, newPos.longitude)); } } else { + // Euler method + + // var xVecOld = new Vec3(0, oldPoint[1], oldPoint[2]); + // var yVecOld = new Vec3(oldPoint[0], 0, oldPoint[2]); + // var zVecOld = new Vec3(oldPoint[0], oldPoint[1], 0); + // var xVecNew = new Vec3(0, newPoint[1], newPoint[2]); + // var yVecNew = new Vec3(newPoint[0], 0, newPoint[2]); + // var zVecNew = new Vec3(newPoint[0], newPoint[1], 0); + // + // + // var alpha = Math.acos(xVecOld.dot(xVecNew) / (xVecOld.magnitude() * xVecNew.magnitude())); + // var beta = Math.acos(yVecOld.dot(yVecNew) / (yVecOld.magnitude() * yVecNew.magnitude())); + // var gama = Math.acos(zVecOld.dot(zVecNew) / (zVecOld.magnitude() * zVecNew.magnitude())); + // + // var alpha = Math.atan2() + // + // var crossX = xVecOld.cross(xVecNew); + // var crossY = yVecOld.cross(yVecNew); + // var crossZ = zVecOld.cross(zVecNew); + // + // if(new Vec3(1, 0, 0).dot(crossX) < 0){ + // alpha = -alpha; + // } + // + // if(new Vec3(0, 1, 0).dot(crossY) < 0){ + // beta = -beta; + // } + // + // if(new Vec3(0, 0, 1).dot(crossZ) < 0){ + // gama = -gama; + // } + // + // for (var i = 0, len = locations.length; i < len; i++) { + // globe.computePointFromLocation(locations[i].latitude, locations[i].longitude, result); + // var newX = result[0] * Math.cos(beta) * Math.cos(gama) + + // result[1] * (Math.cos(beta) * (-Math.sin(gama))) + + // result[2] * Math.sin(beta); + // + // var newY = result[0] * ((-Math.sin(alpha)) * (-Math.sin(beta)) * (Math.cos(gama)) + Math.cos(alpha) * Math.sin(gama)) + + // result[1] * ( (-Math.sin(alpha)) * (-Math.sin(beta)) * (-Math.sin(gama)) + Math.cos(alpha) * Math.cos(gama) ) + + // result[2] * Math.sin(alpha) * Math.cos(beta); + // + // var newZ = result[0] * (Math.cos(alpha) * (-Math.sin(beta)) * Math.cos(gama) + Math.sin(alpha) * Math.sin(gama)) + + // result[1] * (Math.cos(alpha) * (-Math.sin(beta)) * (-Math.sin(gama)) + Math.sin(alpha) * Math.cos(gama)) + + // result[2] * Math.cos(alpha) * Math.cos(beta); + // + // globe.computePositionFromPoint(newX, newY, newZ, newPos); + // newLocations.push(new Location(newPos.latitude, newPos.longitude)); + // } + var delta_lat = newLocation.latitude - oldLocation.latitude; var delta_long = newLocation.longitude - oldLocation.longitude; var max = -90; @@ -47116,8 +47166,8 @@ define('shapes/SurfaceShape',[ newLocations.push(new Location(new_lat, new_long)); } - if (max > 87) { - var delta = max - 87; + if (max > 90) { + var delta = max - 90; for (var i = 0, len = newLocations.length; i < len; i++) { newLocations[i].latitude -= delta; } @@ -74514,13 +74564,17 @@ define('util/editor/BaseSurfaceEditorFragment',[ * rotate the shape. * @param {PlacemarkAttributes} moveControlPointAttributes The attributes to use for control points that move * the boundaries of the shape. + * @param {PlacemarkAttributes} shadowControlPointAttributes The attributes to use for control points that will + * mark the middle of one segment. */ BaseSurfaceEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes, - moveControlPointAttributes) { + moveControlPointAttributes, + shadowControlPointAttributes) { throw new UnsupportedOperationError(Logger.logMessage( Logger.LEVEL_SEVERE, "BaseSurfaceEditorFragment", @@ -74540,6 +74594,7 @@ define('util/editor/BaseSurfaceEditorFragment',[ BaseSurfaceEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, + shadowControlPoints, accessories) { throw new UnsupportedOperationError(Logger.logMessage( Logger.LEVEL_SEVERE, @@ -74813,6 +74868,39 @@ define('util/editor/BaseSurfaceEditorFragment',[ } }; + // Computes the location for a shadow control point for two given locations. + BaseSurfaceEditorFragment.prototype.computeShadowPointLocations = function (shape, + shadowControlPoint, + startLocation, + endLocation) { + var segmentAzimuth = null; + var segmentDistance = null; + + if (shape.pathType === WorldWind.LINEAR) { + shadowControlPoint.position = new Location( + (startLocation.latitude + endLocation.latitude)/2, + (startLocation.longitude + endLocation.longitude)/2 + ); + } else if (shape.pathType === WorldWind.RHUMB_LINE) { + if (segmentAzimuth == null) { + segmentAzimuth = Location.rhumbAzimuth(startLocation, endLocation); + segmentDistance = Location.rhumbDistance(startLocation, endLocation); + } + shadowControlPoint.position = Location.rhumbLocation(startLocation, segmentAzimuth, 0.5 * segmentDistance, + shadowControlPoint.position); + } else { + // Great Circle + if (segmentAzimuth == null) { + segmentAzimuth = Location.greatCircleAzimuth(startLocation, endLocation); //degrees + segmentDistance = Location.greatCircleDistance(startLocation, endLocation); //radians + } + //Location, degrees, radians, Location + shadowControlPoint.position = Location.greatCircleLocation(startLocation, segmentAzimuth, 0.5 * segmentDistance, + shadowControlPoint.position); + } + + } + return BaseSurfaceEditorFragment; } ); @@ -74864,7 +74952,10 @@ define('util/editor/ShapeEditorConstants',[], MIN_CORNER: "min_corner", // Indicates the corner with max latitude for a surface sector - MAX_CORNER: "max_corner" + MAX_CORNER: "max_corner", + + // Indicates a control point that marks the middle of a segment. + SHADOW: "shadow" }; return ShapeEditorConstants; @@ -74923,12 +75014,17 @@ define('util/editor/PlacemarkEditorFragment',[ // Internal use only. PlacemarkEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes, moveControlPointAttributes) { - this.createControlPoint(controlPoints, moveControlPointAttributes, ShapeEditorConstants.DRAG); + if (moveControlPointAttributes) { + // we will use the same Placemark as control point + shape.userProperties.purpose = ShapeEditorConstants.DRAG; + controlPoints.push(shape); + } }; // Internal use only. @@ -75256,48 +75352,67 @@ define('util/editor/SurfaceEllipseEditorFragment',[ // Internal use only. SurfaceEllipseEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes) { - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.WIDTH); - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.HEIGHT); - this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); + if (resizeControlPointAttributes) { + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.WIDTH); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.HEIGHT); + } + + if (rotateControlPointAttributes) { + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); - this.createRotationAccessory(accessories, rotateControlPointAttributes); + this.createRotationAccessory(accessories, rotateControlPointAttributes); + } }; // Internal use only. SurfaceEllipseEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, + shadowControlPoints, accessories) { - Location.greatCircleLocation( - shape.center, - 90 + shape.heading, - shape.majorRadius / globe.equatorialRadius, - controlPoints[0].position - ); + var length = controlPoints.length; - Location.greatCircleLocation( - shape.center, - shape.heading, - shape.minorRadius / globe.equatorialRadius, - controlPoints[1].position - ); + if (length > 0) { + for (var i = 0; i < length; i++) { + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.WIDTH) { + Location.greatCircleLocation( + shape.center, + 90 + shape.heading, + shape.majorRadius / globe.equatorialRadius, + controlPoints[i].position + ); + controlPoints[i].userProperties.size = shape.majorRadius; + } - Location.greatCircleLocation( - shape.center, - shape.heading, - 1.6 * shape.minorRadius / globe.equatorialRadius, - controlPoints[2].position - ); + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.HEIGHT) { + Location.greatCircleLocation( + shape.center, + shape.heading, + shape.minorRadius / globe.equatorialRadius, + controlPoints[i].position + ); + controlPoints[i].userProperties.size = shape.minorRadius; + } + + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { + Location.greatCircleLocation( + shape.center, + shape.heading, + 1.6 * shape.minorRadius / globe.equatorialRadius, + controlPoints[i].position + ); - controlPoints[0].userProperties.size = shape.majorRadius; - controlPoints[1].userProperties.size = shape.minorRadius; - controlPoints[2].userProperties.rotation = shape.heading; + controlPoints[i].userProperties.rotation = shape.heading; - this.updateRotationAccessory(shape.center, controlPoints[2].position, accessories); + this.updateRotationAccessory(shape.center, controlPoints[i].position, accessories); + } + } + } }; // Internal use only. @@ -75584,22 +75699,26 @@ define('util/editor/SurfaceCircleEditorFragment',[ // Internal use only. SurfaceCircleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes) { - - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.RADIUS); + if (resizeControlPointAttributes) { + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.RADIUS); + } }; // Internal use only. SurfaceCircleEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints) { - Location.greatCircleLocation( - shape.center, - 90, - shape.radius / globe.equatorialRadius, - controlPoints[0].position - ); + if (controlPoints.length > 0) { + Location.greatCircleLocation( + shape.center, + 90, + shape.radius / globe.equatorialRadius, + controlPoints[0].position + ); - controlPoints[0].userProperties.size = shape.radius; + controlPoints[0].userProperties.size = shape.radius; + } }; // Internal use only. @@ -75662,6 +75781,7 @@ define('util/editor/SurfacePolygonEditorFragment',[ var SurfacePolygonEditorFragment = function () { this.currentHeading = 0; this.moveControlPointAttributes = null; + this.shadowControlPointAttributes = null; }; SurfacePolygonEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); @@ -75692,72 +75812,135 @@ define('util/editor/SurfacePolygonEditorFragment',[ // Internal use only. SurfacePolygonEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes, - moveControlPointAttributes) { + moveControlPointAttributes, + shadowControlPointAttributes) { this.currentHeading = 0; - this.moveControlPointAttributes = moveControlPointAttributes; - var locations = this.getLocations(shape); + if (moveControlPointAttributes) { + this.moveControlPointAttributes = moveControlPointAttributes; + this.shadowControlPointAttributes = shadowControlPointAttributes; - for (var i = 0, len = locations.length; i < len; i++) { - this.createControlPoint( - controlPoints, - moveControlPointAttributes, - ShapeEditorConstants.LOCATION, - i - ); + var locations = this.getLocations(shape); + + for (var i = 0, len = locations.length; i < len; i++) { + this.createControlPoint( + controlPoints, + moveControlPointAttributes, + ShapeEditorConstants.LOCATION, + i + ); + } } - this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); + if (rotateControlPointAttributes) { + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); - this.createRotationAccessory(accessories, rotateControlPointAttributes); + this.createRotationAccessory(accessories, rotateControlPointAttributes); + } + + if (shadowControlPointAttributes) { + for (var i = 0, len = locations.length - 1; i < len; i++) { + this.createControlPoint( + shadowControlPoints, + shadowControlPointAttributes, + ShapeEditorConstants.SHADOW, + i + ); + } + } }; // Internal use only. SurfacePolygonEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, + shadowControlPoints, accessories) { var locations = this.getLocations(shape); + var lenLocations = locations.length; + var lenControlPoints = controlPoints.length; + var locationControlPoints = []; + var rotationControlPoint = null; - var rotationControlPoint = controlPoints.pop(); + if (lenControlPoints > 0) { + for (var i = lenControlPoints - 1; i > -1; i--) { + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { + rotationControlPoint = controlPoints[i]; - var lenControlPoints = controlPoints.length; - var lenLocations = locations.length; + var polygonCenter = this.getCenterFromLocations(globe, locations); + var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); + + Location.greatCircleLocation( + polygonCenter, + this.currentHeading, + polygonRadius, + rotationControlPoint.position + ); + + rotationControlPoint.userProperties.rotation = this.currentHeading; + + this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); + } + + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.LOCATION) { + locationControlPoints.push(controlPoints[i]); + } + + controlPoints.pop(); + } + } + + locationControlPoints.reverse(); + var lenLocationControlPoints = locationControlPoints.length; for (var i = 0; i < lenLocations; i++) { - if (i >= lenControlPoints) { + if (i >= lenLocationControlPoints) { this.createControlPoint( - controlPoints, + locationControlPoints, this.moveControlPointAttributes, ShapeEditorConstants.LOCATION, i ); } - controlPoints[i].position = locations[i]; + locationControlPoints[i].position = locations[i]; } - if (lenControlPoints > lenLocations) { - controlPoints.splice(lenLocations, lenControlPoints - lenLocations) + if (locationControlPoints.length > lenLocations) { + locationControlPoints.splice(lenLocations, locationControlPoints.length - lenLocations) } - var polygonCenter = this.getCenterFromLocations(globe, locations); - var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); + for (var i = 0; i < locationControlPoints.length; i++) { + controlPoints.push(locationControlPoints[i]); + } - Location.greatCircleLocation( - polygonCenter, - this.currentHeading, - polygonRadius, - rotationControlPoint.position - ); + for (var i = 0; i < lenLocations - 1; i++) { + this.createControlPoint( + controlPoints, + this.shadowControlPointAttributes, + ShapeEditorConstants.SHADOW, + lenLocations + i + ); - rotationControlPoint.userProperties.rotation = this.currentHeading; + this.computeShadowPointLocations(shape, controlPoints[lenLocations + i], locations[i], locations[i + 1]); - controlPoints.push(rotationControlPoint); + if (i == lenLocations - 2) { + this.createControlPoint( + controlPoints, + this.shadowControlPointAttributes, + ShapeEditorConstants.SHADOW, + lenLocations + i + 1 + ); + + this.computeShadowPointLocations(shape, controlPoints[lenLocations + i + 1], locations[i + 1], locations[0]); + } + } - this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); + + controlPoints.push(rotationControlPoint); }; // Internal use only. @@ -75993,6 +76176,7 @@ define('util/editor/SurfacePolylineEditorFragment',[ var SurfacePolylineEditorFragment = function () { this.currentHeading = 0; this.moveControlPointAttributes = null; + this.shadowControlPointAttributes = null; }; SurfacePolylineEditorFragment.prototype = Object.create(BaseSurfaceEditorFragment.prototype); @@ -76023,72 +76207,121 @@ define('util/editor/SurfacePolylineEditorFragment',[ // Internal use only. SurfacePolylineEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes, - moveControlPointAttributes) { + moveControlPointAttributes, + shadowControlPointAttributes) { this.currentHeading = 0; - this.moveControlPointAttributes = moveControlPointAttributes; - var locations = shape.boundaries; + if (moveControlPointAttributes) { + this.moveControlPointAttributes = moveControlPointAttributes; + this.shadowControlPointAttributes = shadowControlPointAttributes; - for (var i = 0, len = locations.length; i < len; i++) { - this.createControlPoint( - controlPoints, - moveControlPointAttributes, - ShapeEditorConstants.LOCATION, - i - ); + var locations = shape.boundaries; + + for (var i = 0, len = locations.length; i < len; i++) { + this.createControlPoint( + controlPoints, + moveControlPointAttributes, + ShapeEditorConstants.LOCATION, + i + ); + } } - this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); + if (rotateControlPointAttributes) { + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); - this.createRotationAccessory(accessories, rotateControlPointAttributes); + this.createRotationAccessory(accessories, rotateControlPointAttributes); + } + + // if (shadowControlPointAttributes) { + // for (var i = 0, len = locations.length - 1; i < len; i++) { + // this.createControlPoint( + // shadowControlPoints, + // shadowControlPointAttributes, + // ShapeEditorConstants.SHADOW, + // i + // ); + // } + // } }; // Internal use only. SurfacePolylineEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, + shadowControlPoints, accessories) { var locations = shape.boundaries; + var lenLocations = locations.length; + var lenControlPoints = controlPoints.length; + var locationControlPoints = []; + var rotationControlPoint = null; - var rotationControlPoint = controlPoints.pop(); - var lenControlPoints = controlPoints.length; - var lenLocations = locations.length; + for (var i = lenControlPoints - 1; i > -1; i--) { + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { + rotationControlPoint = controlPoints[i]; + + var polygonCenter = this.getCenterFromLocations(globe, locations); + var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); + + Location.greatCircleLocation( + polygonCenter, + this.currentHeading, + polygonRadius, + rotationControlPoint.position + ); + + rotationControlPoint.userProperties.rotation = this.currentHeading; + + this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); + } + + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.LOCATION) { + locationControlPoints.push(controlPoints[i]); + } + controlPoints.pop(); + } + + locationControlPoints.reverse(); + var lenLocationControlPoints = locationControlPoints.length; for (var i = 0; i < lenLocations; i++) { - if (i >= lenControlPoints) { + if (i >= lenLocationControlPoints) { this.createControlPoint( - controlPoints, + locationControlPoints, this.moveControlPointAttributes, ShapeEditorConstants.LOCATION, i ); } - controlPoints[i].position = locations[i]; + locationControlPoints[i].position = locations[i]; } - if (lenControlPoints > lenLocations) { - controlPoints.splice(lenLocations, lenControlPoints - lenLocations) + if (locationControlPoints.length > lenLocations) { + locationControlPoints.splice(lenLocations, locationControlPoints.length - lenLocations); } - var polygonCenter = this.getCenterFromLocations(globe, locations); - var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); + for (var i = 0; i < locationControlPoints.length; i++) { + controlPoints.push(locationControlPoints[i]); + } - Location.greatCircleLocation( - polygonCenter, - this.currentHeading, - polygonRadius, - rotationControlPoint.position - ); + for (var i = 0; i < lenLocations - 1; i++) { + this.createControlPoint( + shadowControlPoints, + this.shadowControlPointAttributes, + ShapeEditorConstants.SHADOW, + lenLocations + i + ); - rotationControlPoint.userProperties.rotation = this.currentHeading; + this.computeShadowPointLocations(shape, shadowControlPoints[i], locations[i], locations[i + 1]); + } controlPoints.push(rotationControlPoint); - - this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); }; // Internal use only. @@ -76461,48 +76694,69 @@ define('util/editor/SurfaceRectangleEditorFragment',[ // Internal use only. SurfaceRectangleEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes, rotateControlPointAttributes) { - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.WIDTH); - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.HEIGHT); - this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); + if (resizeControlPointAttributes) { + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.WIDTH); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.HEIGHT); + } - this.createRotationAccessory(accessories, rotateControlPointAttributes); + if (rotateControlPointAttributes) { + this.createControlPoint(controlPoints, rotateControlPointAttributes, ShapeEditorConstants.ROTATION); + + this.createRotationAccessory(accessories, rotateControlPointAttributes); + } }; // Internal use only. SurfaceRectangleEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints, + shadowControlPoints, accessories) { - Location.greatCircleLocation( - shape.center, - 90 + shape.heading, - 0.5 * shape.width / globe.equatorialRadius, - controlPoints[0].position - ); + var length = controlPoints.length; - Location.greatCircleLocation( - shape.center, - shape.heading, - 0.5 * shape.height / globe.equatorialRadius, - controlPoints[1].position - ); + if (length > 0) { + for (var i = 0; i < length; i++) { + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.WIDTH) { + Location.greatCircleLocation( + shape.center, + 90 + shape.heading, + 0.5 * shape.width / globe.equatorialRadius, + controlPoints[i].position + ); - Location.greatCircleLocation( - shape.center, - shape.heading, - 0.8 * shape.height / globe.equatorialRadius, - controlPoints[2].position - ); + controlPoints[i].userProperties.size = shape.width; + } + + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.HEIGHT) { + Location.greatCircleLocation( + shape.center, + shape.heading, + 0.5 * shape.height / globe.equatorialRadius, + controlPoints[i].position + ); + + controlPoints[i].userProperties.size = shape.height; + } + + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { + Location.greatCircleLocation( + shape.center, + shape.heading, + 0.8 * shape.height / globe.equatorialRadius, + controlPoints[i].position + ); - controlPoints[0].userProperties.size = shape.width; - controlPoints[1].userProperties.size = shape.height; - controlPoints[2].userProperties.rotation = shape.heading; + controlPoints[i].userProperties.rotation = shape.heading; - this.updateRotationAccessory(shape.center, controlPoints[2].position, accessories); + this.updateRotationAccessory(shape.center, controlPoints[i].position, accessories); + } + } + } }; // Internal use only. @@ -76751,19 +77005,24 @@ define('util/editor/SurfaceSectorEditorFragment',[ // Internal use only. SurfaceSectorEditorFragment.prototype.initializeControlElements = function (shape, controlPoints, + shadowControlPoints, accessories, resizeControlPointAttributes) { - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.MIN_CORNER); - this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.MAX_CORNER); + if (resizeControlPointAttributes) { + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.MIN_CORNER); + this.createControlPoint(controlPoints, resizeControlPointAttributes, ShapeEditorConstants.MAX_CORNER); + } }; // Internal use only. SurfaceSectorEditorFragment.prototype.updateControlElements = function (shape, globe, controlPoints) { - controlPoints[0].position = new Location(shape._sector.minLatitude, shape._sector.minLongitude); - controlPoints[1].position = new Location(shape._sector.maxLatitude, shape._sector.maxLongitude); + if (controlPoints.length > 0) { + controlPoints[0].position = new Location(shape._sector.minLatitude, shape._sector.minLongitude); + controlPoints[1].position = new Location(shape._sector.maxLatitude, shape._sector.maxLongitude); + } }; // Internal use only. @@ -76904,25 +77163,31 @@ define('util/editor/ShapeEditor',[ // Internal use only. // Flags indicating whether the specific action is allowed or not. - this._allowMove = false; - this._allowReshape = false; - this._allowRotate = false; - this._allowManageControlPoint = false; + this._allowMove = true; + this._allowReshape = true; + this._allowRotate = true; + this._allowManageControlPoint = true; // Documented in defineProperties below. this._moveControlPointAttributes = new PlacemarkAttributes(null); - this._moveControlPointAttributes.imageColor = WorldWind.Color.BLUE; - this._moveControlPointAttributes.imageScale = 6; + this._moveControlPointAttributes.imageSource = WorldWind.configuration.baseUrl + "images/blue-dot.png"; + this._moveControlPointAttributes.imageScale = 0.15; + + // Documented in defineProperties below. + this._shadowControlPointAttributes = new PlacemarkAttributes(null); + this._shadowControlPointAttributes.imageSource = WorldWind.configuration.baseUrl + "images/gray-dot.png"; + this._shadowControlPointAttributes.imageScale = 0.15; // Documented in defineProperties below. this._resizeControlPointAttributes = new PlacemarkAttributes(null); - this._resizeControlPointAttributes.imageColor = WorldWind.Color.CYAN; - this._resizeControlPointAttributes.imageScale = 6; + this._resizeControlPointAttributes.imageSource = WorldWind.configuration.baseUrl + "images/yellow-dot.png"; + this._resizeControlPointAttributes.imageScale = 0.15; // Documented in defineProperties below. this._rotateControlPointAttributes = new PlacemarkAttributes(null); this._rotateControlPointAttributes.imageColor = WorldWind.Color.GREEN; - this._rotateControlPointAttributes.imageScale = 6; + this._rotateControlPointAttributes.imageSource = WorldWind.configuration.baseUrl + "images/green-dot.png"; + this._rotateControlPointAttributes.imageScale = 0.15; // Documented in defineProperties below. this._annotationAttributes = new AnnotationAttributes(null); @@ -76964,6 +77229,10 @@ define('util/editor/ShapeEditor',[ // The layer that holds the control points created by the editor fragment. this.controlPointsLayer = new RenderableLayer("Shape Editor Control Points"); + // Internal use only. + // The layer that holds the shadow control points created by the editor fragment. + this.shadowControlPointsLayer = new RenderableLayer("Shape Editor Shadow Control Points"); + // Internal use only. // The layers that holds the additional accessories created by the editor fragment. this.accessoriesLayer = new RenderableLayer("Shape Editor Accessories"); @@ -77001,14 +77270,6 @@ define('util/editor/ShapeEditor',[ // Flag indicating whether the action should trigger the secondary behavior in the editor fragment. this.actionSecondaryBehavior = false; - // Internal use only. - // The client X position at the start of the action. - this.actionStartX = null; - - //Internal use only. - // The client Y position at the start of the action. - this.actionStartY = null; - // Internal use only. // The current client X position for the action. this.actionCurrentX = null; @@ -77033,12 +77294,6 @@ define('util/editor/ShapeEditor',[ this._dbclickTimeout = 0; this._clickDelay = 500; - // Internal use only. - // counters used to detect long press event (time measured in ms) - this._longPressTimeout = 0; - this._longPressDelay = 1500; - - this._worldWindow.worldWindowController.addGestureListener(this); }; @@ -77081,6 +77336,20 @@ define('util/editor/ShapeEditor',[ } }, + /** + * Attributes used for the shadow control points used to mask the middle of a segment. + * @memberof ShapeEditor.prototype + * @type {PlacemarkAttributes} + */ + shadowControlPointAttributes: { + get: function () { + return this._shadowControlPointAttributes; + }, + set: function (value) { + this._shadowControlPointAttributes = value; + } + }, + /** * Attributes used for the control points that resize the shape. * @memberof ShapeEditor.prototype @@ -77230,10 +77499,10 @@ define('util/editor/ShapeEditor',[ this.creatorShapeProperties = null; this.newCreatedShapeLayer = null; - this._allowMove = false; - this._allowReshape = false; - this._allowRotate = false; - this._allowManageControlPoint = false; + this._allowMove = true; + this._allowReshape = true; + this._allowRotate = true; + this._allowManageControlPoint = true; var currentShape = this._shape; this._shape = null; @@ -77269,6 +77538,27 @@ define('util/editor/ShapeEditor',[ // Internal use only. // Called by {@link ShapeEditor#edit} to initialize the control elements used for editing. ShapeEditor.prototype.initializeControlElements = function () { + var moveControlAttributes = this._moveControlPointAttributes; + var resizeControlAttributes = this._resizeControlPointAttributes; + var rotateControlAttributes = this._rotateControlPointAttributes; + var shadowControlAttributes = this._shadowControlPointAttributes; + + if (!this._allowMove) { + moveControlAttributes = null; + } + + if (!this._allowReshape) { + resizeControlAttributes = null; + } + + if (!this._allowRotate) { + rotateControlAttributes = null; + } + + if (!this._allowManageControlPoint) { + shadowControlAttributes = null; + } + if (this._worldWindow.indexOfLayer(this.shadowShapeLayer) == -1) { this._worldWindow.insertLayer(0, this.shadowShapeLayer); } @@ -77277,6 +77567,11 @@ define('util/editor/ShapeEditor',[ this._worldWindow.addLayer(this.controlPointsLayer); } + if (this._worldWindow.indexOfLayer(this.shadowControlPointsLayer) == -1) { + this._worldWindow.addLayer(this.shadowControlPointsLayer); + } + + if (this._worldWindow.indexOfLayer(this.accessoriesLayer) == -1) { this._worldWindow.addLayer(this.accessoriesLayer); } @@ -77288,10 +77583,12 @@ define('util/editor/ShapeEditor',[ this.activeEditorFragment.initializeControlElements( this._shape, this.controlPointsLayer.renderables, + this.shadowControlPointsLayer.renderables, this.accessoriesLayer.renderables, - this._resizeControlPointAttributes, - this._rotateControlPointAttributes, - this._moveControlPointAttributes + resizeControlAttributes, + rotateControlAttributes, + moveControlAttributes, + shadowControlAttributes ); this.updateControlElements(); @@ -77303,6 +77600,9 @@ define('util/editor/ShapeEditor',[ this._worldWindow.removeLayer(this.controlPointsLayer); this.controlPointsLayer.removeAllRenderables(); + this._worldWindow.removeLayer(this.shadowControlPointsLayer); + this.shadowControlPointsLayer.removeAllRenderables(); + this._worldWindow.removeLayer(this.accessoriesLayer); this.accessoriesLayer.removeAllRenderables(); @@ -77319,6 +77619,7 @@ define('util/editor/ShapeEditor',[ this._shape, this._worldWindow.globe, this.controlPointsLayer.renderables, + this.shadowControlPointsLayer.renderables, this.accessoriesLayer.renderables ); }; @@ -77347,13 +77648,14 @@ define('util/editor/ShapeEditor',[ var x = event.clientX, y = event.clientY; - this.actionStartX = x; - this.actionStartY = y; this.actionCurrentX = x; this.actionCurrentY = y; var mousePoint = this._worldWindow.canvasCoordinates(x, y); + var tmpOutlineWidth = this._shape.highlightAttributes.outlineWidth; + this._shape.highlightAttributes.outlineWidth = 5; var pickList = this._worldWindow.pick(mousePoint); + this._shape.highlightAttributes.outlineWidth = tmpOutlineWidth; var terrainObject = pickList.terrainObject(); if (terrainObject && this.isCreatorEnabled() && this.activeEditorFragment !== null && this._shape === null) { @@ -77401,35 +77703,6 @@ define('util/editor/ShapeEditor',[ ); } - var allowVertex = terrainObject - && this.actionStartX === this.actionCurrentX - && this.actionStartY === this.actionCurrentY - && this._allowManageControlPoint; - - // counter for long-press detection - clearTimeout(this._longPressTimeout); - - var context = this; - - - // The editor provides vertex insertion and removal for SurfacePolygon and SurfacePolyline. - // Long press when the cursor is over the shape inserts a control point near the position - // of the cursor. - this._longPressTimeout = setTimeout(function () { - if (allowVertex) { - context.activeEditorFragment.addNewVertex( - context._shape, - context._worldWindow.globe, - terrainObject.position - ); - - context.updateControlElements(); - context._worldWindow.redraw(); - } - }, this._longPressDelay - ); - - for (var p = 0, len = pickList.objects.length; p < len; p++) { var object = pickList.objects[p]; @@ -77445,6 +77718,10 @@ define('util/editor/ShapeEditor',[ this.beginAction(terrainObject.position, this._allowManageControlPoint, userObject); event.preventDefault(); break; + } else if (this.shadowControlPointsLayer.renderables.indexOf(userObject) !== -1) { + this.beginAction(terrainObject.position, this._allowManageControlPoint, userObject); + event.preventDefault(); + break; } } } @@ -77466,8 +77743,6 @@ define('util/editor/ShapeEditor',[ this._click1Time = 0; } - clearTimeout(this._longPressTimeout); - if (this.actionType) { var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); @@ -77502,17 +77777,15 @@ define('util/editor/ShapeEditor',[ var mousePoint = this._worldWindow.canvasCoordinates(event.clientX, event.clientY); var terrainObject = this._worldWindow.pickTerrain(mousePoint).terrainObject(); - if (this.isCreatorEnabled() && this.activeEditorFragment.isRegularShape()) { - this.setCreatorEnabled(false); - } - - // The editor provides vertex insertion and removal for SurfacePolygon and - // SurfacePolyline. Shift-clicking when the cursor is over the shape inserts a control point near the position - // of the cursor. Ctrl-clicking when the cursor is over a control point removes that particular control point. + // The editor provides vertex insertion and removal for SurfacePolygon and SurfacePolyline. + // Double click when the cursor is over a control point will remove it. + // Single click when the cursor is over a shadow control point will add it. + console.dir(this.actionType) if (this.actionType) { if (this._click0Time && this._click1Time) { if (this._click1Time <= this._clickDelay) { if (this.actionControlPoint + && this.actionType == 'location' && terrainObject && this._allowManageControlPoint) { this.actionSecondaryBehavior = true; @@ -77522,12 +77795,22 @@ define('util/editor/ShapeEditor',[ clearTimeout(this._dbclickTimeout); this._click0Time = 0; this._click1Time = 0; + + } else { + if (this.actionType == 'shadow' && this._allowManageControlPoint) { + this.activeEditorFragment.addNewVertex( + this._shape, + this._worldWindow.globe, + terrainObject.position + ); + + this.updateControlElements(); + this._worldWindow.redraw(); + } } this.endAction(); } - - clearTimeout(this._longPressTimeout); }; // Internal use only. @@ -77567,7 +77850,7 @@ define('util/editor/ShapeEditor',[ if (this.activeEditorFragment instanceof PlacemarkEditorFragment) { shadowShape.altitudeMode = WorldWind.CLAMP_TO_GROUND; - shadowShape.highlightAttributes = new PlacemarkAttributes(this.originalHighlightAttributes); + shadowShape.highlightAttributes = new PlacemarkAttributes(this.originalPlacemarkHighlightAttributes); } else { shadowShape.highlightAttributes = new ShapeAttributes(this.originalHighlightAttributes); } @@ -77604,7 +77887,8 @@ define('util/editor/ShapeEditor',[ if ((purpose === ShapeEditorConstants.ROTATION && this._allowRotate) || (purpose !== ShapeEditorConstants.ROTATION && this._allowReshape) || - (purpose === ShapeEditorConstants.LOCATION && this._allowManageControlPoint && this.actionSecondaryBehavior)) { + (purpose === ShapeEditorConstants.LOCATION && this._allowManageControlPoint && this.actionSecondaryBehavior) || + (purpose === ShapeEditorConstants.SHADOW && this._allowManageControlPoint && this.actionSecondaryBehavior)) { this.activeEditorFragment.reshape( this._shape, this._worldWindow.globe, @@ -77734,6 +78018,7 @@ define('util/editor/ShapeEditor',[ return ShapeEditor; } ); + /* * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the * National Aeronautics and Space Administration. All rights reserved. diff --git a/build/dist/worldwind.min.js b/build/dist/worldwind.min.js index b5b386f6c..0958f2a32 100644 --- a/build/dist/worldwind.min.js +++ b/build/dist/worldwind.min.js @@ -151,38 +151,38 @@ * http://www.opensource.org/licenses/mit-license */ -!function(t,e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define([],e):t.WorldWind=e()}(this,function(){var t,e,i;!function(r){function n(t,e){return _.call(t,e)}function o(t,e){var i,r,n,o,s,a,l,h,u,c,d,p=e&&e.split("/"),f=E.map,g=f&&f["*"]||{};if(t&&"."===t.charAt(0))if(e){for(p=p.slice(0,p.length-1),t=t.split("/"),s=t.length-1,E.nodeIdCompat&&S.test(t[s])&&(t[s]=t[s].replace(S,"")),t=p.concat(t),u=0;u0&&(t.splice(u-1,2),u-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((p||g)&&f){for(i=t.split("/"),u=i.length;u>0;u-=1){if(r=i.slice(0,u).join("/"),p)for(c=p.length;c>0;c-=1)if(n=f[p.slice(0,c).join("/")],n&&(n=n[r])){o=n,a=u;break}if(o)break;!l&&g&&g[r]&&(l=g[r],h=u)}!o&&l&&(o=l,a=h),o&&(i.splice(0,a,o),t=i.join("/"))}return t}function s(t,e){return function(){var i=b.call(arguments,0);return"string"!=typeof i[0]&&1===i.length&&i.push(null),p.apply(r,i.concat([t,e]))}}function a(t){return function(e){return o(e,t)}}function l(t){return function(e){m[t]=e}}function h(t){if(n(y,t)){var e=y[t];delete y[t],v[t]=!0,d.apply(r,e)}if(!n(m,t)&&!n(v,t))throw new Error("No "+t);return m[t]}function u(t){var e,i=t?t.indexOf("!"):-1;return i>-1&&(e=t.substring(0,i),t=t.substring(i+1,t.length)),[e,t]}function c(t){return function(){return E&&E.config&&E.config[t]||{}}}var d,p,f,g,m={},y={},E={},v={},_=Object.prototype.hasOwnProperty,b=[].slice,S=/\.js$/;f=function(t,e){var i,r=u(t),n=r[0];return t=r[1],n&&(n=o(n,e),i=h(n)),n?t=i&&i.normalize?i.normalize(t,a(e)):o(t,e):(t=o(t,e),r=u(t),n=r[0],t=r[1],n&&(i=h(n))),{f:n?n+"!"+t:t,n:t,pr:n,p:i}},g={require:function(t){return s(t)},exports:function(t){var e=m[t];return"undefined"!=typeof e?e:m[t]={}},module:function(t){return{id:t,uri:"",exports:m[t],config:c(t)}}},d=function(t,e,i,o){var a,u,c,d,p,E,_=[],b=typeof i;if(o=o||t,"undefined"===b||"function"===b){for(e=!e.length&&i.length?["require","exports","module"]:e,p=0;p0&&i<=e&&(i===t.LEVEL_SEVERE?console.error(r):i===t.LEVEL_WARNING?console.warn(r):i===t.LEVEL_INFO?console.info(r):console.log(r))},makeMessage:function(t,e,i){var r=this.messageTable[i]?this.messageTable[i]:i;return t+"."+e+": "+r},logMessage:function(t,e,i,r){var n=this.makeMessage(e,i,r);return this.log(t,n),n},messageTable:{abstractInvocation:"The function called is abstract and must be overridden in a subclass.",indexOutOfRange:"The specified index is out of range.",invalidColumn:"The specified column is out of range.",invalidHeight:"The specified height is zero or negative.",invalidWidth:"The specified width is zero or negative.",invalidRow:"The specified row is out of range.",invalidSize:"The specified size is zero or negative.",missingAltitudeMode:"The specified altitude mode is null or undefined.",missingArrayBuffer:"The specified array buffer is null or undefined",missingAttributeName:"The specified DBase attribute file name is null or undefined.",missingArray:"The specified array is null, undefined or of insufficient length.",missingBoundaries:"The specified boundaries array is null or undefined.",missingBuffer:"The specified buffer descriptor is null or undefined.",missingColor:"The specified color is null or undefined.",missingConfig:"The specified config is null or undefined.",missingDc:"The specified draw context is null or undefined.",missingDomElement:"The specified DOM element is null or undefined.",missingEntry:"The specified entry is null or undefined.",missingFont:"The specified font is null or undefined.",missingFrustum:"The specified frustum is null or undefined.",missingFunction:"The specified function is null or undefined.",missingGlContext:"The specified WebGL rendering context is null or undefined.",missingGlobe:"The specified globe is null or undefined.",missingId:"The specified id is null or undefined.",missingImage:"The specified image is null or undefined.",missingImageFormat:"The specified image format is null or undefined.",missingIndices:"The specified indices array is null or undefined.",missingKey:"The specified key is null or undefined.",missingLevel:"The specified level is null or undefined.",missingLine:"The specified line is null or undefined.",missingList:"The specified list is null or undefined.",missingListener:"The specified listener is null or undefined",missingLocation:"The specified location is null or undefined.",missingMatrix:"The specified matrix is null or undefined.",missingOffset:"The specified offset is null or undefined.",missingPath:"The specified path is null or undefined.",missingPlacename:"The specified place name is null or undefined.",missingPlane:"The specified plane is null or undefined.",missingPoint:"The specified point is null or undefined.",missingPoints:"The specified points array is null or undefined.",missingPosition:"The specified position is null or undefined.",missingPositions:"The specified positions array is null or undefined.",missingProgram:"The specified program is null or undefined.",missingProjection:"The specified projection is null or undefined.",missingRectangle:"The specified rectangle is null or undefined.",missingRenderable:"The specified renderable is null or undefined.",missingResolution:"The specified resolution is null, undefined, or zero.",missingResource:"The specified resource is null or undefined.",missingResult:"The specified result variable is null or undefined.",missingResults:"The specified results array is null or undefined.",missingSector:"The specified sector is null or undefined.",missingShapeType:"The specified shape type is null or undefined.",missingSize:"The specified size is null or undefined.",missingText:"The specified text is null or undefined.",missingTexture:"The specified texture is null or undefined.",missingTile:"The specified tile is null or undefined.",missingType:"The specified type is null or undefined.",missingUrl:"The specified URL is null or undefined",missingVector:"The specified vector is null or undefined.",missingVertex:"The specified vertex is null or undefined.",missingViewport:"The specified viewport is null or undefined.",missingWebCoverageService:"The specified WebCoverageService is null or undefined.",missingWorldWindow:"The specified WorldWindow is null or undefined.",notYetImplemented:"This function is not yet implemented",unsupportedVersion:"The specified version is not supported.",webglNotSupported:"The browser does not support WebGL, or WebGL is disabled."}},e=1;return t}),i("formats/aaigrid/AAIGridReader",["./AAIGridConstants","./AAIGridMetadata","../../error/ArgumentError","../../util/Logger"],function(t,e,i,r){"use strict";var n=function(t){if(!t)throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","constructor","missingDataSource"));if("string"!=typeof t&&!(t instanceof ArrayBuffer))throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","constructor","invalidDataSource"));this._values=null,this._metadata=new e;var n=this.decodeData(t);this.parse(n)};return Object.defineProperties(n.prototype,{metadata:{get:function(){return this._metadata}}}),n.prototype.getImageData=function(){return this._values},n.prototype.decodeData=function(t){if("string"!=typeof t&&!(t instanceof ArrayBuffer))throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","decodeData","invalidDataSource"));if("string"==typeof t)return t;if("function"==typeof window.TextDecoder){var e=new TextDecoder("utf-8");return e.decode(t)}for(var n="",o=new Uint8Array(t),s=65535,a=0,l=o.length;al&&(s=l-a),n+=String.fromCharCode.apply(null,o.subarray(a,a+s));return n},n.prototype.parse=function(e){if("string"!=typeof e)throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","parse","invalidDataString"));for(var n=e.replace(/\r?\n|\r/g,"\n").split("\n"),o=[],s=!0,a=0,l=n.length;a=200&&this.status<300?e(new n(this.response),o):(r.log(r.LEVEL_WARNING,"AAIGrid retrieval failed ("+o.statusText+"): "+t),e(null,o))},o.onerror=function(){r.log(r.LEVEL_WARNING,"AAIGrid retrieval failed: "+t),e(null,o)},o.ontimeout=function(){r.log(r.LEVEL_WARNING,"AAIGrid retrieval timed out: "+t),e(null,o)},o.open("GET",t,!0),o.responseType="arraybuffer",o.send(null)},n}),i("geom/Angle",[],function(){"use strict";var t={DEGREES_TO_RADIANS:Math.PI/180,RADIANS_TO_DEGREES:180/Math.PI,TWO_PI:2*Math.PI,HALF_PI:Math.PI/2,normalizedDegrees:function(t){var e=t%360;return e>180?e-360:e<-180?360+e:e},normalizedDegreesLatitude:function(t){var e=t%180;return e>90?180-e:e<-90?-180-e:e},normalizedDegreesLongitude:function(t){var e=t%360;return e>180?e-360:e<-180?360+e:e},normalizedRadians:function(t){var e=t%this.TWO_PI;return e>Math.PI?e-this.TWO_PI:e<-Math.PI?this.TWO_PI+e:e},normalizedRadiansLatitude:function(t){var e=t%Math.PI;return e>this.HALF_PI?Math.PI-e:e<-this.HALF_PI?-Math.PI-e:e},normalizedRadiansLongitude:function(t){var e=t%this.TWO_PI;return e>Math.PI?e-this.TWO_PI:e<-Math.PI?this.TWO_PI+e:e},isValidLatitude:function(t){return t>=-90&&t<=90},isValidLongitude:function(t){return t>=-180&&t<=180},toString:function(t){return t.toString()+"°"},toDecimalDegreesString:function(t){return t.toString()+"°"},toDMSString:function(t){var e,i,r,n,o;return e=t<0?-1:1,i=e*t,r=Math.floor(i),i=60*(i-r),n=Math.floor(i),i=60*(i-n),o=Math.round(i),60==o&&(n++,o=0),60==n&&(r++,n=0),(e==-1?"-":"")+r+"° "+n+"’ "+o+"”"},toDMString:function(t){var e,i,r,n,o,s;return e=t<0?-1:1,i=e*t,r=Math.floor(i),i=60*(i-r),n=Math.floor(i),i=60*(i-n),o=Math.round(i),60==o&&(n++,o=0),60==n&&(r++,n=0),s=0==o?n:n+o/60,(e==-1?"-":"")+r+"° "+s+"’"}};return t}),i("util/Color",["../util/Logger"],function(t){"use strict";var e=function(t,e,i,r){this.red=t,this.green=e,this.blue=i,this.alpha=r};return e.WHITE=new e(1,1,1,1),e.BLACK=new e(0,0,0,1),e.RED=new e(1,0,0,1),e.GREEN=new e(0,1,0,1),e.BLUE=new e(0,0,1,1),e.CYAN=new e(0,1,1,1),e.YELLOW=new e(1,1,0,1),e.MAGENTA=new e(1,0,1,1),e.LIGHT_GRAY=new e(.75,.75,.75,1),e.MEDIUM_GRAY=new e(.5,.5,.5,1),e.DARK_GRAY=new e(.25,.25,.25,1),e.TRANSPARENT=new e(0,0,0,0),e.prototype.set=function(t,e,i,r){return this.red=t,this.green=e,this.blue=i,this.alpha=r,this},e.prototype.copy=function(e){if(!e)throw new ArgumentError(t.logMessage(t.LEVEL_SEVERE,"Color","copy","missingColor"));return this.red=e.red,this.green=e.green,this.blue=e.blue,this.alpha=e.alpha,this},e.prototype.clone=function(){return new e(this.red,this.green,this.blue,this.alpha)},e.prototype.premultipliedComponents=function(t){var e=this.alpha;return t[0]=this.red*e,t[1]=this.green*e,t[2]=this.blue*e,t[3]=e,t},e.colorFromByteArray=function(t){return new e(t[0]/255,t[1]/255,t[2]/255,t[3]/255)},e.colorFromBytes=function(t,i,r,n){return new e(t/255,i/255,r/255,n/255)},e.colorFromHex=function(t){var i=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),o=parseInt(t.substring(6,8),16);return e.colorFromBytes(i,r,n,o)},e.colorFromKmlHex=function(t){var i=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),o=parseInt(t.substring(6,8),16);return e.colorFromBytes(o,n,r,i)},e.prototype.nextColor=function(){var t=Math.round(255*this.red),e=Math.round(255*this.green),i=Math.round(255*this.blue);return t<255?this.red=(t+1)/255:e<255?(this.red=0,this.green=(e+1)/255):i<255?(this.red=0,this.green=0,this.blue=(i+1)/255):(this.red=1/255,this.green=0,this.blue=0),this},e.prototype.equals=function(t){var e=Math.round(255*this.red),i=Math.round(255*this.green),r=Math.round(255*this.blue),n=Math.round(255*this.alpha),o=Math.round(255*t.red),s=Math.round(255*t.green),a=Math.round(255*t.blue),l=Math.round(255*t.alpha);return e===o&&i===s&&r===a&&n===l},e.prototype.equalsBytes=function(t){var e=Math.round(255*this.red),i=Math.round(255*this.green),r=Math.round(255*this.blue),n=Math.round(255*this.alpha);return e===t[0]&&i===t[1]&&r===t[2]&&n===t[3]},e.prototype.toByteString=function(){var t=Math.round(255*this.red),e=Math.round(255*this.green),i=Math.round(255*this.blue),r=Math.round(255*this.alpha);return"("+t+","+e+","+i+","+r+")"},e.prototype.toHexString=function(t){var e=Math.ceil(255*this.red).toString(16),i=Math.ceil(255*this.green).toString(16),r=Math.ceil(255*this.blue).toString(16),n=Math.ceil(255*this.alpha).toString(16),o="#";return o+=e.length<2?"0"+e:e,o+=i.length<2?"0"+i:i,o+=r.length<2?"0"+r:r,t&&(o+=n.length<2?"0"+n:n),o},e.prototype.toCssColorString=function(){var t=Math.round(255*this.red),e=Math.round(255*this.green),i=Math.round(255*this.blue);return"rgba("+t+", "+e+", "+i+", "+this.alpha+")"},e}),i("util/Font",["../error/ArgumentError","../util/Color","../util/Logger"],function(t,e,i){"use strict";var r=function(e,r,n,o,s,a){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Font","constructor","missingSize"));if(e<=0)throw new t(i.logMessage(i.LEVEL_SEVERE,"Font","constructor","invalidSize"));this._size=e,this.style=r||"normal",this.variant=n||"normal",this.weight=o||"normal",this.family=s||"sans-serif",this.horizontalAlignment=a||"center"};return Object.defineProperties(r.prototype,{size:{get:function(){return this._size},set:function(t){this._fontString=null,this._size=t}},style:{get:function(){return this._style},set:function(t){this._fontString=null,this._style=t}},variant:{get:function(){return this._variant},set:function(t){this._fontString=null,this._variant=t}},weight:{get:function(){return this._weight},set:function(t){this._fontString=null,this._weight=t}},family:{get:function(){return this._family},set:function(t){this._fontString=null,this._family=t}},horizontalAlignment:{get:function(){return this._horizontalAlignment},set:function(t){this._toString=null,this._horizontalAlignment=t}},fontString:{get:function(){return this._fontString||(this._fontString=this._style+" "+this.variant+" "+this._weight+" "+this._size.toString()+"px "+this._family),this._fontString}}}),r.prototype.toString=function(){return this._toString&&this._fontString||(this._toString=this.fontString+" "+this.horizontalAlignment),this._toString},r}),i("util/Insets",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i,r,n,o){if(4!==arguments.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"Insets","constructor","invalidArgumentCount"));this._top=i,this._left=r,this._bottom=n,this._right=o};return i.prototype.set=function(t,e,i,r){this._top=t,this._left=e,this._bottom=i,this._right=r},i.prototype.clone=function(){return new i(this._top,this._left,this._bottom,this._right)},i.prototype.toString=function(){return this._top+" "+this._left+" "+this._bottom+" "+this._right},Object.defineProperties(i.prototype,{top:{get:function(){return this._top},set:function(t){this._top=t}},left:{get:function(){return this._left},set:function(t){this._left=t}},bottom:{get:function(){return this._bottom},set:function(t){this._bottom=t}},right:{get:function(){return this._right},set:function(t){this._right=t}}}),i}),i("geom/Vec3",["../util/Logger","../error/ArgumentError"],function(t,e){"use strict";var i=function(t,e,i){this[0]=t,this[1]=e,this[2]=i};return i.prototype=new Float64Array(3),i.ZERO=new i(0,0,0),i.average=function(i,r){if(!i||i.length<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","average","missingArray"));if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","average","missingResult"));var n,o=i.length;r[0]=0,r[1]=0,r[2]=0;for(var s=0,a=i.length;s.999},i.computeTriangleNormal=function(r,n,o){if(!r||!n||!o)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","areColinear","missingVector"));var s=(n[1]-r[1])*(o[2]-r[2])-(n[2]-r[2])*(o[1]-r[1]),a=(n[2]-r[2])*(o[0]-r[0])-(n[0]-r[0])*(o[2]-r[2]),l=(n[0]-r[0])*(o[1]-r[1])-(n[1]-r[1])*(o[0]-r[0]),h=s*s+a*a+l*l;return 0===h?new i(s,a,l):(h=Math.sqrt(h),new i(s/h,a/h,l/h))},i.findThreeIndependentVertices=function(t,e){var r=e&&e>0?e:3;if(!t||t.length<3*r)return null;for(var n=new i(t[0],t[1],t[2]),o=null,s=null,a=r;a0&&o>0?1:0},n.prototype.clip=function(n,o){if(!n||!o)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","clip","missingPoint"));if(n.equals(o))return null;var s,a,l,h=e.fromSegment(n,o),u=this.normal.dot(h.direction);return 0===u?(s=this.dot(h.origin),0===s?[n,o]:null):(a=-this.dot(h.origin)/u,a<0||a>1?null:(l=h.pointAt(a,new r(0,0,0)),u>0?[l,o]:[n,l]))},n}),i("geom/Rectangle",["../util/Logger"],function(t){"use strict";var e=function(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r};return e.prototype.set=function(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r},e.prototype.getMinX=function(){return this.x},e.prototype.getMinY=function(){return this.y},e.prototype.getMaxX=function(){return this.x+this.width},e.prototype.getMaxY=function(){return this.y+this.height},e.prototype.containsPoint=function(t){return t[0]>=this.x&&t[0]<=this.x+this.width&&t[1]>=this.y&&t[1]<=this.y+this.height},e.prototype.intersects=function(t){return!(t.x+t.widththis.x+this.width)&&(!(t.y+t.heightthis.y+this.height)))},e.prototype.intersectsRectangles=function(t){if(t)for(var e=0;ei?i:t},interpolate:function(t,e,i){return(1-t)*e+t*i},cbrt:function(t){return"function"==typeof Math.cbrt?Math.cbrt(t):Math.pow(t,1/3)},computeEllipsoidalGlobeIntersection:function(t,i,n,o){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeEllipsoidalGlobeIntersection","missingLine"));if(!o)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeEllipsoidalGlobeIntersection","missingResult"));var s,a=t.direction[0],l=t.direction[1],h=t.direction[2],u=t.origin[0],c=t.origin[1],d=t.origin[2],p=i/n,f=p*p,g=i*i,m=a*a+f*l*l+h*h,y=2*(u*a+f*c*l+d*h),E=u*u+f*c*c+d*d-g,v=y*y-4*m*E;return!(v<0)&&(s=(-y-Math.sqrt(v))/(2*m),o[0]=u+a*s,o[1]=c+l*s,o[2]=d+h*s,!0)},computeTriangleIntersection:function(t,i,n,o,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingLine"));if(!i||!n||!o)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingVertex"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingResult"));var a=t.direction[0],l=t.direction[1],h=t.direction[2],u=t.origin[0],c=t.origin[1],d=t.origin[2],p=1e-5,f=n[0]-i[0],g=n[1]-i[1],m=n[2]-i[2],y=o[0]-i[0],E=o[1]-i[1],v=o[2]-i[2],_=l*v-h*E,b=h*y-a*v,S=a*E-l*y,w=f*_+g*b+m*S;if(w>-p&&w1+p)return!1;var C=R*m-x*g,A=x*f-T*m,P=T*g-R*f,N=L*(a*C+l*A+h*P);if(N<-p||M+N>1+p)return!1;var O=L*(y*C+E*A+v*P);return!(O<0)&&(s[0]=u+a*O,s[1]=c+l*O,s[2]=d+h*O,!0)},computeIndexedTrianglesIntersection:function(t,i,n,a){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingLine"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingPoints"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingIndices"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingResults"));for(var l=new o(0,0,0),h=new o(0,0,0),u=new o(0,0,0),c=new o(0,0,0),d=0,p=n.length;d0},computeTriStripIntersections:function(t,i,n,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingLine"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingPoints"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingIndices"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingResults"));var a,l,h,u,c,d,p,f,g,m,y,E,v,_,b,S,w,L,T,R,x,M,C,A,P,N,O,I,D,k,V=t.direction[0],F=t.direction[1],G=t.direction[2],W=t.origin[0],B=t.origin[1],U=t.origin[2],K=1e-5;k=3*n[0],u=i[k++],c=i[k++],d=i[k],k=3*n[1],p=i[k++],f=i[k++],g=i[k];for(var j=2,z=n.length;j-K&&I1+K||(M=R*E-x*y,C=x*m-T*E,A=T*y-R*m,N=D*(V*M+F*C+G*A),N<-K||P+N>1+K||(O=D*(v*M+_*C+b*A),O>=0&&s.push(new o(W+V*O,B+F*O,U+G*O)))))},fabs:function(t){return t>=0?t:-t},fmod:function(t,e){return 0===e?0:t-Math.floor(t/e)*e},fract:function(t){return t-Math.floor(t)},mod:function(t,e){return(t%e+e)%e},max:function(t,e){return t>e?t:e},localCoordinateAxesAtPoint:function(t,i,n,o,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingVector"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingGlobe"));if(!n||!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingResult"));var a=t[0],l=t[1],h=t[2];i.surfaceNormalAtPoint(a,l,h,s),i.northTangentAtPoint(a,l,h,o),n.set(o[0],o[1],o[2]),n.cross(s),n.normalize(),o.set(s[0],s[1],s[2]),o.cross(n),o.normalize()},horizonDistanceForGlobeRadius:function(t,i){if(t<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","horizontalDistanceForGlobeRadius","The specified globe radius is negative."));return t>0&&i>0?Math.sqrt(i*(2*t+i)):0},perspectiveNearDistanceForFarDistance:function(t,i,n){if(t<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified distance is negative."));if(i<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified resolution is negative."));if(n<1)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified depth bits is negative."));var o=(1<0?1:t<0?-1:0},gudermannianInverse:function(e){return Math.log(Math.tan(Math.PI/4+e*t.DEGREES_TO_RADIANS/2))/Math.PI},epsg3857ToEpsg4326:function(e,i){var r=6378137,n=Math.PI/2-2*Math.atan(Math.exp(-i/r)),o=e/r;return[s.clamp(n*t.RADIANS_TO_DEGREES,-90,90),s.clamp(o*t.RADIANS_TO_DEGREES,-180,180)]},powerOfTwoFloor:function(t){var e=Math.floor(Math.log(t)/Math.log(2));return Math.pow(2,e)},normalizeAngle360:function(t){var e=t%360;return e>=0?e:e<0?360+e:360-e}};return s}),i("geom/Location",["../geom/Angle","../error/ArgumentError","../util/Logger","../geom/Plane","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t,e){this.latitude=t,this.longitude=e};return s.ZERO=new s(0,0),s.fromRadians=function(e,i){return new s(e*t.RADIANS_TO_DEGREES,i*t.RADIANS_TO_DEGREES)},s.prototype.copy=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","copy","missingLocation"));return this.latitude=t.latitude,this.longitude=t.longitude,this},s.prototype.set=function(t,e){return this.latitude=t,this.longitude=e,this},s.prototype.equals=function(t){return t&&t.latitude===this.latitude&&t.longitude===this.longitude},s.interpolateAlongPath=function(t,r,n,o,s){if(!n||!o)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateAlongPath","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateAlongPath","missingResult"));return t===WorldWind.GREAT_CIRCLE?this.interpolateGreatCircle(r,n,o,s):t&&t===WorldWind.RHUMB_LINE?this.interpolateRhumb(r,n,o,s):this.interpolateLinear(r,n,o,s)},s.interpolateGreatCircle=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateGreatCircle","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateGreatCircle","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.greatCircleAzimuth(r,n),h=this.greatCircleDistance(r,n);return this.greatCircleLocation(r,l,a*h,s)},s.greatCircleAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleAzimuth","missingLocation"));var o,s,a,l=r.latitude*t.DEGREES_TO_RADIANS,h=n.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n.longitude*t.DEGREES_TO_RADIANS;return l==h&&u==c?0:u==c?l>h?180:0:(s=Math.cos(h)*Math.sin(c-u),o=Math.cos(l)*Math.sin(h)-Math.sin(l)*Math.cos(h)*Math.cos(c-u),a=Math.atan2(s,o),isNaN(a)?0:a*t.RADIANS_TO_DEGREES)},s.greatCircleDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleDistance","missingLocation"));var o,s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(o=Math.sin((u-h)/2),s=Math.sin((d-c)/2),a=o*o+Math.cos(h)*Math.cos(u)*s*s,l=2*Math.asin(Math.sqrt(a)),isNaN(l)?0:l)},s.greatCircleLocation=function(r,n,o,s){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleLocation","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleLocation","missingResult"));if(0==o)return s.latitude=r.latitude,s.longitude=r.longitude,s;var a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n*t.DEGREES_TO_RADIANS;return a=Math.asin(Math.sin(h)*Math.cos(o)+Math.cos(h)*Math.sin(o)*Math.cos(c)),l=u+Math.atan2(Math.sin(o)*Math.sin(c),Math.cos(h)*Math.cos(o)-Math.sin(h)*Math.sin(o)*Math.cos(c)),isNaN(a)||isNaN(l)?(s.latitude=r.latitude,s.longitude=r.longitude):(s.latitude=t.normalizedDegreesLatitude(a*t.RADIANS_TO_DEGREES),s.longitude=t.normalizedDegreesLongitude(l*t.RADIANS_TO_DEGREES)),s},s.interpolateRhumb=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateRhumb","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateRhumb","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.rhumbAzimuth(r,n),h=this.rhumbDistance(r,n);return this.rhumbLocation(r,l,a*h,s)},s.rhumbAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbAzimuth","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=d-c,a=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(h/2+Math.PI/4)),o.fabs(s)>Math.PI&&(s=s>0?-(2*Math.PI-s):2*Math.PI+s),l=Math.atan2(s,a),isNaN(l)?0:l*t.RADIANS_TO_DEGREES)},s.rhumbDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbDistance","missingLocation"));var s,a,l,h,u,c=r.latitude*t.DEGREES_TO_RADIANS,d=n.latitude*t.DEGREES_TO_RADIANS,p=r.longitude*t.DEGREES_TO_RADIANS,f=n.longitude*t.DEGREES_TO_RADIANS;return c==d&&p==f?0:(s=d-c,a=f-p,l=Math.log(Math.tan(d/2+Math.PI/4)/Math.tan(c/2+Math.PI/4)),h=s/l,(isNaN(l)||isNaN(h))&&(h=Math.cos(c)),o.fabs(a)>Math.PI&&(a=a>0?-(2*Math.PI-a):2*Math.PI+a),u=Math.sqrt(s*s+h*h*a*a),isNaN(u)?0:u)},s.rhumbLocation=function(r,n,s,a){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbLocation","missingLocation"));if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbLocation","missingResult"));if(0==s)return a.latitude=r.latitude,a.longitude=r.longitude,a;var l,h,u=r.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n*t.DEGREES_TO_RADIANS,p=u+s*Math.cos(d),f=Math.log(Math.tan(p/2+Math.PI/4)/Math.tan(u/2+Math.PI/4)),g=(p-u)/f;return(isNaN(f)||isNaN(g)||!isFinite(g))&&(g=Math.cos(u)),l=s*Math.sin(d)/g,o.fabs(p)>Math.PI/2&&(p=p>0?Math.PI-p:-Math.PI-p),h=o.fmod(c+l+Math.PI,2*Math.PI)-Math.PI,isNaN(p)||isNaN(h)?(a.latitude=r.latitude,a.longitude=r.longitude):(a.latitude=t.normalizedDegreesLatitude(p*t.RADIANS_TO_DEGREES),a.longitude=t.normalizedDegreesLongitude(h*t.RADIANS_TO_DEGREES)),a},s.interpolateLinear=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateLinear","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateLinear","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.linearAzimuth(r,n),h=this.linearDistance(r,n);return this.linearLocation(r,l,a*h,s)},s.linearAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearAzimuth","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=d-c,a=u-h,o.fabs(s)>Math.PI&&(s=s>0?-(2*Math.PI-s):2*Math.PI+s),l=Math.atan2(s,a),isNaN(l)?0:l*t.RADIANS_TO_DEGREES)},s.linearDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearDistance","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=u-h,a=d-c,o.fabs(a)>Math.PI&&(a=a>0?-(2*Math.PI-a):2*Math.PI+a),l=Math.sqrt(s*s+a*a),isNaN(l)?0:l)},s.linearLocation=function(r,n,s,a){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearLocation","missingLocation"));if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearLocation","missingResult"));if(0==s)return a.latitude=r.latitude,a.longitude=r.longitude,a;var l,h=r.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n*t.DEGREES_TO_RADIANS,d=h+s*Math.cos(c);return o.fabs(d)>Math.PI/2&&(d=d>0?Math.PI-d:-Math.PI-d),l=o.fmod(u+s*Math.sin(c)+Math.PI,2*Math.PI)-Math.PI,isNaN(d)||isNaN(l)?(a.latitude=r.latitude,a.longitude=r.longitude):(a.latitude=t.normalizedDegreesLatitude(d*t.RADIANS_TO_DEGREES),a.longitude=t.normalizedDegreesLongitude(l*t.RADIANS_TO_DEGREES)),a},s.locationsCrossDateLine=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","locationsCrossDateline","missingLocation"));for(var r=null,n=0,s=t.length;n180&&l<360)return!0}r=a}return!1},s.greatCircleArcExtremeLocations=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleArcExtremeLocations","missingLocation"));for(var r=null,n=null,o=null,a=0,l=t.length;au[0].latitude)&&(r=u[0]),(null==n||n.latitude=l.latitude&&(c=l.latitude,h=l),d<=l.latitude&&(d=l.latitude,u=l);var f=s.greatCircleAzimuth(t,r),g=s.greatCircleDistance(t,r),m=s.greatCircleExtremeLocationsUsingAzimuth(t,f);for(n=0,a=m.length;n=0&&E<=g&&(c>=l.latitude&&(c=l.latitude,h=l),d<=l.latitude&&(d=l.latitude,u=l))}return[h,u]},s.greatCircleExtremeLocationsUsingAzimuth=function(r,n){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleArcExtremeLocationsUsingAzimuth","missingLocation"));var o=r.latitude,a=n*t.DEGREES_TO_RADIANS,l=-Math.tan(o)/Math.cos(a),h=Math.atan(l),u=h+Math.PI/2,c=h-Math.PI/2;return[s.greatCircleLocation(r,n,u,new s(0,0)),s.greatCircleLocation(r,n,c,new s(0,0))]},s.intersectionWithMeridian=function(t,e,i,o){var s=o.computePointFromLocation(t.latitude,t.longitude,new n(0,0,0)),a=o.computePointFromLocation(e.latitude,e.longitude,new n(0,0,0)),l=o.computePointFromLocation(90,i,new n(0,0,0)),h=o.computePointFromLocation(0,i,new n(0,0,0)),u=r.fromPoints(l,h,n.ZERO),c=new n(0,0,0);if(!u.intersectsSegmentAt(s,a,c))return null;var d=new WorldWind.Position(0,0,0);return o.computePositionFromPoint(c[0],c[1],c[2],d),d.latitude},s.meridianIntersection=function(t,e,i){var r=t.longitude<0?t.longitude+360:t.longitude,n=e.longitude<0?e.longitude+360:e.longitude;if(r===n)return null;var o=i<0?i+360:i,s=(e.latitude-t.latitude)/(n-r),a=t.latitude+s*(o-r);return a},s.poles={NONE:0,NORTH:1,SOUTH:2},s}),i("geom/Position",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../util/WWMath"],function(t,e,i,r,n){"use strict";var o=function(t,e,i){this.latitude=t,this.longitude=e,this.altitude=i};return o.ZERO=new o(0,0,0),o.fromRadians=function(e,i,r){return new o(e*t.RADIANS_TO_DEGREES,i*t.RADIANS_TO_DEGREES,r)},o.prototype.copy=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","copy","missingPosition"));return this.latitude=t.latitude,this.longitude=t.longitude,this.altitude=t.altitude,this},o.prototype.equals=function(t){return t&&t.latitude===this.latitude&&t.longitude===this.longitude&&t.altitude===this.altitude},o.interpolateGreatCircle=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateGreatCircle","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateGreatCircle","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateGreatCircle(l,o,s,a),a},o.interpolateRhumb=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateRhumb","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateRhumb","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateRhumb(l,o,s,a),a},o.interpolateLinear=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateLinear","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateLinear","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateLinear(l,o,s,a),a},o.prototype.toString=function(){return"("+this.latitude.toString()+"°, "+this.longitude.toString()+"°, "+this.altitude.toString()+")"},o}),i("render/Texture",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Texture","constructor","missingGlContext"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"Texture","constructor","missingImage"));o||(o=r.CLAMP_TO_EDGE);var s=r.createTexture(),a=i.isPowerOfTwo(n.width)&&i.isPowerOfTwo(n.height);this.originalImageWidth=n.width,this.originalImageHeight=n.height,o!==r.REPEAT||a||(n=this.resizeImage(n),a=!0),this.imageWidth=n.width,this.imageHeight=n.height,this.size=n.width*n.height*4,r.bindTexture(r.TEXTURE_2D,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,a?r.LINEAR_MIPMAP_LINEAR:r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,o),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),a&&r.generateMipmap(r.TEXTURE_2D),this.textureId=s,this.creationTime=new Date,this.texParameters={},this.anisotropicFilterExt=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic")};return r.prototype.setTexParameter=function(t,e){this.texParameters[t]=e},r.prototype.getTexParameter=function(t){return this.texParameters[t]},r.prototype.clearTexParameters=function(){this.texParameters={}},r.prototype.dispose=function(t){t.deleteTexture(this.textureId),delete this.textureId},r.prototype.bind=function(t){var e=t.currentGlContext;return e.bindTexture(e.TEXTURE_2D,this.textureId),this.applyTexParameters(t),t.frameStatistics.incrementTextureLoadCount(1),!0},r.prototype.applyTexParameters=function(t){var e=t.currentGlContext,i=this.texParameters[e.TEXTURE_MAG_FILTER]||e.LINEAR;e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,i),i===e.LINEAR&&this.anisotropicFilterExt&&e.texParameteri(e.TEXTURE_2D,this.anisotropicFilterExt.TEXTURE_MAX_ANISOTROPY_EXT,4)},r.prototype.resizeImage=function(t){var e=document.createElement("canvas");e.width=i.powerOfTwoFloor(t.width),e.height=i.powerOfTwoFloor(t.height);var r=e.getContext("2d");return r.drawImage(t,0,0,e.width,e.height),e},r}),i("geom/Matrix",["../geom/Angle","../error/ArgumentError","../util/Logger","../geom/Plane","../geom/Position","../geom/Rectangle","../render/Texture","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l,this[9]=h,this[10]=u,this[11]=c,this[12]=d,this[13]=p,this[14]=f,this[15]=g};return h.prototype=new Float64Array(16),h.fromIdentity=function(){return new h(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},h.principalAxesFromPoints=function(t,r,n,o){if(!t||t.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","principalAxesFromPoints","missingPoints")); -if(!r||!n||!o)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","principalAxesFromPoints","An axis argument is null or undefined."));var s=h.fromIdentity();s.setToCovarianceOfPoints(t),s.eigensystemFromSymmetricMatrix(r,n,o),r.normalize(),n.normalize(),o.normalize()},h.prototype.set=function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){return this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l,this[9]=h,this[10]=u,this[11]=c,this[12]=d,this[13]=p,this[14]=f,this[15]=g,this},h.prototype.setToIdentity=function(){this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=1,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=1,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1},h.prototype.copy=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","copy","missingMatrix"));this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15]},h.prototype.clone=function(){var t=h.fromIdentity();return t.copy(this),t},h.prototype.equals=function(t){return t&&this[0]==t[0]&&this[1]==t[1]&&this[2]==t[2]&&this[3]==t[3]&&this[4]==t[4]&&this[5]==t[5]&&this[6]==t[6]&&this[7]==t[7]&&this[8]==t[8]&&this[9]==t[9]&&this[10]==t[10]&&this[11]==t[11]&&this[12]==t[12]&&this[13]==t[13]&&this[14]==t[14]&&this[15]==t[15]},h.prototype.columnMajorComponents=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","columnMajorComponents","missingResult"));return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t},h.prototype.setToTranslation=function(t,e,i){return this[0]=1,this[1]=0,this[2]=0,this[3]=t,this[4]=0,this[5]=1,this[6]=0,this[7]=e,this[8]=0,this[9]=0,this[10]=1,this[11]=i,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.setTranslation=function(t,e,i){return this[3]=t,this[7]=e,this[11]=i,this},h.prototype.setToScale=function(t,e,i){return this[0]=t,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=e,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=i,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.setScale=function(t,e,i){return this[0]=t,this[5]=e,this[10]=i,this},h.prototype.setToTransposeOfMatrix=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToTransposeOfMatrix","missingMatrix"));return this[0]=t[0],this[1]=t[4],this[2]=t[8],this[3]=t[12],this[4]=t[1],this[5]=t[5],this[6]=t[9],this[7]=t[13],this[8]=t[2],this[9]=t[6],this[10]=t[10],this[11]=t[14],this[12]=t[3],this[13]=t[7],this[14]=t[11],this[15]=t[15],this},h.prototype.setToMultiply=function(t,r){if(!t||!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToMultiply","missingMatrix"));var n=t,o=r;return this[0]=n[0]*o[0]+n[1]*o[4]+n[2]*o[8]+n[3]*o[12],this[1]=n[0]*o[1]+n[1]*o[5]+n[2]*o[9]+n[3]*o[13],this[2]=n[0]*o[2]+n[1]*o[6]+n[2]*o[10]+n[3]*o[14],this[3]=n[0]*o[3]+n[1]*o[7]+n[2]*o[11]+n[3]*o[15],this[4]=n[4]*o[0]+n[5]*o[4]+n[6]*o[8]+n[7]*o[12],this[5]=n[4]*o[1]+n[5]*o[5]+n[6]*o[9]+n[7]*o[13],this[6]=n[4]*o[2]+n[5]*o[6]+n[6]*o[10]+n[7]*o[14],this[7]=n[4]*o[3]+n[5]*o[7]+n[6]*o[11]+n[7]*o[15],this[8]=n[8]*o[0]+n[9]*o[4]+n[10]*o[8]+n[11]*o[12],this[9]=n[8]*o[1]+n[9]*o[5]+n[10]*o[9]+n[11]*o[13],this[10]=n[8]*o[2]+n[9]*o[6]+n[10]*o[10]+n[11]*o[14],this[11]=n[8]*o[3]+n[9]*o[7]+n[10]*o[11]+n[11]*o[15],this[12]=n[12]*o[0]+n[13]*o[4]+n[14]*o[8]+n[15]*o[12],this[13]=n[12]*o[1]+n[13]*o[5]+n[14]*o[9]+n[15]*o[13],this[14]=n[12]*o[2]+n[13]*o[6]+n[14]*o[10]+n[15]*o[14],this[15]=n[12]*o[3]+n[13]*o[7]+n[14]*o[11]+n[15]*o[15],this},h.prototype.setToCovarianceOfPoints=function(t){if(!t||t.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToCovarianceOfPoints","missingArray"));var r,n,o,s,l=0,h=0,u=0,c=0,d=0,p=0,f=0,g=new a(0,0,0);r=a.averageOfBuffer(t,new a(0,0,0));for(var m=0,y=t.length/3;m=0;r-=1){for(o=i[r],n=r+1;n<4;n+=1)o-=t[r][n]*i[n];i[r]=o/t[r][r]}},h.ludcmp=function(t,e){var i,r,n,o,s,a,l,h,u=1e-20,c=[],d=1;for(r=0;r<4;r+=1){for(s=0,n=0;n<4;n+=1)(i=Math.abs(t[r][n]))>s&&(s=i);if(0==s)return 0;c[r]=1/s}for(n=0;n<4;n+=1){for(r=0;r=s&&(s=h,l=r)}if(n!=l){for(o=0;o<4;o+=1)h=t[l][o],t[l][o]=t[n][o],t[n][o]=h;d=-d,c[l]=c[n]}if(e[n]=l,0==t[n][n]&&(t[n][n]=u),3!=n)for(h=1/t[n][n],r=n+1;r<4;r+=1)t[r][n]*=h}return d},h.prototype.invertOrthonormalMatrix=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","invertOrthonormalMatrix","missingMatrix"));var r=t;return this[0]=r[0],this[1]=r[4],this[2]=r[8],this[3]=0-r[0]*r[3]-r[4]*r[7]-r[8]*r[11],this[4]=r[1],this[5]=r[5],this[6]=r[9],this[7]=0-r[1]*r[3]-r[5]*r[7]-r[9]*r[11],this[8]=r[2],this[9]=r[6],this[10]=r[10],this[11]=0-r[2]*r[3]-r[6]*r[7]-r[10]*r[11],this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.eigensystemFromSymmetricMatrix=function(t,r,n){if(!t||!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","eigensystemFromSymmetricMatrix","missingResult"));if(this[1]!=this[4]||this[2]!=this[8]||this[6]!=this[9])throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","eigensystemFromSymmetricMatrix","Matrix is not symmetric"));for(var o,s,a,h,u,c,d,p,f,g,m,y=1e-10,E=this[0],v=this[1],_=this[2],b=this[5],S=this[6],w=this[10],L=[[1,0,0],[0,1,0],[0,0,1]],T=32,R=0;R1)return!1;var l=this[0]*o+this[1]*s+this[2]*a+this[3],h=this[4]*o+this[5]*s+this[6]*a+this[7],u=this[8]*o+this[9]*s+this[10]*a+this[11],c=this[12]*o+this[13]*s+this[14]*a+this[15];return 0!==c&&(n[0]=l/c,n[1]=h/c,n[2]=u/c,!0)},h}),i("pick/PickedObject",[],function(){"use strict";var t=function(t,e,i,r,n){this.color=t,this.userObject=e,this.position=i,this.parentLayer=r,this.isTerrain=n,this.isOnTop=!1};return t}),i("error/UnsupportedOperationError",["../error/AbstractError"],function(t){"use strict";var e=function(e){t.call(this,"UnsupportedOperationError",e);var i;try{throw new Error}catch(t){i=t.stack}this.stack=i};return e.prototype=Object.create(t.prototype),e}),i("render/Renderable",["../util/Logger","../error/UnsupportedOperationError"],function(t,e){"use strict";var i=function(){this.displayName="Renderable",this.enabled=!0,this.pickDelegate=null,this.userProperties={}};return i.prototype.render=function(i){throw new e(t.logMessage(t.LEVEL_SEVERE,"Renderable","render","abstractInvocation"))},i}),i("shapes/Annotation",["../shapes/AnnotationAttributes","../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Font","../util/Insets","../util/Logger","../geom/Matrix","../util/Offset","../pick/PickedObject","../render/Renderable","../shapes/TextAttributes","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f){"use strict";var g=function(i,r){if(!i)throw new e(s.logMessage(s.LEVEL_SEVERE,"Annotation","constructor","missingPosition"));u.call(this),this.position=i,this.attributes=r?r:new t(null),this.altitudeMode=WorldWind.ABSOLUTE,this.layer=null,this.lastStateKey=null,this.calloutTransform=a.fromIdentity(),this.calloutOffset=new WorldWind.Offset(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,0),this.label="",this.labelTexture=null,this.labelTransform=a.fromIdentity(),this.placePoint=new p(0,0,0),this.depthOffset=-2.05,this.calloutPoints=null};return g.matrix=a.fromIdentity(),g.screenPoint=new p(0,0,0),g.scratchPoint=new p(0,0,0),g.prototype=Object.create(u.prototype),Object.defineProperties(g.prototype,{text:{get:function(){return this.label},set:function(t){this.label=t,this.lastStateKey=null}}}),g.prototype.renderOrdered=function(t){if(this.drawOrderedAnnotation(t),t.pickingMode){var e=new h(this.pickColor.clone(),this,this.position,this.layer,!1);t.pickPoint&&this.labelBounds.containsPoint(t.convertPointToViewport(t.pickPoint,g.scratchPoint))&&(e.labelPicked=!0),t.resolvePick(e)}},g.prototype.clone=function(){var t=new g(this.position);return t.copy(this),t.pickDelegate=this.pickDelegate?this.pickDelegate:this,t},g.prototype.copy=function(t){return this.position=t.position,this.enabled=t.enabled,this.attributes=t.attributes,this.label=t.label,this.altitudeMode=t.altitudeMode,this.pickDelegate=t.pickDelegate,this.depthOffset=t.depthOffset,this},g.prototype.render=function(t){if(this.enabled&&t.accumulateOrderedRenderables&&(!t.globe.projectionLimits||t.globe.projectionLimits.containsLocation(this.position.latitude,this.position.longitude))){var e;if(this.lastFrameTime!==t.timestamp)e=this.makeOrderedRenderable(t);else{var i=this.clone();e=i.makeOrderedRenderable(t)}e&&(e.layer=t.currentLayer,this.lastFrameTime=t.timestamp,t.addOrderedRenderable(e))}},g.prototype.drawOrderedAnnotation=function(t){this.beginDrawing(t);try{this.doDrawOrderedAnnotation(t)}finally{this.endDrawing(t)}},g.prototype.makeOrderedRenderable=function(t){var e,i,r,n,o,s,a,l,h;if(this.attributes.width>0&&(this.label=t.textRenderer.wrap(this.label,this.attributes.width,this.attributes.height)),t.surfacePointForMode(this.position.latitude,this.position.longitude,this.position.altitude,this.altitudeMode,this.placePoint),this.eyeDistance=t.eyePoint.distanceTo(this.placePoint),!t.projectWithDepth(this.placePoint,this.depthOffset,g.screenPoint))return null;this.labelTexture=t.createTextTexture(this.label,this.attributes.textAttributes),e=this.labelTexture.imageWidth,i=this.labelTexture.imageHeight,r=this.attributes.scale,n=this.attributes.insets.left,o=this.attributes.insets.right,s=this.attributes.insets.top,a=this.attributes.insets.bottom,h=this.attributes.leaderGapHeight,l=this.calloutOffset.offsetForSize((e+n+o)*r,(i+s+a)*r),this.calloutTransform.setTranslation(g.screenPoint[0]-l[0],g.screenPoint[1]+h,g.screenPoint[2]),this.labelTransform.setTranslation(g.screenPoint[0]-l[0]+n*r,g.screenPoint[1]+h+a*r,g.screenPoint[2]),this.labelTransform.setScale(e*r,i*r,1),this.labelBounds=f.boundingRectForUnitQuad(this.labelTransform);var u=(e+n+o)*r,c=(i+s+a)*r,d=u/2,p=-h;return this.attributes.drawLeader||(p=0),this.attributes.stateKey!==this.lastStateKey&&(this.calloutPoints=this.createCallout(u,c,d,p,this.attributes.leaderGapWidth,this.attributes.cornerRadius)),this},g.prototype.beginDrawing=function(t){var e,r=t.currentGlContext;t.findAndBindProgram(i),e=t.currentProgram,r.enableVertexAttribArray(e.vertexPointLocation),r.enableVertexAttribArray(e.vertexTexCoordLocation),e.loadModulateColor(r,t.pickingMode)},g.prototype.endDrawing=function(t){var e=t.currentGlContext,i=t.currentProgram;e.disableVertexAttribArray(i.vertexPointLocation),e.disableVertexAttribArray(i.vertexTexCoordLocation),t.bindProgram(null)},g.prototype.drawCorner=function(t,e,i,r,n,o,s,a){if(i<1)return a;for(var l=(n-r)/(o-1),h=1;hs)for(var m=null,y=null,E=Math.ceil(g/s),v=1;v1&&(i=1),Math.acos(i)}};return i}),i("geom/Sector",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t,e,i,r){this.minLatitude=t,this.maxLatitude=e,this.minLongitude=i,this.maxLongitude=r};return s.ZERO=new s(0,0,0,0),s.FULL_SPHERE=new s(-90,90,-180,180),s.prototype.copy=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","copy","missingSector"));return this.minLatitude=t.minLatitude,this.maxLatitude=t.maxLatitude,this.minLongitude=t.minLongitude,this.maxLongitude=t.maxLongitude,this},s.prototype.isEmpty=function(){return this.minLatitude===this.maxLatitude&&this.minLongitude===this.maxLongitude},s.prototype.deltaLatitude=function(){return this.maxLatitude-this.minLatitude},s.prototype.deltaLongitude=function(){return this.maxLongitude-this.minLongitude},s.prototype.centroidLatitude=function(){return.5*(this.minLatitude+this.maxLatitude)},s.prototype.centroidLongitude=function(){return.5*(this.minLongitude+this.maxLongitude)},s.prototype.centroid=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","centroid","missingResult"));return t.latitude=this.centroidLatitude(),t.longitude=this.centroidLongitude(),t},s.prototype.minLatitudeRadians=function(){return this.minLatitude*t.DEGREES_TO_RADIANS},s.prototype.maxLatitudeRadians=function(){return this.maxLatitude*t.DEGREES_TO_RADIANS},s.prototype.minLongitudeRadians=function(){return this.minLongitude*t.DEGREES_TO_RADIANS},s.prototype.maxLongitudeRadians=function(){return this.maxLongitude*t.DEGREES_TO_RADIANS},s.prototype.setToBoundingSector=function(t){if(!t||t.length<2)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","setToBoundingSector","missingArray"));for(var i=90,n=-90,o=180,s=-180,a=0,l=t.length;aa&&(a=p);var f=d.longitude;if(f>=0&&fl&&(l=f),null!=h){var g=h.longitude;o.signum(f)!=o.signum(g)&&Math.abs(f-g)<180&&(l=0,n=0)}h=d}return i===a&&n===l?null:[new s(i,a,n,180),new s(i,a,-180,l)]},s.prototype.intersects=function(t){return t&&this.minLongitude<=t.maxLongitude&&this.maxLongitude>=t.minLongitude&&this.minLatitude<=t.maxLatitude&&this.maxLatitude>=t.minLatitude},s.prototype.overlaps=function(t){return t&&this.minLongitudet.minLongitude&&this.minLatitudet.minLatitude},s.prototype.contains=function(t){return t&&this.minLatitude<=t.minLatitude&&this.maxLatitude>=t.maxLatitude&&this.minLongitude<=t.minLongitude&&this.maxLongitude>=t.maxLongitude},s.prototype.containsLocation=function(t,e){return this.minLatitude<=t&&this.maxLatitude>=t&&this.minLongitude<=e&&this.maxLongitude>=e},s.prototype.intersection=function(t){if(!t instanceof s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","intersection","missingSector"));return this.minLatitudet.maxLatitude&&(this.maxLatitude=t.maxLatitude),this.minLongitudet.maxLongitude&&(this.maxLongitude=t.maxLongitude),this.maxLatitude0?(h.push(t.computePointFromPosition(this.minLatitude,d.longitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(this.maxLatitude,d.longitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(0,this.minLongitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(0,this.maxLongitude,l,new n(0,0,0)))):this.minLatitude<0?h.push(t.computePointFromPosition(this.maxLatitude,d.longitude,l,new n(0,0,0))):h.push(t.computePointFromPosition(this.minLatitude,d.longitude,l,new n(0,0,0))),this.deltaLongitude()>=360){var p=this.minLatitude;h.push(t.computePointFromPosition(p,0,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,90,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,-90,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,180,l,new n(0,0,0)));var f=this.maxLatitude;h.push(t.computePointFromPosition(f,0,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,90,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,-90,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,180,l,new n(0,0,0)))}else if(this.deltaLongitude()>180){var g=d.longitude,m=d.latitude,y=(this.minLongitude+g)/2;h.push(t.computePointFromPosition(m,y,l,new n(0,0,0))),y=(g+this.maxLongitude)/2,h.push(t.computePointFromPosition(m,y,l,new n(0,0,0))),h.push(t.computePointFromPosition(m,this.minLongitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(m,this.maxLongitude,l,new n(0,0,0)))}return h},s.prototype.union=function(t){if(!t instanceof s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","union","missingSector"));return this.minLatitude>t.minLatitude&&(this.minLatitude=t.minLatitude),this.maxLatitudet.minLongitude&&(this.minLongitude=t.minLongitude),this.maxLongitude0&&(t.splice(u-1,2),u-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((p||g)&&f){for(i=t.split("/"),u=i.length;u>0;u-=1){if(r=i.slice(0,u).join("/"),p)for(c=p.length;c>0;c-=1)if(n=f[p.slice(0,c).join("/")],n&&(n=n[r])){o=n,a=u;break}if(o)break;!l&&g&&g[r]&&(l=g[r],h=u)}!o&&l&&(o=l,a=h),o&&(i.splice(0,a,o),t=i.join("/"))}return t}function s(t,e){return function(){var i=b.call(arguments,0);return"string"!=typeof i[0]&&1===i.length&&i.push(null),p.apply(r,i.concat([t,e]))}}function a(t){return function(e){return o(e,t)}}function l(t){return function(e){m[t]=e}}function h(t){if(n(y,t)){var e=y[t];delete y[t],v[t]=!0,d.apply(r,e)}if(!n(m,t)&&!n(v,t))throw new Error("No "+t);return m[t]}function u(t){var e,i=t?t.indexOf("!"):-1;return i>-1&&(e=t.substring(0,i),t=t.substring(i+1,t.length)),[e,t]}function c(t){return function(){return E&&E.config&&E.config[t]||{}}}var d,p,f,g,m={},y={},E={},v={},_=Object.prototype.hasOwnProperty,b=[].slice,w=/\.js$/;f=function(t,e){var i,r=u(t),n=r[0];return t=r[1],n&&(n=o(n,e),i=h(n)),n?t=i&&i.normalize?i.normalize(t,a(e)):o(t,e):(t=o(t,e),r=u(t),n=r[0],t=r[1],n&&(i=h(n))),{f:n?n+"!"+t:t,n:t,pr:n,p:i}},g={require:function(t){return s(t)},exports:function(t){var e=m[t];return"undefined"!=typeof e?e:m[t]={}},module:function(t){return{id:t,uri:"",exports:m[t],config:c(t)}}},d=function(t,e,i,o){var a,u,c,d,p,E,_=[],b=typeof i;if(o=o||t,"undefined"===b||"function"===b){for(e=!e.length&&i.length?["require","exports","module"]:e,p=0;p0&&i<=e&&(i===t.LEVEL_SEVERE?console.error(r):i===t.LEVEL_WARNING?console.warn(r):i===t.LEVEL_INFO?console.info(r):console.log(r))},makeMessage:function(t,e,i){var r=this.messageTable[i]?this.messageTable[i]:i;return t+"."+e+": "+r},logMessage:function(t,e,i,r){var n=this.makeMessage(e,i,r);return this.log(t,n),n},messageTable:{abstractInvocation:"The function called is abstract and must be overridden in a subclass.",indexOutOfRange:"The specified index is out of range.",invalidColumn:"The specified column is out of range.",invalidHeight:"The specified height is zero or negative.",invalidWidth:"The specified width is zero or negative.",invalidRow:"The specified row is out of range.",invalidSize:"The specified size is zero or negative.",missingAltitudeMode:"The specified altitude mode is null or undefined.",missingArrayBuffer:"The specified array buffer is null or undefined",missingAttributeName:"The specified DBase attribute file name is null or undefined.",missingArray:"The specified array is null, undefined or of insufficient length.",missingBoundaries:"The specified boundaries array is null or undefined.",missingBuffer:"The specified buffer descriptor is null or undefined.",missingColor:"The specified color is null or undefined.",missingConfig:"The specified config is null or undefined.",missingDc:"The specified draw context is null or undefined.",missingDomElement:"The specified DOM element is null or undefined.",missingEntry:"The specified entry is null or undefined.",missingFont:"The specified font is null or undefined.",missingFrustum:"The specified frustum is null or undefined.",missingFunction:"The specified function is null or undefined.",missingGlContext:"The specified WebGL rendering context is null or undefined.",missingGlobe:"The specified globe is null or undefined.",missingId:"The specified id is null or undefined.",missingImage:"The specified image is null or undefined.",missingImageFormat:"The specified image format is null or undefined.",missingIndices:"The specified indices array is null or undefined.",missingKey:"The specified key is null or undefined.",missingLevel:"The specified level is null or undefined.",missingLine:"The specified line is null or undefined.",missingList:"The specified list is null or undefined.",missingListener:"The specified listener is null or undefined",missingLocation:"The specified location is null or undefined.",missingMatrix:"The specified matrix is null or undefined.",missingOffset:"The specified offset is null or undefined.",missingPath:"The specified path is null or undefined.",missingPlacename:"The specified place name is null or undefined.",missingPlane:"The specified plane is null or undefined.",missingPoint:"The specified point is null or undefined.",missingPoints:"The specified points array is null or undefined.",missingPosition:"The specified position is null or undefined.",missingPositions:"The specified positions array is null or undefined.",missingProgram:"The specified program is null or undefined.",missingProjection:"The specified projection is null or undefined.",missingRectangle:"The specified rectangle is null or undefined.",missingRenderable:"The specified renderable is null or undefined.",missingResolution:"The specified resolution is null, undefined, or zero.",missingResource:"The specified resource is null or undefined.",missingResult:"The specified result variable is null or undefined.",missingResults:"The specified results array is null or undefined.",missingSector:"The specified sector is null or undefined.",missingShapeType:"The specified shape type is null or undefined.",missingSize:"The specified size is null or undefined.",missingText:"The specified text is null or undefined.",missingTexture:"The specified texture is null or undefined.",missingTile:"The specified tile is null or undefined.",missingType:"The specified type is null or undefined.",missingUrl:"The specified URL is null or undefined",missingVector:"The specified vector is null or undefined.",missingVertex:"The specified vertex is null or undefined.",missingViewport:"The specified viewport is null or undefined.",missingWebCoverageService:"The specified WebCoverageService is null or undefined.",missingWorldWindow:"The specified WorldWindow is null or undefined.",notYetImplemented:"This function is not yet implemented",unsupportedVersion:"The specified version is not supported.",webglNotSupported:"The browser does not support WebGL, or WebGL is disabled."}},e=1;return t}),i("formats/aaigrid/AAIGridReader",["./AAIGridConstants","./AAIGridMetadata","../../error/ArgumentError","../../util/Logger"],function(t,e,i,r){"use strict";var n=function(t){if(!t)throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","constructor","missingDataSource"));if("string"!=typeof t&&!(t instanceof ArrayBuffer))throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","constructor","invalidDataSource"));this._values=null,this._metadata=new e;var n=this.decodeData(t);this.parse(n)};return Object.defineProperties(n.prototype,{metadata:{get:function(){return this._metadata}}}),n.prototype.getImageData=function(){return this._values},n.prototype.decodeData=function(t){if("string"!=typeof t&&!(t instanceof ArrayBuffer))throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","decodeData","invalidDataSource"));if("string"==typeof t)return t;if("function"==typeof window.TextDecoder){var e=new TextDecoder("utf-8");return e.decode(t)}for(var n="",o=new Uint8Array(t),s=65535,a=0,l=o.length;al&&(s=l-a),n+=String.fromCharCode.apply(null,o.subarray(a,a+s));return n},n.prototype.parse=function(e){if("string"!=typeof e)throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","parse","invalidDataString"));for(var n=e.replace(/\r?\n|\r/g,"\n").split("\n"),o=[],s=!0,a=0,l=n.length;a=200&&this.status<300?e(new n(this.response),o):(r.log(r.LEVEL_WARNING,"AAIGrid retrieval failed ("+o.statusText+"): "+t),e(null,o))},o.onerror=function(){r.log(r.LEVEL_WARNING,"AAIGrid retrieval failed: "+t),e(null,o)},o.ontimeout=function(){r.log(r.LEVEL_WARNING,"AAIGrid retrieval timed out: "+t),e(null,o)},o.open("GET",t,!0),o.responseType="arraybuffer",o.send(null)},n}),i("geom/Angle",[],function(){"use strict";var t={DEGREES_TO_RADIANS:Math.PI/180,RADIANS_TO_DEGREES:180/Math.PI,TWO_PI:2*Math.PI,HALF_PI:Math.PI/2,normalizedDegrees:function(t){var e=t%360;return e>180?e-360:e<-180?360+e:e},normalizedDegreesLatitude:function(t){var e=t%180;return e>90?180-e:e<-90?-180-e:e},normalizedDegreesLongitude:function(t){var e=t%360;return e>180?e-360:e<-180?360+e:e},normalizedRadians:function(t){var e=t%this.TWO_PI;return e>Math.PI?e-this.TWO_PI:e<-Math.PI?this.TWO_PI+e:e},normalizedRadiansLatitude:function(t){var e=t%Math.PI;return e>this.HALF_PI?Math.PI-e:e<-this.HALF_PI?-Math.PI-e:e},normalizedRadiansLongitude:function(t){var e=t%this.TWO_PI;return e>Math.PI?e-this.TWO_PI:e<-Math.PI?this.TWO_PI+e:e},isValidLatitude:function(t){return t>=-90&&t<=90},isValidLongitude:function(t){return t>=-180&&t<=180},toString:function(t){return t.toString()+"°"},toDecimalDegreesString:function(t){return t.toString()+"°"},toDMSString:function(t){var e,i,r,n,o;return e=t<0?-1:1,i=e*t,r=Math.floor(i),i=60*(i-r),n=Math.floor(i),i=60*(i-n),o=Math.round(i),60==o&&(n++,o=0),60==n&&(r++,n=0),(e==-1?"-":"")+r+"° "+n+"’ "+o+"”"},toDMString:function(t){var e,i,r,n,o,s;return e=t<0?-1:1,i=e*t,r=Math.floor(i),i=60*(i-r),n=Math.floor(i),i=60*(i-n),o=Math.round(i),60==o&&(n++,o=0),60==n&&(r++,n=0),s=0==o?n:n+o/60,(e==-1?"-":"")+r+"° "+s+"’"}};return t}),i("util/Color",["../util/Logger"],function(t){"use strict";var e=function(t,e,i,r){this.red=t,this.green=e,this.blue=i,this.alpha=r};return e.WHITE=new e(1,1,1,1),e.BLACK=new e(0,0,0,1),e.RED=new e(1,0,0,1),e.GREEN=new e(0,1,0,1),e.BLUE=new e(0,0,1,1),e.CYAN=new e(0,1,1,1),e.YELLOW=new e(1,1,0,1),e.MAGENTA=new e(1,0,1,1),e.LIGHT_GRAY=new e(.75,.75,.75,1),e.MEDIUM_GRAY=new e(.5,.5,.5,1),e.DARK_GRAY=new e(.25,.25,.25,1),e.TRANSPARENT=new e(0,0,0,0),e.prototype.set=function(t,e,i,r){return this.red=t,this.green=e,this.blue=i,this.alpha=r,this},e.prototype.copy=function(e){if(!e)throw new ArgumentError(t.logMessage(t.LEVEL_SEVERE,"Color","copy","missingColor"));return this.red=e.red,this.green=e.green,this.blue=e.blue,this.alpha=e.alpha,this},e.prototype.clone=function(){return new e(this.red,this.green,this.blue,this.alpha)},e.prototype.premultipliedComponents=function(t){var e=this.alpha;return t[0]=this.red*e,t[1]=this.green*e,t[2]=this.blue*e,t[3]=e,t},e.colorFromByteArray=function(t){return new e(t[0]/255,t[1]/255,t[2]/255,t[3]/255)},e.colorFromBytes=function(t,i,r,n){return new e(t/255,i/255,r/255,n/255)},e.colorFromHex=function(t){var i=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),o=parseInt(t.substring(6,8),16);return e.colorFromBytes(i,r,n,o)},e.colorFromKmlHex=function(t){var i=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),o=parseInt(t.substring(6,8),16);return e.colorFromBytes(o,n,r,i)},e.prototype.nextColor=function(){var t=Math.round(255*this.red),e=Math.round(255*this.green),i=Math.round(255*this.blue);return t<255?this.red=(t+1)/255:e<255?(this.red=0,this.green=(e+1)/255):i<255?(this.red=0,this.green=0,this.blue=(i+1)/255):(this.red=1/255,this.green=0,this.blue=0),this},e.prototype.equals=function(t){var e=Math.round(255*this.red),i=Math.round(255*this.green),r=Math.round(255*this.blue),n=Math.round(255*this.alpha),o=Math.round(255*t.red),s=Math.round(255*t.green),a=Math.round(255*t.blue),l=Math.round(255*t.alpha);return e===o&&i===s&&r===a&&n===l},e.prototype.equalsBytes=function(t){var e=Math.round(255*this.red),i=Math.round(255*this.green),r=Math.round(255*this.blue),n=Math.round(255*this.alpha);return e===t[0]&&i===t[1]&&r===t[2]&&n===t[3]},e.prototype.toByteString=function(){var t=Math.round(255*this.red),e=Math.round(255*this.green),i=Math.round(255*this.blue),r=Math.round(255*this.alpha);return"("+t+","+e+","+i+","+r+")"},e.prototype.toHexString=function(t){var e=Math.ceil(255*this.red).toString(16),i=Math.ceil(255*this.green).toString(16),r=Math.ceil(255*this.blue).toString(16),n=Math.ceil(255*this.alpha).toString(16),o="#";return o+=e.length<2?"0"+e:e,o+=i.length<2?"0"+i:i,o+=r.length<2?"0"+r:r,t&&(o+=n.length<2?"0"+n:n),o},e.prototype.toCssColorString=function(){var t=Math.round(255*this.red),e=Math.round(255*this.green),i=Math.round(255*this.blue);return"rgba("+t+", "+e+", "+i+", "+this.alpha+")"},e}),i("util/Font",["../error/ArgumentError","../util/Color","../util/Logger"],function(t,e,i){"use strict";var r=function(e,r,n,o,s,a){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Font","constructor","missingSize"));if(e<=0)throw new t(i.logMessage(i.LEVEL_SEVERE,"Font","constructor","invalidSize"));this._size=e,this.style=r||"normal",this.variant=n||"normal",this.weight=o||"normal",this.family=s||"sans-serif",this.horizontalAlignment=a||"center"};return Object.defineProperties(r.prototype,{size:{get:function(){return this._size},set:function(t){this._fontString=null,this._size=t}},style:{get:function(){return this._style},set:function(t){this._fontString=null,this._style=t}},variant:{get:function(){return this._variant},set:function(t){this._fontString=null,this._variant=t}},weight:{get:function(){return this._weight},set:function(t){this._fontString=null,this._weight=t}},family:{get:function(){return this._family},set:function(t){this._fontString=null,this._family=t}},horizontalAlignment:{get:function(){return this._horizontalAlignment},set:function(t){this._toString=null,this._horizontalAlignment=t}},fontString:{get:function(){return this._fontString||(this._fontString=this._style+" "+this.variant+" "+this._weight+" "+this._size.toString()+"px "+this._family),this._fontString}}}),r.prototype.toString=function(){return this._toString&&this._fontString||(this._toString=this.fontString+" "+this.horizontalAlignment),this._toString},r}),i("util/Insets",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i,r,n,o){if(4!==arguments.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"Insets","constructor","invalidArgumentCount"));this._top=i,this._left=r,this._bottom=n,this._right=o};return i.prototype.set=function(t,e,i,r){this._top=t,this._left=e,this._bottom=i,this._right=r},i.prototype.clone=function(){return new i(this._top,this._left,this._bottom,this._right)},i.prototype.toString=function(){return this._top+" "+this._left+" "+this._bottom+" "+this._right},Object.defineProperties(i.prototype,{top:{get:function(){return this._top},set:function(t){this._top=t}},left:{get:function(){return this._left},set:function(t){this._left=t}},bottom:{get:function(){return this._bottom},set:function(t){this._bottom=t}},right:{get:function(){return this._right},set:function(t){this._right=t}}}),i}),i("geom/Vec3",["../util/Logger","../error/ArgumentError"],function(t,e){"use strict";var i=function(t,e,i){this[0]=t,this[1]=e,this[2]=i};return i.prototype=new Float64Array(3),i.ZERO=new i(0,0,0),i.average=function(i,r){if(!i||i.length<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","average","missingArray"));if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","average","missingResult"));var n,o=i.length;r[0]=0,r[1]=0,r[2]=0;for(var s=0,a=i.length;s.999},i.computeTriangleNormal=function(r,n,o){if(!r||!n||!o)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","areColinear","missingVector"));var s=(n[1]-r[1])*(o[2]-r[2])-(n[2]-r[2])*(o[1]-r[1]),a=(n[2]-r[2])*(o[0]-r[0])-(n[0]-r[0])*(o[2]-r[2]),l=(n[0]-r[0])*(o[1]-r[1])-(n[1]-r[1])*(o[0]-r[0]),h=s*s+a*a+l*l;return 0===h?new i(s,a,l):(h=Math.sqrt(h),new i(s/h,a/h,l/h))},i.findThreeIndependentVertices=function(t,e){var r=e&&e>0?e:3;if(!t||t.length<3*r)return null;for(var n=new i(t[0],t[1],t[2]),o=null,s=null,a=r;a0&&o>0?1:0},n.prototype.clip=function(n,o){if(!n||!o)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","clip","missingPoint"));if(n.equals(o))return null;var s,a,l,h=e.fromSegment(n,o),u=this.normal.dot(h.direction);return 0===u?(s=this.dot(h.origin),0===s?[n,o]:null):(a=-this.dot(h.origin)/u,a<0||a>1?null:(l=h.pointAt(a,new r(0,0,0)),u>0?[l,o]:[n,l]))},n}),i("geom/Rectangle",["../util/Logger"],function(t){"use strict";var e=function(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r};return e.prototype.set=function(t,e,i,r){this.x=t,this.y=e,this.width=i,this.height=r},e.prototype.getMinX=function(){return this.x},e.prototype.getMinY=function(){return this.y},e.prototype.getMaxX=function(){return this.x+this.width},e.prototype.getMaxY=function(){return this.y+this.height},e.prototype.containsPoint=function(t){return t[0]>=this.x&&t[0]<=this.x+this.width&&t[1]>=this.y&&t[1]<=this.y+this.height},e.prototype.intersects=function(t){return!(t.x+t.widththis.x+this.width)&&(!(t.y+t.heightthis.y+this.height)))},e.prototype.intersectsRectangles=function(t){if(t)for(var e=0;ei?i:t},interpolate:function(t,e,i){return(1-t)*e+t*i},cbrt:function(t){return"function"==typeof Math.cbrt?Math.cbrt(t):Math.pow(t,1/3)},computeEllipsoidalGlobeIntersection:function(t,i,n,o){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeEllipsoidalGlobeIntersection","missingLine"));if(!o)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeEllipsoidalGlobeIntersection","missingResult"));var s,a=t.direction[0],l=t.direction[1],h=t.direction[2],u=t.origin[0],c=t.origin[1],d=t.origin[2],p=i/n,f=p*p,g=i*i,m=a*a+f*l*l+h*h,y=2*(u*a+f*c*l+d*h),E=u*u+f*c*c+d*d-g,v=y*y-4*m*E;return!(v<0)&&(s=(-y-Math.sqrt(v))/(2*m),o[0]=u+a*s,o[1]=c+l*s,o[2]=d+h*s,!0)},computeTriangleIntersection:function(t,i,n,o,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingLine"));if(!i||!n||!o)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingVertex"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriangleIntersection","missingResult"));var a=t.direction[0],l=t.direction[1],h=t.direction[2],u=t.origin[0],c=t.origin[1],d=t.origin[2],p=1e-5,f=n[0]-i[0],g=n[1]-i[1],m=n[2]-i[2],y=o[0]-i[0],E=o[1]-i[1],v=o[2]-i[2],_=l*v-h*E,b=h*y-a*v,w=a*E-l*y,S=f*_+g*b+m*w;if(S>-p&&S1+p)return!1;var C=R*m-x*g,A=x*f-T*m,P=T*g-R*f,O=L*(a*C+l*A+h*P);if(O<-p||M+O>1+p)return!1;var N=L*(y*C+E*A+v*P);return!(N<0)&&(s[0]=u+a*N,s[1]=c+l*N,s[2]=d+h*N,!0)},computeIndexedTrianglesIntersection:function(t,i,n,a){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingLine"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingPoints"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingIndices"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeIndexedTrianglesIntersection","missingResults"));for(var l=new o(0,0,0),h=new o(0,0,0),u=new o(0,0,0),c=new o(0,0,0),d=0,p=n.length;d0},computeTriStripIntersections:function(t,i,n,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingLine"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingPoints"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingIndices"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","computeTriStripIntersections","missingResults"));var a,l,h,u,c,d,p,f,g,m,y,E,v,_,b,w,S,L,T,R,x,M,C,A,P,O,N,I,D,k,V=t.direction[0],F=t.direction[1],G=t.direction[2],W=t.origin[0],B=t.origin[1],U=t.origin[2],K=1e-5;k=3*n[0],u=i[k++],c=i[k++],d=i[k],k=3*n[1],p=i[k++],f=i[k++],g=i[k];for(var j=2,z=n.length;j-K&&I1+K||(M=R*E-x*y,C=x*m-T*E,A=T*y-R*m,O=D*(V*M+F*C+G*A),O<-K||P+O>1+K||(N=D*(v*M+_*C+b*A),N>=0&&s.push(new o(W+V*N,B+F*N,U+G*N)))))},fabs:function(t){return t>=0?t:-t},fmod:function(t,e){return 0===e?0:t-Math.floor(t/e)*e},fract:function(t){return t-Math.floor(t)},mod:function(t,e){return(t%e+e)%e},max:function(t,e){return t>e?t:e},localCoordinateAxesAtPoint:function(t,i,n,o,s){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingVector"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingGlobe"));if(!n||!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","localCoordinateAxesAtPoint","missingResult"));var a=t[0],l=t[1],h=t[2];i.surfaceNormalAtPoint(a,l,h,s),i.northTangentAtPoint(a,l,h,o),n.set(o[0],o[1],o[2]),n.cross(s),n.normalize(),o.set(s[0],s[1],s[2]),o.cross(n),o.normalize()},horizonDistanceForGlobeRadius:function(t,i){if(t<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","horizontalDistanceForGlobeRadius","The specified globe radius is negative."));return t>0&&i>0?Math.sqrt(i*(2*t+i)):0},perspectiveNearDistanceForFarDistance:function(t,i,n){if(t<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified distance is negative."));if(i<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified resolution is negative."));if(n<1)throw new e(r.logMessage(r.LEVEL_SEVERE,"WWMath","perspectiveNearDistanceForFarDistance","The specified depth bits is negative."));var o=(1<0?1:t<0?-1:0},gudermannianInverse:function(e){return Math.log(Math.tan(Math.PI/4+e*t.DEGREES_TO_RADIANS/2))/Math.PI},epsg3857ToEpsg4326:function(e,i){var r=6378137,n=Math.PI/2-2*Math.atan(Math.exp(-i/r)),o=e/r;return[s.clamp(n*t.RADIANS_TO_DEGREES,-90,90),s.clamp(o*t.RADIANS_TO_DEGREES,-180,180)]},powerOfTwoFloor:function(t){var e=Math.floor(Math.log(t)/Math.log(2));return Math.pow(2,e)},normalizeAngle360:function(t){var e=t%360;return e>=0?e:e<0?360+e:360-e}};return s}),i("geom/Location",["../geom/Angle","../error/ArgumentError","../util/Logger","../geom/Plane","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t,e){this.latitude=t,this.longitude=e};return s.ZERO=new s(0,0),s.fromRadians=function(e,i){return new s(e*t.RADIANS_TO_DEGREES,i*t.RADIANS_TO_DEGREES)},s.prototype.copy=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","copy","missingLocation"));return this.latitude=t.latitude,this.longitude=t.longitude,this},s.prototype.set=function(t,e){return this.latitude=t,this.longitude=e,this},s.prototype.equals=function(t){return t&&t.latitude===this.latitude&&t.longitude===this.longitude},s.interpolateAlongPath=function(t,r,n,o,s){if(!n||!o)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateAlongPath","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateAlongPath","missingResult"));return t===WorldWind.GREAT_CIRCLE?this.interpolateGreatCircle(r,n,o,s):t&&t===WorldWind.RHUMB_LINE?this.interpolateRhumb(r,n,o,s):this.interpolateLinear(r,n,o,s)},s.interpolateGreatCircle=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateGreatCircle","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateGreatCircle","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.greatCircleAzimuth(r,n),h=this.greatCircleDistance(r,n);return this.greatCircleLocation(r,l,a*h,s)},s.greatCircleAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleAzimuth","missingLocation"));var o,s,a,l=r.latitude*t.DEGREES_TO_RADIANS,h=n.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n.longitude*t.DEGREES_TO_RADIANS;return l==h&&u==c?0:u==c?l>h?180:0:(s=Math.cos(h)*Math.sin(c-u),o=Math.cos(l)*Math.sin(h)-Math.sin(l)*Math.cos(h)*Math.cos(c-u),a=Math.atan2(s,o),isNaN(a)?0:a*t.RADIANS_TO_DEGREES)},s.greatCircleDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleDistance","missingLocation"));var o,s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(o=Math.sin((u-h)/2),s=Math.sin((d-c)/2),a=o*o+Math.cos(h)*Math.cos(u)*s*s,l=2*Math.asin(Math.sqrt(a)),isNaN(l)?0:l)},s.greatCircleLocation=function(r,n,o,s){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleLocation","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleLocation","missingResult"));if(0==o)return s.latitude=r.latitude,s.longitude=r.longitude,s;var a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n*t.DEGREES_TO_RADIANS;return a=Math.asin(Math.sin(h)*Math.cos(o)+Math.cos(h)*Math.sin(o)*Math.cos(c)),l=u+Math.atan2(Math.sin(o)*Math.sin(c),Math.cos(h)*Math.cos(o)-Math.sin(h)*Math.sin(o)*Math.cos(c)),isNaN(a)||isNaN(l)?(s.latitude=r.latitude,s.longitude=r.longitude):(s.latitude=t.normalizedDegreesLatitude(a*t.RADIANS_TO_DEGREES),s.longitude=t.normalizedDegreesLongitude(l*t.RADIANS_TO_DEGREES)),s},s.interpolateRhumb=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateRhumb","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateRhumb","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.rhumbAzimuth(r,n),h=this.rhumbDistance(r,n);return this.rhumbLocation(r,l,a*h,s)},s.rhumbAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbAzimuth","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=d-c,a=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(h/2+Math.PI/4)),o.fabs(s)>Math.PI&&(s=s>0?-(2*Math.PI-s):2*Math.PI+s),l=Math.atan2(s,a),isNaN(l)?0:l*t.RADIANS_TO_DEGREES)},s.rhumbDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbDistance","missingLocation"));var s,a,l,h,u,c=r.latitude*t.DEGREES_TO_RADIANS,d=n.latitude*t.DEGREES_TO_RADIANS,p=r.longitude*t.DEGREES_TO_RADIANS,f=n.longitude*t.DEGREES_TO_RADIANS;return c==d&&p==f?0:(s=d-c,a=f-p,l=Math.log(Math.tan(d/2+Math.PI/4)/Math.tan(c/2+Math.PI/4)),h=s/l,(isNaN(l)||isNaN(h))&&(h=Math.cos(c)),o.fabs(a)>Math.PI&&(a=a>0?-(2*Math.PI-a):2*Math.PI+a),u=Math.sqrt(s*s+h*h*a*a),isNaN(u)?0:u)},s.rhumbLocation=function(r,n,s,a){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbLocation","missingLocation"));if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","rhumbLocation","missingResult"));if(0==s)return a.latitude=r.latitude,a.longitude=r.longitude,a;var l,h,u=r.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n*t.DEGREES_TO_RADIANS,p=u+s*Math.cos(d),f=Math.log(Math.tan(p/2+Math.PI/4)/Math.tan(u/2+Math.PI/4)),g=(p-u)/f;return(isNaN(f)||isNaN(g)||!isFinite(g))&&(g=Math.cos(u)),l=s*Math.sin(d)/g,o.fabs(p)>Math.PI/2&&(p=p>0?Math.PI-p:-Math.PI-p),h=o.fmod(c+l+Math.PI,2*Math.PI)-Math.PI,isNaN(p)||isNaN(h)?(a.latitude=r.latitude,a.longitude=r.longitude):(a.latitude=t.normalizedDegreesLatitude(p*t.RADIANS_TO_DEGREES),a.longitude=t.normalizedDegreesLongitude(h*t.RADIANS_TO_DEGREES)),a},s.interpolateLinear=function(t,r,n,s){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateLinear","missingLocation"));if(!s)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","interpolateLinear","missingResult"));if(r.equals(n))return s.latitude=r.latitude,s.longitude=r.longitude,s;var a=o.clamp(t,0,1),l=this.linearAzimuth(r,n),h=this.linearDistance(r,n);return this.linearLocation(r,l,a*h,s)},s.linearAzimuth=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearAzimuth","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=d-c,a=u-h,o.fabs(s)>Math.PI&&(s=s>0?-(2*Math.PI-s):2*Math.PI+s),l=Math.atan2(s,a),isNaN(l)?0:l*t.RADIANS_TO_DEGREES)},s.linearDistance=function(r,n){if(!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearDistance","missingLocation"));var s,a,l,h=r.latitude*t.DEGREES_TO_RADIANS,u=n.latitude*t.DEGREES_TO_RADIANS,c=r.longitude*t.DEGREES_TO_RADIANS,d=n.longitude*t.DEGREES_TO_RADIANS;return h==u&&c==d?0:(s=u-h,a=d-c,o.fabs(a)>Math.PI&&(a=a>0?-(2*Math.PI-a):2*Math.PI+a),l=Math.sqrt(s*s+a*a),isNaN(l)?0:l)},s.linearLocation=function(r,n,s,a){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearLocation","missingLocation"));if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","linearLocation","missingResult"));if(0==s)return a.latitude=r.latitude,a.longitude=r.longitude,a;var l,h=r.latitude*t.DEGREES_TO_RADIANS,u=r.longitude*t.DEGREES_TO_RADIANS,c=n*t.DEGREES_TO_RADIANS,d=h+s*Math.cos(c);return o.fabs(d)>Math.PI/2&&(d=d>0?Math.PI-d:-Math.PI-d),l=o.fmod(u+s*Math.sin(c)+Math.PI,2*Math.PI)-Math.PI,isNaN(d)||isNaN(l)?(a.latitude=r.latitude,a.longitude=r.longitude):(a.latitude=t.normalizedDegreesLatitude(d*t.RADIANS_TO_DEGREES),a.longitude=t.normalizedDegreesLongitude(l*t.RADIANS_TO_DEGREES)),a},s.locationsCrossDateLine=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","locationsCrossDateline","missingLocation"));for(var r=null,n=0,s=t.length;n180&&l<360)return!0}r=a}return!1},s.greatCircleArcExtremeLocations=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleArcExtremeLocations","missingLocation"));for(var r=null,n=null,o=null,a=0,l=t.length;au[0].latitude)&&(r=u[0]),(null==n||n.latitude=l.latitude&&(c=l.latitude,h=l),d<=l.latitude&&(d=l.latitude,u=l);var f=s.greatCircleAzimuth(t,r),g=s.greatCircleDistance(t,r),m=s.greatCircleExtremeLocationsUsingAzimuth(t,f);for(n=0,a=m.length;n=0&&E<=g&&(c>=l.latitude&&(c=l.latitude,h=l),d<=l.latitude&&(d=l.latitude,u=l))}return[h,u]},s.greatCircleExtremeLocationsUsingAzimuth=function(r,n){if(!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Location","greatCircleArcExtremeLocationsUsingAzimuth","missingLocation"));var o=r.latitude,a=n*t.DEGREES_TO_RADIANS,l=-Math.tan(o)/Math.cos(a),h=Math.atan(l),u=h+Math.PI/2,c=h-Math.PI/2;return[s.greatCircleLocation(r,n,u,new s(0,0)),s.greatCircleLocation(r,n,c,new s(0,0))]},s.intersectionWithMeridian=function(t,e,i,o){var s=o.computePointFromLocation(t.latitude,t.longitude,new n(0,0,0)),a=o.computePointFromLocation(e.latitude,e.longitude,new n(0,0,0)),l=o.computePointFromLocation(90,i,new n(0,0,0)),h=o.computePointFromLocation(0,i,new n(0,0,0)),u=r.fromPoints(l,h,n.ZERO),c=new n(0,0,0);if(!u.intersectsSegmentAt(s,a,c))return null;var d=new WorldWind.Position(0,0,0);return o.computePositionFromPoint(c[0],c[1],c[2],d),d.latitude},s.meridianIntersection=function(t,e,i){var r=t.longitude<0?t.longitude+360:t.longitude,n=e.longitude<0?e.longitude+360:e.longitude;if(r===n)return null;var o=i<0?i+360:i,s=(e.latitude-t.latitude)/(n-r),a=t.latitude+s*(o-r);return a},s.poles={NONE:0,NORTH:1,SOUTH:2},s}),i("geom/Position",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../util/WWMath"],function(t,e,i,r,n){"use strict";var o=function(t,e,i){this.latitude=t,this.longitude=e,this.altitude=i};return o.ZERO=new o(0,0,0),o.fromRadians=function(e,i,r){return new o(e*t.RADIANS_TO_DEGREES,i*t.RADIANS_TO_DEGREES,r)},o.prototype.copy=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","copy","missingPosition"));return this.latitude=t.latitude,this.longitude=t.longitude,this.altitude=t.altitude,this},o.prototype.equals=function(t){return t&&t.latitude===this.latitude&&t.longitude===this.longitude&&t.altitude===this.altitude},o.interpolateGreatCircle=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateGreatCircle","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateGreatCircle","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateGreatCircle(l,o,s,a),a},o.interpolateRhumb=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateRhumb","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateRhumb","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateRhumb(l,o,s,a),a},o.interpolateLinear=function(t,o,s,a){if(!o||!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateLinear","missingPosition"));if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"Position","interpolateLinear","missingResult"));var l=n.clamp(t,0,1);return a.altitude=n.interpolate(l,o.altitude,s.altitude),i.interpolateLinear(l,o,s,a),a},o.prototype.toString=function(){return"("+this.latitude.toString()+"°, "+this.longitude.toString()+"°, "+this.altitude.toString()+")"},o}),i("render/Texture",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(t,e,i){"use strict";var r=function(r,n,o){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Texture","constructor","missingGlContext"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"Texture","constructor","missingImage"));o||(o=r.CLAMP_TO_EDGE);var s=r.createTexture(),a=i.isPowerOfTwo(n.width)&&i.isPowerOfTwo(n.height);this.originalImageWidth=n.width,this.originalImageHeight=n.height,o!==r.REPEAT||a||(n=this.resizeImage(n),a=!0),this.imageWidth=n.width,this.imageHeight=n.height,this.size=n.width*n.height*4,r.bindTexture(r.TEXTURE_2D,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,a?r.LINEAR_MIPMAP_LINEAR:r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,o),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),a&&r.generateMipmap(r.TEXTURE_2D),this.textureId=s,this.creationTime=new Date,this.texParameters={},this.anisotropicFilterExt=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic")};return r.prototype.setTexParameter=function(t,e){this.texParameters[t]=e},r.prototype.getTexParameter=function(t){return this.texParameters[t]},r.prototype.clearTexParameters=function(){this.texParameters={}},r.prototype.dispose=function(t){t.deleteTexture(this.textureId),delete this.textureId},r.prototype.bind=function(t){var e=t.currentGlContext;return e.bindTexture(e.TEXTURE_2D,this.textureId),this.applyTexParameters(t),t.frameStatistics.incrementTextureLoadCount(1),!0},r.prototype.applyTexParameters=function(t){var e=t.currentGlContext,i=this.texParameters[e.TEXTURE_MAG_FILTER]||e.LINEAR;e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,i),i===e.LINEAR&&this.anisotropicFilterExt&&e.texParameteri(e.TEXTURE_2D,this.anisotropicFilterExt.TEXTURE_MAX_ANISOTROPY_EXT,4)},r.prototype.resizeImage=function(t){var e=document.createElement("canvas");e.width=i.powerOfTwoFloor(t.width),e.height=i.powerOfTwoFloor(t.height);var r=e.getContext("2d");return r.drawImage(t,0,0,e.width,e.height),e},r}),i("geom/Matrix",["../geom/Angle","../error/ArgumentError","../util/Logger","../geom/Plane","../geom/Position","../geom/Rectangle","../render/Texture","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l,this[9]=h,this[10]=u,this[11]=c,this[12]=d,this[13]=p,this[14]=f,this[15]=g};return h.prototype=new Float64Array(16),h.fromIdentity=function(){return new h(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},h.principalAxesFromPoints=function(t,r,n,o){if(!t||t.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","principalAxesFromPoints","missingPoints")); +if(!r||!n||!o)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","principalAxesFromPoints","An axis argument is null or undefined."));var s=h.fromIdentity();s.setToCovarianceOfPoints(t),s.eigensystemFromSymmetricMatrix(r,n,o),r.normalize(),n.normalize(),o.normalize()},h.prototype.set=function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){return this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l,this[9]=h,this[10]=u,this[11]=c,this[12]=d,this[13]=p,this[14]=f,this[15]=g,this},h.prototype.setToIdentity=function(){this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=1,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=1,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1},h.prototype.copy=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","copy","missingMatrix"));this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15]},h.prototype.clone=function(){var t=h.fromIdentity();return t.copy(this),t},h.prototype.equals=function(t){return t&&this[0]==t[0]&&this[1]==t[1]&&this[2]==t[2]&&this[3]==t[3]&&this[4]==t[4]&&this[5]==t[5]&&this[6]==t[6]&&this[7]==t[7]&&this[8]==t[8]&&this[9]==t[9]&&this[10]==t[10]&&this[11]==t[11]&&this[12]==t[12]&&this[13]==t[13]&&this[14]==t[14]&&this[15]==t[15]},h.prototype.columnMajorComponents=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","columnMajorComponents","missingResult"));return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t},h.prototype.setToTranslation=function(t,e,i){return this[0]=1,this[1]=0,this[2]=0,this[3]=t,this[4]=0,this[5]=1,this[6]=0,this[7]=e,this[8]=0,this[9]=0,this[10]=1,this[11]=i,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.setTranslation=function(t,e,i){return this[3]=t,this[7]=e,this[11]=i,this},h.prototype.setToScale=function(t,e,i){return this[0]=t,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=e,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=i,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.setScale=function(t,e,i){return this[0]=t,this[5]=e,this[10]=i,this},h.prototype.setToTransposeOfMatrix=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToTransposeOfMatrix","missingMatrix"));return this[0]=t[0],this[1]=t[4],this[2]=t[8],this[3]=t[12],this[4]=t[1],this[5]=t[5],this[6]=t[9],this[7]=t[13],this[8]=t[2],this[9]=t[6],this[10]=t[10],this[11]=t[14],this[12]=t[3],this[13]=t[7],this[14]=t[11],this[15]=t[15],this},h.prototype.setToMultiply=function(t,r){if(!t||!r)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToMultiply","missingMatrix"));var n=t,o=r;return this[0]=n[0]*o[0]+n[1]*o[4]+n[2]*o[8]+n[3]*o[12],this[1]=n[0]*o[1]+n[1]*o[5]+n[2]*o[9]+n[3]*o[13],this[2]=n[0]*o[2]+n[1]*o[6]+n[2]*o[10]+n[3]*o[14],this[3]=n[0]*o[3]+n[1]*o[7]+n[2]*o[11]+n[3]*o[15],this[4]=n[4]*o[0]+n[5]*o[4]+n[6]*o[8]+n[7]*o[12],this[5]=n[4]*o[1]+n[5]*o[5]+n[6]*o[9]+n[7]*o[13],this[6]=n[4]*o[2]+n[5]*o[6]+n[6]*o[10]+n[7]*o[14],this[7]=n[4]*o[3]+n[5]*o[7]+n[6]*o[11]+n[7]*o[15],this[8]=n[8]*o[0]+n[9]*o[4]+n[10]*o[8]+n[11]*o[12],this[9]=n[8]*o[1]+n[9]*o[5]+n[10]*o[9]+n[11]*o[13],this[10]=n[8]*o[2]+n[9]*o[6]+n[10]*o[10]+n[11]*o[14],this[11]=n[8]*o[3]+n[9]*o[7]+n[10]*o[11]+n[11]*o[15],this[12]=n[12]*o[0]+n[13]*o[4]+n[14]*o[8]+n[15]*o[12],this[13]=n[12]*o[1]+n[13]*o[5]+n[14]*o[9]+n[15]*o[13],this[14]=n[12]*o[2]+n[13]*o[6]+n[14]*o[10]+n[15]*o[14],this[15]=n[12]*o[3]+n[13]*o[7]+n[14]*o[11]+n[15]*o[15],this},h.prototype.setToCovarianceOfPoints=function(t){if(!t||t.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","setToCovarianceOfPoints","missingArray"));var r,n,o,s,l=0,h=0,u=0,c=0,d=0,p=0,f=0,g=new a(0,0,0);r=a.averageOfBuffer(t,new a(0,0,0));for(var m=0,y=t.length/3;m=0;r-=1){for(o=i[r],n=r+1;n<4;n+=1)o-=t[r][n]*i[n];i[r]=o/t[r][r]}},h.ludcmp=function(t,e){var i,r,n,o,s,a,l,h,u=1e-20,c=[],d=1;for(r=0;r<4;r+=1){for(s=0,n=0;n<4;n+=1)(i=Math.abs(t[r][n]))>s&&(s=i);if(0==s)return 0;c[r]=1/s}for(n=0;n<4;n+=1){for(r=0;r=s&&(s=h,l=r)}if(n!=l){for(o=0;o<4;o+=1)h=t[l][o],t[l][o]=t[n][o],t[n][o]=h;d=-d,c[l]=c[n]}if(e[n]=l,0==t[n][n]&&(t[n][n]=u),3!=n)for(h=1/t[n][n],r=n+1;r<4;r+=1)t[r][n]*=h}return d},h.prototype.invertOrthonormalMatrix=function(t){if(!t)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","invertOrthonormalMatrix","missingMatrix"));var r=t;return this[0]=r[0],this[1]=r[4],this[2]=r[8],this[3]=0-r[0]*r[3]-r[4]*r[7]-r[8]*r[11],this[4]=r[1],this[5]=r[5],this[6]=r[9],this[7]=0-r[1]*r[3]-r[5]*r[7]-r[9]*r[11],this[8]=r[2],this[9]=r[6],this[10]=r[10],this[11]=0-r[2]*r[3]-r[6]*r[7]-r[10]*r[11],this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},h.prototype.eigensystemFromSymmetricMatrix=function(t,r,n){if(!t||!r||!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","eigensystemFromSymmetricMatrix","missingResult"));if(this[1]!=this[4]||this[2]!=this[8]||this[6]!=this[9])throw new e(i.logMessage(i.LEVEL_SEVERE,"Matrix","eigensystemFromSymmetricMatrix","Matrix is not symmetric"));for(var o,s,a,h,u,c,d,p,f,g,m,y=1e-10,E=this[0],v=this[1],_=this[2],b=this[5],w=this[6],S=this[10],L=[[1,0,0],[0,1,0],[0,0,1]],T=32,R=0;R1)return!1;var l=this[0]*o+this[1]*s+this[2]*a+this[3],h=this[4]*o+this[5]*s+this[6]*a+this[7],u=this[8]*o+this[9]*s+this[10]*a+this[11],c=this[12]*o+this[13]*s+this[14]*a+this[15];return 0!==c&&(n[0]=l/c,n[1]=h/c,n[2]=u/c,!0)},h}),i("pick/PickedObject",[],function(){"use strict";var t=function(t,e,i,r,n){this.color=t,this.userObject=e,this.position=i,this.parentLayer=r,this.isTerrain=n,this.isOnTop=!1};return t}),i("error/UnsupportedOperationError",["../error/AbstractError"],function(t){"use strict";var e=function(e){t.call(this,"UnsupportedOperationError",e);var i;try{throw new Error}catch(t){i=t.stack}this.stack=i};return e.prototype=Object.create(t.prototype),e}),i("render/Renderable",["../util/Logger","../error/UnsupportedOperationError"],function(t,e){"use strict";var i=function(){this.displayName="Renderable",this.enabled=!0,this.pickDelegate=null,this.userProperties={}};return i.prototype.render=function(i){throw new e(t.logMessage(t.LEVEL_SEVERE,"Renderable","render","abstractInvocation"))},i}),i("shapes/Annotation",["../shapes/AnnotationAttributes","../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Font","../util/Insets","../util/Logger","../geom/Matrix","../util/Offset","../pick/PickedObject","../render/Renderable","../shapes/TextAttributes","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f){"use strict";var g=function(i,r){if(!i)throw new e(s.logMessage(s.LEVEL_SEVERE,"Annotation","constructor","missingPosition"));u.call(this),this.position=i,this.attributes=r?r:new t(null),this.altitudeMode=WorldWind.ABSOLUTE,this.layer=null,this.lastStateKey=null,this.calloutTransform=a.fromIdentity(),this.calloutOffset=new WorldWind.Offset(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,0),this.label="",this.labelTexture=null,this.labelTransform=a.fromIdentity(),this.placePoint=new p(0,0,0),this.depthOffset=-2.05,this.calloutPoints=null};return g.matrix=a.fromIdentity(),g.screenPoint=new p(0,0,0),g.scratchPoint=new p(0,0,0),g.prototype=Object.create(u.prototype),Object.defineProperties(g.prototype,{text:{get:function(){return this.label},set:function(t){this.label=t,this.lastStateKey=null}}}),g.prototype.renderOrdered=function(t){if(this.drawOrderedAnnotation(t),t.pickingMode){var e=new h(this.pickColor.clone(),this,this.position,this.layer,!1);t.pickPoint&&this.labelBounds.containsPoint(t.convertPointToViewport(t.pickPoint,g.scratchPoint))&&(e.labelPicked=!0),t.resolvePick(e)}},g.prototype.clone=function(){var t=new g(this.position);return t.copy(this),t.pickDelegate=this.pickDelegate?this.pickDelegate:this,t},g.prototype.copy=function(t){return this.position=t.position,this.enabled=t.enabled,this.attributes=t.attributes,this.label=t.label,this.altitudeMode=t.altitudeMode,this.pickDelegate=t.pickDelegate,this.depthOffset=t.depthOffset,this},g.prototype.render=function(t){if(this.enabled&&t.accumulateOrderedRenderables&&(!t.globe.projectionLimits||t.globe.projectionLimits.containsLocation(this.position.latitude,this.position.longitude))){var e;if(this.lastFrameTime!==t.timestamp)e=this.makeOrderedRenderable(t);else{var i=this.clone();e=i.makeOrderedRenderable(t)}e&&(e.layer=t.currentLayer,this.lastFrameTime=t.timestamp,t.addOrderedRenderable(e))}},g.prototype.drawOrderedAnnotation=function(t){this.beginDrawing(t);try{this.doDrawOrderedAnnotation(t)}finally{this.endDrawing(t)}},g.prototype.makeOrderedRenderable=function(t){var e,i,r,n,o,s,a,l,h;if(this.attributes.width>0&&(this.label=t.textRenderer.wrap(this.label,this.attributes.width,this.attributes.height)),t.surfacePointForMode(this.position.latitude,this.position.longitude,this.position.altitude,this.altitudeMode,this.placePoint),this.eyeDistance=t.eyePoint.distanceTo(this.placePoint),!t.projectWithDepth(this.placePoint,this.depthOffset,g.screenPoint))return null;this.labelTexture=t.createTextTexture(this.label,this.attributes.textAttributes),e=this.labelTexture.imageWidth,i=this.labelTexture.imageHeight,r=this.attributes.scale,n=this.attributes.insets.left,o=this.attributes.insets.right,s=this.attributes.insets.top,a=this.attributes.insets.bottom,h=this.attributes.leaderGapHeight,l=this.calloutOffset.offsetForSize((e+n+o)*r,(i+s+a)*r),this.calloutTransform.setTranslation(g.screenPoint[0]-l[0],g.screenPoint[1]+h,g.screenPoint[2]),this.labelTransform.setTranslation(g.screenPoint[0]-l[0]+n*r,g.screenPoint[1]+h+a*r,g.screenPoint[2]),this.labelTransform.setScale(e*r,i*r,1),this.labelBounds=f.boundingRectForUnitQuad(this.labelTransform);var u=(e+n+o)*r,c=(i+s+a)*r,d=u/2,p=-h;return this.attributes.drawLeader||(p=0),this.attributes.stateKey!==this.lastStateKey&&(this.calloutPoints=this.createCallout(u,c,d,p,this.attributes.leaderGapWidth,this.attributes.cornerRadius)),this},g.prototype.beginDrawing=function(t){var e,r=t.currentGlContext;t.findAndBindProgram(i),e=t.currentProgram,r.enableVertexAttribArray(e.vertexPointLocation),r.enableVertexAttribArray(e.vertexTexCoordLocation),e.loadModulateColor(r,t.pickingMode)},g.prototype.endDrawing=function(t){var e=t.currentGlContext,i=t.currentProgram;e.disableVertexAttribArray(i.vertexPointLocation),e.disableVertexAttribArray(i.vertexTexCoordLocation),t.bindProgram(null)},g.prototype.drawCorner=function(t,e,i,r,n,o,s,a){if(i<1)return a;for(var l=(n-r)/(o-1),h=1;hs)for(var m=null,y=null,E=Math.ceil(g/s),v=1;v1&&(i=1),Math.acos(i)}};return i}),i("geom/Sector",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t,e,i,r){this.minLatitude=t,this.maxLatitude=e,this.minLongitude=i,this.maxLongitude=r};return s.ZERO=new s(0,0,0,0),s.FULL_SPHERE=new s(-90,90,-180,180),s.prototype.copy=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","copy","missingSector"));return this.minLatitude=t.minLatitude,this.maxLatitude=t.maxLatitude,this.minLongitude=t.minLongitude,this.maxLongitude=t.maxLongitude,this},s.prototype.isEmpty=function(){return this.minLatitude===this.maxLatitude&&this.minLongitude===this.maxLongitude},s.prototype.deltaLatitude=function(){return this.maxLatitude-this.minLatitude},s.prototype.deltaLongitude=function(){return this.maxLongitude-this.minLongitude},s.prototype.centroidLatitude=function(){return.5*(this.minLatitude+this.maxLatitude)},s.prototype.centroidLongitude=function(){return.5*(this.minLongitude+this.maxLongitude)},s.prototype.centroid=function(t){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","centroid","missingResult"));return t.latitude=this.centroidLatitude(),t.longitude=this.centroidLongitude(),t},s.prototype.minLatitudeRadians=function(){return this.minLatitude*t.DEGREES_TO_RADIANS},s.prototype.maxLatitudeRadians=function(){return this.maxLatitude*t.DEGREES_TO_RADIANS},s.prototype.minLongitudeRadians=function(){return this.minLongitude*t.DEGREES_TO_RADIANS},s.prototype.maxLongitudeRadians=function(){return this.maxLongitude*t.DEGREES_TO_RADIANS},s.prototype.setToBoundingSector=function(t){if(!t||t.length<2)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","setToBoundingSector","missingArray"));for(var i=90,n=-90,o=180,s=-180,a=0,l=t.length;aa&&(a=p);var f=d.longitude;if(f>=0&&fl&&(l=f),null!=h){var g=h.longitude;o.signum(f)!=o.signum(g)&&Math.abs(f-g)<180&&(l=0,n=0)}h=d}return i===a&&n===l?null:[new s(i,a,n,180),new s(i,a,-180,l)]},s.prototype.intersects=function(t){return t&&this.minLongitude<=t.maxLongitude&&this.maxLongitude>=t.minLongitude&&this.minLatitude<=t.maxLatitude&&this.maxLatitude>=t.minLatitude},s.prototype.overlaps=function(t){return t&&this.minLongitudet.minLongitude&&this.minLatitudet.minLatitude},s.prototype.contains=function(t){return t&&this.minLatitude<=t.minLatitude&&this.maxLatitude>=t.maxLatitude&&this.minLongitude<=t.minLongitude&&this.maxLongitude>=t.maxLongitude},s.prototype.containsLocation=function(t,e){return this.minLatitude<=t&&this.maxLatitude>=t&&this.minLongitude<=e&&this.maxLongitude>=e},s.prototype.intersection=function(t){if(!t instanceof s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","intersection","missingSector"));return this.minLatitudet.maxLatitude&&(this.maxLatitude=t.maxLatitude),this.minLongitudet.maxLongitude&&(this.maxLongitude=t.maxLongitude),this.maxLatitude0?(h.push(t.computePointFromPosition(this.minLatitude,d.longitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(this.maxLatitude,d.longitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(0,this.minLongitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(0,this.maxLongitude,l,new n(0,0,0)))):this.minLatitude<0?h.push(t.computePointFromPosition(this.maxLatitude,d.longitude,l,new n(0,0,0))):h.push(t.computePointFromPosition(this.minLatitude,d.longitude,l,new n(0,0,0))),this.deltaLongitude()>=360){var p=this.minLatitude;h.push(t.computePointFromPosition(p,0,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,90,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,-90,l,new n(0,0,0))),h.push(t.computePointFromPosition(p,180,l,new n(0,0,0)));var f=this.maxLatitude;h.push(t.computePointFromPosition(f,0,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,90,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,-90,l,new n(0,0,0))),h.push(t.computePointFromPosition(f,180,l,new n(0,0,0)))}else if(this.deltaLongitude()>180){var g=d.longitude,m=d.latitude,y=(this.minLongitude+g)/2;h.push(t.computePointFromPosition(m,y,l,new n(0,0,0))),y=(g+this.maxLongitude)/2,h.push(t.computePointFromPosition(m,y,l,new n(0,0,0))),h.push(t.computePointFromPosition(m,this.minLongitude,l,new n(0,0,0))),h.push(t.computePointFromPosition(m,this.maxLongitude,l,new n(0,0,0)))}return h},s.prototype.union=function(t){if(!t instanceof s)throw new e(r.logMessage(r.LEVEL_SEVERE,"Sector","union","missingSector"));return this.minLatitude>t.minLatitude&&(this.minLatitude=t.minLatitude),this.maxLatitudet.minLongitude&&(this.minLongitude=t.minLongitude),this.maxLongitude0?r0?(e.t-i.t)*r+(e.t-t.t)*n:0},r.geom.transLeq=function(t,e){return t.t0?r0?(e.s-i.s)*r+(e.s-t.s)*n:0},r.geom.edgeGoesLeft=function(t){return r.geom.vertLeq(t.dst(),t.org)},r.geom.edgeGoesRight=function(t){return r.geom.vertLeq(t.org,t.dst())},r.geom.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},r.geom.vertCCW=function(t,e,i){return t.s*(e.t-i.t)+e.s*(i.t-t.t)+i.s*(t.t-e.t)>=0},r.geom.interpolate_=function(t,e,i,r){return t=t<0?0:t,i=i<0?0:i,t<=i?0===i?(e+r)/2:e+(r-e)*(t/(t+i)):r+(e-r)*(i/(t+i))},r.geom.edgeIntersect=function(t,e,i,n,o){var s,a,l;r.geom.vertLeq(t,e)||(l=t,t=e,e=l),r.geom.vertLeq(i,n)||(l=i,i=n,n=l),r.geom.vertLeq(t,i)||(l=t,t=i,i=l,l=e,e=n,n=l),r.geom.vertLeq(i,e)?r.geom.vertLeq(e,n)?(s=r.geom.edgeEval(t,i,e),a=r.geom.edgeEval(i,e,n),s+a<0&&(s=-s,a=-a),o.s=r.geom.interpolate_(s,i.s,a,e.s)):(s=r.geom.edgeSign(t,i,e),a=-r.geom.edgeSign(t,n,e),s+a<0&&(s=-s,a=-a),o.s=r.geom.interpolate_(s,i.s,a,n.s)):o.s=(i.s+e.s)/2,r.geom.transLeq(t,e)||(l=t,t=e,e=l),r.geom.transLeq(i,n)||(l=i,i=n,n=l),r.geom.transLeq(t,i)||(l=t,t=i,i=l,l=e,e=n,n=l),r.geom.transLeq(i,e)?r.geom.transLeq(e,n)?(s=r.geom.transEval(t,i,e),a=r.geom.transEval(i,e,n),s+a<0&&(s=-s,a=-a),o.t=r.geom.interpolate_(s,i.t,a,e.t)):(s=r.geom.transSign(t,i,e),a=-r.geom.transSign(t,n,e),s+a<0&&(s=-s,a=-a),o.t=r.geom.interpolate_(s,i.t,a,n.t)):o.t=(i.t+e.t)/2},r.mesh={},r.mesh.makeEdge=function(t){var e=r.mesh.makeEdgePair_(t.eHead);return r.mesh.makeVertex_(e,t.vHead),r.mesh.makeVertex_(e.sym,t.vHead),r.mesh.makeFace_(e,t.fHead),e},r.mesh.meshSplice=function(t,e){var i=!1,n=!1;t!==e&&(e.org!==t.org&&(n=!0,r.mesh.killVertex_(e.org,t.org)),e.lFace!==t.lFace&&(i=!0,r.mesh.killFace_(e.lFace,t.lFace)),r.mesh.splice_(e,t),n||(r.mesh.makeVertex_(e,t.org),t.org.anEdge=t),i||(r.mesh.makeFace_(e,t.lFace),t.lFace.anEdge=t))},r.mesh.deleteEdge=function(t){var e=t.sym,i=!1;t.lFace!==t.rFace()&&(i=!0,r.mesh.killFace_(t.lFace,t.rFace())),t.oNext===t?r.mesh.killVertex_(t.org,null):(t.rFace().anEdge=t.oPrev(),t.org.anEdge=t.oNext,r.mesh.splice_(t,t.oPrev()),i||r.mesh.makeFace_(t,t.lFace)),e.oNext===e?(r.mesh.killVertex_(e.org,null),r.mesh.killFace_(e.lFace,null)):(t.lFace.anEdge=e.oPrev(),e.org.anEdge=e.oNext,r.mesh.splice_(e,e.oPrev())),r.mesh.killEdge_(t)},r.mesh.addEdgeVertex=function(t){var e=r.mesh.makeEdgePair_(t),i=e.sym;return r.mesh.splice_(e,t.lNext),e.org=t.dst(),r.mesh.makeVertex_(i,e.org),e.lFace=i.lFace=t.lFace,e},r.mesh.splitEdge=function(t){var e=r.mesh.addEdgeVertex(t),i=e.sym;return r.mesh.splice_(t.sym,t.sym.oPrev()),r.mesh.splice_(t.sym,i),t.sym.org=i.org,i.dst().anEdge=i.sym,i.sym.lFace=t.rFace(),i.winding=t.winding,i.sym.winding=t.sym.winding,i},r.mesh.connect=function(t,e){var i=!1,n=r.mesh.makeEdgePair_(t),o=n.sym;return e.lFace!==t.lFace&&(i=!0,r.mesh.killFace_(e.lFace,t.lFace)),r.mesh.splice_(n,t.lNext),r.mesh.splice_(o,e),n.org=t.dst(),o.org=e.org,n.lFace=o.lFace=t.lFace,t.lFace.anEdge=o,i||r.mesh.makeFace_(n,t.lFace),n},r.mesh.zapFace=function(t){var e,i=t.anEdge,n=i.lNext;do if(e=n,n=e.lNext,e.lFace=null,null===e.rFace()){e.oNext===e?r.mesh.killVertex_(e.org,null):(e.org.anEdge=e.oNext,r.mesh.splice_(e,e.oPrev()));var o=e.sym;o.oNext===o?r.mesh.killVertex_(o.org,null):(o.org.anEdge=o.oNext,r.mesh.splice_(o,o.oPrev())),r.mesh.killEdge_(e)}while(e!==i);var s=t.prev,a=t.next;a.prev=s,s.next=a},r.mesh.meshUnion=function(t,e){var i=t.fHead,r=t.vHead,n=t.eHead,o=e.fHead,s=e.vHead,a=e.eHead;return o.next!==o&&(i.prev.next=o.next,o.next.prev=i.prev,o.prev.next=i,i.prev=o.prev),s.next!==s&&(r.prev.next=s.next,s.next.prev=r.prev,s.prev.next=r,r.prev=s.prev),a.next!==a&&(n.sym.next.sym.next=a.next,a.next.sym.next=n.sym.next,a.sym.next.sym.next=n,n.sym.next=a.sym.next),t},r.mesh.deleteMesh=function(t){},r.mesh.makeEdgePair_=function(t){var e=new r.GluHalfEdge,i=new r.GluHalfEdge,n=t.sym.next;return i.next=n,n.sym.next=e,e.next=t,t.sym.next=i,e.sym=i,e.oNext=e,e.lNext=i,i.sym=e,i.oNext=i,i.lNext=e,e},r.mesh.splice_=function(t,e){var i=t.oNext,r=e.oNext;i.sym.lNext=e,r.sym.lNext=t,t.oNext=r,e.oNext=i},r.mesh.makeVertex_=function(t,e){var i=e.prev,n=new r.GluVertex(e,i);i.next=n,e.prev=n,n.anEdge=t;var o=t;do o.org=n,o=o.oNext;while(o!==t)},r.mesh.makeFace_=function(t,e){var i=e.prev,n=new r.GluFace(e,i);i.next=n,e.prev=n,n.anEdge=t,n.inside=e.inside;var o=t;do o.lFace=n,o=o.lNext;while(o!==t)},r.mesh.killEdge_=function(t){var e=t.next,i=t.sym.next;e.sym.next=i,i.sym.next=e},r.mesh.killVertex_=function(t,e){var i=t.anEdge,r=i;do r.org=e,r=r.oNext;while(r!==i);var n=t.prev,o=t.next;o.prev=n,n.next=o},r.mesh.killFace_=function(t,e){var i=t.anEdge,r=i;do r.lFace=e,r=r.lNext;while(r!==i);var n=t.prev,o=t.next;o.prev=n,n.next=o},r.normal={},r.normal.S_UNIT_X_=1,r.normal.S_UNIT_Y_=0,r.normal.projectPolygon=function(t){var e=!1,i=[t.normal[0],t.normal[1],t.normal[2]];0===i[0]&&0===i[1]&&0===i[2]&&(r.normal.computeNormal_(t,i),e=!0);var n=t.sUnit,o=t.tUnit,s=r.normal.longAxis_(i);if(r.TRUE_PROJECT){r.normal.normalize_(i),n[s]=0,n[(s+1)%3]=r.normal.S_UNIT_X_,n[(s+2)%3]=r.normal.S_UNIT_Y_;var a=r.normal.dot_(n,i);n[0]-=a*i[0],n[1]-=a*i[1],n[2]-=a*i[2],r.normal.normalize_(n),o[0]=i[1]*n[2]-i[2]*n[1],o[1]=i[2]*n[0]-i[0]*n[2],o[2]=i[0]*n[1]-i[1]*n[0],r.normal.normalize_(o)}else n[s]=0,n[(s+1)%3]=r.normal.S_UNIT_X_,n[(s+2)%3]=r.normal.S_UNIT_Y_,o[s]=0,o[(s+1)%3]=i[s]>0?-r.normal.S_UNIT_Y_:r.normal.S_UNIT_Y_,o[(s+2)%3]=i[s]>0?r.normal.S_UNIT_X_:-r.normal.S_UNIT_X_;for(var l=t.mesh.vHead,h=l.next;h!==l;h=h.next)h.s=r.normal.dot_(h.coords,n),h.t=r.normal.dot_(h.coords,o);e&&r.normal.checkOrientation_(t)},r.normal.dot_=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},r.normal.normalize_=function(t){var e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];e=Math.sqrt(e),t[0]/=e,t[1]/=e,t[2]/=e},r.normal.longAxis_=function(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e},r.normal.computeNormal_=function(t,e){var i,n=[-2*r.GLU_TESS_MAX_COORD,-2*r.GLU_TESS_MAX_COORD,-2*r.GLU_TESS_MAX_COORD],o=[2*r.GLU_TESS_MAX_COORD,2*r.GLU_TESS_MAX_COORD,2*r.GLU_TESS_MAX_COORD],s=[],a=[],l=t.mesh.vHead;for(i=l.next;i!==l;i=i.next)for(var h=0;h<3;++h){var u=i.coords[h];un[h]&&(n[h]=u,s[h]=i)}var c=0;if(n[1]-o[1]>n[0]-o[0]&&(c=1),n[2]-o[2]>n[c]-o[c]&&(c=2),o[c]>=n[c])return e[0]=0,e[1]=0,void(e[2]=1);var d=0,p=a[c],f=s[c],g=[0,0,0],m=[p.coords[0]-f.coords[0],p.coords[1]-f.coords[1],p.coords[2]-f.coords[2]],y=[0,0,0];for(i=l.next;i!==l;i=i.next){y[0]=i.coords[0]-f.coords[0],y[1]=i.coords[1]-f.coords[1],y[2]=i.coords[2]-f.coords[2],g[0]=m[1]*y[2]-m[2]*y[1],g[1]=m[2]*y[0]-m[0]*y[2],g[2]=m[0]*y[1]-m[1]*y[0];var E=g[0]*g[0]+g[1]*g[1]+g[2]*g[2];E>d&&(d=E,e[0]=g[0],e[1]=g[1],e[2]=g[2])}d<=0&&(e[0]=e[1]=e[2]=0,e[r.normal.longAxis_(m)]=1)},r.normal.checkOrientation_=function(t){for(var e=0,i=t.mesh.fHead,r=i.next;r!==i;r=r.next){var n=r.anEdge;if(!(n.winding<=0))do e+=(n.org.s-n.dst().s)*(n.org.t+n.dst().t),n=n.lNext;while(n!==r.anEdge)}if(e<0){for(var o=t.mesh.vHead,s=o.next;s!==o;s=s.next)s.t=-s.t;t.tUnit[0]=-t.tUnit[0],t.tUnit[1]=-t.tUnit[1],t.tUnit[2]=-t.tUnit[2]}},r.render={},r.render.renderMesh=function(t,e,i){for(var n=!1,o=-1,s=e.fHead.prev;s!==e.fHead;s=s.prev)if(s.inside){n||(t.callBeginOrBeginData(r.primitiveType.GL_TRIANGLES),n=!0);var a=s.anEdge;do{if(i){var l=a.rFace().inside?0:1;o!==l&&(o=l,t.callEdgeFlagOrEdgeFlagData(!!o))}t.callVertexOrVertexData(a.org.data),a=a.lNext}while(a!==s.anEdge)}n&&t.callEndOrEndData()},r.render.renderBoundary=function(t,e){for(var i=e.fHead.next;i!==e.fHead;i=i.next)if(i.inside){t.callBeginOrBeginData(r.primitiveType.GL_LINE_LOOP);var n=i.anEdge;do t.callVertexOrVertexData(n.org.data),n=n.lNext;while(n!==i.anEdge);t.callEndOrEndData()}},r.sweep={},r.sweep.SENTINEL_COORD_=4*r.GLU_TESS_MAX_COORD,r.sweep.TOLERANCE_NONZERO_=!1,r.sweep.computeInterior=function(t){t.fatalError=!1,r.sweep.removeDegenerateEdges_(t),r.sweep.initPriorityQ_(t),r.sweep.initEdgeDict_(t);for(var e;null!==(e=t.pq.extractMin());){for(;;){var i=t.pq.minimum();if(null===i||!r.geom.vertEq(i,e))break;i=t.pq.extractMin(),r.sweep.spliceMergeVertices_(t,e.anEdge,i.anEdge)}r.sweep.sweepEvent_(t,e)}var n=t.dict.getMin().getKey();t.event=n.eUp.org,r.sweep.doneEdgeDict_(t),r.sweep.donePriorityQ_(t),r.sweep.removeDegenerateFaces_(t.mesh),t.mesh.checkMesh()},r.sweep.addWinding_=function(t,e){t.winding+=e.winding,t.sym.winding+=e.sym.winding},r.sweep.edgeLeq_=function(t,e,i){var n=t.event,o=e.eUp,s=i.eUp;if(o.dst()===n)return s.dst()===n?r.geom.vertLeq(o.org,s.org)?r.geom.edgeSign(s.dst(),o.org,s.org)<=0:r.geom.edgeSign(o.dst(),s.org,o.org)>=0:r.geom.edgeSign(s.dst(),n,s.org)<=0;if(s.dst()===n)return r.geom.edgeSign(o.dst(),n,o.org)>=0;var a=r.geom.edgeEval(o.dst(),n,o.org),l=r.geom.edgeEval(s.dst(),n,s.org);return a>=l},r.sweep.deleteRegion_=function(t,e){e.fixUpperEdge,e.eUp.activeRegion=null,t.dict.deleteNode(e.nodeUp),e.nodeUp=null},r.sweep.fixUpperEdge_=function(t,e){r.mesh.deleteEdge(t.eUp),t.fixUpperEdge=!1,t.eUp=e,e.activeRegion=t},r.sweep.topLeftRegion_=function(t){var e=t.eUp.org;do t=t.regionAbove();while(t.eUp.org===e);if(t.fixUpperEdge){var i=r.mesh.connect(t.regionBelow().eUp.sym,t.eUp.lNext);r.sweep.fixUpperEdge_(t,i),t=t.regionAbove()}return t},r.sweep.topRightRegion_=function(t){var e=t.eUp.dst();do t=t.regionAbove();while(t.eUp.dst()===e);return t},r.sweep.addRegionBelow_=function(t,e,i){var n=new r.ActiveRegion;return n.eUp=i,n.nodeUp=t.dict.insertBefore(e.nodeUp,n),i.activeRegion=n,n},r.sweep.isWindingInside_=function(t,e){switch(t.windingRule){case r.windingRule.GLU_TESS_WINDING_ODD:return 0!==(1&e);case r.windingRule.GLU_TESS_WINDING_NONZERO:return 0!==e;case r.windingRule.GLU_TESS_WINDING_POSITIVE:return e>0;case r.windingRule.GLU_TESS_WINDING_NEGATIVE:return e<0;case r.windingRule.GLU_TESS_WINDING_ABS_GEQ_TWO:return e>=2||e<=-2}return!1},r.sweep.computeWinding_=function(t,e){e.windingNumber=e.regionAbove().windingNumber+e.eUp.winding,e.inside=r.sweep.isWindingInside_(t,e.windingNumber)},r.sweep.finishRegion_=function(t,e){var i=e.eUp,n=i.lFace;n.inside=e.inside,n.anEdge=i,r.sweep.deleteRegion_(t,e)},r.sweep.finishLeftRegions_=function(t,e,i){for(var n=e,o=e.eUp;n!==i;){n.fixUpperEdge=!1;var s=n.regionBelow(),a=s.eUp;if(a.org!==o.org){if(!s.fixUpperEdge){r.sweep.finishRegion_(t,n);break}a=r.mesh.connect(o.lPrev(),a.sym),r.sweep.fixUpperEdge_(s,a)}o.oNext!==a&&(r.mesh.meshSplice(a.oPrev(),a),r.mesh.meshSplice(o,a)),r.sweep.finishRegion_(t,n),o=s.eUp,n=s}return o},r.sweep.addRightEdges_=function(t,e,i,n,o,s){var a=!0,l=i;do r.sweep.addRegionBelow_(t,e,l.sym),l=l.oNext;while(l!==n);null===o&&(o=e.regionBelow().eUp.rPrev());for(var h,u=e,c=o;h=u.regionBelow(),l=h.eUp.sym,l.org===c.org;)l.oNext!==c&&(r.mesh.meshSplice(l.oPrev(),l),r.mesh.meshSplice(c.oPrev(),l)),h.windingNumber=u.windingNumber-l.winding,h.inside=r.sweep.isWindingInside_(t,h.windingNumber),u.dirty=!0,!a&&r.sweep.checkForRightSplice_(t,u)&&(r.sweep.addWinding_(l,c),r.sweep.deleteRegion_(t,u),r.mesh.deleteEdge(c)),a=!1,u=h,c=l;u.dirty=!0,s&&r.sweep.walkDirtyRegions_(t,u)},r.sweep.callCombine_=function(t,e,i,n,o){var s=[e.coords[0],e.coords[1],e.coords[2]];e.data=null,e.data=t.callCombineOrCombineData(s,i,n),null===e.data&&(o?t.fatalError||(t.callErrorOrErrorData(r.errorType.GLU_TESS_NEED_COMBINE_CALLBACK),t.fatalError=!0):e.data=i[0])},r.sweep.spliceMergeVertices_=function(t,e,i){var n=[null,null,null,null],o=[.5,.5,0,0];n[0]=e.org.data,n[1]=i.org.data,r.sweep.callCombine_(t,e.org,n,o,!1),r.mesh.meshSplice(e,i)},r.sweep.vertexWeights_=function(t,e,i,n,o){var s=r.geom.vertL1dist(e,t),a=r.geom.vertL1dist(i,t),l=o,h=o+1;n[l]=.5*a/(s+a),n[h]=.5*s/(s+a),t.coords[0]+=n[l]*e.coords[0]+n[h]*i.coords[0],t.coords[1]+=n[l]*e.coords[1]+n[h]*i.coords[1],t.coords[2]+=n[l]*e.coords[2]+n[h]*i.coords[2]},r.sweep.getIntersectData_=function(t,e,i,n,o,s){var a=[0,0,0,0],l=[i.data,n.data,o.data,s.data];e.coords[0]=e.coords[1]=e.coords[2]=0,r.sweep.vertexWeights_(e,i,n,a,0),r.sweep.vertexWeights_(e,o,s,a,2),r.sweep.callCombine_(t,e,l,a,!0)},r.sweep.checkForRightSplice_=function(t,e){var i=e.regionBelow(),n=e.eUp,o=i.eUp;if(r.geom.vertLeq(n.org,o.org)){if(r.geom.edgeSign(o.dst(),n.org,o.org)>0)return!1;r.geom.vertEq(n.org,o.org)?n.org!==o.org&&(t.pq.remove(n.org.pqHandle),r.sweep.spliceMergeVertices_(t,o.oPrev(),n)):(r.mesh.splitEdge(o.sym),r.mesh.meshSplice(n,o.oPrev()),e.dirty=i.dirty=!0)}else{if(r.geom.edgeSign(n.dst(),o.org,n.org)<0)return!1;e.regionAbove().dirty=e.dirty=!0,r.mesh.splitEdge(n.sym),r.mesh.meshSplice(o.oPrev(),n)}return!0},r.sweep.checkForLeftSplice_=function(t,e){var i,n=e.regionBelow(),o=e.eUp,s=n.eUp;if(r.geom.vertLeq(o.dst(),s.dst())){if(r.geom.edgeSign(o.dst(),s.dst(),o.org)<0)return!1;e.regionAbove().dirty=e.dirty=!0,i=r.mesh.splitEdge(o),r.mesh.meshSplice(s.sym,i),i.lFace.inside=e.inside}else{if(r.geom.edgeSign(s.dst(),o.dst(),s.org)>0)return!1;e.dirty=n.dirty=!0,i=r.mesh.splitEdge(s),r.mesh.meshSplice(o.lNext,s.sym),i.rFace().inside=e.inside}return!0},r.sweep.checkForIntersect_=function(t,e){var i=e.regionBelow(),n=e.eUp,o=i.eUp,s=n.org,a=o.org,l=n.dst(),h=o.dst(),u=new r.GluVertex;if(s===a)return!1;var c=Math.min(s.t,l.t),d=Math.max(a.t,h.t);if(c>d)return!1;if(r.geom.vertLeq(s,a)){if(r.geom.edgeSign(h,s,a)>0)return!1}else if(r.geom.edgeSign(l,a,s)<0)return!1;r.geom.edgeIntersect(l,s,h,a,u),r.geom.vertLeq(u,t.event)&&(u.s=t.event.s,u.t=t.event.t);var p=r.geom.vertLeq(s,a)?s:a;if(r.geom.vertLeq(p,u)&&(u.s=p.s,u.t=p.t),r.geom.vertEq(u,s)||r.geom.vertEq(u,a))return r.sweep.checkForRightSplice_(t,e),!1;if(!r.geom.vertEq(l,t.event)&&r.geom.edgeSign(l,t.event,u)>=0||!r.geom.vertEq(h,t.event)&&r.geom.edgeSign(h,t.event,u)<=0){if(h===t.event)return r.mesh.splitEdge(n.sym),r.mesh.meshSplice(o.sym,n),e=r.sweep.topLeftRegion_(e),n=e.regionBelow().eUp,r.sweep.finishLeftRegions_(t,e.regionBelow(),i),r.sweep.addRightEdges_(t,e,n.oPrev(),n,n,!0),!0;if(l===t.event){r.mesh.splitEdge(o.sym),r.mesh.meshSplice(n.lNext,o.oPrev()),i=e,e=r.sweep.topRightRegion_(e);var f=e.regionBelow().eUp.rPrev();return i.eUp=o.oPrev(),o=r.sweep.finishLeftRegions_(t,i,null),r.sweep.addRightEdges_(t,e,o.oNext,n.rPrev(),f,!0),!0}return r.geom.edgeSign(l,t.event,u)>=0&&(e.regionAbove().dirty=e.dirty=!0,r.mesh.splitEdge(n.sym),n.org.s=t.event.s,n.org.t=t.event.t),r.geom.edgeSign(h,t.event,u)<=0&&(e.dirty=i.dirty=!0,r.mesh.splitEdge(o.sym),o.org.s=t.event.s,o.org.t=t.event.t),!1}return r.mesh.splitEdge(n.sym),r.mesh.splitEdge(o.sym),r.mesh.meshSplice(o.oPrev(),n),n.org.s=u.s,n.org.t=u.t,n.org.pqHandle=t.pq.insert(n.org),r.sweep.getIntersectData_(t,n.org,s,l,a,h),e.regionAbove().dirty=e.dirty=i.dirty=!0,!1},r.sweep.walkDirtyRegions_=function(t,e){for(var i=e.regionBelow();;){for(;i.dirty;)e=i,i=i.regionBelow();if(!e.dirty&&(i=e,e=e.regionAbove(),null===e||!e.dirty))return;e.dirty=!1;var n=e.eUp,o=i.eUp;if(n.dst()!==o.dst()&&r.sweep.checkForLeftSplice_(t,e)&&(i.fixUpperEdge?(r.sweep.deleteRegion_(t,i),r.mesh.deleteEdge(o),i=e.regionBelow(),o=i.eUp):e.fixUpperEdge&&(r.sweep.deleteRegion_(t,e),r.mesh.deleteEdge(n),e=i.regionAbove(),n=e.eUp)),n.org!==o.org)if(n.dst()===o.dst()||e.fixUpperEdge||i.fixUpperEdge||n.dst()!==t.event&&o.dst()!==t.event)r.sweep.checkForRightSplice_(t,e);else if(r.sweep.checkForIntersect_(t,e))return;n.org===o.org&&n.dst()===o.dst()&&(r.sweep.addWinding_(o,n),r.sweep.deleteRegion_(t,e),r.mesh.deleteEdge(n),e=i.regionAbove())}},r.sweep.connectRightVertex_=function(t,e,i){var n=i.oNext,o=e.regionBelow(),s=e.eUp,a=o.eUp,l=!1;if(s.dst()!==a.dst()&&r.sweep.checkForIntersect_(t,e),r.geom.vertEq(s.org,t.event)&&(r.mesh.meshSplice(n.oPrev(),s),e=r.sweep.topLeftRegion_(e),n=e.regionBelow().eUp,r.sweep.finishLeftRegions_(t,e.regionBelow(),o),l=!0),r.geom.vertEq(a.org,t.event)&&(r.mesh.meshSplice(i,a.oPrev()),i=r.sweep.finishLeftRegions_(t,o,null),l=!0),l)return void r.sweep.addRightEdges_(t,e,i.oNext,n,n,!0);var h;h=r.geom.vertLeq(a.org,s.org)?a.oPrev():s,h=r.mesh.connect(i.lPrev(),h),r.sweep.addRightEdges_(t,e,h,h.oNext,h.oNext,!1),h.sym.activeRegion.fixUpperEdge=!0,r.sweep.walkDirtyRegions_(t,e)},r.sweep.connectLeftDegenerate_=function(t,e,i){var n=e.eUp;if(r.geom.vertEq(n.org,i))return void(r.sweep.TOLERANCE_NONZERO_&&r.sweep.spliceMergeVertices_(t,n,i.anEdge));if(!r.geom.vertEq(n.dst(),i))return r.mesh.splitEdge(n.sym),e.fixUpperEdge&&(r.mesh.deleteEdge(n.oNext),e.fixUpperEdge=!1),r.mesh.meshSplice(i.anEdge,n),void r.sweep.sweepEvent_(t,i);if(r.sweep.TOLERANCE_NONZERO_){e=r.sweep.topRightRegion_(e);var o=e.regionBelow(),s=o.eUp.sym,a=s.oNext,l=a;o.fixUpperEdge&&(r.sweep.deleteRegion_(t,o),r.mesh.deleteEdge(s),s=a.oPrev()),r.mesh.meshSplice(i.anEdge,s),r.geom.edgeGoesLeft(a)||(a=null),r.sweep.addRightEdges_(t,e,s.oNext,l,a,!0)}},r.sweep.connectLeftVertex_=function(t,e){var i=new r.ActiveRegion;i.eUp=e.anEdge.sym;var n=t.dict.search(i).getKey(),o=n.regionBelow(),s=n.eUp,a=o.eUp;if(0===r.geom.edgeSign(s.dst(),e,s.org))return void r.sweep.connectLeftDegenerate_(t,n,e);var l,h=r.geom.vertLeq(a.dst(),s.dst())?n:o;if(n.inside||h.fixUpperEdge){if(h===n)l=r.mesh.connect(e.anEdge.sym,s.lNext);else{var u=r.mesh.connect(a.dNext(),e.anEdge);l=u.sym}h.fixUpperEdge?r.sweep.fixUpperEdge_(h,l):r.sweep.computeWinding_(t,r.sweep.addRegionBelow_(t,n,l)),r.sweep.sweepEvent_(t,e)}else r.sweep.addRightEdges_(t,n,e.anEdge,e.anEdge,null,!0)},r.sweep.sweepEvent_=function(t,e){t.event=e;for(var i=e.anEdge;null===i.activeRegion;)if(i=i.oNext,i===e.anEdge)return void r.sweep.connectLeftVertex_(t,e);var n=r.sweep.topLeftRegion_(i.activeRegion),o=n.regionBelow(),s=o.eUp,a=r.sweep.finishLeftRegions_(t,o,null);a.oNext===s?r.sweep.connectRightVertex_(t,n,a):r.sweep.addRightEdges_(t,n,a.oNext,s,s,!0)},r.sweep.addSentinel_=function(t,e){var i=new r.ActiveRegion,n=r.mesh.makeEdge(t.mesh);n.org.s=r.sweep.SENTINEL_COORD_,n.org.t=e,n.dst().s=-r.sweep.SENTINEL_COORD_,n.dst().t=e,t.event=n.dst(),i.eUp=n,i.windingNumber=0,i.inside=!1,i.fixUpperEdge=!1,i.sentinel=!0,i.dirty=!1,i.nodeUp=t.dict.insert(i)},r.sweep.initEdgeDict_=function(t){t.dict=new r.Dict(t,r.sweep.edgeLeq_),r.sweep.addSentinel_(t,-r.sweep.SENTINEL_COORD_),r.sweep.addSentinel_(t,r.sweep.SENTINEL_COORD_)},r.sweep.doneEdgeDict_=function(t){for(var e;null!==(e=t.dict.getMin().getKey());)!e.sentinel,r.sweep.deleteRegion_(t,e);t.dict=null},r.sweep.removeDegenerateEdges_=function(t){for(var e,i=t.mesh.eHead,n=i.next;n!==i;n=e){e=n.next;var o=n.lNext;r.geom.vertEq(n.org,n.dst())&&n.lNext.lNext!==n&&(r.sweep.spliceMergeVertices_(t,o,n),r.mesh.deleteEdge(n),n=o,o=n.lNext),o.lNext===n&&(o!==n&&(o!==e&&o!==e.sym||(e=e.next),r.mesh.deleteEdge(o)),n!==e&&n!==e.sym||(e=e.next),r.mesh.deleteEdge(n))}},r.sweep.initPriorityQ_=function(t){var e=new r.PriorityQ(r.geom.vertLeq);t.pq=e;var i,n=t.mesh.vHead;for(i=n.next;i!==n;i=i.next)i.pqHandle=e.insert(i);e.init()},r.sweep.donePriorityQ_=function(t){t.pq.deleteQ(),t.pq=null},r.sweep.removeDegenerateFaces_=function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e){e=i.next;var n=i.anEdge;n.lNext.lNext===n&&(r.sweep.addWinding_(n.oNext,n),r.mesh.deleteEdge(n))}},r.tessmono={},r.tessmono.tessellateMonoRegion_=function(t){for(var e=t.anEdge;r.geom.vertLeq(e.dst(),e.org);e=e.lPrev());for(;r.geom.vertLeq(e.org,e.dst());e=e.lNext);for(var i,n=e.lPrev();e.lNext!==n;)if(r.geom.vertLeq(e.dst(),n.org)){for(;n.lNext!==e&&(r.geom.edgeGoesLeft(n.lNext)||r.geom.edgeSign(n.org,n.dst(),n.lNext.dst())<=0);)i=r.mesh.connect(n.lNext,n),n=i.sym;n=n.lPrev()}else{for(;n.lNext!==e&&(r.geom.edgeGoesRight(e.lPrev())||r.geom.edgeSign(e.dst(),e.org,e.lPrev().org)>=0);)i=r.mesh.connect(e,e.lPrev()),e=i.sym;e=e.lNext}for(;n.lNext.lNext!==e;)i=r.mesh.connect(n.lNext,n),n=i.sym},r.tessmono.tessellateInterior=function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e)e=i.next,i.inside&&r.tessmono.tessellateMonoRegion_(i)},r.tessmono.discardExterior=function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e)e=i.next,i.inside||r.mesh.zapFace(i)},r.tessmono.setWindingNumber=function(t,e,i){for(var n,o=t.eHead.next;o!==t.eHead;o=n)n=o.next,o.rFace().inside!==o.lFace.inside?o.winding=o.lFace.inside?e:-e:i?r.mesh.deleteEdge(o):o.winding=0},r.Dict=function(t,e){this.head_=new r.DictNode,this.frame_=t,this.leq_=e},r.Dict.prototype.deleteDict_=function(){},r.Dict.prototype.insertBefore=function(t,e){do t=t.prev;while(null!==t.key&&!this.leq_(this.frame_,t.key,e));var i=new r.DictNode(e,t.next,t);return t.next.prev=i,t.next=i,i},r.Dict.prototype.insert=function(t){return this.insertBefore(this.head_,t)},r.Dict.prototype.deleteNode=function(t){t.next.prev=t.prev,t.prev.next=t.next},r.Dict.prototype.search=function(t){var e=this.head_;do e=e.next;while(null!==e.key&&!this.leq_(this.frame_,t,e.key));return e},r.Dict.prototype.getMin=function(){return this.head_.next},r.Dict.prototype.getMax=function(){return this.head_.prev},r.DictNode=function(t,e,i){this.key=t||null,this.next=e||this,this.prev=i||this},r.DictNode.prototype.getKey=function(){return this.key},r.DictNode.prototype.getSuccessor=function(){return this.next},r.DictNode.prototype.getPredecessor=function(){return this.prev},r.CachedVertex=function(){this.coords=[0,0,0],this.data=null},r.GluTesselator=function(){this.state=r.GluTesselator.tessState_.T_DORMANT,this.lastEdge_=null,this.mesh=null,this.callError_=null,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.relTolerance=r.GLU_TESS_DEFAULT_TOLERANCE,this.windingRule=r.windingRule.GLU_TESS_WINDING_ODD,this.fatalError=!1,this.dict=null,this.pq=null,this.event=null,this.callCombine_=null,this.boundaryOnly=!1,this.callBegin_=null,this.callEdgeFlag_=null,this.callVertex_=null,this.callEnd_=null,this.callMesh_=null,this.callBeginData_=null,this.callEdgeFlagData_=null,this.callVertexData_=null,this.callEndData_=null,this.callErrorData_=null,this.callCombineData_=null,this.polygonData_=null,this.emptyCache=!1,this.cacheCount=0,this.cache=new Array(r.TESS_MAX_CACHE);for(var t=0;t1)break;return void(this.relTolerance=e);case r.gluEnum.GLU_TESS_WINDING_RULE:var i=e;switch(i){case r.windingRule.GLU_TESS_WINDING_ODD:case r.windingRule.GLU_TESS_WINDING_NONZERO:case r.windingRule.GLU_TESS_WINDING_POSITIVE:case r.windingRule.GLU_TESS_WINDING_NEGATIVE:case r.windingRule.GLU_TESS_WINDING_ABS_GEQ_TWO:return void(this.windingRule=i)}break;case r.gluEnum.GLU_TESS_BOUNDARY_ONLY:return void(this.boundaryOnly=!!e);default:return void this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_ENUM)}this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_VALUE)},r.GluTesselator.prototype.gluGetTessProperty=function(t){switch(t){case r.gluEnum.GLU_TESS_TOLERANCE:return this.relTolerance;case r.gluEnum.GLU_TESS_WINDING_RULE:var e=this.windingRule;return e;case r.gluEnum.GLU_TESS_BOUNDARY_ONLY:return this.boundaryOnly;default:this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_ENUM)}return!1},r.GluTesselator.prototype.gluTessNormal=function(t,e,i){this.normal[0]=t,this.normal[1]=e,this.normal[2]=i},r.GluTesselator.prototype.gluTessCallback=function(t,e){var i=e?e:null;switch(t){case r.gluEnum.GLU_TESS_BEGIN:return void(this.callBegin_=i);case r.gluEnum.GLU_TESS_BEGIN_DATA:return void(this.callBeginData_=i);case r.gluEnum.GLU_TESS_EDGE_FLAG:return void(this.callEdgeFlag_=i);case r.gluEnum.GLU_TESS_EDGE_FLAG_DATA:return void(this.callEdgeFlagData_=i);case r.gluEnum.GLU_TESS_VERTEX:return void(this.callVertex_=i);case r.gluEnum.GLU_TESS_VERTEX_DATA:return void(this.callVertexData_=i);case r.gluEnum.GLU_TESS_END:return void(this.callEnd_=i);case r.gluEnum.GLU_TESS_END_DATA:return void(this.callEndData_=i);case r.gluEnum.GLU_TESS_ERROR:return void(this.callError_=i);case r.gluEnum.GLU_TESS_ERROR_DATA:return void(this.callErrorData_=i);case r.gluEnum.GLU_TESS_COMBINE:return void(this.callCombine_=i);case r.gluEnum.GLU_TESS_COMBINE_DATA:return void(this.callCombineData_=i);case r.gluEnum.GLU_TESS_MESH:return void(this.callMesh_=i);default:return void this.callErrorOrErrorData(r.gluEnum.GLU_INVALID_ENUM)}},r.GluTesselator.prototype.gluTessVertex=function(t,e){var i=!1,n=[0,0,0];this.requireState_(r.GluTesselator.tessState_.T_IN_CONTOUR),this.emptyCache&&(this.emptyCache_(),this.lastEdge_=null);for(var o=0;o<3;++o){var s=t[o];s<-r.GLU_TESS_MAX_COORD&&(s=-r.GLU_TESS_MAX_COORD,i=!0),s>r.GLU_TESS_MAX_COORD&&(s=r.GLU_TESS_MAX_COORD,i=!0),n[o]=s}if(i&&this.callErrorOrErrorData(r.errorType.GLU_TESS_COORD_TOO_LARGE),null===this.mesh){if(this.cacheCount0&&(this.emptyCache=!0)},r.GluTesselator.prototype.gluTessEndContour=function(){this.requireState_(r.GluTesselator.tessState_.T_IN_CONTOUR),this.state=r.GluTesselator.tessState_.T_IN_POLYGON},r.GluTesselator.prototype.gluTessEndPolygon=function(){if(this.requireState_(r.GluTesselator.tessState_.T_IN_POLYGON),this.state=r.GluTesselator.tessState_.T_DORMANT,null===this.mesh&&this.emptyCache_(),r.normal.projectPolygon(this),r.sweep.computeInterior(this),!this.fatalError){var t=this.mesh;if(this.boundaryOnly?r.tessmono.setWindingNumber(t,1,!0):r.tessmono.tessellateInterior(t),this.mesh.checkMesh(),this.callBegin_||this.callEnd_||this.callVertex_||this.callEdgeFlag_||this.callBeginData_||this.callEndData_||this.callVertexData_||this.callEdgeFlagData_)if(this.boundaryOnly)r.render.renderBoundary(this,this.mesh);else{var e=!(!this.callEdgeFlag_&&!this.callEdgeFlagData_);r.render.renderMesh(this,this.mesh,e)}if(this.callMesh_)return r.tessmono.discardExterior(this.mesh),this.callMesh_(this.mesh),this.mesh=null,void(this.polygonData_=null)}r.mesh.deleteMesh(this.mesh),this.polygonData_=null,this.mesh=null},r.GluTesselator.prototype.makeDormant_=function(){this.mesh&&r.mesh.deleteMesh(this.mesh),this.state=r.GluTesselator.tessState_.T_DORMANT,this.lastEdge_=null,this.mesh=null},r.GluTesselator.prototype.requireState_=function(t){this.state!==t&&this.gotoState_(t)},r.GluTesselator.prototype.gotoState_=function(t){for(;this.state!==t;)if(this.state=this.max_&&(this.max_*=2,this.keys_=r.PriorityQ.prototype.PQKeyRealloc_(this.keys_,this.max_)),this.keys_[e]=t,-(e+1)},r.PriorityQ.prototype.PQKeyRealloc_=function(t,e){var i=new Array(e),r=0;if(null!==t)for(;r0&&null===this.keys_[this.order_[this.size_-1]]);return t},r.PriorityQ.prototype.minimum=function(){if(0===this.size_)return this.heap_.minimum();var t=this.keys_[this.order_[this.size_-1]];if(!this.heap_.isEmpty()){var e=this.heap_.minimum();if(this.leq_(e,t))return e}return t},r.PriorityQ.prototype.isEmpty_=function(){return 0===this.size_&&this.heap_.isEmpty()},r.PriorityQ.prototype.remove=function(t){if(t>=0)return void this.heap_.remove(t);for(t=-(t+1),this.keys_[t]=null;this.size_>0&&null===this.keys_[this.order_[this.size_-1]];)--this.size_},r.PriorityQHeap=function(t){this.nodes_=r.PQNode.realloc(null,r.PriorityQHeap.INIT_SIZE_+1),this.handles_=r.PQHandleElem.realloc(null,r.PriorityQHeap.INIT_SIZE_+1),this.size_=0,this.max_=r.PriorityQHeap.INIT_SIZE_,this.freeList_=0,this.initialized_=!1,this.leq_=t,this.nodes_[1].handle=1},r.PriorityQHeap.INIT_SIZE_=32,r.PriorityQHeap.prototype.deleteHeap=function(){this.handles_=null,this.nodes_=null},r.PriorityQHeap.prototype.init=function(){for(var t=this.size_;t>=1;--t)this.floatDown_(t);this.initialized_=!0},r.PriorityQHeap.prototype.insert=function(t){var e=++this.size_;2*e>this.max_&&(this.max_*=2,this.nodes_=r.PQNode.realloc(this.nodes_,this.max_+1),this.handles_=r.PQHandleElem.realloc(this.handles_,this.max_+1));var i;return 0===this.freeList_?i=e:(i=this.freeList_,this.freeList_=this.handles_[i].node),this.nodes_[e].handle=i,this.handles_[i].node=e,this.handles_[i].key=t,this.initialized_&&this.floatUp_(e),i},r.PriorityQHeap.prototype.isEmpty=function(){return 0===this.size_},r.PriorityQHeap.prototype.minimum=function(){return this.handles_[this.nodes_[1].handle].key},r.PriorityQHeap.prototype.extractMin=function(){var t=this.nodes_,e=this.handles_,i=t[1].handle,r=e[i].key;return this.size_>0&&(t[1].handle=t[this.size_].handle,e[t[1].handle].node=1,e[i].key=null,e[i].node=this.freeList_,this.freeList_=i,--this.size_>0&&this.floatDown_(1)),r},r.PriorityQHeap.prototype.remove=function(t){var e=this.nodes_,i=this.handles_,r=i[t].node;e[r].handle=e[this.size_].handle,i[e[r].handle].node=r,r<=--this.size_&&(r<=1||this.leq_(i[e[r>>1].handle].key,i[e[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),i[t].key=null,i[t].node=this.freeList_,this.freeList_=t},r.PriorityQHeap.prototype.floatDown_=function(t){for(var e=this.nodes_,i=this.handles_,r=e[t].handle;;){var n=t<<1;nthis.size_||this.leq_(i[r].key,i[o].key)){e[t].handle=r,i[r].node=t;break}e[t].handle=o,i[o].node=t,t=n}},r.PriorityQHeap.prototype.floatUp_=function(t){for(var e=this.nodes_,i=this.handles_,r=e[t].handle;;){var n=t>>1,o=e[n].handle;if(0===n||this.leq_(i[o].key,i[r].key)){e[t].handle=r,i[r].node=t;break}e[t].handle=o,i[o].node=t,t=n}},r.ActiveRegion=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},r.ActiveRegion.prototype.regionBelow=function(){return this.nodeUp.getPredecessor().getKey()},r.ActiveRegion.prototype.regionAbove=function(){return this.nodeUp.getSuccessor().getKey()},"undefined"!=typeof module&&(module.exports=r),i("util/libtess",function(){}),i("util/measure/AreaMeasurer",["../../geom/Angle","../../error/ArgumentError","../../geom/Location","../Logger","./MeasurerUtils","../../geom/Sector","../../geom/Vec3","../libtess"],function(t,e,i,n,o,s,a,l){"use strict";var h=function(t){if(!t)throw new e(n.logMessage(n.LEVEL_SEVERE,"AreaMeasurer","constructor","missingWorldWindow"));this.wwd=t,this.DEFAULT_AREA_SAMPLING_STEPS=32,this._areaTerrainSamplingSteps=this.DEFAULT_AREA_SAMPLING_STEPS,this._maxSegmentLength=1e5,this.subdividedPositions=null,this.vecZ=new a(0,0,1),this.scratchLocation=new i(0,0)};return Object.defineProperties(h.prototype,{areaTerrainSamplingSteps:{get:function(){return this._areaTerrainSamplingSteps},set:function(t){this._areaTerrainSamplingSteps=t}},maxSegmentLength:{get:function(){return this._maxSegmentLength},set:function(t){this._maxSegmentLength=t}}}),h.prototype.getArea=function(t,e,i){var r=this.wwd.globe;return e?this.computeSurfaceAreaSampling(r,t,i):this.computeProjectedAreaGeometry(r,t,i)},h.prototype.computeSurfaceAreaSampling=function(e,i,r){var n=new s(0,0,0,0);n.setToBoundingSector(i),this.subdividedPositions=o.subdividePositions(e,i,!0,r,this._maxSegmentLength);for(var l=Math.max(this.DEFAULT_AREA_SAMPLING_STEPS,this._areaTerrainSamplingSteps),h=n.deltaLatitude()*t.DEGREES_TO_RADIANS,u=n.deltaLongitude()*t.DEGREES_TO_RADIANS,c=Math.max(h/l,u/l),d=Math.round(h/c),p=Math.round(u/c*Math.cos(n.centroidLatitude()*t.DEGREES_TO_RADIANS)),f=h/d,g=u/p,m=0,y=0;ythis.tryAgainInterval?(delete this.possiblyAbsent[t],!1):ithis.maxTrys},t.prototype.markResourceAbsent=function(t){var e=this.possiblyAbsent[t];e||(e={timeOfLastMark:Date.now(),numTrys:0},this.possiblyAbsent[t]=e),e.numTrys=e.numTrys+1,e.timeOfLastMark=Date.now()},t.prototype.markResourceAbsentPermanently=function(t){var e=this.possiblyAbsent[t];e||(e={timeOfLastMark:Date.now(),numTrys:0},this.possiblyAbsent[t]=e),e.numTrys=e.numTrys+1,e.timeOfLastMark=Date.now(),e.permanent=!0},t.prototype.unmarkResourceAbsent=function(t){var e=this.possiblyAbsent[t];e&&delete this.possiblyAbsent[t]},t}),i("globe/ElevationCoverage",["../error/ArgumentError","../util/Logger","../geom/Sector"],function(t,e,i){"use strict";var r=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationCoverage","constructor","missingResolution"));this.timestamp=Date.now(),this.displayName="Coverage",this._enabled=!0,this.resolution=r,this.coverageSector=i.FULL_SPHERE};return Object.defineProperties(r.prototype,{enabled:{get:function(){return this._enabled},set:function(t){this._enabled=t,this.timestamp=Date.now()}}}),r.prototype.minAndMaxElevationsForSector=function(i,r){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationCoverage","minAndMaxElevationsForSector","missingSector"));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationCoverage","minAndMaxElevationsForSector","missingResult"));return r[0]>0&&(r[0]=0),r[1]<0&&(r[1]=0),!0},r.prototype.elevationAtLocation=function(t,e){return 0},r.prototype.elevationsForGrid=function(i,r,n,o){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationCoverage","elevationsForGrid","missingSector"));if(r<=0||n<=0)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationCoverage","elevationsForGrid","numLat or numLon is less than 1"));if(!o||o.length=this.imageWidth?0:e<0||e>=this.imageHeight?0:(e=this.imageHeight-e-1,this.imageData[t+e*this.imageWidth])},r.prototype.elevationAtLocation=function(t,e){var n=this.sector.maxLatitude,o=this.sector.minLongitude,s=this.sector.deltaLatitude(),a=this.sector.deltaLongitude(),l=(this.imageWidth-1)*(e-o)/a,h=(this.imageHeight-1)*(n-t)/s,u=Math.floor(i.clamp(l,0,this.imageWidth-1)),c=Math.floor(i.clamp(u+1,0,this.imageWidth-1)),d=Math.floor(i.clamp(h,0,this.imageHeight-1)),p=Math.floor(i.clamp(d+1,0,this.imageHeight-1)),f=this.imageData,g=f[u+d*this.imageWidth],m=f[c+d*this.imageWidth],y=f[u+p*this.imageWidth],E=f[c+p*this.imageWidth],v=l-u,_=h-d;return r.isNoData(g,m,y,E)?NaN:(1-v)*(1-_)*g+v*(1-_)*m+(1-v)*_*y+v*_*E},r.prototype.elevationsForGrid=function(n,o,s,a){if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","missingSector"));if(o<1||s<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","The specified number of sample points is less than 1."));if(!a)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","missingResult"));var l,h,u,c,d=this.sector.minLatitude,p=this.sector.maxLatitude,f=this.sector.minLongitude,g=this.sector.maxLongitude,m=p-d,y=g-f,E=n.minLatitude,v=n.maxLatitude,_=n.minLongitude,b=n.maxLongitude,S=(v-E)/(o>1?o-1:1),w=(b-_)/(s>1?s-1:1),L=0,T=this.imageData;for(c=0,l=E;c=d&&l<=p){var R=(this.imageHeight-1)*(p-l)/m,x=Math.floor(i.clamp(R,0,this.imageHeight-1)),M=Math.floor(i.clamp(x+1,0,this.imageHeight-1)),C=R-x;for(u=0,h=_;u=f&&h<=g&&isNaN(a[L])){var A=(this.imageWidth-1)*(h-f)/y,P=Math.floor(i.clamp(A,0,this.imageWidth-1)),N=Math.floor(i.clamp(P+1,0,this.imageWidth-1)),O=A-P,I=T[P+x*this.imageWidth],D=T[N+x*this.imageWidth],k=T[P+M*this.imageWidth],V=T[N+M*this.imageWidth];r.isNoData(I,D,k,V)?a[L]=NaN:a[L]=(1-O)*(1-C)*I+O*(1-C)*D+(1-O)*C*k+O*C*V}L++}}else L+=s},r.prototype.minAndMaxElevationsForSector=function(t){if(!this.hasData)return null;var e=[];if(t)if(t.contains(this.sector))e[0]>this.minElevation&&(e[0]=this.minElevation),e[1]_&&(m=_),y<_&&(y=_)}e[0]>m&&(e[0]=m),e[1]0){this.minElevation=Number.MAX_VALUE,this.maxElevation=-Number.MAX_VALUE;for(var t=this.imageData,e=this.imageWidth*this.imageHeight,i=0;in&&(this.minElevation=n),this.maxElevation>>8:i.getUint32(r,o)>>>8;if(n<=4)return s?i.getInt32(r,o):i.getUint32(r,o);if(n<=8)return i.getFloat64(r,o);throw new t(e.logMessage(e.LEVEL_SEVERE,"GeoTiffReader","getBytes","tooManyBytesRequested"))},getSampleBytes:function(t,r,n,o,s){var a;switch(o){case i.SampleFormat.UNSIGNED:a=this.getBytes(t,r,n,s,!1);break;case i.SampleFormat.SIGNED:a=this.getBytes(t,r,n,s,!0);break;case i.SampleFormat.IEEE_FLOAT:3==n?a=t.getFloat32(r,s)>>>8:4==n?a=t.getFloat32(r,s):8==n?a=t.getFloat64(r,s):e.log(e.LEVEL_WARNING,"Do not attempt to parse the data not handled: "+n);break;case i.SampleFormat.UNDEFINED:default:a=this.getBytes(t,r,n,s,!1)}return a},getRGBAFillValue:function(t,e,i,r){return"undefined"==typeof r&&(r=1),"rgba("+t+", "+e+", "+i+", "+r+")"},clampColorSample:function(t,e){var i=Math.pow(2,8-e);return Math.floor(t*i+(i-1))}};return r}),i("util/proj4-src",[],function(){"use strict";function t(t,e){if(t[e])return t[e];for(var i,r,n=Object.keys(t),o=e.toLowerCase().replace(Be,""),s=-1;++s0?90:-90),t.lat_ts=t.lat1)}function l(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?l[t]=Ue(arguments[1]):l[t]=ei(arguments[1]):l[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){Array.isArray(t)?l.apply(e,t):l(t)});if("string"==typeof t){if(t in l)return l[t]}else"EPSG"in t?l["EPSG:"+t.EPSG]=t:"ESRI"in t?l["ESRI:"+t.ESRI]=t:"IAU2000"in t?l["IAU2000:"+t.IAU2000]=t:console.log(t);return}}function h(t){return"string"==typeof t}function u(t){return t in l}function c(t){return ii.some(function(e){return t.indexOf(e)>-1})}function d(t){return"+"===t[0]}function p(t){ -return h(t)?u(t)?l[t]:c(t)?ei(t):d(t)?Ue(t):void 0:t}function f(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=ni(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function g(t){var e=t.x,i=t.y;if(i*De>90&&i*De<-90&&e*De>180&&e*De<-180)return null;var r,n;if(Math.abs(Math.abs(i)-Ce)<=Oe)return null;if(this.sphere)r=this.x0+this.a*this.k0*si(e-this.long0),n=this.y0+this.a*this.k0*Math.log(Math.tan(ke+.5*i));else{var o=Math.sin(i),s=ai(this.e,i,o);r=this.x0+this.a*this.k0*si(e-this.long0),n=this.y0-this.a*this.k0*Math.log(s)}return t.x=r,t.y=n,t}function m(t){var e,i,r=t.x-this.x0,n=t.y-this.y0;if(this.sphere)i=Ce-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var o=Math.exp(-n/(this.a*this.k0));if(i=li(this.e,o),i===-9999)return null}return e=si(this.long0+r/(this.a*this.k0)),t.x=e,t.y=i,t}function y(){}function E(t){return t}function v(t,e){var i=gi.length;return t.names?(gi[i]=t,t.names.forEach(function(t){fi[t.toLowerCase()]=i}),this):(console.log(e),!0)}function _(t){if(!t)return!1;var e=t.toLowerCase();return"undefined"!=typeof fi[e]&&gi[fi[e]]?gi[fi[e]]:void 0}function b(){pi.forEach(v)}function S(t,e,i,r){var n=t*t,o=e*e,s=(n-o)/n,a=0;r?(t*=1-s*(Ae+s*(Pe+s*Ne)),n=t*t,s=0):a=Math.sqrt(s);var l=(n-o)/o;return{es:s,e:a,ep2:l}}function w(e,i,r,n,o){if(!e){var s=t(yi,n);s||(s=Ei),e=s.a,i=s.b,r=s.rf}return r&&!i&&(i=(1-1/r)*e),(0===r||Math.abs(e-i)3&&(0===s.datum_params[3]&&0===s.datum_params[4]&&0===s.datum_params[5]&&0===s.datum_params[6]||(s.datum_type=Te,s.datum_params[3]*=Me,s.datum_params[4]*=Me,s.datum_params[5]*=Me,s.datum_params[6]=s.datum_params[6]/1e6+1))),s.a=i,s.b=r,s.es=n,s.ep2=o,s}function T(e,i){if(!(this instanceof T))return new T(e);i=i||function(t){if(t)throw t};var r=p(e);if("object"!=typeof r)return void i(e);var n=T.projections.get(r.projName);if(!n)return void i(e);if(r.datumCode&&"none"!==r.datumCode){var o=t(vi,r.datumCode);o&&(r.datum_params=o.towgs84?o.towgs84.split(","):null,r.ellps=o.ellipse,r.datumName=o.datumName?o.datumName:r.datumCode)}r.k0=r.k0||1,r.axis=r.axis||"enu",r.ellps=r.ellps||"wgs84";var s=w(r.a,r.b,r.rf,r.ellps,r.sphere),a=S(s.a,s.b,s.rf,r.R_A),l=r.datum||L(r.datumCode,r.datum_params,s.a,s.b,a.es,a.ep2);ri(this,r),ri(this,n),this.a=s.a,this.b=s.b,this.rf=s.rf,this.sphere=s.sphere,this.es=a.es,this.e=a.e,this.ep2=a.ep2,this.datum=l,this.init(),i(null,this)}function R(t,e){return t.datum_type===e.datum_type&&(!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(t.datum_type===Le?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type!==Te||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6]))}function x(t,e,i){var r,n,o,s,a=t.x,l=t.y,h=t.z?t.z:0;if(l<-Ce&&l>-1.001*Ce)l=-Ce;else if(l>Ce&&l<1.001*Ce)l=Ce;else if(l<-Ce||l>Ce)return null;return a>Math.PI&&(a-=2*Math.PI),n=Math.sin(l),s=Math.cos(l),o=n*n,r=i/Math.sqrt(1-e*o),{x:(r+h)*s*Math.cos(a),y:(r+h)*s*Math.sin(a),z:(r*(1-e)+h)*n}}function M(t,e,i,r){var n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_=1e-12,b=_*_,S=30,w=t.x,L=t.y,T=t.z?t.z:0;if(n=Math.sqrt(w*w+L*L),o=Math.sqrt(w*w+L*L+T*T),n/i<_){if(y=0,o/i<_)return E=Ce,v=-r,{x:t.x,y:t.y,z:t.z}}else y=Math.atan2(L,w);s=T/o,a=n/o,l=1/Math.sqrt(1-e*(2-e)*a*a),c=a*(1-e)*l,d=s*l,m=0;do m++,u=i/Math.sqrt(1-e*d*d),v=n*c+T*d-u*(1-e*d*d),h=e*u/(u+v),l=1/Math.sqrt(1-h*(2-h)*a*a),p=a*(1-h)*l,f=s*l,g=f*c-p*d,c=p,d=f;while(g*g>b&&m=56&&u<64&&c>=3&&c<12&&(h=32),u>=72&&u<84&&(c>=0&&c<9?h=31:c>=9&&c<21?h=33:c>=21&&c<33?h=35:c>=33&&c<42&&(h=37)),e=6*(h-1)-180+3,l=W(e),i=p/(1-p),r=d/Math.sqrt(1-p*Math.sin(g)*Math.sin(g)),n=Math.tan(g)*Math.tan(g),o=i*Math.cos(g)*Math.cos(g),s=Math.cos(g)*(m-l),a=d*((1-p/4-3*p*p/64-5*p*p*p/256)*g-(3*p/8+3*p*p/32+45*p*p*p/1024)*Math.sin(2*g)+(15*p*p/256+45*p*p*p/1024)*Math.sin(4*g)-35*p*p*p/3072*Math.sin(6*g));var y=f*r*(s+(1-n+o)*s*s*s/6+(5-18*n+n*n+72*o-58*i)*s*s*s*s*s/120)+5e5,E=f*(a+r*Math.tan(g)*(s*s/2+(5-n+9*o+4*o*o)*s*s*s*s/24+(61-58*n+n*n+600*o-330*i)*s*s*s*s*s*s/720));return u<0&&(E+=1e7),{northing:Math.round(E),easting:Math.round(y),zoneNumber:h,zoneLetter:j(u)}}function K(t){var e=t.northing,i=t.easting,r=t.zoneLetter,n=t.zoneNumber;if(n<0||n>60)return null;var o,s,a,l,h,u,c,d,p,f,g=.9996,m=6378137,y=.00669438,E=(1-Math.sqrt(1-y))/(1+Math.sqrt(1-y)),v=i-5e5,_=e;r<"N"&&(_-=1e7),d=6*(n-1)-180+3,o=y/(1-y),c=_/g,p=c/(m*(1-y/4-3*y*y/64-5*y*y*y/256)),f=p+(3*E/2-27*E*E*E/32)*Math.sin(2*p)+(21*E*E/16-55*E*E*E*E/32)*Math.sin(4*p)+151*E*E*E/96*Math.sin(6*p),s=m/Math.sqrt(1-y*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),l=o*Math.cos(f)*Math.cos(f),h=m*(1-y)/Math.pow(1-y*Math.sin(f)*Math.sin(f),1.5),u=v/(s*g);var b=f-s*Math.tan(f)/h*(u*u/2-(5+3*a+10*l-4*l*l-9*o)*u*u*u*u/24+(61+90*a+298*l+45*a*a-252*o-3*l*l)*u*u*u*u*u*u/720);b=B(b);var S=(u-(1+2*a+l)*u*u*u/6+(5-2*l+28*a-3*l*l+8*o+24*a*a)*u*u*u*u*u/120)/Math.cos(f);S=d+B(S);var w;if(t.accuracy){var L=K({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});w={top:L.lat,right:L.lon,bottom:b,left:S}}else w={lat:b,lon:S};return w}function j(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function z(t,e){var i="00000"+t.easting,r="00000"+t.northing;return t.zoneNumber+t.zoneLetter+H(t.easting,t.northing,t.zoneNumber)+i.substr(i.length-5,e)+r.substr(r.length-5,e)}function H(t,e,i){var r=q(i),n=Math.floor(t/1e5),o=Math.floor(e/1e5)%20;return Y(n,o,r)}function q(t){var e=t%Li;return 0===e&&(e=Li),e}function Y(t,e,i){var r=i-1,n=Ti.charCodeAt(r),o=Ri.charCodeAt(r),s=n+t-1,a=o+e,l=!1;s>Pi&&(s=s-Pi+xi-1,l=!0),(s===Mi||nMi||(s>Mi||nCi||(s>Ci||nPi&&(s=s-Pi+xi-1),a>Ai?(a=a-Ai+xi-1,l=!0):l=!1,(a===Mi||oMi||(a>Mi||oCi||(a>Ci||oAi&&(a=a-Ai+xi-1);var h=String.fromCharCode(s)+String.fromCharCode(a);return h}function X(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,r=null,n="",o=0;!/[A-Z]/.test(e=t.charAt(o));){if(o>=2)throw"MGRSPoint bad conversion from: "+t;n+=e,o++}var s=parseInt(n,10);if(0===o||o+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(o++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;r=t.substring(o,o+=2);for(var l=q(s),h=J(r.charAt(0),l),u=Z(r.charAt(1),l);u0&&(d=1e5/Math.pow(10,y),p=t.substring(o,o+y),E=parseFloat(p)*d,f=t.substring(o+y),v=parseFloat(f)*d),g=E+h,m=v+u,{easting:g,northing:m,zoneLetter:a,zoneNumber:s,accuracy:d}}function J(t,e){for(var i=Ti.charCodeAt(e-1),r=1e5,n=!1;i!==t.charCodeAt(0);){if(i++,i===Mi&&i++,i===Ci&&i++,i>Pi){if(n)throw"Bad character: "+t;i=xi,n=!0}r+=1e5}return r}function Z(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=Ri.charCodeAt(e-1),r=0,n=!1;i!==t.charCodeAt(0);){if(i++,i===Mi&&i++,i===Ci&&i++,i>Ai){if(n)throw"Bad character: "+t;i=xi,n=!0}r+=1e5}return r}function Q(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function $(t,e,i){if(!(this instanceof $))return new $(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&"undefined"==typeof e){var r=t.split(",");this.x=parseFloat(r[0],10),this.y=parseFloat(r[1],10),this.z=parseFloat(r[2],10)||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}function tt(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=Hi(this.es),this.ml0=qi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function et(t){var e,i,r,n=t.x,o=t.y,s=si(n-this.long0),a=Math.sin(o),l=Math.cos(o);if(this.es){var h=l*s,u=Math.pow(h,2),c=this.ep2*Math.pow(l,2),d=Math.pow(c,2),p=Math.abs(l)>Oe?Math.tan(o):0,f=Math.pow(p,2),g=Math.pow(f,2);e=1-this.es*Math.pow(a,2),h/=Math.sqrt(e);var m=qi(o,a,l,this.en);i=this.a*(this.k0*h*(1+u/6*(1-f+c+u/20*(5-18*f+g+14*c-58*f*c+u/42*(61+179*g-g*f-479*f)))))+this.x0,r=this.a*(this.k0*(m-this.ml0+a*s*h/2*(1+u/12*(5-f+9*c+4*d+u/30*(61+g-58*f+270*c-330*f*c+u/56*(1385+543*g-g*f-3111*f))))))+this.y0}else{var y=l*Math.sin(s);if(Math.abs(Math.abs(y)-1)=1){if(y-1>Oe)return 93;r=0}else r=Math.acos(r);o<0&&(r=-r),r=this.a*this.k0*(r-this.lat0)+this.y0}return t.x=i,t.y=r,t}function it(t){var e,i,r,n,o=(t.x-this.x0)*(1/this.a),s=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+s/this.k0,i=Xi(e,this.es,this.en),Math.abs(i)Oe?Math.tan(i):0,u=this.ep2*Math.pow(l,2),c=Math.pow(u,2),d=Math.pow(h,2),p=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var f=o*Math.sqrt(e)/this.k0,g=Math.pow(f,2);e*=h,r=i-e*g/(1-this.es)*.5*(1-g/12*(5+3*d-9*u*d+u-4*c-g/30*(61+90*d-252*u*d+45*p+46*u-g/56*(1385+3633*d+4095*p+1574*p*d)))),n=si(this.long0+f*(1-g/6*(1+2*d+u-g/20*(5+28*d+24*p+8*u*d+6*u-g/42*(61+662*d+1320*p+720*p*d))))/l)}else r=Ce*oi(s),n=0;else{var m=Math.exp(o/this.k0),y=.5*(m-1/m),E=this.lat0+s/this.k0,v=Math.cos(E);e=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(y,2))),r=Math.asin(e),s<0&&(r=-r),n=0===y&&0===v?0:si(Math.atan2(y,v)+this.long0)}return t.x=n,t.y=r,t}function rt(){if(void 0===this.es||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),i*=e,this.cgb[1]=i*(7/3+e*(-1.6+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(-2.4+e*(-24832/14175))),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(.25+i*(1/64+i/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(-.6+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*-.03233083094085698,this.gtu[5]=.6650675310896665*i;var r=ir(this.cbg,this.lat0);this.Zb=-this.Qn*(r+rr(this.gtu,2*r))}function nt(t){var e=si(t.x-this.long0),i=t.y;i=ir(this.cbg,i);var r=Math.sin(i),n=Math.cos(i),o=Math.sin(e),s=Math.cos(e);i=Math.atan2(r,s*n),e=Math.atan2(o*n,$i(r,n*s)),e=er(Math.tan(e));var a=or(this.gtu,2*i,2*e);i+=a[0],e+=a[1];var l,h;return Math.abs(e)<=2.623395162778?(l=this.a*(this.Qn*e)+this.x0,h=this.a*(this.Qn*i+this.Zb)+this.y0):(l=1/0,h=1/0),t.x=l,t.y=h,t}function ot(t){var e=(t.x-this.x0)*(1/this.a),i=(t.y-this.y0)*(1/this.a);i=(i-this.Zb)/this.Qn,e/=this.Qn;var r,n;if(Math.abs(e)<=2.623395162778){var o=or(this.utg,2*i,2*e);i+=o[0],e+=o[1],e=Math.atan(Qi(e));var s=Math.sin(i),a=Math.cos(i),l=Math.sin(e),h=Math.cos(e);i=Math.atan2(s*h,$i(l,h*a)),e=Math.atan2(l,h*a),r=si(e+this.long0),n=ir(this.cgb,i)}else r=1/0,n=1/0;return t.x=r,t.y=n,t}function st(){var t=lr(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*Ie,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,ar.init.apply(this),this.forward=ar.forward,this.inverse=ar.inverse}function at(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+ke)/(Math.pow(Math.tan(.5*this.lat0+ke),this.C)*dr(this.e*t,this.ratexp))}function lt(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+ke),this.C)*dr(this.e*Math.sin(i),this.ratexp))-Ce,t.x=this.C*e,t}function ht(t){for(var e=1e-14,i=t.x/this.C,r=t.y,n=Math.pow(Math.tan(.5*r+ke)/this.K,1/this.C),o=pr;o>0&&(r=2*Math.atan(n*dr(this.e*Math.sin(t.y),-.5*this.e))-Ce,!(Math.abs(r-t.y)0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Oe&&(this.k0=.5*this.cons*ni(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/ai(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=ni(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-Ce,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function gt(t){var e,i,r,n,o,s,a=t.x,l=t.y,h=Math.sin(l),u=Math.cos(l),c=si(a-this.long0);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=Oe&&Math.abs(l+this.lat0)<=Oe?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*h+this.coslat0*u*Math.cos(c)),t.x=this.a*e*u*Math.sin(c)+this.x0,t.y=this.a*e*(this.coslat0*h-this.sinlat0*u*Math.cos(c))+this.y0,t):(i=2*Math.atan(this.ssfn_(l,h,this.e))-Ce,n=Math.cos(i),r=Math.sin(i),Math.abs(this.coslat0)<=Oe?(o=ai(this.e,l*this.con,this.con*h),s=2*this.a*this.k0*o/this.cons,t.x=this.x0+s*Math.sin(a-this.long0),t.y=this.y0-this.con*s*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)0?this.long0+Math.atan2(t.x,-1*t.y):this.long0+Math.atan2(t.x,t.y):this.long0+Math.atan2(t.x*Math.sin(a),s*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a))),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=Oe){if(s<=Oe)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,r=s*this.cons/(2*this.a*this.k0),i=this.con*li(this.e,r),e=this.con*si(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else n=2*Math.atan(s*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,s<=Oe?o=this.X0:(o=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/s),e=si(this.long0+Math.atan2(t.x*Math.sin(n),s*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)))),i=-1*li(this.e,Math.tan(.5*(Ce+o)));return t.x=e,t.y=i,t}function yt(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,r=this.rf,n=1/r,o=2*n-Math.pow(n,2),s=this.e=Math.sqrt(o);this.R=this.k0*i*Math.sqrt(1-o)/(1-o*Math.pow(e,2)),this.alpha=Math.sqrt(1+o/(1-o)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+s*e)/(1-s*e));this.K=a-this.alpha*l+this.alpha*s/2*h}function Et(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),r=-this.alpha*(e+i)+this.K,n=2*(Math.atan(Math.exp(r))-Math.PI/4),o=this.alpha*(t.x-this.lambda0),s=Math.atan(Math.sin(o)/(Math.sin(this.b0)*Math.tan(n)+Math.cos(this.b0)*Math.cos(o))),a=Math.asin(Math.cos(this.b0)*Math.sin(n)-Math.sin(this.b0)*Math.cos(n)*Math.cos(o));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*s+this.x0,t}function vt(t){for(var e=t.x-this.x0,i=t.y-this.y0,r=e/this.R,n=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),o=Math.asin(Math.cos(this.b0)*Math.sin(n)+Math.sin(this.b0)*Math.cos(n)*Math.cos(r)),s=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(n))),a=this.lambda0+s/this.alpha,l=0,h=o,u=-1e3,c=0;Math.abs(h-u)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+o/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=a,t.y=h,t}function _t(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var t=Math.sin(this.lat0),e=Math.cos(this.lat0),i=this.e*t;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(e,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-i*i);var r=ai(this.e,this.lat0,t),n=this.bl/e*Math.sqrt((1-this.es)/(1-i*i));n*n<1&&(n=1);var o,s;if(isNaN(this.longc)){var a=ai(this.e,this.lat1,Math.sin(this.lat1)),l=ai(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(n+Math.sqrt(n*n-1))*Math.pow(r,this.bl):this.el=(n-Math.sqrt(n*n-1))*Math.pow(r,this.bl);var h=Math.pow(a,this.bl),u=Math.pow(l,this.bl);o=this.el/h,s=.5*(o-1/o);var c=(this.el*this.el-u*h)/(this.el*this.el+u*h),d=(u-h)/(u+h),p=si(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(c*Math.tan(.5*this.bl*p)/d)/this.bl,this.long0=si(this.long0);var f=si(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*f)/s),this.alpha=Math.asin(n*Math.sin(this.gamma0))}else o=this.lat0>=0?n+Math.sqrt(n*n-1):n-Math.sqrt(n*n-1),this.el=o*Math.pow(r,this.bl),s=.5*(o-1/o),this.gamma0=Math.asin(Math.sin(this.alpha)/n),this.long0=this.longc-Math.asin(s*Math.tan(this.gamma0))/this.bl;this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(n*n-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(n*n-1),Math.cos(this.alpha))}function bt(t){var e,i,r,n=t.x,o=t.y,s=si(n-this.long0);if(Math.abs(Math.abs(o)-Ce)<=Oe)r=o>0?-1:1,i=this.al/this.bl*Math.log(Math.tan(ke+r*this.gamma0*.5)),e=-1*r*Ce*this.al/this.bl;else{var a=ai(this.e,o,Math.sin(o)),l=this.el/Math.pow(a,this.bl),h=.5*(l-1/l),u=.5*(l+1/l),c=Math.sin(this.bl*s),d=(h*Math.sin(this.gamma0)-c*Math.cos(this.gamma0))/u;i=Math.abs(Math.abs(d)-1)<=Oe?Number.POSITIVE_INFINITY:.5*this.al*Math.log((1-d)/(1+d))/this.bl,e=Math.abs(Math.cos(this.bl*s))<=Oe?this.al*this.bl*s:this.al*Math.atan2(h*Math.cos(this.gamma0)+c*Math.sin(this.gamma0),Math.cos(this.bl*s))/this.bl}return this.no_rot?(t.x=this.x0+e,t.y=this.y0+i):(e-=this.uc,t.x=this.x0+i*Math.cos(this.alpha)+e*Math.sin(this.alpha),t.y=this.y0+e*Math.cos(this.alpha)-i*Math.sin(this.alpha)),t}function St(t){var e,i;this.no_rot?(i=t.y-this.y0,e=t.x-this.x0):(i=(t.x-this.x0)*Math.cos(this.alpha)-(t.y-this.y0)*Math.sin(this.alpha),e=(t.y-this.y0)*Math.cos(this.alpha)+(t.x-this.x0)*Math.sin(this.alpha),e+=this.uc);var r=Math.exp(-1*this.bl*i/this.al),n=.5*(r-1/r),o=.5*(r+1/r),s=Math.sin(this.bl*e/this.al),a=(s*Math.cos(this.gamma0)+n*Math.sin(this.gamma0))/o,l=Math.pow(this.el/Math.sqrt((1+a)/(1-a)),1/this.bl);return Math.abs(a-1)Oe?this.ns=Math.log(r/a)/Math.log(n/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=r/(this.ns*Math.pow(n,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Lt(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=Oe&&(i=oi(i)*(Ce-2*Oe));var r,n,o=Math.abs(Math.abs(i)-Ce);if(o>Oe)r=ai(this.e,i,Math.sin(i)),n=this.a*this.f0*Math.pow(r,this.ns);else{if(o=i*this.ns,o<=0)return null;n=0}var s=this.ns*si(e-this.long0);return t.x=this.k0*(n*Math.sin(s))+this.x0,t.y=this.k0*(this.rh-n*Math.cos(s))+this.y0,t}function Tt(t){var e,i,r,n,o,s=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(s*s+a*a),i=1):(e=-Math.sqrt(s*s+a*a),i=-1);var l=0;if(0!==e&&(l=Math.atan2(i*s,i*a)),0!==e||this.ns>0){if(i=1/this.ns,r=Math.pow(e/(this.a*this.f0),i),n=li(this.e,r),n===-9999)return null}else n=-Ce;return o=si(l/this.ns+this.long0),t.x=o,t.y=n,t}function Rt(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function xt(t){var e,i,r,n,o,s,a,l=t.x,h=t.y,u=si(l-this.long0);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),r=-u*this.alfa,n=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(r)),o=Math.asin(Math.cos(i)*Math.sin(r)/Math.cos(n)),s=this.n*o,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(n/2+this.s45),this.n),t.y=a*Math.cos(s)/1,t.x=a*Math.sin(s)/1,this.czech||(t.y*=-1,t.x*=-1),t}function Mt(t){var e,i,r,n,o,s,a,l,h=t.x;t.x=t.y,t.y=h,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),o=Math.atan2(t.y,t.x),n=o/Math.sin(this.s0),r=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(n)),i=Math.asin(Math.cos(r)*Math.sin(n)/Math.cos(e)),t.x=this.long0-i/this.alfa,a=e,l=0;var u=0;do t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-t.y)<1e-10&&(l=1),a=t.y,u+=1;while(0===l&&u<15);return u>=15?null:t}function Ct(){this.sphere||(this.e0=Cr(this.es),this.e1=Ar(this.es),this.e2=Pr(this.es),this.e3=Nr(this.es),this.ml0=this.a*Mr(this.e0,this.e1,this.e2,this.e3,this.lat0))}function At(t){var e,i,r=t.x,n=t.y;if(r=si(r-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(n)*Math.sin(r)),i=this.a*(Math.atan2(Math.tan(n),Math.cos(r))-this.lat0);else{var o=Math.sin(n),s=Math.cos(n),a=Or(this.a,this.e,o),l=Math.tan(n)*Math.tan(n),h=r*Math.cos(n),u=h*h,c=this.es*s*s/(1-this.es),d=this.a*Mr(this.e0,this.e1,this.e2,this.e3,n);e=a*h*(1-u*l*(1/6-(8-l+8*c)*u/120)),i=d-this.ml0+a*o/s*u*(.5+(5-l+6*c)*u/24)}return t.x=e+this.x0,t.y=i+this.y0,t}function Pt(t){t.x-=this.x0,t.y-=this.y0;var e,i,r=t.x/this.a,n=t.y/this.a;if(this.sphere){var o=n+this.lat0;e=Math.asin(Math.sin(o)*Math.cos(r)),i=Math.atan2(Math.tan(r),Math.cos(o))}else{var s=this.ml0/this.a+n,a=Dr(s,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-Ce)<=Oe)return t.x=this.long0,t.y=Ce,n<0&&(t.y*=-1),t;var l=Or(this.a,this.e,Math.sin(a)),h=l*l*l/this.a/this.a*(1-this.es),u=Math.pow(Math.tan(a),2),c=r*this.a/l,d=c*c;e=a-l*Math.tan(a)/h*c*c*(.5-(1+3*u)*c*c/24),i=c*(1-d*(u/3+(1+3*u)*u*d/15))/Math.cos(a)}return t.x=si(i+this.long0),t.y=Ir(e),t}function Nt(){var t=Math.abs(this.lat0);if(Math.abs(t-Ce)0){var e;switch(this.qp=Fr(this.e,1),this.mmf=.5/(1-this.es),this.apa=Dt(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=Fr(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Ot(t){var e,i,r,n,o,s,a,l,h,u,c=t.x,d=t.y;if(c=si(c-this.long0),this.sphere){if(o=Math.sin(d),u=Math.cos(d),r=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(i=this.mode===this.EQUIT?1+u*r:1+this.sinph0*o+this.cosph0*u*r,i<=Oe)return null;i=Math.sqrt(2/i),e=i*u*Math.sin(c),i*=this.mode===this.EQUIT?o:this.cosph0*o-this.sinph0*u*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),Math.abs(d+this.phi0)=0?(e=(h=Math.sqrt(s))*n,i=r*(this.mode===this.S_POLE?h:-h)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t}function It(t){t.x-=this.x0,t.y-=this.y0;var e,i,r,n,o,s,a,l=t.x/this.a,h=t.y/this.a;if(this.sphere){var u,c=0,d=0;if(u=Math.sqrt(l*l+h*h),i=.5*u,i>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(d=Math.sin(i),c=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(u)<=Oe?0:Math.asin(h*d/u),l*=d,h=c*u;break;case this.OBLIQ:i=Math.abs(u)<=Oe?this.phi0:Math.asin(c*this.sinph0+h*d*this.cosph0/u),l*=d*this.cosph0,h=(c-Math.sin(i)*this.sinph0)*u;break;case this.N_POLE:h=-h,i=Ce-i;break;case this.S_POLE:i-=Ce}e=0!==h||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(l,h):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){ -if(l/=this.dd,h*=this.dd,s=Math.sqrt(l*l+h*h),sOe?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Ft(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var r=Fr(this.e3,this.sin_phi,this.cos_phi),n=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,o=this.ns0*si(e-this.long0),s=n*Math.sin(o)+this.x0,a=this.rh-n*Math.cos(o)+this.y0;return t.x=s,t.y=a,t}function Gt(t){var e,i,r,n,o,s;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),r=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),r=-1),n=0,0!==e&&(n=Math.atan2(r*t.x,r*t.y)),r=e*this.ns0/this.a,this.sphere?s=Math.asin((this.c-r*r)/(2*this.ns0)):(i=(this.c-r*r)/this.ns0,s=this.phi1z(this.e3,i)),o=si(n/this.ns0+this.long0),t.x=o,t.y=s,t}function Wt(t,e){var i,r,n,o,s,a=Zr(.5*e);if(t0||Math.abs(s)<=Oe?(a=this.x0+this.a*o*i*Math.sin(r)/s,l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*i*n)/s):(a=this.x0+this.infinity_dist*i*Math.sin(r),l=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=l,t}function Kt(t){var e,i,r,n,o,s;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(n=Math.atan2(e,this.rc),i=Math.sin(n),r=Math.cos(n),s=Zr(r*this.sin_p14+t.y*i*this.cos_p14/e),o=Math.atan2(t.x*i,e*this.cos_p14*r-t.y*this.sin_p14*i),o=si(this.long0+o)):(s=this.phic0,o=0),t.x=o,t.y=s,t}function jt(){this.sphere||(this.k0=ni(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function zt(t){var e,i,r=t.x,n=t.y,o=si(r-this.long0);if(this.sphere)e=this.x0+this.a*o*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var s=Fr(this.e,Math.sin(n));e=this.x0+this.a*this.k0*o,i=this.y0+this.a*s*.5/this.k0}return t.x=e,t.y=i,t}function Ht(t){t.x-=this.x0,t.y-=this.y0;var e,i;return this.sphere?(e=si(this.long0+t.x/this.a/Math.cos(this.lat_ts)),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=rn(this.e,2*t.y*this.k0/this.a),e=si(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=i,t}function qt(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function Yt(t){var e=t.x,i=t.y,r=si(e-this.long0),n=Ir(i-this.lat0);return t.x=this.x0+this.a*r*this.rc,t.y=this.y0+this.a*n,t}function Xt(t){var e=t.x,i=t.y;return t.x=si(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=Ir(this.lat0+(i-this.y0)/this.a),t}function Jt(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Cr(this.es),this.e1=Ar(this.es),this.e2=Pr(this.es),this.e3=Nr(this.es),this.ml0=this.a*Mr(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Zt(t){var e,i,r,n=t.x,o=t.y,s=si(n-this.long0);if(r=s*Math.sin(o),this.sphere)Math.abs(o)<=Oe?(e=this.a*s,i=-1*this.a*this.lat0):(e=this.a*Math.sin(r)/Math.tan(o),i=this.a*(Ir(o-this.lat0)+(1-Math.cos(r))/Math.tan(o)));else if(Math.abs(o)<=Oe)e=this.a*s,i=-1*this.ml0;else{var a=Or(this.a,this.e,Math.sin(o))/Math.tan(o);e=a*Math.sin(r),i=this.a*Mr(this.e0,this.e1,this.e2,this.e3,o)-this.ml0+a*(1-Math.cos(r))}return t.x=e+this.x0,t.y=i+this.y0,t}function Qt(t){var e,i,r,n,o,s,a,l,h;if(r=t.x-this.x0,n=t.y-this.y0,this.sphere)if(Math.abs(n+this.a*this.lat0)<=Oe)e=si(r/this.a+this.long0),i=0;else{s=this.lat0+n/this.a,a=r*r/this.a/this.a+s*s,l=s;var u;for(o=ln;o;--o)if(u=Math.tan(l),h=-1*(s*(l*u+1)-l-.5*(l*l+a)*u)/((l-s)/u-1),l+=h,Math.abs(h)<=Oe){i=l;break}e=si(this.long0+Math.asin(r*Math.tan(l)/this.a)/Math.sin(i))}else if(Math.abs(n+this.ml0)<=Oe)i=0,e=si(this.long0+r/this.a);else{s=(this.ml0+n)/this.a,a=r*r/this.a/this.a+s*s,l=s;var c,d,p,f,g;for(o=ln;o;--o)if(g=this.e*Math.sin(l),c=Math.sqrt(1-g*g)*Math.tan(l),d=this.a*Mr(this.e0,this.e1,this.e2,this.e3,l),p=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),f=d/this.a,h=(s*(c*f+1)-f-.5*c*(f*f+a))/(this.es*Math.sin(2*l)*(f*f+a-2*s*f)/(4*c)+(s-f)*(c*p-2/Math.sin(2*l))-p),l-=h,Math.abs(h)<=Oe){i=l;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=si(this.long0+Math.asin(r*c/this.a)/Math.sin(i))}return t.x=e,t.y=i,t}function $t(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function te(t){var e,i=t.x,r=t.y,n=r-this.lat0,o=i-this.long0,s=n/Me*1e-5,a=o,l=1,h=0;for(e=1;e<=10;e++)l*=s,h+=this.A[e]*l;var u,c,d=h,p=a,f=1,g=0,m=0,y=0;for(e=1;e<=6;e++)u=f*d-g*p,c=g*d+f*p,f=u,g=c,m=m+this.B_re[e]*f-this.B_im[e]*g,y=y+this.B_im[e]*f+this.B_re[e]*g;return t.x=y*this.a+this.x0,t.y=m*this.a+this.y0,t}function ee(t){var e,i,r,n=t.x,o=t.y,s=n-this.x0,a=o-this.y0,l=a/this.a,h=s/this.a,u=1,c=0,d=0,p=0;for(e=1;e<=6;e++)i=u*l-c*h,r=c*l+u*h,u=i,c=r,d=d+this.C_re[e]*u-this.C_im[e]*c,p=p+this.C_im[e]*u+this.C_re[e]*c;for(var f=0;f.999999999999&&(i=.999999999999),e=Math.asin(i);var r=si(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));r<-Math.PI&&(r=-Math.PI),r>Math.PI&&(r=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var n=Math.asin(i);return t.x=r,t.y=n,t}function ce(){Math.abs(this.lat1+this.lat2)=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var o=0;if(0!==i&&(o=Math.atan2(e*t.x,e*t.y)),this.sphere)return n=si(this.long0+o/this.ns),r=Ir(this.g-i/this.a),t.x=n,t.y=r,t;var s=this.g-i/this.a;return r=Dr(s,this.e0,this.e1,this.e2,this.e3),n=si(this.long0+o/this.ns),t.x=n,t.y=r,t}function fe(){this.R=this.a}function ge(t){var e,i,r=t.x,n=t.y,o=si(r-this.long0);Math.abs(n)<=Oe&&(e=this.x0+this.R*o,i=this.y0);var s=Zr(2*Math.abs(n/Math.PI));(Math.abs(o)<=Oe||Math.abs(Math.abs(n)-Ce)<=Oe)&&(e=this.x0,i=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*s):this.y0+Math.PI*this.R*-Math.tan(.5*s));var a=.5*Math.abs(Math.PI/o-o/Math.PI),l=a*a,h=Math.sin(s),u=Math.cos(s),c=u/(h+u-1),d=c*c,p=c*(2/h-1),f=p*p,g=Math.PI*this.R*(a*(c-f)+Math.sqrt(l*(c-f)*(c-f)-(f+l)*(d-f)))/(f+l);o<0&&(g=-g),e=this.x0+g;var m=l+c;return g=Math.PI*this.R*(p*m-a*Math.sqrt((f+l)*(l+1)-m*m))/(f+l),i=n>=0?this.y0+g:this.y0-g,t.x=e,t.y=i,t}function me(t){var e,i,r,n,o,s,a,l,h,u,c,d,p;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,r=t.x/c,n=t.y/c,o=r*r+n*n,s=-Math.abs(n)*(1+o),a=s-2*n*n+r*r,l=-2*s+1+2*n*n+o*o,p=n*n/l+(2*a*a*a/l/l/l-9*s*a/l/l)/27,h=(s-a*a/3/l)/l,u=2*Math.sqrt(-h/3),c=3*p/h/u,Math.abs(c)>1&&(c=c>=0?1:-1),d=Math.acos(c)/3,i=t.y>=0?(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI:-(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI,e=Math.abs(r)2*Ce*this.a)return;return i=e/this.a,r=Math.sin(i),n=Math.cos(i),o=this.long0,Math.abs(e)<=Oe?s=this.lat0:(s=Zr(n*this.sin_p12+t.y*r*this.cos_p12/e),a=Math.abs(this.lat0)-Ce,o=si(Math.abs(a)<=Oe?this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y):this.long0+Math.atan2(t.x*r,e*this.cos_p12*n-t.y*this.sin_p12*r))),t.x=o,t.y=s,t}return l=Cr(this.es),h=Ar(this.es),u=Pr(this.es),c=Nr(this.es),Math.abs(this.sin_p12-1)<=Oe?(d=this.a*Mr(l,h,u,c,Ce),e=Math.sqrt(t.x*t.x+t.y*t.y),p=d-e,s=Dr(p/this.a,l,h,u,c),o=si(this.long0+Math.atan2(t.x,-1*t.y)),t.x=o,t.y=s,t):Math.abs(this.sin_p12+1)<=Oe?(d=this.a*Mr(l,h,u,c,Ce),e=Math.sqrt(t.x*t.x+t.y*t.y),p=e-d,s=Dr(p/this.a,l,h,u,c),o=si(this.long0+Math.atan2(t.x,t.y)),t.x=o,t.y=s,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),m=Math.atan2(t.x,t.y),f=Or(this.a,this.e,this.sin_p12),y=Math.cos(m),E=this.e*this.cos_p12*y,v=-E*E/(1-this.es),_=3*this.es*(1-v)*this.sin_p12*this.cos_p12*y/(1-this.es),b=e/f,S=b-v*(1+v)*Math.pow(b,3)/6-_*(1+3*v)*Math.pow(b,4)/24,w=1-v*S*S/2-b*S*S*S/6,g=Math.asin(this.sin_p12*Math.cos(S)+this.cos_p12*Math.sin(S)*y),o=si(this.long0+Math.asin(Math.sin(m)*Math.sin(S)/Math.cos(g))),s=Math.atan((1-this.es*w*this.sin_p12/Math.sin(g))*Math.tan(g)/(1-this.es)),t.x=o,t.y=s,t)}function _e(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function be(t){var e,i,r,n,o,s,a,l,h=t.x,u=t.y;return r=si(h-this.long0),e=Math.sin(u),i=Math.cos(u),n=Math.cos(r),s=this.sin_p14*e+this.cos_p14*i*n,o=1,(s>0||Math.abs(s)<=Oe)&&(a=this.a*o*i*Math.sin(r),l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=l,t}function Se(t){var e,i,r,n,o,s,a;return t.x-=this.x0,t.y-=this.y0,e=Math.sqrt(t.x*t.x+t.y*t.y),i=Zr(e/this.a),r=Math.sin(i),n=Math.cos(i),s=this.long0,Math.abs(e)<=Oe?(a=this.lat0,t.x=s,t.y=a,t):(a=Zr(n*this.sin_p14+t.y*r*this.cos_p14/e),o=Math.abs(this.lat0)-Ce,Math.abs(o)<=Oe?(s=si(this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y)),t.x=s,t.y=a,t):(s=si(this.long0+Math.atan2(t.x*r,e*this.cos_p14*n-t.y*this.sin_p14*r)),t.x=s,t.y=a,t))}var we=function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]},Le=1,Te=2,Re=4,xe=5,Me=484813681109536e-20,Ce=Math.PI/2,Ae=.16666666666666666,Pe=.04722222222222222,Ne=.022156084656084655,Oe="undefined"==typeof Number.EPSILON?1e-10:Number.EPSILON,Ie=.017453292519943295,De=57.29577951308232,ke=Math.PI/4,Ve=2*Math.PI,Fe=3.14159265359,Ge={};Ge.greenwich=0,Ge.lisbon=-9.131906111111,Ge.paris=2.337229166667,Ge.bogota=-74.080916666667,Ge.madrid=-3.687938888889,Ge.rome=12.452333333333,Ge.bern=7.439583333333,Ge.jakarta=106.807719444444,Ge.ferro=-17.666666666667,Ge.brussels=4.367975,Ge.stockholm=18.058277777778,Ge.athens=23.7163375,Ge.oslo=10.722916666667;var We={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},Be=/[\s_\-\/\(\)]/g,Ue=function(e){var i,r,n,o={},s=e.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t},{}),a={proj:"projName",datum:"datumCode",rf:function(t){o.rf=parseFloat(t)},lat_0:function(t){o.lat0=t*Ie},lat_1:function(t){o.lat1=t*Ie},lat_2:function(t){o.lat2=t*Ie},lat_ts:function(t){o.lat_ts=t*Ie},lon_0:function(t){o.long0=t*Ie},lon_1:function(t){o.long1=t*Ie},lon_2:function(t){o.long2=t*Ie},alpha:function(t){o.alpha=parseFloat(t)*Ie},lonc:function(t){o.longc=t*Ie},x_0:function(t){o.x0=parseFloat(t)},y_0:function(t){o.y0=parseFloat(t)},k_0:function(t){o.k0=parseFloat(t)},k:function(t){o.k0=parseFloat(t)},a:function(t){o.a=parseFloat(t)},b:function(t){o.b=parseFloat(t)},r_a:function(){o.R_A=!0},zone:function(t){o.zone=parseInt(t,10)},south:function(){o.utmSouth=!0},towgs84:function(t){o.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){o.to_meter=parseFloat(t)},units:function(e){o.units=e;var i=t(We,e);i&&(o.to_meter=i.to_meter)},from_greenwich:function(t){o.from_greenwich=t*Ie},pm:function(e){var i=t(Ge,e);o.from_greenwich=(i?i:parseFloat(e))*Ie},nadgrids:function(t){"@null"===t?o.datumCode="none":o.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&e.indexOf(t.substr(0,1))!==-1&&e.indexOf(t.substr(1,1))!==-1&&e.indexOf(t.substr(2,1))!==-1&&(o.axis=t)}};for(i in s)r=s[i],i in a?(n=a[i],"function"==typeof n?n(r):o[n]=r):o[i]=r;return"string"==typeof o.datumCode&&"WGS84"!==o.datumCode&&(o.datumCode=o.datumCode.toLowerCase()),o},Ke=1,je=2,ze=3,He=4,qe=5,Ye=-1,Xe=/\s/,Je=/[A-Za-z]/,Ze=/[A-Za-z84]/,Qe=/[,\]]/,$e=/[\d\.E\-\+]/;e.prototype.readCharicter=function(){var t=this.text[this.place++];if(this.state!==He)for(;Xe.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case Ke:return this.neutral(t);case je:return this.keyword(t);case He:return this.quoted(t);case qe:return this.afterquote(t);case ze:return this.number(t);case Ye:return}},e.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=He);if(Qe.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},e.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=Ke)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=Ke,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=Ye))):void 0},e.prototype.number=function(t){if($e.test(t))return void(this.word+=t);if(Qe.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)},e.prototype.quoted=function(t){return'"'===t?void(this.state=qe):void(this.word+=t)},e.prototype.keyword=function(t){if(Ze.test(t))return void(this.word+=t);if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=Ke)}if(Qe.test(t))return void this.afterItem(t);throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place)},e.prototype.neutral=function(t){if(Je.test(t))return this.word=t,void(this.state=je);if('"'===t)return this.word="",void(this.state=He);if($e.test(t))return this.word=t,void(this.state=ze);if(Qe.test(t))return void this.afterItem(t);throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place)},e.prototype.output=function(){for(;this.place2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e},wi=T("WGS84"),Li=6,Ti="AJSAJS",Ri="AFAFAF",xi=65,Mi=73,Ci=79,Ai=86,Pi=90,Ni={forward:V,inverse:F,toPoint:G};$.fromMGRS=function(t){return new $(G(t))},$.prototype.toMGRS=function(t){return V([this.x,this.y],t)};var Oi="2.4.3",Ii=1,Di=.25,ki=.046875,Vi=.01953125,Fi=.01068115234375,Gi=.75,Wi=.46875,Bi=.013020833333333334,Ui=.007120768229166667,Ki=.3645833333333333,ji=.005696614583333333,zi=.3076171875,Hi=function(t){var e=[];e[0]=Ii-t*(Di+t*(ki+t*(Vi+t*Fi))),e[1]=t*(Gi-t*(ki+t*(Vi+t*Fi)));var i=t*t;return e[2]=i*(Wi-t*(Bi+t*Ui)),i*=t,e[3]=i*(Ki-t*ji),e[4]=i*t*zi,e},qi=function(t,e,i,r){return i*=e,e*=e,r[0]*t-i*(r[1]+e*(r[2]+e*(r[3]+e*r[4])))},Yi=20,Xi=function(t,e,i){for(var r=1/(1-e),n=t,o=Yi;o;--o){var s=Math.sin(n),a=1-e*s*s;if(a=(qi(n,s,Math.cos(n),i)-t)*(a*Math.sqrt(a))*r,n-=a,Math.abs(a)=0;)i=-s+r*o+t[n],s=o,o=i;return e+i*Math.sin(2*e)},rr=function(t,e){for(var i,r=2*Math.cos(e),n=t.length-1,o=t[n],s=0;--n>=0;)i=-s+r*o+t[n],s=o,o=i;return Math.sin(e)*i},nr=function(t){var e=Math.exp(t);return e=(e+1/e)/2},or=function(t,e,i){for(var r,n,o=Math.sin(e),s=Math.cos(e),a=Qi(i),l=nr(i),h=2*s*l,u=-2*o*a,c=t.length-1,d=t[c],p=0,f=0,g=0;--c>=0;)r=f,n=p,f=d,p=g,d=-r+h*f-u*p+t[c],g=-n+u*f+h*p;return h=o*l,u=s*a,[h*d-u*g,h*g+u*d]},sr=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],ar={init:rt,forward:nt,inverse:ot,names:sr},lr=function(t,e){if(void 0===t){if(t=Math.floor(30*(si(e)+Math.PI)/Math.PI)+1,t<0)return 0;if(t>60)return 60}return t},hr="etmerc",ur=["Universal Transverse Mercator System","utm"],cr={init:st,names:ur,dependsOn:hr},dr=function(t,e){return Math.pow((1-t)/(1+t),e)},pr=20,fr=["gauss"],gr={init:at,forward:lt,inverse:ht,names:fr},mr=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative"],yr={init:ut,forward:ct,inverse:dt,names:mr},Er=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],vr={init:ft,forward:gt,inverse:mt,names:Er,ssfn_:pt},_r=["somerc"],br={init:yt,forward:Et,inverse:vt,names:_r},Sr=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],wr={init:_t,forward:bt,inverse:St,names:Sr},Lr=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],Tr={init:wt,forward:Lt,inverse:Tt,names:Lr},Rr=["Krovak","krovak"],xr={init:Rt,forward:xt,inverse:Mt,names:Rr},Mr=function(t,e,i,r,n){return t*n-e*Math.sin(2*n)+i*Math.sin(4*n)-r*Math.sin(6*n)},Cr=function(t){return 1-.25*t*(1+t/16*(3+1.25*t))},Ar=function(t){return.375*t*(1+.25*t*(1+.46875*t))},Pr=function(t){return.05859375*t*t*(1+.75*t)},Nr=function(t){return t*t*t*(35/3072)},Or=function(t,e,i){var r=e*i;return t/Math.sqrt(1-r*r)},Ir=function(t){return Math.abs(t)1e-7?(i=t*e,(1-t*t)*(e/(1-i*i)-.5/t*Math.log((1-i)/(1+i)))):2*e},Gr=1,Wr=2,Br=3,Ur=4,Kr=.3333333333333333,jr=.17222222222222222,zr=.10257936507936508,Hr=.06388888888888888,qr=.0664021164021164,Yr=.016415012942191543,Xr=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Jr={init:Nt,forward:Ot,inverse:It,names:Xr,S_POLE:Gr,N_POLE:Wr,EQUIT:Br,OBLIQ:Ur},Zr=function(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)},Qr=["Albers_Conic_Equal_Area","Albers","aea"],$r={init:Vt,forward:Ft,inverse:Gt,names:Qr, -phi1z:Wt},tn=["gnom"],en={init:Bt,forward:Ut,inverse:Kt,names:tn},rn=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*Ce:Ce;for(var r,n,o,s,a=Math.asin(.5*e),l=0;l<30;l++)if(n=Math.sin(a),o=Math.cos(a),s=t*n,r=Math.pow(1-s*s,2)/(2*o)*(e/(1-t*t)-n/(1-s*s)+.5/t*Math.log((1-s)/(1+s))),a+=r,Math.abs(r)<=1e-10)return a;return NaN},nn=["cea"],on={init:jt,forward:zt,inverse:Ht,names:nn},sn=["Equirectangular","Equidistant_Cylindrical","eqc"],an={init:qt,forward:Yt,inverse:Xt,names:sn},ln=20,hn=["Polyconic","poly"],un={init:Jt,forward:Zt,inverse:Qt,names:hn},cn=["New_Zealand_Map_Grid","nzmg"],dn={init:$t,forward:te,inverse:ee,names:cn},pn=["Miller_Cylindrical","mill"],fn={init:ie,forward:re,inverse:ne,names:pn},gn=20,mn=["Sinusoidal","sinu"],yn={init:oe,forward:se,inverse:ae,names:mn},En=["Mollweide","moll"],vn={init:le,forward:he,inverse:ue,names:En},_n=["Equidistant_Conic","eqdc"],bn={init:ce,forward:de,inverse:pe,names:_n},Sn=["Van_der_Grinten_I","VanDerGrinten","vandg"],wn={init:fe,forward:ge,inverse:me,names:Sn},Ln=["Azimuthal_Equidistant","aeqd"],Tn={init:ye,forward:Ee,inverse:ve,names:Ln},Rn=["ortho"],xn={init:_e,forward:be,inverse:Se,names:Rn},Mn=function(t){t.Proj.projections.add(Zi),t.Proj.projections.add(ar),t.Proj.projections.add(cr),t.Proj.projections.add(yr),t.Proj.projections.add(vr),t.Proj.projections.add(br),t.Proj.projections.add(wr),t.Proj.projections.add(Tr),t.Proj.projections.add(xr),t.Proj.projections.add(Vr),t.Proj.projections.add(Jr),t.Proj.projections.add($r),t.Proj.projections.add(en),t.Proj.projections.add(on),t.Proj.projections.add(an),t.Proj.projections.add(un),t.Proj.projections.add(dn),t.Proj.projections.add(fn),t.Proj.projections.add(yn),t.Proj.projections.add(vn),t.Proj.projections.add(bn),t.Proj.projections.add(wn),t.Proj.projections.add(Tn),t.Proj.projections.add(xn)};return k.defaultDatum="WGS84",k.Proj=T,k.WGS84=new k.Proj("WGS84"),k.Point=$,k.toPoint=Si,k.defs=l,k.transform=O,k.mgrs=Ni,k.version=Oi,Mn(k),k}),i("formats/geotiff/TiffIFDEntry",["../../error/AbstractError","../../error/ArgumentError","./GeoTiffUtil","../../util/Logger","./TiffConstants"],function(t,e,i,r,n){"use strict";var o=function(t,i,n,o,s,a){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingTag"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingType"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingCount"));if(null===o||void 0===o)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingValueOffset"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingGeoTiffData"));if(null===a||void 0===a)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingIsLittleEndian"));this._tag=t,this._type=i,this._count=n,this._valueOffset=o,this._geoTiffData=s,this._isLittleEndian=a};return Object.defineProperties(o.prototype,{tag:{get:function(){return this._tag}},type:{get:function(){return this._type}},count:{get:function(){return this._count}},valueOffset:{get:function(){return this._valueOffset}},geoTiffData:{get:function(){return this._geoTiffData}},isLittleEndian:{get:function(){return this._isLittleEndian}}}),o.prototype.getIFDTypeLength=function(){switch(this.type){case n.Type.BYTE:case n.Type.ASCII:case n.Type.SBYTE:case n.Type.UNDEFINED:return 1;case n.Type.SHORT:case n.Type.SSHORT:return 2;case n.Type.LONG:case n.Type.SLONG:case n.Type.FLOAT:return 4;case n.Type.RATIONAL:case n.Type.SRATIONAL:case n.Type.DOUBLE:return 8;default:return-1}},o.prototype.getIFDEntryValue=function(){var e=[],o=null,s=this.getIFDTypeLength(),a=s*this.count;if(a<=4)o=this.isLittleEndian===!1?this.valueOffset>>>8*(4-s):this.valueOffset,e.push(o);else for(var l=0;l=8)if(this.type===n.Type.RATIONAL||this.type===n.Type.SRATIONAL)e.push(i.getBytes(this.geoTiffData,this.valueOffset+h,4,this.isLittleEndian)),e.push(i.getBytes(this.geoTiffData,this.valueOffset+h+4,4,this.isLittleEndian));else{if(this.type!==n.Type.DOUBLE)throw new t(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","parse","invalidTypeOfIFD"));e.push(i.getBytes(this.geoTiffData,this.valueOffset+h,8,this.isLittleEndian))}else e.push(i.getBytes(this.geoTiffData,this.valueOffset+h,s,this.isLittleEndian))}return this.type===n.Type.ASCII?(e.forEach(function(t,e,i){0===t?i.splice(e,1):i[e]=String.fromCharCode(t)}),e.join("")):e},o}),i("util/WWUtil",["../error/ArgumentError","../geom/Line","../util/Logger","../geom/Rectangle","../geom/Vec3"],function(t,e,i,r,n){"use strict";var o={latLonRegex:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,suffixForMimeType:function(t){return"image/png"===t?"png":"image/jpeg"===t?"jpg":"application/bil16"===t?"bil":"application/bil32"===t?"bil":null},currentUrlSansFilePart:function(){for(var t=window.location.protocol,e=window.location.host,i=window.location.pathname,r=i.split("/"),n="",o=0,s=r.length;o0&&(n=n+"/"+r[o]);return t+"//"+e+n},worldwindlibLocation:function(){for(var t=document.getElementsByTagName("script"),e="/worldwind.",i=0;i=0)return t[i].src.substring(0,r)+"/"}return null},urlPath:function(t){if(!t)return"";for(var e=t.split("/"),i="",r=0,n=e.length;rt.length)&&(i=t.length),i-=e.length;var r=t.lastIndexOf(e,i);return r!==-1&&r===i}};return o}),i("formats/geotiff/GeoTiffReader",["../../error/AbstractError","../../error/ArgumentError","./GeoTiffConstants","./GeoTiffKeyEntry","./GeoTiffMetadata","./GeoTiffUtil","../../geom/Location","../../geom/Sector","../../util/Logger","../../util/proj4-src","./TiffConstants","./TiffIFDEntry","../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","constructor","missingArrayBuffer"));this._isLittleEndian=!1,this._imageFileDirectories=[],this._geoTiffData=new DataView(t),this._metadata=new n,this.parse()};return Object.defineProperties(p.prototype,{isLittleEndian:{get:function(){return this._isLittleEndian}},imageFileDirectories:{get:function(){return this._imageFileDirectories}},geoTiffData:{get:function(){return this._geoTiffData}},metadata:{get:function(){return this._metadata}}}),p.retrieveFromUrl=function(t,i){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","retrieveFromUrl","missingUrl"));if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","retrieveFromUrl","The specified callback is null or undefined."));var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onreadystatechange=function(){if(4===r.readyState)if(200===r.status){var e=r.response;e&&i(new p(e),r)}else l.log(l.LEVEL_WARNING,"GeoTiff retrieval failed ("+r.statusText+"): "+t),i(null,r)}.bind(this),r.onerror=function(){l.log(l.LEVEL_WARNING,"GeoTiff retrieval failed: "+t),i(null,r)},r.ontimeout=function(){l.log(l.LEVEL_WARNING,"GeoTiff retrieval timed out: "+t),i(null,r)},r.send(null)},p.prototype.parse=function(){if(!this._imageFileDirectories.length){if(this.getEndianness(),!this.isTiffFileType())throw new t(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","parse","invalidTiffFileType"));var e=o.getBytes(this.geoTiffData,4,4,this.isLittleEndian);this.parseImageFileDirectory(e),this.getMetadataFromImageFileDirectory(),this.parseGeoKeys(),this.setBBox()}},p.prototype.getEndianness=function(){var e=o.getBytes(this.geoTiffData,0,2,this.isLittleEndian);if(18761===e)this._isLittleEndian=!0;else{if(19789!==e)throw new t(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","getEndianness","invalidByteOrderValue"));this._isLittleEndian=!1}},p.prototype.getImage=function(){return this.createImage()},p.prototype.getImageData=function(){return this.createTypedElevationArray()},p.prototype.isTiffFileType=function(){var t=o.getBytes(this.geoTiffData,2,2,this.isLittleEndian);return 42===t},p.prototype.isGeoTiff=function(){return!!this.getIFDByTag(i.Tag.GEO_KEY_DIRECTORY)},p.prototype.createImage=function(){var t=this.metadata.bitsPerSample,e=this.metadata.samplesPerPixel,i=this.metadata.photometricInterpretation,r=this.metadata.imageLength,n=this.metadata.imageWidth;if(this.metadata.colorMap)var o=this.metadata.colorMap,s=Math.pow(2,t[0]);var a=document.createElement("canvas");a.width=n,a.height=r;var l=a.getContext("2d");if(this.metadata.stripOffsets){var h=this.parseStrips(!1);if(this.metadata.rowsPerStrip)var u=this.metadata.rowsPerStrip;else var u=r;for(var c=h.length,d=0,p=u,f=r%u,g=0===f?u:f,m=0;m=0&&x<=127?L=x+1:x>=-127&&x<=-1?T=-x+1:w=!0}else{for(var M=o.getBytes(this.geoTiffData,n+c,1,this.isLittleEndian),C=0;C6&&0===c);else if(16===d){var p=t,f=i;t=p*a[0]+f*a[1]+a[3],i=p*a[4]+f*a[5]+a[7],r=[t,i]}else c<3||u<6?r=[t,i]:(t=(t-n[0])*o[0]+n[3],i=(i-n[1])*(-1*o[1])+n[4],r=[t,i]);return h.defs([["EPSG:26771","+proj=tmerc +lat_0=36.66666666666666 +lon_0=-88.33333333333333 +k=0.9999749999999999 +x_0=152400.3048006096 +y_0=0 +ellps=clrk66 +datum=NAD27 +to_meter=0.3048006096012192 +no_defs "],["EPSG:32633","+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"]]),this.metadata.projectedCSType&&(r=h("EPSG:"+this.metadata.projectedCSType,"EPSG:4326",r)),new s(r[1],r[0])},p.prototype.setBBox=function(){var t=this.geoTiffImageToPCS(0,0),e=this.geoTiffImageToPCS(this.metadata.imageWidth,0),i=this.geoTiffImageToPCS(0,this.metadata.imageLength);this.geoTiffImageToPCS(this.metadata.imageWidth,this.metadata.imageLength);this.metadata.bbox=new a(i.latitude,t.latitude,t.longitude,e.longitude)},p.prototype.getMetadataFromImageFileDirectory=function(){for(var t=0;tt.levelNumber?1:0},n}),i("util/LevelSet",["../error/ArgumentError","../util/Level","../geom/Location","../util/Logger"],function(t,e,i,r){"use strict";var n=function(n,o,s,a,l){if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","missingSector"));if(!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified level zero delta is null or undefined"));if(o.latitude<=0||o.longitude<=0)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified level zero delta is less than or equal to zero."));if(s<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified number of levels is less than one."));if(a<1||l<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified tile width or tile height is less than one."));this.sector=n,this.levelZeroDelta=o,this.numLevels=s,this.tileWidth=a,this.tileHeight=l,this.levels=[];for(var h=0;h=this.levels.length?null:this.levels[t]},n.prototype.levelForTexelSize=function(t){var e=this.lastLevel();if(e.texelSize>=t)return e;for(var i=0,r=this.levels.length;i=i||r<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","constructor","The specified low-water value is undefined, greater than or equal to the capacity, or less than 1"));this._capacity=i,this._lowWater=r,this.usedCapacity=0,this.freeCapacity=i,this.entries={},this.listeners=[]};return Object.defineProperties(i.prototype,{capacity:{get:function(){return this._capacity},set:function(i){if(!i||i<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","capacity","Specified cache capacity is undefined, 0 or negative."));var r=this._capacity;this._capacity=i,this._capacity<=this.lowWater&&(this._lowWater=.85*this._capacity),this._capacity=this._capacity||i<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","lowWater","Specified cache low-water value is undefined, negative or not less than the current capacity."));this._lowWater=i}}}),i.prototype.entryForKey=function(t){if(!t)return null;var e=this.entries[t];return e?(e.lastUsed=Date.now(),e.entry):null},i.prototype.putEntry=function(i,r,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","missingKey."));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","missingEntry."));if(n<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","The specified entry size is less than 1."));var o,s=this.entries[i];s&&this.removeEntry(i),this.usedCapacity+n>this._capacity&&this.makeSpace(n),this.usedCapacity+=n,this.freeCapacity=this._capacity-this.usedCapacity,o={key:i,entry:r,size:n,lastUsed:Date.now(),agingFactor:1},this.entries[i]=o},i.prototype.clear=function(t){if(t)for(var e in this.entries)this.entries.hasOwnProperty(e)&&this.removeCacheEntry(e);this.entries={},this.freeCapacity=this._capacity,this.usedCapacity=0},i.prototype.removeEntry=function(t){if(t){var e=this.entries[t];e&&this.removeCacheEntry(e)}},i.prototype.setEntryAgingFactor=function(t,e){if(t){var i=this.entries[t];i&&(i.agingFactor=e)}},i.prototype.removeCacheEntry=function(t){delete this.entries[t.key],this.usedCapacity-=t.size,this.freeCapacity=this._capacity-this.usedCapacity;for(var e=0,i=this.listeners.length;e-1&&this.listeners.splice(r,1)},i.prototype.makeSpace=function(t){var e=[],i=Date.now();for(var r in this.entries)this.entries.hasOwnProperty(r)&&e.push(this.entries[r]);e.sort(function(t,e){var r=(i-t.lastUsed)*t.agingFactor,n=(i-e.lastUsed)*e.agingFactor;return n-r});for(var n=0,o=e.length;nthis._lowWater||this.freeCapacityi&&(_=i),bo&&(S=o),ws&&(L=s),T180&&(i.computePointFromPosition(e.centroidLatitude(),e.centroidLongitude()+90,o,this.tmp1),i.computePointFromPosition(e.centroidLatitude(),e.centroidLongitude()-90,o,this.tmp2),this.adjustExtremes(this.r,d,this.s,p,this.t,f,this.tmp1),this.adjustExtremes(this.r,d,this.s,p,this.t,f,this.tmp2)),d[1]-d[0]=0?i:-i},c.prototype.effectiveRadius=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","effectiveRadius","missingPlane"));var i=e.normal;return.5*(h.fabs(this.r.dot(i))+h.fabs(this.s.dot(i))+h.fabs(this.t.dot(i)))},c.prototype.intersectsFrustum=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","intersectsFrustum","missingFrustum"));return this.tmp1.copy(this.bottomCenter),this.tmp2.copy(this.topCenter),!(this.intersectionPoint(e.near)<0)&&(!(this.intersectionPoint(e.far)<0)&&(!(this.intersectionPoint(e.left)<0)&&(!(this.intersectionPoint(e.right)<0)&&(!(this.intersectionPoint(e.top)<0)&&!(this.intersectionPoint(e.bottom)<0)))))},c.prototype.intersectionPoint=function(t){var e=t.normal,i=.5*(Math.abs(this.s.dot(e))+Math.abs(this.t.dot(e)));return this.intersectsAt(t,i,this.tmp1,this.tmp2)},c.prototype.intersectsAt=function(t,e,i,r){var n=t.dot(i),o=n<=-e,s=t.dot(r),a=s<=-e;if(o&&a)return-1;if(o==a)return 0;this.tmp3.copy(i),this.tmp3.subtract(r);var l=(e+n)/t.normal.dot(this.tmp3);return this.tmp3.copy(r),this.tmp3.subtract(i),this.tmp3.multiply(l),this.tmp3.add(i),o?i.copy(this.tmp3):r.copy(this.tmp3),l},c.prototype.adjustExtremes=function(t,e,i,r,n,o,s){var a=s.dot(t);e[0]>a&&(e[0]=a),e[1]l&&(r[0]=l),r[1]h&&(o[0]=h),o[1]Math.max(e*n,this.minCellSize)},s.prototype.update=function(t){var e=t.globe.elevationTimestamp(),i=t.verticalExaggeration,r=t.globeStateKey;this.updateTimestamp==e&&this.updateVerticalExaggeration==i&&this.updateGlobeStateKey==r||(this.doUpdate(t),t.frameStatistics.incrementTileUpdateCount(1),this.updateTimestamp=e,this.updateVerticalExaggeration=i,this.updateGlobeStateKey=r)},s.prototype.doUpdate=function(t){var i=t.globe,r=t.verticalExaggeration,s=i.minAndMaxElevationsForSector(this.sector),a=s[0]*r,l=s[1]*r;a===l&&(a=l+10),this.extent||(this.extent=new e),this.extent.setToSector(this.sector,i,a,l),this.samplePoints||(this.sampleElevations=new Float64Array(9),this.samplePoints=new Float64Array(3*this.sampleElevations.length)),o.fillArray(this.sampleElevations,.5*(a+l)),i.computePointsForGrid(this.sector,3,3,this.sampleElevations,n.ZERO,this.samplePoints),this.referencePoint||(this.referencePoint=new n(0,0,0)),i.computePointFromPosition(this.sector.centroidLatitude(),this.sector.centroidLongitude(),0,this.referencePoint)},s.computeTileKey=function(t,e,i){return t+"."+e+"."+i},s.computeRow=function(t,e){var i=Math.floor((e+90)/t);return 90==e&&(i-=1),i},s.computeColumn=function(t,e){var i=Math.floor((e+180)/t);return 180==e&&(i-=1),i},s.computeLastRow=function(t,e){var i=Math.ceil((e+90)/t-1);return e+90u&&(r[0]=u);var c=h.maxElevation;r[1]=0;h--){if(i=c.computeTileKey(h,s,a),l=this.imageCache.entryForKey(i)){var u=l.elevationAtLocation(t,e);return isNaN(u)?null:u}s=Math.floor(s/2),a=Math.floor(a/2)}return null},p.prototype.pointElevationsForGrid=function(t,e,i,r,n){if(this.assembleTiles(r,t,!0),0===this.currentTiles.length)return!1;this.currentTiles.sort(function(t,e){return t.level.levelNumber-e.level.levelNumber});for(var o=0,s=this.currentTiles.length;o1?e-1:1),m=t.deltaLongitude()/(i>1?i-1:1),y=0;for(h=0,o=c;h=0;L--)if(s=this.levels.level(L),a=Math.round(360*s.tileWidth/s.tileDelta.longitude),l=Math.round(180*s.tileHeight/s.tileDelta.latitude),h=1/(2*l),u=1-h,c=0,p=l-1,f=a*d.fract(t),g=l*d.clamp(e,h,u),m=d.mod(Math.floor(f-.5),a),y=d.mod(m+1,a),E=d.clamp(Math.floor(g-.5),c,p),v=d.clamp(E+1,c,p),_=d.fract(f-.5),b=d.fract(g-.5),S=L==i||0==L,this.lookupPixels(m,y,E,v,s,S,w))return!n.isNoData(w[0],w[1],w[2],w[3])&&(r[o]=(1-_)*(1-b)*w[0]+_*(1-b)*w[1]+(1-_)*b*w[2]+_*b*w[3],!0);return!1},p.prototype.lookupPixels=function(t,e,i,r,n,o,s){var a,l,h,u,c=n.levelNumber,d=n.tileWidth,p=n.tileHeight,f=Math.floor(i/p),g=Math.floor(r/p),m=Math.floor(t/d),y=Math.floor(e/d);return f==g&&f==this.cachedRow&&m==y&&m==this.cachedCol?a=l=h=u=this.cachedImage:f==g&&m==y?(a=this.lookupImage(c,f,m,o),l=h=u=a,this.cachedRow=f,this.cachedCol=m,this.cachedImage=a):(a=this.lookupImage(c,f,m,o),l=this.lookupImage(c,f,y,o),h=this.lookupImage(c,g,m,o),u=this.lookupImage(c,g,y,o)),!!(a&&l&&h&&u)&&(s[0]=a.pixel(t%d,i%p),s[1]=l.pixel(e%d,i%p),s[2]=h.pixel(t%d,r%p),s[3]=u.pixel(e%d,r%p),!0)},p.prototype.lookupImage=function(t,e,i,r){var n=c.computeTileKey(t,e,i),o=this.imageCache.entryForKey(n);if(null==o&&r){var s=this.tileForLevel(t,e,i);this.retrieveTileImage(s)}return o},p.prototype.assembleTiles=function(t,e,i){if(this.currentTiles=[],this.currentSector.copy(e),this.currentSector.intersection(this.coverageSector),!this.currentSector.isEmpty())for(var r=t.tileDelta.latitude,n=t.tileDelta.longitude,o=c.computeRow(r,this.currentSector.minLatitude),s=c.computeLastRow(r,this.currentSector.maxLatitude),a=c.computeColumn(n,this.currentSector.minLongitude),l=c.computeLastColumn(n,this.currentSector.maxLongitude),h=o;h<=s;h++)for(var u=a;u<=l;u++)this.addTileOrAncestor(t,h,u,i)},p.prototype.addTileOrAncestor=function(t,e,i,r){var n=this.tileForLevel(t.levelNumber,e,i);this.isTileImageInMemory(n)?this.addToCurrentTiles(n):(r&&this.retrieveTileImage(n),t.isFirstLevel()?this.currentTiles.push(n):this.addAncestor(t,e,i,r))},p.prototype.addAncestor=function(t,e,i,r){for(var n=null,o=Math.floor(e/2),s=Math.floor(i/2),a=t.levelNumber-1;a>=0;a--){if(n=this.tileForLevel(a,o,s),this.isTileImageInMemory(n))return void this.addToCurrentTiles(n);o=Math.floor(o/2),s=Math.floor(s/2)}this.addToCurrentTiles(n),r&&this.retrieveTileImage(n)},p.prototype.addToCurrentTiles=function(t){this.currentTiles.push(t)},p.prototype.tileForLevel=function(t,e,i){var r=c.computeTileKey(t,e,i),n=this.tileCache.entryForKey(r);if(n)return n;var o=this.levels.level(t),s=c.computeSector(o,e,i);return n=new c(s,o,e,i),this.tileCache.putEntry(r,n,n.size()),n},p.prototype.isTileImageInMemory=function(t){return this.imageCache.containsKey(t.tileKey)},p.prototype.resourceUrlForTile=function(t){return this.urlBuilder.urlForTile(t,this.retrievalImageFormat)},p.prototype.retrieveTileImage=function(t){if(this.currentRetrievals.indexOf(t.tileKey)<0){if(this.currentRetrievals.length>this.retrievalQueueSize)return;var e=this.resourceUrlForTile(t,this.retrievalImageFormat),i=new XMLHttpRequest,r=this;if(!e)return;i.open("GET",e,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){if(4===i.readyState){r.removeFromCurrentRetrievals(t.tileKey);var n=i.getResponseHeader("content-type");if(200===i.status)if(n===r.retrievalImageFormat||"text/plain"===n||"application/octet-stream"===n){l.log(l.LEVEL_INFO,"Elevations retrieval succeeded: "+e),r.loadElevationImage(t,i),r.absentResourceList.unmarkResourceAbsent(t.tileKey);var o=document.createEvent("Event");o.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(o)}else"text/xml"===n?(r.absentResourceList.markResourceAbsent(t.tileKey),l.log(l.LEVEL_WARNING,"Elevations retrieval failed ("+i.statusText+"): "+e+".\n "+String.fromCharCode.apply(null,new Uint8Array(i.response)))):(r.absentResourceList.markResourceAbsent(t.tileKey),l.log(l.LEVEL_WARNING,"Elevations retrieval failed: "+e+". Unexpected content type "+n));else r.absentResourceList.markResourceAbsent(t.tileKey),l.log(l.LEVEL_WARNING,"Elevations retrieval failed ("+i.statusText+"): "+e)}},i.onerror=function(){r.removeFromCurrentRetrievals(t.tileKey),r.absentResourceList.markResourceAbsent(t.tileKey),l.log(l.LEVEL_WARNING,"Elevations retrieval failed: "+e)},i.ontimeout=function(){r.removeFromCurrentRetrievals(t.tileKey),r.absentResourceList.markResourceAbsent(t.tileKey),l.log(l.LEVEL_WARNING,"Elevations retrieval timed out: "+e)},i.send(null),this.currentRetrievals.push(t.tileKey)}},p.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},p.prototype.loadElevationImage=function(t,e){var i,r=new n(t.sector,t.tileWidth,t.tileHeight);"application/bil16"===this.retrievalImageFormat?(r.imageData=new Int16Array(e.response),r.size=2*r.imageData.length):"application/bil32"===this.retrievalImageFormat?(r.imageData=new Float32Array(e.response),r.size=4*r.imageData.length):"image/tiff"===this.retrievalImageFormat&&(i=new o(e.response),r.imageData=i.getImageData(),r.size=r.imageData.length*i.metadata.bitsPerSample[0]/8),r.imageData&&(r.findMinAndMaxElevation(),this.imageCache.putEntry(t.tileKey,r,r.size),this.timestamp=Date.now())},p}),i("util/WmsUrlBuilder",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i,r,n,o,s){if(!i||0===i.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","constructor","The WMS service address is missing."));if(!r||0===r.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","constructor","The WMS layer names are not specified."));this.serviceAddress=i,this.layerNames=r,this.styleNames=n?n:"",this.transparent=!0,this.wmsVersion=o&&o.length>0?o:"1.3.0",this.isWms130OrGreater=this.wmsVersion>="1.3.0",this.crs="EPSG:4326",this.timeString=s};return i.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","The image format is null or undefined."));var o=r.sector,s=i.fixGetMapString(this.serviceAddress);return s.search(/service=wms/i)<0&&(s+="service=WMS"),s+="&request=GetMap",s=s+"&version="+this.wmsVersion,s=s+"&transparent="+(this.transparent?"TRUE":"FALSE"),s=s+"&layers="+this.layerNames,s=s+"&styles="+this.styleNames,s=s+"&format="+n,s=s+"&width="+r.tileWidth,s=s+"&height="+r.tileHeight,this.timeString&&(s=s+"&time="+this.timeString),this.isWms130OrGreater?(s=s+"&crs="+this.crs,s+="&bbox=","CRS:84"===this.crs?(s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude):(s=s+o.minLatitude+","+o.minLongitude+",",s=s+o.maxLatitude+","+o.maxLongitude)):(s=s+"&srs="+this.crs,s+="&bbox=",s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude),s=s.replace(" ","%20")},i.fixGetMapString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","fixGetMapString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/),r<0&&(i+="&")),i},i}),i("globe/AsterV2ElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:new e(-83.0001,83.0001,-180,180),resolution:.000277777777778,retrievalImageFormat:"application/bil16",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/elev","aster_v2","","1.3.0")}),this.displayName="ASTER V2 Earth Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("shaders/AtmosphereProgram",["../error/ArgumentError","../shaders/GpuProgram","../util/Logger"],function(t,e,i){"use strict";var r=function(t,i,r,n){e.call(this,t,i,r,n),this.FRAGMODE_SKY=1,this.FRAGMODE_GROUND_PRIMARY=2,this.FRAGMODE_GROUND_SECONDARY=3,this.FRAGMODE_GROUND_PRIMARY_TEX_BLEND=4,this.altitude=16e4,this.rayleighScaleDepth=.25,this.fragModeLocation=this.uniformLocation(t,"fragMode"),this.mvpMatrixLocation=this.uniformLocation(t,"mvpMatrix"),this.texCoordMatrixLocation=this.uniformLocation(t,"texCoordMatrix"),this.vertexOriginLocation=this.uniformLocation(t,"vertexOrigin"),this.eyePointLocation=this.uniformLocation(t,"eyePoint"),this.eyeMagnitudeLocation=this.uniformLocation(t,"eyeMagnitude"),this.eyeMagnitude2Location=this.uniformLocation(t,"eyeMagnitude2"),this.lightDirectionLocation=this.uniformLocation(t,"lightDirection"),this.atmosphereRadiusLocation=this.uniformLocation(t,"atmosphereRadius"),this.atmosphereRadius2Location=this.uniformLocation(t,"atmosphereRadius2"),this.globeRadiusLocation=this.uniformLocation(t,"globeRadius"),this.scaleLocation=this.uniformLocation(t,"scale"),this.opacityLocation=this.uniformLocation(t,"opacity"),this.scaleDepthLocation=this.uniformLocation(t,"scaleDepth"),this.scaleOverScaleDepthLocation=this.uniformLocation(t,"scaleOverScaleDepth"),this.scratchArray9=new Float32Array(9)};return r.key="WorldWindGpuAtmosphereProgram",r.prototype=Object.create(e.prototype),r.prototype.getAltitude=function(){return this.altitude},r.prototype.loadFragMode=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadFragMode","missingFragMode"));e.uniform1i(this.fragModeLocation,r)},r.prototype.loadModelviewProjection=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadModelviewProjection","missingMatrix"));this.loadUniformMatrix(e,r,this.mvpMatrixLocation)},r.prototype.loadVertexOrigin=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadVertexOrigin","missingVector"));e.uniform3f(this.vertexOriginLocation,r[0],r[1],r[2])},r.prototype.loadLightDirection=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadLightDirection","missingVector"));e.uniform3f(this.lightDirectionLocation,r[0],r[1],r[2])},r.prototype.loadEyePoint=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadEyePoint","missingVector"));e.uniform3f(this.eyePointLocation,r[0],r[1],r[2]),e.uniform1f(this.eyeMagnitudeLocation,r.magnitude()),e.uniform1f(this.eyeMagnitude2Location,r.magnitudeSquared())},r.prototype.loadGlobeRadius=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadGlobeRadius","missingGlobeRadius"));var n=r,o=n+this.altitude;e.uniform1f(this.globeRadiusLocation,n),e.uniform1f(this.atmosphereRadiusLocation,o),e.uniform1f(this.atmosphereRadius2Location,o*o)},r.prototype.setScale=function(t){t.uniform1f(this.scaleLocation,1/this.getAltitude()),t.uniform1f(this.scaleDepthLocation,this.rayleighScaleDepth),t.uniform1f(this.scaleOverScaleDepthLocation,1/this.getAltitude()/this.rayleighScaleDepth)},r.prototype.loadTexMatrix=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadTexMatrix","missingMatrix"));r.columnMajorComponents(this.scratchArray9),e.uniformMatrix3fv(this.texCoordMatrixLocation,!1,this.scratchArray9)},r.prototype.loadOpacity=function(e,r){if(void 0===r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadOpacity","missingOpacity"));e.uniform1f(this.opacityLocation,r)},r}),i("shaders/GroundProgram",["../shaders/AtmosphereProgram"],function(t){"use strict";var e=function(e){var i="precision mediump int;\nconst int FRAGMODE_GROUND_PRIMARY_TEX_BLEND = 4;\nconst int SAMPLE_COUNT = 2;\nconst float SAMPLES = 2.0;\nconst float PI = 3.141592653589;\nconst float Kr = 0.0025;\nconst float Kr4PI = Kr * 4.0 * PI;\nconst float Km = 0.0015;\nconst float Km4PI = Km * 4.0 * PI;\nconst float ESun = 15.0;\nconst float KmESun = Km * ESun;\nconst float KrESun = Kr * ESun;\nconst vec3 invWavelength = vec3(5.60204474633241, 9.473284437923038, 19.643802610477206);\nconst float rayleighScaleDepth = 0.25;\nuniform int fragMode;\nuniform mat4 mvpMatrix;\nuniform mat3 texCoordMatrix;\nuniform vec3 vertexOrigin;\nuniform vec3 eyePoint;\nuniform float eyeMagnitude;\nuniform float eyeMagnitude2;\nuniform vec3 lightDirection;\nuniform float atmosphereRadius;\nuniform float atmosphereRadius2;\nuniform float globeRadius;\nuniform float scale;\nuniform float scaleDepth;\nuniform float scaleOverScaleDepth;\nuniform float opacity;\nattribute vec4 vertexPoint;\nattribute vec2 vertexTexCoord;\nvarying vec3 primaryColor;\nvarying vec3 secondaryColor;\nvarying vec2 texCoord;\nfloat scaleFunc(float cos) {\n float x = 1.0 - cos;\n return scaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nvoid sampleGround() {\n vec3 point = vertexPoint.xyz + vertexOrigin;\n vec3 ray = point - eyePoint;\n float far = length(ray);\n ray /= far;\n vec3 start;\n if (eyeMagnitude < atmosphereRadius) {\n start = eyePoint;\n } else {\n float B = 2.0 * dot(eyePoint, ray);\n float C = eyeMagnitude2 - atmosphereRadius2;\n float det = max(0.0, B*B - 4.0 * C);\n float near = 0.5 * (-B - sqrt(det));\n start = eyePoint + ray * near;\n far -= near;\n}\n float depth = exp((globeRadius - atmosphereRadius) / scaleDepth);\n float eyeAngle = dot(-ray, point) / length(point);\n float lightAngle = dot(lightDirection, point) / length(point);\n float eyeScale = scaleFunc(eyeAngle);\n float lightScale = scaleFunc(lightAngle);\n float eyeOffset = depth*eyeScale;\n float temp = (lightScale + eyeScale);\n float sampleLength = far / SAMPLES;\n float scaledLength = sampleLength * scale;\n vec3 sampleRay = ray * sampleLength;\n vec3 samplePoint = start + sampleRay * 0.5;\n vec3 frontColor = vec3(0.0, 0.0, 0.0);\n vec3 attenuate = vec3(0.0, 0.0, 0.0);\n for(int i=0; i=this.max_&&(this.max_*=2,this.keys_=r.PriorityQ.prototype.PQKeyRealloc_(this.keys_,this.max_)),this.keys_[e]=t,-(e+1)},r.PriorityQ.prototype.PQKeyRealloc_=function(t,e){var i=new Array(e),r=0;if(null!==t)for(;r0&&null===this.keys_[this.order_[this.size_-1]]);return t},r.PriorityQ.prototype.minimum=function(){if(0===this.size_)return this.heap_.minimum();var t=this.keys_[this.order_[this.size_-1]];if(!this.heap_.isEmpty()){var e=this.heap_.minimum();if(this.leq_(e,t))return e}return t},r.PriorityQ.prototype.isEmpty_=function(){return 0===this.size_&&this.heap_.isEmpty()},r.PriorityQ.prototype.remove=function(t){if(t>=0)return void this.heap_.remove(t);for(t=-(t+1),this.keys_[t]=null;this.size_>0&&null===this.keys_[this.order_[this.size_-1]];)--this.size_},r.PriorityQHeap=function(t){this.nodes_=r.PQNode.realloc(null,r.PriorityQHeap.INIT_SIZE_+1),this.handles_=r.PQHandleElem.realloc(null,r.PriorityQHeap.INIT_SIZE_+1),this.size_=0,this.max_=r.PriorityQHeap.INIT_SIZE_,this.freeList_=0,this.initialized_=!1,this.leq_=t,this.nodes_[1].handle=1},r.PriorityQHeap.INIT_SIZE_=32,r.PriorityQHeap.prototype.deleteHeap=function(){this.handles_=null,this.nodes_=null},r.PriorityQHeap.prototype.init=function(){for(var t=this.size_;t>=1;--t)this.floatDown_(t);this.initialized_=!0},r.PriorityQHeap.prototype.insert=function(t){var e=++this.size_;2*e>this.max_&&(this.max_*=2,this.nodes_=r.PQNode.realloc(this.nodes_,this.max_+1),this.handles_=r.PQHandleElem.realloc(this.handles_,this.max_+1));var i;return 0===this.freeList_?i=e:(i=this.freeList_,this.freeList_=this.handles_[i].node),this.nodes_[e].handle=i,this.handles_[i].node=e,this.handles_[i].key=t,this.initialized_&&this.floatUp_(e),i},r.PriorityQHeap.prototype.isEmpty=function(){return 0===this.size_},r.PriorityQHeap.prototype.minimum=function(){return this.handles_[this.nodes_[1].handle].key},r.PriorityQHeap.prototype.extractMin=function(){var t=this.nodes_,e=this.handles_,i=t[1].handle,r=e[i].key;return this.size_>0&&(t[1].handle=t[this.size_].handle,e[t[1].handle].node=1,e[i].key=null,e[i].node=this.freeList_,this.freeList_=i,--this.size_>0&&this.floatDown_(1)),r},r.PriorityQHeap.prototype.remove=function(t){var e=this.nodes_,i=this.handles_,r=i[t].node;e[r].handle=e[this.size_].handle,i[e[r].handle].node=r,r<=--this.size_&&(r<=1||this.leq_(i[e[r>>1].handle].key,i[e[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),i[t].key=null,i[t].node=this.freeList_,this.freeList_=t},r.PriorityQHeap.prototype.floatDown_=function(t){for(var e=this.nodes_,i=this.handles_,r=e[t].handle;;){var n=t<<1;nthis.size_||this.leq_(i[r].key,i[o].key)){e[t].handle=r,i[r].node=t;break}e[t].handle=o,i[o].node=t,t=n}},r.PriorityQHeap.prototype.floatUp_=function(t){for(var e=this.nodes_,i=this.handles_,r=e[t].handle;;){var n=t>>1,o=e[n].handle;if(0===n||this.leq_(i[o].key,i[r].key)){e[t].handle=r,i[r].node=t;break}e[t].handle=o,i[o].node=t,t=n}},r.ActiveRegion=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},r.ActiveRegion.prototype.regionBelow=function(){return this.nodeUp.getPredecessor().getKey()},r.ActiveRegion.prototype.regionAbove=function(){return this.nodeUp.getSuccessor().getKey()},"undefined"!=typeof module&&(module.exports=r),i("util/libtess",function(){}),i("util/measure/AreaMeasurer",["../../geom/Angle","../../error/ArgumentError","../../geom/Location","../Logger","./MeasurerUtils","../../geom/Sector","../../geom/Vec3","../libtess"],function(t,e,i,n,o,s,a,l){"use strict";var h=function(t){if(!t)throw new e(n.logMessage(n.LEVEL_SEVERE,"AreaMeasurer","constructor","missingWorldWindow"));this.wwd=t,this.DEFAULT_AREA_SAMPLING_STEPS=32,this._areaTerrainSamplingSteps=this.DEFAULT_AREA_SAMPLING_STEPS,this._maxSegmentLength=1e5,this.subdividedPositions=null,this.vecZ=new a(0,0,1),this.scratchLocation=new i(0,0)};return Object.defineProperties(h.prototype,{areaTerrainSamplingSteps:{get:function(){return this._areaTerrainSamplingSteps},set:function(t){this._areaTerrainSamplingSteps=t}},maxSegmentLength:{get:function(){return this._maxSegmentLength},set:function(t){this._maxSegmentLength=t}}}),h.prototype.getArea=function(t,e,i){var r=this.wwd.globe;return e?this.computeSurfaceAreaSampling(r,t,i):this.computeProjectedAreaGeometry(r,t,i)},h.prototype.computeSurfaceAreaSampling=function(e,i,r){var n=new s(0,0,0,0);n.setToBoundingSector(i),this.subdividedPositions=o.subdividePositions(e,i,!0,r,this._maxSegmentLength);for(var l=Math.max(this.DEFAULT_AREA_SAMPLING_STEPS,this._areaTerrainSamplingSteps),h=n.deltaLatitude()*t.DEGREES_TO_RADIANS,u=n.deltaLongitude()*t.DEGREES_TO_RADIANS,c=Math.max(h/l,u/l),d=Math.round(h/c),p=Math.round(u/c*Math.cos(n.centroidLatitude()*t.DEGREES_TO_RADIANS)),f=h/d,g=u/p,m=0,y=0;ythis.tryAgainInterval?(delete this.possiblyAbsent[t],!1):ithis.maxTrys},t.prototype.markResourceAbsent=function(t){var e=this.possiblyAbsent[t];e||(e={timeOfLastMark:Date.now(),numTrys:0},this.possiblyAbsent[t]=e),e.numTrys=e.numTrys+1,e.timeOfLastMark=Date.now()},t.prototype.markResourceAbsentPermanently=function(t){var e=this.possiblyAbsent[t];e||(e={timeOfLastMark:Date.now(),numTrys:0},this.possiblyAbsent[t]=e),e.numTrys=e.numTrys+1,e.timeOfLastMark=Date.now(),e.permanent=!0},t.prototype.unmarkResourceAbsent=function(t){var e=this.possiblyAbsent[t];e&&delete this.possiblyAbsent[t]},t}),i("globe/ElevationCoverage",["../error/ArgumentError","../util/Logger","../geom/Sector"],function(t,e,i){"use strict";var r=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationCoverage","constructor","missingResolution"));this.timestamp=Date.now(),this.displayName="Coverage",this._enabled=!0,this.resolution=r,this.coverageSector=i.FULL_SPHERE};return Object.defineProperties(r.prototype,{enabled:{get:function(){return this._enabled},set:function(t){this._enabled=t,this.timestamp=Date.now()}}}),r.prototype.minAndMaxElevationsForSector=function(i,r){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationCoverage","minAndMaxElevationsForSector","missingSector"));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationCoverage","minAndMaxElevationsForSector","missingResult"));return r[0]>0&&(r[0]=0),r[1]<0&&(r[1]=0),!0},r.prototype.elevationAtLocation=function(t,e){return 0},r.prototype.elevationsForGrid=function(i,r,n,o){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationCoverage","elevationsForGrid","missingSector"));if(r<=0||n<=0)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationCoverage","elevationsForGrid","numLat or numLon is less than 1"));if(!o||o.length=this.imageWidth?0:e<0||e>=this.imageHeight?0:(e=this.imageHeight-e-1,this.imageData[t+e*this.imageWidth])},r.prototype.elevationAtLocation=function(t,e){var n=this.sector.maxLatitude,o=this.sector.minLongitude,s=this.sector.deltaLatitude(),a=this.sector.deltaLongitude(),l=(this.imageWidth-1)*(e-o)/a,h=(this.imageHeight-1)*(n-t)/s,u=Math.floor(i.clamp(l,0,this.imageWidth-1)),c=Math.floor(i.clamp(u+1,0,this.imageWidth-1)),d=Math.floor(i.clamp(h,0,this.imageHeight-1)),p=Math.floor(i.clamp(d+1,0,this.imageHeight-1)),f=this.imageData,g=f[u+d*this.imageWidth],m=f[c+d*this.imageWidth],y=f[u+p*this.imageWidth],E=f[c+p*this.imageWidth],v=l-u,_=h-d;return r.isNoData(g,m,y,E)?NaN:(1-v)*(1-_)*g+v*(1-_)*m+(1-v)*_*y+v*_*E},r.prototype.elevationsForGrid=function(n,o,s,a){if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","missingSector"));if(o<1||s<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","The specified number of sample points is less than 1."));if(!a)throw new t(e.logMessage(e.LEVEL_SEVERE,"ElevationImage","elevationsForGrid","missingResult"));var l,h,u,c,d=this.sector.minLatitude,p=this.sector.maxLatitude,f=this.sector.minLongitude,g=this.sector.maxLongitude,m=p-d,y=g-f,E=n.minLatitude,v=n.maxLatitude,_=n.minLongitude,b=n.maxLongitude,w=(v-E)/(o>1?o-1:1),S=(b-_)/(s>1?s-1:1),L=0,T=this.imageData;for(c=0,l=E;c=d&&l<=p){var R=(this.imageHeight-1)*(p-l)/m,x=Math.floor(i.clamp(R,0,this.imageHeight-1)),M=Math.floor(i.clamp(x+1,0,this.imageHeight-1)),C=R-x;for(u=0,h=_;u=f&&h<=g&&isNaN(a[L])){var A=(this.imageWidth-1)*(h-f)/y,P=Math.floor(i.clamp(A,0,this.imageWidth-1)),O=Math.floor(i.clamp(P+1,0,this.imageWidth-1)),N=A-P,I=T[P+x*this.imageWidth],D=T[O+x*this.imageWidth],k=T[P+M*this.imageWidth],V=T[O+M*this.imageWidth];r.isNoData(I,D,k,V)?a[L]=NaN:a[L]=(1-N)*(1-C)*I+N*(1-C)*D+(1-N)*C*k+N*C*V}L++}}else L+=s},r.prototype.minAndMaxElevationsForSector=function(t){if(!this.hasData)return null;var e=[];if(t)if(t.contains(this.sector))e[0]>this.minElevation&&(e[0]=this.minElevation),e[1]_&&(m=_),y<_&&(y=_)}e[0]>m&&(e[0]=m),e[1]0){this.minElevation=Number.MAX_VALUE,this.maxElevation=-Number.MAX_VALUE;for(var t=this.imageData,e=this.imageWidth*this.imageHeight,i=0;in&&(this.minElevation=n),this.maxElevation>>8:i.getUint32(r,o)>>>8;if(n<=4)return s?i.getInt32(r,o):i.getUint32(r,o);if(n<=8)return i.getFloat64(r,o);throw new t(e.logMessage(e.LEVEL_SEVERE,"GeoTiffReader","getBytes","tooManyBytesRequested"))},getSampleBytes:function(t,r,n,o,s){var a;switch(o){case i.SampleFormat.UNSIGNED:a=this.getBytes(t,r,n,s,!1);break;case i.SampleFormat.SIGNED:a=this.getBytes(t,r,n,s,!0);break;case i.SampleFormat.IEEE_FLOAT:3==n?a=t.getFloat32(r,s)>>>8:4==n?a=t.getFloat32(r,s):8==n?a=t.getFloat64(r,s):e.log(e.LEVEL_WARNING,"Do not attempt to parse the data not handled: "+n);break;case i.SampleFormat.UNDEFINED:default:a=this.getBytes(t,r,n,s,!1)}return a},getRGBAFillValue:function(t,e,i,r){return"undefined"==typeof r&&(r=1),"rgba("+t+", "+e+", "+i+", "+r+")"},clampColorSample:function(t,e){var i=Math.pow(2,8-e);return Math.floor(t*i+(i-1))}};return r}),i("util/proj4-src",[],function(){"use strict";function t(t,e){if(t[e])return t[e];for(var i,r,n=Object.keys(t),o=e.toLowerCase().replace(Be,""),s=-1;++s0?90:-90),t.lat_ts=t.lat1)}function l(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?l[t]=Ue(arguments[1]):l[t]=ei(arguments[1]):l[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){Array.isArray(t)?l.apply(e,t):l(t)});if("string"==typeof t){if(t in l)return l[t]}else"EPSG"in t?l["EPSG:"+t.EPSG]=t:"ESRI"in t?l["ESRI:"+t.ESRI]=t:"IAU2000"in t?l["IAU2000:"+t.IAU2000]=t:console.log(t);return}}function h(t){return"string"==typeof t}function u(t){return t in l}function c(t){return ii.some(function(e){return t.indexOf(e)>-1})}function d(t){return"+"===t[0]}function p(t){ +return h(t)?u(t)?l[t]:c(t)?ei(t):d(t)?Ue(t):void 0:t}function f(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=ni(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function g(t){var e=t.x,i=t.y;if(i*De>90&&i*De<-90&&e*De>180&&e*De<-180)return null;var r,n;if(Math.abs(Math.abs(i)-Ce)<=Ne)return null;if(this.sphere)r=this.x0+this.a*this.k0*si(e-this.long0),n=this.y0+this.a*this.k0*Math.log(Math.tan(ke+.5*i));else{var o=Math.sin(i),s=ai(this.e,i,o);r=this.x0+this.a*this.k0*si(e-this.long0),n=this.y0-this.a*this.k0*Math.log(s)}return t.x=r,t.y=n,t}function m(t){var e,i,r=t.x-this.x0,n=t.y-this.y0;if(this.sphere)i=Ce-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var o=Math.exp(-n/(this.a*this.k0));if(i=li(this.e,o),i===-9999)return null}return e=si(this.long0+r/(this.a*this.k0)),t.x=e,t.y=i,t}function y(){}function E(t){return t}function v(t,e){var i=gi.length;return t.names?(gi[i]=t,t.names.forEach(function(t){fi[t.toLowerCase()]=i}),this):(console.log(e),!0)}function _(t){if(!t)return!1;var e=t.toLowerCase();return"undefined"!=typeof fi[e]&&gi[fi[e]]?gi[fi[e]]:void 0}function b(){pi.forEach(v)}function w(t,e,i,r){var n=t*t,o=e*e,s=(n-o)/n,a=0;r?(t*=1-s*(Ae+s*(Pe+s*Oe)),n=t*t,s=0):a=Math.sqrt(s);var l=(n-o)/o;return{es:s,e:a,ep2:l}}function S(e,i,r,n,o){if(!e){var s=t(yi,n);s||(s=Ei),e=s.a,i=s.b,r=s.rf}return r&&!i&&(i=(1-1/r)*e),(0===r||Math.abs(e-i)3&&(0===s.datum_params[3]&&0===s.datum_params[4]&&0===s.datum_params[5]&&0===s.datum_params[6]||(s.datum_type=Te,s.datum_params[3]*=Me,s.datum_params[4]*=Me,s.datum_params[5]*=Me,s.datum_params[6]=s.datum_params[6]/1e6+1))),s.a=i,s.b=r,s.es=n,s.ep2=o,s}function T(e,i){if(!(this instanceof T))return new T(e);i=i||function(t){if(t)throw t};var r=p(e);if("object"!=typeof r)return void i(e);var n=T.projections.get(r.projName);if(!n)return void i(e);if(r.datumCode&&"none"!==r.datumCode){var o=t(vi,r.datumCode);o&&(r.datum_params=o.towgs84?o.towgs84.split(","):null,r.ellps=o.ellipse,r.datumName=o.datumName?o.datumName:r.datumCode)}r.k0=r.k0||1,r.axis=r.axis||"enu",r.ellps=r.ellps||"wgs84";var s=S(r.a,r.b,r.rf,r.ellps,r.sphere),a=w(s.a,s.b,s.rf,r.R_A),l=r.datum||L(r.datumCode,r.datum_params,s.a,s.b,a.es,a.ep2);ri(this,r),ri(this,n),this.a=s.a,this.b=s.b,this.rf=s.rf,this.sphere=s.sphere,this.es=a.es,this.e=a.e,this.ep2=a.ep2,this.datum=l,this.init(),i(null,this)}function R(t,e){return t.datum_type===e.datum_type&&(!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(t.datum_type===Le?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type!==Te||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6]))}function x(t,e,i){var r,n,o,s,a=t.x,l=t.y,h=t.z?t.z:0;if(l<-Ce&&l>-1.001*Ce)l=-Ce;else if(l>Ce&&l<1.001*Ce)l=Ce;else if(l<-Ce||l>Ce)return null;return a>Math.PI&&(a-=2*Math.PI),n=Math.sin(l),s=Math.cos(l),o=n*n,r=i/Math.sqrt(1-e*o),{x:(r+h)*s*Math.cos(a),y:(r+h)*s*Math.sin(a),z:(r*(1-e)+h)*n}}function M(t,e,i,r){var n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_=1e-12,b=_*_,w=30,S=t.x,L=t.y,T=t.z?t.z:0;if(n=Math.sqrt(S*S+L*L),o=Math.sqrt(S*S+L*L+T*T),n/i<_){if(y=0,o/i<_)return E=Ce,v=-r,{x:t.x,y:t.y,z:t.z}}else y=Math.atan2(L,S);s=T/o,a=n/o,l=1/Math.sqrt(1-e*(2-e)*a*a),c=a*(1-e)*l,d=s*l,m=0;do m++,u=i/Math.sqrt(1-e*d*d),v=n*c+T*d-u*(1-e*d*d),h=e*u/(u+v),l=1/Math.sqrt(1-h*(2-h)*a*a),p=a*(1-h)*l,f=s*l,g=f*c-p*d,c=p,d=f;while(g*g>b&&m=56&&u<64&&c>=3&&c<12&&(h=32),u>=72&&u<84&&(c>=0&&c<9?h=31:c>=9&&c<21?h=33:c>=21&&c<33?h=35:c>=33&&c<42&&(h=37)),e=6*(h-1)-180+3,l=W(e),i=p/(1-p),r=d/Math.sqrt(1-p*Math.sin(g)*Math.sin(g)),n=Math.tan(g)*Math.tan(g),o=i*Math.cos(g)*Math.cos(g),s=Math.cos(g)*(m-l),a=d*((1-p/4-3*p*p/64-5*p*p*p/256)*g-(3*p/8+3*p*p/32+45*p*p*p/1024)*Math.sin(2*g)+(15*p*p/256+45*p*p*p/1024)*Math.sin(4*g)-35*p*p*p/3072*Math.sin(6*g));var y=f*r*(s+(1-n+o)*s*s*s/6+(5-18*n+n*n+72*o-58*i)*s*s*s*s*s/120)+5e5,E=f*(a+r*Math.tan(g)*(s*s/2+(5-n+9*o+4*o*o)*s*s*s*s/24+(61-58*n+n*n+600*o-330*i)*s*s*s*s*s*s/720));return u<0&&(E+=1e7),{northing:Math.round(E),easting:Math.round(y),zoneNumber:h,zoneLetter:j(u)}}function K(t){var e=t.northing,i=t.easting,r=t.zoneLetter,n=t.zoneNumber;if(n<0||n>60)return null;var o,s,a,l,h,u,c,d,p,f,g=.9996,m=6378137,y=.00669438,E=(1-Math.sqrt(1-y))/(1+Math.sqrt(1-y)),v=i-5e5,_=e;r<"N"&&(_-=1e7),d=6*(n-1)-180+3,o=y/(1-y),c=_/g,p=c/(m*(1-y/4-3*y*y/64-5*y*y*y/256)),f=p+(3*E/2-27*E*E*E/32)*Math.sin(2*p)+(21*E*E/16-55*E*E*E*E/32)*Math.sin(4*p)+151*E*E*E/96*Math.sin(6*p),s=m/Math.sqrt(1-y*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),l=o*Math.cos(f)*Math.cos(f),h=m*(1-y)/Math.pow(1-y*Math.sin(f)*Math.sin(f),1.5),u=v/(s*g);var b=f-s*Math.tan(f)/h*(u*u/2-(5+3*a+10*l-4*l*l-9*o)*u*u*u*u/24+(61+90*a+298*l+45*a*a-252*o-3*l*l)*u*u*u*u*u*u/720);b=B(b);var w=(u-(1+2*a+l)*u*u*u/6+(5-2*l+28*a-3*l*l+8*o+24*a*a)*u*u*u*u*u/120)/Math.cos(f);w=d+B(w);var S;if(t.accuracy){var L=K({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});S={top:L.lat,right:L.lon,bottom:b,left:w}}else S={lat:b,lon:w};return S}function j(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function z(t,e){var i="00000"+t.easting,r="00000"+t.northing;return t.zoneNumber+t.zoneLetter+H(t.easting,t.northing,t.zoneNumber)+i.substr(i.length-5,e)+r.substr(r.length-5,e)}function H(t,e,i){var r=q(i),n=Math.floor(t/1e5),o=Math.floor(e/1e5)%20;return Y(n,o,r)}function q(t){var e=t%Li;return 0===e&&(e=Li),e}function Y(t,e,i){var r=i-1,n=Ti.charCodeAt(r),o=Ri.charCodeAt(r),s=n+t-1,a=o+e,l=!1;s>Pi&&(s=s-Pi+xi-1,l=!0),(s===Mi||nMi||(s>Mi||nCi||(s>Ci||nPi&&(s=s-Pi+xi-1),a>Ai?(a=a-Ai+xi-1,l=!0):l=!1,(a===Mi||oMi||(a>Mi||oCi||(a>Ci||oAi&&(a=a-Ai+xi-1);var h=String.fromCharCode(s)+String.fromCharCode(a);return h}function X(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,r=null,n="",o=0;!/[A-Z]/.test(e=t.charAt(o));){if(o>=2)throw"MGRSPoint bad conversion from: "+t;n+=e,o++}var s=parseInt(n,10);if(0===o||o+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(o++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;r=t.substring(o,o+=2);for(var l=q(s),h=J(r.charAt(0),l),u=Z(r.charAt(1),l);u0&&(d=1e5/Math.pow(10,y),p=t.substring(o,o+y),E=parseFloat(p)*d,f=t.substring(o+y),v=parseFloat(f)*d),g=E+h,m=v+u,{easting:g,northing:m,zoneLetter:a,zoneNumber:s,accuracy:d}}function J(t,e){for(var i=Ti.charCodeAt(e-1),r=1e5,n=!1;i!==t.charCodeAt(0);){if(i++,i===Mi&&i++,i===Ci&&i++,i>Pi){if(n)throw"Bad character: "+t;i=xi,n=!0}r+=1e5}return r}function Z(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=Ri.charCodeAt(e-1),r=0,n=!1;i!==t.charCodeAt(0);){if(i++,i===Mi&&i++,i===Ci&&i++,i>Ai){if(n)throw"Bad character: "+t;i=xi,n=!0}r+=1e5}return r}function Q(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function $(t,e,i){if(!(this instanceof $))return new $(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&"undefined"==typeof e){var r=t.split(",");this.x=parseFloat(r[0],10),this.y=parseFloat(r[1],10),this.z=parseFloat(r[2],10)||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}function tt(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=Hi(this.es),this.ml0=qi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function et(t){var e,i,r,n=t.x,o=t.y,s=si(n-this.long0),a=Math.sin(o),l=Math.cos(o);if(this.es){var h=l*s,u=Math.pow(h,2),c=this.ep2*Math.pow(l,2),d=Math.pow(c,2),p=Math.abs(l)>Ne?Math.tan(o):0,f=Math.pow(p,2),g=Math.pow(f,2);e=1-this.es*Math.pow(a,2),h/=Math.sqrt(e);var m=qi(o,a,l,this.en);i=this.a*(this.k0*h*(1+u/6*(1-f+c+u/20*(5-18*f+g+14*c-58*f*c+u/42*(61+179*g-g*f-479*f)))))+this.x0,r=this.a*(this.k0*(m-this.ml0+a*s*h/2*(1+u/12*(5-f+9*c+4*d+u/30*(61+g-58*f+270*c-330*f*c+u/56*(1385+543*g-g*f-3111*f))))))+this.y0}else{var y=l*Math.sin(s);if(Math.abs(Math.abs(y)-1)=1){if(y-1>Ne)return 93;r=0}else r=Math.acos(r);o<0&&(r=-r),r=this.a*this.k0*(r-this.lat0)+this.y0}return t.x=i,t.y=r,t}function it(t){var e,i,r,n,o=(t.x-this.x0)*(1/this.a),s=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+s/this.k0,i=Xi(e,this.es,this.en),Math.abs(i)Ne?Math.tan(i):0,u=this.ep2*Math.pow(l,2),c=Math.pow(u,2),d=Math.pow(h,2),p=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var f=o*Math.sqrt(e)/this.k0,g=Math.pow(f,2);e*=h,r=i-e*g/(1-this.es)*.5*(1-g/12*(5+3*d-9*u*d+u-4*c-g/30*(61+90*d-252*u*d+45*p+46*u-g/56*(1385+3633*d+4095*p+1574*p*d)))),n=si(this.long0+f*(1-g/6*(1+2*d+u-g/20*(5+28*d+24*p+8*u*d+6*u-g/42*(61+662*d+1320*p+720*p*d))))/l)}else r=Ce*oi(s),n=0;else{var m=Math.exp(o/this.k0),y=.5*(m-1/m),E=this.lat0+s/this.k0,v=Math.cos(E);e=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(y,2))),r=Math.asin(e),s<0&&(r=-r),n=0===y&&0===v?0:si(Math.atan2(y,v)+this.long0)}return t.x=n,t.y=r,t}function rt(){if(void 0===this.es||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),i*=e,this.cgb[1]=i*(7/3+e*(-1.6+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(-2.4+e*(-24832/14175))),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(.25+i*(1/64+i/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(-.6+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*-.03233083094085698,this.gtu[5]=.6650675310896665*i;var r=ir(this.cbg,this.lat0);this.Zb=-this.Qn*(r+rr(this.gtu,2*r))}function nt(t){var e=si(t.x-this.long0),i=t.y;i=ir(this.cbg,i);var r=Math.sin(i),n=Math.cos(i),o=Math.sin(e),s=Math.cos(e);i=Math.atan2(r,s*n),e=Math.atan2(o*n,$i(r,n*s)),e=er(Math.tan(e));var a=or(this.gtu,2*i,2*e);i+=a[0],e+=a[1];var l,h;return Math.abs(e)<=2.623395162778?(l=this.a*(this.Qn*e)+this.x0,h=this.a*(this.Qn*i+this.Zb)+this.y0):(l=1/0,h=1/0),t.x=l,t.y=h,t}function ot(t){var e=(t.x-this.x0)*(1/this.a),i=(t.y-this.y0)*(1/this.a);i=(i-this.Zb)/this.Qn,e/=this.Qn;var r,n;if(Math.abs(e)<=2.623395162778){var o=or(this.utg,2*i,2*e);i+=o[0],e+=o[1],e=Math.atan(Qi(e));var s=Math.sin(i),a=Math.cos(i),l=Math.sin(e),h=Math.cos(e);i=Math.atan2(s*h,$i(l,h*a)),e=Math.atan2(l,h*a),r=si(e+this.long0),n=ir(this.cgb,i)}else r=1/0,n=1/0;return t.x=r,t.y=n,t}function st(){var t=lr(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*Ie,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,ar.init.apply(this),this.forward=ar.forward,this.inverse=ar.inverse}function at(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+ke)/(Math.pow(Math.tan(.5*this.lat0+ke),this.C)*dr(this.e*t,this.ratexp))}function lt(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+ke),this.C)*dr(this.e*Math.sin(i),this.ratexp))-Ce,t.x=this.C*e,t}function ht(t){for(var e=1e-14,i=t.x/this.C,r=t.y,n=Math.pow(Math.tan(.5*r+ke)/this.K,1/this.C),o=pr;o>0&&(r=2*Math.atan(n*dr(this.e*Math.sin(t.y),-.5*this.e))-Ce,!(Math.abs(r-t.y)0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Ne&&(this.k0=.5*this.cons*ni(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/ai(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=ni(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-Ce,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function gt(t){var e,i,r,n,o,s,a=t.x,l=t.y,h=Math.sin(l),u=Math.cos(l),c=si(a-this.long0);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=Ne&&Math.abs(l+this.lat0)<=Ne?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*h+this.coslat0*u*Math.cos(c)),t.x=this.a*e*u*Math.sin(c)+this.x0,t.y=this.a*e*(this.coslat0*h-this.sinlat0*u*Math.cos(c))+this.y0,t):(i=2*Math.atan(this.ssfn_(l,h,this.e))-Ce,n=Math.cos(i),r=Math.sin(i),Math.abs(this.coslat0)<=Ne?(o=ai(this.e,l*this.con,this.con*h),s=2*this.a*this.k0*o/this.cons,t.x=this.x0+s*Math.sin(a-this.long0),t.y=this.y0-this.con*s*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)0?this.long0+Math.atan2(t.x,-1*t.y):this.long0+Math.atan2(t.x,t.y):this.long0+Math.atan2(t.x*Math.sin(a),s*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a))),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=Ne){if(s<=Ne)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,r=s*this.cons/(2*this.a*this.k0),i=this.con*li(this.e,r),e=this.con*si(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else n=2*Math.atan(s*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,s<=Ne?o=this.X0:(o=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/s),e=si(this.long0+Math.atan2(t.x*Math.sin(n),s*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)))),i=-1*li(this.e,Math.tan(.5*(Ce+o)));return t.x=e,t.y=i,t}function yt(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,r=this.rf,n=1/r,o=2*n-Math.pow(n,2),s=this.e=Math.sqrt(o);this.R=this.k0*i*Math.sqrt(1-o)/(1-o*Math.pow(e,2)),this.alpha=Math.sqrt(1+o/(1-o)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+s*e)/(1-s*e));this.K=a-this.alpha*l+this.alpha*s/2*h}function Et(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),r=-this.alpha*(e+i)+this.K,n=2*(Math.atan(Math.exp(r))-Math.PI/4),o=this.alpha*(t.x-this.lambda0),s=Math.atan(Math.sin(o)/(Math.sin(this.b0)*Math.tan(n)+Math.cos(this.b0)*Math.cos(o))),a=Math.asin(Math.cos(this.b0)*Math.sin(n)-Math.sin(this.b0)*Math.cos(n)*Math.cos(o));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*s+this.x0,t}function vt(t){for(var e=t.x-this.x0,i=t.y-this.y0,r=e/this.R,n=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),o=Math.asin(Math.cos(this.b0)*Math.sin(n)+Math.sin(this.b0)*Math.cos(n)*Math.cos(r)),s=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(n))),a=this.lambda0+s/this.alpha,l=0,h=o,u=-1e3,c=0;Math.abs(h-u)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+o/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=a,t.y=h,t}function _t(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var t=Math.sin(this.lat0),e=Math.cos(this.lat0),i=this.e*t;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(e,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-i*i);var r=ai(this.e,this.lat0,t),n=this.bl/e*Math.sqrt((1-this.es)/(1-i*i));n*n<1&&(n=1);var o,s;if(isNaN(this.longc)){var a=ai(this.e,this.lat1,Math.sin(this.lat1)),l=ai(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(n+Math.sqrt(n*n-1))*Math.pow(r,this.bl):this.el=(n-Math.sqrt(n*n-1))*Math.pow(r,this.bl);var h=Math.pow(a,this.bl),u=Math.pow(l,this.bl);o=this.el/h,s=.5*(o-1/o);var c=(this.el*this.el-u*h)/(this.el*this.el+u*h),d=(u-h)/(u+h),p=si(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(c*Math.tan(.5*this.bl*p)/d)/this.bl,this.long0=si(this.long0);var f=si(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*f)/s),this.alpha=Math.asin(n*Math.sin(this.gamma0))}else o=this.lat0>=0?n+Math.sqrt(n*n-1):n-Math.sqrt(n*n-1),this.el=o*Math.pow(r,this.bl),s=.5*(o-1/o),this.gamma0=Math.asin(Math.sin(this.alpha)/n),this.long0=this.longc-Math.asin(s*Math.tan(this.gamma0))/this.bl;this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(n*n-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(n*n-1),Math.cos(this.alpha))}function bt(t){var e,i,r,n=t.x,o=t.y,s=si(n-this.long0);if(Math.abs(Math.abs(o)-Ce)<=Ne)r=o>0?-1:1,i=this.al/this.bl*Math.log(Math.tan(ke+r*this.gamma0*.5)),e=-1*r*Ce*this.al/this.bl;else{var a=ai(this.e,o,Math.sin(o)),l=this.el/Math.pow(a,this.bl),h=.5*(l-1/l),u=.5*(l+1/l),c=Math.sin(this.bl*s),d=(h*Math.sin(this.gamma0)-c*Math.cos(this.gamma0))/u;i=Math.abs(Math.abs(d)-1)<=Ne?Number.POSITIVE_INFINITY:.5*this.al*Math.log((1-d)/(1+d))/this.bl,e=Math.abs(Math.cos(this.bl*s))<=Ne?this.al*this.bl*s:this.al*Math.atan2(h*Math.cos(this.gamma0)+c*Math.sin(this.gamma0),Math.cos(this.bl*s))/this.bl}return this.no_rot?(t.x=this.x0+e,t.y=this.y0+i):(e-=this.uc,t.x=this.x0+i*Math.cos(this.alpha)+e*Math.sin(this.alpha),t.y=this.y0+e*Math.cos(this.alpha)-i*Math.sin(this.alpha)),t}function wt(t){var e,i;this.no_rot?(i=t.y-this.y0,e=t.x-this.x0):(i=(t.x-this.x0)*Math.cos(this.alpha)-(t.y-this.y0)*Math.sin(this.alpha),e=(t.y-this.y0)*Math.cos(this.alpha)+(t.x-this.x0)*Math.sin(this.alpha),e+=this.uc);var r=Math.exp(-1*this.bl*i/this.al),n=.5*(r-1/r),o=.5*(r+1/r),s=Math.sin(this.bl*e/this.al),a=(s*Math.cos(this.gamma0)+n*Math.sin(this.gamma0))/o,l=Math.pow(this.el/Math.sqrt((1+a)/(1-a)),1/this.bl);return Math.abs(a-1)Ne?this.ns=Math.log(r/a)/Math.log(n/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=r/(this.ns*Math.pow(n,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Lt(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=Ne&&(i=oi(i)*(Ce-2*Ne));var r,n,o=Math.abs(Math.abs(i)-Ce);if(o>Ne)r=ai(this.e,i,Math.sin(i)),n=this.a*this.f0*Math.pow(r,this.ns);else{if(o=i*this.ns,o<=0)return null;n=0}var s=this.ns*si(e-this.long0);return t.x=this.k0*(n*Math.sin(s))+this.x0,t.y=this.k0*(this.rh-n*Math.cos(s))+this.y0,t}function Tt(t){var e,i,r,n,o,s=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(s*s+a*a),i=1):(e=-Math.sqrt(s*s+a*a),i=-1);var l=0;if(0!==e&&(l=Math.atan2(i*s,i*a)),0!==e||this.ns>0){if(i=1/this.ns,r=Math.pow(e/(this.a*this.f0),i),n=li(this.e,r),n===-9999)return null}else n=-Ce;return o=si(l/this.ns+this.long0),t.x=o,t.y=n,t}function Rt(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function xt(t){var e,i,r,n,o,s,a,l=t.x,h=t.y,u=si(l-this.long0);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),r=-u*this.alfa,n=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(r)),o=Math.asin(Math.cos(i)*Math.sin(r)/Math.cos(n)),s=this.n*o,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(n/2+this.s45),this.n),t.y=a*Math.cos(s)/1,t.x=a*Math.sin(s)/1,this.czech||(t.y*=-1,t.x*=-1),t}function Mt(t){var e,i,r,n,o,s,a,l,h=t.x;t.x=t.y,t.y=h,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),o=Math.atan2(t.y,t.x),n=o/Math.sin(this.s0),r=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(n)),i=Math.asin(Math.cos(r)*Math.sin(n)/Math.cos(e)),t.x=this.long0-i/this.alfa,a=e,l=0;var u=0;do t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-t.y)<1e-10&&(l=1),a=t.y,u+=1;while(0===l&&u<15);return u>=15?null:t}function Ct(){this.sphere||(this.e0=Cr(this.es),this.e1=Ar(this.es),this.e2=Pr(this.es),this.e3=Or(this.es),this.ml0=this.a*Mr(this.e0,this.e1,this.e2,this.e3,this.lat0))}function At(t){var e,i,r=t.x,n=t.y;if(r=si(r-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(n)*Math.sin(r)),i=this.a*(Math.atan2(Math.tan(n),Math.cos(r))-this.lat0);else{var o=Math.sin(n),s=Math.cos(n),a=Nr(this.a,this.e,o),l=Math.tan(n)*Math.tan(n),h=r*Math.cos(n),u=h*h,c=this.es*s*s/(1-this.es),d=this.a*Mr(this.e0,this.e1,this.e2,this.e3,n);e=a*h*(1-u*l*(1/6-(8-l+8*c)*u/120)),i=d-this.ml0+a*o/s*u*(.5+(5-l+6*c)*u/24)}return t.x=e+this.x0,t.y=i+this.y0,t}function Pt(t){t.x-=this.x0,t.y-=this.y0;var e,i,r=t.x/this.a,n=t.y/this.a;if(this.sphere){var o=n+this.lat0;e=Math.asin(Math.sin(o)*Math.cos(r)),i=Math.atan2(Math.tan(r),Math.cos(o))}else{var s=this.ml0/this.a+n,a=Dr(s,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-Ce)<=Ne)return t.x=this.long0,t.y=Ce,n<0&&(t.y*=-1),t;var l=Nr(this.a,this.e,Math.sin(a)),h=l*l*l/this.a/this.a*(1-this.es),u=Math.pow(Math.tan(a),2),c=r*this.a/l,d=c*c;e=a-l*Math.tan(a)/h*c*c*(.5-(1+3*u)*c*c/24),i=c*(1-d*(u/3+(1+3*u)*u*d/15))/Math.cos(a)}return t.x=si(i+this.long0),t.y=Ir(e),t}function Ot(){var t=Math.abs(this.lat0);if(Math.abs(t-Ce)0){var e;switch(this.qp=Fr(this.e,1),this.mmf=.5/(1-this.es),this.apa=Dt(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=Fr(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Nt(t){var e,i,r,n,o,s,a,l,h,u,c=t.x,d=t.y;if(c=si(c-this.long0),this.sphere){if(o=Math.sin(d),u=Math.cos(d),r=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(i=this.mode===this.EQUIT?1+u*r:1+this.sinph0*o+this.cosph0*u*r,i<=Ne)return null;i=Math.sqrt(2/i),e=i*u*Math.sin(c),i*=this.mode===this.EQUIT?o:this.cosph0*o-this.sinph0*u*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),Math.abs(d+this.phi0)=0?(e=(h=Math.sqrt(s))*n,i=r*(this.mode===this.S_POLE?h:-h)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t}function It(t){t.x-=this.x0,t.y-=this.y0;var e,i,r,n,o,s,a,l=t.x/this.a,h=t.y/this.a;if(this.sphere){var u,c=0,d=0;if(u=Math.sqrt(l*l+h*h),i=.5*u,i>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(d=Math.sin(i),c=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(u)<=Ne?0:Math.asin(h*d/u),l*=d,h=c*u;break;case this.OBLIQ:i=Math.abs(u)<=Ne?this.phi0:Math.asin(c*this.sinph0+h*d*this.cosph0/u),l*=d*this.cosph0,h=(c-Math.sin(i)*this.sinph0)*u;break;case this.N_POLE:h=-h,i=Ce-i;break;case this.S_POLE:i-=Ce}e=0!==h||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(l,h):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){ +if(l/=this.dd,h*=this.dd,s=Math.sqrt(l*l+h*h),sNe?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Ft(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var r=Fr(this.e3,this.sin_phi,this.cos_phi),n=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,o=this.ns0*si(e-this.long0),s=n*Math.sin(o)+this.x0,a=this.rh-n*Math.cos(o)+this.y0;return t.x=s,t.y=a,t}function Gt(t){var e,i,r,n,o,s;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),r=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),r=-1),n=0,0!==e&&(n=Math.atan2(r*t.x,r*t.y)),r=e*this.ns0/this.a,this.sphere?s=Math.asin((this.c-r*r)/(2*this.ns0)):(i=(this.c-r*r)/this.ns0,s=this.phi1z(this.e3,i)),o=si(n/this.ns0+this.long0),t.x=o,t.y=s,t}function Wt(t,e){var i,r,n,o,s,a=Zr(.5*e);if(t0||Math.abs(s)<=Ne?(a=this.x0+this.a*o*i*Math.sin(r)/s,l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*i*n)/s):(a=this.x0+this.infinity_dist*i*Math.sin(r),l=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=l,t}function Kt(t){var e,i,r,n,o,s;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(n=Math.atan2(e,this.rc),i=Math.sin(n),r=Math.cos(n),s=Zr(r*this.sin_p14+t.y*i*this.cos_p14/e),o=Math.atan2(t.x*i,e*this.cos_p14*r-t.y*this.sin_p14*i),o=si(this.long0+o)):(s=this.phic0,o=0),t.x=o,t.y=s,t}function jt(){this.sphere||(this.k0=ni(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function zt(t){var e,i,r=t.x,n=t.y,o=si(r-this.long0);if(this.sphere)e=this.x0+this.a*o*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var s=Fr(this.e,Math.sin(n));e=this.x0+this.a*this.k0*o,i=this.y0+this.a*s*.5/this.k0}return t.x=e,t.y=i,t}function Ht(t){t.x-=this.x0,t.y-=this.y0;var e,i;return this.sphere?(e=si(this.long0+t.x/this.a/Math.cos(this.lat_ts)),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=rn(this.e,2*t.y*this.k0/this.a),e=si(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=i,t}function qt(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function Yt(t){var e=t.x,i=t.y,r=si(e-this.long0),n=Ir(i-this.lat0);return t.x=this.x0+this.a*r*this.rc,t.y=this.y0+this.a*n,t}function Xt(t){var e=t.x,i=t.y;return t.x=si(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=Ir(this.lat0+(i-this.y0)/this.a),t}function Jt(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Cr(this.es),this.e1=Ar(this.es),this.e2=Pr(this.es),this.e3=Or(this.es),this.ml0=this.a*Mr(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Zt(t){var e,i,r,n=t.x,o=t.y,s=si(n-this.long0);if(r=s*Math.sin(o),this.sphere)Math.abs(o)<=Ne?(e=this.a*s,i=-1*this.a*this.lat0):(e=this.a*Math.sin(r)/Math.tan(o),i=this.a*(Ir(o-this.lat0)+(1-Math.cos(r))/Math.tan(o)));else if(Math.abs(o)<=Ne)e=this.a*s,i=-1*this.ml0;else{var a=Nr(this.a,this.e,Math.sin(o))/Math.tan(o);e=a*Math.sin(r),i=this.a*Mr(this.e0,this.e1,this.e2,this.e3,o)-this.ml0+a*(1-Math.cos(r))}return t.x=e+this.x0,t.y=i+this.y0,t}function Qt(t){var e,i,r,n,o,s,a,l,h;if(r=t.x-this.x0,n=t.y-this.y0,this.sphere)if(Math.abs(n+this.a*this.lat0)<=Ne)e=si(r/this.a+this.long0),i=0;else{s=this.lat0+n/this.a,a=r*r/this.a/this.a+s*s,l=s;var u;for(o=ln;o;--o)if(u=Math.tan(l),h=-1*(s*(l*u+1)-l-.5*(l*l+a)*u)/((l-s)/u-1),l+=h,Math.abs(h)<=Ne){i=l;break}e=si(this.long0+Math.asin(r*Math.tan(l)/this.a)/Math.sin(i))}else if(Math.abs(n+this.ml0)<=Ne)i=0,e=si(this.long0+r/this.a);else{s=(this.ml0+n)/this.a,a=r*r/this.a/this.a+s*s,l=s;var c,d,p,f,g;for(o=ln;o;--o)if(g=this.e*Math.sin(l),c=Math.sqrt(1-g*g)*Math.tan(l),d=this.a*Mr(this.e0,this.e1,this.e2,this.e3,l),p=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),f=d/this.a,h=(s*(c*f+1)-f-.5*c*(f*f+a))/(this.es*Math.sin(2*l)*(f*f+a-2*s*f)/(4*c)+(s-f)*(c*p-2/Math.sin(2*l))-p),l-=h,Math.abs(h)<=Ne){i=l;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=si(this.long0+Math.asin(r*c/this.a)/Math.sin(i))}return t.x=e,t.y=i,t}function $t(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function te(t){var e,i=t.x,r=t.y,n=r-this.lat0,o=i-this.long0,s=n/Me*1e-5,a=o,l=1,h=0;for(e=1;e<=10;e++)l*=s,h+=this.A[e]*l;var u,c,d=h,p=a,f=1,g=0,m=0,y=0;for(e=1;e<=6;e++)u=f*d-g*p,c=g*d+f*p,f=u,g=c,m=m+this.B_re[e]*f-this.B_im[e]*g,y=y+this.B_im[e]*f+this.B_re[e]*g;return t.x=y*this.a+this.x0,t.y=m*this.a+this.y0,t}function ee(t){var e,i,r,n=t.x,o=t.y,s=n-this.x0,a=o-this.y0,l=a/this.a,h=s/this.a,u=1,c=0,d=0,p=0;for(e=1;e<=6;e++)i=u*l-c*h,r=c*l+u*h,u=i,c=r,d=d+this.C_re[e]*u-this.C_im[e]*c,p=p+this.C_im[e]*u+this.C_re[e]*c;for(var f=0;f.999999999999&&(i=.999999999999),e=Math.asin(i);var r=si(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));r<-Math.PI&&(r=-Math.PI),r>Math.PI&&(r=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var n=Math.asin(i);return t.x=r,t.y=n,t}function ce(){Math.abs(this.lat1+this.lat2)=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var o=0;if(0!==i&&(o=Math.atan2(e*t.x,e*t.y)),this.sphere)return n=si(this.long0+o/this.ns),r=Ir(this.g-i/this.a),t.x=n,t.y=r,t;var s=this.g-i/this.a;return r=Dr(s,this.e0,this.e1,this.e2,this.e3),n=si(this.long0+o/this.ns),t.x=n,t.y=r,t}function fe(){this.R=this.a}function ge(t){var e,i,r=t.x,n=t.y,o=si(r-this.long0);Math.abs(n)<=Ne&&(e=this.x0+this.R*o,i=this.y0);var s=Zr(2*Math.abs(n/Math.PI));(Math.abs(o)<=Ne||Math.abs(Math.abs(n)-Ce)<=Ne)&&(e=this.x0,i=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*s):this.y0+Math.PI*this.R*-Math.tan(.5*s));var a=.5*Math.abs(Math.PI/o-o/Math.PI),l=a*a,h=Math.sin(s),u=Math.cos(s),c=u/(h+u-1),d=c*c,p=c*(2/h-1),f=p*p,g=Math.PI*this.R*(a*(c-f)+Math.sqrt(l*(c-f)*(c-f)-(f+l)*(d-f)))/(f+l);o<0&&(g=-g),e=this.x0+g;var m=l+c;return g=Math.PI*this.R*(p*m-a*Math.sqrt((f+l)*(l+1)-m*m))/(f+l),i=n>=0?this.y0+g:this.y0-g,t.x=e,t.y=i,t}function me(t){var e,i,r,n,o,s,a,l,h,u,c,d,p;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,r=t.x/c,n=t.y/c,o=r*r+n*n,s=-Math.abs(n)*(1+o),a=s-2*n*n+r*r,l=-2*s+1+2*n*n+o*o,p=n*n/l+(2*a*a*a/l/l/l-9*s*a/l/l)/27,h=(s-a*a/3/l)/l,u=2*Math.sqrt(-h/3),c=3*p/h/u,Math.abs(c)>1&&(c=c>=0?1:-1),d=Math.acos(c)/3,i=t.y>=0?(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI:-(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI,e=Math.abs(r)2*Ce*this.a)return;return i=e/this.a,r=Math.sin(i),n=Math.cos(i),o=this.long0,Math.abs(e)<=Ne?s=this.lat0:(s=Zr(n*this.sin_p12+t.y*r*this.cos_p12/e),a=Math.abs(this.lat0)-Ce,o=si(Math.abs(a)<=Ne?this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y):this.long0+Math.atan2(t.x*r,e*this.cos_p12*n-t.y*this.sin_p12*r))),t.x=o,t.y=s,t}return l=Cr(this.es),h=Ar(this.es),u=Pr(this.es),c=Or(this.es),Math.abs(this.sin_p12-1)<=Ne?(d=this.a*Mr(l,h,u,c,Ce),e=Math.sqrt(t.x*t.x+t.y*t.y),p=d-e,s=Dr(p/this.a,l,h,u,c),o=si(this.long0+Math.atan2(t.x,-1*t.y)),t.x=o,t.y=s,t):Math.abs(this.sin_p12+1)<=Ne?(d=this.a*Mr(l,h,u,c,Ce),e=Math.sqrt(t.x*t.x+t.y*t.y),p=e-d,s=Dr(p/this.a,l,h,u,c),o=si(this.long0+Math.atan2(t.x,t.y)),t.x=o,t.y=s,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),m=Math.atan2(t.x,t.y),f=Nr(this.a,this.e,this.sin_p12),y=Math.cos(m),E=this.e*this.cos_p12*y,v=-E*E/(1-this.es),_=3*this.es*(1-v)*this.sin_p12*this.cos_p12*y/(1-this.es),b=e/f,w=b-v*(1+v)*Math.pow(b,3)/6-_*(1+3*v)*Math.pow(b,4)/24,S=1-v*w*w/2-b*w*w*w/6,g=Math.asin(this.sin_p12*Math.cos(w)+this.cos_p12*Math.sin(w)*y),o=si(this.long0+Math.asin(Math.sin(m)*Math.sin(w)/Math.cos(g))),s=Math.atan((1-this.es*S*this.sin_p12/Math.sin(g))*Math.tan(g)/(1-this.es)),t.x=o,t.y=s,t)}function _e(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function be(t){var e,i,r,n,o,s,a,l,h=t.x,u=t.y;return r=si(h-this.long0),e=Math.sin(u),i=Math.cos(u),n=Math.cos(r),s=this.sin_p14*e+this.cos_p14*i*n,o=1,(s>0||Math.abs(s)<=Ne)&&(a=this.a*o*i*Math.sin(r),l=this.y0+this.a*o*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=l,t}function we(t){var e,i,r,n,o,s,a;return t.x-=this.x0,t.y-=this.y0,e=Math.sqrt(t.x*t.x+t.y*t.y),i=Zr(e/this.a),r=Math.sin(i),n=Math.cos(i),s=this.long0,Math.abs(e)<=Ne?(a=this.lat0,t.x=s,t.y=a,t):(a=Zr(n*this.sin_p14+t.y*r*this.cos_p14/e),o=Math.abs(this.lat0)-Ce,Math.abs(o)<=Ne?(s=si(this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y)),t.x=s,t.y=a,t):(s=si(this.long0+Math.atan2(t.x*r,e*this.cos_p14*n-t.y*this.sin_p14*r)),t.x=s,t.y=a,t))}var Se=function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]},Le=1,Te=2,Re=4,xe=5,Me=484813681109536e-20,Ce=Math.PI/2,Ae=.16666666666666666,Pe=.04722222222222222,Oe=.022156084656084655,Ne="undefined"==typeof Number.EPSILON?1e-10:Number.EPSILON,Ie=.017453292519943295,De=57.29577951308232,ke=Math.PI/4,Ve=2*Math.PI,Fe=3.14159265359,Ge={};Ge.greenwich=0,Ge.lisbon=-9.131906111111,Ge.paris=2.337229166667,Ge.bogota=-74.080916666667,Ge.madrid=-3.687938888889,Ge.rome=12.452333333333,Ge.bern=7.439583333333,Ge.jakarta=106.807719444444,Ge.ferro=-17.666666666667,Ge.brussels=4.367975,Ge.stockholm=18.058277777778,Ge.athens=23.7163375,Ge.oslo=10.722916666667;var We={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},Be=/[\s_\-\/\(\)]/g,Ue=function(e){var i,r,n,o={},s=e.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t},{}),a={proj:"projName",datum:"datumCode",rf:function(t){o.rf=parseFloat(t)},lat_0:function(t){o.lat0=t*Ie},lat_1:function(t){o.lat1=t*Ie},lat_2:function(t){o.lat2=t*Ie},lat_ts:function(t){o.lat_ts=t*Ie},lon_0:function(t){o.long0=t*Ie},lon_1:function(t){o.long1=t*Ie},lon_2:function(t){o.long2=t*Ie},alpha:function(t){o.alpha=parseFloat(t)*Ie},lonc:function(t){o.longc=t*Ie},x_0:function(t){o.x0=parseFloat(t)},y_0:function(t){o.y0=parseFloat(t)},k_0:function(t){o.k0=parseFloat(t)},k:function(t){o.k0=parseFloat(t)},a:function(t){o.a=parseFloat(t)},b:function(t){o.b=parseFloat(t)},r_a:function(){o.R_A=!0},zone:function(t){o.zone=parseInt(t,10)},south:function(){o.utmSouth=!0},towgs84:function(t){o.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){o.to_meter=parseFloat(t)},units:function(e){o.units=e;var i=t(We,e);i&&(o.to_meter=i.to_meter)},from_greenwich:function(t){o.from_greenwich=t*Ie},pm:function(e){var i=t(Ge,e);o.from_greenwich=(i?i:parseFloat(e))*Ie},nadgrids:function(t){"@null"===t?o.datumCode="none":o.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&e.indexOf(t.substr(0,1))!==-1&&e.indexOf(t.substr(1,1))!==-1&&e.indexOf(t.substr(2,1))!==-1&&(o.axis=t)}};for(i in s)r=s[i],i in a?(n=a[i],"function"==typeof n?n(r):o[n]=r):o[i]=r;return"string"==typeof o.datumCode&&"WGS84"!==o.datumCode&&(o.datumCode=o.datumCode.toLowerCase()),o},Ke=1,je=2,ze=3,He=4,qe=5,Ye=-1,Xe=/\s/,Je=/[A-Za-z]/,Ze=/[A-Za-z84]/,Qe=/[,\]]/,$e=/[\d\.E\-\+]/;e.prototype.readCharicter=function(){var t=this.text[this.place++];if(this.state!==He)for(;Xe.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case Ke:return this.neutral(t);case je:return this.keyword(t);case He:return this.quoted(t);case qe:return this.afterquote(t);case ze:return this.number(t);case Ye:return}},e.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=He);if(Qe.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},e.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=Ke)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=Ke,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=Ye))):void 0},e.prototype.number=function(t){if($e.test(t))return void(this.word+=t);if(Qe.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)},e.prototype.quoted=function(t){return'"'===t?void(this.state=qe):void(this.word+=t)},e.prototype.keyword=function(t){if(Ze.test(t))return void(this.word+=t);if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=Ke)}if(Qe.test(t))return void this.afterItem(t);throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place)},e.prototype.neutral=function(t){if(Je.test(t))return this.word=t,void(this.state=je);if('"'===t)return this.word="",void(this.state=He);if($e.test(t))return this.word=t,void(this.state=ze);if(Qe.test(t))return void this.afterItem(t);throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place)},e.prototype.output=function(){for(;this.place2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e},Si=T("WGS84"),Li=6,Ti="AJSAJS",Ri="AFAFAF",xi=65,Mi=73,Ci=79,Ai=86,Pi=90,Oi={forward:V,inverse:F,toPoint:G};$.fromMGRS=function(t){return new $(G(t))},$.prototype.toMGRS=function(t){return V([this.x,this.y],t)};var Ni="2.4.3",Ii=1,Di=.25,ki=.046875,Vi=.01953125,Fi=.01068115234375,Gi=.75,Wi=.46875,Bi=.013020833333333334,Ui=.007120768229166667,Ki=.3645833333333333,ji=.005696614583333333,zi=.3076171875,Hi=function(t){var e=[];e[0]=Ii-t*(Di+t*(ki+t*(Vi+t*Fi))),e[1]=t*(Gi-t*(ki+t*(Vi+t*Fi)));var i=t*t;return e[2]=i*(Wi-t*(Bi+t*Ui)),i*=t,e[3]=i*(Ki-t*ji),e[4]=i*t*zi,e},qi=function(t,e,i,r){return i*=e,e*=e,r[0]*t-i*(r[1]+e*(r[2]+e*(r[3]+e*r[4])))},Yi=20,Xi=function(t,e,i){for(var r=1/(1-e),n=t,o=Yi;o;--o){var s=Math.sin(n),a=1-e*s*s;if(a=(qi(n,s,Math.cos(n),i)-t)*(a*Math.sqrt(a))*r,n-=a,Math.abs(a)=0;)i=-s+r*o+t[n],s=o,o=i;return e+i*Math.sin(2*e)},rr=function(t,e){for(var i,r=2*Math.cos(e),n=t.length-1,o=t[n],s=0;--n>=0;)i=-s+r*o+t[n],s=o,o=i;return Math.sin(e)*i},nr=function(t){var e=Math.exp(t);return e=(e+1/e)/2},or=function(t,e,i){for(var r,n,o=Math.sin(e),s=Math.cos(e),a=Qi(i),l=nr(i),h=2*s*l,u=-2*o*a,c=t.length-1,d=t[c],p=0,f=0,g=0;--c>=0;)r=f,n=p,f=d,p=g,d=-r+h*f-u*p+t[c],g=-n+u*f+h*p;return h=o*l,u=s*a,[h*d-u*g,h*g+u*d]},sr=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],ar={init:rt,forward:nt,inverse:ot,names:sr},lr=function(t,e){if(void 0===t){if(t=Math.floor(30*(si(e)+Math.PI)/Math.PI)+1,t<0)return 0;if(t>60)return 60}return t},hr="etmerc",ur=["Universal Transverse Mercator System","utm"],cr={init:st,names:ur,dependsOn:hr},dr=function(t,e){return Math.pow((1-t)/(1+t),e)},pr=20,fr=["gauss"],gr={init:at,forward:lt,inverse:ht,names:fr},mr=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative"],yr={init:ut,forward:ct,inverse:dt,names:mr},Er=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],vr={init:ft,forward:gt,inverse:mt,names:Er,ssfn_:pt},_r=["somerc"],br={init:yt,forward:Et,inverse:vt,names:_r},wr=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],Sr={init:_t,forward:bt,inverse:wt,names:wr},Lr=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],Tr={init:St,forward:Lt,inverse:Tt,names:Lr},Rr=["Krovak","krovak"],xr={init:Rt,forward:xt,inverse:Mt,names:Rr},Mr=function(t,e,i,r,n){return t*n-e*Math.sin(2*n)+i*Math.sin(4*n)-r*Math.sin(6*n)},Cr=function(t){return 1-.25*t*(1+t/16*(3+1.25*t))},Ar=function(t){return.375*t*(1+.25*t*(1+.46875*t))},Pr=function(t){return.05859375*t*t*(1+.75*t)},Or=function(t){return t*t*t*(35/3072)},Nr=function(t,e,i){var r=e*i;return t/Math.sqrt(1-r*r)},Ir=function(t){return Math.abs(t)1e-7?(i=t*e,(1-t*t)*(e/(1-i*i)-.5/t*Math.log((1-i)/(1+i)))):2*e},Gr=1,Wr=2,Br=3,Ur=4,Kr=.3333333333333333,jr=.17222222222222222,zr=.10257936507936508,Hr=.06388888888888888,qr=.0664021164021164,Yr=.016415012942191543,Xr=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Jr={init:Ot,forward:Nt,inverse:It,names:Xr,S_POLE:Gr,N_POLE:Wr,EQUIT:Br,OBLIQ:Ur},Zr=function(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)},Qr=["Albers_Conic_Equal_Area","Albers","aea"],$r={init:Vt,forward:Ft,inverse:Gt,names:Qr, +phi1z:Wt},tn=["gnom"],en={init:Bt,forward:Ut,inverse:Kt,names:tn},rn=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*Ce:Ce;for(var r,n,o,s,a=Math.asin(.5*e),l=0;l<30;l++)if(n=Math.sin(a),o=Math.cos(a),s=t*n,r=Math.pow(1-s*s,2)/(2*o)*(e/(1-t*t)-n/(1-s*s)+.5/t*Math.log((1-s)/(1+s))),a+=r,Math.abs(r)<=1e-10)return a;return NaN},nn=["cea"],on={init:jt,forward:zt,inverse:Ht,names:nn},sn=["Equirectangular","Equidistant_Cylindrical","eqc"],an={init:qt,forward:Yt,inverse:Xt,names:sn},ln=20,hn=["Polyconic","poly"],un={init:Jt,forward:Zt,inverse:Qt,names:hn},cn=["New_Zealand_Map_Grid","nzmg"],dn={init:$t,forward:te,inverse:ee,names:cn},pn=["Miller_Cylindrical","mill"],fn={init:ie,forward:re,inverse:ne,names:pn},gn=20,mn=["Sinusoidal","sinu"],yn={init:oe,forward:se,inverse:ae,names:mn},En=["Mollweide","moll"],vn={init:le,forward:he,inverse:ue,names:En},_n=["Equidistant_Conic","eqdc"],bn={init:ce,forward:de,inverse:pe,names:_n},wn=["Van_der_Grinten_I","VanDerGrinten","vandg"],Sn={init:fe,forward:ge,inverse:me,names:wn},Ln=["Azimuthal_Equidistant","aeqd"],Tn={init:ye,forward:Ee,inverse:ve,names:Ln},Rn=["ortho"],xn={init:_e,forward:be,inverse:we,names:Rn},Mn=function(t){t.Proj.projections.add(Zi),t.Proj.projections.add(ar),t.Proj.projections.add(cr),t.Proj.projections.add(yr),t.Proj.projections.add(vr),t.Proj.projections.add(br),t.Proj.projections.add(Sr),t.Proj.projections.add(Tr),t.Proj.projections.add(xr),t.Proj.projections.add(Vr),t.Proj.projections.add(Jr),t.Proj.projections.add($r),t.Proj.projections.add(en),t.Proj.projections.add(on),t.Proj.projections.add(an),t.Proj.projections.add(un),t.Proj.projections.add(dn),t.Proj.projections.add(fn),t.Proj.projections.add(yn),t.Proj.projections.add(vn),t.Proj.projections.add(bn),t.Proj.projections.add(Sn),t.Proj.projections.add(Tn),t.Proj.projections.add(xn)};return k.defaultDatum="WGS84",k.Proj=T,k.WGS84=new k.Proj("WGS84"),k.Point=$,k.toPoint=wi,k.defs=l,k.transform=N,k.mgrs=Oi,k.version=Ni,Mn(k),k}),i("formats/geotiff/TiffIFDEntry",["../../error/AbstractError","../../error/ArgumentError","./GeoTiffUtil","../../util/Logger","./TiffConstants"],function(t,e,i,r,n){"use strict";var o=function(t,i,n,o,s,a){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingTag"));if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingType"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingCount"));if(null===o||void 0===o)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingValueOffset"));if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingGeoTiffData"));if(null===a||void 0===a)throw new e(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","constructor","missingIsLittleEndian"));this._tag=t,this._type=i,this._count=n,this._valueOffset=o,this._geoTiffData=s,this._isLittleEndian=a};return Object.defineProperties(o.prototype,{tag:{get:function(){return this._tag}},type:{get:function(){return this._type}},count:{get:function(){return this._count}},valueOffset:{get:function(){return this._valueOffset}},geoTiffData:{get:function(){return this._geoTiffData}},isLittleEndian:{get:function(){return this._isLittleEndian}}}),o.prototype.getIFDTypeLength=function(){switch(this.type){case n.Type.BYTE:case n.Type.ASCII:case n.Type.SBYTE:case n.Type.UNDEFINED:return 1;case n.Type.SHORT:case n.Type.SSHORT:return 2;case n.Type.LONG:case n.Type.SLONG:case n.Type.FLOAT:return 4;case n.Type.RATIONAL:case n.Type.SRATIONAL:case n.Type.DOUBLE:return 8;default:return-1}},o.prototype.getIFDEntryValue=function(){var e=[],o=null,s=this.getIFDTypeLength(),a=s*this.count;if(a<=4)o=this.isLittleEndian===!1?this.valueOffset>>>8*(4-s):this.valueOffset,e.push(o);else for(var l=0;l=8)if(this.type===n.Type.RATIONAL||this.type===n.Type.SRATIONAL)e.push(i.getBytes(this.geoTiffData,this.valueOffset+h,4,this.isLittleEndian)),e.push(i.getBytes(this.geoTiffData,this.valueOffset+h+4,4,this.isLittleEndian));else{if(this.type!==n.Type.DOUBLE)throw new t(r.logMessage(r.LEVEL_SEVERE,"TiffIFDEntry","parse","invalidTypeOfIFD"));e.push(i.getBytes(this.geoTiffData,this.valueOffset+h,8,this.isLittleEndian))}else e.push(i.getBytes(this.geoTiffData,this.valueOffset+h,s,this.isLittleEndian))}return this.type===n.Type.ASCII?(e.forEach(function(t,e,i){0===t?i.splice(e,1):i[e]=String.fromCharCode(t)}),e.join("")):e},o}),i("util/WWUtil",["../error/ArgumentError","../geom/Line","../util/Logger","../geom/Rectangle","../geom/Vec3"],function(t,e,i,r,n){"use strict";var o={latLonRegex:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,suffixForMimeType:function(t){return"image/png"===t?"png":"image/jpeg"===t?"jpg":"application/bil16"===t?"bil":"application/bil32"===t?"bil":null},currentUrlSansFilePart:function(){for(var t=window.location.protocol,e=window.location.host,i=window.location.pathname,r=i.split("/"),n="",o=0,s=r.length;o0&&(n=n+"/"+r[o]);return t+"//"+e+n},worldwindlibLocation:function(){for(var t=document.getElementsByTagName("script"),e="/worldwind.",i=0;i=0)return t[i].src.substring(0,r)+"/"}return null},urlPath:function(t){if(!t)return"";for(var e=t.split("/"),i="",r=0,n=e.length;rt.length)&&(i=t.length),i-=e.length;var r=t.lastIndexOf(e,i);return r!==-1&&r===i}};return o}),i("formats/geotiff/GeoTiffReader",["../../error/AbstractError","../../error/ArgumentError","./GeoTiffConstants","./GeoTiffKeyEntry","./GeoTiffMetadata","./GeoTiffUtil","../../geom/Location","../../geom/Sector","../../util/Logger","../../util/proj4-src","./TiffConstants","./TiffIFDEntry","../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","constructor","missingArrayBuffer"));this._isLittleEndian=!1,this._imageFileDirectories=[],this._geoTiffData=new DataView(t),this._metadata=new n,this.parse()};return Object.defineProperties(p.prototype,{isLittleEndian:{get:function(){return this._isLittleEndian}},imageFileDirectories:{get:function(){return this._imageFileDirectories}},geoTiffData:{get:function(){return this._geoTiffData}},metadata:{get:function(){return this._metadata}}}),p.retrieveFromUrl=function(t,i){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","retrieveFromUrl","missingUrl"));if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","retrieveFromUrl","The specified callback is null or undefined."));var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onreadystatechange=function(){if(4===r.readyState)if(200===r.status){var e=r.response;e&&i(new p(e),r)}else l.log(l.LEVEL_WARNING,"GeoTiff retrieval failed ("+r.statusText+"): "+t),i(null,r)}.bind(this),r.onerror=function(){l.log(l.LEVEL_WARNING,"GeoTiff retrieval failed: "+t),i(null,r)},r.ontimeout=function(){l.log(l.LEVEL_WARNING,"GeoTiff retrieval timed out: "+t),i(null,r)},r.send(null)},p.prototype.parse=function(){if(!this._imageFileDirectories.length){if(this.getEndianness(),!this.isTiffFileType())throw new t(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","parse","invalidTiffFileType"));var e=o.getBytes(this.geoTiffData,4,4,this.isLittleEndian);this.parseImageFileDirectory(e),this.getMetadataFromImageFileDirectory(),this.parseGeoKeys(),this.setBBox()}},p.prototype.getEndianness=function(){var e=o.getBytes(this.geoTiffData,0,2,this.isLittleEndian);if(18761===e)this._isLittleEndian=!0;else{if(19789!==e)throw new t(l.logMessage(l.LEVEL_SEVERE,"GeoTiffReader","getEndianness","invalidByteOrderValue"));this._isLittleEndian=!1}},p.prototype.getImage=function(){return this.createImage()},p.prototype.getImageData=function(){return this.createTypedElevationArray()},p.prototype.isTiffFileType=function(){var t=o.getBytes(this.geoTiffData,2,2,this.isLittleEndian);return 42===t},p.prototype.isGeoTiff=function(){return!!this.getIFDByTag(i.Tag.GEO_KEY_DIRECTORY)},p.prototype.createImage=function(){var t=this.metadata.bitsPerSample,e=this.metadata.samplesPerPixel,i=this.metadata.photometricInterpretation,r=this.metadata.imageLength,n=this.metadata.imageWidth;if(this.metadata.colorMap)var o=this.metadata.colorMap,s=Math.pow(2,t[0]);var a=document.createElement("canvas");a.width=n,a.height=r;var l=a.getContext("2d");if(this.metadata.stripOffsets){var h=this.parseStrips(!1);if(this.metadata.rowsPerStrip)var u=this.metadata.rowsPerStrip;else var u=r;for(var c=h.length,d=0,p=u,f=r%u,g=0===f?u:f,m=0;m=0&&x<=127?L=x+1:x>=-127&&x<=-1?T=-x+1:S=!0}else{for(var M=o.getBytes(this.geoTiffData,n+c,1,this.isLittleEndian),C=0;C6&&0===c);else if(16===d){var p=t,f=i;t=p*a[0]+f*a[1]+a[3],i=p*a[4]+f*a[5]+a[7],r=[t,i]}else c<3||u<6?r=[t,i]:(t=(t-n[0])*o[0]+n[3],i=(i-n[1])*(-1*o[1])+n[4],r=[t,i]);return h.defs([["EPSG:26771","+proj=tmerc +lat_0=36.66666666666666 +lon_0=-88.33333333333333 +k=0.9999749999999999 +x_0=152400.3048006096 +y_0=0 +ellps=clrk66 +datum=NAD27 +to_meter=0.3048006096012192 +no_defs "],["EPSG:32633","+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"]]),this.metadata.projectedCSType&&(r=h("EPSG:"+this.metadata.projectedCSType,"EPSG:4326",r)),new s(r[1],r[0])},p.prototype.setBBox=function(){var t=this.geoTiffImageToPCS(0,0),e=this.geoTiffImageToPCS(this.metadata.imageWidth,0),i=this.geoTiffImageToPCS(0,this.metadata.imageLength);this.geoTiffImageToPCS(this.metadata.imageWidth,this.metadata.imageLength);this.metadata.bbox=new a(i.latitude,t.latitude,t.longitude,e.longitude)},p.prototype.getMetadataFromImageFileDirectory=function(){for(var t=0;tt.levelNumber?1:0},n}),i("util/LevelSet",["../error/ArgumentError","../util/Level","../geom/Location","../util/Logger"],function(t,e,i,r){"use strict";var n=function(n,o,s,a,l){if(!n)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","missingSector"));if(!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified level zero delta is null or undefined"));if(o.latitude<=0||o.longitude<=0)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified level zero delta is less than or equal to zero."));if(s<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified number of levels is less than one."));if(a<1||l<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"LevelSet","constructor","The specified tile width or tile height is less than one."));this.sector=n,this.levelZeroDelta=o,this.numLevels=s,this.tileWidth=a,this.tileHeight=l,this.levels=[];for(var h=0;h=this.levels.length?null:this.levels[t]},n.prototype.levelForTexelSize=function(t){var e=this.lastLevel();if(e.texelSize>=t)return e;for(var i=0,r=this.levels.length;i=i||r<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","constructor","The specified low-water value is undefined, greater than or equal to the capacity, or less than 1"));this._capacity=i,this._lowWater=r,this.usedCapacity=0,this.freeCapacity=i,this.entries={},this.listeners=[]};return Object.defineProperties(i.prototype,{capacity:{get:function(){return this._capacity},set:function(i){if(!i||i<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","capacity","Specified cache capacity is undefined, 0 or negative."));var r=this._capacity;this._capacity=i,this._capacity<=this.lowWater&&(this._lowWater=.85*this._capacity),this._capacity=this._capacity||i<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","lowWater","Specified cache low-water value is undefined, negative or not less than the current capacity."));this._lowWater=i}}}),i.prototype.entryForKey=function(t){if(!t)return null;var e=this.entries[t];return e?(e.lastUsed=Date.now(),e.entry):null},i.prototype.putEntry=function(i,r,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","missingKey."));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","missingEntry."));if(n<1)throw new t(e.logMessage(e.LEVEL_SEVERE,"MemoryCache","putEntry","The specified entry size is less than 1."));var o,s=this.entries[i];s&&this.removeEntry(i),this.usedCapacity+n>this._capacity&&this.makeSpace(n),this.usedCapacity+=n,this.freeCapacity=this._capacity-this.usedCapacity,o={key:i,entry:r,size:n,lastUsed:Date.now(),agingFactor:1},this.entries[i]=o},i.prototype.clear=function(t){if(t)for(var e in this.entries)this.entries.hasOwnProperty(e)&&this.removeCacheEntry(e);this.entries={},this.freeCapacity=this._capacity,this.usedCapacity=0},i.prototype.removeEntry=function(t){if(t){var e=this.entries[t];e&&this.removeCacheEntry(e)}},i.prototype.setEntryAgingFactor=function(t,e){if(t){var i=this.entries[t];i&&(i.agingFactor=e)}},i.prototype.removeCacheEntry=function(t){delete this.entries[t.key],this.usedCapacity-=t.size,this.freeCapacity=this._capacity-this.usedCapacity;for(var e=0,i=this.listeners.length;e-1&&this.listeners.splice(r,1)},i.prototype.makeSpace=function(t){var e=[],i=Date.now();for(var r in this.entries)this.entries.hasOwnProperty(r)&&e.push(this.entries[r]);e.sort(function(t,e){var r=(i-t.lastUsed)*t.agingFactor,n=(i-e.lastUsed)*e.agingFactor;return n-r});for(var n=0,o=e.length;nthis._lowWater||this.freeCapacityi&&(_=i),bo&&(w=o),Ss&&(L=s),T180&&(i.computePointFromPosition(e.centroidLatitude(),e.centroidLongitude()+90,o,this.tmp1),i.computePointFromPosition(e.centroidLatitude(),e.centroidLongitude()-90,o,this.tmp2),this.adjustExtremes(this.r,d,this.s,p,this.t,f,this.tmp1),this.adjustExtremes(this.r,d,this.s,p,this.t,f,this.tmp2)),d[1]-d[0]=0?i:-i},c.prototype.effectiveRadius=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","effectiveRadius","missingPlane"));var i=e.normal;return.5*(h.fabs(this.r.dot(i))+h.fabs(this.s.dot(i))+h.fabs(this.t.dot(i)))},c.prototype.intersectsFrustum=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"BoundingBox","intersectsFrustum","missingFrustum"));return this.tmp1.copy(this.bottomCenter),this.tmp2.copy(this.topCenter),!(this.intersectionPoint(e.near)<0)&&(!(this.intersectionPoint(e.far)<0)&&(!(this.intersectionPoint(e.left)<0)&&(!(this.intersectionPoint(e.right)<0)&&(!(this.intersectionPoint(e.top)<0)&&!(this.intersectionPoint(e.bottom)<0)))))},c.prototype.intersectionPoint=function(t){var e=t.normal,i=.5*(Math.abs(this.s.dot(e))+Math.abs(this.t.dot(e)));return this.intersectsAt(t,i,this.tmp1,this.tmp2)},c.prototype.intersectsAt=function(t,e,i,r){var n=t.dot(i),o=n<=-e,s=t.dot(r),a=s<=-e;if(o&&a)return-1;if(o==a)return 0;this.tmp3.copy(i),this.tmp3.subtract(r);var l=(e+n)/t.normal.dot(this.tmp3);return this.tmp3.copy(r),this.tmp3.subtract(i),this.tmp3.multiply(l),this.tmp3.add(i),o?i.copy(this.tmp3):r.copy(this.tmp3),l},c.prototype.adjustExtremes=function(t,e,i,r,n,o,s){var a=s.dot(t);e[0]>a&&(e[0]=a),e[1]l&&(r[0]=l),r[1]h&&(o[0]=h),o[1]Math.max(e*n,this.minCellSize)},s.prototype.update=function(t){var e=t.globe.elevationTimestamp(),i=t.verticalExaggeration,r=t.globeStateKey;this.updateTimestamp==e&&this.updateVerticalExaggeration==i&&this.updateGlobeStateKey==r||(this.doUpdate(t),t.frameStatistics.incrementTileUpdateCount(1),this.updateTimestamp=e,this.updateVerticalExaggeration=i,this.updateGlobeStateKey=r)},s.prototype.doUpdate=function(t){var i=t.globe,r=t.verticalExaggeration,s=i.minAndMaxElevationsForSector(this.sector),a=s[0]*r,l=s[1]*r;a===l&&(a=l+10),this.extent||(this.extent=new e),this.extent.setToSector(this.sector,i,a,l),this.samplePoints||(this.sampleElevations=new Float64Array(9),this.samplePoints=new Float64Array(3*this.sampleElevations.length)),o.fillArray(this.sampleElevations,.5*(a+l)),i.computePointsForGrid(this.sector,3,3,this.sampleElevations,n.ZERO,this.samplePoints),this.referencePoint||(this.referencePoint=new n(0,0,0)),i.computePointFromPosition(this.sector.centroidLatitude(),this.sector.centroidLongitude(),0,this.referencePoint)},s.computeTileKey=function(t,e,i){return t+"."+e+"."+i},s.computeRow=function(t,e){var i=Math.floor((e+90)/t);return 90==e&&(i-=1),i},s.computeColumn=function(t,e){var i=Math.floor((e+180)/t);return 180==e&&(i-=1),i},s.computeLastRow=function(t,e){var i=Math.ceil((e+90)/t-1);return e+90u&&(r[0]=u);var c=h.maxElevation;r[1]=0;h--){if(i=c.computeTileKey(h,s,a),l=this.imageCache.entryForKey(i)){var u=l.elevationAtLocation(t,e);return isNaN(u)?null:u}s=Math.floor(s/2),a=Math.floor(a/2)}return null},p.prototype.pointElevationsForGrid=function(t,e,i,r,n){if(this.assembleTiles(r,t,!0),0===this.currentTiles.length)return!1;this.currentTiles.sort(function(t,e){return t.level.levelNumber-e.level.levelNumber});for(var o=0,s=this.currentTiles.length;o1?e-1:1),m=t.deltaLongitude()/(i>1?i-1:1),y=0;for(h=0,o=c;h=0;L--)if(s=this.levels.level(L),a=Math.round(360*s.tileWidth/s.tileDelta.longitude),l=Math.round(180*s.tileHeight/s.tileDelta.latitude),h=1/(2*l),u=1-h,c=0,p=l-1,f=a*d.fract(t),g=l*d.clamp(e,h,u),m=d.mod(Math.floor(f-.5),a),y=d.mod(m+1,a),E=d.clamp(Math.floor(g-.5),c,p),v=d.clamp(E+1,c,p),_=d.fract(f-.5),b=d.fract(g-.5),w=L==i||0==L,this.lookupPixels(m,y,E,v,s,w,S))return!n.isNoData(S[0],S[1],S[2],S[3])&&(r[o]=(1-_)*(1-b)*S[0]+_*(1-b)*S[1]+(1-_)*b*S[2]+_*b*S[3],!0);return!1},p.prototype.lookupPixels=function(t,e,i,r,n,o,s){var a,l,h,u,c=n.levelNumber,d=n.tileWidth,p=n.tileHeight,f=Math.floor(i/p),g=Math.floor(r/p),m=Math.floor(t/d),y=Math.floor(e/d);return f==g&&f==this.cachedRow&&m==y&&m==this.cachedCol?a=l=h=u=this.cachedImage:f==g&&m==y?(a=this.lookupImage(c,f,m,o),l=h=u=a,this.cachedRow=f,this.cachedCol=m,this.cachedImage=a):(a=this.lookupImage(c,f,m,o),l=this.lookupImage(c,f,y,o),h=this.lookupImage(c,g,m,o),u=this.lookupImage(c,g,y,o)),!!(a&&l&&h&&u)&&(s[0]=a.pixel(t%d,i%p),s[1]=l.pixel(e%d,i%p),s[2]=h.pixel(t%d,r%p),s[3]=u.pixel(e%d,r%p),!0)},p.prototype.lookupImage=function(t,e,i,r){var n=c.computeTileKey(t,e,i),o=this.imageCache.entryForKey(n);if(null==o&&r){var s=this.tileForLevel(t,e,i);this.retrieveTileImage(s)}return o},p.prototype.assembleTiles=function(t,e,i){if(this.currentTiles=[],this.currentSector.copy(e),this.currentSector.intersection(this.coverageSector),!this.currentSector.isEmpty())for(var r=t.tileDelta.latitude,n=t.tileDelta.longitude,o=c.computeRow(r,this.currentSector.minLatitude),s=c.computeLastRow(r,this.currentSector.maxLatitude),a=c.computeColumn(n,this.currentSector.minLongitude),l=c.computeLastColumn(n,this.currentSector.maxLongitude),h=o;h<=s;h++)for(var u=a;u<=l;u++)this.addTileOrAncestor(t,h,u,i)},p.prototype.addTileOrAncestor=function(t,e,i,r){var n=this.tileForLevel(t.levelNumber,e,i);this.isTileImageInMemory(n)?this.addToCurrentTiles(n):(r&&this.retrieveTileImage(n),t.isFirstLevel()?this.currentTiles.push(n):this.addAncestor(t,e,i,r))},p.prototype.addAncestor=function(t,e,i,r){for(var n=null,o=Math.floor(e/2),s=Math.floor(i/2),a=t.levelNumber-1;a>=0;a--){if(n=this.tileForLevel(a,o,s),this.isTileImageInMemory(n))return void this.addToCurrentTiles(n);o=Math.floor(o/2),s=Math.floor(s/2)}this.addToCurrentTiles(n),r&&this.retrieveTileImage(n)},p.prototype.addToCurrentTiles=function(t){this.currentTiles.push(t)},p.prototype.tileForLevel=function(t,e,i){var r=c.computeTileKey(t,e,i),n=this.tileCache.entryForKey(r);if(n)return n;var o=this.levels.level(t),s=c.computeSector(o,e,i);return n=new c(s,o,e,i),this.tileCache.putEntry(r,n,n.size()),n},p.prototype.isTileImageInMemory=function(t){return this.imageCache.containsKey(t.tileKey)},p.prototype.resourceUrlForTile=function(t){return this.urlBuilder.urlForTile(t,this.retrievalImageFormat)},p.prototype.retrieveTileImage=function(t){if(this.currentRetrievals.indexOf(t.tileKey)<0){if(this.currentRetrievals.length>this.retrievalQueueSize)return;var e=this.resourceUrlForTile(t,this.retrievalImageFormat),i=new XMLHttpRequest,r=this;if(!e)return;i.open("GET",e,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){if(4===i.readyState){r.removeFromCurrentRetrievals(t.tileKey);var n=i.getResponseHeader("content-type");if(200===i.status)if(n===r.retrievalImageFormat||"text/plain"===n||"application/octet-stream"===n){l.log(l.LEVEL_INFO,"Elevations retrieval succeeded: "+e),r.loadElevationImage(t,i),r.absentResourceList.unmarkResourceAbsent(t.tileKey);var o=document.createEvent("Event");o.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(o)}else"text/xml"===n?(r.absentResourceList.markResourceAbsent(t.tileKey),l.log(l.LEVEL_WARNING,"Elevations retrieval failed ("+i.statusText+"): "+e+".\n "+String.fromCharCode.apply(null,new Uint8Array(i.response)))):(r.absentResourceList.markResourceAbsent(t.tileKey),l.log(l.LEVEL_WARNING,"Elevations retrieval failed: "+e+". Unexpected content type "+n));else r.absentResourceList.markResourceAbsent(t.tileKey),l.log(l.LEVEL_WARNING,"Elevations retrieval failed ("+i.statusText+"): "+e)}},i.onerror=function(){r.removeFromCurrentRetrievals(t.tileKey),r.absentResourceList.markResourceAbsent(t.tileKey),l.log(l.LEVEL_WARNING,"Elevations retrieval failed: "+e)},i.ontimeout=function(){r.removeFromCurrentRetrievals(t.tileKey),r.absentResourceList.markResourceAbsent(t.tileKey),l.log(l.LEVEL_WARNING,"Elevations retrieval timed out: "+e)},i.send(null),this.currentRetrievals.push(t.tileKey)}},p.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},p.prototype.loadElevationImage=function(t,e){var i,r=new n(t.sector,t.tileWidth,t.tileHeight);"application/bil16"===this.retrievalImageFormat?(r.imageData=new Int16Array(e.response),r.size=2*r.imageData.length):"application/bil32"===this.retrievalImageFormat?(r.imageData=new Float32Array(e.response),r.size=4*r.imageData.length):"image/tiff"===this.retrievalImageFormat&&(i=new o(e.response),r.imageData=i.getImageData(),r.size=r.imageData.length*i.metadata.bitsPerSample[0]/8),r.imageData&&(r.findMinAndMaxElevation(),this.imageCache.putEntry(t.tileKey,r,r.size),this.timestamp=Date.now())},p}),i("util/WmsUrlBuilder",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i,r,n,o,s){if(!i||0===i.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","constructor","The WMS service address is missing."));if(!r||0===r.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","constructor","The WMS layer names are not specified."));this.serviceAddress=i,this.layerNames=r,this.styleNames=n?n:"",this.transparent=!0,this.wmsVersion=o&&o.length>0?o:"1.3.0",this.isWms130OrGreater=this.wmsVersion>="1.3.0",this.crs="EPSG:4326",this.timeString=s};return i.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","The image format is null or undefined."));var o=r.sector,s=i.fixGetMapString(this.serviceAddress);return s.search(/service=wms/i)<0&&(s+="service=WMS"),s+="&request=GetMap",s=s+"&version="+this.wmsVersion,s=s+"&transparent="+(this.transparent?"TRUE":"FALSE"),s=s+"&layers="+this.layerNames,s=s+"&styles="+this.styleNames,s=s+"&format="+n,s=s+"&width="+r.tileWidth,s=s+"&height="+r.tileHeight,this.timeString&&(s=s+"&time="+this.timeString),this.isWms130OrGreater?(s=s+"&crs="+this.crs,s+="&bbox=","CRS:84"===this.crs?(s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude):(s=s+o.minLatitude+","+o.minLongitude+",",s=s+o.maxLatitude+","+o.maxLongitude)):(s=s+"&srs="+this.crs,s+="&bbox=",s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude),s=s.replace(" ","%20")},i.fixGetMapString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","fixGetMapString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/),r<0&&(i+="&")),i},i}),i("globe/AsterV2ElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:new e(-83.0001,83.0001,-180,180),resolution:.000277777777778,retrievalImageFormat:"application/bil16",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/elev","aster_v2","","1.3.0")}),this.displayName="ASTER V2 Earth Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("shaders/AtmosphereProgram",["../error/ArgumentError","../shaders/GpuProgram","../util/Logger"],function(t,e,i){"use strict";var r=function(t,i,r,n){e.call(this,t,i,r,n),this.FRAGMODE_SKY=1,this.FRAGMODE_GROUND_PRIMARY=2,this.FRAGMODE_GROUND_SECONDARY=3,this.FRAGMODE_GROUND_PRIMARY_TEX_BLEND=4,this.altitude=16e4,this.rayleighScaleDepth=.25,this.fragModeLocation=this.uniformLocation(t,"fragMode"),this.mvpMatrixLocation=this.uniformLocation(t,"mvpMatrix"),this.texCoordMatrixLocation=this.uniformLocation(t,"texCoordMatrix"),this.vertexOriginLocation=this.uniformLocation(t,"vertexOrigin"),this.eyePointLocation=this.uniformLocation(t,"eyePoint"),this.eyeMagnitudeLocation=this.uniformLocation(t,"eyeMagnitude"),this.eyeMagnitude2Location=this.uniformLocation(t,"eyeMagnitude2"),this.lightDirectionLocation=this.uniformLocation(t,"lightDirection"),this.atmosphereRadiusLocation=this.uniformLocation(t,"atmosphereRadius"),this.atmosphereRadius2Location=this.uniformLocation(t,"atmosphereRadius2"),this.globeRadiusLocation=this.uniformLocation(t,"globeRadius"),this.scaleLocation=this.uniformLocation(t,"scale"),this.opacityLocation=this.uniformLocation(t,"opacity"),this.scaleDepthLocation=this.uniformLocation(t,"scaleDepth"),this.scaleOverScaleDepthLocation=this.uniformLocation(t,"scaleOverScaleDepth"),this.scratchArray9=new Float32Array(9)};return r.key="WorldWindGpuAtmosphereProgram",r.prototype=Object.create(e.prototype),r.prototype.getAltitude=function(){return this.altitude},r.prototype.loadFragMode=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadFragMode","missingFragMode"));e.uniform1i(this.fragModeLocation,r)},r.prototype.loadModelviewProjection=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadModelviewProjection","missingMatrix"));this.loadUniformMatrix(e,r,this.mvpMatrixLocation)},r.prototype.loadVertexOrigin=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadVertexOrigin","missingVector"));e.uniform3f(this.vertexOriginLocation,r[0],r[1],r[2])},r.prototype.loadLightDirection=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadLightDirection","missingVector"));e.uniform3f(this.lightDirectionLocation,r[0],r[1],r[2])},r.prototype.loadEyePoint=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadEyePoint","missingVector"));e.uniform3f(this.eyePointLocation,r[0],r[1],r[2]),e.uniform1f(this.eyeMagnitudeLocation,r.magnitude()),e.uniform1f(this.eyeMagnitude2Location,r.magnitudeSquared())},r.prototype.loadGlobeRadius=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadGlobeRadius","missingGlobeRadius"));var n=r,o=n+this.altitude;e.uniform1f(this.globeRadiusLocation,n),e.uniform1f(this.atmosphereRadiusLocation,o),e.uniform1f(this.atmosphereRadius2Location,o*o)},r.prototype.setScale=function(t){t.uniform1f(this.scaleLocation,1/this.getAltitude()),t.uniform1f(this.scaleDepthLocation,this.rayleighScaleDepth),t.uniform1f(this.scaleOverScaleDepthLocation,1/this.getAltitude()/this.rayleighScaleDepth)},r.prototype.loadTexMatrix=function(e,r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadTexMatrix","missingMatrix"));r.columnMajorComponents(this.scratchArray9),e.uniformMatrix3fv(this.texCoordMatrixLocation,!1,this.scratchArray9)},r.prototype.loadOpacity=function(e,r){if(void 0===r)throw new t(i.logMessage(i.LEVEL_SEVERE,"AtmosphereProgram","loadOpacity","missingOpacity"));e.uniform1f(this.opacityLocation,r)},r}),i("shaders/GroundProgram",["../shaders/AtmosphereProgram"],function(t){"use strict";var e=function(e){var i="precision mediump int;\nconst int FRAGMODE_GROUND_PRIMARY_TEX_BLEND = 4;\nconst int SAMPLE_COUNT = 2;\nconst float SAMPLES = 2.0;\nconst float PI = 3.141592653589;\nconst float Kr = 0.0025;\nconst float Kr4PI = Kr * 4.0 * PI;\nconst float Km = 0.0015;\nconst float Km4PI = Km * 4.0 * PI;\nconst float ESun = 15.0;\nconst float KmESun = Km * ESun;\nconst float KrESun = Kr * ESun;\nconst vec3 invWavelength = vec3(5.60204474633241, 9.473284437923038, 19.643802610477206);\nconst float rayleighScaleDepth = 0.25;\nuniform int fragMode;\nuniform mat4 mvpMatrix;\nuniform mat3 texCoordMatrix;\nuniform vec3 vertexOrigin;\nuniform vec3 eyePoint;\nuniform float eyeMagnitude;\nuniform float eyeMagnitude2;\nuniform vec3 lightDirection;\nuniform float atmosphereRadius;\nuniform float atmosphereRadius2;\nuniform float globeRadius;\nuniform float scale;\nuniform float scaleDepth;\nuniform float scaleOverScaleDepth;\nuniform float opacity;\nattribute vec4 vertexPoint;\nattribute vec2 vertexTexCoord;\nvarying vec3 primaryColor;\nvarying vec3 secondaryColor;\nvarying vec2 texCoord;\nfloat scaleFunc(float cos) {\n float x = 1.0 - cos;\n return scaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nvoid sampleGround() {\n vec3 point = vertexPoint.xyz + vertexOrigin;\n vec3 ray = point - eyePoint;\n float far = length(ray);\n ray /= far;\n vec3 start;\n if (eyeMagnitude < atmosphereRadius) {\n start = eyePoint;\n } else {\n float B = 2.0 * dot(eyePoint, ray);\n float C = eyeMagnitude2 - atmosphereRadius2;\n float det = max(0.0, B*B - 4.0 * C);\n float near = 0.5 * (-B - sqrt(det));\n start = eyePoint + ray * near;\n far -= near;\n}\n float depth = exp((globeRadius - atmosphereRadius) / scaleDepth);\n float eyeAngle = dot(-ray, point) / length(point);\n float lightAngle = dot(lightDirection, point) / length(point);\n float eyeScale = scaleFunc(eyeAngle);\n float lightScale = scaleFunc(lightAngle);\n float eyeOffset = depth*eyeScale;\n float temp = (lightScale + eyeScale);\n float sampleLength = far / SAMPLES;\n float scaledLength = sampleLength * scale;\n vec3 sampleRay = ray * sampleLength;\n vec3 samplePoint = start + sampleRay * 0.5;\n vec3 frontColor = vec3(0.0, 0.0, 0.0);\n vec3 attenuate = vec3(0.0, 0.0, 0.0);\n for(int i=0; i=this.minActiveAltitude&&e.altitude<=this.maxActiveAltitude)},e.prototype.isLayerInView=function(t){return!0},e}),i("geom/Matrix3",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(t,e,i,r,n,o,s,a,l){this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=n,this[5]=o,this[6]=s,this[7]=a,this[8]=l};return i.prototype=new Float64Array(9),i.fromIdentity=function(){return new i(1,0,0,0,1,0,0,0,1)},i.prototype.setToUnitYFlip=function(){return this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=-1,this[5]=1,this[6]=0,this[7]=0,this[8]=1,this},i.prototype.multiplyMatrix=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Matrix3","multiplyMatrix","missingMatrix"));var r,n,o,s=this,a=i;return r=s[0],n=s[1],o=s[2],s[0]=r*a[0]+n*a[3]+o*a[6],s[1]=r*a[1]+n*a[4]+o*a[7],s[2]=r*a[2]+n*a[5]+o*a[8],r=s[3],n=s[4],o=s[5],s[3]=r*a[0]+n*a[3]+o*a[6],s[4]=r*a[1]+n*a[4]+o*a[7],s[5]=r*a[2]+n*a[5]+o*a[8],r=s[6],n=s[7],o=s[8],s[6]=r*a[0]+n*a[3]+o*a[6],s[7]=r*a[1]+n*a[4]+o*a[7],s[8]=r*a[2]+n*a[5]+o*a[8],this},i.prototype.multiplyByTileTransform=function(t,e){var i=t.deltaLatitude(),r=t.deltaLongitude(),n=e.deltaLatitude(),o=e.deltaLongitude(),s=r/o,a=i/n,l=(t.minLongitude-e.minLongitude)/o,h=(t.minLatitude-e.minLatitude)/n,u=this;return u[2]+=u[0]*l+u[1]*h,u[5]+=u[3]*l+u[4]*h,u[8]+=u[6]*l+u[6]*h,u[0]*=s,u[1]*=a,u[3]*=s,u[4]*=a,u[6]*=s,u[7]*=a,this},i.prototype.columnMajorComponents=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Matrix3","columnMajorComponents","missingResult"));return i[0]=this[0],i[1]=this[3],i[2]=this[6],i[3]=this[1],i[4]=this[4],i[5]=this[7],i[6]=this[2],i[7]=this[5],i[8]=this[8],i},i}),i("shaders/SkyProgram",["../shaders/AtmosphereProgram"],function(t){"use strict";var e=function(e){var i="precision mediump int;\nconst int SAMPLE_COUNT = 2;\nconst float SAMPLES = 2.0;\nconst float PI = 3.141592653589;\nconst float Kr = 0.0025;\nconst float Kr4PI = Kr * 4.0 * PI;\nconst float Km = 0.0015;\nconst float Km4PI = Km * 4.0 * PI;\nconst float ESun = 15.0;\nconst float KmESun = Km * ESun;\nconst float KrESun = Kr * ESun;\nconst vec3 invWavelength = vec3(5.60204474633241, 9.473284437923038, 19.643802610477206);\nconst float rayleighScaleDepth = 0.25;\nuniform mat4 mvpMatrix;\nuniform vec3 vertexOrigin;\nuniform vec3 eyePoint;\nuniform float eyeMagnitude;\nuniform float eyeMagnitude2;\nuniform mediump vec3 lightDirection;\nuniform float atmosphereRadius;\nuniform float atmosphereRadius2;\nuniform float globeRadius;\nuniform float scale;\nuniform float scaleDepth;\nuniform float scaleOverScaleDepth;\nattribute vec4 vertexPoint;\nvarying vec3 primaryColor;\nvarying vec3 secondaryColor;\nvarying vec3 direction;\nfloat scaleFunc(float cos)\n{\n float x = 1.0 - cos;\n return scaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nvoid sampleSky() {\n vec3 point = vertexPoint.xyz + vertexOrigin;\n vec3 ray = point - eyePoint;\n float far = length(ray);\n ray /= far;\n vec3 start;\n float startOffset;\n if (eyeMagnitude < atmosphereRadius) {\n start = eyePoint;\n float height = length(start);\n float depth = exp(scaleOverScaleDepth * (globeRadius - eyeMagnitude));\n float startAngle = dot(ray, start) / height;\n startOffset = depth*scaleFunc(startAngle);\n } else {\n float B = 2.0 * dot(eyePoint, ray);\n float C = eyeMagnitude2 - atmosphereRadius2;\n float det = max(0.0, B*B - 4.0 * C);\n float near = 0.5 * (-B - sqrt(det));\n start = eyePoint + ray * near;\n far -= near;\n float startAngle = dot(ray, start) / atmosphereRadius;\n float startDepth = exp(-1.0 / scaleDepth);\n startOffset = startDepth*scaleFunc(startAngle);\n }\n float sampleLength = far / SAMPLES;\n float scaledLength = sampleLength * scale;\n vec3 sampleRay = ray * sampleLength;\n vec3 samplePoint = start + sampleRay * 0.5;\n vec3 frontColor = vec3(0.0, 0.0, 0.0);\n for(int i=0; i=90&&h<270&&(p+=180),p=r.normalizeAngle360(p),{declination:d,rightAscension:p}},celestialToGeographic:function(n,o){if(!n)throw new e(i.logMessage(i.LEVEL_SEVERE,"SunPosition","celestialToGeographic","missingCelestialLocation"));if(o instanceof Date==!1)throw new e(i.logMessage(i.LEVEL_SEVERE,"SunPosition","celestialToGeographic","missingDate"));var s=this.computeJulianDate(o),a=s-2451545,l=r.normalizeAngle360(280.46061837+360.98564736629*a),h=r.normalizeAngle360(l-n.rightAscension),u=t.normalizedDegreesLongitude(-h);return{latitude:n.declination,longitude:u}},computeJulianDate:function(t){if(t instanceof Date==!1)throw new e(i.logMessage(i.LEVEL_SEVERE,"SunPosition","computeJulianDate","missingDate"));var r=t.getUTCFullYear(),n=t.getUTCMonth()+1,o=t.getUTCDate(),s=t.getUTCHours(),a=t.getUTCMinutes(),l=t.getUTCSeconds(),h=(s+a/60+l/3600)/24;n<=2&&(r-=1,n+=12);var u=Math.floor(r/100),c=2-u+Math.floor(u/4),d=Math.floor(365.25*(r+4716))+Math.floor(30.6001*(n+1))+o+c-1524.5;return d+h}};return n}),i("layer/AtmosphereLayer",["../error/ArgumentError","../shaders/GroundProgram","../layer/Layer","../util/Logger","../geom/Matrix","../geom/Matrix3","../geom/Sector","../shaders/SkyProgram","../util/SunPosition","../geom/Vec3","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(t){i.call(this,"Atmosphere"),this.pickEnabled=!1,this._nightImageSource=t||WorldWind.configuration.baseUrl+"images/dnb_land_ocean_ice_2012.png",this._activeLightDirection=new h(0,0,0),this._fullSphereSector=s.FULL_SPHERE,this._skyData={},this._skyWidth=128,this._skyHeight=128,this._numIndices=0,this._texMatrix=o.fromIdentity(),this._activeTexture=null};return c.prototype=Object.create(i.prototype),Object.defineProperties(c.prototype,{nightImageSource:{get:function(){return this._nightImageSource},set:function(t){this._nightImageSource=t}}}),c.prototype.doRender=function(t){t.globe.is2D()||(this.determineLightDirection(t),this.drawSky(t),this.drawGround(t))},c.prototype.applySkyVertices=function(t){var e,i,r=t.currentGlContext,n=t.currentProgram,o=this._skyData;o.verticesVboCacheKey||(o.verticesVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(o.verticesVboCacheKey),i?(r.bindBuffer(r.ARRAY_BUFFER,i),r.vertexAttribPointer(0,3,r.FLOAT,!1,0,0)):(e=this.assembleVertexPoints(t,this._skyHeight,this._skyWidth,n.getAltitude()),i=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,i),r.bufferData(r.ARRAY_BUFFER,e,r.STATIC_DRAW),r.vertexAttribPointer(0,3,r.FLOAT,!1,0,0),t.gpuResourceCache.putResource(o.verticesVboCacheKey,i,4*e.length),t.frameStatistics.incrementVboLoadCount(1))},c.prototype.applySkyIndices=function(t){var e,i,r=t.currentGlContext,n=this._skyData;n.indicesVboCacheKey||(n.indicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(n.indicesVboCacheKey),i?r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i):(e=this.assembleTriStripIndices(this._skyWidth,this._skyHeight),i=r.createBuffer(),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),t.gpuResourceCache.putResource(n.indicesVboCacheKey,i,2*e.length))},c.prototype.drawSky=function(t){var e=t.currentGlContext,i=t.findAndBindProgram(a);i.loadGlobeRadius(e,t.globe.equatorialRadius),i.loadEyePoint(e,t.eyePoint),i.loadVertexOrigin(e,h.ZERO),i.loadModelviewProjection(e,t.modelviewProjection),i.loadLightDirection(e,this._activeLightDirection),i.setScale(e),this.applySkyVertices(t),this.applySkyIndices(t),e.depthMask(!1),e.frontFace(e.CW),e.enableVertexAttribArray(0),e.drawElements(e.TRIANGLE_STRIP,this._numIndices,e.UNSIGNED_SHORT,0),e.depthMask(!0),e.frontFace(e.CCW),e.disableVertexAttribArray(0)},c.prototype.drawGround=function(t){var i,r=t.currentGlContext,n=t.findAndBindProgram(e),o=t.terrain;n.loadGlobeRadius(r,t.globe.equatorialRadius),n.loadEyePoint(r,t.eyePoint),n.loadLightDirection(r,this._activeLightDirection),n.loadOpacity(r,this.opacity),n.setScale(r),this.nightImageSource&&null!==this.time&&(this._activeTexture=t.gpuResourceCache.resourceForKey(this.nightImageSource),this._activeTexture||(this._activeTexture=t.gpuResourceCache.retrieveTexture(r,this.nightImageSource)),i=this._activeTexture&&this._activeTexture.bind(t)),o.beginRendering(t);for(var s=0,a=o.surfaceGeometry.length;s=this.dates.length-1?null:(this.currentIndex++,this.currentTime=this.dates[this.currentIndex],this.currentTime)},i.prototype.previous=function(){return this.currentIndex<=0?null:(this.currentIndex--,this.currentTime=this.dates[this.currentIndex],this.currentTime)},i.prototype.reset=function(){this.currentIndex=-1,this.currentTime=null},i.prototype.getTimeForScale=function(t){return t<=0?this.currentIndex=0:t>=1?this.currentIndex=this.dates.length-1:this.currentIndex=Math.floor(this.dates.length*t),this.currentTime=this.dates[this.currentIndex],this.currentTime},i}),i("gesture/Touch",[],function(){"use strict";var t=function(t,e,i){this.identifier=t,this._clientX=e,this._clientY=i,this._clientStartX=e,this._clientStartY=i};return Object.defineProperties(t.prototype,{clientX:{get:function(){return this._clientX},set:function(t){this._clientX=t}},clientY:{get:function(){return this._clientY},set:function(t){this._clientY=t}},translationX:{get:function(){return this._clientX-this._clientStartX},set:function(t){this._clientStartX=this._clientX-t}},translationY:{get:function(){return this._clientY-this._clientStartY},set:function(t){this._clientStartY=this._clientY-t}}}),t}),i("gesture/GestureRecognizer",["../error/ArgumentError","../util/Logger","../gesture/Touch"],function(t,e,i){"use strict";var r=function(i,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","constructor","missingTarget"));this.target=i,this.enabled=!0,this._state=WorldWind.POSSIBLE,this._nextState=null,this._clientX=0,this._clientY=0,this._clientStartX=0,this._clientStartY=0,this._translationX=0,this._translationY=0,this._translationWeight=.4,this._mouseButtonMask=0,this._touches=[],this._touchCentroidShiftX=0,this._touchCentroidShiftY=0,this._gestureCallbacks=[],this._canRecognizeWith=[],this._requiresFailureOf=[],this._requiredToFailBy=[],n&&this._gestureCallbacks.push(n),this.listenerList=[],r.allRecognizers.push(this)};return r.allRecognizers=[],Object.defineProperties(r.prototype,{state:{get:function(){return this._state},set:function(t){this.transitionToState(t)}},clientX:{get:function(){return this._clientX},set:function(t){this._clientX=t}},clientY:{get:function(){return this._clientY},set:function(t){this._clientY=t}},translationX:{get:function(){return this._translationX},set:function(t){this._translationX=t,this._clientStartX=this._clientX,this._touchCentroidShiftX=0}},translationY:{get:function(){return this._translationY},set:function(t){this._translationY=t,this._clientStartY=this._clientY,this._touchCentroidShiftY=0}},mouseButtonMask:{get:function(){return this._mouseButtonMask}},touchCount:{get:function(){return this._touches.length}},gestureCallbacks:{get:function(){return this._gestureCallbacks}}}),r.prototype.touch=function(i){if(i<0||i>=this._touches.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","touch","indexOutOfRange"));return this._touches[i]},r.prototype.recognizeSimultaneouslyWith=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","recognizeSimultaneouslyWith","The specified gesture recognizer is null or undefined."));var r=this._canRecognizeWith.indexOf(i);r==-1&&(this._canRecognizeWith.push(i),i._canRecognizeWith.push(this))},r.prototype.canRecognizeSimultaneouslyWith=function(t){var e=this._canRecognizeWith.indexOf(t);return e!=-1},r.prototype.requireRecognizerToFail=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"GestureRecognizer","requireRecognizerToFail","The specified gesture recognizer is null or undefined"));var r=this._requiresFailureOf.indexOf(i);r==-1&&(this._requiresFailureOf.push(i),i._requiredToFailBy.push(this))},r.prototype.requiresRecognizerToFail=function(t){var e=this._requiresFailureOf.indexOf(t);return e!=-1},r.prototype.requiredToFailByRecognizer=function(t){var e=this._requiredToFailBy.indexOf(t);return e!=-1},r.prototype.reset=function(){this._state=WorldWind.POSSIBLE,this._nextState=null,this._clientX=0,this._clientY=0,this._clientStartX=0,this._clientStartY=0,this._translationX=0,this._translationY=0,this._mouseButtonMask=0,this._touches=[],this._touchCentroidShiftX=0,this._touchCentroidShiftY=0},r.prototype.prepareToRecognize=function(){},r.prototype.mouseDown=function(t){},r.prototype.mouseMove=function(t){},r.prototype.mouseUp=function(t){},r.prototype.touchStart=function(t){},r.prototype.touchMove=function(t){},r.prototype.touchCancel=function(t){},r.prototype.touchEnd=function(t){},r.prototype.transitionToState=function(t){this._nextState=null,t===WorldWind.FAILED?(this._state=t,this.updateRecognizersWaitingForFailure(),this.resetIfEventsEnded()):t===WorldWind.RECOGNIZED?(this.tryToRecognize(t),this._state===t&&(this.prepareToRecognize(),this.notifyListeners(),this.callGestureCallbacks(),this.resetIfEventsEnded())):t===WorldWind.BEGAN?(this.tryToRecognize(t),this._state===t&&(this.prepareToRecognize(),this.notifyListeners(),this.callGestureCallbacks())):t===WorldWind.CHANGED?(this._state=t,this.notifyListeners(),this.callGestureCallbacks()):t===WorldWind.CANCELLED?(this._state=t,this.notifyListeners(),this.callGestureCallbacks(),this.resetIfEventsEnded()):t===WorldWind.ENDED&&(this._state=t,this.notifyListeners(),this.callGestureCallbacks(),this.resetIfEventsEnded())},r.prototype.updateRecognizersWaitingForFailure=function(){for(var t=0,e=this._requiredToFailBy.length;t0)){var e=1<this.maxMouseMovement&&(this.state=WorldWind.FAILED)}},e.prototype.mouseUp=function(t){if(this.state==WorldWind.POSSIBLE&&0==this.mouseButtonMask){var e=this.clicks.length;e==this.numberOfClicks?(this.clientX=this.clicks[0].clientX,this.clientY=this.clicks[0].clientY,this.state=WorldWind.RECOGNIZED):this.failAfterDelay(this.maxClickInterval)}},e.prototype.touchStart=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.failAfterDelay=function(t){var e=this;e.timeout&&window.clearTimeout(e.timeout),e.timeout=window.setTimeout(function(){e.timeout=null,e.state==WorldWind.POSSIBLE&&(e.state=WorldWind.FAILED)},t)},e.prototype.cancelFailAfterDelay=function(){var t=this;t.timeout&&(window.clearTimeout(t.timeout),t.timeout=null)},e}),i("gesture/DragRecognizer",["../gesture/GestureRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.button=0,this.interpretDistance=5};return e.prototype=Object.create(t.prototype),e.prototype.mouseMove=function(t){this.state==WorldWind.POSSIBLE?this.shouldInterpret()&&(this.shouldRecognize()?(this.translationX=0,this.translationY=0,this.state=WorldWind.BEGAN):this.state=WorldWind.FAILED):this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CHANGED)},e.prototype.mouseUp=function(t){0==this.mouseButtonMask&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.ENDED))},e.prototype.touchStart=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.shouldInterpret=function(){var t=this.translationX,e=this.translationY,i=Math.sqrt(t*t+e*e);return i>this.interpretDistance},e.prototype.shouldRecognize=function(){var t=1<this.interpretDistance},e.prototype.shouldRecognize=function(){var t=this.touchCount;return 0!=t&&t>=this.minNumberOfTouches&&t<=this.maxNumberOfTouches},e}),i("gesture/PinchRecognizer",["../gesture/GestureRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this._scale=1,this._offsetScale=1,this.referenceDistance=0,this.interpretThreshold=20,this.weight=.4,this.pinchTouches=[]};return e.prototype=Object.create(t.prototype),Object.defineProperties(e.prototype,{scale:{get:function(){return this._scale*this._offsetScale}}}),e.prototype.reset=function(){t.prototype.reset.call(this),this._scale=1,this._offsetScale=1,this.referenceDistance=0,this.pinchTouches=[]},e.prototype.mouseDown=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.touchStart=function(t){this.pinchTouches.length<2&&2==this.pinchTouches.push(t)&&(this.referenceDistance=this.currentPinchDistance(),this._offsetScale*=this._scale,this._scale=1)},e.prototype.touchMove=function(t){if(2==this.pinchTouches.length)if(this.state==WorldWind.POSSIBLE)this.shouldRecognize()&&(this.state=WorldWind.BEGAN);else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED){var e=this.currentPinchDistance(),i=Math.abs(e/this.referenceDistance),r=this.weight;this._scale=this._scale*(1-r)+i*r,this.state=WorldWind.CHANGED}},e.prototype.touchEnd=function(t){var e=this.pinchTouches.indexOf(t);e!=-1&&this.pinchTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.ENDED))},e.prototype.touchCancel=function(t){var e=this.pinchTouches.indexOf(t);e!=-1&&this.pinchTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CANCELLED))},e.prototype.prepareToRecognize=function(){this.referenceDistance=this.currentPinchDistance(),this._scale=1},e.prototype.shouldRecognize=function(){var t=this.currentPinchDistance();return Math.abs(t-this.referenceDistance)>this.interpretThreshold},e.prototype.currentPinchDistance=function(){var t=this.pinchTouches[0],e=this.pinchTouches[1],i=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(i*i+r*r)},e}),i("gesture/RotationRecognizer",["../geom/Angle","../gesture/GestureRecognizer"],function(t,e){"use strict";var i=function(t,i){e.call(this,t,i),this._rotation=0,this._offsetRotation=0,this.referenceAngle=0,this.interpretThreshold=20,this.weight=.4,this.rotationTouches=[]};return i.prototype=Object.create(e.prototype),Object.defineProperties(i.prototype,{rotation:{get:function(){return this._rotation+this._offsetRotation}}}),i.prototype.reset=function(){e.prototype.reset.call(this),this._rotation=0,this._offsetRotation=0,this.referenceAngle=0,this.rotationTouches=[]},i.prototype.mouseDown=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},i.prototype.touchStart=function(t){this.rotationTouches.length<2&&2==this.rotationTouches.push(t)&&(this.referenceAngle=this.currentTouchAngle(),this._offsetRotation+=this._rotation, -this._rotation=0)},i.prototype.touchMove=function(e){if(2==this.rotationTouches.length)if(this.state==WorldWind.POSSIBLE)this.shouldRecognize()&&(this.state=WorldWind.BEGAN);else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED){var i=this.currentTouchAngle(),r=t.normalizedDegrees(i-this.referenceAngle),n=this.weight;this._rotation=this._rotation*(1-n)+r*n,this.state=WorldWind.CHANGED}},i.prototype.touchEnd=function(t){var e=this.rotationTouches.indexOf(t);e!=-1&&this.rotationTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.ENDED))},i.prototype.touchCancel=function(t){var e=this.rotationTouches.indexOf(t);e!=-1&&(this.rotationTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CANCELLED)))},i.prototype.prepareToRecognize=function(){this.referenceAngle=this.currentTouchAngle(),this._rotation=0},i.prototype.shouldRecognize=function(){var e=this.currentTouchAngle(),i=t.normalizedDegrees(e-this.referenceAngle);return Math.abs(i)>this.interpretThreshold},i.prototype.currentTouchAngle=function(){var e=this.rotationTouches[0],i=this.rotationTouches[1],r=e.clientX-i.clientX,n=e.clientY-i.clientY;return Math.atan2(n,r)*t.RADIANS_TO_DEGREES},i}),i("gesture/TapRecognizer",["../gesture/GestureRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.numberOfTaps=1,this.numberOfTouches=1,this.maxTouchMovement=20,this.maxTapDuration=500,this.maxTapInterval=400,this.taps=[],this.timeout=null};return e.prototype=Object.create(t.prototype),e.prototype.reset=function(){t.prototype.reset.call(this),this.taps=[],this.cancelFailAfterDelay()},e.prototype.mouseDown=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.touchStart=function(t){if(this.state==WorldWind.POSSIBLE){var e;this.touchCount>this.numberOfTouches?this.state=WorldWind.FAILED:1==this.touchCount?(e={touchCount:this.touchCount,clientX:this.clientX,clientY:this.clientY},this.taps.push(e),this.failAfterDelay(this.maxTapDuration)):(e=this.taps[this.taps.length-1],e.touchCount=this.touchCount,e.clientX=this.clientX,e.clientY=this.clientY)}},e.prototype.touchMove=function(t){if(this.state==WorldWind.POSSIBLE){var e=this.translationX,i=this.translationY,r=Math.sqrt(e*e+i*i);r>this.maxTouchMovement&&(this.state=WorldWind.FAILED)}},e.prototype.touchEnd=function(t){if(this.state==WorldWind.POSSIBLE&&0==this.touchCount){var e=this.taps.length,i=this.taps[e-1];i.touchCount!=this.numberOfTouches?this.state=WorldWind.FAILED:e==this.numberOfTaps?(this.clientX=this.taps[0].clientX,this.clientY=this.taps[0].clientY,this.state=WorldWind.RECOGNIZED):this.failAfterDelay(this.maxTapInterval)}},e.prototype.touchCancel=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.failAfterDelay=function(t){var e=this;e.timeout&&window.clearTimeout(e.timeout),e.timeout=window.setTimeout(function(){e.timeout=null,e.state==WorldWind.POSSIBLE&&(e.state=WorldWind.FAILED)},t)},e.prototype.cancelFailAfterDelay=function(){var t=this;t.timeout&&(window.clearTimeout(t.timeout),t.timeout=null)},e}),i("gesture/TiltRecognizer",["../gesture/PanRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.maxTouchDistance=250,this.maxTouchDivergence=50};return e.LEFT=1,e.RIGHT=2,e.UP=4,e.DOWN=8,e.prototype=Object.create(t.prototype),e.prototype.shouldInterpret=function(){for(var t=0,e=this.touchCount;tthis.interpretDistance)return!0}return!1},e.prototype.shouldRecognize=function(){var t=this.touchCount;if(t<2)return!1;var i=this.touch(0),r=this.touch(1),n=i.clientX-r.clientX,o=i.clientY-r.clientY,s=Math.sqrt(n*n+o*o);if(s>this.maxTouchDistance)return!1;var a=i.translationX-r.translationX,l=i.translationY-r.translationY,h=Math.sqrt(a*a+l*l);if(h>this.maxTouchDivergence)return!1;var u=e.UP|e.DOWN,c=this.touchDirection(i)&u,d=this.touchDirection(r)&u;return 0!=(c&d)},e.prototype.touchDirection=function(t){var i=t.translationX,r=t.translationY,n=0;return Math.abs(i)>Math.abs(r)?(n|=i<0?e.LEFT:0,n|=i>0?e.RIGHT:0):(n|=r<0?e.UP:0,n|=r>0?e.DOWN:0),n},e}),i("WorldWindowController",["./error/ArgumentError","./util/Logger","./error/UnsupportedOperationError"],function(t,e,i){"use strict";var r=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WorldWindowController","constructor","missingWorldWindow"));this.wwd=i,this.allGestureListeners=[]};return r.prototype.onGestureEvent=function(t){for(var e=!1,i=0;i=1&&this.opacity>=1){this.previousTiles={};for(var e=0;e0&&(t.surfaceTileRenderer.renderTiles(t,this.currentTiles,this.opacity,t.surfaceOpacity>=1),t.frameStatistics.incrementImageTileCount(this.currentTiles.length),this.inCurrentFrame=!0)}},c.prototype.fadeOutgoingTiles=function(t){for(var e=(t.timestamp-t.previousRedrawTimestamp)/t.fadeTime,i={},r=0;r0&&!i[n.imagePath]&&(n.opacity=Math.max(0,n.opacity-e),n.opacity>0&&(this.currentTiles.push(n),this.currentTilesInvalid=!0,t.redrawRequested=!0)))},c.prototype.isLayerInView=function(t){return t.terrain&&t.terrain.sector&&t.terrain.sector.intersects(this.levels.sector)},c.prototype.createTopLevelTiles=function(t){this.topLevelTiles=[],h.createTilesForLevel(this.levels.firstLevel(),this,this.topLevelTiles)},c.prototype.assembleTiles=function(t){this.currentTiles=[],this.topLevelTiles&&0!==this.topLevelTiles.length||this.createTopLevelTiles(t);for(var e=0,i=this.topLevelTiles.length;e=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},c.prototype.isTileTextureInMemory=function(t,e){return t.gpuResourceCache.containsResource(e.imagePath)},c.prototype.isTextureExpired=function(t){return this.expiration&&t.creationTime.getTime()<=this.expiration.getTime()},c.prototype.retrieveTileImage=function(t,e,i){if(this.currentRetrievals.indexOf(e.imagePath)<0){if(this.currentRetrievals.length>this.retrievalQueueSize)return;if(this.absentResourceList.isResourceAbsent(e.imagePath))return;var r=this.resourceUrlForTile(e,this.retrievalImageFormat),n=new Image,s=e.imagePath,a=t.gpuResourceCache,l=t.currentGlContext.canvas,h=this;if(!r)return void(this.currentTilesInvalid=!0);n.onload=function(){o.log(o.LEVEL_INFO,"Image retrieval succeeded: "+r);var u=h.createTexture(t,e,n);if(h.removeFromCurrentRetrievals(s),u&&(a.putResource(s,u,u.size),h.currentTilesInvalid=!0,h.absentResourceList.unmarkResourceAbsent(s),!i)){var c=document.createEvent("Event");c.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),l.dispatchEvent(c)}},n.onerror=function(){h.removeFromCurrentRetrievals(s),h.absentResourceList.markResourceAbsent(s),o.log(o.LEVEL_WARNING,"Image retrieval failed: "+r)},this.currentRetrievals.push(s),n.crossOrigin=this.crossOrigin,n.src=r}},c.prototype.createTexture=function(t,e,i){return new l(t.currentGlContext,i)},c.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},c.prototype.resourceUrlForTile=function(t,e){return this.urlBuilder?this.urlBuilder.urlForTile(t,e):null},c}),i("layer/MercatorTiledImageLayer",["../util/Color","../geom/Sector","../layer/TiledImageLayer","../geom/Vec2","../util/WWMath"],function(t,e,i,r,n){"use strict";var o=function(t,e,n,o,s,a,l){i.call(this,t,e,n,o,s,a,l),this.detectBlankImages=!1,this.testPixels=[new r(20,20),new r(235,20),new r(20,235),new r(235,235)],this.destCanvas=document.createElement("canvas"),this.destContext=this.destCanvas.getContext("2d")};return o.prototype=Object.create(i.prototype),o.prototype.createTile=function(t,r,o,s){var a,l,h,u,c,d,p=this.mapSizeForLevel(r.levelNumber),f=n.clamp(s*this.imageSize,0,p),g=n.clamp(o*this.imageSize,0,p),m=n.clamp(f+this.imageSize,0,p),y=n.clamp(g+this.imageSize,0,p);return a=f/p-.5,l=.5-y/p,h=90-360*Math.atan(Math.exp(2*-l*Math.PI))/Math.PI,u=360*a,a=m/p-.5,l=.5-g/p,c=90-360*Math.atan(Math.exp(2*-l*Math.PI))/Math.PI,d=360*a,t=new e(h,c,u,d),i.prototype.createTile.call(this,t,r,o,s)},o.prototype.createTexture=function(t,e,r){var o,s,a,l,h,u,c,d,p=t.canvas2D,f=t.ctx2D,g=this.destCanvas,m=this.destContext,y=m.createImageData(r.width,r.height),E=e.sector,v=n.gudermannianInverse(E.minLatitude),_=n.gudermannianInverse(E.maxLatitude);if(p.width=r.width,p.height=r.height,g.width=r.width,g.height=r.height,f.drawImage(r,0,0,r.width,r.height),o=f.getImageData(0,0,r.width,r.height),this.detectBlankImages&&this.isBlankImage(r,o))return this.absentResourceList.markResourceAbsentPermanently(e.imagePath),null;for(var b=0;b<1;b++)for(var S=0;S0;s--)r=0,n=1<=0&&this.renderables.splice(e,1)},r.prototype.removeAllRenderables=function(){this.renderables=[]},r.prototype.doRender=function(t){for(var e=t.orderedRenderables.length,r=0,n=this.renderables.length;re&&(this.inCurrentFrame=!0)},r}),i("render/SurfaceTile",["../error/ArgumentError","../util/Logger","../geom/Matrix","../geom/Sector","../error/UnsupportedOperationError"],function(t,e,i,r,n){"use strict";var o=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","constructor","missingSector"));this.sector=i};return o.prototype.bind=function(t){throw new n(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","bind","abstractInvocation"))},o.prototype.applyInternalTransform=function(t,i){throw new n(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","applyInternalTransform","abstractInvocation"))},o}),i("shapes/SurfaceImage",["../error/ArgumentError","../util/Logger","../pick/PickedObject","../render/SurfaceTile"],function(t,e,i,r){"use strict";var n=function(i,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","constructor","missingSector"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","constructor","missingImage"));r.call(this,i),this.enabled=!0,this._imageSource=n,this.resamplingMode=WorldWind.FILTER_LINEAR,this.opacity=1,this.displayName="Surface Image",this.imageSourceWasUpdated=!0};return n.prototype=Object.create(r.prototype),Object.defineProperties(n.prototype,{imageSource:{get:function(){return this._imageSource},set:function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","imageSource","missingImage"));this._imageSource=i,this.imageSourceWasUpdated=!0}}}),n.prototype.bind=function(t){var e=t.gpuResourceCache.resourceForKey(this._imageSource);return e&&!this.imageSourceWasUpdated?this.bindTexture(t,e):(e=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this._imageSource),this.imageSourceWasUpdated=!1,e?this.bindTexture(t,e):void 0)},n.prototype.bindTexture=function(t,e){var i=t.currentGlContext;return e.setTexParameter(i.TEXTURE_MAG_FILTER,this.resamplingMode===WorldWind.FILTER_NEAREST?i.NEAREST:i.LINEAR),e.bind(t)},n.prototype.applyInternalTransform=function(t,e){},n.prototype.render=function(t){if(this.enabled&&t.terrain&&this.sector.overlaps(t.terrain.sector)){if(t.pickingMode&&(this.pickColor=t.uniquePickColor()),t.surfaceTileRenderer.renderTiles(t,[this],this.opacity*t.currentLayer.opacity),t.pickingMode){var e=new i(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(e)}t.currentLayer.inCurrentFrame=!0}},n}),i("layer/BMNGOneImageLayer",["../layer/RenderableLayer","../geom/Sector","../shapes/SurfaceImage","../util/WWUtil"],function(t,e,i,r){"use strict";var n=function(){t.call(this,"Blue Marble Image");var r=new i(e.FULL_SPHERE,WorldWind.configuration.baseUrl+"images/BMNG_world.topo.bathy.200405.3.2048x1024.jpg");this.addRenderable(r),this.pickEnabled=!1,this.minActiveAltitude=3e6};return n.prototype=Object.create(t.prototype),n}),i("util/PeriodicTimeSequence",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"PeriodicTimeSequence","constructor","missingString"));var n=r.split("/");if(3!==n.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"PeriodicTimeSequence","constructor","The interval string "+r+" does not contain 3 elements."));this.sequenceString=r,this.startTime=new Date(n[0]),this.endTime=new Date(n[1]),this.intervalMilliseconds=this.endTime.getTime()-this.startTime.getTime(),this._currentTime=this.startTime,this.infiniteInterval=this.startTime.getTime()==this.endTime.getTime(),this.period=i.parsePeriodString(n[2],!1)};return Object.defineProperties(i.prototype,{currentTime:{get:function(){return this._currentTime},set:function(t){this._currentTime=t}},scaleForCurrentTime:{get:function(){return this.currentTime?(this.currentTime.getTime()-this.startTime.getTime())/this.intervalMilliseconds:1}}}),i.prototype.next=function(){return this.currentTime?this.currentTime.getTime()>=this.endTime.getTime()&&!this.infiniteInterval?this.currentTime=null:this.currentTime=i.incrementTime(this.currentTime,this.period):this.currentTime=this.startTime,this.currentTime},i.prototype.previous=function(){return this.currentTime?this.currentTime.getTime()===this.startTime.getTime()?this.currentTime=null:this.currentTime=this.getTimeForScale(.9999*this.scaleForCurrentTime):this.currentTime=this.endTime,this.currentTime},i.prototype.reset=function(){this.currentTime=null},i.prototype.getTimeForScale=function(t){if(t<=0)return this.startTime;if(t>=1)return this.endTime;var e=new Date(this.startTime.getTime()),r=e,n=0;for(n=0;n0;h--)a[h]>=l[h]&&(a[h-1]=a[h-1]+Math.floor(a[h]/l[h]),a[h]=a[h]%l[h]);return a},i}),i("util/LevelRowColumnUrlBuilder",["../error/ArgumentError","../util/Logger","../util/WWUtil"],function(t,e,i){"use strict";var r=function(t,e){this.serverAddress=t,t&&0!==t.length||(this.serverAddress=i.currentUrlSansFilePart()),this.pathToData=e};return r.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","The image format is null or undefined."));var o=this.serverAddress;return this.pathToData&&(o=o+"/"+this.pathToData),o=o+"/"+r.level.levelNumber.toString(),o=o+"/"+r.row.toString(),o=o+"/"+r.row.toString()+"_"+r.column.toString(),o=o+"."+i.suffixForMimeType(n),o=o.replace(" ","%20")},r}),i("layer/RestTiledImageLayer",["../error/ArgumentError","../geom/Location","../util/Logger","../geom/Sector","../layer/TiledImageLayer","../util/LevelRowColumnUrlBuilder","../util/WWUtil"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,a,l){var h=s.urlPath(t+"/"+i);n.call(this,l&&l.sector||r.FULL_SPHERE,l&&l.levelZeroTileDelta||new e(45,45),l&&l.numLevels||5,l&&l.imageFormat||"image/jpeg",h,l&&l.tileWidth||256,l&&l.tileHeight||256),this.displayName=a,this.pickEnabled=!1,this.urlBuilder=new o(t,i)};return a.prototype=Object.create(n.prototype),a}),i("layer/BMNGRestLayer",["../error/ArgumentError","../layer/Layer","../util/Logger","../util/PeriodicTimeSequence","../layer/RestTiledImageLayer"],function(t,e,i,r,n){"use strict";var o=function(t,i,n,s){e.call(this,n||"Blue Marble time series"),this.time=s||new Date("2004-01"),this.timeSequence=new r("2004-01-01/2004-12-01/P1M"),this.serverAddress=t,this.pathToData=i,this.layers={},this.layerNames=[{month:"BlueMarble-200401",time:o.availableTimes[0]},{month:"BlueMarble-200402",time:o.availableTimes[1]},{month:"BlueMarble-200403",time:o.availableTimes[2]},{month:"BlueMarble-200404",time:o.availableTimes[3]},{month:"BlueMarble-200405",time:o.availableTimes[4]},{month:"BlueMarble-200406",time:o.availableTimes[5]},{month:"BlueMarble-200407",time:o.availableTimes[6]},{month:"BlueMarble-200408",time:o.availableTimes[7]},{month:"BlueMarble-200409",time:o.availableTimes[8]},{month:"BlueMarble-200410",time:o.availableTimes[9]},{month:"BlueMarble-200411",time:o.availableTimes[10]},{month:"BlueMarble-200412",time:o.availableTimes[11]}],this.pickEnabled=!1};return o.prototype=Object.create(e.prototype),o.availableTimes=[new Date("2004-01"),new Date("2004-02"),new Date("2004-03"),new Date("2004-04"),new Date("2004-05"),new Date("2004-06"),new Date("2004-07"),new Date("2004-08"),new Date("2004-09"),new Date("2004-10"),new Date("2004-11"),new Date("2004-12")],o.prototype.prePopulate=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"BMNGRestLayer","prePopulate","missingWorldWindow"));for(var r=0;r=this.layerNames[11].time.getTime())return this.layerNames[11].month;for(var i=0;i=r&&e<=n){var o=e-r,s=n-e;return o1){e=!1;break}return e},fetchFile:function(e,i){var r=new XMLHttpRequest;r.onload=function(){this.status>=200&&this.status<400?i(this.response):(t.log(t.LEVEL_SEVERE,"sever error: "+this.status),i(null))},r.onerror=function(e){t.log(t.LEVEL_SEVERE,"connection error: "+e),i(null)},r.open("get",e,!0),r.send()}};return e}),i("formats/collada/ColladaImage",["./ColladaUtils"],function(t){"use strict";var e=function(t,e){this.filename="",this.map=t,this.name=e,this.path=""};return e.prototype.parse=function(e){for(var i=0;i3&&(0===T&&(S=w),T>2*u&&((S>65535||L>65535)&&(v=!0),m.push(S),m.push(L))),w>65535&&(v=!0),m.push(w),y+=u}}var I={vertices:new Float32Array(h[0][1]),indexedRendering:E,material:a};return I.indexedRendering&&(I.indices=v?new Uint32Array(m):new Uint16Array(m)),this.transformMeshInfo(I,h),I},e.prototype.parseInputs=function(t,e,i){for(var r=[],n=0,o=t.querySelectorAll("input"),s=0;sr?1:i===r?0:-1})},h.prototype.flattenNode=function(t){if(t.mesh)for(var e=t.mesh,i=this._meshes[e].buffers,r=0,n=i.length;r0;u&&(l.textures.diffuse?h=l.textures.diffuse.mapId:l.textures.reflective&&(h=l.textures.reflective.mapId)),this._entities.push({mesh:i[r],material:l,node:t,imageKey:h})}for(var c=0;c=1||t.pickingMode),r.loadColor(i,t.pickingMode?this.pickColor:this._tmpColor),r.loadOpacity(i,t.pickingMode?o>0?1:0:o)},h.prototype.applyMatrix=function(t,e,i,r,n){this._mvpMatrix.copy(t.modelviewProjection),this._mvpMatrix.multiplyMatrix(this._transformationMatrix),r&&this._localTransforms&&this._mvpMatrix.multiplyMatrix(r),e&&!t.pickingMode&&(this._normalMatrix.copy(t.modelviewNormalTransform),this._normalMatrix.multiplyMatrix(this._normalTransformMatrix),n&&this._localTransforms&&this._normalMatrix.multiplyMatrix(n),t.currentProgram.loadModelviewInverse(t.currentGlContext,this._normalMatrix)),i&&this._activeTexture&&(t.currentProgram.loadTextureMatrix(t.currentGlContext,this._texCoordMatrix),this._activeTexture=null),t.currentProgram.loadModelviewProjection(t.currentGlContext,this._mvpMatrix)},h.prototype.endDrawing=function(t){ -var e=t.currentGlContext,i=t.currentProgram;e.disableVertexAttribArray(1),e.disableVertexAttribArray(2),i.loadApplyLighting(e,0),i.loadTextureEnabled(e,!1)},h.prototype.computeTransformationMatrix=function(t){this._transformationMatrix.setToIdentity(),this._transformationMatrix.multiplyByLocalCoordinateTransform(this._placePoint,t),this._transformationMatrix.multiplyByRotation(1,0,0,this._xRotation),this._transformationMatrix.multiplyByRotation(0,1,0,this._yRotation),this._transformationMatrix.multiplyByRotation(0,0,1,this._zRotation),this._transformationMatrix.multiplyByScale(this._scale,this._scale,this._scale),this._transformationMatrix.multiplyByTranslation(this._xTranslation,this._yTranslation,this._zTranslation),this.computeNormalMatrix()},h.prototype.computeNormalMatrix=function(){this._transformationMatrix.extractRotationAngles(this._tmpVector),this._normalTransformMatrix.setToIdentity(),this._normalTransformMatrix.multiplyByRotation(-1,0,0,this._tmpVector[0]),this._normalTransformMatrix.multiplyByRotation(0,-1,0,this._tmpVector[1]),this._normalTransformMatrix.multiplyByRotation(0,0,-1,this._tmpVector[2])},h.prototype.mustRenderNode=function(t){var e=!0;if(this._hideNodes){var i=this._nodesToHide.indexOf(t);e=i===-1}return e},h}),i("formats/collada/ColladaLoader",["../../error/ArgumentError","./ColladaAsset","./ColladaImage","./ColladaMaterial","./ColladaMesh","./ColladaNode","./ColladaScene","./ColladaUtils","../../util/Logger"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(e,i){if(!e)throw new t(l.logMessage(l.LEVEL_SEVERE,"ColladaLoader","constructor","missingPosition"));this.position=e,this.dirPath="/",this.init(i)};return h.prototype.init=function(t){t&&(this.dirPath=t.dirPath||"/"),this.scene={type:"SceneTree",dirPath:this.dirPath,images:{},metadata:{},materials:{},meshes:{},root:{children:[]}},this.xmlDoc=null},h.prototype.load=function(t,e){t.indexOf("://")===-1&&(t=this.dirPath+t),a.fetchFile(t,function(t){if(t)try{i=this.parse(t)}catch(t){i=null,l.log(l.LEVEL_SEVERE,"error parsing collada file: "+t)}else var i=null;e(i)}.bind(this))},h.prototype.parse=function(t){this.init();var i=new DOMParser;this.xmlDoc=i.parseFromString(t,"text/xml");var r=this.xmlDoc.querySelectorAll("library_nodes node"),n=this.xmlDoc.querySelectorAll("library_effects effect");return this.scene.metadata=new e(this.xmlDoc).parse(),this.parseLib("visual_scene",r),this.parseLib("library_geometries"),this.parseLib("library_materials",n),this.parseLib("library_images"),this.xmlDoc=null,new s(this.position,this.scene)},h.prototype.parseLib=function(t,e){var s=this.xmlDoc.getElementsByTagName(t),l=[];s&&s.length&&(l=s[0].childNodes);for(var h=0;h0&&this.drawLabel(t),this.currentVisibility<1&&this.markerImageSource&&this.drawMarker(t),this.activeAttributes.depthTest||e.enable(e.DEPTH_TEST)},p.prototype.drawLabel=function(t){var e,i=t.currentGlContext,r=t.currentProgram;!t.pickingMode&&this.activeTexture&&(p.matrix.setToIdentity(),p.matrix.multiplyByTextureTransform(this.activeTexture),e=this.activeTexture.bind(t),r.loadTextureEnabled(i,e),r.loadTextureMatrix(i,p.matrix)),p.matrix.copy(t.screenProjection),p.matrix.multiplyMatrix(this.imageTransform),r.loadModelviewProjection(i,p.matrix),i.drawArrays(i.TRIANGLE_STRIP,0,4)},p.prototype.drawMarker=function(t){var e,i=t.currentGlContext,r=t.currentProgram,n=t.gpuResourceCache.resourceForKey(this.markerImageSource);if(!n)return void t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.markerImageSource);t.pickingMode||(p.matrix.setToIdentity(),p.matrix.multiplyByTextureTransform(n),e=n.bind(t),r.loadTextureEnabled(i,e),r.loadTextureMatrix(i,p.matrix),r.loadOpacity(i,this.layer.opacity*(1-this.currentVisibility)));var o=this.markerImageScale;p.matrix.copy(t.screenProjection),p.matrix.multiplyByTranslation(this.screenPoint[0]-o*n.imageWidth/2,this.screenPoint[1]-o*n.imageWidth/2,this.screenPoint[2]),p.matrix.multiplyByScale(n.imageWidth*o,n.imageHeight*o,1),r.loadModelviewProjection(i,p.matrix),i.drawArrays(i.TRIANGLE_STRIP,0,4)},p}),i("shapes/ScreenText",["../error/ArgumentError","../util/Logger","../util/Offset","../shapes/Text"],function(t,e,i,r){"use strict";var n=function(i,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Text","constructor","missingOffset"));r.call(this,n),this.screenOffset=i,this.altitudeMode=null};return n.prototype=Object.create(r.prototype),n.prototype.render=function(t){this.lastFrameTime!==t.timestamp&&r.prototype.render.call(this,t)},n.prototype.computeScreenPointAndEyeDistance=function(t){var e=t.currentGlContext,i=this.screenOffset.offsetForSize(e.drawingBufferWidth,e.drawingBufferHeight);return this.screenPoint[0]=i[0],this.screenPoint[1]=i[1],this.screenPoint[2]=0,this.eyeDistance=0,!0},n}),i("layer/CoordinatesDisplayLayer",["../error/ArgumentError","../util/Color","../util/Font","../layer/Layer","../util/Logger","../util/Offset","../geom/Position","../shapes/ScreenImage","../shapes/ScreenText","../shapes/TextAttributes","../geom/Vec2"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(i){function s(t){p.handleUIEvent(t)}function u(t,e){p.handleRedraw(e)}if(!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"CoordinatesDisplayLayer","constructor","missingWorldWindow"));r.call(this,"Coordinates"),this.wwd=i,this.pickEnabled=!1,this.eventType=null,this.clientX=null,this.clientY=null,this.terrainPosition=null,this.latText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.latText.attributes=new h(null),this.latText.attributes.color=e.YELLOW,this.lonText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.lonText.attributes=new h(null),this.lonText.attributes.color=e.YELLOW,this.elevText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.elevText.attributes=new h(null),this.elevText.attributes.color=e.YELLOW,this.eyeText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.eyeText.attributes=new h(null),this.eyeText.attributes.color=e.YELLOW;var c=new o(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,.5),d=WorldWind.configuration.baseUrl+"images/crosshair.png";this.crosshairImage=new a(c,d);var p=this;window.PointerEvent?(i.addEventListener("pointerdown",s),i.addEventListener("pointermove",s),i.addEventListener("pointerleave",s)):(i.addEventListener("mousedown",s),i.addEventListener("mousemove",s),i.addEventListener("mouseleave",s),i.addEventListener("touchstart",s),i.addEventListener("touchmove",s)),this.wwd.redrawCallbacks.push(u)};return c.prototype=Object.create(r.prototype),c.prototype.doRender=function(t){var e,i,r,n,s,a=this.terrainPosition,l=t.eyePosition,h=t.currentGlContext.canvas.clientWidth;h>650?(e=h/2-50,i=11,r=WorldWind.OFFSET_PIXELS,n=0):h>400?(e=60,i=5,r=WorldWind.OFFSET_INSET_PIXELS,n=1):(e=60,i=5,r=WorldWind.OFFSET_INSET_PIXELS,n=1,s=!0),this.latText.text=a?this.formatLatitude(a.latitude):null,this.latText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.latText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.latText.render(t),e+=70,this.lonText.text=a?this.formatLongitude(a.longitude):null,this.lonText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.lonText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.lonText.render(t),t.globe.is2D()||(e+=70,this.elevText.text=a?this.formatAltitude(a.altitude,"m"):null,this.elevText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.elevText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.elevText.render(t)),s||(e+=40,this.eyeText.text="Eye "+this.formatAltitude(l.altitude,l.altitude<1e3?"m":"km"),this.eyeText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.eyeText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,0,WorldWind.OFFSET_FRACTION,n),this.eyeText.render(t)),"touch"===this.eventType&&this.crosshairImage.render(t),this.inCurrentFrame=!0},c.prototype.handleUIEvent=function(t){t.type.indexOf("pointer")!==-1?this.eventType=t.pointerType:t.type.indexOf("mouse")!==-1?this.eventType="mouse":t.type.indexOf("touch")!==-1&&(this.eventType="touch"),t.type.indexOf("leave")!==-1?(this.clientX=null,this.clientY=null):(this.clientX=t.clientX,this.clientY=t.clientY),this.wwd.redraw()},c.prototype.handleRedraw=function(t){if(t===WorldWind.BEFORE_REDRAW){var e,i;("mouse"===this.eventType||"pen"===this.eventType)&&this.clientX&&this.clientY?(e=this.wwd.canvasCoordinates(this.clientX,this.clientY),e[0]>=0&&e[0]=0&&e[1]i?-1:e2e3&&(this.frameTimeAverage=this.frameTimeCumulative/this.frameCount,this.frameRateAverage=1e3*this.frameCount/(t-this.frameTimeBase),this.frameTimeMin=this.frameTimeExtremes[0],this.frameTimeMax=this.frameTimeExtremes[1],this.frameCount=0,this.frameTimeCumulative=0,this.frameTimeBase=t,this.frameTimeExtremes=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY])},t.prototype.incrementRenderedTileCount=function(t){this.renderedTileCount+=t},t.prototype.setTerrainTileCount=function(t){this.terrainTileCount=t},t.prototype.incrementImageTileCount=function(t){this.imageTileCount=t},t.prototype.incrementTileUpdateCount=function(t){this.tileUpdateCount+=t},t.prototype.incrementTextureLoadCount=function(t){this.textureLoadCount+=t},t.prototype.incrementVboLoadCount=function(t){this.vboLoadCount+=t},t}),i("render/FramebufferTexture",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(t,e){"use strict";var i=function(i,r,n,o){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"FramebufferTexture","constructor","missingGlContext"));if(r<0||n<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"FramebufferTexture","constructor","The framebuffer width or height is less than zero."));this.width=r,this.height=n,this.depth=o,this.size=r*n*4+(o?r*n*2:0),this.framebufferId=i.createFramebuffer(),i.bindFramebuffer(i.FRAMEBUFFER,this.framebufferId),this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,r,n,0,i.RGBA,i.UNSIGNED_BYTE,null),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,this.texture,0),this.depthBuffer=null,o&&(this.depthBuffer=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,this.depthBuffer),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_COMPONENT16,r,n),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,this.depthBuffer));var s=i.checkFramebufferStatus(i.FRAMEBUFFER);s!=i.FRAMEBUFFER_COMPLETE&&(e.logMessage(e.LEVEL_WARNING,"FramebufferTexture","constructor","Error creating framebuffer: "+s),this.framebufferId=null,this.texture=null,this.depthBuffer=null),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindRenderbuffer(i.RENDERBUFFER,null),i.bindTexture(i.TEXTURE_2D,null)};return i.prototype.bind=function(t){return this.texture&&t.currentGlContext.bindTexture(gl.TEXTURE_2D,this.texture),!!this.texture},i}),i("render/FramebufferTile",["../error/ArgumentError","../render/FramebufferTexture","../util/Logger","../geom/Matrix","../geom/Rectangle","../render/TextureTile"],function(t,e,i,r,n,o){"use strict";var s=function(e,n,s,a,l){if(!l||l.length<1)throw new t(i.logMessage(i.LEVEL_SEVERE,"FramebufferTile","constructor","The specified cache name is null, undefined or zero length."));o.call(this,e,n,s,a),this.gpuCacheKey=l,this.textureTransform=r.fromIdentity().setToUnitYFlip(),this.mustClear=!0};return s.prototype=Object.create(o.prototype),s.prototype.clearFramebuffer=function(t){this.mustClear=!0},s.prototype.bindFramebuffer=function(t){var e=t.gpuResourceCache.resourceForKey(this.gpuCacheKey);return e||(e=this.createFramebuffer(t)),t.bindFramebuffer(e),this.mustClear&&(this.doClearFramebuffer(t),this.mustClear=!1),!0},s.prototype.createFramebuffer=function(t){var i=new e(t.currentGlContext,this.tileWidth,this.tileHeight,!1);return t.gpuResourceCache.putResource(this.gpuCacheKey,i,i.size),i},s.prototype.doClearFramebuffer=function(t){var e=t.currentGlContext;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},s.prototype.applyInternalTransform=function(t,e){e.multiplyMatrix(this.textureTransform)},s}),i("render/FramebufferTileController",["../error/ArgumentError","../render/FramebufferTile","../util/LevelSet","../geom/Location","../util/Logger","../cache/MemoryCache","../geom/Sector","../util/Tile"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(){this.tileWidth=256,this.tileHeight=256,this.detailControl=1.75,this.levels=new i(s.FULL_SPHERE,new r(45,45),16,this.tileWidth,this.tileHeight),this.topLevelTiles=[],this.currentTiles=[],this.currentTimestamp=null,this.currentGlobeStateKey=null,this.tileCache=new o(5e5,4e5),this.key="FramebufferTileController "+ ++l.keyPool};return l.keyPool=0,l.prototype.selectTiles=function(e,i){if(!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"FramebufferTileController","selectTiles","missingSector"));this.assembleTiles(e);for(var r=[],o=0,s=this.currentTiles.length;o=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},l}),i("globe/ElevationModel",["../error/ArgumentError","../geom/Angle","../geom/Location","../util/Logger"],function(t,e,i,r){"use strict";var n=function(){this.id=0,this.stateKey="",this.coverages=[],this.scratchLocation=new i(0,0),this.computeStateKey()};return Object.defineProperties(n.prototype,{timestamp:{get:function(){var t,e,i=0;for(t=0,e=this.coverages.length;tt&&(t=r.maxElevation)}return t!==-Number.MAX_VALUE?t:0}}}),n.idPool=0,n.prototype.computeStateKey=function(){this.id=++n.idPool,this.stateKey="elevationModel "+this.id.toString()+" "},n.prototype.coverageComparator=function(t,e){var i=t.resolution,r=e.resolution;return i>r?-1:i===r?0:1},n.prototype.performCoverageListChangedActions=function(){this.coverages.length>1&&this.coverages.sort(this.coverageComparator),this.computeStateKey()},n.prototype.addCoverage=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","addCoverage","missingCoverage"));return!this.containsCoverage(e)&&(this.coverages.push(e),this.performCoverageListChangedActions(),!0)},n.prototype.removeAllCoverages=function(){this.coverages.length>0&&(this.coverages=[],this.performCoverageListChangedActions())},n.prototype.removeCoverage=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","removeCoverage","missingCoverage"));var i=this.coverages.indexOf(e);i>=0&&(this.coverages.splice(i,1),this.performCoverageListChangedActions())},n.prototype.containsCoverage=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","containsCoverage","missingCoverage"));var i=this.coverages.indexOf(e);return i>=0},n.prototype.minAndMaxElevationsForSector=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","minAndMaxElevationsForSector","missingSector"));for(var i=[Number.MAX_VALUE,-Number.MAX_VALUE],n=this.coverages.length-1;n>=0;n--){var o=this.coverages[n];if(o.enabled&&o.coverageSector.intersects(e)&&o.minAndMaxElevationsForSector(e,i))break}return i[0]!==Number.MAX_VALUE?i:[0,0]},n.prototype.elevationAtLocation=function(t,e){var i,r=this.coverages.length;for(i=r-1;i>=0;i--){var n=this.coverages[i];if(n.enabled&&n.coverageSector.containsLocation(t,e)){var o=n.elevationAtLocation(t,e);if(null!==o)return o}}return 0},n.prototype.preferredCoverageIndex=function(t,e,i){var r,n=this.coverages.length,o=Number.MAX_VALUE,s=-1;for(r=0;ro)return s;o=h,s=r}}return s},n.prototype.bestCoverageAtLocation=function(e,i,n){if(!n||n<0)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","bestCoverageAtLocation","invalidResolution"));this.scratchLocation.set(e,i);var o=this.preferredCoverageIndex(null,this.scratchLocation,n);return o>=0?this.coverages[o]:null},n.prototype.elevationsForGrid=function(e,i,n,o,s){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","elevationsForGrid","missingSector"));if(!i||!n||i<1||n<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","elevationsForGrid","The specified number of latitudinal or longitudinal positions is less than one."));if(!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","elevationsForGrid","missingTargetResolution"));if(!s)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","elevationsForGrid","missingResult"));s.fill(NaN);var a=Number.MAX_VALUE,l=!1,h=this.preferredCoverageIndex(e,null,o);if(h>=0)for(var u=h;!l&&u>=0;u--){var c=this.coverages[u];c.enabled&&c.coverageSector.intersects(e)&&(l=c.elevationsForGrid(e,i,n,s),l&&(a=c.resolution))}if(!l){var d=s.length;for(u=0;u1?s-1:1),T=(w-S)/(a>1?a-1:1),R=h?h:new o(0,0,0),x=0,M=0,C=new Float64Array(a),A=new Float64Array(a);for(p=0,g=S;p0||0!=D?(V>0?(p=Math.sqrt(V),f=Math.sqrt(O*I*D),V>10*N?(g=s.cbrt((p+f)*(p+f)),d=k+.5*g+2*k*k/g):d=k+.5*s.cbrt((p+f)*(p+f))+.5*s.cbrt((p-f)*(p-f))):(p=Math.sqrt(-V),f=Math.sqrt(-8*k*k*k),g=Math.sqrt(O*I*D),m=2*Math.atan2(g,p+f)/3,d=-4*k*Math.sin(m)*Math.cos(Math.PI/6+m)),y=Math.sqrt(d*d+O*D),E=N*(d+y-D)/(2*y),v=(d+y)/(Math.sqrt(E*E+d+y)+E),_=v*C/(v+N),b=Math.sqrt(_*_+x*x),u=(v+N-1)*b/v,c=2*Math.atan2(x,b+_)):(p=Math.sqrt(1-N),f=Math.sqrt(N-I),S=Math.sqrt(N),u=-A*p*f/S,c=f/(S*f+p*Math.sqrt(I))),L=Math.sqrt(2),w=(L-1)*Rf?(n[0]=c[0]+p*(c[3]-c[0])+f*(c[6]-c[0]),n[1]=c[1]+p*(c[4]-c[1])+f*(c[7]-c[1]),n[2]=c[2]+p*(c[5]-c[2])+f*(c[8]-c[2])):(n[0]=c[9]+(1-p)*(c[6]-c[9])+(1-f)*(c[3]-c[9]),n[1]=c[10]+(1-p)*(c[7]-c[10])+(1-f)*(c[4]-c[10]),n[2]=c[11]+(1-p)*(c[8]-c[11])+(1-f)*(c[5]-c[11])),n[0]+=this.referencePoint[0],n[1]+=this.referencePoint[1],n[2]+=this.referencePoint[2],n},n.prototype.update=function(t){r.prototype.update.call(this,t);var e=t.globe.elevationTimestamp();this._elevationTimestamp!=e&&(this._elevationTimestamp=e,this._stateKey=null)},n.prototype.computeStateKey=function(){var t=[];return t.push(this._elevationTimestamp),t.push(this.neighborMap[WorldWind.NORTH]?this.neighborMap[WorldWind.NORTH].compare(this.level):0),t.push(this.neighborMap[WorldWind.SOUTH]?this.neighborMap[WorldWind.SOUTH].compare(this.level):0),t.push(this.neighborMap[WorldWind.EAST]?this.neighborMap[WorldWind.EAST].compare(this.level):0),t.push(this.neighborMap[WorldWind.WEST]?this.neighborMap[WorldWind.WEST].compare(this.level):0),t.join(".")},n}),i("globe/TerrainTileList",["../error/ArgumentError","../util/Logger","../geom/Sector"],function(t,e,i){"use strict";var r=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"TerrainTileList","TerrainTileList","missingTessellator"));this.tessellator=i,this.sector=null,this.tileArray=[]};return Object.defineProperties(r.prototype,{length:{get:function(){return this.tileArray.length}}}),r.prototype.addTile=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"TerrainTileList","addTile","missingTile"));this.tileArray.indexOf(r)==-1&&(this.tileArray.push(r),this.sector?this.sector.union(r.sector):(this.sector=new i(0,0,0,0),this.sector.copy(r.sector)))},r.prototype.removeAllTiles=function(){this.tileArray=[],this.sector=null},r}),i("globe/Tessellator",["../geom/Angle","../error/ArgumentError","../shaders/BasicProgram","../globe/Globe","../shaders/GpuProgram","../util/Level","../util/LevelSet","../geom/Location","../util/Logger","../geom/Matrix","../cache/MemoryCache","../error/NotYetImplementedError","../pick/PickedObject","../geom/Position","../geom/Rectangle","../geom/Sector","../globe/Terrain","../globe/TerrainTile","../globe/TerrainTileList","../util/Tile","../util/WWMath","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_,b){"use strict";var S=function(){this.numRowsTilesInTopLevel=4,this.numColumnsTilesInTopLevel=8,this.maximumSubdivisionDepth=15,this.tileWidth=32,this.tileHeight=32,this.detailControl=40,this.levels=new s(g.FULL_SPHERE,new a(180/this.numRowsTilesInTopLevel,360/this.numColumnsTilesInTopLevel),this.maximumSubdivisionDepth,this.tileWidth,this.tileHeight),this.topLevelTiles={},this.currentTiles=new E(this),this.tileCache=new u(5e6,4e6),this.elevationTimestamp=void 0,this.lastModelViewProjection=h.fromIdentity(),this.vertexPointLocation=-1,this.vertexTexCoordLocation=-1,this.texCoords=null,this.texCoordVboCacheKey="global_tex_coords",this.indices=null,this.indicesVboCacheKey="global_indices",this.baseIndices=null,this.baseIndicesOffset=null,this.numBaseIndices=null,this.indicesNorth=null,this.indicesNorthOffset=null,this.numIndicesNorth=null,this.indicesSouth=null,this.indicesSouthOffset=null,this.numIndicesSouth=null,this.indicesWest=null,this.indicesWestOffset=null,this.numIndicesWest=null,this.indicesEast=null,this.indicesEastOffset=null,this.numIndicesEast=null,this.indicesLoresNorth=null,this.indicesLoresNorthOffset=null,this.numIndicesLoresNorth=null,this.indicesLoresSouth=null,this.indicesLoresSouthOffset=null,this.numIndicesLoresSouth=null,this.indicesLoresWest=null,this.indicesLoresWestOffset=null,this.numIndicesLoresWest=null,this.indicesLoresEast=null,this.indicesLoresEastOffset=null,this.numIndicesLoresEast=null,this.outlineIndicesOffset=null,this.numOutlineIndices=null,this.wireframeIndicesOffset=null,this.numWireframeIndices=null,this.scratchMatrix=h.fromIdentity(),this.scratchElevations=null,this.scratchPrevElevations=null,this.corners={},this.tiles=[]};return S.prototype.tessellate=function(t){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","tessellate","missingDC"));var i=t.globe.elevationTimestamp();if(this.lastGlobeStateKey===t.globeStateKey&&this.lastVerticalExaggeration===t.verticalExaggeration&&this.elevationTimestamp===i&&t.modelviewProjection.equals(this.lastModelViewProjection))return this.lastTerrain;this.lastModelViewProjection.copy(t.modelviewProjection),this.lastGlobeStateKey=t.globeStateKey,this.elevationTimestamp=i,this.lastVerticalExaggeration=t.verticalExaggeration,this.currentTiles.removeAllTiles(),this.topLevelTiles[t.globeStateKey]&&0!=this.topLevelTiles[t.globeStateKey].length||this.createTopLevelTiles(t),this.corners={},this.tiles=[];for(var r=0,n=this.topLevelTiles[t.globeStateKey].length;r=0){var n=r.resourceForKey(this.texCoordVboCacheKey);i.bindBuffer(i.ARRAY_BUFFER,n),i.vertexAttribPointer(this.vertexTexCoordLocation,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(this.vertexTexCoordLocation)}var o=r.resourceForKey(this.indicesVboCacheKey);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,o)},S.prototype.endRendering=function(t){var e=t.currentGlContext;e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.vertexPointLocation>=0&&e.disableVertexAttribArray(this.vertexPointLocation),this.vertexTexCoordLocation>=0&&e.disableVertexAttribArray(this.vertexTexCoordLocation)},S.prototype.beginRenderingTile=function(t,i){if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","beginRenderingTile","missingTile"));var r=t.currentGlContext,n=t.gpuResourceCache;this.scratchMatrix.setToMultiply(t.modelviewProjection,i.transformationMatrix),t.currentProgram.loadModelviewProjection(r,this.scratchMatrix);var o=t.globeStateKey+i.tileKey,s=n.resourceForKey(o);s?i.pointsVboStateKey!=i.pointsStateKey?(r.bindBuffer(r.ARRAY_BUFFER,s),r.bufferSubData(r.ARRAY_BUFFER,0,i.points),i.pointsVboStateKey=i.pointsStateKey):t.currentGlContext.bindBuffer(r.ARRAY_BUFFER,s):(s=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,s),r.bufferData(r.ARRAY_BUFFER,i.points,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),n.putResource(o,s,4*i.points.length),i.pointsVboStateKey=i.pointsStateKey),r.vertexAttribPointer(this.vertexPointLocation,3,r.FLOAT,!1,0,0)},S.prototype.endRenderingTile=function(t,e){},S.prototype.renderTile=function(t,i){if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","renderTile","missingTile"));var r=t.currentGlContext,n=r.TRIANGLE_STRIP;r.drawElements(n,this.numBaseIndices,r.UNSIGNED_SHORT,2*this.baseIndicesOffset);var o,s=i.level;o=i.neighborLevel(WorldWind.NORTH),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresNorth,r.UNSIGNED_SHORT,2*this.indicesLoresNorthOffset):r.drawElements(n,this.numIndicesNorth,r.UNSIGNED_SHORT,2*this.indicesNorthOffset),o=i.neighborLevel(WorldWind.SOUTH),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresSouth,r.UNSIGNED_SHORT,2*this.indicesLoresSouthOffset):r.drawElements(n,this.numIndicesSouth,r.UNSIGNED_SHORT,2*this.indicesSouthOffset),o=i.neighborLevel(WorldWind.WEST),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresWest,r.UNSIGNED_SHORT,2*this.indicesLoresWestOffset):r.drawElements(n,this.numIndicesWest,r.UNSIGNED_SHORT,2*this.indicesWestOffset),o=i.neighborLevel(WorldWind.EAST),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresEast,r.UNSIGNED_SHORT,2*this.indicesLoresEastOffset):r.drawElements(n,this.numIndicesEast,r.UNSIGNED_SHORT,2*this.indicesEastOffset)},S.prototype.renderWireframeTile=function(t,i){if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","renderWireframeTile","missingTile"));var r=t.currentGlContext;this.vertexTexCoordLocation>=0&&r.disableVertexAttribArray(this.vertexTexCoordLocation),r.drawElements(r.LINES,this.numWireframeIndices,r.UNSIGNED_SHORT,2*this.wireframeIndicesOffset)},S.prototype.renderTileOutline=function(t,i){if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","renderTileOutline","missingTile"));var r=t.currentGlContext;this.vertexTexCoordLocation>=0&&r.disableVertexAttribArray(this.vertexTexCoordLocation),r.drawElements(r.LINE_LOOP,this.numOutlineIndices,r.UNSIGNED_SHORT,2*this.outlineIndicesOffset)},S.prototype.pick=function(t,i,r){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","pick","missingDc"));if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","pick","missingList"));for(var n=null,o=r||this,s=new p(0,0,0),a=[],h=0,u=i.length;ha&&(s=a,o=r)}return i[o]},S.prototype.computeIntersections=function(t,e,i){var r,n,o=e.level,s=e.points,a=i.length;t.origin.subtract(e.referencePoint),this.buildSharedGeometry(e),n=this.baseIndices,_.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.SOUTH),n=r&&r.compare(o)<0?this.indicesLoresSouth:this.indicesSouth,_.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.WEST),n=r&&r.compare(o)<0?this.indicesLoresWest:this.indicesWest,_.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.EAST),n=r&&r.compare(o)<0?this.indicesLoresEast:this.indicesEast,_.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.NORTH),n=r&&r.compare(o)<0?this.indicesLoresNorth:this.indicesNorth,_.computeTriStripIntersections(t,s,n,i),t.origin.add(e.referencePoint);for(var l=a,h=i.length;l0){for(this.tiles=[],this.corners={},i=0,r=f.length;i=0?this.tiles[u].level:null),t.setNeighborLevel(WorldWind.SOUTH,c>=0?this.tiles[c].level:null),t.setNeighborLevel(WorldWind.EAST,d>=0?this.tiles[d].level:null),t.setNeighborLevel(WorldWind.WEST,p>=0?this.tiles[p].level:null)},S.prototype.isTileVisible=function(t,e){return!(t.globe.projectionLimits&&!e.sector.overlaps(t.globe.projectionLimits))&&e.extent.intersectsFrustum(t.frustumInModelCoordinates)},S.prototype.tileMeetsRenderCriteria=function(t,e){var i=this.detailControl;return(e.sector.minLatitude>=75||e.sector.maxLatitude<=-75)&&(i*=2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},S.prototype.regenerateTileGeometryIfNeeded=function(t,e){var i=t.globeStateKey+e.stateKey+t.verticalExaggeration;e.points&&e.pointsStateKey==i||(this.regenerateTileGeometry(t,e),e.pointsStateKey=i)},S.prototype.coverageTargetResolution=function(e){return e/8*t.RADIANS_TO_DEGREES},S.prototype.regenerateTileGeometry=function(t,e){var i=e.tileHeight+1,r=e.tileWidth+1,n=e.referencePoint,o=this.scratchElevations;o||(o=new Float64Array(i*r),this.scratchElevations=o),e.points||(e.points=new Float32Array(i*r*3)),b.fillArray(o,0),t.globe.elevationsForGrid(e.sector,i,r,this.coverageTargetResolution(e.texelSize),o),this.mustAlignNeighborElevations(t,e)&&this.alignNeighborElevations(t,e,o),b.multiplyArray(o,t.verticalExaggeration),t.globe.computePointsForGrid(e.sector,i,r,o,n,e.points),e.transformationMatrix.setTranslation(n[0],n[1],n[2])},S.prototype.mustAlignNeighborElevations=function(t,e){var i=e.level,r=e.neighborLevel(WorldWind.NORTH),n=e.neighborLevel(WorldWind.SOUTH),o=e.neighborLevel(WorldWind.EAST),s=e.neighborLevel(WorldWind.WEST);return r&&r.compare(i)<0||n&&n.compare(i)<0||o&&o.compare(i)<0||s&&s.compare(i)<0},S.prototype.alignNeighborElevations=function(t,e,i){var r,n,o,s,a=e.tileHeight+1,l=e.tileWidth+1,h=e.level,u=Math.floor(a/2)+1,c=Math.floor(l/2)+1,d=h.previousLevel(),p=this.scratchPrevElevations;if(p||(p=new Float64Array(u*c),this.scratchPrevElevations=p),b.fillArray(p,0),t.globe.elevationsForGrid(e.sector,u,c,this.coverageTargetResolution(d.texelSize),p),r=e.neighborLevel(WorldWind.NORTH),r&&r.compare(h)<0)for(o=(a-1)*l,s=(u-1)*c,n=0;n0;l-=1)i=l+h*n,s[a++]=i,s[a++]=i-n;for(l=0,i=l+h*n,s[a++]=i,this.indicesNorthOffset=s.length-o,this.indicesNorth=new Uint16Array(s.slice(this.indicesNorthOffset)),this.numIndicesNorth=o,o=2*n-2,h=0,l=0,i=l+h*n,s[a++]=i,l=1;l0;h-=1)i=l+h*n,s[a++]=i,s[a++]=i+1;for(h=0,i=l+h*n,s[a++]=i,this.indicesWestOffset=s.length-o,this.indicesWest=new Uint16Array(s.slice(this.indicesWestOffset)),this.numIndicesWest=o,o=2*r-2,l=n-1,h=0,i=l+h*n,s[a++]=i,h=1;h0;l-=1)i=(l+1&-2)+h*n,s[a++]=i,i=l+(h-1)*n,s[a++]=i;for(l=0,i=l+h*n,s[a++]=i,this.indicesLoresNorthOffset=s.length-o,this.indicesLoresNorth=new Uint16Array(s.slice(this.indicesLoresNorthOffset)),this.numIndicesLoresNorth=o,o=2*n-2,h=0,l=0,i=l+h*n,s[a++]=i,l=1;l0;h-=1)i=l+(h+1&-2)*n,s[a++]=i,i=l+1+h*n,s[a++]=i;for(h=0,i=l+h*n,s[a++]=i,this.indicesLoresWestOffset=s.length-o,this.indicesLoresWest=new Uint16Array(s.slice(this.indicesLoresWestOffset)),this.numIndicesLoresWest=o,o=2*r-2,l=n-1,h=0,i=l+h*n,s[a++]=i,h=1;h=0;i-=1)n=i+r*s,l[h]=n,h+=1;for(i=0,r=o-1;r>=0;r-=1)n=i+r*s,l[h]=n,h+=1;return this.numOutlineIndices=a,l},S.prototype.cacheSharedGeometryVBOs=function(t){var e=t.currentGlContext,i=t.gpuResourceCache,r=i.resourceForKey(this.texCoordVboCacheKey);r||(r=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,this.texCoords,e.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),i.putResource(this.texCoordVboCacheKey,r,4*this.texCoords.length/2));var n=i.resourceForKey(this.indicesVboCacheKey);n||(n=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),i.putResource(this.indicesVboCacheKey,n,2*this.indices.length))},S}),i("globe/Globe",["../geom/Angle","../error/ArgumentError","../geom/BoundingBox","../globe/ElevationModel","../geom/Line","../geom/Location","../util/Logger","../geom/Position","../projections/ProjectionWgs84","../geom/Sector","../globe/Tessellator","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t,i){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","constructor","Elevation model is null or undefined."));this.elevationModel=t,this.equatorialRadius=WorldWind.WGS84_SEMI_MAJOR_AXIS;var r=1/WorldWind.WGS84_INVERSE_FLATTENING;this.polarRadius=this.equatorialRadius*(1-r),this.eccentricitySquared=2*r-r*r,this.tessellator=new u,this._projection=i||new l,this._offset=0,this.offsetVector=new c(0,0,0),this.id=++p.idPool,this._stateKey="globe "+this.id.toString()+" "};return p.idPool=0,Object.defineProperties(p.prototype,{stateKey:{get:function(){return this._stateKey+this.elevationModel.stateKey+"offset "+this.offset.toString()+" "+this.projection.stateKey}},continuous:{get:function(){return this.projection.continuous}},projection:{get:function(){return this._projection},set:function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","projection","missingProjection"));this.projection!=t&&(this.tessellator=new u),this._projection=t}},projectionLimits:{get:function(){return this._projection.projectionLimits}},offset:{get:function(){return this._offset},set:function(t){this._offset=t,this.offsetVector[0]=2*t*Math.PI*this.equatorialRadius}}}),p.prototype.is2D=function(){return this.projection.is2D},p.prototype.computePointFromPosition=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointFromPosition","missingResult"));return this.projection.geographicToCartesian(this,t,i,r,this.offsetVector,n)},p.prototype.computePointFromLocation=function(t,i,r){if(!r)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointFromLocation","missingResult"));return this.computePointFromPosition(t,i,0,r)},p.prototype.computePointsForGrid=function(t,i,r,n,o,a){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointsFromPositions","missingSector"));if(i<1||r<1)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointsFromPositions","Number of latitude or longitude locations is less than one."));var l=i*r;if(!n||n.length180&&(n.longitude-=360)),n},p.prototype.radiusAt=function(e,i){var r=Math.sin(e*t.DEGREES_TO_RADIANS),n=this.equatorialRadius/Math.sqrt(1-this.eccentricitySquared*r*r); -return n*Math.sqrt(1+(this.eccentricitySquared*this.eccentricitySquared-2*this.eccentricitySquared)*r*r)},p.prototype.surfaceNormalAtLocation=function(i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","surfaceNormalAtLocation","missingResult"));if(this.projection.surfaceNormalAtLocation)return this.projection.surfaceNormalAtLocation(this,i,r,n);if(this.is2D())return n[0]=0,n[1]=0,n[2]=1,n;var o=Math.cos(i*t.DEGREES_TO_RADIANS),a=Math.cos(r*t.DEGREES_TO_RADIANS),l=Math.sin(i*t.DEGREES_TO_RADIANS),h=Math.sin(r*t.DEGREES_TO_RADIANS);return n[0]=o*h,n[1]=l,n[2]=o*a,n.normalize()},p.prototype.surfaceNormalAtPoint=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","surfaceNormalAtPoint","missingResult"));if(this.projection.surfaceNormalAtPoint)return this.projection.surfaceNormalAtPoint(this,t,i,r,n);if(this.is2D())return n[0]=0,n[1]=0,n[2]=1,n;var o=this.equatorialRadius*this.equatorialRadius,a=this.polarRadius*this.polarRadius;return n[0]=t/o,n[1]=i/a,n[2]=r/o,n.normalize()},p.prototype.northTangentAtLocation=function(t,i,r){if(!r)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","northTangentAtLocation","missingResult"));return this.projection.northTangentAtLocation(this,t,i,r)},p.prototype.northTangentAtPoint=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","northTangentAtPoint","missingResult"));return this.projection.northTangentAtPoint(this,t,i,r,this.offsetVector,n)},p.prototype.intersectsFrustum=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectsFrustum","missingFrustum"));if(this.is2D()){var r=new i;return r.setToSector(h.FULL_SPHERE,this,this.elevationModel.minElevation,this.elevationModel.maxElevation),r.intersectsFrustum(t)}return!(t.far.distance<=this.equatorialRadius)&&(!(t.left.distance<=this.equatorialRadius)&&(!(t.right.distance<=this.equatorialRadius)&&(!(t.top.distance<=this.equatorialRadius)&&(!(t.bottom.distance<=this.equatorialRadius)&&!(t.near.distance<=this.equatorialRadius)))))},p.prototype.intersectsLine=function(t,i){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectWithRay","missingLine"));if(!i)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectsLine","missingResult"));var r,n=t.direction[0],o=t.direction[1],a=t.direction[2],l=t.origin[0],h=t.origin[1],u=t.origin[2];if(this.is2D())return(0!=a||0==u)&&(r=-u/a,!(r<0)&&(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0));var c,d,p,f,g=this.equatorialRadius,m=g*g,y=g/this.polarRadius,E=y*y;return c=n*n+E*o*o+a*a,d=2*(l*n+E*h*o+u*a),p=l*l+E*h*h+u*u-m,f=d*d-4*c*p,!(f<0)&&(r=(-d-Math.sqrt(f))/(2*c),r>0?(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0):(r=(-d+Math.sqrt(f))/(2*c),r>0&&(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0)))},p.prototype.elevationTimestamp=function(){return this.elevationModel.timestamp},p.prototype.minElevation=function(){return this.elevationModel.minElevation},p.prototype.maxElevation=function(){return this.elevationModel.maxElevation},p.prototype.minAndMaxElevationsForSector=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","minAndMaxElevationsForSector","missingSector"));return this.elevationModel.minAndMaxElevationsForSector(t)},p.prototype.elevationAtLocation=function(t,e){return this.elevationModel.elevationAtLocation(t,e)},p.prototype.elevationsForGrid=function(t,i,r,n,o){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","elevationsForSector","missingSector"));if(i<=0||r<=0)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","elevationsForSector","numLat or numLon is less than 1"));if(!o||o.length=i)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","constructor","Specified cache low-water value is undefined, negative or not less than the capacity."));this.entries=new n(i,o),this.cacheKeyPool=0,this.currentRetrievals={},this.absentResourceList=new t(3,6e4)};return Object.defineProperties(s.prototype,{capacity:{get:function(){return this.entries.capacity}},lowWater:{get:function(){return this.entries.lowWater}},usedCapacity:{get:function(){return this.entries.usedCapacity}},freeCapacity:{get:function(){return this.entries.freeCapacity}}}),s.prototype.generateCacheKey=function(){return"GpuResourceCache "+ ++this.cacheKeyPool},s.prototype.putResource=function(t,n,o){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","missingKey."));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","missingResource."));if(!o||o<1)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","The specified resource size is undefined or less than 1."));var s={resource:n};this.entries.putEntry(t instanceof i?t.key:t,s,o)},s.prototype.resourceForKey=function(t){var e=t instanceof i?this.entries.entryForKey(t.key):this.entries.entryForKey(t),r=e?e.resource:null;return null!==r&&"function"==typeof r.clearTexParameters&&r.clearTexParameters(),r},s.prototype.setResourceAgingFactor=function(t,e){this.entries.setEntryAgingFactor(t,e)},s.prototype.containsResource=function(t){return this.entries.containsKey(t instanceof i?t.key:t)},s.prototype.removeResource=function(t){this.entries.removeEntry(t instanceof i?t.key:t)},s.prototype.clear=function(){this.entries.clear(!1)},s.prototype.retrieveTexture=function(t,e,n){if(!e)return null;if(e instanceof i){var s=new o(t,e.image,n);return this.putResource(e.key,s,s.size),s}if(this.currentRetrievals[e]||this.absentResourceList.isResourceAbsent(e))return null;var a=this,l=new Image;return l.onload=function(){r.log(r.LEVEL_INFO,"Image retrieval succeeded: "+e);var i=new o(t,l,n);a.putResource(e,i,i.size),delete a.currentRetrievals[e],a.absentResourceList.unmarkResourceAbsent(e);var s=document.createEvent("Event");s.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(s)},l.onerror=function(){delete a.currentRetrievals[e],a.absentResourceList.markResourceAbsent(e),r.log(r.LEVEL_WARNING,"Image retrieval failed: "+e)},this.currentRetrievals[e]=e,l.crossOrigin="anonymous",l.src=e,null},s}),i("pick/PickedObjectList",[],function(){"use strict";var t=function(){this.objects=[]};return t.prototype.hasNonTerrainObjects=function(){return this.objects.length>1||1===this.objects.length&&null==this.terrainObject()},t.prototype.terrainObject=function(){for(var t=0,e=this.objects.length;t1)for(var e=0;e0?this.objects[0]:null},t}),i("render/ScreenCreditController",["../error/ArgumentError","../util/Color","../util/Font","../layer/Layer","../util/Logger","../util/Offset","../shapes/ScreenText"],function(t,e,i,r,n,o,s){"use strict";var a=function(){r.call(this,"ScreenCreditController"),this.creditPlacement=new o(WorldWind.OFFSET_PIXELS,11,WorldWind.OFFSET_PIXELS,2),this.creditMargin=11,this.opacity=.5,this.credits=[]};return a.prototype=Object.create(r.prototype),a.prototype.clear=function(){this.credits=[]},a.prototype.addCredit=function(e,r,a){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenCreditController","addCredit","missingText"));if(!r)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenCreditController","addCredit","missingColor"));for(var l=0,h=this.credits.length;l=i&&(s+=r);var a=e.get(o);a.index=s,n.set(s,a)}return n},t}),i("util/PolygonSplitter",["./HashMap","../geom/Location","../geom/Position","./WWMath"],function(t,e,i,r){"use strict";var n={addedIndex:-1,poleIndexOffset:-1,splitContours:function(t,e){for(var i=!1,r=0,n=t.length;r1&&(i=!0),e.push(o)}return i},splitContour:function(i){var r=new t,n=[],o=[],s=[],a=[],l=-1,h=this.findIntersectionAndPole(i,n,o,r);return 0===o.length?(s.push(n),a.push(r),this.formatContourOutput(s,h,l,a)):(o.length>2&&o.sort(function(t,e){return e.latitude-t.latitude}),h!==e.poles.NONE&&(n=this.handleOnePole(n,o,r,h),r=this.reindexIntersections(o,r,this.poleIndexOffset)),0===o.length?(s.push(n),a.push(r),l=0,this.formatContourOutput(s,h,l,a)):(this.linkIntersections(o,r),l=this.makePolygons(n,o,r,s,a),this.formatContourOutput(s,h,l,a)))},findIntersectionAndPole:function(t,i,n,o){var s=!1,a=90,l=-90;this.addedIndex=-1;for(var h=0,u=t.length;h0?e.poles.NORTH:i<0?e.poles.SOUTH:Math.abs(i)>=Math.abs(t)?e.poles.NORTH:e.poles.SOUTH},handleOnePole:function(t,i,r,n){var o;if(n===e.poles.NORTH)var s=i.shift(),a=90;else n===e.poles.SOUTH&&(s=i.pop(),a=-90);var l=r.get(s.indexEnd),h=r.get(s.indexStart);l.forPole=!0,h.forPole=!0,this.poleIndexOffset=s.indexStart,o=t.slice(0,s.indexEnd+1);var u=this.createPoint(a,t[l.index].longitude,t[l.index].altitude),c=this.createPoint(a,t[h.index].longitude,t[h.index].altitude);return o.push(u,c),o=o.concat(t.slice(this.poleIndexOffset))},linkIntersections:function(t,e){for(var i=0;i=r&&(e[n].indexEnd+=2),e[n].indexStart>=r&&(e[n].indexStart+=2);return i},makePolygons:function(e,i,r,n,o){for(var s=-1,a=0;aDate.now()},m.prototype.createShapeDataObject=function(){return{}},m.prototype.resetExpiration=function(t){t.expiryTime=Date.now()+this.expirationInterval+1e3*Math.random()},m.prototype.establishCurrentData=function(t){this.currentData=this.shapeDataCache.entryForKey(t.globeStateKey),this.currentData||(this.currentData=this.createShapeDataObject(),this.resetExpiration(this.currentData),this.shapeDataCache.putEntry(t.globeStateKey,this.currentData,1)),this.currentData.isExpired=!this.isShapeDataCurrent(t,this.currentData)},m.prototype.render=function(t){this.enabled&&(this.layer=t.currentLayer,this.prepareBoundaries(t),this.establishCurrentData(t),!this.currentData.isExpired&&this.currentData.extent||(this.computeExtent(t),this.currentData.verticalExaggeration=t.verticalExaggeration,this.resetExpiration(this.currentData)),this.currentData&&this.currentData.extent&&!this.intersectsFrustum(t)||t.surfaceShapeTileBuilder.insertSurfaceShape(this))},m.prototype.interpolateLocations=function(t){var e,i,r,n=t[0],o=n,s=!0,a=!0,l=0,h=!0;for(this._locations=[n],i=1,r=t.length;i2&&(h=!1)),h&&this.interpolateEdge(e,o,this._locations),this._locations.push(o),e=o;this._isInteriorInhibited||e.latitude==n.latitude&&e.longitude==n.longitude||(this.interpolateEdge(e,n,this._locations),this._locations.push(n))},m.prototype.interpolateEdge=function(t,e,i){var r,n,s=o.greatCircleDistance(t,e),a=Math.round(this._maximumNumEdgeIntervals*s/Math.PI);if(a>0){r=1/a,n=t;for(var l=this.throttledStep(r,n);l<1;l+=this.throttledStep(r,n))n=new o(0,0),o.interpolateAlongPath(this._pathType,l,t,e,n),180===t.longitude&&180===e.longitude?n.longitude=180:t.longitude===-180&&e.longitude===-180&&(n.longitude=-180),i.push(n)}},m.prototype.throttledStep=function(t,i){var r=Math.cos(i.latitude*e.DEGREES_TO_RADIANS);r*=r;var n=this._polarThrottle/(1+this._polarThrottle);return t*(1-n+n*r)},m.prototype.prepareBoundaries=function(t){if(!this.boundariesArePrepared){this.computeBoundaries(t);var e=this.formatBoundaries();this.normalizeAngles(e),e=this.interpolateBoundaries(e);var i=[],r=u.splitContours(e,i);this.contours=i,this.crossesAntiMeridian=r,this.prepareGeometry(t,i),this.prepareSectors(),this.boundariesArePrepared=!0}},m.prototype.formatBoundaries=function(){var t=[];return this._boundaries.length?(null!=this._boundaries[0].latitude?t.push(this._boundaries):t=this._boundaries,t):t},m.prototype.resetBoundaries=function(){this.boundariesArePrepared=!1,this.shapeDataCache.clear(!1)},m.prototype.normalizeAngles=function(t){for(var i=0,r=t.length;i180)&&(a.longitude=e.normalizedDegreesLongitude(a.longitude)),(a.latitude<-90||a.latitude>90)&&(a.latitude=e.normalizedDegreesLatitude(a.latitude))}},m.prototype.interpolateBoundaries=function(t){for(var e=[],i=0,r=t.length;i0?this._boundingSectors:(this.prepareBoundaries(t),this._boundingSectors)},m.prototype.computeExtent=function(t){if(!this._boundingSectors||0===this._boundingSectors.length)return null;if(!this.currentData)return null;this.currentData.extent||(this.currentData.extent=new r);var e;if(1===this._boundingSectors.length)e=this._boundingSectors[0].computeBoundingPoints(t.globe,t.verticalExaggeration),this.currentData.extent.setToVec3Points(e);else{for(var i=[],n=0;n90?(E=180-E,v+=180):E<-90&&(E=-180-E,v+=180),v<-180?v+=360:v>180&&(v-=360),E>m&&(m=E),E87)for(var u=m-87,c=0,d=n.length;c0?(e.union(a),t.union(a)):a.minLongitude<0?e.union(a):t.union(a)}var l=Math.min(t.minLatitude,e.minLatitude),h=Math.max(t.maxLatitude,t.maxLatitude);this._boundingSector=new d(l,h,-180,180),this._boundingSectors=[t,e]},m.prototype.sectorsNotOverAntiMeridian=function(){this._boundingSector=new d(90,-90,180,-180);for(var t=0,e=this.contours.length;t1?h===l?this.outlineForPole(c,d,r):this.outlineForSplit(c,d,r):a.pole!==o.poles.NONE&&1===u?this.outlineForPole(c,d,r):a.pole===o.poles.NONE&&u>1?this.outlineForSplit(c,d,r):a.pole===o.poles.NONE&&1===u&&r.push(c)}this._interiorGeometry=i,this._outlineGeometry=r},m.prototype.outlineForPole=function(t,e,i){this.containsPole=!0;for(var r=[],n=0,o=0,s=t.length;o0;if(l||u){if(t.pickingMode)this.pickColor||(this.pickColor=t.uniquePickColor()),e.fillStyle=this.pickColor.toCssColorString(),e.strokeStyle=e.fillStyle,e.lineWidth=a.outlineWidth;else{var c=a.interiorColor,d=a.outlineColor;e.fillStyle=new n(c.red,c.green,c.blue,c.alpha*this.layer.opacity).toCssColorString(),e.strokeStyle=new n(d.red,d.green,d.blue,d.alpha*this.layer.opacity).toCssColorString(),e.lineWidth=a.outlineWidth}if(this.crossesAntiMeridian||this.containsPole?(l&&(this.draw(this._interiorGeometry,e,i,r,o,s),e.fill()),u&&(this.draw(this._outlineGeometry,e,i,r,o,s),e.stroke())):(this.draw(this._interiorGeometry,e,i,r,o,s),l&&e.fill(),u&&e.stroke()),t.pickingMode){var p=new h(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(p)}}}},m.prototype.draw=function(t,e,i,r,n,o){e.beginPath();for(var s=0,a=t.length;s0},a.prototype.getShapes=function(){return this.surfaceShapes},a.prototype.setShapes=function(t){this.surfaceShapes=t},a.prototype.getSector=function(){return this.sector},a.prototype.addSurfaceShape=function(t){this.surfaceShapes.push(t),this.surfaceShapeStateKeys.push(t.stateKey+" lo "+t.layer.opacity)},a.prototype.needsUpdate=function(t){var e,i;if(this.surfaceShapes.length!=this.asRenderedSurfaceShapeStateKeys.length)return!0;for(e=0,i=this.surfaceShapes.length;e0?h:1,d=u>0?u:1,p=a/d,f=s/c,g=-(l.minLongitude-o.minLongitude)/d,m=-(l.minLatitude-o.minLatitude)/c;this.texMaskMatrix.set(p,0,0,g,0,f,0,m,0,0,1,0,0,0,0,1),this.texSamplerMatrix.setToUnitYFlip(),i.applyInternalTransform(t,this.texSamplerMatrix),this.texSamplerMatrix.multiplyMatrix(this.texMaskMatrix),n.loadTexSamplerMatrix(r,this.texSamplerMatrix),n.loadTexMaskMatrix(r,this.texMaskMatrix)},o}),i("render/TextRenderer",["../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Font","../util/Logger","../geom/Matrix","../render/Texture","../geom/Vec2"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"TextRenderer","constructor","missingDc"));this.canvas2D=document.createElement("canvas"),this.ctx2D=this.canvas2D.getContext("2d"),this.dc=e,this.enableOutline=!0,this.lineSpacing=.15,this.outlineColor=new i(0,0,0,.5),this.outlineWidth=4,this.textColor=new i(1,1,1,1),this.typeFace=new r(14)};return l.prototype.textSize=function(t){if(0===t.length)return new a(0,0);this.ctx2D.font=this.typeFace.fontString;for(var e=t.split("\n"),i=e.length*(this.typeFace.size*(1+this.lineSpacing)),r=0,n=0;n0){var e=this.drawText(t);return new s(this.dc.currentGlContext,e)}return null},l.prototype.drawText=function(t){var e=this.ctx2D,i=this.canvas2D,r=this.textSize(t),n=t.split("\n"),o=this.enableOutline?this.outlineWidth/2:0,s=this.dc.pixelScale;i.width=Math.ceil(r[0])*s,i.height=Math.ceil(r[1])*s,e.scale(s,s),e.font=this.typeFace.fontString,e.textBaseline="bottom",e.textAlign=this.typeFace.horizontalAlignment,e.fillStyle=this.textColor.toCssColorString(),e.strokeStyle=this.outlineColor.toCssColorString(),e.lineWidth=this.outlineWidth,e.lineCap="round",e.lineJoin="round","left"===this.typeFace.horizontalAlignment?e.translate(o,0):"right"===this.typeFace.horizontalAlignment?e.translate(r[0]-o,0):e.translate(r[0]/2,0);for(var a=0;a0&&(a=a.substring(0,a.length-1)),a+="..."),a},l.prototype.wrapLine=function(t,e){var i="",r=t.trim(),n=this.textSize(r);if(n[0]>e){for(var o="",s=0,a=r.indexOf(" ",s+1);s0?this.surfaceRenderables[this.surfaceRenderables.length-1]:null},R.prototype.popSurfaceRenderable=function(){return this.surfaceRenderables.length>0?this.surfaceRenderables.pop():null},R.prototype.reverseSurfaceRenderables=function(){this.surfaceRenderables.reverse()},R.prototype.addOrderedRenderable=function(t,e){if(t){var i={orderedRenderable:t,insertionOrder:this.orderedRenderablesCounter++,eyeDistance:e||t.eyeDistance,globeStateKey:this.globeStateKey};this.globe.continuous&&(i.globeOffset=this.globe.offset),0===i.eyeDistance?this.screenRenderables.push(i):this.orderedRenderables.push(i)}},R.prototype.addOrderedRenderableToBack=function(t){if(t){var e={orderedRenderable:t,insertionOrder:this.orderedRenderablesCounter++,eyeDistance:Number.MAX_VALUE,globeStateKey:this.globeStateKey};this.globe.continuous&&(e.globeOffset=this.globe.offset),this.orderedRenderables.push(e)}},R.prototype.peekOrderedRenderable=function(){return this.orderedRenderables.length>0?this.orderedRenderables[this.orderedRenderables.length-1].orderedRenderable:null},R.prototype.popOrderedRenderable=function(){if(this.orderedRenderables.length>0){var t=this.orderedRenderables.pop();return this.globeStateKey=t.globeStateKey,this.globe.continuous&&(this.globe.offset=t.globeOffset),t.orderedRenderable}return null},R.prototype.nextScreenRenderable=function(){if(this.screenRenderables.length>0){var t=this.screenRenderables.shift();return this.globeStateKey=t.globeStateKey,this.globe.continuous&&(this.globe.offset=t.globeOffset),t.orderedRenderable}return null},R.prototype.sortOrderedRenderables=function(){this.orderedRenderables.sort(function(t,e){var i=t.eyeDistance,r=e.eyeDistance;if(ir)return 1;var n=t.insertionOrder,o=e.insertionOrder;return n>o?-1:nO.x+O.width||k>O.y+O.height)return!1;N.x=T.clamp(I,O.x,O.x+O.width),N.y=T.clamp(k,O.y,O.y+O.height),N.width=T.clamp(D,O.x,O.x+O.width)-N.x,N.height=T.clamp(V,O.y,O.y+O.height)-N.y,this.pickRectangle=N;var F=d.fromIdentity();return F.invertMatrix(this.modelviewProjection),P[0]=N.x,P[1]=N.y,P[2]=0,F.unProject(P,O,t=new L(0,0,0)),P[0]=N.x,P[1]=N.y,P[2]=1,F.unProject(P,O,e=new L(0,0,0)),P[0]=N.x+N.width,P[1]=N.y,P[2]=0,F.unProject(P,O,i=new L(0,0,0)),P[0]=N.x+N.width,P[1]=N.y,P[2]=1,F.unProject(P,O,r=new L(0,0,0)),P[0]=N.x,P[1]=N.y+N.height,P[2]=0,F.unProject(P,O,n=new L(0,0,0)),P[0]=N.x,P[1]=N.y+N.height,P[2]=1,F.unProject(P,O,s=new L(0,0,0)),P[0]=N.x+N.width,P[1]=N.y+N.height,P[2]=0,F.unProject(P,O,a=new L(0,0,0)),P[0]=N.x+N.width,P[1]=N.y+N.height,P[2]=1,F.unProject(P,O,l=new L(0,0,0)),x=new L(s[0]-t[0],s[1]-t[1],s[2]-t[2]),C.set(n[0]-e[0],n[1]-e[1],n[2]-e[2]),h=x.cross(C),E=new f(h[0],h[1],h[2],-h.dot(t)),E.normalize(),x=new L(a[0]-r[0],a[1]-r[1],a[2]-r[2]),C.set(l[0]-i[0],l[1]-i[1],l[2]-i[2]),u=x.cross(C),v=new f(u[0],u[1],u[2],-u.dot(i)),v.normalize(),x=new L(s[0]-a[0],s[1]-a[1],s[2]-a[2]),C.set(l[0]-n[0],l[1]-n[1],l[2]-n[2]),c=x.cross(C),_=new f(c[0],c[1],c[2],-c.dot(n)),_.normalize(),x=new L(r[0]-t[0],r[1]-t[1],r[2]-t[2]),C.set(e[0]-i[0],e[1]-i[1],e[2]-i[2]),p=x.cross(C),b=new f(p[0],p[1],p[2],-p.dot(i)),b.normalize(),x=new L(n[0]-i[0],n[1]-i[1],n[2]-i[2]),C.set(a[0]-t[0],a[1]-t[1],a[2]-t[2]),g=x.cross(C),S=new f(g[0],g[1],g[2],-g.dot(t)),S.normalize(),x=new L(l[0]-e[0],l[1]-e[1],l[2]-e[2]),C.set(s[0]-r[0],s[1]-r[1],s[2]-r[2]),y=x.cross(C),R=new f(y[0],y[1],y[2],-y.dot(e)),R.normalize(),this.pickFrustum=new o(E,v,b,_,S,R),!0},R.prototype.isSmall=function(t,e){if(!t)return!1;var i=this.eyePoint.distanceTo(t.center),r=this.pixelSizeAtDistance(i);return 2*t.radius1)&&(a=.5*a+.5,l=.5*l+.5,h=.5*h+.5,a=a*this.viewport.width+this.viewport.x,l=l*this.viewport.height+this.viewport.y,i[0]=a,i[1]=l,i[2]=h,!0))},R.prototype.projectWithDepth=function(e,i,r){if(!e)throw new t(c.logMessage(c.LEVEL_SEVERE,"DrawContext","projectWithDepth","missingPoint"));if(!r)throw new t(c.logMessage(c.LEVEL_SEVERE,"DrawContext","projectWithDepth","missingResult"));var n=e[0],o=e[1],s=e[2],a=this.modelview,l=a[0]*n+a[1]*o+a[2]*s+a[3],h=a[4]*n+a[5]*o+a[6]*s+a[7],u=a[8]*n+a[9]*o+a[10]*s+a[11],d=a[12]*n+a[13]*o+a[14]*s+a[15],p=this.projection,f=p[0]*l+p[1]*h+p[2]*u+p[3]*d,g=p[4]*l+p[5]*h+p[6]*u+p[7]*d,m=p[8]*l+p[9]*h+p[10]*u+p[11]*d,y=p[12]*l+p[13]*h+p[14]*u+p[15]*d;return 0!==y&&(f/=y,g/=y,m/=y,!(m<-1||m>1)&&(m=p[8]*l+p[9]*h+p[10]*u*(1+i)+p[11]*d,m/=y,m=T.clamp(m,-1,1),f=.5*f+.5,g=.5*g+.5,m=.5*m+.5,f=f*this.viewport.width+this.viewport.x,g=g*this.viewport.height+this.viewport.y,r[0]=f,r[1]=g,r[2]=m,!0))},R.prototype.convertPointToViewport=function(e,i){if(!e)throw new t(c.logMessage(c.LEVEL_SEVERE,"DrawContext","convertPointToViewport","missingPoint"));if(!i)throw new t(c.logMessage(c.LEVEL_SEVERE,"DrawContext","convertPointToViewport","missingResult"));return i[0]=e[0],i[1]=this.viewport.height-e[1],i},R.prototype.pixelSizeAtDistance=function(t){return this.pixelSizeFactor*t+this.pixelSizeOffset},R.prototype.createTextTexture=function(t,e){if(!t||!e)return null;var i=this.computeTextTextureStateKey(t,e),r=this.gpuResourceCache.resourceForKey(i);return r||(this.textRenderer.textColor=e.color,this.textRenderer.typeFace=e.font,this.textRenderer.enableOutline=e.enableOutline,this.textRenderer.outlineColor=e.outlineColor,this.textRenderer.outlineWidth=e.outlineWidth,r=this.textRenderer.renderText(t),this.gpuResourceCache.putResource(i,r,r.size),this.gpuResourceCache.setResourceAgingFactor(i,100)),r},R.prototype.computeTextTextureStateKey=function(t,e){return t&&e?t+"c "+e.color.toHexString(!0)+" f "+e.font.toString()+" eo "+e.enableOutline+" ow "+e.outlineWidth+" oc "+e.outlineColor.toHexString(!0):null},R.prototype.getExtension=function(e){if(!e)throw new t(c.logMessage(c.LEVEL_SEVERE,"DrawContext","getExtension","missingExtensionName"));return e in this.glExtensionsCache||(this.glExtensionsCache[e]=this.currentGlContext.getExtension(e)||null),this.glExtensionsCache[e]},R}),i("globe/GebcoElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:e.FULL_SPHERE,resolution:.008333333333333,retrievalImageFormat:"application/bil16",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/elev","GEBCO","","1.3.0")}),this.displayName="GEBCO Earth Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("globe/UsgsNedElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:new e(24.396308,49.384358,-124.848974,-66.885444),resolution:92592592593e-15,retrievalImageFormat:"application/bil16",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/elev","USGS-NED","","1.3.0")}),this.displayName="USGS NED Earth Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("globe/UsgsNedHiElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:new e(18.86546,28.517269,-178.443593,-154.755792),resolution:92592592593e-15,retrievalImageFormat:"application/bil16",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/elev","USGS-NED","","1.3.0")}),this.displayName="USGS NED Hawaii Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("globe/EarthElevationModel",["../globe/AsterV2ElevationCoverage","../globe/ElevationModel","../globe/GebcoElevationCoverage","../globe/UsgsNedElevationCoverage","../globe/UsgsNedHiElevationCoverage"],function(t,e,i,r,n){"use strict";var o=function(){e.call(this),this.addCoverage(new i),this.addCoverage(new t),this.addCoverage(new r),this.addCoverage(new n)};return o.prototype=Object.create(e.prototype),o}),i("globe/EarthRestElevationCoverage",["../util/LevelSet","../geom/Location","../geom/Sector","../util/LevelRowColumnUrlBuilder","../globe/TiledElevationCoverage"],function(t,e,i,r,n){"use strict";var o=function(o,s,a){n.call(this,{coverageSector:i.FULL_SPHERE,resolution:.00732421875,retrievalImageFormat:"application/bil16",minElevation:-11e3,maxElevation:8850,urlBuilder:new r(o,s)}),this.displayName=a||"Earth Elevations",this.levels=new t(i.FULL_SPHERE,new e(60,60),5,512,512)};return o.prototype=Object.create(n.prototype),o}),i("layer/FrameStatisticsLayer",["../error/ArgumentError","../util/Color","../util/Font","../layer/Layer","../util/Logger","../util/Offset","../shapes/ScreenText","../shapes/TextAttributes"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(l){function h(t,e){c.handleRedraw(t,e)}if(!l)throw new t(n.logMessage(n.LEVEL_SEVERE,"FrameStatisticsLayer","constructor","missingWorldWindow"));r.call(this,"Frame Statistics"),this.pickEnabled=!1;var u=new a(null);u.color=e.GREEN,u.font=new i(12),u.offset=new o(WorldWind.OFFSET_FRACTION,0,WorldWind.OFFSET_FRACTION,1),this.frameTime=new s(new o(WorldWind.OFFSET_PIXELS,5,WorldWind.OFFSET_INSET_PIXELS,5)," "),this.frameTime.attributes=u,this.frameRate=new s(new o(WorldWind.OFFSET_PIXELS,5,WorldWind.OFFSET_INSET_PIXELS,25)," "),this.frameRate.attributes=u;var c=this;l.redrawCallbacks.push(h)};return l.prototype=Object.create(r.prototype),l.prototype.doRender=function(t){this.frameRate.render(t),this.frameTime.render(t),this.inCurrentFrame=!0},l.prototype.handleRedraw=function(t,e){if(e===WorldWind.BEFORE_REDRAW){var i=t.frameStatistics;this.frameTime.text="Frame time "+i.frameTimeAverage.toFixed(0)+" ms ("+i.frameTimeMin.toFixed(0)+" - "+i.frameTimeMax.toFixed(0)+")",this.frameRate.text="Frame rate "+i.frameRateAverage.toFixed(0)+" fps"}},l}),i("shapes/AbstractShape",["../error/ArgumentError","../util/Logger","../geom/Matrix","../cache/MemoryCache","../render/Renderable","../shapes/ShapeAttributes","../error/UnsupportedOperationError","../geom/Vec3"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(t){n.call(this),this._attributes=t?t:new o(null),this._highlightAttributes=null,this.highlighted=!1,this._altitudeMode=WorldWind.ABSOLUTE,this.referencePosition=null,this.shapeDataCache=new r(3,2),this.currentData=null,this.activeAttributes=null,this.expirationInterval=2e3,this.useSurfaceShapeFor2D=!1, +this._rotation=0)},i.prototype.touchMove=function(e){if(2==this.rotationTouches.length)if(this.state==WorldWind.POSSIBLE)this.shouldRecognize()&&(this.state=WorldWind.BEGAN);else if(this.state==WorldWind.BEGAN||this.state==WorldWind.CHANGED){var i=this.currentTouchAngle(),r=t.normalizedDegrees(i-this.referenceAngle),n=this.weight;this._rotation=this._rotation*(1-n)+r*n,this.state=WorldWind.CHANGED}},i.prototype.touchEnd=function(t){var e=this.rotationTouches.indexOf(t);e!=-1&&this.rotationTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.ENDED))},i.prototype.touchCancel=function(t){var e=this.rotationTouches.indexOf(t);e!=-1&&(this.rotationTouches.splice(e,1),0==this.touchCount&&(this.state==WorldWind.POSSIBLE?this.state=WorldWind.FAILED:this.state!=WorldWind.BEGAN&&this.state!=WorldWind.CHANGED||(this.state=WorldWind.CANCELLED)))},i.prototype.prepareToRecognize=function(){this.referenceAngle=this.currentTouchAngle(),this._rotation=0},i.prototype.shouldRecognize=function(){var e=this.currentTouchAngle(),i=t.normalizedDegrees(e-this.referenceAngle);return Math.abs(i)>this.interpretThreshold},i.prototype.currentTouchAngle=function(){var e=this.rotationTouches[0],i=this.rotationTouches[1],r=e.clientX-i.clientX,n=e.clientY-i.clientY;return Math.atan2(n,r)*t.RADIANS_TO_DEGREES},i}),i("gesture/TapRecognizer",["../gesture/GestureRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.numberOfTaps=1,this.numberOfTouches=1,this.maxTouchMovement=20,this.maxTapDuration=500,this.maxTapInterval=400,this.taps=[],this.timeout=null};return e.prototype=Object.create(t.prototype),e.prototype.reset=function(){t.prototype.reset.call(this),this.taps=[],this.cancelFailAfterDelay()},e.prototype.mouseDown=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.touchStart=function(t){if(this.state==WorldWind.POSSIBLE){var e;this.touchCount>this.numberOfTouches?this.state=WorldWind.FAILED:1==this.touchCount?(e={touchCount:this.touchCount,clientX:this.clientX,clientY:this.clientY},this.taps.push(e),this.failAfterDelay(this.maxTapDuration)):(e=this.taps[this.taps.length-1],e.touchCount=this.touchCount,e.clientX=this.clientX,e.clientY=this.clientY)}},e.prototype.touchMove=function(t){if(this.state==WorldWind.POSSIBLE){var e=this.translationX,i=this.translationY,r=Math.sqrt(e*e+i*i);r>this.maxTouchMovement&&(this.state=WorldWind.FAILED)}},e.prototype.touchEnd=function(t){if(this.state==WorldWind.POSSIBLE&&0==this.touchCount){var e=this.taps.length,i=this.taps[e-1];i.touchCount!=this.numberOfTouches?this.state=WorldWind.FAILED:e==this.numberOfTaps?(this.clientX=this.taps[0].clientX,this.clientY=this.taps[0].clientY,this.state=WorldWind.RECOGNIZED):this.failAfterDelay(this.maxTapInterval)}},e.prototype.touchCancel=function(t){this.state==WorldWind.POSSIBLE&&(this.state=WorldWind.FAILED)},e.prototype.failAfterDelay=function(t){var e=this;e.timeout&&window.clearTimeout(e.timeout),e.timeout=window.setTimeout(function(){e.timeout=null,e.state==WorldWind.POSSIBLE&&(e.state=WorldWind.FAILED)},t)},e.prototype.cancelFailAfterDelay=function(){var t=this;t.timeout&&(window.clearTimeout(t.timeout),t.timeout=null)},e}),i("gesture/TiltRecognizer",["../gesture/PanRecognizer"],function(t){"use strict";var e=function(e,i){t.call(this,e,i),this.maxTouchDistance=250,this.maxTouchDivergence=50};return e.LEFT=1,e.RIGHT=2,e.UP=4,e.DOWN=8,e.prototype=Object.create(t.prototype),e.prototype.shouldInterpret=function(){for(var t=0,e=this.touchCount;tthis.interpretDistance)return!0}return!1},e.prototype.shouldRecognize=function(){var t=this.touchCount;if(t<2)return!1;var i=this.touch(0),r=this.touch(1),n=i.clientX-r.clientX,o=i.clientY-r.clientY,s=Math.sqrt(n*n+o*o);if(s>this.maxTouchDistance)return!1;var a=i.translationX-r.translationX,l=i.translationY-r.translationY,h=Math.sqrt(a*a+l*l);if(h>this.maxTouchDivergence)return!1;var u=e.UP|e.DOWN,c=this.touchDirection(i)&u,d=this.touchDirection(r)&u;return 0!=(c&d)},e.prototype.touchDirection=function(t){var i=t.translationX,r=t.translationY,n=0;return Math.abs(i)>Math.abs(r)?(n|=i<0?e.LEFT:0,n|=i>0?e.RIGHT:0):(n|=r<0?e.UP:0,n|=r>0?e.DOWN:0),n},e}),i("WorldWindowController",["./error/ArgumentError","./util/Logger","./error/UnsupportedOperationError"],function(t,e,i){"use strict";var r=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WorldWindowController","constructor","missingWorldWindow"));this.wwd=i,this.allGestureListeners=[]};return r.prototype.onGestureEvent=function(t){for(var e=!1,i=0;i=1&&this.opacity>=1){this.previousTiles={};for(var e=0;e0&&(t.surfaceTileRenderer.renderTiles(t,this.currentTiles,this.opacity,t.surfaceOpacity>=1),t.frameStatistics.incrementImageTileCount(this.currentTiles.length),this.inCurrentFrame=!0)}},c.prototype.fadeOutgoingTiles=function(t){for(var e=(t.timestamp-t.previousRedrawTimestamp)/t.fadeTime,i={},r=0;r0&&!i[n.imagePath]&&(n.opacity=Math.max(0,n.opacity-e),n.opacity>0&&(this.currentTiles.push(n),this.currentTilesInvalid=!0,t.redrawRequested=!0)))},c.prototype.isLayerInView=function(t){return t.terrain&&t.terrain.sector&&t.terrain.sector.intersects(this.levels.sector)},c.prototype.createTopLevelTiles=function(t){this.topLevelTiles=[],h.createTilesForLevel(this.levels.firstLevel(),this,this.topLevelTiles)},c.prototype.assembleTiles=function(t){this.currentTiles=[],this.topLevelTiles&&0!==this.topLevelTiles.length||this.createTopLevelTiles(t);for(var e=0,i=this.topLevelTiles.length;e=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},c.prototype.isTileTextureInMemory=function(t,e){return t.gpuResourceCache.containsResource(e.imagePath)},c.prototype.isTextureExpired=function(t){return this.expiration&&t.creationTime.getTime()<=this.expiration.getTime()},c.prototype.retrieveTileImage=function(t,e,i){if(this.currentRetrievals.indexOf(e.imagePath)<0){if(this.currentRetrievals.length>this.retrievalQueueSize)return;if(this.absentResourceList.isResourceAbsent(e.imagePath))return;var r=this.resourceUrlForTile(e,this.retrievalImageFormat),n=new Image,s=e.imagePath,a=t.gpuResourceCache,l=t.currentGlContext.canvas,h=this;if(!r)return void(this.currentTilesInvalid=!0);n.onload=function(){o.log(o.LEVEL_INFO,"Image retrieval succeeded: "+r);var u=h.createTexture(t,e,n);if(h.removeFromCurrentRetrievals(s),u&&(a.putResource(s,u,u.size),h.currentTilesInvalid=!0,h.absentResourceList.unmarkResourceAbsent(s),!i)){var c=document.createEvent("Event");c.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),l.dispatchEvent(c)}},n.onerror=function(){h.removeFromCurrentRetrievals(s),h.absentResourceList.markResourceAbsent(s),o.log(o.LEVEL_WARNING,"Image retrieval failed: "+r)},this.currentRetrievals.push(s),n.crossOrigin=this.crossOrigin,n.src=r}},c.prototype.createTexture=function(t,e,i){return new l(t.currentGlContext,i)},c.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},c.prototype.resourceUrlForTile=function(t,e){return this.urlBuilder?this.urlBuilder.urlForTile(t,e):null},c}),i("layer/MercatorTiledImageLayer",["../util/Color","../geom/Sector","../layer/TiledImageLayer","../geom/Vec2","../util/WWMath"],function(t,e,i,r,n){"use strict";var o=function(t,e,n,o,s,a,l){i.call(this,t,e,n,o,s,a,l),this.detectBlankImages=!1,this.testPixels=[new r(20,20),new r(235,20),new r(20,235),new r(235,235)],this.destCanvas=document.createElement("canvas"),this.destContext=this.destCanvas.getContext("2d")};return o.prototype=Object.create(i.prototype),o.prototype.createTile=function(t,r,o,s){var a,l,h,u,c,d,p=this.mapSizeForLevel(r.levelNumber),f=n.clamp(s*this.imageSize,0,p),g=n.clamp(o*this.imageSize,0,p),m=n.clamp(f+this.imageSize,0,p),y=n.clamp(g+this.imageSize,0,p);return a=f/p-.5,l=.5-y/p,h=90-360*Math.atan(Math.exp(2*-l*Math.PI))/Math.PI,u=360*a,a=m/p-.5,l=.5-g/p,c=90-360*Math.atan(Math.exp(2*-l*Math.PI))/Math.PI,d=360*a,t=new e(h,c,u,d),i.prototype.createTile.call(this,t,r,o,s)},o.prototype.createTexture=function(t,e,r){var o,s,a,l,h,u,c,d,p=t.canvas2D,f=t.ctx2D,g=this.destCanvas,m=this.destContext,y=m.createImageData(r.width,r.height),E=e.sector,v=n.gudermannianInverse(E.minLatitude),_=n.gudermannianInverse(E.maxLatitude);if(p.width=r.width,p.height=r.height,g.width=r.width,g.height=r.height,f.drawImage(r,0,0,r.width,r.height),o=f.getImageData(0,0,r.width,r.height),this.detectBlankImages&&this.isBlankImage(r,o))return this.absentResourceList.markResourceAbsentPermanently(e.imagePath),null;for(var b=0;b<1;b++)for(var w=0;w0;s--)r=0,n=1<=0&&this.renderables.splice(e,1)},r.prototype.removeAllRenderables=function(){this.renderables=[]},r.prototype.doRender=function(t){for(var e=t.orderedRenderables.length,r=0,n=this.renderables.length;re&&(this.inCurrentFrame=!0)},r}),i("render/SurfaceTile",["../error/ArgumentError","../util/Logger","../geom/Matrix","../geom/Sector","../error/UnsupportedOperationError"],function(t,e,i,r,n){"use strict";var o=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","constructor","missingSector"));this.sector=i};return o.prototype.bind=function(t){throw new n(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","bind","abstractInvocation"))},o.prototype.applyInternalTransform=function(t,i){throw new n(e.logMessage(e.LEVEL_SEVERE,"SurfaceTile","applyInternalTransform","abstractInvocation"))},o}),i("shapes/SurfaceImage",["../error/ArgumentError","../util/Logger","../pick/PickedObject","../render/SurfaceTile"],function(t,e,i,r){"use strict";var n=function(i,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","constructor","missingSector"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","constructor","missingImage"));r.call(this,i),this.enabled=!0,this._imageSource=n,this.resamplingMode=WorldWind.FILTER_LINEAR,this.opacity=1,this.displayName="Surface Image",this.imageSourceWasUpdated=!0};return n.prototype=Object.create(r.prototype),Object.defineProperties(n.prototype,{imageSource:{get:function(){return this._imageSource},set:function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfaceImage","imageSource","missingImage"));this._imageSource=i,this.imageSourceWasUpdated=!0}}}),n.prototype.bind=function(t){var e=t.gpuResourceCache.resourceForKey(this._imageSource);return e&&!this.imageSourceWasUpdated?this.bindTexture(t,e):(e=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this._imageSource),this.imageSourceWasUpdated=!1,e?this.bindTexture(t,e):void 0)},n.prototype.bindTexture=function(t,e){var i=t.currentGlContext;return e.setTexParameter(i.TEXTURE_MAG_FILTER,this.resamplingMode===WorldWind.FILTER_NEAREST?i.NEAREST:i.LINEAR),e.bind(t)},n.prototype.applyInternalTransform=function(t,e){},n.prototype.render=function(t){if(this.enabled&&t.terrain&&this.sector.overlaps(t.terrain.sector)){if(t.pickingMode&&(this.pickColor=t.uniquePickColor()),t.surfaceTileRenderer.renderTiles(t,[this],this.opacity*t.currentLayer.opacity),t.pickingMode){var e=new i(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(e)}t.currentLayer.inCurrentFrame=!0}},n}),i("layer/BMNGOneImageLayer",["../layer/RenderableLayer","../geom/Sector","../shapes/SurfaceImage","../util/WWUtil"],function(t,e,i,r){"use strict";var n=function(){t.call(this,"Blue Marble Image");var r=new i(e.FULL_SPHERE,WorldWind.configuration.baseUrl+"images/BMNG_world.topo.bathy.200405.3.2048x1024.jpg");this.addRenderable(r),this.pickEnabled=!1,this.minActiveAltitude=3e6};return n.prototype=Object.create(t.prototype),n}),i("util/PeriodicTimeSequence",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"PeriodicTimeSequence","constructor","missingString"));var n=r.split("/");if(3!==n.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"PeriodicTimeSequence","constructor","The interval string "+r+" does not contain 3 elements."));this.sequenceString=r,this.startTime=new Date(n[0]),this.endTime=new Date(n[1]),this.intervalMilliseconds=this.endTime.getTime()-this.startTime.getTime(),this._currentTime=this.startTime,this.infiniteInterval=this.startTime.getTime()==this.endTime.getTime(),this.period=i.parsePeriodString(n[2],!1)};return Object.defineProperties(i.prototype,{currentTime:{get:function(){return this._currentTime},set:function(t){this._currentTime=t}},scaleForCurrentTime:{get:function(){return this.currentTime?(this.currentTime.getTime()-this.startTime.getTime())/this.intervalMilliseconds:1}}}),i.prototype.next=function(){return this.currentTime?this.currentTime.getTime()>=this.endTime.getTime()&&!this.infiniteInterval?this.currentTime=null:this.currentTime=i.incrementTime(this.currentTime,this.period):this.currentTime=this.startTime,this.currentTime},i.prototype.previous=function(){return this.currentTime?this.currentTime.getTime()===this.startTime.getTime()?this.currentTime=null:this.currentTime=this.getTimeForScale(.9999*this.scaleForCurrentTime):this.currentTime=this.endTime,this.currentTime},i.prototype.reset=function(){this.currentTime=null},i.prototype.getTimeForScale=function(t){if(t<=0)return this.startTime;if(t>=1)return this.endTime;var e=new Date(this.startTime.getTime()),r=e,n=0;for(n=0;n0;h--)a[h]>=l[h]&&(a[h-1]=a[h-1]+Math.floor(a[h]/l[h]),a[h]=a[h]%l[h]);return a},i}),i("util/LevelRowColumnUrlBuilder",["../error/ArgumentError","../util/Logger","../util/WWUtil"],function(t,e,i){"use strict";var r=function(t,e){this.serverAddress=t,t&&0!==t.length||(this.serverAddress=i.currentUrlSansFilePart()),this.pathToData=e};return r.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","urlForTile","The image format is null or undefined."));var o=this.serverAddress;return this.pathToData&&(o=o+"/"+this.pathToData),o=o+"/"+r.level.levelNumber.toString(),o=o+"/"+r.row.toString(),o=o+"/"+r.row.toString()+"_"+r.column.toString(),o=o+"."+i.suffixForMimeType(n),o=o.replace(" ","%20")},r}),i("layer/RestTiledImageLayer",["../error/ArgumentError","../geom/Location","../util/Logger","../geom/Sector","../layer/TiledImageLayer","../util/LevelRowColumnUrlBuilder","../util/WWUtil"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,a,l){var h=s.urlPath(t+"/"+i);n.call(this,l&&l.sector||r.FULL_SPHERE,l&&l.levelZeroTileDelta||new e(45,45),l&&l.numLevels||5,l&&l.imageFormat||"image/jpeg",h,l&&l.tileWidth||256,l&&l.tileHeight||256),this.displayName=a,this.pickEnabled=!1,this.urlBuilder=new o(t,i)};return a.prototype=Object.create(n.prototype),a}),i("layer/BMNGRestLayer",["../error/ArgumentError","../layer/Layer","../util/Logger","../util/PeriodicTimeSequence","../layer/RestTiledImageLayer"],function(t,e,i,r,n){"use strict";var o=function(t,i,n,s){e.call(this,n||"Blue Marble time series"),this.time=s||new Date("2004-01"),this.timeSequence=new r("2004-01-01/2004-12-01/P1M"),this.serverAddress=t,this.pathToData=i,this.layers={},this.layerNames=[{month:"BlueMarble-200401",time:o.availableTimes[0]},{month:"BlueMarble-200402",time:o.availableTimes[1]},{month:"BlueMarble-200403",time:o.availableTimes[2]},{month:"BlueMarble-200404",time:o.availableTimes[3]},{month:"BlueMarble-200405",time:o.availableTimes[4]},{month:"BlueMarble-200406",time:o.availableTimes[5]},{month:"BlueMarble-200407",time:o.availableTimes[6]},{month:"BlueMarble-200408",time:o.availableTimes[7]},{month:"BlueMarble-200409",time:o.availableTimes[8]},{month:"BlueMarble-200410",time:o.availableTimes[9]},{month:"BlueMarble-200411",time:o.availableTimes[10]},{month:"BlueMarble-200412",time:o.availableTimes[11]}],this.pickEnabled=!1};return o.prototype=Object.create(e.prototype),o.availableTimes=[new Date("2004-01"),new Date("2004-02"),new Date("2004-03"),new Date("2004-04"),new Date("2004-05"),new Date("2004-06"),new Date("2004-07"),new Date("2004-08"),new Date("2004-09"),new Date("2004-10"),new Date("2004-11"),new Date("2004-12")],o.prototype.prePopulate=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"BMNGRestLayer","prePopulate","missingWorldWindow"));for(var r=0;r=this.layerNames[11].time.getTime())return this.layerNames[11].month;for(var i=0;i=r&&e<=n){var o=e-r,s=n-e;return o1){e=!1;break}return e},fetchFile:function(e,i){var r=new XMLHttpRequest;r.onload=function(){this.status>=200&&this.status<400?i(this.response):(t.log(t.LEVEL_SEVERE,"sever error: "+this.status),i(null))},r.onerror=function(e){t.log(t.LEVEL_SEVERE,"connection error: "+e),i(null)},r.open("get",e,!0),r.send()}};return e}),i("formats/collada/ColladaImage",["./ColladaUtils"],function(t){"use strict";var e=function(t,e){this.filename="",this.map=t,this.name=e,this.path=""};return e.prototype.parse=function(e){for(var i=0;i3&&(0===T&&(w=S),T>2*u&&((w>65535||L>65535)&&(v=!0),m.push(w),m.push(L))),S>65535&&(v=!0),m.push(S),y+=u}}var I={vertices:new Float32Array(h[0][1]),indexedRendering:E,material:a};return I.indexedRendering&&(I.indices=v?new Uint32Array(m):new Uint16Array(m)),this.transformMeshInfo(I,h),I},e.prototype.parseInputs=function(t,e,i){for(var r=[],n=0,o=t.querySelectorAll("input"),s=0;sr?1:i===r?0:-1})},h.prototype.flattenNode=function(t){if(t.mesh)for(var e=t.mesh,i=this._meshes[e].buffers,r=0,n=i.length;r0;u&&(l.textures.diffuse?h=l.textures.diffuse.mapId:l.textures.reflective&&(h=l.textures.reflective.mapId)),this._entities.push({mesh:i[r],material:l,node:t,imageKey:h})}for(var c=0;c=1||t.pickingMode),r.loadColor(i,t.pickingMode?this.pickColor:this._tmpColor),r.loadOpacity(i,t.pickingMode?o>0?1:0:o)},h.prototype.applyMatrix=function(t,e,i,r,n){this._mvpMatrix.copy(t.modelviewProjection),this._mvpMatrix.multiplyMatrix(this._transformationMatrix),r&&this._localTransforms&&this._mvpMatrix.multiplyMatrix(r),e&&!t.pickingMode&&(this._normalMatrix.copy(t.modelviewNormalTransform),this._normalMatrix.multiplyMatrix(this._normalTransformMatrix),n&&this._localTransforms&&this._normalMatrix.multiplyMatrix(n),t.currentProgram.loadModelviewInverse(t.currentGlContext,this._normalMatrix)),i&&this._activeTexture&&(t.currentProgram.loadTextureMatrix(t.currentGlContext,this._texCoordMatrix),this._activeTexture=null),t.currentProgram.loadModelviewProjection(t.currentGlContext,this._mvpMatrix)},h.prototype.endDrawing=function(t){ +var e=t.currentGlContext,i=t.currentProgram;e.disableVertexAttribArray(1),e.disableVertexAttribArray(2),i.loadApplyLighting(e,0),i.loadTextureEnabled(e,!1)},h.prototype.computeTransformationMatrix=function(t){this._transformationMatrix.setToIdentity(),this._transformationMatrix.multiplyByLocalCoordinateTransform(this._placePoint,t),this._transformationMatrix.multiplyByRotation(1,0,0,this._xRotation),this._transformationMatrix.multiplyByRotation(0,1,0,this._yRotation),this._transformationMatrix.multiplyByRotation(0,0,1,this._zRotation),this._transformationMatrix.multiplyByScale(this._scale,this._scale,this._scale),this._transformationMatrix.multiplyByTranslation(this._xTranslation,this._yTranslation,this._zTranslation),this.computeNormalMatrix()},h.prototype.computeNormalMatrix=function(){this._transformationMatrix.extractRotationAngles(this._tmpVector),this._normalTransformMatrix.setToIdentity(),this._normalTransformMatrix.multiplyByRotation(-1,0,0,this._tmpVector[0]),this._normalTransformMatrix.multiplyByRotation(0,-1,0,this._tmpVector[1]),this._normalTransformMatrix.multiplyByRotation(0,0,-1,this._tmpVector[2])},h.prototype.mustRenderNode=function(t){var e=!0;if(this._hideNodes){var i=this._nodesToHide.indexOf(t);e=i===-1}return e},h}),i("formats/collada/ColladaLoader",["../../error/ArgumentError","./ColladaAsset","./ColladaImage","./ColladaMaterial","./ColladaMesh","./ColladaNode","./ColladaScene","./ColladaUtils","../../util/Logger"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(e,i){if(!e)throw new t(l.logMessage(l.LEVEL_SEVERE,"ColladaLoader","constructor","missingPosition"));this.position=e,this.dirPath="/",this.init(i)};return h.prototype.init=function(t){t&&(this.dirPath=t.dirPath||"/"),this.scene={type:"SceneTree",dirPath:this.dirPath,images:{},metadata:{},materials:{},meshes:{},root:{children:[]}},this.xmlDoc=null},h.prototype.load=function(t,e){t.indexOf("://")===-1&&(t=this.dirPath+t),a.fetchFile(t,function(t){if(t)try{i=this.parse(t)}catch(t){i=null,l.log(l.LEVEL_SEVERE,"error parsing collada file: "+t)}else var i=null;e(i)}.bind(this))},h.prototype.parse=function(t){this.init();var i=new DOMParser;this.xmlDoc=i.parseFromString(t,"text/xml");var r=this.xmlDoc.querySelectorAll("library_nodes node"),n=this.xmlDoc.querySelectorAll("library_effects effect");return this.scene.metadata=new e(this.xmlDoc).parse(),this.parseLib("visual_scene",r),this.parseLib("library_geometries"),this.parseLib("library_materials",n),this.parseLib("library_images"),this.xmlDoc=null,new s(this.position,this.scene)},h.prototype.parseLib=function(t,e){var s=this.xmlDoc.getElementsByTagName(t),l=[];s&&s.length&&(l=s[0].childNodes);for(var h=0;h0&&this.drawLabel(t),this.currentVisibility<1&&this.markerImageSource&&this.drawMarker(t),this.activeAttributes.depthTest||e.enable(e.DEPTH_TEST)},p.prototype.drawLabel=function(t){var e,i=t.currentGlContext,r=t.currentProgram;!t.pickingMode&&this.activeTexture&&(p.matrix.setToIdentity(),p.matrix.multiplyByTextureTransform(this.activeTexture),e=this.activeTexture.bind(t),r.loadTextureEnabled(i,e),r.loadTextureMatrix(i,p.matrix)),p.matrix.copy(t.screenProjection),p.matrix.multiplyMatrix(this.imageTransform),r.loadModelviewProjection(i,p.matrix),i.drawArrays(i.TRIANGLE_STRIP,0,4)},p.prototype.drawMarker=function(t){var e,i=t.currentGlContext,r=t.currentProgram,n=t.gpuResourceCache.resourceForKey(this.markerImageSource);if(!n)return void t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.markerImageSource);t.pickingMode||(p.matrix.setToIdentity(),p.matrix.multiplyByTextureTransform(n),e=n.bind(t),r.loadTextureEnabled(i,e),r.loadTextureMatrix(i,p.matrix),r.loadOpacity(i,this.layer.opacity*(1-this.currentVisibility)));var o=this.markerImageScale;p.matrix.copy(t.screenProjection),p.matrix.multiplyByTranslation(this.screenPoint[0]-o*n.imageWidth/2,this.screenPoint[1]-o*n.imageWidth/2,this.screenPoint[2]),p.matrix.multiplyByScale(n.imageWidth*o,n.imageHeight*o,1),r.loadModelviewProjection(i,p.matrix),i.drawArrays(i.TRIANGLE_STRIP,0,4)},p}),i("shapes/ScreenText",["../error/ArgumentError","../util/Logger","../util/Offset","../shapes/Text"],function(t,e,i,r){"use strict";var n=function(i,n){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Text","constructor","missingOffset"));r.call(this,n),this.screenOffset=i,this.altitudeMode=null};return n.prototype=Object.create(r.prototype),n.prototype.render=function(t){this.lastFrameTime!==t.timestamp&&r.prototype.render.call(this,t)},n.prototype.computeScreenPointAndEyeDistance=function(t){var e=t.currentGlContext,i=this.screenOffset.offsetForSize(e.drawingBufferWidth,e.drawingBufferHeight);return this.screenPoint[0]=i[0],this.screenPoint[1]=i[1],this.screenPoint[2]=0,this.eyeDistance=0,!0},n}),i("layer/CoordinatesDisplayLayer",["../error/ArgumentError","../util/Color","../util/Font","../layer/Layer","../util/Logger","../util/Offset","../geom/Position","../shapes/ScreenImage","../shapes/ScreenText","../shapes/TextAttributes","../geom/Vec2"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(i){function s(t){p.handleUIEvent(t)}function u(t,e){p.handleRedraw(e)}if(!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"CoordinatesDisplayLayer","constructor","missingWorldWindow"));r.call(this,"Coordinates"),this.wwd=i,this.pickEnabled=!1,this.eventType=null,this.clientX=null,this.clientY=null,this.terrainPosition=null,this.latText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.latText.attributes=new h(null),this.latText.attributes.color=e.YELLOW,this.lonText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.lonText.attributes=new h(null),this.lonText.attributes.color=e.YELLOW,this.elevText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.elevText.attributes=new h(null),this.elevText.attributes.color=e.YELLOW,this.eyeText=new l(new o(WorldWind.OFFSET_PIXELS,0,WorldWind.OFFSET_PIXELS,0)," "),this.eyeText.attributes=new h(null),this.eyeText.attributes.color=e.YELLOW;var c=new o(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,.5),d=WorldWind.configuration.baseUrl+"images/crosshair.png";this.crosshairImage=new a(c,d);var p=this;window.PointerEvent?(i.addEventListener("pointerdown",s),i.addEventListener("pointermove",s),i.addEventListener("pointerleave",s)):(i.addEventListener("mousedown",s),i.addEventListener("mousemove",s),i.addEventListener("mouseleave",s),i.addEventListener("touchstart",s),i.addEventListener("touchmove",s)),this.wwd.redrawCallbacks.push(u)};return c.prototype=Object.create(r.prototype),c.prototype.doRender=function(t){var e,i,r,n,s,a=this.terrainPosition,l=t.eyePosition,h=t.currentGlContext.canvas.clientWidth;h>650?(e=h/2-50,i=11,r=WorldWind.OFFSET_PIXELS,n=0):h>400?(e=60,i=5,r=WorldWind.OFFSET_INSET_PIXELS,n=1):(e=60,i=5,r=WorldWind.OFFSET_INSET_PIXELS,n=1,s=!0),this.latText.text=a?this.formatLatitude(a.latitude):null,this.latText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.latText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.latText.render(t),e+=70,this.lonText.text=a?this.formatLongitude(a.longitude):null,this.lonText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.lonText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.lonText.render(t),t.globe.is2D()||(e+=70,this.elevText.text=a?this.formatAltitude(a.altitude,"m"):null,this.elevText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.elevText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,1,WorldWind.OFFSET_FRACTION,n),this.elevText.render(t)),s||(e+=40,this.eyeText.text="Eye "+this.formatAltitude(l.altitude,l.altitude<1e3?"m":"km"),this.eyeText.screenOffset=new o(WorldWind.OFFSET_PIXELS,e,r,i),this.eyeText.attributes.offset=new o(WorldWind.OFFSET_FRACTION,0,WorldWind.OFFSET_FRACTION,n),this.eyeText.render(t)),"touch"===this.eventType&&this.crosshairImage.render(t),this.inCurrentFrame=!0},c.prototype.handleUIEvent=function(t){t.type.indexOf("pointer")!==-1?this.eventType=t.pointerType:t.type.indexOf("mouse")!==-1?this.eventType="mouse":t.type.indexOf("touch")!==-1&&(this.eventType="touch"),t.type.indexOf("leave")!==-1?(this.clientX=null,this.clientY=null):(this.clientX=t.clientX,this.clientY=t.clientY),this.wwd.redraw()},c.prototype.handleRedraw=function(t){if(t===WorldWind.BEFORE_REDRAW){var e,i;("mouse"===this.eventType||"pen"===this.eventType)&&this.clientX&&this.clientY?(e=this.wwd.canvasCoordinates(this.clientX,this.clientY),e[0]>=0&&e[0]=0&&e[1]i?-1:e2e3&&(this.frameTimeAverage=this.frameTimeCumulative/this.frameCount,this.frameRateAverage=1e3*this.frameCount/(t-this.frameTimeBase),this.frameTimeMin=this.frameTimeExtremes[0],this.frameTimeMax=this.frameTimeExtremes[1],this.frameCount=0,this.frameTimeCumulative=0,this.frameTimeBase=t,this.frameTimeExtremes=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY])},t.prototype.incrementRenderedTileCount=function(t){this.renderedTileCount+=t},t.prototype.setTerrainTileCount=function(t){this.terrainTileCount=t},t.prototype.incrementImageTileCount=function(t){this.imageTileCount=t},t.prototype.incrementTileUpdateCount=function(t){this.tileUpdateCount+=t},t.prototype.incrementTextureLoadCount=function(t){this.textureLoadCount+=t},t.prototype.incrementVboLoadCount=function(t){this.vboLoadCount+=t},t}),i("render/FramebufferTexture",["../error/ArgumentError","../util/Logger","../util/WWMath"],function(t,e){"use strict";var i=function(i,r,n,o){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"FramebufferTexture","constructor","missingGlContext"));if(r<0||n<0)throw new t(e.logMessage(e.LEVEL_SEVERE,"FramebufferTexture","constructor","The framebuffer width or height is less than zero."));this.width=r,this.height=n,this.depth=o,this.size=r*n*4+(o?r*n*2:0),this.framebufferId=i.createFramebuffer(),i.bindFramebuffer(i.FRAMEBUFFER,this.framebufferId),this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,r,n,0,i.RGBA,i.UNSIGNED_BYTE,null),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,this.texture,0),this.depthBuffer=null,o&&(this.depthBuffer=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,this.depthBuffer),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_COMPONENT16,r,n),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,this.depthBuffer));var s=i.checkFramebufferStatus(i.FRAMEBUFFER);s!=i.FRAMEBUFFER_COMPLETE&&(e.logMessage(e.LEVEL_WARNING,"FramebufferTexture","constructor","Error creating framebuffer: "+s),this.framebufferId=null,this.texture=null,this.depthBuffer=null),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindRenderbuffer(i.RENDERBUFFER,null),i.bindTexture(i.TEXTURE_2D,null)};return i.prototype.bind=function(t){return this.texture&&t.currentGlContext.bindTexture(gl.TEXTURE_2D,this.texture),!!this.texture},i}),i("render/FramebufferTile",["../error/ArgumentError","../render/FramebufferTexture","../util/Logger","../geom/Matrix","../geom/Rectangle","../render/TextureTile"],function(t,e,i,r,n,o){"use strict";var s=function(e,n,s,a,l){if(!l||l.length<1)throw new t(i.logMessage(i.LEVEL_SEVERE,"FramebufferTile","constructor","The specified cache name is null, undefined or zero length."));o.call(this,e,n,s,a),this.gpuCacheKey=l,this.textureTransform=r.fromIdentity().setToUnitYFlip(),this.mustClear=!0};return s.prototype=Object.create(o.prototype),s.prototype.clearFramebuffer=function(t){this.mustClear=!0},s.prototype.bindFramebuffer=function(t){var e=t.gpuResourceCache.resourceForKey(this.gpuCacheKey);return e||(e=this.createFramebuffer(t)),t.bindFramebuffer(e),this.mustClear&&(this.doClearFramebuffer(t),this.mustClear=!1),!0},s.prototype.createFramebuffer=function(t){var i=new e(t.currentGlContext,this.tileWidth,this.tileHeight,!1);return t.gpuResourceCache.putResource(this.gpuCacheKey,i,i.size),i},s.prototype.doClearFramebuffer=function(t){var e=t.currentGlContext;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},s.prototype.applyInternalTransform=function(t,e){e.multiplyMatrix(this.textureTransform)},s}),i("render/FramebufferTileController",["../error/ArgumentError","../render/FramebufferTile","../util/LevelSet","../geom/Location","../util/Logger","../cache/MemoryCache","../geom/Sector","../util/Tile"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(){this.tileWidth=256,this.tileHeight=256,this.detailControl=1.75,this.levels=new i(s.FULL_SPHERE,new r(45,45),16,this.tileWidth,this.tileHeight),this.topLevelTiles=[],this.currentTiles=[],this.currentTimestamp=null,this.currentGlobeStateKey=null,this.tileCache=new o(5e5,4e5),this.key="FramebufferTileController "+ ++l.keyPool};return l.keyPool=0,l.prototype.selectTiles=function(e,i){if(!i)throw new t(n.logMessage(n.LEVEL_SEVERE,"FramebufferTileController","selectTiles","missingSector"));this.assembleTiles(e);for(var r=[],o=0,s=this.currentTiles.length;o=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},l}),i("globe/ElevationModel",["../error/ArgumentError","../geom/Angle","../geom/Location","../util/Logger"],function(t,e,i,r){"use strict";var n=function(){this.id=0,this.stateKey="",this.coverages=[],this.scratchLocation=new i(0,0),this.computeStateKey()};return Object.defineProperties(n.prototype,{timestamp:{get:function(){var t,e,i=0;for(t=0,e=this.coverages.length;tt&&(t=r.maxElevation)}return t!==-Number.MAX_VALUE?t:0}}}),n.idPool=0,n.prototype.computeStateKey=function(){this.id=++n.idPool,this.stateKey="elevationModel "+this.id.toString()+" "},n.prototype.coverageComparator=function(t,e){var i=t.resolution,r=e.resolution;return i>r?-1:i===r?0:1},n.prototype.performCoverageListChangedActions=function(){this.coverages.length>1&&this.coverages.sort(this.coverageComparator),this.computeStateKey()},n.prototype.addCoverage=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","addCoverage","missingCoverage"));return!this.containsCoverage(e)&&(this.coverages.push(e),this.performCoverageListChangedActions(),!0)},n.prototype.removeAllCoverages=function(){this.coverages.length>0&&(this.coverages=[],this.performCoverageListChangedActions())},n.prototype.removeCoverage=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","removeCoverage","missingCoverage"));var i=this.coverages.indexOf(e);i>=0&&(this.coverages.splice(i,1),this.performCoverageListChangedActions())},n.prototype.containsCoverage=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","containsCoverage","missingCoverage"));var i=this.coverages.indexOf(e);return i>=0},n.prototype.minAndMaxElevationsForSector=function(e){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","minAndMaxElevationsForSector","missingSector"));for(var i=[Number.MAX_VALUE,-Number.MAX_VALUE],n=this.coverages.length-1;n>=0;n--){var o=this.coverages[n];if(o.enabled&&o.coverageSector.intersects(e)&&o.minAndMaxElevationsForSector(e,i))break}return i[0]!==Number.MAX_VALUE?i:[0,0]},n.prototype.elevationAtLocation=function(t,e){var i,r=this.coverages.length;for(i=r-1;i>=0;i--){var n=this.coverages[i];if(n.enabled&&n.coverageSector.containsLocation(t,e)){var o=n.elevationAtLocation(t,e);if(null!==o)return o}}return 0},n.prototype.preferredCoverageIndex=function(t,e,i){var r,n=this.coverages.length,o=Number.MAX_VALUE,s=-1;for(r=0;ro)return s;o=h,s=r}}return s},n.prototype.bestCoverageAtLocation=function(e,i,n){if(!n||n<0)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","bestCoverageAtLocation","invalidResolution"));this.scratchLocation.set(e,i);var o=this.preferredCoverageIndex(null,this.scratchLocation,n);return o>=0?this.coverages[o]:null},n.prototype.elevationsForGrid=function(e,i,n,o,s){if(!e)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","elevationsForGrid","missingSector"));if(!i||!n||i<1||n<1)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","elevationsForGrid","The specified number of latitudinal or longitudinal positions is less than one."));if(!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","elevationsForGrid","missingTargetResolution"));if(!s)throw new t(r.logMessage(r.LEVEL_SEVERE,"ElevationModel","elevationsForGrid","missingResult"));s.fill(NaN);var a=Number.MAX_VALUE,l=!1,h=this.preferredCoverageIndex(e,null,o);if(h>=0)for(var u=h;!l&&u>=0;u--){var c=this.coverages[u];c.enabled&&c.coverageSector.intersects(e)&&(l=c.elevationsForGrid(e,i,n,s),l&&(a=c.resolution))}if(!l){var d=s.length;for(u=0;u1?s-1:1),T=(S-w)/(a>1?a-1:1),R=h?h:new o(0,0,0),x=0,M=0,C=new Float64Array(a),A=new Float64Array(a);for(p=0,g=w;p0||0!=D?(V>0?(p=Math.sqrt(V),f=Math.sqrt(N*I*D),V>10*O?(g=s.cbrt((p+f)*(p+f)),d=k+.5*g+2*k*k/g):d=k+.5*s.cbrt((p+f)*(p+f))+.5*s.cbrt((p-f)*(p-f))):(p=Math.sqrt(-V),f=Math.sqrt(-8*k*k*k),g=Math.sqrt(N*I*D),m=2*Math.atan2(g,p+f)/3,d=-4*k*Math.sin(m)*Math.cos(Math.PI/6+m)),y=Math.sqrt(d*d+N*D),E=O*(d+y-D)/(2*y),v=(d+y)/(Math.sqrt(E*E+d+y)+E),_=v*C/(v+O),b=Math.sqrt(_*_+x*x),u=(v+O-1)*b/v,c=2*Math.atan2(x,b+_)):(p=Math.sqrt(1-O),f=Math.sqrt(O-I),w=Math.sqrt(O),u=-A*p*f/w,c=f/(w*f+p*Math.sqrt(I))),L=Math.sqrt(2),S=(L-1)*Rf?(n[0]=c[0]+p*(c[3]-c[0])+f*(c[6]-c[0]),n[1]=c[1]+p*(c[4]-c[1])+f*(c[7]-c[1]),n[2]=c[2]+p*(c[5]-c[2])+f*(c[8]-c[2])):(n[0]=c[9]+(1-p)*(c[6]-c[9])+(1-f)*(c[3]-c[9]),n[1]=c[10]+(1-p)*(c[7]-c[10])+(1-f)*(c[4]-c[10]),n[2]=c[11]+(1-p)*(c[8]-c[11])+(1-f)*(c[5]-c[11])),n[0]+=this.referencePoint[0],n[1]+=this.referencePoint[1],n[2]+=this.referencePoint[2],n},n.prototype.update=function(t){r.prototype.update.call(this,t);var e=t.globe.elevationTimestamp();this._elevationTimestamp!=e&&(this._elevationTimestamp=e,this._stateKey=null)},n.prototype.computeStateKey=function(){var t=[];return t.push(this._elevationTimestamp),t.push(this.neighborMap[WorldWind.NORTH]?this.neighborMap[WorldWind.NORTH].compare(this.level):0),t.push(this.neighborMap[WorldWind.SOUTH]?this.neighborMap[WorldWind.SOUTH].compare(this.level):0),t.push(this.neighborMap[WorldWind.EAST]?this.neighborMap[WorldWind.EAST].compare(this.level):0),t.push(this.neighborMap[WorldWind.WEST]?this.neighborMap[WorldWind.WEST].compare(this.level):0),t.join(".")},n}),i("globe/TerrainTileList",["../error/ArgumentError","../util/Logger","../geom/Sector"],function(t,e,i){"use strict";var r=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"TerrainTileList","TerrainTileList","missingTessellator"));this.tessellator=i,this.sector=null,this.tileArray=[]};return Object.defineProperties(r.prototype,{length:{get:function(){return this.tileArray.length}}}),r.prototype.addTile=function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"TerrainTileList","addTile","missingTile"));this.tileArray.indexOf(r)==-1&&(this.tileArray.push(r),this.sector?this.sector.union(r.sector):(this.sector=new i(0,0,0,0),this.sector.copy(r.sector)))},r.prototype.removeAllTiles=function(){this.tileArray=[],this.sector=null},r}),i("globe/Tessellator",["../geom/Angle","../error/ArgumentError","../shaders/BasicProgram","../globe/Globe","../shaders/GpuProgram","../util/Level","../util/LevelSet","../geom/Location","../util/Logger","../geom/Matrix","../cache/MemoryCache","../error/NotYetImplementedError","../pick/PickedObject","../geom/Position","../geom/Rectangle","../geom/Sector","../globe/Terrain","../globe/TerrainTile","../globe/TerrainTileList","../util/Tile","../util/WWMath","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_,b){"use strict";var w=function(){this.numRowsTilesInTopLevel=4,this.numColumnsTilesInTopLevel=8,this.maximumSubdivisionDepth=15,this.tileWidth=32,this.tileHeight=32,this.detailControl=40,this.levels=new s(g.FULL_SPHERE,new a(180/this.numRowsTilesInTopLevel,360/this.numColumnsTilesInTopLevel),this.maximumSubdivisionDepth,this.tileWidth,this.tileHeight),this.topLevelTiles={},this.currentTiles=new E(this),this.tileCache=new u(5e6,4e6),this.elevationTimestamp=void 0,this.lastModelViewProjection=h.fromIdentity(),this.vertexPointLocation=-1,this.vertexTexCoordLocation=-1,this.texCoords=null,this.texCoordVboCacheKey="global_tex_coords",this.indices=null,this.indicesVboCacheKey="global_indices",this.baseIndices=null,this.baseIndicesOffset=null,this.numBaseIndices=null,this.indicesNorth=null,this.indicesNorthOffset=null,this.numIndicesNorth=null,this.indicesSouth=null,this.indicesSouthOffset=null,this.numIndicesSouth=null,this.indicesWest=null,this.indicesWestOffset=null,this.numIndicesWest=null,this.indicesEast=null,this.indicesEastOffset=null,this.numIndicesEast=null,this.indicesLoresNorth=null,this.indicesLoresNorthOffset=null,this.numIndicesLoresNorth=null,this.indicesLoresSouth=null,this.indicesLoresSouthOffset=null,this.numIndicesLoresSouth=null,this.indicesLoresWest=null,this.indicesLoresWestOffset=null,this.numIndicesLoresWest=null,this.indicesLoresEast=null,this.indicesLoresEastOffset=null,this.numIndicesLoresEast=null,this.outlineIndicesOffset=null,this.numOutlineIndices=null,this.wireframeIndicesOffset=null,this.numWireframeIndices=null,this.scratchMatrix=h.fromIdentity(),this.scratchElevations=null,this.scratchPrevElevations=null,this.corners={},this.tiles=[]};return w.prototype.tessellate=function(t){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","tessellate","missingDC"));var i=t.globe.elevationTimestamp();if(this.lastGlobeStateKey===t.globeStateKey&&this.lastVerticalExaggeration===t.verticalExaggeration&&this.elevationTimestamp===i&&t.modelviewProjection.equals(this.lastModelViewProjection))return this.lastTerrain;this.lastModelViewProjection.copy(t.modelviewProjection),this.lastGlobeStateKey=t.globeStateKey,this.elevationTimestamp=i,this.lastVerticalExaggeration=t.verticalExaggeration,this.currentTiles.removeAllTiles(),this.topLevelTiles[t.globeStateKey]&&0!=this.topLevelTiles[t.globeStateKey].length||this.createTopLevelTiles(t),this.corners={},this.tiles=[];for(var r=0,n=this.topLevelTiles[t.globeStateKey].length;r=0){var n=r.resourceForKey(this.texCoordVboCacheKey);i.bindBuffer(i.ARRAY_BUFFER,n),i.vertexAttribPointer(this.vertexTexCoordLocation,2,i.FLOAT,!1,0,0),i.enableVertexAttribArray(this.vertexTexCoordLocation)}var o=r.resourceForKey(this.indicesVboCacheKey);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,o)},w.prototype.endRendering=function(t){var e=t.currentGlContext;e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.vertexPointLocation>=0&&e.disableVertexAttribArray(this.vertexPointLocation),this.vertexTexCoordLocation>=0&&e.disableVertexAttribArray(this.vertexTexCoordLocation)},w.prototype.beginRenderingTile=function(t,i){if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","beginRenderingTile","missingTile"));var r=t.currentGlContext,n=t.gpuResourceCache;this.scratchMatrix.setToMultiply(t.modelviewProjection,i.transformationMatrix),t.currentProgram.loadModelviewProjection(r,this.scratchMatrix);var o=t.globeStateKey+i.tileKey,s=n.resourceForKey(o);s?i.pointsVboStateKey!=i.pointsStateKey?(r.bindBuffer(r.ARRAY_BUFFER,s),r.bufferSubData(r.ARRAY_BUFFER,0,i.points),i.pointsVboStateKey=i.pointsStateKey):t.currentGlContext.bindBuffer(r.ARRAY_BUFFER,s):(s=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,s),r.bufferData(r.ARRAY_BUFFER,i.points,r.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),n.putResource(o,s,4*i.points.length),i.pointsVboStateKey=i.pointsStateKey),r.vertexAttribPointer(this.vertexPointLocation,3,r.FLOAT,!1,0,0)},w.prototype.endRenderingTile=function(t,e){},w.prototype.renderTile=function(t,i){if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","renderTile","missingTile"));var r=t.currentGlContext,n=r.TRIANGLE_STRIP;r.drawElements(n,this.numBaseIndices,r.UNSIGNED_SHORT,2*this.baseIndicesOffset);var o,s=i.level;o=i.neighborLevel(WorldWind.NORTH),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresNorth,r.UNSIGNED_SHORT,2*this.indicesLoresNorthOffset):r.drawElements(n,this.numIndicesNorth,r.UNSIGNED_SHORT,2*this.indicesNorthOffset),o=i.neighborLevel(WorldWind.SOUTH),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresSouth,r.UNSIGNED_SHORT,2*this.indicesLoresSouthOffset):r.drawElements(n,this.numIndicesSouth,r.UNSIGNED_SHORT,2*this.indicesSouthOffset),o=i.neighborLevel(WorldWind.WEST),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresWest,r.UNSIGNED_SHORT,2*this.indicesLoresWestOffset):r.drawElements(n,this.numIndicesWest,r.UNSIGNED_SHORT,2*this.indicesWestOffset),o=i.neighborLevel(WorldWind.EAST),o&&o.compare(s)<0?r.drawElements(n,this.numIndicesLoresEast,r.UNSIGNED_SHORT,2*this.indicesLoresEastOffset):r.drawElements(n,this.numIndicesEast,r.UNSIGNED_SHORT,2*this.indicesEastOffset)},w.prototype.renderWireframeTile=function(t,i){if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","renderWireframeTile","missingTile"));var r=t.currentGlContext;this.vertexTexCoordLocation>=0&&r.disableVertexAttribArray(this.vertexTexCoordLocation),r.drawElements(r.LINES,this.numWireframeIndices,r.UNSIGNED_SHORT,2*this.wireframeIndicesOffset)},w.prototype.renderTileOutline=function(t,i){if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","renderTileOutline","missingTile"));var r=t.currentGlContext;this.vertexTexCoordLocation>=0&&r.disableVertexAttribArray(this.vertexTexCoordLocation),r.drawElements(r.LINE_LOOP,this.numOutlineIndices,r.UNSIGNED_SHORT,2*this.outlineIndicesOffset)},w.prototype.pick=function(t,i,r){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","pick","missingDc"));if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Tessellator","pick","missingList"));for(var n=null,o=r||this,s=new p(0,0,0),a=[],h=0,u=i.length;ha&&(s=a,o=r)}return i[o]},w.prototype.computeIntersections=function(t,e,i){var r,n,o=e.level,s=e.points,a=i.length;t.origin.subtract(e.referencePoint),this.buildSharedGeometry(e),n=this.baseIndices,_.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.SOUTH),n=r&&r.compare(o)<0?this.indicesLoresSouth:this.indicesSouth,_.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.WEST),n=r&&r.compare(o)<0?this.indicesLoresWest:this.indicesWest,_.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.EAST),n=r&&r.compare(o)<0?this.indicesLoresEast:this.indicesEast,_.computeTriStripIntersections(t,s,n,i),r=e.neighborLevel(WorldWind.NORTH),n=r&&r.compare(o)<0?this.indicesLoresNorth:this.indicesNorth,_.computeTriStripIntersections(t,s,n,i),t.origin.add(e.referencePoint);for(var l=a,h=i.length;l0){for(this.tiles=[],this.corners={},i=0,r=f.length;i=0?this.tiles[u].level:null),t.setNeighborLevel(WorldWind.SOUTH,c>=0?this.tiles[c].level:null),t.setNeighborLevel(WorldWind.EAST,d>=0?this.tiles[d].level:null),t.setNeighborLevel(WorldWind.WEST,p>=0?this.tiles[p].level:null)},w.prototype.isTileVisible=function(t,e){return!(t.globe.projectionLimits&&!e.sector.overlaps(t.globe.projectionLimits))&&e.extent.intersectsFrustum(t.frustumInModelCoordinates)},w.prototype.tileMeetsRenderCriteria=function(t,e){var i=this.detailControl;return(e.sector.minLatitude>=75||e.sector.maxLatitude<=-75)&&(i*=2),e.level.isLastLevel()||!e.mustSubdivide(t,i)},w.prototype.regenerateTileGeometryIfNeeded=function(t,e){var i=t.globeStateKey+e.stateKey+t.verticalExaggeration;e.points&&e.pointsStateKey==i||(this.regenerateTileGeometry(t,e),e.pointsStateKey=i)},w.prototype.coverageTargetResolution=function(e){return e/8*t.RADIANS_TO_DEGREES},w.prototype.regenerateTileGeometry=function(t,e){var i=e.tileHeight+1,r=e.tileWidth+1,n=e.referencePoint,o=this.scratchElevations;o||(o=new Float64Array(i*r),this.scratchElevations=o),e.points||(e.points=new Float32Array(i*r*3)),b.fillArray(o,0),t.globe.elevationsForGrid(e.sector,i,r,this.coverageTargetResolution(e.texelSize),o),this.mustAlignNeighborElevations(t,e)&&this.alignNeighborElevations(t,e,o),b.multiplyArray(o,t.verticalExaggeration),t.globe.computePointsForGrid(e.sector,i,r,o,n,e.points),e.transformationMatrix.setTranslation(n[0],n[1],n[2])},w.prototype.mustAlignNeighborElevations=function(t,e){var i=e.level,r=e.neighborLevel(WorldWind.NORTH),n=e.neighborLevel(WorldWind.SOUTH),o=e.neighborLevel(WorldWind.EAST),s=e.neighborLevel(WorldWind.WEST);return r&&r.compare(i)<0||n&&n.compare(i)<0||o&&o.compare(i)<0||s&&s.compare(i)<0},w.prototype.alignNeighborElevations=function(t,e,i){var r,n,o,s,a=e.tileHeight+1,l=e.tileWidth+1,h=e.level,u=Math.floor(a/2)+1,c=Math.floor(l/2)+1,d=h.previousLevel(),p=this.scratchPrevElevations;if(p||(p=new Float64Array(u*c),this.scratchPrevElevations=p),b.fillArray(p,0),t.globe.elevationsForGrid(e.sector,u,c,this.coverageTargetResolution(d.texelSize),p),r=e.neighborLevel(WorldWind.NORTH),r&&r.compare(h)<0)for(o=(a-1)*l,s=(u-1)*c,n=0;n0;l-=1)i=l+h*n,s[a++]=i,s[a++]=i-n;for(l=0,i=l+h*n,s[a++]=i,this.indicesNorthOffset=s.length-o,this.indicesNorth=new Uint16Array(s.slice(this.indicesNorthOffset)),this.numIndicesNorth=o,o=2*n-2,h=0,l=0,i=l+h*n,s[a++]=i,l=1;l0;h-=1)i=l+h*n,s[a++]=i,s[a++]=i+1;for(h=0,i=l+h*n,s[a++]=i,this.indicesWestOffset=s.length-o,this.indicesWest=new Uint16Array(s.slice(this.indicesWestOffset)),this.numIndicesWest=o,o=2*r-2,l=n-1,h=0,i=l+h*n,s[a++]=i,h=1;h0;l-=1)i=(l+1&-2)+h*n,s[a++]=i,i=l+(h-1)*n,s[a++]=i;for(l=0,i=l+h*n,s[a++]=i,this.indicesLoresNorthOffset=s.length-o,this.indicesLoresNorth=new Uint16Array(s.slice(this.indicesLoresNorthOffset)),this.numIndicesLoresNorth=o,o=2*n-2,h=0,l=0,i=l+h*n,s[a++]=i,l=1;l0;h-=1)i=l+(h+1&-2)*n,s[a++]=i,i=l+1+h*n,s[a++]=i;for(h=0,i=l+h*n,s[a++]=i,this.indicesLoresWestOffset=s.length-o,this.indicesLoresWest=new Uint16Array(s.slice(this.indicesLoresWestOffset)),this.numIndicesLoresWest=o,o=2*r-2,l=n-1,h=0,i=l+h*n,s[a++]=i,h=1;h=0;i-=1)n=i+r*s,l[h]=n,h+=1;for(i=0,r=o-1;r>=0;r-=1)n=i+r*s,l[h]=n,h+=1;return this.numOutlineIndices=a,l},w.prototype.cacheSharedGeometryVBOs=function(t){var e=t.currentGlContext,i=t.gpuResourceCache,r=i.resourceForKey(this.texCoordVboCacheKey);r||(r=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,this.texCoords,e.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),i.putResource(this.texCoordVboCacheKey,r,4*this.texCoords.length/2));var n=i.resourceForKey(this.indicesVboCacheKey);n||(n=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),i.putResource(this.indicesVboCacheKey,n,2*this.indices.length))},w}),i("globe/Globe",["../geom/Angle","../error/ArgumentError","../geom/BoundingBox","../globe/ElevationModel","../geom/Line","../geom/Location","../util/Logger","../geom/Position","../projections/ProjectionWgs84","../geom/Sector","../globe/Tessellator","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t,i){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","constructor","Elevation model is null or undefined."));this.elevationModel=t,this.equatorialRadius=WorldWind.WGS84_SEMI_MAJOR_AXIS;var r=1/WorldWind.WGS84_INVERSE_FLATTENING;this.polarRadius=this.equatorialRadius*(1-r),this.eccentricitySquared=2*r-r*r,this.tessellator=new u,this._projection=i||new l,this._offset=0,this.offsetVector=new c(0,0,0),this.id=++p.idPool,this._stateKey="globe "+this.id.toString()+" "};return p.idPool=0,Object.defineProperties(p.prototype,{stateKey:{get:function(){return this._stateKey+this.elevationModel.stateKey+"offset "+this.offset.toString()+" "+this.projection.stateKey}},continuous:{get:function(){return this.projection.continuous}},projection:{get:function(){return this._projection},set:function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","projection","missingProjection"));this.projection!=t&&(this.tessellator=new u),this._projection=t}},projectionLimits:{get:function(){return this._projection.projectionLimits}},offset:{get:function(){return this._offset},set:function(t){this._offset=t,this.offsetVector[0]=2*t*Math.PI*this.equatorialRadius}}}),p.prototype.is2D=function(){return this.projection.is2D},p.prototype.computePointFromPosition=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointFromPosition","missingResult"));return this.projection.geographicToCartesian(this,t,i,r,this.offsetVector,n)},p.prototype.computePointFromLocation=function(t,i,r){if(!r)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointFromLocation","missingResult"));return this.computePointFromPosition(t,i,0,r)},p.prototype.computePointsForGrid=function(t,i,r,n,o,a){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointsFromPositions","missingSector"));if(i<1||r<1)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","computePointsFromPositions","Number of latitude or longitude locations is less than one."));var l=i*r;if(!n||n.length180&&(n.longitude-=360)),n},p.prototype.radiusAt=function(e,i){var r=Math.sin(e*t.DEGREES_TO_RADIANS),n=this.equatorialRadius/Math.sqrt(1-this.eccentricitySquared*r*r); +return n*Math.sqrt(1+(this.eccentricitySquared*this.eccentricitySquared-2*this.eccentricitySquared)*r*r)},p.prototype.surfaceNormalAtLocation=function(i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","surfaceNormalAtLocation","missingResult"));if(this.projection.surfaceNormalAtLocation)return this.projection.surfaceNormalAtLocation(this,i,r,n);if(this.is2D())return n[0]=0,n[1]=0,n[2]=1,n;var o=Math.cos(i*t.DEGREES_TO_RADIANS),a=Math.cos(r*t.DEGREES_TO_RADIANS),l=Math.sin(i*t.DEGREES_TO_RADIANS),h=Math.sin(r*t.DEGREES_TO_RADIANS);return n[0]=o*h,n[1]=l,n[2]=o*a,n.normalize()},p.prototype.surfaceNormalAtPoint=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","surfaceNormalAtPoint","missingResult"));if(this.projection.surfaceNormalAtPoint)return this.projection.surfaceNormalAtPoint(this,t,i,r,n);if(this.is2D())return n[0]=0,n[1]=0,n[2]=1,n;var o=this.equatorialRadius*this.equatorialRadius,a=this.polarRadius*this.polarRadius;return n[0]=t/o,n[1]=i/a,n[2]=r/o,n.normalize()},p.prototype.northTangentAtLocation=function(t,i,r){if(!r)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","northTangentAtLocation","missingResult"));return this.projection.northTangentAtLocation(this,t,i,r)},p.prototype.northTangentAtPoint=function(t,i,r,n){if(!n)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","northTangentAtPoint","missingResult"));return this.projection.northTangentAtPoint(this,t,i,r,this.offsetVector,n)},p.prototype.intersectsFrustum=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectsFrustum","missingFrustum"));if(this.is2D()){var r=new i;return r.setToSector(h.FULL_SPHERE,this,this.elevationModel.minElevation,this.elevationModel.maxElevation),r.intersectsFrustum(t)}return!(t.far.distance<=this.equatorialRadius)&&(!(t.left.distance<=this.equatorialRadius)&&(!(t.right.distance<=this.equatorialRadius)&&(!(t.top.distance<=this.equatorialRadius)&&(!(t.bottom.distance<=this.equatorialRadius)&&!(t.near.distance<=this.equatorialRadius)))))},p.prototype.intersectsLine=function(t,i){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectWithRay","missingLine"));if(!i)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","intersectsLine","missingResult"));var r,n=t.direction[0],o=t.direction[1],a=t.direction[2],l=t.origin[0],h=t.origin[1],u=t.origin[2];if(this.is2D())return(0!=a||0==u)&&(r=-u/a,!(r<0)&&(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0));var c,d,p,f,g=this.equatorialRadius,m=g*g,y=g/this.polarRadius,E=y*y;return c=n*n+E*o*o+a*a,d=2*(l*n+E*h*o+u*a),p=l*l+E*h*h+u*u-m,f=d*d-4*c*p,!(f<0)&&(r=(-d-Math.sqrt(f))/(2*c),r>0?(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0):(r=(-d+Math.sqrt(f))/(2*c),r>0&&(i[0]=l+n*r,i[1]=h+o*r,i[2]=u+a*r,!0)))},p.prototype.elevationTimestamp=function(){return this.elevationModel.timestamp},p.prototype.minElevation=function(){return this.elevationModel.minElevation},p.prototype.maxElevation=function(){return this.elevationModel.maxElevation},p.prototype.minAndMaxElevationsForSector=function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","minAndMaxElevationsForSector","missingSector"));return this.elevationModel.minAndMaxElevationsForSector(t)},p.prototype.elevationAtLocation=function(t,e){return this.elevationModel.elevationAtLocation(t,e)},p.prototype.elevationsForGrid=function(t,i,r,n,o){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","elevationsForSector","missingSector"));if(i<=0||r<=0)throw new e(s.logMessage(s.LEVEL_SEVERE,"Globe","elevationsForSector","numLat or numLon is less than 1"));if(!o||o.length=i)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","constructor","Specified cache low-water value is undefined, negative or not less than the capacity."));this.entries=new n(i,o),this.cacheKeyPool=0,this.currentRetrievals={},this.absentResourceList=new t(3,6e4)};return Object.defineProperties(s.prototype,{capacity:{get:function(){return this.entries.capacity}},lowWater:{get:function(){return this.entries.lowWater}},usedCapacity:{get:function(){return this.entries.usedCapacity}},freeCapacity:{get:function(){return this.entries.freeCapacity}}}),s.prototype.generateCacheKey=function(){return"GpuResourceCache "+ ++this.cacheKeyPool},s.prototype.putResource=function(t,n,o){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","missingKey."));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","missingResource."));if(!o||o<1)throw new e(r.logMessage(r.LEVEL_SEVERE,"GpuResourceCache","putResource","The specified resource size is undefined or less than 1."));var s={resource:n};this.entries.putEntry(t instanceof i?t.key:t,s,o)},s.prototype.resourceForKey=function(t){var e=t instanceof i?this.entries.entryForKey(t.key):this.entries.entryForKey(t),r=e?e.resource:null;return null!==r&&"function"==typeof r.clearTexParameters&&r.clearTexParameters(),r},s.prototype.setResourceAgingFactor=function(t,e){this.entries.setEntryAgingFactor(t,e)},s.prototype.containsResource=function(t){return this.entries.containsKey(t instanceof i?t.key:t)},s.prototype.removeResource=function(t){this.entries.removeEntry(t instanceof i?t.key:t)},s.prototype.clear=function(){this.entries.clear(!1)},s.prototype.retrieveTexture=function(t,e,n){if(!e)return null;if(e instanceof i){var s=new o(t,e.image,n);return this.putResource(e.key,s,s.size),s}if(this.currentRetrievals[e]||this.absentResourceList.isResourceAbsent(e))return null;var a=this,l=new Image;return l.onload=function(){r.log(r.LEVEL_INFO,"Image retrieval succeeded: "+e);var i=new o(t,l,n);a.putResource(e,i,i.size),delete a.currentRetrievals[e],a.absentResourceList.unmarkResourceAbsent(e);var s=document.createEvent("Event");s.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(s)},l.onerror=function(){delete a.currentRetrievals[e],a.absentResourceList.markResourceAbsent(e),r.log(r.LEVEL_WARNING,"Image retrieval failed: "+e)},this.currentRetrievals[e]=e,l.crossOrigin="anonymous",l.src=e,null},s}),i("pick/PickedObjectList",[],function(){"use strict";var t=function(){this.objects=[]};return t.prototype.hasNonTerrainObjects=function(){return this.objects.length>1||1===this.objects.length&&null==this.terrainObject()},t.prototype.terrainObject=function(){for(var t=0,e=this.objects.length;t1)for(var e=0;e0?this.objects[0]:null},t}),i("render/ScreenCreditController",["../error/ArgumentError","../util/Color","../util/Font","../layer/Layer","../util/Logger","../util/Offset","../shapes/ScreenText"],function(t,e,i,r,n,o,s){"use strict";var a=function(){r.call(this,"ScreenCreditController"),this.creditPlacement=new o(WorldWind.OFFSET_PIXELS,11,WorldWind.OFFSET_PIXELS,2),this.creditMargin=11,this.opacity=.5,this.credits=[]};return a.prototype=Object.create(r.prototype),a.prototype.clear=function(){this.credits=[]},a.prototype.addCredit=function(e,r,a){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenCreditController","addCredit","missingText"));if(!r)throw new t(n.logMessage(n.LEVEL_SEVERE,"ScreenCreditController","addCredit","missingColor"));for(var l=0,h=this.credits.length;l=i&&(s+=r);var a=e.get(o);a.index=s,n.set(s,a)}return n},t}),i("util/PolygonSplitter",["./HashMap","../geom/Location","../geom/Position","./WWMath"],function(t,e,i,r){"use strict";var n={addedIndex:-1,poleIndexOffset:-1,splitContours:function(t,e){for(var i=!1,r=0,n=t.length;r1&&(i=!0),e.push(o)}return i},splitContour:function(i){var r=new t,n=[],o=[],s=[],a=[],l=-1,h=this.findIntersectionAndPole(i,n,o,r);return 0===o.length?(s.push(n),a.push(r),this.formatContourOutput(s,h,l,a)):(o.length>2&&o.sort(function(t,e){return e.latitude-t.latitude}),h!==e.poles.NONE&&(n=this.handleOnePole(n,o,r,h),r=this.reindexIntersections(o,r,this.poleIndexOffset)),0===o.length?(s.push(n),a.push(r),l=0,this.formatContourOutput(s,h,l,a)):(this.linkIntersections(o,r),l=this.makePolygons(n,o,r,s,a),this.formatContourOutput(s,h,l,a)))},findIntersectionAndPole:function(t,i,n,o){var s=!1,a=90,l=-90;this.addedIndex=-1;for(var h=0,u=t.length;h0?e.poles.NORTH:i<0?e.poles.SOUTH:Math.abs(i)>=Math.abs(t)?e.poles.NORTH:e.poles.SOUTH},handleOnePole:function(t,i,r,n){var o;if(n===e.poles.NORTH)var s=i.shift(),a=90;else n===e.poles.SOUTH&&(s=i.pop(),a=-90);var l=r.get(s.indexEnd),h=r.get(s.indexStart);l.forPole=!0,h.forPole=!0,this.poleIndexOffset=s.indexStart,o=t.slice(0,s.indexEnd+1);var u=this.createPoint(a,t[l.index].longitude,t[l.index].altitude),c=this.createPoint(a,t[h.index].longitude,t[h.index].altitude);return o.push(u,c),o=o.concat(t.slice(this.poleIndexOffset))},linkIntersections:function(t,e){for(var i=0;i=r&&(e[n].indexEnd+=2),e[n].indexStart>=r&&(e[n].indexStart+=2);return i},makePolygons:function(e,i,r,n,o){for(var s=-1,a=0;aDate.now()},m.prototype.createShapeDataObject=function(){return{}},m.prototype.resetExpiration=function(t){t.expiryTime=Date.now()+this.expirationInterval+1e3*Math.random()},m.prototype.establishCurrentData=function(t){this.currentData=this.shapeDataCache.entryForKey(t.globeStateKey),this.currentData||(this.currentData=this.createShapeDataObject(),this.resetExpiration(this.currentData),this.shapeDataCache.putEntry(t.globeStateKey,this.currentData,1)),this.currentData.isExpired=!this.isShapeDataCurrent(t,this.currentData)},m.prototype.render=function(t){this.enabled&&(this.layer=t.currentLayer,this.prepareBoundaries(t),this.establishCurrentData(t),!this.currentData.isExpired&&this.currentData.extent||(this.computeExtent(t),this.currentData.verticalExaggeration=t.verticalExaggeration,this.resetExpiration(this.currentData)),this.currentData&&this.currentData.extent&&!this.intersectsFrustum(t)||t.surfaceShapeTileBuilder.insertSurfaceShape(this))},m.prototype.interpolateLocations=function(t){var e,i,r,n=t[0],o=n,s=!0,a=!0,l=0,h=!0;for(this._locations=[n],i=1,r=t.length;i2&&(h=!1)),h&&this.interpolateEdge(e,o,this._locations),this._locations.push(o),e=o;this._isInteriorInhibited||e.latitude==n.latitude&&e.longitude==n.longitude||(this.interpolateEdge(e,n,this._locations),this._locations.push(n))},m.prototype.interpolateEdge=function(t,e,i){var r,n,s=o.greatCircleDistance(t,e),a=Math.round(this._maximumNumEdgeIntervals*s/Math.PI);if(a>0){r=1/a,n=t;for(var l=this.throttledStep(r,n);l<1;l+=this.throttledStep(r,n))n=new o(0,0),o.interpolateAlongPath(this._pathType,l,t,e,n),180===t.longitude&&180===e.longitude?n.longitude=180:t.longitude===-180&&e.longitude===-180&&(n.longitude=-180),i.push(n)}},m.prototype.throttledStep=function(t,i){var r=Math.cos(i.latitude*e.DEGREES_TO_RADIANS);r*=r;var n=this._polarThrottle/(1+this._polarThrottle);return t*(1-n+n*r)},m.prototype.prepareBoundaries=function(t){if(!this.boundariesArePrepared){this.computeBoundaries(t);var e=this.formatBoundaries();this.normalizeAngles(e),e=this.interpolateBoundaries(e);var i=[],r=u.splitContours(e,i);this.contours=i,this.crossesAntiMeridian=r,this.prepareGeometry(t,i),this.prepareSectors(),this.boundariesArePrepared=!0}},m.prototype.formatBoundaries=function(){var t=[];return this._boundaries.length?(null!=this._boundaries[0].latitude?t.push(this._boundaries):t=this._boundaries,t):t},m.prototype.resetBoundaries=function(){this.boundariesArePrepared=!1,this.shapeDataCache.clear(!1)},m.prototype.normalizeAngles=function(t){for(var i=0,r=t.length;i180)&&(a.longitude=e.normalizedDegreesLongitude(a.longitude)),(a.latitude<-90||a.latitude>90)&&(a.latitude=e.normalizedDegreesLatitude(a.latitude))}},m.prototype.interpolateBoundaries=function(t){for(var e=[],i=0,r=t.length;i0?this._boundingSectors:(this.prepareBoundaries(t),this._boundingSectors)},m.prototype.computeExtent=function(t){if(!this._boundingSectors||0===this._boundingSectors.length)return null;if(!this.currentData)return null;this.currentData.extent||(this.currentData.extent=new r);var e;if(1===this._boundingSectors.length)e=this._boundingSectors[0].computeBoundingPoints(t.globe,t.verticalExaggeration),this.currentData.extent.setToVec3Points(e);else{for(var i=[],n=0;n90?(E=180-E,v+=180):E<-90&&(E=-180-E,v+=180),v<-180?v+=360:v>180&&(v-=360),E>m&&(m=E),E90)for(var u=m-90,c=0,d=n.length;c0?(e.union(a),t.union(a)):a.minLongitude<0?e.union(a):t.union(a)}var l=Math.min(t.minLatitude,e.minLatitude),h=Math.max(t.maxLatitude,t.maxLatitude);this._boundingSector=new d(l,h,-180,180),this._boundingSectors=[t,e]},m.prototype.sectorsNotOverAntiMeridian=function(){this._boundingSector=new d(90,-90,180,-180);for(var t=0,e=this.contours.length;t1?h===l?this.outlineForPole(c,d,r):this.outlineForSplit(c,d,r):a.pole!==o.poles.NONE&&1===u?this.outlineForPole(c,d,r):a.pole===o.poles.NONE&&u>1?this.outlineForSplit(c,d,r):a.pole===o.poles.NONE&&1===u&&r.push(c)}this._interiorGeometry=i,this._outlineGeometry=r},m.prototype.outlineForPole=function(t,e,i){this.containsPole=!0;for(var r=[],n=0,o=0,s=t.length;o0;if(l||u){if(t.pickingMode)this.pickColor||(this.pickColor=t.uniquePickColor()),e.fillStyle=this.pickColor.toCssColorString(),e.strokeStyle=e.fillStyle,e.lineWidth=a.outlineWidth;else{var c=a.interiorColor,d=a.outlineColor;e.fillStyle=new n(c.red,c.green,c.blue,c.alpha*this.layer.opacity).toCssColorString(),e.strokeStyle=new n(d.red,d.green,d.blue,d.alpha*this.layer.opacity).toCssColorString(),e.lineWidth=a.outlineWidth}if(this.crossesAntiMeridian||this.containsPole?(l&&(this.draw(this._interiorGeometry,e,i,r,o,s),e.fill()),u&&(this.draw(this._outlineGeometry,e,i,r,o,s),e.stroke())):(this.draw(this._interiorGeometry,e,i,r,o,s),l&&e.fill(),u&&e.stroke()),t.pickingMode){var p=new h(this.pickColor.clone(),this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(p)}}}},m.prototype.draw=function(t,e,i,r,n,o){e.beginPath();for(var s=0,a=t.length;s0},a.prototype.getShapes=function(){return this.surfaceShapes},a.prototype.setShapes=function(t){this.surfaceShapes=t},a.prototype.getSector=function(){return this.sector},a.prototype.addSurfaceShape=function(t){this.surfaceShapes.push(t),this.surfaceShapeStateKeys.push(t.stateKey+" lo "+t.layer.opacity)},a.prototype.needsUpdate=function(t){var e,i;if(this.surfaceShapes.length!=this.asRenderedSurfaceShapeStateKeys.length)return!0;for(e=0,i=this.surfaceShapes.length;e0?h:1,d=u>0?u:1,p=a/d,f=s/c,g=-(l.minLongitude-o.minLongitude)/d,m=-(l.minLatitude-o.minLatitude)/c;this.texMaskMatrix.set(p,0,0,g,0,f,0,m,0,0,1,0,0,0,0,1),this.texSamplerMatrix.setToUnitYFlip(),i.applyInternalTransform(t,this.texSamplerMatrix),this.texSamplerMatrix.multiplyMatrix(this.texMaskMatrix),n.loadTexSamplerMatrix(r,this.texSamplerMatrix),n.loadTexMaskMatrix(r,this.texMaskMatrix)},o}),i("render/TextRenderer",["../error/ArgumentError","../shaders/BasicTextureProgram","../util/Color","../util/Font","../util/Logger","../geom/Matrix","../render/Texture","../geom/Vec2"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"TextRenderer","constructor","missingDc"));this.canvas2D=document.createElement("canvas"),this.ctx2D=this.canvas2D.getContext("2d"),this.dc=e,this.enableOutline=!0,this.lineSpacing=.15,this.outlineColor=new i(0,0,0,.5),this.outlineWidth=4,this.textColor=new i(1,1,1,1),this.typeFace=new r(14)};return l.prototype.textSize=function(t){if(0===t.length)return new a(0,0);this.ctx2D.font=this.typeFace.fontString;for(var e=t.split("\n"),i=e.length*(this.typeFace.size*(1+this.lineSpacing)),r=0,n=0;n0){var e=this.drawText(t);return new s(this.dc.currentGlContext,e)}return null},l.prototype.drawText=function(t){var e=this.ctx2D,i=this.canvas2D,r=this.textSize(t),n=t.split("\n"),o=this.enableOutline?this.outlineWidth/2:0,s=this.dc.pixelScale;i.width=Math.ceil(r[0])*s,i.height=Math.ceil(r[1])*s,e.scale(s,s),e.font=this.typeFace.fontString,e.textBaseline="bottom",e.textAlign=this.typeFace.horizontalAlignment,e.fillStyle=this.textColor.toCssColorString(),e.strokeStyle=this.outlineColor.toCssColorString(),e.lineWidth=this.outlineWidth,e.lineCap="round",e.lineJoin="round","left"===this.typeFace.horizontalAlignment?e.translate(o,0):"right"===this.typeFace.horizontalAlignment?e.translate(r[0]-o,0):e.translate(r[0]/2,0);for(var a=0;a0&&(a=a.substring(0,a.length-1)),a+="..."),a},l.prototype.wrapLine=function(t,e){var i="",r=t.trim(),n=this.textSize(r);if(n[0]>e){for(var o="",s=0,a=r.indexOf(" ",s+1);s0?this.surfaceRenderables[this.surfaceRenderables.length-1]:null},R.prototype.popSurfaceRenderable=function(){return this.surfaceRenderables.length>0?this.surfaceRenderables.pop():null},R.prototype.reverseSurfaceRenderables=function(){this.surfaceRenderables.reverse()},R.prototype.addOrderedRenderable=function(t,e){if(t){var i={orderedRenderable:t,insertionOrder:this.orderedRenderablesCounter++,eyeDistance:e||t.eyeDistance,globeStateKey:this.globeStateKey};this.globe.continuous&&(i.globeOffset=this.globe.offset),0===i.eyeDistance?this.screenRenderables.push(i):this.orderedRenderables.push(i)}},R.prototype.addOrderedRenderableToBack=function(t){if(t){var e={orderedRenderable:t,insertionOrder:this.orderedRenderablesCounter++,eyeDistance:Number.MAX_VALUE,globeStateKey:this.globeStateKey};this.globe.continuous&&(e.globeOffset=this.globe.offset),this.orderedRenderables.push(e)}},R.prototype.peekOrderedRenderable=function(){return this.orderedRenderables.length>0?this.orderedRenderables[this.orderedRenderables.length-1].orderedRenderable:null},R.prototype.popOrderedRenderable=function(){if(this.orderedRenderables.length>0){var t=this.orderedRenderables.pop();return this.globeStateKey=t.globeStateKey,this.globe.continuous&&(this.globe.offset=t.globeOffset),t.orderedRenderable}return null},R.prototype.nextScreenRenderable=function(){if(this.screenRenderables.length>0){var t=this.screenRenderables.shift();return this.globeStateKey=t.globeStateKey,this.globe.continuous&&(this.globe.offset=t.globeOffset),t.orderedRenderable}return null},R.prototype.sortOrderedRenderables=function(){this.orderedRenderables.sort(function(t,e){var i=t.eyeDistance,r=e.eyeDistance;if(ir)return 1;var n=t.insertionOrder,o=e.insertionOrder;return n>o?-1:nN.x+N.width||k>N.y+N.height)return!1;O.x=T.clamp(I,N.x,N.x+N.width),O.y=T.clamp(k,N.y,N.y+N.height),O.width=T.clamp(D,N.x,N.x+N.width)-O.x,O.height=T.clamp(V,N.y,N.y+N.height)-O.y,this.pickRectangle=O;var F=d.fromIdentity();return F.invertMatrix(this.modelviewProjection),P[0]=O.x,P[1]=O.y,P[2]=0,F.unProject(P,N,t=new L(0,0,0)),P[0]=O.x,P[1]=O.y,P[2]=1,F.unProject(P,N,e=new L(0,0,0)),P[0]=O.x+O.width,P[1]=O.y,P[2]=0,F.unProject(P,N,i=new L(0,0,0)),P[0]=O.x+O.width,P[1]=O.y,P[2]=1,F.unProject(P,N,r=new L(0,0,0)),P[0]=O.x,P[1]=O.y+O.height,P[2]=0,F.unProject(P,N,n=new L(0,0,0)),P[0]=O.x,P[1]=O.y+O.height,P[2]=1,F.unProject(P,N,s=new L(0,0,0)),P[0]=O.x+O.width,P[1]=O.y+O.height,P[2]=0,F.unProject(P,N,a=new L(0,0,0)),P[0]=O.x+O.width,P[1]=O.y+O.height,P[2]=1,F.unProject(P,N,l=new L(0,0,0)),x=new L(s[0]-t[0],s[1]-t[1],s[2]-t[2]),C.set(n[0]-e[0],n[1]-e[1],n[2]-e[2]),h=x.cross(C),E=new f(h[0],h[1],h[2],-h.dot(t)),E.normalize(),x=new L(a[0]-r[0],a[1]-r[1],a[2]-r[2]),C.set(l[0]-i[0],l[1]-i[1],l[2]-i[2]),u=x.cross(C),v=new f(u[0],u[1],u[2],-u.dot(i)),v.normalize(),x=new L(s[0]-a[0],s[1]-a[1],s[2]-a[2]),C.set(l[0]-n[0],l[1]-n[1],l[2]-n[2]),c=x.cross(C),_=new f(c[0],c[1],c[2],-c.dot(n)),_.normalize(),x=new L(r[0]-t[0],r[1]-t[1],r[2]-t[2]),C.set(e[0]-i[0],e[1]-i[1],e[2]-i[2]),p=x.cross(C),b=new f(p[0],p[1],p[2],-p.dot(i)),b.normalize(),x=new L(n[0]-i[0],n[1]-i[1],n[2]-i[2]),C.set(a[0]-t[0],a[1]-t[1],a[2]-t[2]),g=x.cross(C),w=new f(g[0],g[1],g[2],-g.dot(t)),w.normalize(),x=new L(l[0]-e[0],l[1]-e[1],l[2]-e[2]),C.set(s[0]-r[0],s[1]-r[1],s[2]-r[2]),y=x.cross(C),R=new f(y[0],y[1],y[2],-y.dot(e)),R.normalize(),this.pickFrustum=new o(E,v,b,_,w,R),!0},R.prototype.isSmall=function(t,e){if(!t)return!1;var i=this.eyePoint.distanceTo(t.center),r=this.pixelSizeAtDistance(i);return 2*t.radius1)&&(a=.5*a+.5,l=.5*l+.5,h=.5*h+.5,a=a*this.viewport.width+this.viewport.x,l=l*this.viewport.height+this.viewport.y,i[0]=a,i[1]=l,i[2]=h,!0))},R.prototype.projectWithDepth=function(e,i,r){if(!e)throw new t(c.logMessage(c.LEVEL_SEVERE,"DrawContext","projectWithDepth","missingPoint"));if(!r)throw new t(c.logMessage(c.LEVEL_SEVERE,"DrawContext","projectWithDepth","missingResult"));var n=e[0],o=e[1],s=e[2],a=this.modelview,l=a[0]*n+a[1]*o+a[2]*s+a[3],h=a[4]*n+a[5]*o+a[6]*s+a[7],u=a[8]*n+a[9]*o+a[10]*s+a[11],d=a[12]*n+a[13]*o+a[14]*s+a[15],p=this.projection,f=p[0]*l+p[1]*h+p[2]*u+p[3]*d,g=p[4]*l+p[5]*h+p[6]*u+p[7]*d,m=p[8]*l+p[9]*h+p[10]*u+p[11]*d,y=p[12]*l+p[13]*h+p[14]*u+p[15]*d;return 0!==y&&(f/=y,g/=y,m/=y,!(m<-1||m>1)&&(m=p[8]*l+p[9]*h+p[10]*u*(1+i)+p[11]*d,m/=y,m=T.clamp(m,-1,1),f=.5*f+.5,g=.5*g+.5,m=.5*m+.5,f=f*this.viewport.width+this.viewport.x,g=g*this.viewport.height+this.viewport.y,r[0]=f,r[1]=g,r[2]=m,!0))},R.prototype.convertPointToViewport=function(e,i){if(!e)throw new t(c.logMessage(c.LEVEL_SEVERE,"DrawContext","convertPointToViewport","missingPoint"));if(!i)throw new t(c.logMessage(c.LEVEL_SEVERE,"DrawContext","convertPointToViewport","missingResult"));return i[0]=e[0],i[1]=this.viewport.height-e[1],i},R.prototype.pixelSizeAtDistance=function(t){return this.pixelSizeFactor*t+this.pixelSizeOffset},R.prototype.createTextTexture=function(t,e){if(!t||!e)return null;var i=this.computeTextTextureStateKey(t,e),r=this.gpuResourceCache.resourceForKey(i);return r||(this.textRenderer.textColor=e.color,this.textRenderer.typeFace=e.font,this.textRenderer.enableOutline=e.enableOutline,this.textRenderer.outlineColor=e.outlineColor,this.textRenderer.outlineWidth=e.outlineWidth,r=this.textRenderer.renderText(t),this.gpuResourceCache.putResource(i,r,r.size),this.gpuResourceCache.setResourceAgingFactor(i,100)),r},R.prototype.computeTextTextureStateKey=function(t,e){return t&&e?t+"c "+e.color.toHexString(!0)+" f "+e.font.toString()+" eo "+e.enableOutline+" ow "+e.outlineWidth+" oc "+e.outlineColor.toHexString(!0):null},R.prototype.getExtension=function(e){if(!e)throw new t(c.logMessage(c.LEVEL_SEVERE,"DrawContext","getExtension","missingExtensionName"));return e in this.glExtensionsCache||(this.glExtensionsCache[e]=this.currentGlContext.getExtension(e)||null),this.glExtensionsCache[e]},R}),i("globe/GebcoElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:e.FULL_SPHERE,resolution:.008333333333333,retrievalImageFormat:"application/bil16",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/elev","GEBCO","","1.3.0")}),this.displayName="GEBCO Earth Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("globe/UsgsNedElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:new e(24.396308,49.384358,-124.848974,-66.885444),resolution:92592592593e-15,retrievalImageFormat:"application/bil16",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/elev","USGS-NED","","1.3.0")}),this.displayName="USGS NED Earth Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("globe/UsgsNedHiElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WmsUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:new e(18.86546,28.517269,-178.443593,-154.755792),resolution:92592592593e-15,retrievalImageFormat:"application/bil16",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/elev","USGS-NED","","1.3.0")}),this.displayName="USGS NED Hawaii Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("globe/EarthElevationModel",["../globe/AsterV2ElevationCoverage","../globe/ElevationModel","../globe/GebcoElevationCoverage","../globe/UsgsNedElevationCoverage","../globe/UsgsNedHiElevationCoverage"],function(t,e,i,r,n){"use strict";var o=function(){e.call(this),this.addCoverage(new i),this.addCoverage(new t),this.addCoverage(new r),this.addCoverage(new n)};return o.prototype=Object.create(e.prototype),o}),i("globe/EarthRestElevationCoverage",["../util/LevelSet","../geom/Location","../geom/Sector","../util/LevelRowColumnUrlBuilder","../globe/TiledElevationCoverage"],function(t,e,i,r,n){"use strict";var o=function(o,s,a){n.call(this,{coverageSector:i.FULL_SPHERE,resolution:.00732421875,retrievalImageFormat:"application/bil16",minElevation:-11e3,maxElevation:8850,urlBuilder:new r(o,s)}),this.displayName=a||"Earth Elevations",this.levels=new t(i.FULL_SPHERE,new e(60,60),5,512,512)};return o.prototype=Object.create(n.prototype),o}),i("layer/FrameStatisticsLayer",["../error/ArgumentError","../util/Color","../util/Font","../layer/Layer","../util/Logger","../util/Offset","../shapes/ScreenText","../shapes/TextAttributes"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(l){function h(t,e){c.handleRedraw(t,e)}if(!l)throw new t(n.logMessage(n.LEVEL_SEVERE,"FrameStatisticsLayer","constructor","missingWorldWindow"));r.call(this,"Frame Statistics"),this.pickEnabled=!1;var u=new a(null);u.color=e.GREEN,u.font=new i(12),u.offset=new o(WorldWind.OFFSET_FRACTION,0,WorldWind.OFFSET_FRACTION,1),this.frameTime=new s(new o(WorldWind.OFFSET_PIXELS,5,WorldWind.OFFSET_INSET_PIXELS,5)," "),this.frameTime.attributes=u,this.frameRate=new s(new o(WorldWind.OFFSET_PIXELS,5,WorldWind.OFFSET_INSET_PIXELS,25)," "),this.frameRate.attributes=u;var c=this;l.redrawCallbacks.push(h)};return l.prototype=Object.create(r.prototype),l.prototype.doRender=function(t){this.frameRate.render(t),this.frameTime.render(t),this.inCurrentFrame=!0},l.prototype.handleRedraw=function(t,e){if(e===WorldWind.BEFORE_REDRAW){var i=t.frameStatistics;this.frameTime.text="Frame time "+i.frameTimeAverage.toFixed(0)+" ms ("+i.frameTimeMin.toFixed(0)+" - "+i.frameTimeMax.toFixed(0)+")",this.frameRate.text="Frame rate "+i.frameRateAverage.toFixed(0)+" fps"}},l}),i("shapes/AbstractShape",["../error/ArgumentError","../util/Logger","../geom/Matrix","../cache/MemoryCache","../render/Renderable","../shapes/ShapeAttributes","../error/UnsupportedOperationError","../geom/Vec3"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(t){n.call(this),this._attributes=t?t:new o(null),this._highlightAttributes=null,this.highlighted=!1,this._altitudeMode=WorldWind.ABSOLUTE,this.referencePosition=null,this.shapeDataCache=new r(3,2),this.currentData=null,this.activeAttributes=null,this.expirationInterval=2e3,this.useSurfaceShapeFor2D=!1, this.scratchMatrix=i.fromIdentity()};return l.prototype=Object.create(n.prototype),Object.defineProperties(l.prototype,{attributes:{get:function(){return this._attributes},set:function(t){this._attributes=t,this.surfaceShape&&(this.surfaceShape.attributes=this._attributes)}},highlightAttributes:{get:function(){return this._highlightAttributes},set:function(t){this._highlightAttributes=t,this.surfaceShape&&(this.surfaceShape.highlightAttributes=this._highlightAttributes)}},altitudeMode:{get:function(){return this._altitudeMode},set:function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"AbstractShape","altitudeMode","missingAltitudeMode"));this._altitudeMode=i,this.reset()}}}),l.prototype.reset=function(){this.shapeDataCache.clear(!1),this.surfaceShape=null},l.prototype.updateSurfaceShape=function(){this.surfaceShape.displayName=this.displayName,this.surfaceShape.highlighted=this.highlighted,this.surfaceShape.enabled=this.enabled,this.surfaceShape.pathType=this.pathType,this.surfaceShape.pickDelegate=this.pickDelegate?this.pickDelegate:this},l.prototype.createSurfaceShape=function(){return null},l.prototype.render=function(t){if(this.enabled&&t.accumulateOrderedRenderables){if(t.globe.is2D()&&this.useSurfaceShapeFor2D&&(this.surfaceShape||(this.surfaceShape=this.createSurfaceShape(),this.surfaceShape&&(this.surfaceShape.attributes=this._attributes,this.surfaceShape.highlightAttributes=this._highlightAttributes)),this.surfaceShape))return this.updateSurfaceShape(),void this.surfaceShape.render(t);if((t.terrain||this.altitudeMode==WorldWind.ABSOLUTE)&&(this.establishCurrentData(t),(!t.globe.projectionLimits||this.isWithinProjectionLimits(t))&&(!this.currentData.extent||this.intersectsFrustum(t))&&(this.determineActiveAttributes(t),this.activeAttributes))){var e=this.makeOrderedRenderable(t);if(e){if(!this.intersectsFrustum(t))return;if(t.isSmall(this.currentData.extent,1))return;e.layer=t.currentLayer,t.addOrderedRenderable(e,this.currentData.eyeDistance)}}}},l.prototype.renderOrdered=function(t){this.currentData=this.shapeDataCache.entryForKey(t.globeStateKey),this.beginDrawing(t);try{this.doRenderOrdered(t)}finally{this.endDrawing(t)}},l.prototype.makeOrderedRenderable=function(t){var e=this.doMakeOrderedRenderable(t);return this.currentData.verticalExaggeration=t.verticalExaggeration,e},l.prototype.doMakeOrderedRenderable=function(t){throw new s(e.logMessage(e.LEVEL_SEVERE,"AbstractShape","makeOrderedRenderable","abstractInvocation"))},l.prototype.doRenderOrdered=function(t){throw new s(e.logMessage(e.LEVEL_SEVERE,"AbstractShape","doRenderOrdered","abstractInvocation"))},l.prototype.beginDrawing=function(t){},l.prototype.endDrawing=function(t){},l.prototype.intersectsFrustum=function(t){return!this.currentData||!this.currentData.extent||(t.pickingMode?this.currentData.extent.intersectsFrustum(t.pickFrustum):this.currentData.extent.intersectsFrustum(t.frustumInModelCoordinates))},l.prototype.establishCurrentData=function(t){this.currentData=this.shapeDataCache.entryForKey(t.globeStateKey),this.currentData||(this.currentData=this.createShapeDataObject(),this.resetExpiration(this.currentData),this.shapeDataCache.putEntry(t.globeStateKey,this.currentData,1)),this.currentData.isExpired=!this.isShapeDataCurrent(t,this.currentData)},l.prototype.createShapeDataObject=function(){return{transformationMatrix:i.fromIdentity(),referencePoint:new a(0,0,0)}},l.prototype.resetExpiration=function(t){t.expiryTime=Date.now()+this.expirationInterval+1e3*Math.random()},l.prototype.isShapeDataCurrent=function(t,e){return e.verticalExaggeration===t.verticalExaggeration&&e.expiryTime>Date.now()},l.prototype.determineActiveAttributes=function(t){this.highlighted&&this._highlightAttributes?this.activeAttributes=this.highlightAttributes:this.activeAttributes=this._attributes},l.prototype.isWithinProjectionLimits=function(t){return!0},l.prototype.applyMvpMatrix=function(t){this.scratchMatrix.copy(t.modelviewProjection),this.scratchMatrix.multiplyMatrix(this.currentData.transformationMatrix),t.currentProgram.loadModelviewProjection(t.currentGlContext,this.scratchMatrix)},l.prototype.applyMvpMatrixForOutline=function(t){this.scratchMatrix.copy(t.projection),this.scratchMatrix.offsetProjectionDepth(-.001),this.scratchMatrix.multiplyMatrix(t.modelview),this.scratchMatrix.multiplyMatrix(this.currentData.transformationMatrix),t.currentProgram.loadModelviewProjection(t.currentGlContext,this.scratchMatrix)},l}),i("shapes/AbstractMesh",["../shapes/AbstractShape","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../util/ImageSource","../geom/Line","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../geom/Vec2","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g){"use strict";var m=function(e){t.call(this,e),this.pickTransparentImagePixels=!0,this._altitudeScale=1};return m.prototype=Object.create(t.prototype),Object.defineProperties(m.prototype,{altitudeScale:{get:function(){return this._altitudeScale},set:function(t){this._altitudeScale=t,this.reset()}}}),m.prototype.mustGenerateGeometry=function(t){return!this.currentData.meshPoints||(this.currentData.drawInterior!==this.activeAttributes.drawInterior||(!(!this.activeAttributes.applyLighting||this.currentData.normals)||this.altitudeMode!==WorldWind.ABSOLUTE&&this.currentData.isExpired))},m.prototype.doMakeOrderedRenderable=function(t){if(!this.activeAttributes.drawInterior&&!this.activeAttributes.drawOutline)return null;if(!this.mustGenerateGeometry(t))return this;var e=this.currentData,i=e.referencePoint;return t.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude*this._altitudeScale,this._altitudeMode,i),e.transformationMatrix.setToTranslation(i[0],i[1],i[2]),e.meshPoints=this.computeMeshPoints(t,e),e.refreshVertexBuffer=!0,this.activeAttributes.imageSource&&!this.texCoords&&(this.texCoords=this.computeTexCoords(),this.texCoords&&(e.refreshTexCoordBuffer=!0)),this.meshIndices||(this.meshIndices=this.computeMeshIndices(),e.refreshMeshIndices=!0),this.meshOutlineIndices||(this.meshOutlineIndices=this.computeOutlineIndices(),this.meshOutlineIndices&&(e.refreshOutlineIndices=!0)),this.activeAttributes.applyLighting&&this.computeNormals(e),e.drawInterior=this.activeAttributes.drawInterior,this.resetExpiration(e),e.extent||(e.extent=new r),e.extent.setToPoints(e.meshPoints),e.extent.translate(e.referencePoint),this},m.prototype.computeMeshPoints=function(t,e){throw new UnsupportedOperationError(l.logMessage(l.LEVEL_SEVERE,"AbstractMesh","computeMeshPoints","abstractInvocation"))},m.prototype.computeTexCoords=function(){return null},m.prototype.computeMeshIndices=function(t){throw new UnsupportedOperationError(l.logMessage(l.LEVEL_SEVERE,"AbstractMesh","computeMeshIndices","abstractInvocation"))},m.prototype.computeOutlineIndices=function(t){},m.prototype.computeNormals=function(t){for(var e,i=new Float32Array(t.meshPoints.length),r=this.meshIndices,n=t.meshPoints,o=[],s=[new f(0,0,0),new f(0,0,0),new f(0,0,0)],a=0;a=1||t.pickingMode),s.loadColor(o,t.pickingMode?r:i),s.loadOpacity(o,t.pickingMode?1:this.layer.opacity),!l||t.pickingMode&&this.pickTransparentImagePixels||(this.activeTexture=t.gpuResourceCache.resourceForKey(this.activeAttributes.imageSource),this.activeTexture||(this.activeTexture=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.activeAttributes.imageSource)),n=this.activeTexture&&this.activeTexture.bind(t),n&&(a.texCoordsVboCacheKey||(a.texCoordsVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(a.texCoordsVboCacheKey),e||(e=o.createBuffer(),t.gpuResourceCache.putResource(a.texCoordsVboCacheKey,e,4*this.texCoords.length),a.refreshTexCoordBuffer=!0),o.bindBuffer(o.ARRAY_BUFFER,e),a.refreshTexCoordBuffer&&(o.bufferData(o.ARRAY_BUFFER,this.texCoords,o.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),a.refreshTexCoordBuffer=!1),o.enableVertexAttribArray(s.vertexTexCoordLocation),o.vertexAttribPointer(s.vertexTexCoordLocation,2,o.FLOAT,!1,0,0),this.scratchMatrix.setToIdentity(),this.scratchMatrix.multiplyByTextureTransform(this.activeTexture),s.loadTextureEnabled(o,!0),s.loadTextureUnit(o,o.TEXTURE0),s.loadTextureMatrix(o,this.scratchMatrix),s.loadModulateColor(o,t.pickingMode))),h&&(s.loadApplyLighting(o,!0),a.normalsVboCacheKey||(a.normalsVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(a.normalsVboCacheKey),e||(e=o.createBuffer(),t.gpuResourceCache.putResource(a.normalsVboCacheKey,e,4*a.normals.length),a.refreshNormalsBuffer=!0),o.bindBuffer(o.ARRAY_BUFFER,e),a.refreshNormalsBuffer&&(o.bufferData(o.ARRAY_BUFFER,a.normals,o.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),a.refreshNormalsBuffer=!1),o.enableVertexAttribArray(s.normalVectorLocation),o.vertexAttribPointer(s.normalVectorLocation,3,o.FLOAT,!1,0,0)),o.drawElements(o.TRIANGLES,this.meshIndices.length,o.UNSIGNED_SHORT,0),l&&o.disableVertexAttribArray(s.vertexTexCoordLocation),h&&(s.loadApplyLighting(o,!1),o.disableVertexAttribArray(s.normalVectorLocation))}if(this.activeAttributes.drawOutline&&this.meshOutlineIndices&&(s.loadTextureEnabled(o,!1),o.disableVertexAttribArray(s.vertexTexCoordLocation),this.applyMvpMatrixForOutline(t),i=this.activeAttributes.outlineColor,o.depthMask(i.alpha*this.layer.opacity>=1||t.pickingMode),s.loadColor(o,t.pickingMode?r:i),s.loadOpacity(o,t.pickingMode?1:this.layer.opacity),o.lineWidth(this.activeAttributes.outlineWidth),a.outlineIndicesVboCacheKey||(a.outlineIndicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(a.outlineIndicesVboCacheKey),e||(e=o.createBuffer(),t.gpuResourceCache.putResource(a.outlineIndicesVboCacheKey,e,2*this.meshOutlineIndices.length),a.refreshOutlineIndices=!0),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,e),a.refreshOutlineIndices&&(o.bufferData(o.ELEMENT_ARRAY_BUFFER,this.meshOutlineIndices,o.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1),a.refreshOutlineIndices=!1),o.drawElements(o.LINE_STRIP,this.meshOutlineIndices.length,o.UNSIGNED_SHORT,0)),t.pickingMode){var c=this.computePickPosition(t),d=new u(r,this.pickDelegate?this.pickDelegate:this,c,this.layer,!1);t.resolvePick(d)}},m.prototype.computePickPosition=function(t){var e=this.currentData,i=t.pickRay,r=new f(i.origin[0],i.origin[1],i.origin[2]).subtract(e.referencePoint),n=new s(r,i.direction),o=[];if(g.computeIndexedTrianglesIntersection(n,e.meshPoints,this.meshIndices,o)){var a=o[0];if(o.length>1)for(var l=a.distanceToSquared(t.eyePoint),h=1;h0&&this.boundaries[0].length>2?this.boundaries[0][0]:this.boundaries.length>2?this.boundaries[0]:null},n.prototype.moveTo=function(t,e){if(this.boundaries.length>0&&this.boundaries[0].length>2){for(var i=[],r=0,n=this._boundaries.length;r2&&(this.boundaries=this.computeShiftedLocations(t,this.getReferencePosition(),e,this._boundaries))},n}),i("shapes/GeographicMesh",["../shapes/AbstractMesh","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../util/ImageSource","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../shapes/SurfacePolygon","../geom/Vec2","../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f){"use strict";var g=function(i,r){if(!i)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","constructor","missingPositions"));if(i.length<2||i[0].length<2)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","constructor","Number of positions is insufficient."));if(i.length*i[0].length>65536)throw new e(a.logMessage(a.LEVEL_SEVERE,"GeographicMesh","constructor","Too many positions. Must be fewer than 65536. Try using multiple meshes."));for(var n=i[0].length,o=1;o=0;e--)t.push(this._positions[this.numRows-1][e]);for(i=this.numRows-2;i>0;i--)t.push(this._positions[i][0]);return new d(t,null)},g.prototype.computeMeshPoints=function(t,e){for(var i,r,n=Number.MAX_VALUE,o=t.eyePoint,s=new Float32Array(this.numRows*this.numColumns*3),a=new f(0,0,0),l=0,h=0;h=(this.numRows-1)*this.numColumns;i--)t[e++]=i;for(r=this.numRows-2;r>=0;r--)t[e++]=r*this.numColumns;return t},g}),i("shapes/GeographicText",["../error/ArgumentError","../util/Logger","../shapes/Text","../geom/Vec3"],function(t,e,i,r){"use strict";var n=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Text","constructor","missingPosition"));i.call(this,n),this.position=r,this.declutterGroup=1};return n.placePoint=new r(0,0,0),n.prototype=Object.create(i.prototype),n.prototype.clone=function(){var t=new n(this.position,this.text);return t.copy(this),t.pickDelegate=this.pickDelegate?this.pickDelegate:this,t},n.prototype.render=function(t){t.globe.projectionLimits&&!t.globe.projectionLimits.containsLocation(this.position.latitude,this.position.longitude)||i.prototype.render.call(this,t)},n.prototype.computeScreenPointAndEyeDistance=function(t){return t.surfacePointForMode(this.position.latitude,this.position.longitude,this.position.altitude,this.altitudeMode,n.placePoint),!!t.frustumInModelCoordinates.containsPoint(n.placePoint)&&(this.eyeDistance=this.alwaysOnTop?0:t.eyePoint.distanceTo(n.placePoint),!!t.projectWithDepth(n.placePoint,this.depthOffset,this.screenPoint))},n}),i("formats/geojson/GeoJSONConstants",[],function(){"use strict";var t=function(){};return t.FIELD_TYPE="type",t.FIELD_CRS="crs",t.FIELD_NAME="name",t.FIELD_BBOX="bbox",t.FIELD_COORDINATES="coordinates",t.FIELD_GEOMETRIES="geometries",t.FIELD_GEOMETRY="geometry",t.FIELD_PROPERTIES="properties",t.FIELD_FEATURES="features",t.FIELD_ID="id",t.TYPE_POINT="Point",t.TYPE_MULTI_POINT="MultiPoint",t.TYPE_LINE_STRING="LineString",t.TYPE_MULTI_LINE_STRING="MultiLineString",t.TYPE_POLYGON="Polygon",t.TYPE_MULTI_POLYGON="MultiPolygon",t.TYPE_GEOMETRY_COLLECTION="GeometryCollection",t.TYPE_FEATURE="Feature",t.TYPE_FEATURE_COLLECTION="FeatureCollection",t.FIELD_CRS_NAME="name",t.FIELD_CRS_LINK="link",t.WGS84_CRS="urn:ogc:def:crs:OGC:1.3:CRS84",t.EPSG4326_CRS="EPSG:4326",t}),i("formats/geojson/GeoJSONExporter",["../../error/ArgumentError","./GeoJSONConstants","../../util/Logger"],function(t,e,i){"use strict";var r={exportRenderable:function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONExporter","exportRenderable","missingRenderable"));return e instanceof WorldWind.Placemark?this.exportPlacemark(e):e instanceof WorldWind.SurfacePolyline?this.exportSurfacePolyline(e):e instanceof WorldWind.SurfacePolygon?this.exportSurfacePolygon(e):e instanceof WorldWind.SurfaceEllipse?this.exportSurfaceEllipse(e):e instanceof WorldWind.SurfaceCircle?this.exportSurfaceCircle(e):e instanceof WorldWind.SurfaceRectangle?this.exportSurfaceRectangle(e):e instanceof WorldWind.SurfaceSector?this.exportSurfaceSector(e):e instanceof WorldWind.Path?this.exportPath(e):e instanceof WorldWind.Polygon?this.exportPolygon(e):(i.log(i.LEVEL_WARNING,"Export renderable not implemented: "+e),null)},exportRenderables:function(r){if(!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONExporter","exportRenderables","missingRenderables"));if(0!=r.length){if(r.length>1){var n="{";n=n+'"'+e.FIELD_TYPE+'":"'+e.TYPE_GEOMETRY_COLLECTION+'"',n=n+',"'+e.FIELD_GEOMETRIES+'":[';for(var o=0;o0&&r.boundaries[0].length>2)for(var o=0;o=0;o--)n=n+"["+r._boundaries[o].longitude+","+r._boundaries[o].latitude+"]",n+=",",0===o&&(n=n+"["+r._boundaries[r._boundaries.length-1].longitude+","+r._boundaries[r._boundaries.length-1].latitude+"]");return n+="]",n+="]",n+="}"},exportSurfaceRectangle:function(r){if(!(r instanceof WorldWind.SurfaceRectangle))throw new t(i.logMessage(i.LEVEL_SEVERE,"GeoJSONExporter","exportSurfaceRectangle","invalidTypeOfRenderable"));var n="{";n=n+'"'+e.FIELD_TYPE+'":"'+e.TYPE_POLYGON+'",',n=n+'"'+e.FIELD_COORDINATES+'":[',n+="[";for(var o=0;o0&&r.boundaries[0].length>2)for(var o=0;othis.eyeDistanceScalingLabelThreshold&&(this.targetVisibility=0),!t.pickingMode&&this.mustDrawLabel()&&this.currentVisibility!=this.targetVisibility){var s=(t.timestamp-t.previousRedrawTimestamp)/t.fadeTime;this.currentVisibility0&&(n.loadOpacity(r,t.pickingMode?1:this.layer.opacity*this.currentVisibility),d.matrix.copy(t.screenProjection),d.matrix.multiplyMatrix(this.labelTransform),n.loadModelviewProjection(r,d.matrix),!t.pickingMode&&this.labelTexture?(this.texCoordMatrix.setToIdentity(),this.texCoordMatrix.multiplyByTextureTransform(this.labelTexture),n.loadTextureMatrix(r,this.texCoordMatrix),n.loadColor(r,i.WHITE),e=this.labelTexture.bind(t),n.loadTextureEnabled(r,e)):(n.loadTextureEnabled(r,!1),n.loadColor(r,this.pickColor)),this.activeAttributes.labelAttributes.depthTest?o||(o=!0,r.enable(r.DEPTH_TEST)):(o=!1,r.disable(r.DEPTH_TEST)),r.drawArrays(r.TRIANGLE_STRIP,0,4)),o||r.enable(r.DEPTH_TEST)},d.prototype.mustDrawLabel=function(){return this.label&&this.label.length>0&&this.activeAttributes.labelAttributes},d.prototype.mustDrawLeaderLine=function(t){return this.activeAttributes.drawLeaderLine&&this.activeAttributes.leaderLineAttributes&&(!t.pickingMode||this.enableLeaderLinePicking)},d.prototype.getReferencePosition=function(){return this.position},d.prototype.moveTo=function(t,e){this.position=e},d}),i("shapes/Polygon",["../shapes/AbstractShape","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../util/ImageSource","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../shapes/SurfacePolygon","../geom/Vec2","../geom/Vec3","../util/libtess"],function(t,e,i,n,o,s,a,l,h,u,c,d,p,f,g,m){"use strict";var y=function(i,r){if(!i)throw new e(l.logMessage(l.LEVEL_SEVERE,"Polygon","constructor","missingBoundaries"));t.call(this,r),i.length>0&&i[0].latitude&&(i=[i],this._boundariesSpecifiedSimply=!0),this._boundaries=i,this._textureCoordinates=null,this.referencePosition=this.determineReferencePosition(this._boundaries),this._extrude=!1,this.scratchPoint=new g(0,0,0)};return y.prototype=Object.create(t.prototype),Object.defineProperties(y.prototype,{boundaries:{get:function(){return this._boundariesSpecifiedSimply?this._boundaries[0]:this._boundaries},set:function(t){if(!t)throw new e(l.logMessage(l.LEVEL_SEVERE,"Polygon","boundaries","missingBoundaries"));t.length>0&&t[0].latitude&&(t=[t],this._boundariesSpecifiedSimply=!0),this._boundaries=t,this.referencePosition=this.determineReferencePosition(this._boundaries),this.reset()}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(t){this._textureCoordinates=t,this.reset()}},extrude:{get:function(){return this._extrude},set:function(t){this._extrude=t,this.reset()}}}),y.prototype.determineReferencePosition=function(t){return t.length>0&&t[0].length>2?t[0][0]:null},y.prototype.mustGenerateGeometry=function(t){return!this.currentData.boundaryPoints||(this.currentData.drawInterior!==this.activeAttributes.drawInterior||this.altitudeMode!==WorldWind.ABSOLUTE&&this.currentData.isExpired)},y.prototype.hasCapTexture=function(){return this.textureCoordinates&&this.capImageSource()},y.prototype.capImageSource=function(){return this.activeAttributes.imageSource?"string"==typeof this.activeAttributes.imageSource||this.activeAttributes.imageSource instanceof s?this.activeAttributes.imageSource:Array.isArray(this.activeAttributes.imageSource)&&this.activeAttributes.imageSource[0]&&("string"==typeof this.activeAttributes.imageSource[0]||this.activeAttributes.imageSource instanceof s)?this.activeAttributes.imageSource[0]:null:null},y.prototype.hasSideTextures=function(){return this.activeAttributes.imageSource&&Array.isArray(this.activeAttributes.imageSource)&&this.activeAttributes.imageSource.length>1},y.prototype.sideImageSource=function(t){if(0===t||2===this.activeAttributes.imageSource.length)return this.activeAttributes.imageSource[1];var e=this.activeAttributes.imageSource.length-1;return t=Math.min(t+1,e),this.activeAttributes.imageSource[t]},y.prototype.createSurfaceShape=function(){return new p(this.boundaries,null)},y.prototype.doMakeOrderedRenderable=function(t){if(!this.referencePosition)return null;if(!this.activeAttributes.drawInterior&&!this.activeAttributes.drawOutline)return null;if(!this.mustGenerateGeometry(t))return this;var e=this.currentData,i=e.referencePoint;t.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude,this._altitudeMode,i),e.transformationMatrix.setToTranslation(i[0],i[1],i[2]);for(var r=[],o=0;o0&&(o+=i[s]*e[s][n]);r[n]=o}return r}),this.polygonTessellator.gluTessCallback(r.gluEnum.GLU_TESS_ERROR,function(t){s=t,l.logMessage(l.LEVEL_WARNING,"Polygon","tessellatePolygon","Tessellation error "+t+".")})),n=g.computeBufferNormal(e[0],a),n||(n=new g(0,0,0),t.globe.surfaceNormalAtLocation(this.referencePosition.latitude,this.referencePosition.longitude,n)),this.polygonTessellator.gluTessNormal(n[0],n[1],n[2]),this.currentData.capNormal=n,this.polygonTessellator.gluTessBeginPolygon(o);for(var u=0;u0&&this.drawCap(t,e),this._extrude&&this.activeAttributes.drawInterior&&this.drawSides(t,e),this.activeAttributes.drawOutline&&this.drawOutline(t,e),i.refreshBuffers=!1,t.pickingMode){var r=new u(e,this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(r)}},y.prototype.drawCap=function(t,e){var i,r,n,o,s,a=t.currentGlContext,l=t.currentProgram,h=this.currentData,u=h.refreshBuffers,c=!!this.hasCapTexture(),d=this.activeAttributes.applyLighting,p=h.capTriangles.length/(c?5:3);l.loadTextureEnabled(a,!1),this.applyMvpMatrix(t),h.capVboCacheKey||(h.capVboCacheKey=t.gpuResourceCache.generateCacheKey()),i=t.gpuResourceCache.resourceForKey(h.capVboCacheKey),i||(i=a.createBuffer(),t.gpuResourceCache.putResource(h.capVboCacheKey,i,4*h.capTriangles.length),u=!0),a.bindBuffer(a.ARRAY_BUFFER,i),u&&(s=d?this.makeCapBufferWithNormals():h.capTriangles,a.bufferData(a.ARRAY_BUFFER,s,a.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1)),r=this.activeAttributes.interiorColor,a.depthMask(r.alpha*this.layer.opacity>=1||t.pickingMode),l.loadColor(a,t.pickingMode?e:r),l.loadOpacity(a,t.pickingMode?1:this.layer.opacity),n=12+(c?8:0)+(d?12:0),c&&!t.pickingMode&&(this.activeTexture=t.gpuResourceCache.resourceForKey(this.capImageSource()),this.activeTexture||(this.activeTexture=t.gpuResourceCache.retrieveTexture(t.currentGlContext,this.capImageSource())),o=this.activeTexture&&this.activeTexture.bind(t),o&&(a.enableVertexAttribArray(l.vertexTexCoordLocation),a.vertexAttribPointer(l.vertexTexCoordLocation,2,a.FLOAT,!1,n,12),this.scratchMatrix.setToIdentity(),this.scratchMatrix.multiplyByTextureTransform(this.activeTexture),l.loadTextureEnabled(a,!0),l.loadTextureUnit(a,a.TEXTURE0),l.loadTextureMatrix(a,this.scratchMatrix),l.loadModulateColor(a,t.pickingMode))),d&&!t.pickingMode&&(l.loadApplyLighting(a,!0),a.enableVertexAttribArray(l.normalVectorLocation),a.vertexAttribPointer(l.normalVectorLocation,3,a.FLOAT,!1,n,n-12)),a.vertexAttribPointer(l.vertexPointLocation,3,a.FLOAT,!1,n,0),a.drawArrays(a.TRIANGLES,0,p)},y.prototype.makeCapBufferWithNormals=function(){for(var t=this.currentData,e=t.capNormal,i=this.hasCapTexture()?5:3,r=i+3,n=t.capTriangles.length/i,o=t.capTriangles,s=new Float32Array(n*r),a=0,l=0;l=1||t.pickingMode),l.loadColor(a,t.pickingMode?e:r),l.loadOpacity(a,t.pickingMode?1:this.layer.opacity),c&&!t.pickingMode){d?(l.loadApplyLighting(a,!0),a.enableVertexAttribArray(l.normalVectorLocation)):l.loadApplyLighting(a,!1);for(var m=0;m=1||t.pickingMode),l.loadColor(a,t.pickingMode?e:n),l.loadOpacity(a,t.pickingMode?1:this.layer.opacity),a.lineWidth(this.activeAttributes.outlineWidth),this._extrude?(o=24,s=i/2):(o=12,s=i),a.vertexAttribPointer(l.vertexPointLocation,3,a.FLOAT,!1,o,0),a.drawArrays(a.LINE_STRIP,0,s),this.mustDrawVerticals(t)&&(a.vertexAttribPointer(l.vertexPointLocation,3,a.FLOAT,!1,0,0),a.drawArrays(a.LINES,0,i-2))},y.prototype.beginDrawing=function(t){var e=t.currentGlContext;this.activeAttributes.drawInterior&&e.disable(e.CULL_FACE),t.findAndBindProgram(i),e.enableVertexAttribArray(t.currentProgram.vertexPointLocation);var r=!t.pickMode&&this.activeAttributes.applyLighting;r&&t.currentProgram.loadModelviewInverse(e,t.modelviewNormalTransform)},y.prototype.endDrawing=function(t){var e=t.currentGlContext;e.disableVertexAttribArray(t.currentProgram.vertexPointLocation),e.disableVertexAttribArray(t.currentProgram.normalVectorLocation),e.depthMask(!0),e.lineWidth(1),e.enable(e.CULL_FACE)},y}),i("shapes/SurfacePolyline",["../error/ArgumentError","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r){"use strict";var n=function(i,o){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfacePolyline","constructor","The specified locations array is null or undefined."));r.call(this,o),this._boundaries=i,this._stateId=n.stateId++,this._isInteriorInhibited=!0};return n.prototype=Object.create(r.prototype),Object.defineProperties(n.prototype,{boundaries:{get:function(){return this._boundaries},set:function(i){if(!Array.isArray(i))throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfacePolyline","set boundaries","The specified value is not an array."));this.resetBoundaries(),this._boundaries=i,this._stateId=n.stateId++,this.stateKeyInvalid=!0}}}),n.stateId=Number.MIN_SAFE_INTEGER,n.staticStateKey=function(t){var e=r.staticStateKey(t);return e+" pl "+t._stateId},n.prototype.computeStateKey=function(){return n.staticStateKey(this)},n.prototype.computeBoundaries=function(t){},n.prototype.getReferencePosition=function(){return this.boundaries.length>1?this.boundaries[0]:null},n.prototype.moveTo=function(t,e){this.boundaries=this.computeShiftedLocations(t,this.getReferencePosition(),e,this._boundaries)},n}),i("formats/geojson/GeoJSONParser",["../../error/ArgumentError","../../util/Color","./GeoJSONConstants","./GeoJSONCRS","./GeoJSONFeature","./GeoJSONFeatureCollection","./GeoJSONGeometry","./GeoJSONGeometryCollection","./GeoJSONGeometryLineString","./GeoJSONGeometryMultiLineString","./GeoJSONGeometryMultiPoint","./GeoJSONGeometryMultiPolygon","./GeoJSONGeometryPoint","./GeoJSONGeometryPolygon","../../geom/Location","../../util/Logger","../../shapes/Placemark","../../shapes/PlacemarkAttributes","../../shapes/Polygon","../../geom/Position","../../util/proj4-src","../../layer/RenderableLayer","../../shapes/ShapeAttributes","../../shapes/SurfacePolygon","../../shapes/SurfacePolyline"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_,b,S,w,L){"use strict";var T=function(e){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","constructor","missingDataSource"));this._dataSource=e,this._geoJSONObject=null,this._geoJSONType=null,this._crs=null,this._layer=null,this._parserCompletionCallback=null,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this.defaultPlacemarkAttributes=new y(null),this.defaultShapeAttributes=new S(null),this.setProj4jsAliases()};return Object.defineProperties(T.prototype,{dataSource:{get:function(){return this._dataSource}},geoJSONObject:{get:function(){return this._geoJSONObject}},geoJSONType:{get:function(){return this._geoJSONType}},crs:{get:function(){return this._crs}},layer:{get:function(){return this._layer}},parserCompletionCallback:{get:function(){return this._parserCompletionCallback}},shapeConfigurationCallback:{get:function(){return this._shapeConfigurationCallback}}}),T.prototype.load=function(t,e,i){t&&(this._parserCompletionCallback=t),e&&(this._shapeConfigurationCallback=e),this._layer=i||new b;var r=typeof this.dataSource;if("string"===r){var n=T.tryParseJSONString(this.dataSource);null!==n?this.handle(n):this.requestUrl(this.dataSource)}else"object"===r?this.handle(this.dataSource):g.logMessage(g.LEVEL_SEVERE,"GeoJSON","load","Unsupported data source type: "+r)},T.prototype.defaultShapeConfigurationCallback=function(t,e){var i={},r=e.name||e.Name||e.NAME;return r&&(i.name=r),t.isPointType()||t.isMultiPointType()?i.attributes=this.defaultPlacemarkAttributes:t.isLineStringType()||t.isMultiLineStringType()?i.attributes=this.defaultShapeAttributes:(t.isPolygonType()||t.isMultiPolygonType())&&(i.attributes=this.defaultShapeAttributes),i},T.prototype.requestUrl=function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="text",e.onreadystatechange=function(){4===e.readyState&&(200===e.status?this.handle(T.tryParseJSONString(e.response)):g.log(g.LEVEL_WARNING,"GeoJSON retrieval failed ("+e.statusText+"): "+t))}.bind(this),e.onerror=function(){g.log(g.LEVEL_WARNING,"GeoJSON retrieval failed: "+t)},e.ontimeout=function(){g.log(g.LEVEL_WARNING,"GeoJSON retrieval timed out: "+t)},e.send(null)},T.prototype.handle=function(e){if(e||g.logMessage(g.LEVEL_SEVERE,"GeoJSON","handle","Invalid GeoJSON object"),this._geoJSONObject=e,"[object Array]"===Object.prototype.toString.call(this.geoJSONObject))throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","handle","invalidGeoJSONObjectLength"));if(!this.geoJSONObject.hasOwnProperty(i.FIELD_TYPE))throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","handle","missingGeoJSONType"));this.setGeoJSONType(),this.setGeoJSONCRS(),this._parserCompletionCallback&&"function"==typeof this._parserCompletionCallback&&this._parserCompletionCallback(this.layer)},T.prototype.setGeoJSONCRS=function(){if(this.geoJSONObject[i.FIELD_CRS]){this._crs=new r(this.geoJSONObject[i.FIELD_CRS][i.FIELD_TYPE],this.geoJSONObject[i.FIELD_CRS][i.FIELD_PROPERTIES]);var t=function(){this.addRenderablesForGeoJSON(this.layer)}.bind(this);this.crs.setCRSString(t)}else this.addRenderablesForGeoJSON(this.layer)},T.prototype.addRenderablesForGeoJSON=function(e){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeoJSON","missingLayer"));switch(this.geoJSONType){case i.TYPE_FEATURE:var r=new n(this.geoJSONObject[i.FIELD_GEOMETRY],this.geoJSONObject[i.FIELD_PROPERTIES],this.geoJSONObject[i.FIELD_ID],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForFeature(e,r);break;case i.TYPE_FEATURE_COLLECTION:var s=new o(this.geoJSONObject[i.FIELD_FEATURES],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForFeatureCollection(e,s);break;case i.TYPE_GEOMETRY_COLLECTION:var l=new a(this.geoJSONObject[i.FIELD_GEOMETRIES],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForGeometryCollection(e,l,null);break;default:this.addRenderablesForGeometry(e,this.geoJSONObject,null)}},T.prototype.addRenderablesForGeometry=function(e,r,n){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometry","missingLayer"));if(!r)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometry","missingGeometry"));switch(r[i.FIELD_TYPE]){case i.TYPE_POINT:var o=new d(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForPoint(e,o,n?n:null);break;case i.TYPE_MULTI_POINT:var s=new u(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiPoint(e,s,n?n:null);break;case i.TYPE_LINE_STRING:var a=new l(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForLineString(e,a,n?n:null);break;case i.TYPE_MULTI_LINE_STRING:var f=new h(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiLineString(e,f,n?n:null);break;case i.TYPE_POLYGON:var m=new p(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForPolygon(e,m,n?n:null);break;case i.TYPE_MULTI_POLYGON:var y=new c(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiPolygon(e,y,n?n:null)}},T.prototype.addRenderablesForPoint=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForPoint","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForPoint","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported()){var o=i.coordinates[0],s=i.coordinates[1],a=i.coordinates[2]?i.coordinates[2]:0,l=this.getReprojectedIfRequired(s,o,this.crs),h=new v(l[1],l[0],a),u=new m(h,!1,n&&n.attributes?n.attributes:null);u.altitudeMode=WorldWind.RELATIVE_TO_GROUND,n&&n.name&&(u.label=n.name),n.highlightAttributes&&(u.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(u.pickDelegate=n.pickDelegate),n&&n.userProperties&&(u.userProperties=n.userProperties),e.addRenderable(u)}},T.prototype.addRenderablesForMultiPoint=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPoint","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPoint","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported())for(var o=0,s=i.coordinates.length;o0)for(var o=0;o1?s-1:1),w=(b-_)/(a>1?a-1:1),L=h?h:new n(0,0,0),T=u?u[0]:0,R=0,x=0;for(d=0,f=E;dthis.startPosition.altitude?(s=Math.max(0,this.maxAltitude-this.startPosition.altitude),s+=Math.abs(this.targetPosition.altitude-this.maxAltitude)):s=Math.abs(this.targetPosition.altitude-this.startPosition.altitude);var d=Math.max(l,s/this.wwd.globe.equatorialRadius);if(0!==d){d<2*c&&(a=Math.min(d/c*this.travelTime,this.travelTime)),a=Math.max(1,a),this.panVelocity=l/a,this.rangeVelocity=s/a;var p=this,f=function(){return p.cancelled?void(p.completionCallback&&p.completionCallback(p)):void(p.update()?setTimeout(f,p.animationFrequency):p.completionCallback&&p.completionCallback(p))};setTimeout(f,this.animationFrequency)}},n.prototype.update=function(){var t=new i(this.wwd.navigator.lookAtLocation.latitude,this.wwd.navigator.lookAtLocation.longitude,this.wwd.navigator.range),e=this.updateRange(t);return e=this.updateLocation(t)||e,this.wwd.redraw(),e},n.prototype.updateRange=function(t){var e,i,r=!1;return this.maxAltitudeReachedTime?(i=Date.now()-this.maxAltitudeReachedTime,this.maxAltitude>this.targetPosition.altitude?(e=this.maxAltitude-this.rangeVelocity*i,e=Math.max(e,this.targetPosition.altitude)):(e=this.maxAltitude+this.rangeVelocity*i,e=Math.min(e,this.targetPosition.altitude)),this.wwd.navigator.range=e,r=Math.abs(this.wwd.navigator.range-this.targetPosition.altitude)>1):(i=Date.now()-this.startTime,e=Math.min(this.startPosition.altitude+this.rangeVelocity*i,this.maxAltitude),Math.abs(this.wwd.navigator.range-e)<1&&(this.maxAltitudeReachedTime=Date.now()),this.wwd.navigator.range=e,r=!0),r},n.prototype.updateLocation=function(e){var i=Date.now()-this.startTime,r=t.greatCircleDistance(this.startPosition,e),n=t.greatCircleDistance(e,this.targetPosition),o=t.greatCircleAzimuth(e,this.targetPosition),s=this.panVelocity*i,a=Math.min(s-r,n),l=t.greatCircleLocation(e,o,a,new t(0,0)),h=!1;return this.wwd.navigator.lookAtLocation.latitude=l.latitude,this.wwd.navigator.lookAtLocation.longitude=l.longitude,a<1/this.wwd.globe.equatorialRadius&&(h=!0),!h},n}),i("layer/heatmap/HeatMapTile",[],function(){var t=function(t,e){this._data=t,this._sector=e.sector,this._canvas=this.createCanvas(e.width,e.height),this._width=e.width,this._height=e.height,this._intensityGradient=e.intensityGradient,this._radius=e.radius,this._incrementPerIntensity=e.incrementPerIntensity};return t.prototype.url=function(){return this.draw().toDataURL()},t.prototype.canvas=function(){return this.draw()},t.prototype.draw=function(){var t=[];for(var e in this._intensityGradient)this._intensityGradient.hasOwnProperty(e)&&t.push({shape:this.shape(e),min:e});for(var i,r=this._canvas.getContext("2d"),n=null,o=0;ot.min&&(n=t.shape)}),r.drawImage(n,this.longitudeInSector(s,this._sector,this._width)-n.width/2,this._height-this.latitudeInSector(s,this._sector,this._height)-n.height/2)}return this._canvas},t.prototype.createCanvas=function(t,e){var i=document.createElement("canvas");return i.width=t,i.height=e,i},t.prototype.shape=function(t){var e=this.createCanvas(2*this._radius,2*this._radius),i=e.getContext("2d"),r=i.createRadialGradient(this._radius,this._radius,0,this._radius,this._radius,this._radius);return r.addColorStop(0,"rgba(0,0,0,"+t+")"),r.addColorStop(1,"rgba(0,0,0,0)"),i.beginPath(),i.arc(this._radius,this._radius,this._radius,0,2*Math.PI,!0),i.fillStyle=r,i.fill(),i.closePath(),e},t.prototype.latitudeInSector=function(t,e,i){var r=e.maxLatitude-e.minLatitude,n=t.latitude-e.minLatitude;return Math.ceil(n/r*i)},t.prototype.longitudeInSector=function(t,e,i){var r=e.maxLongitude-e.minLongitude,n=t.longitude-e.minLongitude;return Math.ceil(n/r*i)},t}),i("layer/heatmap/HeatMapColoredTile",["./HeatMapTile"],function(t){var e=function(e,i){t.call(this,e,i),this._extendedWidth=i.extendedWidth,this._extendedHeight=i.extendedHeight,this._gradient=this.gradient(i.intensityGradient)};return e.prototype=Object.create(t.prototype),e.prototype.draw=function(){var e=t.prototype.draw.call(this),i=e.getContext("2d"),r=0,n=0,o=this._width,s=this._height;this._extendedHeight&&(r=this._extendedHeight,s=this._height-2*this._extendedHeight),this._extendedWidth&&(n=this._extendedWidth,o=this._width-2*this._extendedWidth);var a=i.getImageData(r,n,o,s);return this.colorize(a.data,this._gradient),i.putImageData(a,r,n),e},e.prototype.gradient=function(t){var e=this.createCanvas(1,256),i=e.getContext("2d"),r=i.createLinearGradient(0,0,0,256);for(var n in t)r.addColorStop(+n,t[n]);return i.fillStyle=r,i.fillRect(0,0,1,256),i.getImageData(0,0,1,256).data},e.prototype.colorize=function(t,e){for(var i,r=0,n=t.length;rd&&(d=t.measure)}),this._data=r,this._measuredLocations=e,this._intervalType=i.CONTINUOUS,this._scale=["blue","cyan","lime","yellow","red"],this._radius=12.5,this._incrementPerIntensity=1/d,this.setGradient(e)};return c.prototype=Object.create(l.prototype),Object.defineProperties(c.prototype,{intervalType:{get:function(){return this._intervalType},set:function(t){this._intervalType=t,this.setGradient()}},scale:{get:function(){return this._scale},set:function(t){this._scale=t,this.setGradient()}},gradient:{get:function(){return this._gradient}},radius:{get:function(){return this._radius},set:function(t){this._radius=t}}}),c.prototype.filterGeographically=function(t,e){var i=Math.floor(e.minLatitude),r=Math.floor(e.maxLatitude),n=Math.floor(e.minLongitude),o=Math.floor(e.maxLongitude),s=0,a=0;i<=-90&&(i=-90),r>=90&&(r=90),n<=-180&&(s=Math.abs(n- -180),n=-180),o>=180&&(a=Math.abs(o-180),o=180);var l=[];if(this.gatherGeographical(t,l,e,i,r,n,o),0!==s){var u=new h(i,r,180-s,180);this.gatherGeographical(t,l,u,i,r,180-s,180,-360)}if(0!==a){var c=new h(i,r,-180,-180+a);this.gatherGeographical(t,l,c,i,r,-180,-180+a,360)}return l},c.prototype.gatherGeographical=function(t,e,i,r,n,o,s,l){var h,u;for(h=r;h<=n;h++)for(u=o;u<=s;u++)t[h][u].forEach(function(t){i.containsLocation(t.latitude,t.longitude)&&(l?e.push(new a(t.latitude,l+t.longitude,t.measure)):e.push(t))})},c.prototype.setGradient=function(){var t=this.intervalType,e=this.scale,r={};if(t===i.CONTINUOUS)e.forEach(function(t,i){r[i/e.length]=t});else if(t===i.QUANTILES){var n=this._measuredLocations;n.sort(function(t,e){return t.measuree.measure?1:0});var o=n[n.length-1].measure;n.length>=e.length?e.forEach(function(t,i){0===i?r[0]=t:r[n[Math.floor(i/e.length*n.length)].measure/o]=t}):e.forEach(function(t,i){r[i/e.length]=t})}this._gradient=r},c.prototype.retrieveTileImage=function(t,e,i){if(this.currentRetrievals.indexOf(e.imagePath)<0){if(this.absentResourceList.isResourceAbsent(e.imagePath))return;var r=e.imagePath,n=t.gpuResourceCache,o=this,s=this.radius,a=this.calculateExtendedSector(e.sector,2*(s/this.tileWidth),2*(s/this.tileHeight)),l=Math.ceil(a.extensionFactorWidth*this.tileWidth),h=Math.ceil(a.extensionFactorHeight*this.tileHeight),u=this.filterGeographically(this._data,a.sector),c=this.createHeatMapTile(u,{sector:a.sector,width:this.tileWidth+2*l,height:this.tileHeight+2*h,radius:s,intensityGradient:this.gradient,incrementPerIntensity:this._incrementPerIntensity,extendedWidth:l,extendedHeight:h}).canvas(),d=document.createElement("canvas");d.height=this.tileHeight,d.width=this.tileWidth,d.getContext("2d").putImageData(c.getContext("2d").getImageData(l,h,this.tileWidth,this.tileHeight),0,0);var p=o.createTexture(t,e,d);if(o.removeFromCurrentRetrievals(r),p&&(n.putResource(r,p,p.size),o.currentTilesInvalid=!0,o.absentResourceList.unmarkResourceAbsent(r),!i)){var f=document.createEvent("Event");f.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(f)}}},c.prototype.calculateExtendedSector=function(t,e,i){var r=(t.maxLatitude-t.minLatitude)*i,n=(t.maxLongitude-t.minLongitude)*e;return{sector:new h(t.minLatitude-r,t.maxLatitude+r,t.minLongitude-n,t.maxLongitude+n),extensionFactorHeight:i,extensionFactorWidth:e}},c.prototype.createHeatMapTile=function(t,i){return new e(t,i)},c}),i("util/HighlightController",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"HighlightController","constructor","missingWorldWindow"));this.worldWindow=i;var r=[],n=function(t){for(var e=t.clientX,n=t.clientY,o=r.length>0,s=0;s0&&(o=!0),a.objects.length>0)for(var l=0;l1;)try{return d.stringifyByChunk(t,r,i)}catch(t){i=Math.floor(i/2)}return d.stringifyByChar(t)}function s(t,e){for(var i=0;i "+t:t}},t.exports=r},function(t,e,i){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var n={arraySet:function(t,e,i,r,n){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),n);else for(var o=0;o=252?6:u>=248?5:u>=240?4:u>=224?3:u>=192?2:1;h[254]=h[254]=1,e.utf8encode=function(t){return s.nodebuffer?a.newBufferFrom(t,"utf-8"):function(t){var e,i,r,n,o,a=t.length,l=0;for(n=0;n>>6,e[o++]=128|63&i):i<65536?(e[o++]=224|i>>>12,e[o++]=128|i>>>6&63,e[o++]=128|63&i):(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63,e[o++]=128|i>>>6&63,e[o++]=128|63&i);return e}(t)},e.utf8decode=function(t){return s.nodebuffer?o.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,i,r,n,s=t.length,a=new Array(2*s);for(i=0,e=0;e4)a[i++]=65533,e+=n-1;else{for(r&=2===n?31:3===n?15:7;n>1&&e1?a[i++]=65533:r<65536?a[i++]=r:(r-=65536,a[i++]=55296|r>>10&1023,a[i++]=56320|1023&r)}return a.length!==i&&(a.subarray?a=a.subarray(0,i):a.length=i),o.applyFromCharCode(a)}(t=o.transformTo(s.uint8array?"uint8array":"array",t))},o.inherits(r,l),r.prototype.processChunk=function(t){var i=o.transformTo(s.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var r=i;(i=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),i.set(r,this.leftOver.length)}else i=this.leftOver.concat(i);this.leftOver=null}var n=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+h[t[i]]>e?i:e}(i),a=i;n!==i.length&&(s.uint8array?(a=i.subarray(0,n),this.leftOver=i.subarray(n,i.length)):(a=i.slice(0,n),this.leftOver=i.slice(n,i.length))),this.push({data:e.utf8decode(a),meta:t.meta})},r.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:e.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},e.Utf8DecodeWorker=r,o.inherits(n,l),n.prototype.processChunk=function(t){this.push({data:e.utf8encode(t.data),meta:t.meta})},e.Utf8EncodeWorker=n},function(t,e,i){"use strict";var r=null;r="undefined"!=typeof Promise?Promise:i(74),t.exports={Promise:r}},function(t,e,i){(function(t){function i(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===i(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===i(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===i(t)},e.isError=function(t){return"[object Error]"===i(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,i(10).Buffer)},function(t,e,i){"use strict";(function(t){function r(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function n(t,e){if(r()=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function c(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return k(t).length;default:if(r)return D(t).length;e=(""+e).toLowerCase(),r=!0}}function d(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function p(t,e,i,r,n){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:f(t,e,i,r,n);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):f(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}function f(t,e,i,r,n){function o(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}var s,a=1,l=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,l/=2,h/=2,i/=2}if(n){var u=-1;for(s=i;sl&&(i=l-h),s=i;s>=0;s--){for(var c=!0,d=0;dn&&(r=n):r=n;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s>8,n=i%256,o.push(n),o.push(r);return o}(e,t.length-i),t,i,r)}function b(t,e,i){return 0===e&&i===t.length?F.fromByteArray(t):F.fromByteArray(t.slice(e,i))}function S(t,e,i){i=Math.min(t.length,i);for(var r=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+c<=i)switch(c){case 1:h<128&&(u=h);break;case 2:128==(192&(o=t[n+1]))&&(l=(31&h)<<6|63&o)>127&&(u=l);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(l=(15&h)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(u=l)}null===u?(u=65533,c=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),n+=c}return function(t){var e=t.length;if(e<=B)return String.fromCharCode.apply(String,t);for(var i="",r=0;rr)&&(i=r);for(var n="",o=e;oi)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,i,r,n,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function C(t,e,i,r){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-i,2);n>>8*(r?n:1-n)}function A(t,e,i,r){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-i,4);n>>8*(r?n:3-n)&255}function P(t,e,i,r,n,o){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function N(t,e,i,r,n){return n||P(t,0,i,4),G.write(t,e,i,r,23,4),i+4}function O(t,e,i,r,n){return n||P(t,0,i,8),G.write(t,e,i,r,52,8),i+8}function I(t){return t<16?"0"+t.toString(16):t.toString(16)}function D(t,e){var i;e=e||1/0;for(var r=t.length,n=null,o=[],s=0;s55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&o.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;o.push(i)}else if(i<2048){if((e-=2)<0)break;o.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function k(t){return F.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,i,r){for(var n=0;n=e.length||n>=t.length);++n)e[n+i]=t[n];return n}var F=i(102),G=i(101),W=i(51);e.Buffer=o,e.SlowBuffer=function(t){return+t!=t&&(t=0),o.alloc(+t)},e.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=r(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,i){return s(null,t,e,i)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,i){return function(t,e,i,r){return a(e),e<=0?n(t,e):void 0!==i?"string"==typeof r?n(t,e).fill(i,r):n(t,e).fill(i):n(t,e)}(null,t,e,i)},o.allocUnsafe=function(t){return l(null,t)},o.allocUnsafeSlow=function(t){return l(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,r=e.length,n=0,s=Math.min(i,r);nthis.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,i);case"utf8":case"utf-8":return S(this,e,i);case"ascii":return w(this,e,i);case"latin1":case"binary":return L(this,e,i);case"base64":return b(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",i=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),""},o.prototype.compare=function(t,e,i,r,n){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),e<0||i>t.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&e>=i)return 0;if(r>=n)return-1;if(e>=i)return 1;if(e>>>=0,i>>>=0,r>>>=0,n>>>=0,this===t)return 0;for(var s=n-r,a=i-e,l=Math.min(s,a),h=this.slice(r,n),u=t.slice(e,i),c=0;cn)&&(i=n),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return g(this,t,e,i);case"utf8":case"utf-8":return m(this,t,e,i);case"ascii":return y(this,t,e,i);case"latin1":case"binary":return E(this,t,e,i);case"base64":return v(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var B=4096;o.prototype.slice=function(t,e){var i,r=this.length;if(t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(n*=256);)r+=this[t+--e]*n;return r},o.prototype.readUInt8=function(t,e){return e||x(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||x(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||x(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||x(t,e,this.length);for(var r=this[t],n=1,o=0;++o=(n*=128)&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||x(t,e,this.length);for(var r=e,n=1,o=this[t+--r];r>0&&(n*=256);)o+=this[t+--r]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||x(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},o.prototype.readInt16BE=function(t,e){e||x(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},o.prototype.readInt32LE=function(t,e){return e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||x(t,4,this.length),G.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||x(t,4,this.length),G.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||x(t,8,this.length),G.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||x(t,8,this.length),G.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,i,r){t=+t,e|=0,i|=0,r||M(this,t,e,i,Math.pow(2,8*i)-1,0);var n=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+n]=t/o&255;return e+i},o.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):C(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):C(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):A(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):A(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);M(this,t,e,i,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+i},o.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);M(this,t,e,i,n-1,-n)}var o=i-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i},o.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):C(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):C(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):A(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):A(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,i){return N(this,t,e,!0,i)},o.prototype.writeFloatBE=function(t,e,i){return N(this,t,e,!1,i)},o.prototype.writeDoubleLE=function(t,e,i){return O(this,t,e,!0,i)},o.prototype.writeDoubleBE=function(t,e,i){return O(this,t,e,!1,i)},o.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--n)t[n+e]=this[n+i];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(s=e;s1)for(var i=1;i>>1:t>>>1;e[i]=t}return e}();t.exports=function(t,e){return void 0!==t&&t.length?"string"!==r.getTypeOf(t)?function(t,e,i,r){var o=n,s=r+i;t^=-1;for(var a=r;a>>8^o[255&(t^e[a])];return-1^t}(0|e,t,t.length,0):function(t,e,i,r){var o=n,s=r+i;t^=-1;for(var a=r;a>>8^o[255&(t^e.charCodeAt(a))];return-1^t}(0|e,t,t.length,0):0}},function(t,e,i){"use strict";function r(t,e,i,r,n){this.compressedSize=t,this.uncompressedSize=e,this.crc32=i,this.compression=r,this.compressedContent=n}var n=i(8),o=i(37),s=i(36),a=i(35);s=i(36),r.prototype={getContentWorker:function(){var t=new o(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),e=this;return t.on("end",function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),t},getCompressedWorker:function(){return new o(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},r.createWorkerFrom=function(t,e,i){return t.pipe(new a).pipe(new s("uncompressedSize")).pipe(e.compressWorker(i)).pipe(new s("compressedSize")).withStreamInfo("compression",e)},t.exports=r},function(t,e,i){t.exports=!i(41)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,i){"use strict";(function(e,r,n){function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,i){var r=t.entry;for(t.entry=null;r;){var n=r.callback;e.pendingcb--,n(i),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}function s(){}function a(t,e){m=m||i(4),t=t||{};var r=e instanceof m;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,s=t.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var i=t._writableState,r=i.sync,n=i.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),e)!function(t,e,i,r,n){--e.pendingcb,i?(g.nextTick(n,r),g.nextTick(f,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(n(r),t._writableState.errorEmitted=!0,t.emit("error",r),f(t,e))}(t,i,r,e,n);else{var o=d(i);o||i.corked||i.bufferProcessing||!i.bufferedRequest||c(t,i),r?y(u,t,i,o,n):u(t,i,o,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function l(t){return m=m||i(4),v.call(l,this)||this instanceof m?(this._writableState=new a(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),b.call(this),void 0):new l(t)}function h(t,e,i,r,n,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,i?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function u(t,e,i,r){i||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),f(t,e)}function c(t,e){e.bufferProcessing=!0;var i=e.bufferedRequest;if(t._writev&&i&&i.next){var r=e.bufferedRequestCount,n=new Array(r),s=e.corkedRequestsFree;s.entry=i;for(var a=0,l=!0;i;)n[a]=i,i.isBuf||(l=!1),i=i.next,a+=1;n.allBuffers=l,h(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;i;){var u=i.chunk,c=i.encoding,d=i.callback;if(h(t,e,!1,e.objectMode?1:u.length,u,c,d),i=i.next,e.bufferedRequestCount--,e.writing)break}null===i&&(e.lastBufferedRequest=null)}e.bufferedRequest=i,e.bufferProcessing=!1}function d(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function p(t,e){t._final(function(i){e.pendingcb--,i&&t.emit("error",i),e.prefinished=!0,t.emit("prefinish"),f(t,e)})}function f(t,e){var i=d(e);return i&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,g.nextTick(p,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),i}var g=i(14);t.exports=l;var m,y=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?r:g.nextTick;l.WritableState=a;var E=i(9);E.inherits=i(6);var v,_={deprecate:i(94)},b=i(48),S=i(13).Buffer,w=n.Uint8Array||function(){},L=i(47);E.inherits(l,b),a.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(a.prototype,"buffer",{get:_.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(v=Function.prototype[Symbol.hasInstance],Object.defineProperty(l,Symbol.hasInstance,{value:function(t){return!!v.call(this,t)||this===l&&t&&t._writableState instanceof a}})):v=function(t){return t instanceof this},l.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},l.prototype.write=function(t,e,i){var r=this._writableState,n=!1,o=!r.objectMode&&function(t){return S.isBuffer(t)||t instanceof w}(t);return o&&!S.isBuffer(t)&&(t=function(t){return S.from(t)}(t)),"function"==typeof e&&(i=e,e=null),o?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof i&&(i=s),r.ended?function(t,e){var i=new Error("write after end");t.emit("error",i),g.nextTick(e,i)}(this,i):(o||function(t,e,i,r){var n=!0,o=!1;return null===i?o=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),g.nextTick(r,o),n=!1),n}(this,r,t,i))&&(r.pendingcb++,n=function(t,e,i,r,n,o){if(!i){var s=function(t,e,i){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=S.from(e,i)),e}(e,r,n);r!==s&&(i=!0,n="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var l=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),l.prototype._write=function(t,e,i){i(new Error("_write() is not implemented"))},l.prototype._writev=null,l.prototype.end=function(t,e,i){var r=this._writableState;"function"==typeof t?(i=t,t=null,e=null):"function"==typeof e&&(i=e,e=null),null!==t&&void 0!==t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,i){e.ending=!0,f(t,e),i&&(e.finished?g.nextTick(i):t.once("finish",i)),e.ended=!0,t.writable=!1}(this,r,i)},Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),l.prototype.destroy=L.destroy,l.prototype._undestroy=L.undestroy,l.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,i(15),i(96).setImmediate,i(5))},function(t,e,i){(e=t.exports=i(49)).Stream=e,e.Readable=e,e.Writable=i(21),e.Duplex=i(4),e.Transform=i(45),e.PassThrough=i(93)},function(t,e){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function n(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(t){if(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},i.prototype.emit=function(t){var e,i,s,a,l,h;if(this._events||(this._events={}),"error"===t&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}if(o(i=this._events[t]))return!1;if(r(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(n(i))for(a=Array.prototype.slice.call(arguments,1),s=(h=i.slice()).length,l=0;l0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){function i(){this.removeListener(t,i),n||(n=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var n=!1;return i.listener=e,this.on(t,i),this},i.prototype.removeListener=function(t,e){var i,o,s,a;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(s=(i=this._events[t]).length,o=-1,i===e||r(i.listener)&&i.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(n(i)){for(a=s;a-- >0;)if(i[a]===e||i[a].listener&&i[a].listener===e){o=a;break}if(o<0)return this;1===i.length?(i.length=0,delete this._events[t]):i.splice(o,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r(i=this._events[t]))this.removeListener(t,i);else if(i)for(;i.length;)this.removeListener(t,i[i.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,i){"use strict";function r(t){n.call(this,t)}var n=i(26);i(0).inherits(r,n),r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},t.exports=r},function(t,e,i){"use strict";function r(t){this.data=t,this.length=t.length,this.index=0,this.zero=0}var n=i(0);r.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length=this.index;e--)i=(i<<8)+this.byteAt(e);return this.index+=t,i},readString:function(t){return n.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readAndCheckSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},t.exports=r},function(t,e,i){"use strict";function r(t){n.call(this,t);for(var e=0;e=0;--o)if(this.data[o]===e&&this.data[o+1]===i&&this.data[o+2]===r&&this.data[o+3]===n)return o-this.zero;return-1},r.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),i=t.charCodeAt(1),r=t.charCodeAt(2),n=t.charCodeAt(3),o=this.readData(4);return e===o[0]&&i===o[1]&&r===o[2]&&n===o[3]},r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},t.exports=r},function(t,e,i){"use strict";var r=i(0),n=i(3),o=i(26),s=i(54),a=i(53),l=i(24);t.exports=function(t){var e=r.getTypeOf(t);return r.checkSupport(e),"string"!==e||n.uint8array?"nodebuffer"===e?new a(t):n.uint8array?new l(r.transformTo("uint8array",t)):new o(r.transformTo("array",t)):new s(t)}},function(t,e,i){"use strict";e.LOCAL_FILE_HEADER="PK",e.CENTRAL_FILE_HEADER="PK",e.CENTRAL_DIRECTORY_END="PK",e.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",e.ZIP64_CENTRAL_DIRECTORY_END="PK",e.DATA_DESCRIPTOR="PK\b"},function(t,e,i){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e,i){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,i){"use strict";function r(t,e){if(e<65537&&(t.subarray&&s||!t.subarray&&o))return String.fromCharCode.apply(null,n.shrinkBuf(t,e));for(var i="",r=0;r=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;a[254]=a[254]=1,e.string2buf=function(t){var e,i,r,o,s,a=t.length,l=0;for(o=0;o>>6,e[s++]=128|63&i):i<65536?(e[s++]=224|i>>>12,e[s++]=128|i>>>6&63,e[s++]=128|63&i):(e[s++]=240|i>>>18,e[s++]=128|i>>>12&63,e[s++]=128|i>>>6&63,e[s++]=128|63&i);return e},e.buf2binstring=function(t){return r(t,t.length)},e.binstring2buf=function(t){for(var e=new n.Buf8(t.length),i=0,r=e.length;i4)h[n++]=65533,i+=s-1;else{for(o&=2===s?31:3===s?15:7;s>1&&i1?h[n++]=65533:o<65536?h[n++]=o:(o-=65536,h[n++]=55296|o>>10&1023,h[n++]=56320|1023&o)}return r(h,n)},e.utf8border=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+a[t[i]]>e?i:e}},function(t,e,i){"use strict";var r=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();t.exports=function(t,e,i,n){var o=r,s=n+i;t^=-1;for(var a=n;a>>8^o[255&(t^e[a])];return-1^t}},function(t,e,i){"use strict";t.exports=function(t,e,i,r){for(var n=65535&t|0,o=t>>>16&65535|0,s=0;0!==i;){i-=s=i>2e3?2e3:i;do o=o+(n=n+e[r++]|0)|0;while(--s);n%=65521,o%=65521}return n|o<<16|0}},function(t,e,i){"use strict";var r=i(1);e.STORE={magic:"\0\0",compressWorker:function(t){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},e.DEFLATE=i(68)},function(t,e,i){"use strict";function r(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}var n=i(1),o=i(17);i(0).inherits(r,n),r.prototype.processChunk=function(t){this.streamInfo.crc32=o(t.data,this.streamInfo.crc32||0),this.push(t)},t.exports=r},function(t,e,i){"use strict";function r(t){o.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}var n=i(0),o=i(1);n.inherits(r,o),r.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}o.prototype.processChunk.call(this,t)},t.exports=r},function(t,e,i){"use strict";function r(t){o.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then(function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=n.getTypeOf(t),e.isPaused||e._tickAndRepeat()},function(t){e.error(t)})}var n=i(0),o=i(1);n.inherits(r,o),r.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=r},function(t,e,i){"use strict";e.base64=!1,e.binary=!1,e.dir=!1,e.createFolders=!0,e.date=null,e.compression=null,e.compressionOptions=null,e.comment=null,e.unixPermissions=null,e.dosPermissions=null},function(t,e,i){"use strict";(function(e){function r(t,i){return new u.Promise(function(r,n){var s=[],a=t._internalType,h=t._outputType,u=t._mimeType;t.on("data",function(t,e){s.push(t),i&&i(e)}).on("error",function(t){s=[],n(t)}).on("end",function(){try{var t=function(t,e,i){switch(t){case"blob":return o.newBlob(o.transformTo("arraybuffer",e),i);case"base64":return l.encode(e);default:return o.transformTo(t,e)}}(h,function(t,i){var r,n=0,o=null,s=0;for(r=0;r>2,a=(3&e)<<4|i>>4,l=p>1?(15&i)<<2|n>>6:64,h=p>2?63&n:64,u.push(o.charAt(s)+o.charAt(a)+o.charAt(l)+o.charAt(h));return u.join("")},e.decode=function(t){var e,i,r,s,a,l,h=0,u=0;if("data:"===t.substr(0,"data:".length))throw new Error("Invalid base64 input, it looks like a data url.");var c,d=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(t.charAt(t.length-1)===o.charAt(64)&&d--,t.charAt(t.length-2)===o.charAt(64)&&d--,d%1!=0)throw new Error("Invalid base64 input, bad content length.");for(c=n.uint8array?new Uint8Array(0|d):new Array(0|d);h>4,i=(15&s)<<4|(a=o.indexOf(t.charAt(h++)))>>2,r=(3&a)<<6|(l=o.indexOf(t.charAt(h++))),c[u++]=e,64!==a&&(c[u++]=i),64!==l&&(c[u++]=r);return c}},function(t,e,i){"use strict";function r(t){return this instanceof r?(s.call(this,t),this._transformState={afterTransform:function(t,e){var i=this._transformState;i.transforming=!1;var r=i.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));i.writechunk=null,i.writecb=null,null!=e&&this.push(e),r(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function o(t){var e=this.lastTotal-this.lastNeed,i=function(t,e,i){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==i?i:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function s(t,e){if((t.length-e)%2==0){var i=t.toString("utf16le",e);if(i){var r=i.charCodeAt(i.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function a(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}function l(t,e){var i=(t.length-e)%3;return 0===i?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function u(t){return t.toString(this.encoding)}function c(t){return t&&t.length?this.write(t):""}var d=i(13).Buffer,p=d.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};e.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,i;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i=0?(o>0&&(t.lastNeed=o-1),o):--r=0?(o>0&&(t.lastNeed=o-2),o):--r=0?(o>0&&(2===o?o=0:t.lastNeed=o-3),o):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var r=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},r.prototype.fillLast=function(t){return this.lastNeed<=t.length?(t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),void(this.lastNeed-=t.length))}},function(t,e,i){"use strict";function r(t,e){t.emit("error",e)}var n=i(14);t.exports={destroy:function(t,e){var i=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(r,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(n.nextTick(r,i,t),i._writableState&&(i._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,i){t.exports=i(23).EventEmitter},function(t,e,i){"use strict";(function(e,r){function n(t,e){b=b||i(4),t=t||{};var r=e instanceof b;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new P,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(A||(A=i(46).StringDecoder),this.decoder=new A(t.encoding),this.encoding=t.encoding)}function o(t){return b=b||i(4),this instanceof o?(this._readableState=new n(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)), -L.call(this),void 0):new o(t)}function s(t,e,i,r,n){var o,s=t._readableState;return null===e?(s.reading=!1,function(t,e){if(!e.ended){if(e.decoder){var i=e.decoder.end();i&&i.length&&(e.buffer.push(i),e.length+=e.objectMode?1:i.length)}e.ended=!0,h(t)}}(t,s)):(n||(o=function(t,e){var i;return function(t){return T.isBuffer(t)||t instanceof R}(e)||"string"==typeof e||void 0===e||t.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i}(s,e)),o?t.emit("error",o):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===T.prototype||(e=function(t){return T.from(t)}(e)),r?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):a(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!i?(e=s.decoder.write(e),s.objectMode||0!==e.length?a(t,s,e,!1):c(t,s)):a(t,s,e,!1))):r||(s.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=I?t=I:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function h(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(C("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?_.nextTick(u,t):u(t))}function u(t){C("emit readable"),t.emit("readable"),g(t)}function c(t,e){e.readingMore||(e.readingMore=!0,_.nextTick(d,t,e))}function d(t,e){for(var i=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(i=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):i=function(t,e,i){var r;return to.length?o.length:t;if(n+=s===o.length?o:o.slice(0,t),0===(t-=s)){s===o.length?(++r,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=o.slice(s));break}++r}return e.length-=r,n}(t,e):function(t,e){var i=T.allocUnsafe(t),r=e.head,n=1;for(r.data.copy(i),t-=r.data.length;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(i,i.length-t,0,s),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e),r}(t,e.buffer,e.decoder),i);var i}function y(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,_.nextTick(E,e,t))}function E(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function v(t,e){for(var i=0,r=t.length;i=e.highWaterMark||e.ended))return C("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?y(this):h(this),null;if(0===(t=l(t,e))&&e.ended)return 0===e.length&&y(this),null;var r,n=e.needReadable;return C("need readable",n),(0===e.length||e.length-t0?m(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&y(this)),null!==r&&this.emit("data",r),r},o.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},o.prototype.pipe=function(t,e){function i(e,r){C("onunpipe"),e===u&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,C("cleanup"),t.removeListener("close",a),t.removeListener("finish",l),t.removeListener("drain",p),t.removeListener("error",s),t.removeListener("unpipe",i),u.removeListener("end",n),u.removeListener("end",h),u.removeListener("data",o),f=!0,!c.awaitDrain||t._writableState&&!t._writableState.needDrain||p())}function n(){C("onend"),t.end()}function o(e){C("ondata"),m=!1,!1!==t.write(e)||m||((1===c.pipesCount&&c.pipes===t||c.pipesCount>1&&-1!==v(c.pipes,t))&&!f&&(C("false write response, pause",u._readableState.awaitDrain),u._readableState.awaitDrain++,m=!0),u.pause())}function s(e){C("onerror",e),h(),t.removeListener("error",s),0===w(t,"error")&&t.emit("error",e)}function a(){t.removeListener("finish",l),h()}function l(){C("onfinish"),t.removeListener("close",a),h()}function h(){C("unpipe"),u.unpipe(t)}var u=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=t;break;case 1:c.pipes=[c.pipes,t];break;default:c.pipes.push(t)}c.pipesCount+=1,C("pipe count=%d opts=%j",c.pipesCount,e);var d=e&&!1===e.end||t===r.stdout||t===r.stderr?h:n;c.endEmitted?_.nextTick(d):u.once("end",d),t.on("unpipe",i);var p=function(t){return function(){var e=t._readableState;C("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&w(t,"data")&&(e.flowing=!0,g(t))}}(u);t.on("drain",p);var f=!1,m=!1;return u.on("data",o),function(t,e,i){return"function"==typeof t.prependListener?t.prependListener(e,i):void(t._events&&t._events[e]?S(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]:t.on(e,i))}(t,"error",s),t.once("close",a),t.once("finish",l),t.emit("pipe",u),c.flowing||(C("pipe resume"),u.resume()),t},o.prototype.unpipe=function(t){var e=this._readableState,i={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,i),this);if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o>8;this.dir=!!(16&this.externalFileAttributes),0===t&&(this.dosPermissions=63&this.externalFileAttributes),3===t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(t){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(t){var e,i,r,n=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t0)this.isSignature(e,s.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(t){this.reader=n(t)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=r},function(t,e,i){"use strict";function r(t){return new o.Promise(function(e,i){var r=t.decompressed.getContentWorker().pipe(new l);r.on("error",function(t){i(t)}).on("end",function(){r.streamInfo.crc32!==t.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}var n=i(0),o=i(8),s=i(7),a=(n=i(0),i(55)),l=i(35),h=i(12);t.exports=function(t,e){var i=this;return e=n.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),h.isNode&&h.isStream(t)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",t,!0,e.optimizedBinaryString,e.base64).then(function(t){var i=new a(e);return i.load(t),i}).then(function(t){var i=[o.Promise.resolve(t)],n=t.files;if(e.checkCRC32)for(var s=0;s>>=8;return r},u=function(t,e,i,r,o,u){var c,d,p=t.file,f=t.compression,g=u!==s.utf8encode,m=n.transformTo("string",u(p.name)),y=n.transformTo("string",s.utf8encode(p.name)),E=p.comment,v=n.transformTo("string",u(E)),_=n.transformTo("string",s.utf8encode(E)),b=y.length!==p.name.length,S=_.length!==E.length,w="",L="",T="",R=p.dir,x=p.date,M={crc32:0,compressedSize:0,uncompressedSize:0};e&&!i||(M.crc32=t.crc32,M.compressedSize=t.compressedSize,M.uncompressedSize=t.uncompressedSize);var C=0;e&&(C|=8),g||!b&&!S||(C|=2048);var A=0,P=0;R&&(A|=16),"UNIX"===o?(P=798,A|=function(t,e){var i=t;return t||(i=e?16893:33204),(65535&i)<<16}(p.unixPermissions,R)):(P=20,A|=function(t,e){return 63&(t||0)}(p.dosPermissions)),c=x.getUTCHours(),c<<=6,c|=x.getUTCMinutes(),c<<=5,c|=x.getUTCSeconds()/2,d=x.getUTCFullYear()-1980,d<<=4,d|=x.getUTCMonth()+1,d<<=5,d|=x.getUTCDate(),b&&(L=h(1,1)+h(a(m),4)+y,w+="up"+h(L.length,2)+L),S&&(T=h(1,1)+h(a(v),4)+_,w+="uc"+h(T.length,2)+T);var N="";return N+="\n\0",N+=h(C,2),N+=f.magic,N+=h(c,2),N+=h(d,2),N+=h(M.crc32,4),N+=h(M.compressedSize,4),N+=h(M.uncompressedSize,4),N+=h(m.length,2),N+=h(w.length,2),{fileRecord:l.LOCAL_FILE_HEADER+N+m+w,dirRecord:l.CENTRAL_FILE_HEADER+h(P,2)+N+h(v.length,2)+"\0\0\0\0"+h(A,4)+h(r,4)+m+w+v}};n.inherits(r,o),r.prototype.push=function(t){var e=t.meta.percent||0,i=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,o.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:i?(e+100*(i-r-1))/i:100}}))},r.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var i=u(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},r.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,i=u(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),e)this.push({data:function(t){return l.DATA_DESCRIPTOR+h(t.crc32,4)+h(t.compressedSize,4)+h(t.uncompressedSize,4)}(t),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},r.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e=1&&0===D[R];R--);if(x>R&&(x=R),0===R)return h[u++]=20971520,h[u++]=20971520,d.bits=1,0;for(T=1;T0&&(0===t||1!==R))return-1;for(k[1]=0,w=1;w<15;w++)k[w+1]=k[w]+D[w];for(L=0;L852||2===t&&P>592)return 1;for(;;){v=w-C,c[L]E?(_=V[F+c[L]],b=O[I+c[L]]):(_=96,b=0),p=1<>C)+(f-=p)]=v<<24|_<<16|b|0;while(0!==f);for(p=1<>=1;if(0!==p?(N&=p-1,N+=p):N=0,L++,0==--D[w]){if(w===R)break;w=e[i+c[L]]}if(w>x&&(N&m)!==g){for(0===C&&(C=x),y+=T,A=1<<(M=w-C);M+C852||2===t&&P>592)return 1;h[g=N&m]=x<<24|M<<16|y-u|0}}return 0!==N&&(h[y+N]=w-C<<24|64<<16|0),d.bits=x,0}},function(t,e,i){"use strict";t.exports=function(t,e){var i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_,b,S,w,L,T,R;i=t.state,r=t.next_in,T=t.input,n=r+(t.avail_in-5),o=t.next_out,R=t.output,s=o-(e-t.avail_out),a=o+(t.avail_out-257),l=i.dmax,h=i.wsize,u=i.whave,c=i.wnext,d=i.window,p=i.hold,f=i.bits,g=i.lencode,m=i.distcode,y=(1<>>=_=v>>>24,f-=_,0===(_=v>>>16&255))R[o++]=65535&v;else{if(!(16&_)){if(0==(64&_)){v=g[(65535&v)+(p&(1<<_)-1)];continue e}if(32&_){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}b=65535&v,(_&=15)&&(f<_&&(p+=T[r++]<>>=_,f-=_),f<15&&(p+=T[r++]<>>=_=v>>>24,f-=_,!(16&(_=v>>>16&255))){if(0==(64&_)){v=m[(65535&v)+(p&(1<<_)-1)];continue i}t.msg="invalid distance code",i.mode=30;break t}if(S=65535&v,f<(_&=15)&&(p+=T[r++]<l){t.msg="invalid distance too far back",i.mode=30;break t}if(p>>>=_,f-=_,S>(_=o-s)){if((_=S-_)>u&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(w=0,L=d,0===c){if(w+=h-_,_2;)R[o++]=L[w++],R[o++]=L[w++],R[o++]=L[w++],b-=3;b&&(R[o++]=L[w++],b>1&&(R[o++]=L[w++]))}else{w=o-S;do R[o++]=R[w++],R[o++]=R[w++],R[o++]=R[w++],b-=3;while(b>2);b&&(R[o++]=R[w++],b>1&&(R[o++]=R[w++]))}break}}break}}while(r>3,p&=(1<<(f-=b<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function n(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=P,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new d.Buf32(ht),e.distcode=e.distdyn=new d.Buf32(ut),e.sane=1,e.back=-1,w):R}function o(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,n(t)):R}function s(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?R:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,o(t))):R}function a(t,e){var i,r;return t?(r=new function(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new d.Buf16(320),this.work=new d.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},t.state=r,r.window=null,(i=s(t,e))!==w&&(t.state=null),i):R}function l(t){if(dt){var e;for(u=new d.Buf32(512),c=new d.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(m(E,t.lens,0,288,u,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;m(v,t.lens,0,32,c,0,t.work,{bits:5}),dt=!1}t.lencode=u,t.lenbits=9,t.distcode=c,t.distbits=5}function h(t,e,i,r){var n,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(d.arraySet(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),d.arraySet(o.window,e,i-r,n,o.wnext),(r-=n)?(d.arraySet(o.window,e,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,i.check=f(i.check,xt,2,0),ht=0,ut=0,i.mode=N;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&ht)<<8)+(ht>>8))%31){t.msg="incorrect header check",i.mode=st;break}if((15&ht)!==A){t.msg="unknown compression method",i.mode=st;break}if(ut-=4,St=8+(15&(ht>>>=4)),0===i.wbits)i.wbits=St;else if(St>i.wbits){t.msg="invalid window size",i.mode=st;break}i.dmax=1<>8&1),512&i.flags&&(xt[0]=255&ht,xt[1]=ht>>>8&255,i.check=f(i.check,xt,2,0)),ht=0,ut=0,i.mode=O;case O:for(;ut<32;){if(0===u)break t;u--,ht+=n[s++]<>>8&255, -xt[2]=ht>>>16&255,xt[3]=ht>>>24&255,i.check=f(i.check,xt,4,0)),ht=0,ut=0,i.mode=I;case I:for(;ut<16;){if(0===u)break t;u--,ht+=n[s++]<>8),512&i.flags&&(xt[0]=255&ht,xt[1]=ht>>>8&255,i.check=f(i.check,xt,2,0)),ht=0,ut=0,i.mode=D;case D:if(1024&i.flags){for(;ut<16;){if(0===u)break t;u--,ht+=n[s++]<>>8&255,i.check=f(i.check,xt,2,0)),ht=0,ut=0}else i.head&&(i.head.extra=null);i.mode=k;case k:if(1024&i.flags&&((pt=i.length)>u&&(pt=u),pt&&(i.head&&(St=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),d.arraySet(i.head.extra,n,s,pt,St)),512&i.flags&&(i.check=f(i.check,n,pt,s)),u-=pt,s+=pt,i.length-=pt),i.length))break t;i.length=0,i.mode=V;case V:if(2048&i.flags){if(0===u)break t;pt=0;do St=n[s+pt++],i.head&&St&&i.length<65536&&(i.head.name+=String.fromCharCode(St));while(St&&pt>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=U;break;case W:for(;ut<32;){if(0===u)break t;u--,ht+=n[s++]<>>=7&ut,ut-=7&ut,i.mode=rt;break}for(;ut<3;){if(0===u)break t;u--,ht+=n[s++]<>>=1)){case 0:i.mode=j;break;case 1:if(l(i),i.mode=J,e===S){ht>>>=2,ut-=2;break t}break;case 2:i.mode=q;break;case 3:t.msg="invalid block type",i.mode=st}ht>>>=2,ut-=2;break;case j:for(ht>>>=7&ut,ut-=7&ut;ut<32;){if(0===u)break t;u--,ht+=n[s++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=st;break}if(i.length=65535&ht,ht=0,ut=0,i.mode=z,e===S)break t;case z:i.mode=H;case H:if(pt=i.length){if(pt>u&&(pt=u),pt>c&&(pt=c),0===pt)break t;d.arraySet(o,n,s,pt,a),u-=pt,s+=pt,c-=pt,a+=pt,i.length-=pt;break}i.mode=U;break;case q:for(;ut<14;){if(0===u)break t;u--,ht+=n[s++]<>>=5,ut-=5,i.ndist=1+(31&ht),ht>>>=5,ut-=5,i.ncode=4+(15&ht),ht>>>=4,ut-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=st;break}i.have=0,i.mode=Y;case Y:for(;i.have>>=3,ut-=3}for(;i.have<19;)i.lens[Mt[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,Lt={bits:i.lenbits},wt=m(y,i.lens,0,19,i.lencode,0,i.work,Lt),i.lenbits=Lt.bits,wt){t.msg="invalid code lengths set",i.mode=st;break}i.have=0,i.mode=X;case X:for(;i.have>>16&255,Et=65535&Rt,!((mt=Rt>>>24)<=ut);){if(0===u)break t;u--,ht+=n[s++]<>>=mt,ut-=mt,i.lens[i.have++]=Et;else{if(16===Et){for(Tt=mt+2;ut>>=mt,ut-=mt,0===i.have){t.msg="invalid bit length repeat",i.mode=st;break}St=i.lens[i.have-1],pt=3+(3&ht),ht>>>=2,ut-=2}else if(17===Et){for(Tt=mt+3;ut>>=mt)),ht>>>=3,ut-=3}else{for(Tt=mt+7;ut>>=mt)),ht>>>=7,ut-=7}if(i.have+pt>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=st;break}for(;pt--;)i.lens[i.have++]=St}}if(i.mode===st)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=st;break}if(i.lenbits=9,Lt={bits:i.lenbits},wt=m(E,i.lens,0,i.nlen,i.lencode,0,i.work,Lt),i.lenbits=Lt.bits,wt){t.msg="invalid literal/lengths set",i.mode=st;break}if(i.distbits=6,i.distcode=i.distdyn,Lt={bits:i.distbits},wt=m(v,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Lt),i.distbits=Lt.bits,wt){t.msg="invalid distances set",i.mode=st;break}if(i.mode=J,e===S)break t;case J:i.mode=Z;case Z:if(u>=6&&c>=258){t.next_out=a,t.avail_out=c,t.next_in=s,t.avail_in=u,i.hold=ht,i.bits=ut,g(t,dt),a=t.next_out,o=t.output,c=t.avail_out,s=t.next_in,n=t.input,u=t.avail_in,ht=i.hold,ut=i.bits,i.mode===U&&(i.back=-1);break}for(i.back=0;yt=(Rt=i.lencode[ht&(1<>>16&255,Et=65535&Rt,!((mt=Rt>>>24)<=ut);){if(0===u)break t;u--,ht+=n[s++]<>vt)])>>>16&255,Et=65535&Rt,!(vt+(mt=Rt>>>24)<=ut);){if(0===u)break t;u--,ht+=n[s++]<>>=vt,ut-=vt,i.back+=vt}if(ht>>>=mt,ut-=mt,i.back+=mt,i.length=Et,0===yt){i.mode=it;break}if(32&yt){i.back=-1,i.mode=U;break}if(64&yt){t.msg="invalid literal/length code",i.mode=st;break}i.extra=15&yt,i.mode=Q;case Q:if(i.extra){for(Tt=i.extra;ut>>=i.extra,ut-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=$;case $:for(;yt=(Rt=i.distcode[ht&(1<>>16&255,Et=65535&Rt,!((mt=Rt>>>24)<=ut);){if(0===u)break t;u--,ht+=n[s++]<>vt)])>>>16&255,Et=65535&Rt,!(vt+(mt=Rt>>>24)<=ut);){if(0===u)break t;u--,ht+=n[s++]<>>=vt,ut-=vt,i.back+=vt}if(ht>>>=mt,ut-=mt,i.back+=mt,64&yt){t.msg="invalid distance code",i.mode=st;break}i.offset=Et,i.extra=15&yt,i.mode=tt;case tt:if(i.extra){for(Tt=i.extra;ut>>=i.extra,ut-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=st;break}i.mode=et;case et:if(0===c)break t;if(pt=dt-c,i.offset>pt){if((pt=i.offset-pt)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=st;break}pt>i.wnext?(pt-=i.wnext,ft=i.wsize-pt):ft=i.wnext-pt,pt>i.length&&(pt=i.length),gt=i.window}else gt=o,ft=a-i.offset,pt=i.length;pt>c&&(pt=c),c-=pt,i.length-=pt;do o[a++]=gt[ft++];while(--pt);0===i.length&&(i.mode=Z);break;case it:if(0===c)break t;o[a++]=i.length,c--,i.mode=Z;break;case rt:if(i.wrap){for(;ut<32;){if(0===u)break t;u--,ht|=n[s++]<=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var i=o.inflateInit2(this.strm,e.windowBits);if(i!==l.Z_OK)throw new Error(h[i]);this.header=new c,o.inflateGetHeader(this.strm,this.header)}function n(t,e){var i=new r(e);if(i.push(t,!0),i.err)throw i.msg||h[i.err];return i.result}var o=i(62),s=i(2),a=i(31),l=i(29),h=i(16),u=i(30),c=i(59),d=Object.prototype.toString;r.prototype.push=function(t,e){var i,r,n,h,u,c,p=this.strm,f=this.options.chunkSize,g=this.options.dictionary,m=!1;if(this.ended)return!1;r=e===~~e?e:!0===e?l.Z_FINISH:l.Z_NO_FLUSH,"string"==typeof t?p.input=a.binstring2buf(t):"[object ArrayBuffer]"===d.call(t)?p.input=new Uint8Array(t):p.input=t,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new s.Buf8(f),p.next_out=0,p.avail_out=f),(i=o.inflate(p,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&g&&(c="string"==typeof g?a.string2buf(g):"[object ArrayBuffer]"===d.call(g)?new Uint8Array(g):g,i=o.inflateSetDictionary(this.strm,c)),i===l.Z_BUF_ERROR&&!0===m&&(i=l.Z_OK,m=!1),i!==l.Z_STREAM_END&&i!==l.Z_OK)return this.onEnd(i),this.ended=!0,!1;p.next_out&&(0!==p.avail_out&&i!==l.Z_STREAM_END&&(0!==p.avail_in||r!==l.Z_FINISH&&r!==l.Z_SYNC_FLUSH)||("string"===this.options.to?(n=a.utf8border(p.output,p.next_out),h=p.next_out-n,u=a.buf2string(p.output,n),p.next_out=h,p.avail_out=f-h,h&&s.arraySet(p.output,p.output,n,h,0),this.onData(u)):this.onData(s.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(m=!0)}while((p.avail_in>0||0===p.avail_out)&&i!==l.Z_STREAM_END);return i===l.Z_STREAM_END&&(r=l.Z_FINISH),r===l.Z_FINISH?(i=o.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===l.Z_OK):r!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),p.avail_out=0,!0)},r.prototype.onData=function(t){this.chunks.push(t)},r.prototype.onEnd=function(t){t===l.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=r,e.inflate=n,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,n(t,e)},e.ungzip=n},function(t,e,i){"use strict";function r(t){for(var e=t.length;--e>=0;)t[e]=0}function n(t,e,i,r,n){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=t&&t.length}function o(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function s(t){return t<256?Y[t]:Y[256+(t>>>7)]}function a(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function l(t,e,i){t.bi_valid>k-i?(t.bi_buf|=e<>k-t.bi_valid,t.bi_valid+=i-k):(t.bi_buf|=e<>>=1,i<<=1;while(--e>0);return i>>>1}function c(t,e,i){var r,n,o=new Array(D+1),s=0;for(r=1;r<=D;r++)o[r]=s=s+i[r-1]<<1;for(n=0;n<=e;n++){var a=t[2*n+1];0!==a&&(t[2*n]=u(o[a]++,a))}}function d(t){var e;for(e=0;e8?a(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function f(t,e,i,r){var n=2*e,o=2*i;return t[n]>1;i>=1;i--)g(t,o,i);n=l;do i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],g(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,o[2*n]=o[2*i]+o[2*r],t.depth[n]=(t.depth[i]>=t.depth[r]?t.depth[i]:t.depth[r])+1,o[2*i+1]=o[2*r+1]=n,t.heap[1]=n++,g(t,o,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var i,r,n,o,s,a,l=e.dyn_tree,h=e.max_code,u=e.stat_desc.static_tree,c=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,f=e.stat_desc.max_length,g=0;for(o=0;o<=D;o++)t.bl_count[o]=0;for(l[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;if&&(o=f,g++),l[2*r+1]=o,r>h||(t.bl_count[o]++,s=0,r>=p&&(s=d[r-p]),a=l[2*r],t.opt_len+=a*(o+s),c&&(t.static_len+=a*(u[2*r+1]+s)));if(0!==g){do{for(o=f-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[f]--,g-=2}while(g>0);for(o=f;0!==o;o--)for(r=t.bl_count[o];0!==r;)(n=t.heap[--i])>h||(l[2*n+1]!==o&&(t.opt_len+=(o-l[2*n+1])*l[2*n],l[2*n+1]=o),r--)}}(t,e),c(o,h,t.bl_count)}function E(t,e,i){var r,n,o=-1,s=e[1],a=0,l=7,h=4;for(0===s&&(l=138,h=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)n=s,s=e[2*(r+1)+1],++a>=7;r0?(t.strm.data_type===T&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return w;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return L;for(e=32;e=3&&0===t.bl_tree[2*z[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==e?_(t,e,i,r):t.strategy===S||o===n?(l(t,(x<<1)+(r?1:0),3),m(t,H,q)):(l(t,(M<<1)+(r?1:0),3),function(t,e,i,r){var n;for(l(t,e-257,5),l(t,i-1,5),l(t,r-4,4),n=0;n>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(X[i]+A+1)]++,t.dyn_dtree[2*s(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){l(t,x<<1,3),h(t,F,H),function(t){16===t.bi_valid?(a(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},function(t,e,i){"use strict";function r(t,e){return t.msg=L[e],e}function n(t){return(t<<1)-(t>4?9:0)}function o(t){for(var e=t.length;--e>=0;)t[e]=0}function s(t){var e=t.state,i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(_.arraySet(t.output,e.pending_buf,e.pending_out,i,t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))}function a(t,e){b._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,s(t.strm)}function l(t,e){t.pending_buf[t.pending++]=e}function h(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function u(t,e,i,r){var n=t.avail_in;return n>r&&(n=r),0===n?0:(t.avail_in-=n,_.arraySet(e,t.input,t.next_in,n,i),1===t.state.wrap?t.adler=S(t.adler,e,n,i):2===t.state.wrap&&(t.adler=w(t.adler,e,n,i)),t.next_in+=n,t.total_in+=n,n)}function c(t,e){var i,r,n=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match,l=t.strstart>t.w_size-$?t.strstart-(t.w_size-$):0,h=t.window,u=t.w_mask,c=t.prev,d=t.strstart+Q,p=h[o+s-1],f=h[o+s];t.prev_length>=t.good_match&&(n>>=2),a>t.lookahead&&(a=t.lookahead);do if(h[(i=e)+s]===f&&h[i+s-1]===p&&h[i]===h[o]&&h[++i]===h[o+1]){o+=2,i++;do;while(h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&os){if(t.match_start=e,s=r,r>=a)break;p=h[o+s-1],f=h[o+s]}}while((e=c[e&u])>l&&0!=--n);return s<=t.lookahead?s:t.lookahead}function d(t){var e,i,r,n,o,s=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-$)){_.arraySet(t.window,t.window,s,s,0),t.match_start-=s,t.strstart-=s,t.block_start-=s,e=i=t.hash_size;do r=t.head[--e],t.head[e]=r>=s?r-s:0;while(--i);e=i=s;do r=t.prev[--e],t.prev[e]=r>=s?r-s:0;while(--i);n+=s}if(0===t.strm.avail_in)break;if(i=u(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=Z)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<=Z&&(t.ins_h=(t.ins_h<=Z)if(r=b._tr_tally(t,t.strstart-t.match_start,t.match_length-Z),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Z){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=Z&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=Z-1)),t.prev_length>=Z&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-Z,r=b._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-Z),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=(t.ins_h<15&&(l=2,n-=16),s<1||s>K||i!==U||n<8||n>15||e<0||e>9||a<0||a>G)return r(t,N);8===n&&(n=9);var h=new function(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=U,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new _.Buf16(2*X),this.dyn_dtree=new _.Buf16(2*(2*q+1)),this.bl_tree=new _.Buf16(2*(2*Y+1)),o(this.dyn_ltree),o(this.dyn_dtree),o(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new _.Buf16(J+1),this.heap=new _.Buf16(2*H+1),o(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new _.Buf16(2*H+1),o(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0};return t.state=h,h.strm=t,h.wrap=l,h.gzhead=null,h.w_bits=n,h.w_size=1<t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(d(t),0===t.lookahead&&e===T)return lt;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+i;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,a(t,!1),0===t.strm.avail_out))return lt;if(t.strstart-t.block_start>=t.w_size-$&&(a(t,!1),0===t.strm.avail_out))return lt}return t.insert=0,e===M?(a(t,!0),0===t.strm.avail_out?ut:ct):(t.strstart>t.block_start&&(a(t,!1),t.strm.avail_out),lt)}),new g(4,4,8,4,p),new g(4,5,16,8,p),new g(4,6,32,32,p),new g(4,4,16,16,f),new g(8,16,32,32,f),new g(8,16,128,128,f),new g(8,32,128,256,f),new g(32,128,258,1024,f),new g(32,258,258,4096,f)],e.deflateInit=function(t,e){return E(t,e,U,j,z,W)},e.deflateInit2=E,e.deflateReset=y,e.deflateResetKeep=m,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?N:(t.state.gzhead=e,A):N},e.deflate=function(t,e){var i,u,c,p;if(!t||!t.state||e>C||e<0)return t?r(t,N):N;if(u=t.state,!t.output||!t.input&&0!==t.avail_in||u.status===at&&e!==M)return r(t,0===t.avail_out?I:N);if(u.strm=t,i=u.last_flush,u.last_flush=e,u.status===et)if(2===u.wrap)t.adler=0,l(u,31),l(u,139),l(u,8),u.gzhead?(l(u,(u.gzhead.text?1:0)+(u.gzhead.hcrc?2:0)+(u.gzhead.extra?4:0)+(u.gzhead.name?8:0)+(u.gzhead.comment?16:0)),l(u,255&u.gzhead.time),l(u,u.gzhead.time>>8&255),l(u,u.gzhead.time>>16&255),l(u,u.gzhead.time>>24&255),l(u,9===u.level?2:u.strategy>=V||u.level<2?4:0),l(u,255&u.gzhead.os),u.gzhead.extra&&u.gzhead.extra.length&&(l(u,255&u.gzhead.extra.length),l(u,u.gzhead.extra.length>>8&255)),u.gzhead.hcrc&&(t.adler=w(t.adler,u.pending_buf,u.pending,0)),u.gzindex=0,u.status=it):(l(u,0),l(u,0),l(u,0),l(u,0),l(u,0),l(u,9===u.level?2:u.strategy>=V||u.level<2?4:0),l(u,dt),u.status=st);else{var f=U+(u.w_bits-8<<4)<<8;f|=(u.strategy>=V||u.level<2?0:u.level<6?1:6===u.level?2:3)<<6,0!==u.strstart&&(f|=tt),f+=31-f%31,u.status=st,h(u,f),0!==u.strstart&&(h(u,t.adler>>>16),h(u,65535&t.adler)),t.adler=1}if(u.status===it)if(u.gzhead.extra){for(c=u.pending;u.gzindex<(65535&u.gzhead.extra.length)&&(u.pending!==u.pending_buf_size||(u.gzhead.hcrc&&u.pending>c&&(t.adler=w(t.adler,u.pending_buf,u.pending-c,c)),s(t),c=u.pending,u.pending!==u.pending_buf_size));)l(u,255&u.gzhead.extra[u.gzindex]),u.gzindex++;u.gzhead.hcrc&&u.pending>c&&(t.adler=w(t.adler,u.pending_buf,u.pending-c,c)),u.gzindex===u.gzhead.extra.length&&(u.gzindex=0,u.status=rt)}else u.status=rt;if(u.status===rt)if(u.gzhead.name){c=u.pending;do{if(u.pending===u.pending_buf_size&&(u.gzhead.hcrc&&u.pending>c&&(t.adler=w(t.adler,u.pending_buf,u.pending-c,c)),s(t),c=u.pending,u.pending===u.pending_buf_size)){p=1;break}p=u.gzindexc&&(t.adler=w(t.adler,u.pending_buf,u.pending-c,c)),0===p&&(u.gzindex=0,u.status=nt)}else u.status=nt;if(u.status===nt)if(u.gzhead.comment){c=u.pending;do{if(u.pending===u.pending_buf_size&&(u.gzhead.hcrc&&u.pending>c&&(t.adler=w(t.adler,u.pending_buf,u.pending-c,c)),s(t),c=u.pending,u.pending===u.pending_buf_size)){p=1;break}p=u.gzindexc&&(t.adler=w(t.adler,u.pending_buf,u.pending-c,c)),0===p&&(u.status=ot)}else u.status=ot;if(u.status===ot&&(u.gzhead.hcrc?(u.pending+2>u.pending_buf_size&&s(t),u.pending+2<=u.pending_buf_size&&(l(u,255&t.adler),l(u,t.adler>>8&255),t.adler=0,u.status=st)):u.status=st),0!==u.pending){if(s(t),0===t.avail_out)return u.last_flush=-1,A}else if(0===t.avail_in&&n(e)<=n(i)&&e!==M)return r(t,I);if(u.status===at&&0!==t.avail_in)return r(t,I);if(0!==t.avail_in||0!==u.lookahead||e!==T&&u.status!==at){var g=u.strategy===V?function(t,e){for(var i;;){if(0===t.lookahead&&(d(t),0===t.lookahead)){if(e===T)return lt;break}if(t.match_length=0,i=b._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(a(t,!1),0===t.strm.avail_out))return lt}return t.insert=0,e===M?(a(t,!0),0===t.strm.avail_out?ut:ct):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?lt:ht}(u,e):u.strategy===F?function(t,e){for(var i,r,n,o,s=t.window;;){if(t.lookahead<=Q){if(d(t),t.lookahead<=Q&&e===T)return lt;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=Z&&t.strstart>0&&(r=s[n=t.strstart-1])===s[++n]&&r===s[++n]&&r===s[++n]){o=t.strstart+Q;do;while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Z?(i=b._tr_tally(t,1,t.match_length-Z),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=b._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(a(t,!1),0===t.strm.avail_out))return lt}return t.insert=0,e===M?(a(t,!0),0===t.strm.avail_out?ut:ct):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?lt:ht}(u,e):v[u.level].func(u,e);if(g!==ut&&g!==ct||(u.status=at),g===lt||g===ut)return 0===t.avail_out&&(u.last_flush=-1),A;if(g===ht&&(e===R?b._tr_align(u):e!==C&&(b._tr_stored_block(u,0,0,!1),e===x&&(o(u.head),0===u.lookahead&&(u.strstart=0,u.block_start=0,u.insert=0))),s(t),0===t.avail_out))return u.last_flush=-1,A}return e!==M?A:u.wrap<=0?P:(2===u.wrap?(l(u,255&t.adler),l(u,t.adler>>8&255),l(u,t.adler>>16&255),l(u,t.adler>>24&255),l(u,255&t.total_in),l(u,t.total_in>>8&255),l(u,t.total_in>>16&255),l(u,t.total_in>>24&255)):(h(u,t.adler>>>16),h(u,65535&t.adler)),s(t),u.wrap>0&&(u.wrap=-u.wrap),0!==u.pending?A:P)},e.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==et&&e!==it&&e!==rt&&e!==nt&&e!==ot&&e!==st&&e!==at?r(t,N):(t.state=null,e===st?r(t,O):A):N},e.deflateSetDictionary=function(t,e){var i,r,n,s,a,l,h,u,c=e.length;if(!t||!t.state)return N;if(2===(s=(i=t.state).wrap)||1===s&&i.status!==et||i.lookahead)return N;for(1===s&&(t.adler=S(t.adler,e,c,0)),i.wrap=0,c>=i.w_size&&(0===s&&(o(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new _.Buf8(i.w_size),_.arraySet(u,e,c-i.w_size,i.w_size,0),e=u,c=i.w_size),a=t.avail_in,l=t.next_in,h=t.input,t.avail_in=c,t.next_in=0,t.input=e,d(i);i.lookahead>=Z;){r=i.strstart,n=i.lookahead-(Z-1);do i.ins_h=(i.ins_h<0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var i=o.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==c)throw new Error(l[i]);if(e.header&&o.deflateSetHeader(this.strm,e.header),e.dictionary){var n;if(n="string"==typeof e.dictionary?a.string2buf(e.dictionary):"[object ArrayBuffer]"===u.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary, +this.hasCapTexture()&&a.disableVertexAttribArray(l.vertexTexCoordLocation),this.activeAttributes.applyLighting&&a.disableVertexAttribArray(l.normalVectorLocation),h.boundaryVboCacheKeys||(this.currentData.boundaryVboCacheKeys=[]),this.applyMvpMatrixForOutline(t),l.loadTextureEnabled(a,!1),a.disableVertexAttribArray(l.vertexTexCoordLocation);for(var c=0;c=1||t.pickingMode),l.loadColor(a,t.pickingMode?e:n),l.loadOpacity(a,t.pickingMode?1:this.layer.opacity),a.lineWidth(this.activeAttributes.outlineWidth),this._extrude?(o=24,s=i/2):(o=12,s=i),a.vertexAttribPointer(l.vertexPointLocation,3,a.FLOAT,!1,o,0),a.drawArrays(a.LINE_STRIP,0,s),this.mustDrawVerticals(t)&&(a.vertexAttribPointer(l.vertexPointLocation,3,a.FLOAT,!1,0,0),a.drawArrays(a.LINES,0,i-2))},y.prototype.beginDrawing=function(t){var e=t.currentGlContext;this.activeAttributes.drawInterior&&e.disable(e.CULL_FACE),t.findAndBindProgram(i),e.enableVertexAttribArray(t.currentProgram.vertexPointLocation);var r=!t.pickMode&&this.activeAttributes.applyLighting;r&&t.currentProgram.loadModelviewInverse(e,t.modelviewNormalTransform)},y.prototype.endDrawing=function(t){var e=t.currentGlContext;e.disableVertexAttribArray(t.currentProgram.vertexPointLocation),e.disableVertexAttribArray(t.currentProgram.normalVectorLocation),e.depthMask(!0),e.lineWidth(1),e.enable(e.CULL_FACE)},y}),i("shapes/SurfacePolyline",["../error/ArgumentError","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r){"use strict";var n=function(i,o){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfacePolyline","constructor","The specified locations array is null or undefined."));r.call(this,o),this._boundaries=i,this._stateId=n.stateId++,this._isInteriorInhibited=!0};return n.prototype=Object.create(r.prototype),Object.defineProperties(n.prototype,{boundaries:{get:function(){return this._boundaries},set:function(i){if(!Array.isArray(i))throw new t(e.logMessage(e.LEVEL_SEVERE,"SurfacePolyline","set boundaries","The specified value is not an array."));this.resetBoundaries(),this._boundaries=i,this._stateId=n.stateId++,this.stateKeyInvalid=!0}}}),n.stateId=Number.MIN_SAFE_INTEGER,n.staticStateKey=function(t){var e=r.staticStateKey(t);return e+" pl "+t._stateId},n.prototype.computeStateKey=function(){return n.staticStateKey(this)},n.prototype.computeBoundaries=function(t){},n.prototype.getReferencePosition=function(){return this.boundaries.length>1?this.boundaries[0]:null},n.prototype.moveTo=function(t,e){this.boundaries=this.computeShiftedLocations(t,this.getReferencePosition(),e,this._boundaries)},n}),i("formats/geojson/GeoJSONParser",["../../error/ArgumentError","../../util/Color","./GeoJSONConstants","./GeoJSONCRS","./GeoJSONFeature","./GeoJSONFeatureCollection","./GeoJSONGeometry","./GeoJSONGeometryCollection","./GeoJSONGeometryLineString","./GeoJSONGeometryMultiLineString","./GeoJSONGeometryMultiPoint","./GeoJSONGeometryMultiPolygon","./GeoJSONGeometryPoint","./GeoJSONGeometryPolygon","../../geom/Location","../../util/Logger","../../shapes/Placemark","../../shapes/PlacemarkAttributes","../../shapes/Polygon","../../geom/Position","../../util/proj4-src","../../layer/RenderableLayer","../../shapes/ShapeAttributes","../../shapes/SurfacePolygon","../../shapes/SurfacePolyline"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_,b,w,S,L){"use strict";var T=function(e){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","constructor","missingDataSource"));this._dataSource=e,this._geoJSONObject=null,this._geoJSONType=null,this._crs=null,this._layer=null,this._parserCompletionCallback=null,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this.defaultPlacemarkAttributes=new y(null),this.defaultShapeAttributes=new w(null),this.setProj4jsAliases()};return Object.defineProperties(T.prototype,{dataSource:{get:function(){return this._dataSource}},geoJSONObject:{get:function(){return this._geoJSONObject}},geoJSONType:{get:function(){return this._geoJSONType}},crs:{get:function(){return this._crs}},layer:{get:function(){return this._layer}},parserCompletionCallback:{get:function(){return this._parserCompletionCallback}},shapeConfigurationCallback:{get:function(){return this._shapeConfigurationCallback}}}),T.prototype.load=function(t,e,i){t&&(this._parserCompletionCallback=t),e&&(this._shapeConfigurationCallback=e),this._layer=i||new b;var r=typeof this.dataSource;if("string"===r){var n=T.tryParseJSONString(this.dataSource);null!==n?this.handle(n):this.requestUrl(this.dataSource)}else"object"===r?this.handle(this.dataSource):g.logMessage(g.LEVEL_SEVERE,"GeoJSON","load","Unsupported data source type: "+r)},T.prototype.defaultShapeConfigurationCallback=function(t,e){var i={},r=e.name||e.Name||e.NAME;return r&&(i.name=r),t.isPointType()||t.isMultiPointType()?i.attributes=this.defaultPlacemarkAttributes:t.isLineStringType()||t.isMultiLineStringType()?i.attributes=this.defaultShapeAttributes:(t.isPolygonType()||t.isMultiPolygonType())&&(i.attributes=this.defaultShapeAttributes),i},T.prototype.requestUrl=function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="text",e.onreadystatechange=function(){4===e.readyState&&(200===e.status?this.handle(T.tryParseJSONString(e.response)):g.log(g.LEVEL_WARNING,"GeoJSON retrieval failed ("+e.statusText+"): "+t))}.bind(this),e.onerror=function(){g.log(g.LEVEL_WARNING,"GeoJSON retrieval failed: "+t)},e.ontimeout=function(){g.log(g.LEVEL_WARNING,"GeoJSON retrieval timed out: "+t)},e.send(null)},T.prototype.handle=function(e){if(e||g.logMessage(g.LEVEL_SEVERE,"GeoJSON","handle","Invalid GeoJSON object"),this._geoJSONObject=e,"[object Array]"===Object.prototype.toString.call(this.geoJSONObject))throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","handle","invalidGeoJSONObjectLength"));if(!this.geoJSONObject.hasOwnProperty(i.FIELD_TYPE))throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","handle","missingGeoJSONType"));this.setGeoJSONType(),this.setGeoJSONCRS(),this._parserCompletionCallback&&"function"==typeof this._parserCompletionCallback&&this._parserCompletionCallback(this.layer)},T.prototype.setGeoJSONCRS=function(){if(this.geoJSONObject[i.FIELD_CRS]){this._crs=new r(this.geoJSONObject[i.FIELD_CRS][i.FIELD_TYPE],this.geoJSONObject[i.FIELD_CRS][i.FIELD_PROPERTIES]);var t=function(){this.addRenderablesForGeoJSON(this.layer)}.bind(this);this.crs.setCRSString(t)}else this.addRenderablesForGeoJSON(this.layer)},T.prototype.addRenderablesForGeoJSON=function(e){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeoJSON","missingLayer"));switch(this.geoJSONType){case i.TYPE_FEATURE:var r=new n(this.geoJSONObject[i.FIELD_GEOMETRY],this.geoJSONObject[i.FIELD_PROPERTIES],this.geoJSONObject[i.FIELD_ID],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForFeature(e,r);break;case i.TYPE_FEATURE_COLLECTION:var s=new o(this.geoJSONObject[i.FIELD_FEATURES],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForFeatureCollection(e,s);break;case i.TYPE_GEOMETRY_COLLECTION:var l=new a(this.geoJSONObject[i.FIELD_GEOMETRIES],this.geoJSONObject[i.FIELD_BBOX]);this.addRenderablesForGeometryCollection(e,l,null);break;default:this.addRenderablesForGeometry(e,this.geoJSONObject,null)}},T.prototype.addRenderablesForGeometry=function(e,r,n){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometry","missingLayer"));if(!r)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForGeometry","missingGeometry"));switch(r[i.FIELD_TYPE]){case i.TYPE_POINT:var o=new d(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForPoint(e,o,n?n:null);break;case i.TYPE_MULTI_POINT:var s=new u(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiPoint(e,s,n?n:null);break;case i.TYPE_LINE_STRING:var a=new l(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForLineString(e,a,n?n:null);break;case i.TYPE_MULTI_LINE_STRING:var f=new h(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiLineString(e,f,n?n:null);break;case i.TYPE_POLYGON:var m=new p(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForPolygon(e,m,n?n:null);break;case i.TYPE_MULTI_POLYGON:var y=new c(r[i.FIELD_COORDINATES],r[i.FIELD_TYPE],r[i.FIELD_BBOX]);this.addRenderablesForMultiPolygon(e,y,n?n:null)}},T.prototype.addRenderablesForPoint=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForPoint","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForPoint","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported()){var o=i.coordinates[0],s=i.coordinates[1],a=i.coordinates[2]?i.coordinates[2]:0,l=this.getReprojectedIfRequired(s,o,this.crs),h=new v(l[1],l[0],a),u=new m(h,!1,n&&n.attributes?n.attributes:null);u.altitudeMode=WorldWind.RELATIVE_TO_GROUND,n&&n.name&&(u.label=n.name),n.highlightAttributes&&(u.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(u.pickDelegate=n.pickDelegate),n&&n.userProperties&&(u.userProperties=n.userProperties),e.addRenderable(u)}},T.prototype.addRenderablesForMultiPoint=function(e,i,r){if(!e)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPoint","missingLayer"));if(!i)throw new t(g.logMessage(g.LEVEL_SEVERE,"GeoJSON","addRenderablesForMultiPoint","missingGeometry"));var n=this.shapeConfigurationCallback(i,r);if(!this.crs||this.crs.isCRSSupported())for(var o=0,s=i.coordinates.length;o0)for(var o=0;o1?s-1:1),S=(b-_)/(a>1?a-1:1),L=h?h:new n(0,0,0),T=u?u[0]:0,R=0,x=0;for(d=0,f=E;dthis.startPosition.altitude?(s=Math.max(0,this.maxAltitude-this.startPosition.altitude),s+=Math.abs(this.targetPosition.altitude-this.maxAltitude)):s=Math.abs(this.targetPosition.altitude-this.startPosition.altitude);var d=Math.max(l,s/this.wwd.globe.equatorialRadius);if(0!==d){d<2*c&&(a=Math.min(d/c*this.travelTime,this.travelTime)),a=Math.max(1,a),this.panVelocity=l/a,this.rangeVelocity=s/a;var p=this,f=function(){return p.cancelled?void(p.completionCallback&&p.completionCallback(p)):void(p.update()?setTimeout(f,p.animationFrequency):p.completionCallback&&p.completionCallback(p))};setTimeout(f,this.animationFrequency)}},n.prototype.update=function(){var t=new i(this.wwd.navigator.lookAtLocation.latitude,this.wwd.navigator.lookAtLocation.longitude,this.wwd.navigator.range),e=this.updateRange(t);return e=this.updateLocation(t)||e,this.wwd.redraw(),e},n.prototype.updateRange=function(t){var e,i,r=!1;return this.maxAltitudeReachedTime?(i=Date.now()-this.maxAltitudeReachedTime,this.maxAltitude>this.targetPosition.altitude?(e=this.maxAltitude-this.rangeVelocity*i,e=Math.max(e,this.targetPosition.altitude)):(e=this.maxAltitude+this.rangeVelocity*i,e=Math.min(e,this.targetPosition.altitude)),this.wwd.navigator.range=e,r=Math.abs(this.wwd.navigator.range-this.targetPosition.altitude)>1):(i=Date.now()-this.startTime,e=Math.min(this.startPosition.altitude+this.rangeVelocity*i,this.maxAltitude),Math.abs(this.wwd.navigator.range-e)<1&&(this.maxAltitudeReachedTime=Date.now()),this.wwd.navigator.range=e,r=!0),r},n.prototype.updateLocation=function(e){var i=Date.now()-this.startTime,r=t.greatCircleDistance(this.startPosition,e),n=t.greatCircleDistance(e,this.targetPosition),o=t.greatCircleAzimuth(e,this.targetPosition),s=this.panVelocity*i,a=Math.min(s-r,n),l=t.greatCircleLocation(e,o,a,new t(0,0)),h=!1;return this.wwd.navigator.lookAtLocation.latitude=l.latitude,this.wwd.navigator.lookAtLocation.longitude=l.longitude,a<1/this.wwd.globe.equatorialRadius&&(h=!0),!h},n}),i("layer/heatmap/HeatMapTile",[],function(){var t=function(t,e){this._data=t,this._sector=e.sector,this._canvas=this.createCanvas(e.width,e.height),this._width=e.width,this._height=e.height,this._intensityGradient=e.intensityGradient,this._radius=e.radius,this._incrementPerIntensity=e.incrementPerIntensity};return t.prototype.url=function(){return this.draw().toDataURL()},t.prototype.canvas=function(){return this.draw()},t.prototype.draw=function(){var t=[];for(var e in this._intensityGradient)this._intensityGradient.hasOwnProperty(e)&&t.push({shape:this.shape(e),min:e});for(var i,r=this._canvas.getContext("2d"),n=null,o=0;ot.min&&(n=t.shape)}),r.drawImage(n,this.longitudeInSector(s,this._sector,this._width)-n.width/2,this._height-this.latitudeInSector(s,this._sector,this._height)-n.height/2)}return this._canvas},t.prototype.createCanvas=function(t,e){var i=document.createElement("canvas");return i.width=t,i.height=e,i},t.prototype.shape=function(t){var e=this.createCanvas(2*this._radius,2*this._radius),i=e.getContext("2d"),r=i.createRadialGradient(this._radius,this._radius,0,this._radius,this._radius,this._radius);return r.addColorStop(0,"rgba(0,0,0,"+t+")"),r.addColorStop(1,"rgba(0,0,0,0)"),i.beginPath(),i.arc(this._radius,this._radius,this._radius,0,2*Math.PI,!0),i.fillStyle=r,i.fill(),i.closePath(),e},t.prototype.latitudeInSector=function(t,e,i){var r=e.maxLatitude-e.minLatitude,n=t.latitude-e.minLatitude;return Math.ceil(n/r*i)},t.prototype.longitudeInSector=function(t,e,i){var r=e.maxLongitude-e.minLongitude,n=t.longitude-e.minLongitude;return Math.ceil(n/r*i)},t}),i("layer/heatmap/HeatMapColoredTile",["./HeatMapTile"],function(t){var e=function(e,i){t.call(this,e,i),this._extendedWidth=i.extendedWidth,this._extendedHeight=i.extendedHeight,this._gradient=this.gradient(i.intensityGradient)};return e.prototype=Object.create(t.prototype),e.prototype.draw=function(){var e=t.prototype.draw.call(this),i=e.getContext("2d"),r=0,n=0,o=this._width,s=this._height;this._extendedHeight&&(r=this._extendedHeight,s=this._height-2*this._extendedHeight),this._extendedWidth&&(n=this._extendedWidth,o=this._width-2*this._extendedWidth);var a=i.getImageData(r,n,o,s);return this.colorize(a.data,this._gradient),i.putImageData(a,r,n),e},e.prototype.gradient=function(t){var e=this.createCanvas(1,256),i=e.getContext("2d"),r=i.createLinearGradient(0,0,0,256);for(var n in t)r.addColorStop(+n,t[n]);return i.fillStyle=r,i.fillRect(0,0,1,256),i.getImageData(0,0,1,256).data},e.prototype.colorize=function(t,e){for(var i,r=0,n=t.length;rd&&(d=t.measure)}),this._data=r,this._measuredLocations=e,this._intervalType=i.CONTINUOUS,this._scale=["blue","cyan","lime","yellow","red"],this._radius=12.5,this._incrementPerIntensity=1/d,this.setGradient(e)};return c.prototype=Object.create(l.prototype),Object.defineProperties(c.prototype,{intervalType:{get:function(){return this._intervalType},set:function(t){this._intervalType=t,this.setGradient()}},scale:{get:function(){return this._scale},set:function(t){this._scale=t,this.setGradient()}},gradient:{get:function(){return this._gradient}},radius:{get:function(){return this._radius},set:function(t){this._radius=t}}}),c.prototype.filterGeographically=function(t,e){var i=Math.floor(e.minLatitude),r=Math.floor(e.maxLatitude),n=Math.floor(e.minLongitude),o=Math.floor(e.maxLongitude),s=0,a=0;i<=-90&&(i=-90),r>=90&&(r=90),n<=-180&&(s=Math.abs(n- -180),n=-180),o>=180&&(a=Math.abs(o-180),o=180);var l=[];if(this.gatherGeographical(t,l,e,i,r,n,o),0!==s){var u=new h(i,r,180-s,180);this.gatherGeographical(t,l,u,i,r,180-s,180,-360)}if(0!==a){var c=new h(i,r,-180,-180+a);this.gatherGeographical(t,l,c,i,r,-180,-180+a,360)}return l},c.prototype.gatherGeographical=function(t,e,i,r,n,o,s,l){var h,u;for(h=r;h<=n;h++)for(u=o;u<=s;u++)t[h][u].forEach(function(t){i.containsLocation(t.latitude,t.longitude)&&(l?e.push(new a(t.latitude,l+t.longitude,t.measure)):e.push(t))})},c.prototype.setGradient=function(){var t=this.intervalType,e=this.scale,r={};if(t===i.CONTINUOUS)e.forEach(function(t,i){r[i/e.length]=t});else if(t===i.QUANTILES){var n=this._measuredLocations;n.sort(function(t,e){return t.measuree.measure?1:0});var o=n[n.length-1].measure;n.length>=e.length?e.forEach(function(t,i){0===i?r[0]=t:r[n[Math.floor(i/e.length*n.length)].measure/o]=t}):e.forEach(function(t,i){r[i/e.length]=t})}this._gradient=r},c.prototype.retrieveTileImage=function(t,e,i){if(this.currentRetrievals.indexOf(e.imagePath)<0){if(this.absentResourceList.isResourceAbsent(e.imagePath))return;var r=e.imagePath,n=t.gpuResourceCache,o=this,s=this.radius,a=this.calculateExtendedSector(e.sector,2*(s/this.tileWidth),2*(s/this.tileHeight)),l=Math.ceil(a.extensionFactorWidth*this.tileWidth),h=Math.ceil(a.extensionFactorHeight*this.tileHeight),u=this.filterGeographically(this._data,a.sector),c=this.createHeatMapTile(u,{sector:a.sector,width:this.tileWidth+2*l,height:this.tileHeight+2*h,radius:s,intensityGradient:this.gradient,incrementPerIntensity:this._incrementPerIntensity,extendedWidth:l,extendedHeight:h}).canvas(),d=document.createElement("canvas");d.height=this.tileHeight,d.width=this.tileWidth,d.getContext("2d").putImageData(c.getContext("2d").getImageData(l,h,this.tileWidth,this.tileHeight),0,0);var p=o.createTexture(t,e,d);if(o.removeFromCurrentRetrievals(r),p&&(n.putResource(r,p,p.size),o.currentTilesInvalid=!0,o.absentResourceList.unmarkResourceAbsent(r),!i)){var f=document.createEvent("Event");f.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),window.dispatchEvent(f)}}},c.prototype.calculateExtendedSector=function(t,e,i){var r=(t.maxLatitude-t.minLatitude)*i,n=(t.maxLongitude-t.minLongitude)*e;return{sector:new h(t.minLatitude-r,t.maxLatitude+r,t.minLongitude-n,t.maxLongitude+n),extensionFactorHeight:i,extensionFactorWidth:e}},c.prototype.createHeatMapTile=function(t,i){return new e(t,i)},c}),i("util/HighlightController",["../error/ArgumentError","../util/Logger"],function(t,e){"use strict";var i=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"HighlightController","constructor","missingWorldWindow"));this.worldWindow=i;var r=[],n=function(t){for(var e=t.clientX,n=t.clientY,o=r.length>0,s=0;s0&&(o=!0),a.objects.length>0)for(var l=0;l1;)try{return d.stringifyByChunk(t,r,i)}catch(t){i=Math.floor(i/2)}return d.stringifyByChar(t)}function s(t,e){for(var i=0;i "+t:t}},t.exports=r},function(t,e,i){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var n={arraySet:function(t,e,i,r,n){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),n);else for(var o=0;o=252?6:u>=248?5:u>=240?4:u>=224?3:u>=192?2:1;h[254]=h[254]=1,e.utf8encode=function(t){return s.nodebuffer?a.newBufferFrom(t,"utf-8"):function(t){var e,i,r,n,o,a=t.length,l=0;for(n=0;n>>6,e[o++]=128|63&i):i<65536?(e[o++]=224|i>>>12,e[o++]=128|i>>>6&63,e[o++]=128|63&i):(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63,e[o++]=128|i>>>6&63,e[o++]=128|63&i);return e}(t)},e.utf8decode=function(t){return s.nodebuffer?o.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,i,r,n,s=t.length,a=new Array(2*s);for(i=0,e=0;e4)a[i++]=65533,e+=n-1;else{for(r&=2===n?31:3===n?15:7;n>1&&e1?a[i++]=65533:r<65536?a[i++]=r:(r-=65536,a[i++]=55296|r>>10&1023,a[i++]=56320|1023&r)}return a.length!==i&&(a.subarray?a=a.subarray(0,i):a.length=i),o.applyFromCharCode(a)}(t=o.transformTo(s.uint8array?"uint8array":"array",t))},o.inherits(r,l),r.prototype.processChunk=function(t){var i=o.transformTo(s.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var r=i;(i=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),i.set(r,this.leftOver.length)}else i=this.leftOver.concat(i);this.leftOver=null}var n=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+h[t[i]]>e?i:e}(i),a=i;n!==i.length&&(s.uint8array?(a=i.subarray(0,n),this.leftOver=i.subarray(n,i.length)):(a=i.slice(0,n),this.leftOver=i.slice(n,i.length))),this.push({data:e.utf8decode(a),meta:t.meta})},r.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:e.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},e.Utf8DecodeWorker=r,o.inherits(n,l),n.prototype.processChunk=function(t){this.push({data:e.utf8encode(t.data),meta:t.meta})},e.Utf8EncodeWorker=n},function(t,e,i){"use strict";var r=null;r="undefined"!=typeof Promise?Promise:i(74),t.exports={Promise:r}},function(t,e,i){(function(t){function i(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===i(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===i(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===i(t)},e.isError=function(t){return"[object Error]"===i(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,i(10).Buffer)},function(t,e,i){"use strict";(function(t){function r(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function n(t,e){if(r()=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function c(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return k(t).length;default:if(r)return D(t).length;e=(""+e).toLowerCase(),r=!0}}function d(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function p(t,e,i,r,n){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:f(t,e,i,r,n);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):f(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}function f(t,e,i,r,n){function o(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}var s,a=1,l=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,l/=2,h/=2,i/=2}if(n){var u=-1;for(s=i;sl&&(i=l-h),s=i;s>=0;s--){for(var c=!0,d=0;dn&&(r=n):r=n;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s>8,n=i%256,o.push(n),o.push(r);return o}(e,t.length-i),t,i,r)}function b(t,e,i){return 0===e&&i===t.length?F.fromByteArray(t):F.fromByteArray(t.slice(e,i))}function w(t,e,i){i=Math.min(t.length,i);for(var r=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+c<=i)switch(c){case 1:h<128&&(u=h);break;case 2:128==(192&(o=t[n+1]))&&(l=(31&h)<<6|63&o)>127&&(u=l);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(l=(15&h)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(u=l)}null===u?(u=65533,c=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),n+=c}return function(t){var e=t.length;if(e<=B)return String.fromCharCode.apply(String,t);for(var i="",r=0;rr)&&(i=r);for(var n="",o=e;oi)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,i,r,n,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function C(t,e,i,r){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-i,2);n>>8*(r?n:1-n)}function A(t,e,i,r){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-i,4);n>>8*(r?n:3-n)&255}function P(t,e,i,r,n,o){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function O(t,e,i,r,n){return n||P(t,0,i,4),G.write(t,e,i,r,23,4),i+4}function N(t,e,i,r,n){return n||P(t,0,i,8),G.write(t,e,i,r,52,8),i+8}function I(t){return t<16?"0"+t.toString(16):t.toString(16)}function D(t,e){var i;e=e||1/0;for(var r=t.length,n=null,o=[],s=0;s55295&&i<57344){if(!n){if(i>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}n=i;continue}if(i<56320){(e-=3)>-1&&o.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;o.push(i)}else if(i<2048){if((e-=2)<0)break;o.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function k(t){return F.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,i,r){for(var n=0;n=e.length||n>=t.length);++n)e[n+i]=t[n];return n}var F=i(102),G=i(101),W=i(51);e.Buffer=o,e.SlowBuffer=function(t){return+t!=t&&(t=0),o.alloc(+t)},e.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=r(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,i){return s(null,t,e,i)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,i){return function(t,e,i,r){return a(e),e<=0?n(t,e):void 0!==i?"string"==typeof r?n(t,e).fill(i,r):n(t,e).fill(i):n(t,e)}(null,t,e,i)},o.allocUnsafe=function(t){return l(null,t)},o.allocUnsafeSlow=function(t){return l(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,r=e.length,n=0,s=Math.min(i,r);nthis.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,i);case"utf8":case"utf-8":return w(this,e,i);case"ascii":return S(this,e,i);case"latin1":case"binary":return L(this,e,i);case"base64":return b(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",i=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),""},o.prototype.compare=function(t,e,i,r,n){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),e<0||i>t.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&e>=i)return 0;if(r>=n)return-1;if(e>=i)return 1;if(e>>>=0,i>>>=0,r>>>=0,n>>>=0,this===t)return 0;for(var s=n-r,a=i-e,l=Math.min(s,a),h=this.slice(r,n),u=t.slice(e,i),c=0;cn)&&(i=n),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return g(this,t,e,i);case"utf8":case"utf-8":return m(this,t,e,i);case"ascii":return y(this,t,e,i);case"latin1":case"binary":return E(this,t,e,i);case"base64":return v(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var B=4096;o.prototype.slice=function(t,e){var i,r=this.length;if(t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(n*=256);)r+=this[t+--e]*n;return r},o.prototype.readUInt8=function(t,e){return e||x(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||x(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||x(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||x(t,e,this.length);for(var r=this[t],n=1,o=0;++o=(n*=128)&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||x(t,e,this.length);for(var r=e,n=1,o=this[t+--r];r>0&&(n*=256);)o+=this[t+--r]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||x(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},o.prototype.readInt16BE=function(t,e){e||x(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},o.prototype.readInt32LE=function(t,e){return e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||x(t,4,this.length),G.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||x(t,4,this.length),G.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||x(t,8,this.length),G.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||x(t,8,this.length),G.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,i,r){t=+t,e|=0,i|=0,r||M(this,t,e,i,Math.pow(2,8*i)-1,0);var n=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+n]=t/o&255;return e+i},o.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):C(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):C(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):A(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):A(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);M(this,t,e,i,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+i},o.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);M(this,t,e,i,n-1,-n)}var o=i-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i},o.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):C(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):C(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):A(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):A(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,i){return O(this,t,e,!0,i)},o.prototype.writeFloatBE=function(t,e,i){return O(this,t,e,!1,i)},o.prototype.writeDoubleLE=function(t,e,i){return N(this,t,e,!0,i)},o.prototype.writeDoubleBE=function(t,e,i){return N(this,t,e,!1,i)},o.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--n)t[n+e]=this[n+i];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(s=e;s1)for(var i=1;i>>1:t>>>1;e[i]=t}return e}();t.exports=function(t,e){return void 0!==t&&t.length?"string"!==r.getTypeOf(t)?function(t,e,i,r){var o=n,s=r+i;t^=-1;for(var a=r;a>>8^o[255&(t^e[a])];return-1^t}(0|e,t,t.length,0):function(t,e,i,r){var o=n,s=r+i;t^=-1;for(var a=r;a>>8^o[255&(t^e.charCodeAt(a))];return-1^t}(0|e,t,t.length,0):0}},function(t,e,i){"use strict";function r(t,e,i,r,n){this.compressedSize=t,this.uncompressedSize=e,this.crc32=i,this.compression=r,this.compressedContent=n}var n=i(8),o=i(37),s=i(36),a=i(35);s=i(36),r.prototype={getContentWorker:function(){var t=new o(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),e=this;return t.on("end",function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),t},getCompressedWorker:function(){return new o(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},r.createWorkerFrom=function(t,e,i){return t.pipe(new a).pipe(new s("uncompressedSize")).pipe(e.compressWorker(i)).pipe(new s("compressedSize")).withStreamInfo("compression",e)},t.exports=r},function(t,e,i){t.exports=!i(41)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,i){"use strict";(function(e,r,n){function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,i){var r=t.entry;for(t.entry=null;r;){var n=r.callback;e.pendingcb--,n(i),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}function s(){}function a(t,e){m=m||i(4),t=t||{};var r=e instanceof m;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,s=t.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var i=t._writableState,r=i.sync,n=i.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),e)!function(t,e,i,r,n){--e.pendingcb,i?(g.nextTick(n,r),g.nextTick(f,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(n(r),t._writableState.errorEmitted=!0,t.emit("error",r),f(t,e))}(t,i,r,e,n);else{var o=d(i);o||i.corked||i.bufferProcessing||!i.bufferedRequest||c(t,i),r?y(u,t,i,o,n):u(t,i,o,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function l(t){return m=m||i(4),v.call(l,this)||this instanceof m?(this._writableState=new a(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),b.call(this),void 0):new l(t)}function h(t,e,i,r,n,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,i?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function u(t,e,i,r){i||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),f(t,e)}function c(t,e){e.bufferProcessing=!0;var i=e.bufferedRequest;if(t._writev&&i&&i.next){var r=e.bufferedRequestCount,n=new Array(r),s=e.corkedRequestsFree;s.entry=i;for(var a=0,l=!0;i;)n[a]=i,i.isBuf||(l=!1),i=i.next,a+=1;n.allBuffers=l,h(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;i;){var u=i.chunk,c=i.encoding,d=i.callback;if(h(t,e,!1,e.objectMode?1:u.length,u,c,d),i=i.next,e.bufferedRequestCount--,e.writing)break}null===i&&(e.lastBufferedRequest=null)}e.bufferedRequest=i,e.bufferProcessing=!1}function d(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function p(t,e){t._final(function(i){e.pendingcb--,i&&t.emit("error",i),e.prefinished=!0,t.emit("prefinish"),f(t,e)})}function f(t,e){var i=d(e);return i&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,g.nextTick(p,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),i}var g=i(14);t.exports=l;var m,y=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?r:g.nextTick;l.WritableState=a;var E=i(9);E.inherits=i(6);var v,_={deprecate:i(94)},b=i(48),w=i(13).Buffer,S=n.Uint8Array||function(){},L=i(47);E.inherits(l,b),a.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(a.prototype,"buffer",{get:_.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(v=Function.prototype[Symbol.hasInstance],Object.defineProperty(l,Symbol.hasInstance,{value:function(t){return!!v.call(this,t)||this===l&&t&&t._writableState instanceof a}})):v=function(t){return t instanceof this},l.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},l.prototype.write=function(t,e,i){var r=this._writableState,n=!1,o=!r.objectMode&&function(t){return w.isBuffer(t)||t instanceof S}(t);return o&&!w.isBuffer(t)&&(t=function(t){return w.from(t)}(t)),"function"==typeof e&&(i=e,e=null),o?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof i&&(i=s),r.ended?function(t,e){var i=new Error("write after end");t.emit("error",i),g.nextTick(e,i)}(this,i):(o||function(t,e,i,r){var n=!0,o=!1;return null===i?o=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),g.nextTick(r,o),n=!1),n}(this,r,t,i))&&(r.pendingcb++,n=function(t,e,i,r,n,o){if(!i){var s=function(t,e,i){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=w.from(e,i)),e}(e,r,n);r!==s&&(i=!0,n="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var l=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),l.prototype._write=function(t,e,i){i(new Error("_write() is not implemented"))},l.prototype._writev=null,l.prototype.end=function(t,e,i){var r=this._writableState;"function"==typeof t?(i=t,t=null,e=null):"function"==typeof e&&(i=e,e=null),null!==t&&void 0!==t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,i){e.ending=!0,f(t,e),i&&(e.finished?g.nextTick(i):t.once("finish",i)),e.ended=!0,t.writable=!1}(this,r,i)},Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),l.prototype.destroy=L.destroy,l.prototype._undestroy=L.undestroy,l.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,i(15),i(96).setImmediate,i(5))},function(t,e,i){(e=t.exports=i(49)).Stream=e,e.Readable=e,e.Writable=i(21),e.Duplex=i(4),e.Transform=i(45),e.PassThrough=i(93)},function(t,e){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function n(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(t){if(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},i.prototype.emit=function(t){var e,i,s,a,l,h;if(this._events||(this._events={}),"error"===t&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}if(o(i=this._events[t]))return!1;if(r(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(n(i))for(a=Array.prototype.slice.call(arguments,1),s=(h=i.slice()).length,l=0;l0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){function i(){this.removeListener(t,i),n||(n=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var n=!1;return i.listener=e,this.on(t,i),this},i.prototype.removeListener=function(t,e){var i,o,s,a;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(s=(i=this._events[t]).length,o=-1,i===e||r(i.listener)&&i.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(n(i)){for(a=s;a-- >0;)if(i[a]===e||i[a].listener&&i[a].listener===e){o=a;break}if(o<0)return this;1===i.length?(i.length=0,delete this._events[t]):i.splice(o,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r(i=this._events[t]))this.removeListener(t,i);else if(i)for(;i.length;)this.removeListener(t,i[i.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,i){"use strict";function r(t){n.call(this,t)}var n=i(26);i(0).inherits(r,n),r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},t.exports=r},function(t,e,i){"use strict";function r(t){this.data=t,this.length=t.length,this.index=0,this.zero=0}var n=i(0);r.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length=this.index;e--)i=(i<<8)+this.byteAt(e);return this.index+=t,i},readString:function(t){return n.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readAndCheckSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},t.exports=r},function(t,e,i){"use strict";function r(t){n.call(this,t);for(var e=0;e=0;--o)if(this.data[o]===e&&this.data[o+1]===i&&this.data[o+2]===r&&this.data[o+3]===n)return o-this.zero;return-1},r.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),i=t.charCodeAt(1),r=t.charCodeAt(2),n=t.charCodeAt(3),o=this.readData(4);return e===o[0]&&i===o[1]&&r===o[2]&&n===o[3]},r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},t.exports=r},function(t,e,i){"use strict";var r=i(0),n=i(3),o=i(26),s=i(54),a=i(53),l=i(24);t.exports=function(t){var e=r.getTypeOf(t);return r.checkSupport(e),"string"!==e||n.uint8array?"nodebuffer"===e?new a(t):n.uint8array?new l(r.transformTo("uint8array",t)):new o(r.transformTo("array",t)):new s(t)}},function(t,e,i){"use strict";e.LOCAL_FILE_HEADER="PK",e.CENTRAL_FILE_HEADER="PK",e.CENTRAL_DIRECTORY_END="PK",e.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",e.ZIP64_CENTRAL_DIRECTORY_END="PK",e.DATA_DESCRIPTOR="PK\b"},function(t,e,i){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e,i){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,i){"use strict";function r(t,e){if(e<65537&&(t.subarray&&s||!t.subarray&&o))return String.fromCharCode.apply(null,n.shrinkBuf(t,e));for(var i="",r=0;r=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;a[254]=a[254]=1,e.string2buf=function(t){var e,i,r,o,s,a=t.length,l=0;for(o=0;o>>6,e[s++]=128|63&i):i<65536?(e[s++]=224|i>>>12,e[s++]=128|i>>>6&63,e[s++]=128|63&i):(e[s++]=240|i>>>18,e[s++]=128|i>>>12&63,e[s++]=128|i>>>6&63,e[s++]=128|63&i);return e},e.buf2binstring=function(t){return r(t,t.length)},e.binstring2buf=function(t){for(var e=new n.Buf8(t.length),i=0,r=e.length;i4)h[n++]=65533,i+=s-1;else{for(o&=2===s?31:3===s?15:7;s>1&&i1?h[n++]=65533:o<65536?h[n++]=o:(o-=65536,h[n++]=55296|o>>10&1023,h[n++]=56320|1023&o)}return r(h,n)},e.utf8border=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+a[t[i]]>e?i:e}},function(t,e,i){"use strict";var r=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();t.exports=function(t,e,i,n){var o=r,s=n+i;t^=-1;for(var a=n;a>>8^o[255&(t^e[a])];return-1^t}},function(t,e,i){"use strict";t.exports=function(t,e,i,r){for(var n=65535&t|0,o=t>>>16&65535|0,s=0;0!==i;){i-=s=i>2e3?2e3:i;do o=o+(n=n+e[r++]|0)|0;while(--s);n%=65521,o%=65521}return n|o<<16|0}},function(t,e,i){"use strict";var r=i(1);e.STORE={magic:"\0\0",compressWorker:function(t){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},e.DEFLATE=i(68)},function(t,e,i){"use strict";function r(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}var n=i(1),o=i(17);i(0).inherits(r,n),r.prototype.processChunk=function(t){this.streamInfo.crc32=o(t.data,this.streamInfo.crc32||0),this.push(t)},t.exports=r},function(t,e,i){"use strict";function r(t){o.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}var n=i(0),o=i(1);n.inherits(r,o),r.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}o.prototype.processChunk.call(this,t)},t.exports=r},function(t,e,i){"use strict";function r(t){o.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then(function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=n.getTypeOf(t),e.isPaused||e._tickAndRepeat()},function(t){e.error(t)})}var n=i(0),o=i(1);n.inherits(r,o),r.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=r},function(t,e,i){"use strict";e.base64=!1,e.binary=!1,e.dir=!1,e.createFolders=!0,e.date=null,e.compression=null,e.compressionOptions=null,e.comment=null,e.unixPermissions=null,e.dosPermissions=null},function(t,e,i){"use strict";(function(e){function r(t,i){return new u.Promise(function(r,n){var s=[],a=t._internalType,h=t._outputType,u=t._mimeType;t.on("data",function(t,e){s.push(t),i&&i(e)}).on("error",function(t){s=[],n(t)}).on("end",function(){try{var t=function(t,e,i){switch(t){case"blob":return o.newBlob(o.transformTo("arraybuffer",e),i);case"base64":return l.encode(e);default:return o.transformTo(t,e)}}(h,function(t,i){var r,n=0,o=null,s=0;for(r=0;r>2,a=(3&e)<<4|i>>4,l=p>1?(15&i)<<2|n>>6:64,h=p>2?63&n:64,u.push(o.charAt(s)+o.charAt(a)+o.charAt(l)+o.charAt(h));return u.join("")},e.decode=function(t){var e,i,r,s,a,l,h=0,u=0;if("data:"===t.substr(0,"data:".length))throw new Error("Invalid base64 input, it looks like a data url.");var c,d=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(t.charAt(t.length-1)===o.charAt(64)&&d--,t.charAt(t.length-2)===o.charAt(64)&&d--,d%1!=0)throw new Error("Invalid base64 input, bad content length.");for(c=n.uint8array?new Uint8Array(0|d):new Array(0|d);h>4,i=(15&s)<<4|(a=o.indexOf(t.charAt(h++)))>>2,r=(3&a)<<6|(l=o.indexOf(t.charAt(h++))),c[u++]=e,64!==a&&(c[u++]=i),64!==l&&(c[u++]=r);return c}},function(t,e,i){"use strict";function r(t){return this instanceof r?(s.call(this,t),this._transformState={afterTransform:function(t,e){var i=this._transformState;i.transforming=!1;var r=i.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));i.writechunk=null,i.writecb=null,null!=e&&this.push(e),r(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function o(t){var e=this.lastTotal-this.lastNeed,i=function(t,e,i){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==i?i:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function s(t,e){if((t.length-e)%2==0){var i=t.toString("utf16le",e);if(i){var r=i.charCodeAt(i.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function a(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,i)}return e}function l(t,e){var i=(t.length-e)%3;return 0===i?t.toString("base64",e):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-i))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function u(t){return t.toString(this.encoding)}function c(t){return t&&t.length?this.write(t):""}var d=i(13).Buffer,p=d.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};e.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,i;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i=0?(o>0&&(t.lastNeed=o-1),o):--r=0?(o>0&&(t.lastNeed=o-2),o):--r=0?(o>0&&(2===o?o=0:t.lastNeed=o-3),o):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=i;var r=t.length-(i-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},r.prototype.fillLast=function(t){return this.lastNeed<=t.length?(t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),void(this.lastNeed-=t.length))}},function(t,e,i){"use strict";function r(t,e){t.emit("error",e)}var n=i(14);t.exports={destroy:function(t,e){var i=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(r,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(n.nextTick(r,i,t),i._writableState&&(i._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,i){t.exports=i(23).EventEmitter},function(t,e,i){"use strict";(function(e,r){function n(t,e){b=b||i(4),t=t||{};var r=e instanceof b;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new P,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(A||(A=i(46).StringDecoder),this.decoder=new A(t.encoding),this.encoding=t.encoding)}function o(t){return b=b||i(4),this instanceof o?(this._readableState=new n(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)), +L.call(this),void 0):new o(t)}function s(t,e,i,r,n){var o,s=t._readableState;return null===e?(s.reading=!1,function(t,e){if(!e.ended){if(e.decoder){var i=e.decoder.end();i&&i.length&&(e.buffer.push(i),e.length+=e.objectMode?1:i.length)}e.ended=!0,h(t)}}(t,s)):(n||(o=function(t,e){var i;return function(t){return T.isBuffer(t)||t instanceof R}(e)||"string"==typeof e||void 0===e||t.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i}(s,e)),o?t.emit("error",o):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===T.prototype||(e=function(t){return T.from(t)}(e)),r?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):a(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!i?(e=s.decoder.write(e),s.objectMode||0!==e.length?a(t,s,e,!1):c(t,s)):a(t,s,e,!1))):r||(s.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=I?t=I:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function h(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(C("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?_.nextTick(u,t):u(t))}function u(t){C("emit readable"),t.emit("readable"),g(t)}function c(t,e){e.readingMore||(e.readingMore=!0,_.nextTick(d,t,e))}function d(t,e){for(var i=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(i=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):i=function(t,e,i){var r;return to.length?o.length:t;if(n+=s===o.length?o:o.slice(0,t),0===(t-=s)){s===o.length?(++r,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=o.slice(s));break}++r}return e.length-=r,n}(t,e):function(t,e){var i=T.allocUnsafe(t),r=e.head,n=1;for(r.data.copy(i),t-=r.data.length;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(i,i.length-t,0,s),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e),r}(t,e.buffer,e.decoder),i);var i}function y(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,_.nextTick(E,e,t))}function E(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function v(t,e){for(var i=0,r=t.length;i=e.highWaterMark||e.ended))return C("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?y(this):h(this),null;if(0===(t=l(t,e))&&e.ended)return 0===e.length&&y(this),null;var r,n=e.needReadable;return C("need readable",n),(0===e.length||e.length-t0?m(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),i!==t&&e.ended&&y(this)),null!==r&&this.emit("data",r),r},o.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},o.prototype.pipe=function(t,e){function i(e,r){C("onunpipe"),e===u&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,C("cleanup"),t.removeListener("close",a),t.removeListener("finish",l),t.removeListener("drain",p),t.removeListener("error",s),t.removeListener("unpipe",i),u.removeListener("end",n),u.removeListener("end",h),u.removeListener("data",o),f=!0,!c.awaitDrain||t._writableState&&!t._writableState.needDrain||p())}function n(){C("onend"),t.end()}function o(e){C("ondata"),m=!1,!1!==t.write(e)||m||((1===c.pipesCount&&c.pipes===t||c.pipesCount>1&&-1!==v(c.pipes,t))&&!f&&(C("false write response, pause",u._readableState.awaitDrain),u._readableState.awaitDrain++,m=!0),u.pause())}function s(e){C("onerror",e),h(),t.removeListener("error",s),0===S(t,"error")&&t.emit("error",e)}function a(){t.removeListener("finish",l),h()}function l(){C("onfinish"),t.removeListener("close",a),h()}function h(){C("unpipe"),u.unpipe(t)}var u=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=t;break;case 1:c.pipes=[c.pipes,t];break;default:c.pipes.push(t)}c.pipesCount+=1,C("pipe count=%d opts=%j",c.pipesCount,e);var d=e&&!1===e.end||t===r.stdout||t===r.stderr?h:n;c.endEmitted?_.nextTick(d):u.once("end",d),t.on("unpipe",i);var p=function(t){return function(){var e=t._readableState;C("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&S(t,"data")&&(e.flowing=!0,g(t))}}(u);t.on("drain",p);var f=!1,m=!1;return u.on("data",o),function(t,e,i){return"function"==typeof t.prependListener?t.prependListener(e,i):void(t._events&&t._events[e]?w(t._events[e])?t._events[e].unshift(i):t._events[e]=[i,t._events[e]]:t.on(e,i))}(t,"error",s),t.once("close",a),t.once("finish",l),t.emit("pipe",u),c.flowing||(C("pipe resume"),u.resume()),t},o.prototype.unpipe=function(t){var e=this._readableState,i={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,i),this);if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o>8;this.dir=!!(16&this.externalFileAttributes),0===t&&(this.dosPermissions=63&this.externalFileAttributes),3===t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(t){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(t){var e,i,r,n=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t0)this.isSignature(e,s.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(t){this.reader=n(t)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=r},function(t,e,i){"use strict";function r(t){return new o.Promise(function(e,i){var r=t.decompressed.getContentWorker().pipe(new l);r.on("error",function(t){i(t)}).on("end",function(){r.streamInfo.crc32!==t.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}var n=i(0),o=i(8),s=i(7),a=(n=i(0),i(55)),l=i(35),h=i(12);t.exports=function(t,e){var i=this;return e=n.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),h.isNode&&h.isStream(t)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",t,!0,e.optimizedBinaryString,e.base64).then(function(t){var i=new a(e);return i.load(t),i}).then(function(t){var i=[o.Promise.resolve(t)],n=t.files;if(e.checkCRC32)for(var s=0;s>>=8;return r},u=function(t,e,i,r,o,u){var c,d,p=t.file,f=t.compression,g=u!==s.utf8encode,m=n.transformTo("string",u(p.name)),y=n.transformTo("string",s.utf8encode(p.name)),E=p.comment,v=n.transformTo("string",u(E)),_=n.transformTo("string",s.utf8encode(E)),b=y.length!==p.name.length,w=_.length!==E.length,S="",L="",T="",R=p.dir,x=p.date,M={crc32:0,compressedSize:0,uncompressedSize:0};e&&!i||(M.crc32=t.crc32,M.compressedSize=t.compressedSize,M.uncompressedSize=t.uncompressedSize);var C=0;e&&(C|=8),g||!b&&!w||(C|=2048);var A=0,P=0;R&&(A|=16),"UNIX"===o?(P=798,A|=function(t,e){var i=t;return t||(i=e?16893:33204),(65535&i)<<16}(p.unixPermissions,R)):(P=20,A|=function(t,e){return 63&(t||0)}(p.dosPermissions)),c=x.getUTCHours(),c<<=6,c|=x.getUTCMinutes(),c<<=5,c|=x.getUTCSeconds()/2,d=x.getUTCFullYear()-1980,d<<=4,d|=x.getUTCMonth()+1,d<<=5,d|=x.getUTCDate(),b&&(L=h(1,1)+h(a(m),4)+y,S+="up"+h(L.length,2)+L),w&&(T=h(1,1)+h(a(v),4)+_,S+="uc"+h(T.length,2)+T);var O="";return O+="\n\0",O+=h(C,2),O+=f.magic,O+=h(c,2),O+=h(d,2),O+=h(M.crc32,4),O+=h(M.compressedSize,4),O+=h(M.uncompressedSize,4),O+=h(m.length,2),O+=h(S.length,2),{fileRecord:l.LOCAL_FILE_HEADER+O+m+S,dirRecord:l.CENTRAL_FILE_HEADER+h(P,2)+O+h(v.length,2)+"\0\0\0\0"+h(A,4)+h(r,4)+m+S+v}};n.inherits(r,o),r.prototype.push=function(t){var e=t.meta.percent||0,i=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,o.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:i?(e+100*(i-r-1))/i:100}}))},r.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var i=u(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},r.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,i=u(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),e)this.push({data:function(t){return l.DATA_DESCRIPTOR+h(t.crc32,4)+h(t.compressedSize,4)+h(t.uncompressedSize,4)}(t),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},r.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e=1&&0===D[R];R--);if(x>R&&(x=R),0===R)return h[u++]=20971520,h[u++]=20971520,d.bits=1,0;for(T=1;T0&&(0===t||1!==R))return-1;for(k[1]=0,S=1;S<15;S++)k[S+1]=k[S]+D[S];for(L=0;L852||2===t&&P>592)return 1;for(;;){v=S-C,c[L]E?(_=V[F+c[L]],b=N[I+c[L]]):(_=96,b=0),p=1<>C)+(f-=p)]=v<<24|_<<16|b|0;while(0!==f);for(p=1<>=1;if(0!==p?(O&=p-1,O+=p):O=0,L++,0==--D[S]){if(S===R)break;S=e[i+c[L]]}if(S>x&&(O&m)!==g){for(0===C&&(C=x),y+=T,A=1<<(M=S-C);M+C852||2===t&&P>592)return 1;h[g=O&m]=x<<24|M<<16|y-u|0}}return 0!==O&&(h[y+O]=S-C<<24|64<<16|0),d.bits=x,0}},function(t,e,i){"use strict";t.exports=function(t,e){var i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_,b,w,S,L,T,R;i=t.state,r=t.next_in,T=t.input,n=r+(t.avail_in-5),o=t.next_out,R=t.output,s=o-(e-t.avail_out),a=o+(t.avail_out-257),l=i.dmax,h=i.wsize,u=i.whave,c=i.wnext,d=i.window,p=i.hold,f=i.bits,g=i.lencode,m=i.distcode,y=(1<>>=_=v>>>24,f-=_,0===(_=v>>>16&255))R[o++]=65535&v;else{if(!(16&_)){if(0==(64&_)){v=g[(65535&v)+(p&(1<<_)-1)];continue e}if(32&_){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}b=65535&v,(_&=15)&&(f<_&&(p+=T[r++]<>>=_,f-=_),f<15&&(p+=T[r++]<>>=_=v>>>24,f-=_,!(16&(_=v>>>16&255))){if(0==(64&_)){v=m[(65535&v)+(p&(1<<_)-1)];continue i}t.msg="invalid distance code",i.mode=30;break t}if(w=65535&v,f<(_&=15)&&(p+=T[r++]<l){t.msg="invalid distance too far back",i.mode=30;break t}if(p>>>=_,f-=_,w>(_=o-s)){if((_=w-_)>u&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(S=0,L=d,0===c){if(S+=h-_,_2;)R[o++]=L[S++],R[o++]=L[S++],R[o++]=L[S++],b-=3;b&&(R[o++]=L[S++],b>1&&(R[o++]=L[S++]))}else{S=o-w;do R[o++]=R[S++],R[o++]=R[S++],R[o++]=R[S++],b-=3;while(b>2);b&&(R[o++]=R[S++],b>1&&(R[o++]=R[S++]))}break}}break}}while(r>3,p&=(1<<(f-=b<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function n(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=P,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new d.Buf32(ht),e.distcode=e.distdyn=new d.Buf32(ut),e.sane=1,e.back=-1,S):R}function o(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,n(t)):R}function s(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?R:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,o(t))):R}function a(t,e){var i,r;return t?(r=new function(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new d.Buf16(320),this.work=new d.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},t.state=r,r.window=null,(i=s(t,e))!==S&&(t.state=null),i):R}function l(t){if(dt){var e;for(u=new d.Buf32(512),c=new d.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(m(E,t.lens,0,288,u,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;m(v,t.lens,0,32,c,0,t.work,{bits:5}),dt=!1}t.lencode=u,t.lenbits=9,t.distcode=c,t.distbits=5}function h(t,e,i,r){var n,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(d.arraySet(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),d.arraySet(o.window,e,i-r,n,o.wnext),(r-=n)?(d.arraySet(o.window,e,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,i.check=f(i.check,xt,2,0),ht=0,ut=0,i.mode=O;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&ht)<<8)+(ht>>8))%31){t.msg="incorrect header check",i.mode=st;break}if((15&ht)!==A){t.msg="unknown compression method",i.mode=st;break}if(ut-=4,wt=8+(15&(ht>>>=4)),0===i.wbits)i.wbits=wt;else if(wt>i.wbits){t.msg="invalid window size",i.mode=st;break}i.dmax=1<>8&1),512&i.flags&&(xt[0]=255&ht,xt[1]=ht>>>8&255,i.check=f(i.check,xt,2,0)),ht=0,ut=0,i.mode=N;case N:for(;ut<32;){if(0===u)break t;u--,ht+=n[s++]<>>8&255, +xt[2]=ht>>>16&255,xt[3]=ht>>>24&255,i.check=f(i.check,xt,4,0)),ht=0,ut=0,i.mode=I;case I:for(;ut<16;){if(0===u)break t;u--,ht+=n[s++]<>8),512&i.flags&&(xt[0]=255&ht,xt[1]=ht>>>8&255,i.check=f(i.check,xt,2,0)),ht=0,ut=0,i.mode=D;case D:if(1024&i.flags){for(;ut<16;){if(0===u)break t;u--,ht+=n[s++]<>>8&255,i.check=f(i.check,xt,2,0)),ht=0,ut=0}else i.head&&(i.head.extra=null);i.mode=k;case k:if(1024&i.flags&&((pt=i.length)>u&&(pt=u),pt&&(i.head&&(wt=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),d.arraySet(i.head.extra,n,s,pt,wt)),512&i.flags&&(i.check=f(i.check,n,pt,s)),u-=pt,s+=pt,i.length-=pt),i.length))break t;i.length=0,i.mode=V;case V:if(2048&i.flags){if(0===u)break t;pt=0;do wt=n[s+pt++],i.head&&wt&&i.length<65536&&(i.head.name+=String.fromCharCode(wt));while(wt&&pt>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=U;break;case W:for(;ut<32;){if(0===u)break t;u--,ht+=n[s++]<>>=7&ut,ut-=7&ut,i.mode=rt;break}for(;ut<3;){if(0===u)break t;u--,ht+=n[s++]<>>=1)){case 0:i.mode=j;break;case 1:if(l(i),i.mode=J,e===w){ht>>>=2,ut-=2;break t}break;case 2:i.mode=q;break;case 3:t.msg="invalid block type",i.mode=st}ht>>>=2,ut-=2;break;case j:for(ht>>>=7&ut,ut-=7&ut;ut<32;){if(0===u)break t;u--,ht+=n[s++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=st;break}if(i.length=65535&ht,ht=0,ut=0,i.mode=z,e===w)break t;case z:i.mode=H;case H:if(pt=i.length){if(pt>u&&(pt=u),pt>c&&(pt=c),0===pt)break t;d.arraySet(o,n,s,pt,a),u-=pt,s+=pt,c-=pt,a+=pt,i.length-=pt;break}i.mode=U;break;case q:for(;ut<14;){if(0===u)break t;u--,ht+=n[s++]<>>=5,ut-=5,i.ndist=1+(31&ht),ht>>>=5,ut-=5,i.ncode=4+(15&ht),ht>>>=4,ut-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=st;break}i.have=0,i.mode=Y;case Y:for(;i.have>>=3,ut-=3}for(;i.have<19;)i.lens[Mt[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,Lt={bits:i.lenbits},St=m(y,i.lens,0,19,i.lencode,0,i.work,Lt),i.lenbits=Lt.bits,St){t.msg="invalid code lengths set",i.mode=st;break}i.have=0,i.mode=X;case X:for(;i.have>>16&255,Et=65535&Rt,!((mt=Rt>>>24)<=ut);){if(0===u)break t;u--,ht+=n[s++]<>>=mt,ut-=mt,i.lens[i.have++]=Et;else{if(16===Et){for(Tt=mt+2;ut>>=mt,ut-=mt,0===i.have){t.msg="invalid bit length repeat",i.mode=st;break}wt=i.lens[i.have-1],pt=3+(3&ht),ht>>>=2,ut-=2}else if(17===Et){for(Tt=mt+3;ut>>=mt)),ht>>>=3,ut-=3}else{for(Tt=mt+7;ut>>=mt)),ht>>>=7,ut-=7}if(i.have+pt>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=st;break}for(;pt--;)i.lens[i.have++]=wt}}if(i.mode===st)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=st;break}if(i.lenbits=9,Lt={bits:i.lenbits},St=m(E,i.lens,0,i.nlen,i.lencode,0,i.work,Lt),i.lenbits=Lt.bits,St){t.msg="invalid literal/lengths set",i.mode=st;break}if(i.distbits=6,i.distcode=i.distdyn,Lt={bits:i.distbits},St=m(v,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Lt),i.distbits=Lt.bits,St){t.msg="invalid distances set",i.mode=st;break}if(i.mode=J,e===w)break t;case J:i.mode=Z;case Z:if(u>=6&&c>=258){t.next_out=a,t.avail_out=c,t.next_in=s,t.avail_in=u,i.hold=ht,i.bits=ut,g(t,dt),a=t.next_out,o=t.output,c=t.avail_out,s=t.next_in,n=t.input,u=t.avail_in,ht=i.hold,ut=i.bits,i.mode===U&&(i.back=-1);break}for(i.back=0;yt=(Rt=i.lencode[ht&(1<>>16&255,Et=65535&Rt,!((mt=Rt>>>24)<=ut);){if(0===u)break t;u--,ht+=n[s++]<>vt)])>>>16&255,Et=65535&Rt,!(vt+(mt=Rt>>>24)<=ut);){if(0===u)break t;u--,ht+=n[s++]<>>=vt,ut-=vt,i.back+=vt}if(ht>>>=mt,ut-=mt,i.back+=mt,i.length=Et,0===yt){i.mode=it;break}if(32&yt){i.back=-1,i.mode=U;break}if(64&yt){t.msg="invalid literal/length code",i.mode=st;break}i.extra=15&yt,i.mode=Q;case Q:if(i.extra){for(Tt=i.extra;ut>>=i.extra,ut-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=$;case $:for(;yt=(Rt=i.distcode[ht&(1<>>16&255,Et=65535&Rt,!((mt=Rt>>>24)<=ut);){if(0===u)break t;u--,ht+=n[s++]<>vt)])>>>16&255,Et=65535&Rt,!(vt+(mt=Rt>>>24)<=ut);){if(0===u)break t;u--,ht+=n[s++]<>>=vt,ut-=vt,i.back+=vt}if(ht>>>=mt,ut-=mt,i.back+=mt,64&yt){t.msg="invalid distance code",i.mode=st;break}i.offset=Et,i.extra=15&yt,i.mode=tt;case tt:if(i.extra){for(Tt=i.extra;ut>>=i.extra,ut-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=st;break}i.mode=et;case et:if(0===c)break t;if(pt=dt-c,i.offset>pt){if((pt=i.offset-pt)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=st;break}pt>i.wnext?(pt-=i.wnext,ft=i.wsize-pt):ft=i.wnext-pt,pt>i.length&&(pt=i.length),gt=i.window}else gt=o,ft=a-i.offset,pt=i.length;pt>c&&(pt=c),c-=pt,i.length-=pt;do o[a++]=gt[ft++];while(--pt);0===i.length&&(i.mode=Z);break;case it:if(0===c)break t;o[a++]=i.length,c--,i.mode=Z;break;case rt:if(i.wrap){for(;ut<32;){if(0===u)break t;u--,ht|=n[s++]<=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var i=o.inflateInit2(this.strm,e.windowBits);if(i!==l.Z_OK)throw new Error(h[i]);this.header=new c,o.inflateGetHeader(this.strm,this.header)}function n(t,e){var i=new r(e);if(i.push(t,!0),i.err)throw i.msg||h[i.err];return i.result}var o=i(62),s=i(2),a=i(31),l=i(29),h=i(16),u=i(30),c=i(59),d=Object.prototype.toString;r.prototype.push=function(t,e){var i,r,n,h,u,c,p=this.strm,f=this.options.chunkSize,g=this.options.dictionary,m=!1;if(this.ended)return!1;r=e===~~e?e:!0===e?l.Z_FINISH:l.Z_NO_FLUSH,"string"==typeof t?p.input=a.binstring2buf(t):"[object ArrayBuffer]"===d.call(t)?p.input=new Uint8Array(t):p.input=t,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new s.Buf8(f),p.next_out=0,p.avail_out=f),(i=o.inflate(p,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&g&&(c="string"==typeof g?a.string2buf(g):"[object ArrayBuffer]"===d.call(g)?new Uint8Array(g):g,i=o.inflateSetDictionary(this.strm,c)),i===l.Z_BUF_ERROR&&!0===m&&(i=l.Z_OK,m=!1),i!==l.Z_STREAM_END&&i!==l.Z_OK)return this.onEnd(i),this.ended=!0,!1;p.next_out&&(0!==p.avail_out&&i!==l.Z_STREAM_END&&(0!==p.avail_in||r!==l.Z_FINISH&&r!==l.Z_SYNC_FLUSH)||("string"===this.options.to?(n=a.utf8border(p.output,p.next_out),h=p.next_out-n,u=a.buf2string(p.output,n),p.next_out=h,p.avail_out=f-h,h&&s.arraySet(p.output,p.output,n,h,0),this.onData(u)):this.onData(s.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(m=!0)}while((p.avail_in>0||0===p.avail_out)&&i!==l.Z_STREAM_END);return i===l.Z_STREAM_END&&(r=l.Z_FINISH),r===l.Z_FINISH?(i=o.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===l.Z_OK):r!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),p.avail_out=0,!0)},r.prototype.onData=function(t){this.chunks.push(t)},r.prototype.onEnd=function(t){t===l.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=r,e.inflate=n,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,n(t,e)},e.ungzip=n},function(t,e,i){"use strict";function r(t){for(var e=t.length;--e>=0;)t[e]=0}function n(t,e,i,r,n){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=t&&t.length}function o(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function s(t){return t<256?Y[t]:Y[256+(t>>>7)]}function a(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function l(t,e,i){t.bi_valid>k-i?(t.bi_buf|=e<>k-t.bi_valid,t.bi_valid+=i-k):(t.bi_buf|=e<>>=1,i<<=1;while(--e>0);return i>>>1}function c(t,e,i){var r,n,o=new Array(D+1),s=0;for(r=1;r<=D;r++)o[r]=s=s+i[r-1]<<1;for(n=0;n<=e;n++){var a=t[2*n+1];0!==a&&(t[2*n]=u(o[a]++,a))}}function d(t){var e;for(e=0;e8?a(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function f(t,e,i,r){var n=2*e,o=2*i;return t[n]>1;i>=1;i--)g(t,o,i);n=l;do i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],g(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,o[2*n]=o[2*i]+o[2*r],t.depth[n]=(t.depth[i]>=t.depth[r]?t.depth[i]:t.depth[r])+1,o[2*i+1]=o[2*r+1]=n,t.heap[1]=n++,g(t,o,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var i,r,n,o,s,a,l=e.dyn_tree,h=e.max_code,u=e.stat_desc.static_tree,c=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,f=e.stat_desc.max_length,g=0;for(o=0;o<=D;o++)t.bl_count[o]=0;for(l[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;if&&(o=f,g++),l[2*r+1]=o,r>h||(t.bl_count[o]++,s=0,r>=p&&(s=d[r-p]),a=l[2*r],t.opt_len+=a*(o+s),c&&(t.static_len+=a*(u[2*r+1]+s)));if(0!==g){do{for(o=f-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[f]--,g-=2}while(g>0);for(o=f;0!==o;o--)for(r=t.bl_count[o];0!==r;)(n=t.heap[--i])>h||(l[2*n+1]!==o&&(t.opt_len+=(o-l[2*n+1])*l[2*n],l[2*n+1]=o),r--)}}(t,e),c(o,h,t.bl_count)}function E(t,e,i){var r,n,o=-1,s=e[1],a=0,l=7,h=4;for(0===s&&(l=138,h=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)n=s,s=e[2*(r+1)+1],++a>=7;r0?(t.strm.data_type===T&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return S;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return L;for(e=32;e=3&&0===t.bl_tree[2*z[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==e?_(t,e,i,r):t.strategy===w||o===n?(l(t,(x<<1)+(r?1:0),3),m(t,H,q)):(l(t,(M<<1)+(r?1:0),3),function(t,e,i,r){var n;for(l(t,e-257,5),l(t,i-1,5),l(t,r-4,4),n=0;n>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(X[i]+A+1)]++,t.dyn_dtree[2*s(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){l(t,x<<1,3),h(t,F,H),function(t){16===t.bi_valid?(a(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},function(t,e,i){"use strict";function r(t,e){return t.msg=L[e],e}function n(t){return(t<<1)-(t>4?9:0)}function o(t){for(var e=t.length;--e>=0;)t[e]=0}function s(t){var e=t.state,i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(_.arraySet(t.output,e.pending_buf,e.pending_out,i,t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))}function a(t,e){b._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,s(t.strm)}function l(t,e){t.pending_buf[t.pending++]=e}function h(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function u(t,e,i,r){var n=t.avail_in;return n>r&&(n=r),0===n?0:(t.avail_in-=n,_.arraySet(e,t.input,t.next_in,n,i),1===t.state.wrap?t.adler=w(t.adler,e,n,i):2===t.state.wrap&&(t.adler=S(t.adler,e,n,i)),t.next_in+=n,t.total_in+=n,n)}function c(t,e){var i,r,n=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match,l=t.strstart>t.w_size-$?t.strstart-(t.w_size-$):0,h=t.window,u=t.w_mask,c=t.prev,d=t.strstart+Q,p=h[o+s-1],f=h[o+s];t.prev_length>=t.good_match&&(n>>=2),a>t.lookahead&&(a=t.lookahead);do if(h[(i=e)+s]===f&&h[i+s-1]===p&&h[i]===h[o]&&h[++i]===h[o+1]){o+=2,i++;do;while(h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&h[++o]===h[++i]&&os){if(t.match_start=e,s=r,r>=a)break;p=h[o+s-1],f=h[o+s]}}while((e=c[e&u])>l&&0!=--n);return s<=t.lookahead?s:t.lookahead}function d(t){var e,i,r,n,o,s=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-$)){_.arraySet(t.window,t.window,s,s,0),t.match_start-=s,t.strstart-=s,t.block_start-=s,e=i=t.hash_size;do r=t.head[--e],t.head[e]=r>=s?r-s:0;while(--i);e=i=s;do r=t.prev[--e],t.prev[e]=r>=s?r-s:0;while(--i);n+=s}if(0===t.strm.avail_in)break;if(i=u(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=Z)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<=Z&&(t.ins_h=(t.ins_h<=Z)if(r=b._tr_tally(t,t.strstart-t.match_start,t.match_length-Z),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Z){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=Z&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=Z-1)),t.prev_length>=Z&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-Z,r=b._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-Z),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=(t.ins_h<15&&(l=2,n-=16),s<1||s>K||i!==U||n<8||n>15||e<0||e>9||a<0||a>G)return r(t,O);8===n&&(n=9);var h=new function(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=U,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new _.Buf16(2*X),this.dyn_dtree=new _.Buf16(2*(2*q+1)),this.bl_tree=new _.Buf16(2*(2*Y+1)),o(this.dyn_ltree),o(this.dyn_dtree),o(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new _.Buf16(J+1),this.heap=new _.Buf16(2*H+1),o(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new _.Buf16(2*H+1),o(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0};return t.state=h,h.strm=t,h.wrap=l,h.gzhead=null,h.w_bits=n,h.w_size=1<t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(d(t),0===t.lookahead&&e===T)return lt;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+i;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,a(t,!1),0===t.strm.avail_out))return lt;if(t.strstart-t.block_start>=t.w_size-$&&(a(t,!1),0===t.strm.avail_out))return lt}return t.insert=0,e===M?(a(t,!0),0===t.strm.avail_out?ut:ct):(t.strstart>t.block_start&&(a(t,!1),t.strm.avail_out),lt)}),new g(4,4,8,4,p),new g(4,5,16,8,p),new g(4,6,32,32,p),new g(4,4,16,16,f),new g(8,16,32,32,f),new g(8,16,128,128,f),new g(8,32,128,256,f),new g(32,128,258,1024,f),new g(32,258,258,4096,f)],e.deflateInit=function(t,e){return E(t,e,U,j,z,W)},e.deflateInit2=E,e.deflateReset=y,e.deflateResetKeep=m,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?O:(t.state.gzhead=e,A):O},e.deflate=function(t,e){var i,u,c,p;if(!t||!t.state||e>C||e<0)return t?r(t,O):O;if(u=t.state,!t.output||!t.input&&0!==t.avail_in||u.status===at&&e!==M)return r(t,0===t.avail_out?I:O);if(u.strm=t,i=u.last_flush,u.last_flush=e,u.status===et)if(2===u.wrap)t.adler=0,l(u,31),l(u,139),l(u,8),u.gzhead?(l(u,(u.gzhead.text?1:0)+(u.gzhead.hcrc?2:0)+(u.gzhead.extra?4:0)+(u.gzhead.name?8:0)+(u.gzhead.comment?16:0)),l(u,255&u.gzhead.time),l(u,u.gzhead.time>>8&255),l(u,u.gzhead.time>>16&255),l(u,u.gzhead.time>>24&255),l(u,9===u.level?2:u.strategy>=V||u.level<2?4:0),l(u,255&u.gzhead.os),u.gzhead.extra&&u.gzhead.extra.length&&(l(u,255&u.gzhead.extra.length),l(u,u.gzhead.extra.length>>8&255)),u.gzhead.hcrc&&(t.adler=S(t.adler,u.pending_buf,u.pending,0)),u.gzindex=0,u.status=it):(l(u,0),l(u,0),l(u,0),l(u,0),l(u,0),l(u,9===u.level?2:u.strategy>=V||u.level<2?4:0),l(u,dt),u.status=st);else{var f=U+(u.w_bits-8<<4)<<8;f|=(u.strategy>=V||u.level<2?0:u.level<6?1:6===u.level?2:3)<<6,0!==u.strstart&&(f|=tt),f+=31-f%31,u.status=st,h(u,f),0!==u.strstart&&(h(u,t.adler>>>16),h(u,65535&t.adler)),t.adler=1}if(u.status===it)if(u.gzhead.extra){for(c=u.pending;u.gzindex<(65535&u.gzhead.extra.length)&&(u.pending!==u.pending_buf_size||(u.gzhead.hcrc&&u.pending>c&&(t.adler=S(t.adler,u.pending_buf,u.pending-c,c)),s(t),c=u.pending,u.pending!==u.pending_buf_size));)l(u,255&u.gzhead.extra[u.gzindex]),u.gzindex++;u.gzhead.hcrc&&u.pending>c&&(t.adler=S(t.adler,u.pending_buf,u.pending-c,c)),u.gzindex===u.gzhead.extra.length&&(u.gzindex=0,u.status=rt)}else u.status=rt;if(u.status===rt)if(u.gzhead.name){c=u.pending;do{if(u.pending===u.pending_buf_size&&(u.gzhead.hcrc&&u.pending>c&&(t.adler=S(t.adler,u.pending_buf,u.pending-c,c)),s(t),c=u.pending,u.pending===u.pending_buf_size)){p=1;break}p=u.gzindexc&&(t.adler=S(t.adler,u.pending_buf,u.pending-c,c)),0===p&&(u.gzindex=0,u.status=nt)}else u.status=nt;if(u.status===nt)if(u.gzhead.comment){c=u.pending;do{if(u.pending===u.pending_buf_size&&(u.gzhead.hcrc&&u.pending>c&&(t.adler=S(t.adler,u.pending_buf,u.pending-c,c)),s(t),c=u.pending,u.pending===u.pending_buf_size)){p=1;break}p=u.gzindexc&&(t.adler=S(t.adler,u.pending_buf,u.pending-c,c)),0===p&&(u.status=ot)}else u.status=ot;if(u.status===ot&&(u.gzhead.hcrc?(u.pending+2>u.pending_buf_size&&s(t),u.pending+2<=u.pending_buf_size&&(l(u,255&t.adler),l(u,t.adler>>8&255),t.adler=0,u.status=st)):u.status=st),0!==u.pending){if(s(t),0===t.avail_out)return u.last_flush=-1,A}else if(0===t.avail_in&&n(e)<=n(i)&&e!==M)return r(t,I);if(u.status===at&&0!==t.avail_in)return r(t,I);if(0!==t.avail_in||0!==u.lookahead||e!==T&&u.status!==at){var g=u.strategy===V?function(t,e){for(var i;;){if(0===t.lookahead&&(d(t),0===t.lookahead)){if(e===T)return lt;break}if(t.match_length=0,i=b._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(a(t,!1),0===t.strm.avail_out))return lt}return t.insert=0,e===M?(a(t,!0),0===t.strm.avail_out?ut:ct):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?lt:ht}(u,e):u.strategy===F?function(t,e){for(var i,r,n,o,s=t.window;;){if(t.lookahead<=Q){if(d(t),t.lookahead<=Q&&e===T)return lt;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=Z&&t.strstart>0&&(r=s[n=t.strstart-1])===s[++n]&&r===s[++n]&&r===s[++n]){o=t.strstart+Q;do;while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Z?(i=b._tr_tally(t,1,t.match_length-Z),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=b._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(a(t,!1),0===t.strm.avail_out))return lt}return t.insert=0,e===M?(a(t,!0),0===t.strm.avail_out?ut:ct):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?lt:ht}(u,e):v[u.level].func(u,e);if(g!==ut&&g!==ct||(u.status=at),g===lt||g===ut)return 0===t.avail_out&&(u.last_flush=-1),A;if(g===ht&&(e===R?b._tr_align(u):e!==C&&(b._tr_stored_block(u,0,0,!1),e===x&&(o(u.head),0===u.lookahead&&(u.strstart=0,u.block_start=0,u.insert=0))),s(t),0===t.avail_out))return u.last_flush=-1,A}return e!==M?A:u.wrap<=0?P:(2===u.wrap?(l(u,255&t.adler),l(u,t.adler>>8&255),l(u,t.adler>>16&255),l(u,t.adler>>24&255),l(u,255&t.total_in),l(u,t.total_in>>8&255),l(u,t.total_in>>16&255),l(u,t.total_in>>24&255)):(h(u,t.adler>>>16),h(u,65535&t.adler)),s(t),u.wrap>0&&(u.wrap=-u.wrap),0!==u.pending?A:P)},e.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==et&&e!==it&&e!==rt&&e!==nt&&e!==ot&&e!==st&&e!==at?r(t,O):(t.state=null,e===st?r(t,N):A):O},e.deflateSetDictionary=function(t,e){var i,r,n,s,a,l,h,u,c=e.length;if(!t||!t.state)return O;if(2===(s=(i=t.state).wrap)||1===s&&i.status!==et||i.lookahead)return O;for(1===s&&(t.adler=w(t.adler,e,c,0)),i.wrap=0,c>=i.w_size&&(0===s&&(o(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new _.Buf8(i.w_size),_.arraySet(u,e,c-i.w_size,i.w_size,0),e=u,c=i.w_size),a=t.avail_in,l=t.next_in,h=t.input,t.avail_in=c,t.next_in=0,t.input=e,d(i);i.lookahead>=Z;){r=i.strstart,n=i.lookahead-(Z-1);do i.ins_h=(i.ins_h<0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var i=o.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==c)throw new Error(l[i]);if(e.header&&o.deflateSetHeader(this.strm,e.header),e.dictionary){var n;if(n="string"==typeof e.dictionary?a.string2buf(e.dictionary):"[object ArrayBuffer]"===u.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary, (i=o.deflateSetDictionary(this.strm,n))!==c)throw new Error(l[i]);this._dict_set=!0}}function n(t,e){var i=new r(e);if(i.push(t,!0),i.err)throw i.msg||l[i.err];return i.result}var o=i(65),s=i(2),a=i(31),l=i(16),h=i(30),u=Object.prototype.toString,c=0,d=-1,p=0,f=8;r.prototype.push=function(t,e){var i,r,n=this.strm,l=this.options.chunkSize;if(this.ended)return!1;r=e===~~e?e:!0===e?4:0,"string"==typeof t?n.input=a.string2buf(t):"[object ArrayBuffer]"===u.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new s.Buf8(l),n.next_out=0,n.avail_out=l),1!==(i=o.deflate(n,r))&&i!==c)return this.onEnd(i),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(a.buf2binstring(s.shrinkBuf(n.output,n.next_out))):this.onData(s.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==i);return 4===r?(i=o.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===c):2!==r||(this.onEnd(c),n.avail_out=0,!0)},r.prototype.onData=function(t){this.chunks.push(t)},r.prototype.onEnd=function(t){t===c&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=r,e.deflate=n,e.deflateRaw=function(t,e){return(e=e||{}).raw=!0,n(t,e)},e.gzip=function(t,e){return(e=e||{}).gzip=!0,n(t,e)}},function(t,e,i){"use strict";var r={};(0,i(2).assign)(r,i(66),i(63),i(29)),t.exports=r},function(t,e,i){"use strict";function r(t,e){a.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,o=i(67),s=i(0),a=i(1),l=n?"uint8array":"array";e.magic="\b\0",s.inherits(r,a),r.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(l,t.data),!1)},r.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},r.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},r.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},e.compressWorker=function(t){return new r("Deflate",t)},e.uncompressWorker=function(){return new r("Inflate",{})}},function(t,e,i){"use strict";var r=i(34),n=i(58);e.generateWorker=function(t,e,i){var o=new n(e.streamFiles,i,e.platform,e.encodeFileName),s=0;try{t.forEach(function(t,i){s++;var n=function(t,e){var i=t||e,n=r[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,e.compression),a=i.options.compressionOptions||e.compressionOptions||{},l=i.dir,h=i.date;i._compressWorker(n,a).withStreamInfo("file",{name:t,dir:l,date:h,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(o)}),o.entriesCount=s}catch(t){o.error(t)}return o}},function(t,e,i){"use strict";var r=i(39),n=i(37),o=i(7),s=i(18),a=i(1),l=function(t,e,i){this.name=t,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=e,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}};l.prototype={internalStream:function(t){var e=null,i="string";try{if(!t)throw new Error("No output type specified.");var n="string"===(i=t.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),e=this._decompressWorker();var s=!this._dataBinary;s&&!n&&(e=e.pipe(new o.Utf8EncodeWorker)),!s&&n&&(e=e.pipe(new o.Utf8DecodeWorker))}catch(t){(e=new a("error")).error(t)}return new r(e,i,"")},async:function(t,e){return this.internalStream(t).accumulate(e)},nodeStream:function(t,e){return this.internalStream(t||"nodebuffer").toNodejsStream(e)},_compressWorker:function(t,e){if(this._data instanceof s&&this._data.compression.magic===t.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),s.createWorkerFrom(i,t,e)},_decompressWorker:function(){return this._data instanceof s?this._data.getContentWorker():this._data instanceof a?this._data:new n(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],u=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},c=0;ci;)e.push(arguments[i++]);return m[++g]=function(){a("function"==typeof t?t:Function(t),e)},r(g),g},p=function(t){delete m[t]},"process"==i(75)(c)?r=function(t){c.nextTick(s(y,t,1))}:f?(o=(n=new f).port2,n.port1.onmessage=E,r=s(o.postMessage,o,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(r=function(t){u.postMessage(t+"","*")},u.addEventListener("message",E,!1)):r="onreadystatechange"in h("script")?function(t){l.appendChild(h("script")).onreadystatechange=function(){l.removeChild(this),y.call(t)}}:function(t){setTimeout(s(y,t,1),0)}),t.exports={set:d,clear:p}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,i){var r=i(20);t.exports=function(t,e){if(!r(t))return t;var i,n;if(e&&"function"==typeof(i=t.toString)&&!r(n=i.call(t)))return n;if("function"==typeof(i=t.valueOf)&&!r(n=i.call(t)))return n;if(!e&&"function"==typeof(i=t.toString)&&!r(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")}},function(t,e,i){t.exports=!i(19)&&!i(41)(function(){return 7!=Object.defineProperty(i(40)("div"),"a",{get:function(){return 7}}).a})},function(t,e,i){var r=i(20);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,i){var r=i(82),n=i(81),o=i(80),s=Object.defineProperty;e.f=i(19)?Object.defineProperty:function(t,e,i){if(r(t),e=o(e,!0),r(i),n)try{return s(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){var r=i(83),n=i(79);t.exports=i(19)?function(t,e,i){return r.f(t,e,n(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,i){var r=i(11),n=i(43),o=i(42),s=i(84),a=function(t,e,i){var l,h,u,c=t&a.F,d=t&a.G,p=t&a.S,f=t&a.P,g=t&a.B,m=t&a.W,y=d?n:n[e]||(n[e]={}),E=y.prototype,v=d?r:p?r[e]:(r[e]||{}).prototype;for(l in d&&(i=e),i)(h=!c&&v&&void 0!==v[l])&&l in y||(u=h?v[l]:i[l],y[l]=d&&"function"!=typeof v[l]?i[l]:g&&h?o(u,r):m&&v[l]==u?function(t){var e=function(e,i,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,i)}return new t(e,i,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(u):f&&"function"==typeof u?o(Function.call,u):u,f&&((y.virtual||(y.virtual={}))[l]=u,t&a.R&&E&&!E[l]&&s(E,l,u)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,e,i){var r=i(86),n=i(78);r(r.G+r.B,{setImmediate:n.set,clearImmediate:n.clear})},function(t,e,i){i(87),t.exports=i(43).setImmediate},function(t,e,i){t.exports=i(22).PassThrough},function(t,e,i){t.exports=i(22).Transform},function(t,e,i){t.exports=i(4)},function(t,e,i){t.exports=i(21)},function(t,e,i){"use strict";function r(t){return this instanceof r?void n.call(this,t):new r(t)}t.exports=r;var n=i(45),o=i(9);o.inherits=i(6),o.inherits(r,n),r.prototype._transform=function(t,e,i){i(null,t)}},function(t,e,i){(function(e){function i(t){try{if(!e.localStorage)return!1}catch(t){return!1}var i=e.localStorage[t];return null!=i&&"true"===String(i).toLowerCase()}t.exports=function(t,e){if(i("noDeprecation"))return t;var r=!1;return function(){if(!r){if(i("throwDeprecation"))throw new Error(e);i("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,i(5))},function(t,e,i){(function(t,e){!function(t,i){"use strict";function r(t){delete a[t]}function n(t){if(l)setTimeout(n,0,t);else{var e=a[t];if(e){l=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(i,r)}}(e)}finally{r(t),l=!1}}}}if(!t.setImmediate){var o,s=1,a={},l=!1,h=t.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(t);u=u&&u.setTimeout?u:t,"[object process]"==={}.toString.call(t.process)?o=function(t){e.nextTick(function(){n(t)})}:function(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}}()?function(){var e="setImmediate$"+Math.random()+"$",i=function(i){i.source===t&&"string"==typeof i.data&&0===i.data.indexOf(e)&&n(+i.data.slice(e.length))};t.addEventListener?t.addEventListener("message",i,!1):t.attachEvent("onmessage",i),o=function(i){t.postMessage(e+i,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){n(t.data)},o=function(e){t.port2.postMessage(e)}}():h&&"onreadystatechange"in h.createElement("script")?function(){var t=h.documentElement;o=function(e){var i=h.createElement("script");i.onreadystatechange=function(){n(e),i.onreadystatechange=null,t.removeChild(i),i=null},t.appendChild(i)}}():o=function(t){setTimeout(n,0,t)},u.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},i(95),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,i(5))},function(t,e){},function(t,e,i){"use strict";function r(t,e,i){t.copy(e,i)}var n=i(13).Buffer,o=i(97);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,i=""+e.data;e=e.next;)i+=t+e.data;return i},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e=n.allocUnsafe(t>>>0),i=this.head,o=0;i;)r(i.data,e,o),o+=i.data.length,i=i.next;return e},t}(),o&&o.inspect&&o.inspect.custom&&(t.exports.prototype[o.inspect.custom]=function(){var t=o.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,i){function r(){n.call(this)}t.exports=r;var n=i(23).EventEmitter;i(6)(r,n),r.Readable=i(22),r.Writable=i(92),r.Duplex=i(91),r.Transform=i(90),r.PassThrough=i(89),r.Stream=r,r.prototype.pipe=function(t,e){function i(e){t.writable&&!1===t.write(e)&&h.pause&&h.pause()}function r(){h.readable&&h.resume&&h.resume()}function o(){u||(u=!0,t.end())}function s(){u||(u=!0,"function"==typeof t.destroy&&t.destroy())}function a(t){if(l(),0===n.listenerCount(this,"error"))throw t}function l(){h.removeListener("data",i),t.removeListener("drain",r),h.removeListener("end",o),h.removeListener("close",s),h.removeListener("error",a),t.removeListener("error",a),h.removeListener("end",l),h.removeListener("close",l),t.removeListener("close",l)}var h=this;h.on("data",i),t.on("drain",r),t._isStdio||e&&!1===e.end||(h.on("end",o),h.on("close",s));var u=!1;return h.on("error",a),t.on("error",a),h.on("end",l),h.on("close",l),t.on("close",l),t.emit("pipe",h),t}},function(t,e){e.read=function(t,e,i,r,n){var o,s,a=8*n-r-1,l=(1<>1,u=-7,c=i?n-1:0,d=i?-1:1,p=t[e+c];for(c+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+t[e+c],c+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+c],c+=d,u-=8);if(0===o)o=1-h;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=h}return(p?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,i,r,n,o){var s,a,l,h=8*o-n-1,u=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?d/l:d*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=u?(a=0,s=u):s+c>=1?(a=(e*l-1)*Math.pow(2,n),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),s=0));n>=8;t[i+p]=255&a,p+=f,a/=256,n-=8);for(s=s<0;t[i+p]=255&s,p+=f,s/=256,h-=8);t[i+p-f]|=128*g}},function(t,e,i){"use strict";function r(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");return-1===i&&(i=e),[i,i===e?0:4-i%4]}function n(t){return s[t>>18&63]+s[t>>12&63]+s[t>>6&63]+s[63&t]}function o(t,e,i){for(var r,o=[],s=e;s0?n-4:n,c=0;c>16&255,s[h++]=e>>8&255,s[h++]=255&e;return 2===o&&(e=a[t.charCodeAt(c)]<<2|a[t.charCodeAt(c+1)]>>4,s[h++]=255&e),1===o&&(e=a[t.charCodeAt(c)]<<10|a[t.charCodeAt(c+1)]<<4|a[t.charCodeAt(c+2)]>>2,s[h++]=e>>8&255,s[h++]=255&e),s},e.fromByteArray=function(t){for(var e,i=t.length,r=i%3,n=[],a=0,l=i-r;al?l:a+16383));return 1===r?(e=t[i-1],n.push(s[e>>2]+s[e<<4&63]+"==")):2===r&&(e=(t[i-2]<<8)+t[i-1],n.push(s[e>>10]+s[e>>4&63]+s[e<<2&63]+"=")),n.join("")};for(var s=[],a=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,c=h.length;u0?t.substring(0,e):""},m=function(t){return"/"!==t.slice(-1)&&(t+="/"),t},y=function(t,e){return e=void 0!==e?e:l.createFolders,t=m(t),this.files[t]||f.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]},E={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(t){var e,i,r;for(e in this.files)this.files.hasOwnProperty(e)&&(r=this.files[e],(i=e.slice(this.root.length,e.length))&&e.slice(0,this.root.length)===this.root&&t(i,r))},filter:function(t){var e=[];return this.forEach(function(i,r){t(i,r)&&e.push(r)}),e},file:function(t,e,i){if(1===arguments.length){if(r(t)){var n=t;return this.filter(function(t,e){return!e.dir&&n.test(t)})}var o=this.files[this.root+t];return o&&!o.dir?o:null}return t=this.root+t,f.call(this,t,e,i),this},folder:function(t){if(!t)return this;if(r(t))return this.filter(function(e,i){return i.dir&&t.test(e)});var e=this.root+t,i=y.call(this,e),n=this.clone();return n.root=i.name,n},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!==t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var i=this.filter(function(e,i){return i.name.slice(0,t.length)===t}),r=0;ri.kmlMinAltitude)&&(!i.kmlMaxAltitude||e.eyePosition.altituder||e.to>r))return!1}return!0},h.prototype.getStyle=function(t,e){if(!this._pStyle){var i=this;return e.styleResolver.handleRemoteStyle(i.kmlStyleUrl,i.kmlStyleSelector).then(function(e){i._pStyle=e,t.redrawRequested=!0})}},h.prototype.getTagNames=function(){return["NetworkLink","Placemark","PhotoOverlay","ScreenOverlay","GroundOverlay","Folder","Document"]},h}),i("formats/kml/features/KmlContainer",["./KmlFeature"],function(t){"use strict";var e=function(e){t.call(this,e)};return e.prototype=Object.create(t.prototype),Object.defineProperties(e.prototype,{kmlShapes:{get:function(){var t=this._factory.all(this);return t.filter(function(t){return t.isFeature})}}}),e.prototype.render=function(e,i){t.prototype.render.call(this,e,i);var r=this;this.kmlShapes.forEach(function(t){t.render(e,{lastStyle:i.lastStyle,lastVisibility:r.enabled,currentTimeInterval:i.currentTimeInterval,regionInvisible:i.regionInvisible,fileCache:i.fileCache,styleResolver:i.styleResolver,listener:i.listener,activeEvents:i.activeEvents})})},e.prototype.getTagNames=function(){return["Folder","Document"]},e}),i("formats/kml/controls/KmlControls",["../../../util/Logger"],function(t){"use strict";var e=function(){};return e.prototype.hook=function(){t.logMessage(t.LEVEL_WARNING,"KmlControls","hook","Every KML controls should override hook method.")},e}),i("formats/kml/util/KmlCreate",["../KmlElements","../KmlObject"],function(t,e){var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),Object.defineProperties(i.prototype,{shapes:{get:function(){return this._factory.all(this)}}}),i.prototype.getTagNames=function(){return["Create"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/util/KmlDelete",["../KmlElements","../KmlObject"],function(t,e){var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),Object.defineProperties(i.prototype,{shapes:{get:function(){return this._factory.all(this)}}}),i.prototype.getTagNames=function(){return["Delete"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/util/KmlSchema",["./../KmlElements","../KmlObject"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["Schema"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/features/KmlDocument",["./KmlContainer","../KmlElements","./KmlFeature","../util/KmlSchema"],function(t,e,i,r){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),Object.defineProperties(n.prototype,{kmlSchemas:{get:function(){var t=this._factory.all(this);return t.filter(function(t){return t instanceof r})}}}),n.prototype.getTagNames=function(){return["Document"]},e.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/features/KmlFolder",["./KmlContainer","./../KmlElements"],function(t,e){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),i.prototype.getTagNames=function(){return["Folder"]},e.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/geom/KmlGeometry",["../KmlObject"],function(t){"use strict";var e=function(e){t.call(this,e),this._renderable=null};return e.prototype=Object.create(t.prototype),e.prototype.render=function(e,i){t.prototype.render.call(this,e,i),this.enabled=i.lastVisibility},e.prototype.getTagNames=e.getTagNames=function(){return["Point","LinearRing","LineString","MultiGeometry","Polygon"]},e}),i("formats/kml/KmlLatLonBox",["./KmlElements","./KmlObject","./util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlNorth:{get:function(){return this._factory.specific(this,{name:"north",transformer:i.number})}},kmlSouth:{get:function(){return this._factory.specific(this,{name:"south",transformer:i.number})}},kmlEast:{get:function(){return this._factory.specific(this,{name:"east",transformer:i.number})}},kmlWest:{get:function(){return this._factory.specific(this,{name:"west",transformer:i.number})}},kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["LatLonBox"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlLatLonQuad",["./KmlElements","./KmlObject","./util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlCoordinates:{get:function(){return this._factory.specific(this,{name:"coordinates",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["gx:LatLonQuad"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlOverlay",["./KmlFeature","./../KmlIcon","../util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlColor:{get:function(){return this._factory.specific(this,{name:"color",transformer:i.string})}},kmlDrawOrder:{get:function(){return this._factory.specific(this,{name:"drawOrder",transformer:i.string})}},kmlIcon:{get:function(){return this._factory.any(this,{name:e.prototype.getTagNames()})}}}),r.prototype.getTagNames=function(){return["PhotoOverlay","ScreenOverlay","GroundOverlay"]},r}),i("formats/kml/features/KmlGroundOverlay",["./../KmlElements","./KmlFeature","../KmlLatLonBox","../KmlLatLonQuad","./KmlOverlay","../util/KmlNodeTransformers","../../../geom/Sector","../../../shapes/SurfaceImage"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(t){this.isGroundOverlay=!0,n.call(this,t)};return l.prototype=Object.create(n.prototype),Object.defineProperties(l.prototype,{kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:o.string})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:o.string})}},kmlLatLonBox:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}},kmlLatLonQuad:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}}}),l.prototype.render=function(t,i){e.prototype.render.call(this,t,i),!this._renderable&&this.enabled&&this.kmlIcon&&this.kmlLatLonBox&&(this._renderable=new a(new s(this.kmlLatLonBox.kmlSouth,this.kmlLatLonBox.kmlNorth,this.kmlLatLonBox.kmlWest,this.kmlLatLonBox.kmlEast),this.kmlIcon.kmlHref(i.fileCache)),t.redrawRequested=!0),this._renderable&&this._renderable.render(t)},l.prototype.getTagNames=function(){return["GroundOverlay"]},t.addKey(l.prototype.getTagNames()[0],l),l}),i("formats/kml/util/KmlImagePyramid",["../KmlElements","../KmlObject","../util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlTileSize:{get:function(){return this._factory.specific(this,{name:"tileSize",transformer:i.number})}},kmlMaxWidth:{get:function(){return this._factory.specific(this,{name:"maxWidth",transformer:i.number})}},kmlMaxHeight:{get:function(){return this._factory.specific(this,{name:"maxHeight",transformer:i.number})}},kmlGridOrigin:{get:function(){return this._factory.specific(this,{name:"gridOrigin",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["ImagePyramid"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("shapes/Path",["../shapes/AbstractShape","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../shapes/SurfacePolyline","../geom/Vec2","../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p){"use strict";var f=function(i,r){if(!i)throw new e(s.logMessage(s.LEVEL_SEVERE,"Path","constructor","missingPositions"));t.call(this,r),this._positions=i,this._pathType=WorldWind.GREAT_CIRCLE,this._terrainConformance=10,this._numSubSegments=10,this.referencePosition=this.determineReferencePosition(this._positions),this.scratchPoint=new p(0,0,0)};return f.prototype=Object.create(t.prototype),Object.defineProperties(f.prototype,{positions:{get:function(){return this._positions},set:function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Path","constructor","missingPositions"));this._positions=t,this.referencePosition=this.determineReferencePosition(this._positions),this.reset()}},followTerrain:{get:function(){return this._followTerrain},set:function(t){this._followTerrain=t,this.reset()}},terrainConformance:{get:function(){return this._terrainConformance},set:function(t){this._terrainConformance=t,this.reset()}},numSubSegments:{get:function(){return this._numSubSegments},set:function(t){this._numSubSegments=t>=0?t:0,this.reset()}},pathType:{get:function(){return this._pathType},set:function(t){this._pathType=t,this.reset()}},extrude:{get:function(){return this._extrude},set:function(t){this._extrude=t,this.reset()}}}),f.prototype.determineReferencePosition=function(t){return t.length>0?t[0]:null},f.prototype.mustGenerateGeometry=function(t){return!this.currentData.tessellatedPoints||(this.currentData.drawInterior!==this.activeAttributes.drawInterior||this.currentData.drawVerticals!==this.activeAttributes.drawVerticals||(!this.followTerrain&&this.currentData.numSubSegments!==this.numSubSegments||(!(!this.followTerrain||this.currentData.terrainConformance===this.terrainConformance)||this.altitudeMode!==WorldWind.ABSOLUTE&&this.currentData.isExpired)))},f.prototype.createSurfaceShape=function(){return new c(this.positions,null)},f.prototype.doMakeOrderedRenderable=function(t){if(!this.referencePosition)return null;if(!this.mustGenerateGeometry(t))return this;var e=this.currentData.referencePoint;t.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude,this._altitudeMode,e),this.currentData.transformationMatrix.setToTranslation(e[0],e[1],e[2]);var i=this.makeTessellatedPositions(t);if(i.length<2)return null;var n=this.computeRenderedPath(t,i);return this.currentData.tessellatedPoints=n,this.currentData.drawInterior=this.activeAttributes.drawInterior,this.currentData.drawVerticals=this.activeAttributes.drawVerticals,this.currentData.numSubSegments=this.numSubSegments,this.currentData.terrainConformance=this.terrainConformance,this.resetExpiration(this.currentData),this.currentData.fillVbo=!0,this.currentData.extent||(this.currentData.extent=new r),this.currentData.extent.setToPoints(n),this.currentData.extent.translate(this.currentData.referencePoint),this},f.prototype.makeTessellatedPositions=function(t){var e,i,r,n=[],o=t.eyePoint,s=this.mustDrawVerticals(t),a=new p(0,0,0),l=new p(0,0,0),h=this._positions[0];s&&(this.currentData.verticalIndices=new Int16Array(2*this.positions.length),this.currentData.verticalIndices[0]=0,this.currentData.verticalIndices[1]=1),n.push(h),t.surfacePointForMode(h.latitude,h.longitude,h.altitude,this._altitudeMode,a);for(var u=1,c=this._positions.length;u=1||t.pickingMode),a.loadColor(s,t.pickingMode?r:i),a.loadOpacity(s,t.pickingMode?1:this.layer.opacity),s.vertexAttribPointer(a.vertexPointLocation,3,s.FLOAT,!1,0,0),s.drawArrays(s.TRIANGLE_STRIP,0,u)),this.activeAttributes.drawOutline&&((this.mustDrawVerticals(t)&&this.mustDrawInterior(t)||this.altitudeMode===WorldWind.CLAMP_TO_GROUND)&&this.applyMvpMatrixForOutline(t),i=this.activeAttributes.outlineColor,s.depthMask(i.alpha*this.layer.opacity>=1||t.pickingMode),a.loadColor(s,t.pickingMode?r:i),a.loadOpacity(s,t.pickingMode?1:this.layer.opacity),s.lineWidth(this.activeAttributes.outlineWidth),this.currentData.pointBufferHasExtrusionPoints?(n=24,o=u/2):(n=12,o=u),s.vertexAttribPointer(a.vertexPointLocation,3,s.FLOAT,!1,n,0),s.drawArrays(s.LINE_STRIP,0,o),this.mustDrawVerticals(t)&&(h.verticalIndicesVboCacheKey||(h.verticalIndicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(h.verticalIndicesVboCacheKey),e||(e=s.createBuffer(),t.gpuResourceCache.putResource(h.verticalIndicesVboCacheKey,e,4*h.verticalIndices.length),h.fillVbo=!0),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e),h.fillVbo&&(s.bufferData(s.ELEMENT_ARRAY_BUFFER,h.verticalIndices,s.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1)),s.vertexAttribPointer(a.vertexPointLocation,3,s.FLOAT,!1,0,0),s.drawElements(s.LINES,h.verticalIndices.length,s.UNSIGNED_SHORT,0))),h.fillVbo=!1,t.pickingMode){var c=new l(r,this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(c)}},f.prototype.beginDrawing=function(t){var e=t.currentGlContext;this.mustDrawInterior(t)&&e.disable(e.CULL_FACE),t.findAndBindProgram(i),e.enableVertexAttribArray(t.currentProgram.vertexPointLocation)},f.prototype.endDrawing=function(t){var e=t.currentGlContext;e.disableVertexAttribArray(t.currentProgram.vertexPointLocation),e.depthMask(!0),e.lineWidth(1),e.enable(e.CULL_FACE)},f}),i("formats/kml/geom/KmlLineString",["../../../util/Color","../KmlElements","./KmlGeometry","../styles/KmlStyle","../../../geom/Location","../util/KmlNodeTransformers","../../../shapes/Path","../../../geom/Position","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolyline","../../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(t){i.call(this,t),this._style=null};return c.prototype=Object.create(i.prototype),Object.defineProperties(c.prototype,{kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:o.boolean})||!1}},kmlTessellate:{get:function(){return this._factory.specific(this,{name:"tessellate",transformer:o.boolean})||!1}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:o.string})||WorldWind.ABSOLUTE}},kmlPositions:{get:function(){return this._factory.specific(this,{name:"coordinates",transformer:o.positions})}},kmlCenter:{get:function(){var t=this.kmlPositions,e=0,i=0,r=0;return t.forEach(function(t){e+=t.latitude,i+=t.longitude,r+=t.altitude}),new a(e/this.kmlPositions.length,i/this.kmlPositions.length,r/this.kmlPositions.length)}}}),c.prototype.createPath=function(t,e){this.kmlAltitudeMode==WorldWind.CLAMP_TO_GROUND?this._renderable=new h(this.prepareLocations(),this.prepareAttributes(t.normal,e)):this._renderable=new s(this.prepareLocations(),this.prepareAttributes(t.normal,e)),t.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(t.highlight,e)),this.moveValidProperties()},c.prototype.render=function(t,e){i.prototype.render.call(this,t,e),e.lastStyle&&!this._renderable&&(this.createPath(e.lastStyle,e.fileCache),t.redrawRequested=!0),this._renderable&&(this._renderable.enabled=this.enabled,this._renderable.render(t))},c.prototype.prepareAttributes=function(t,e){var i=t&&t.generate(e)||{};return i._applyLighting=!0,i._drawOutline=!0,i._drawInterior=!0,i._drawVerticals=this.kmlExtrude||!1,i._outlineStippleFactor=0,i._outlineStipplePattern=61680,i._enableLighting=!0,new l(r.shapeAttributes(i))},c.prototype.prepareLocations=function(){return this.kmlPositions},c.prototype.moveValidProperties=function(){this._renderable.extrude=this.kmlExtrude||!1,this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.ABSOLUTE,this._renderable.tesselate=this.kmlTesselate||!1},c.prototype.equals=function(t){if(!t)return!1;var e=u.arrayEquals(t.kmlPositions,this.kmlPositions);return e&&t.kmlExtrude==this.kmlExtrude&&t.kmlTessellate==this.kmlTessellate&&t.kmlAltitudeMode==this.kmlAltitudeMode},c.prototype.getTagNames=function(){return["LineString"]},e.addKey(c.prototype.getTagNames()[0],c),c}),i("formats/kml/geom/KmlLinearRing",["./KmlLineString","../KmlElements"],function(t,e){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),i.prototype.getTagNames=function(){return["LinearRing"]},e.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/KmlLocation",["./KmlElements","./KmlObject","./util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlLongitude:{get:function(){return this._factory.specific(this,{name:"longitude",transformer:i.string})}},kmlLatitude:{get:function(){return this._factory.specific(this,{name:"latitude",transformer:i.string})}},kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["Location"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlLookAt",["./KmlAbstractView","./KmlElements","./util/KmlNodeTransformers","../../geom/Position"],function(t,e,i,r){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),Object.defineProperties(n.prototype,{kmlLongitude:{get:function(){return this._factory.specific(this,{name:"longitude",transformer:i.number})}},kmlLatitude:{get:function(){return this._factory.specific(this,{name:"latitude",transformer:i.number})}},kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:i.number})}},kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:i.number})}},kmlTilt:{get:function(){return this._factory.specific(this,{name:"tilt",transformer:i.number})}},kmlRange:{get:function(){return this._factory.specific(this,{name:"range",transformer:i.number})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:i.string})}}}),n.prototype.update=function(t){if(t.wwd){var e=this.kmlAltitude||4e3;t.wwd.goTo(new r(this.kmlLatitude,this.kmlLongitude,e))}},n.prototype.getTagNames=function(){return["LookAt"]},e.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/geom/KmlMultiGeometry",["./../KmlElements","./KmlGeometry","../../../geom/Position"],function(t,e,i){"use strict";var r=function(t){e.call(this,t),this._style=t.style};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlShapes:{get:function(){return this._factory.all(this)}},kmlCenter:{get:function(){var t=this.kmlShapes.map(function(t){return t.kmlCenter}),e=0,r=0,n=0;return t.forEach(function(t){e+=t.latitude,r+=t.longitude,n+=t.altitude}),new i(e/t.length,r/t.length,n/t.length)}}}),r.prototype.render=function(t,i){e.prototype.render.call(this,t,i),this.kmlShapes.forEach(function(e){e.render(t,i)})},r.prototype.getTagNames=function(){return["MultiGeometry"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/geom/KmlMultiTrack",["./../KmlElements","./KmlGeometry"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["gx:MultiTrack"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/features/KmlNetworkLink",["./../KmlElements","./KmlFeature","../KmlFile","../KmlLink","../util/KmlNodeTransformers","../util/KmlRefreshListener"],function(t,e,i,r,n,o){"use strict";var s="refreshNetworkLinkEvent",a=function(t){e.call(this,t),this.isFeature=!0,this.resolvedFile=null,this.displayed=!1,this.isDownloading=!1};return a.prototype=Object.create(e.prototype),Object.defineProperties(a.prototype,{kmlRefreshVisibility:{get:function(){return this._factory.specific(this,{name:"refreshVisibility",transformer:n.boolean})}},kmlFlyToView:{get:function(){return this._factory.specific(this,{name:"flyToView",transformer:n.boolean})}},kmlLink:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}}}),a.prototype.getTagNames=function(){return["NetworkLink"]},a.prototype.render=function(t,r){if(e.prototype.render.call(this,t,r),r.lastVisibility||this.displayed){if(!this.isDownloading&&!this.resolvedFile){this.isDownloading=!0;var n=this;new i(n.buildUrl(r.fileCache)).then(function(t){n.resolvedFile=t,n.isDownloading=!1,n.fireEvent(r)})}this.resolvedFile&&!this.displayed&&(this.resolvedFile.render(t,r),this.handleRefresh(r))}},a.prototype.buildUrl=function(t){return this.kmlLink.kmlHref(t)},a.prototype.handleRefresh=function(t){var e=t.activeEvents;if(e=e.filter(function(t){return t.type==s}),e.length>0){var r=this;new i(r.buildUrl(t.fileCache)).then(function(e){r.resolvedFile=e,r.fireEvent(t)})}},a.prototype.fireEvent=function(t){var e=0;if("onInterval"==this.kmlLink.kmlRefreshMode)e=1e3*this.kmlLink.kmlRefreshInterval;else{if("onExpire"!=this.kmlLink.kmlRefreshMode)return;if(!this.resolvedFile)return;e=this.resolvedFile.getExpired()}t.listener.addEvent(new o.Event(s,e,null))},t.addKey(a.prototype.getTagNames()[0],a),a}),i("formats/kml/util/KmlUpdate",["./KmlChange","./KmlCreate","./KmlDelete","../KmlElements","../KmlObject","./KmlNodeTransformers"],function(t,e,i,r,n,o){var s=function(t){n.call(this,t)};return s.prototype=Object.create(n.prototype),Object.defineProperties(s.prototype,{targetHref:{get:function(){return this._factory.specific(this,{name:"minRefreshPeriod",transformer:o.number})}},Change:{get:function(){return this._factory.any(this,{name:t.prototype.getTagNames()})}},Create:{get:function(){return this._factory.any(this,{name:e.prototype.getTagNames()})}},Delete:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}}}),s.prototype.getTagNames=function(){return["Update"]},r.addKey(s.prototype.getTagNames()[0],s),s}),i("formats/kml/util/KmlNetworkLinkControl",["../KmlAbstractView","../KmlElements","../KmlObject","./KmlNodeTransformers","./KmlUpdate"],function(t,e,i,r,n){var o=function(t){i.call(this,t)};return o.prototype=Object.create(i.prototype),Object.defineProperties(o.prototype,{minRefreshPeriod:{get:function(){return this._factory.specific(this,{name:"minRefreshPeriod",transformer:r.number})}},maxSessionLength:{get:function(){return this._factory.specific(this,{name:"maxSessionLength",transformer:r.number})}},cookie:{get:function(){return this._factory.specific(this,{name:"cookie",transformer:r.string})}},message:{get:function(){return this._factory.specific(this,{name:"message",transformer:r.string})}},linkName:{get:function(){return this._factory.specific(this,{name:"linkName",transformer:r.string})}},linkDescription:{get:function(){return this._factory.specific(this,{name:"linkDescription",transformer:r.string})}},linkSnippet:{get:function(){return this._factory.specific(this,{name:"linkSnippet",transformer:r.string})}},expires:{get:function(){return this._factory.specific(this,{name:"expires",transformer:r.date})}},Update:{get:function(){return this._factory.any(this,{name:n.prototype.getTagNames()})}},AbstractView:{get:function(){return this._factory.any(this,{name:t.prototype.getTagNames()})}}}),o.prototype.getTagNames=function(){return["NetworkLinkControl"]},e.addKey(o.prototype.getTagNames()[0],o),o}),i("formats/kml/KmlOrientation",["./KmlElements","./KmlObject","./util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:i.number})}},kmlTilt:{get:function(){return this._factory.specific(this,{name:"tilt",transformer:i.number})}},kmlRoll:{get:function(){return this._factory.specific(this,{name:"roll",transformer:i.number})}}}),r.prototype.getTagNames=function(){return["Orientation"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/geom/KmlPoint",["../../../util/Color","../KmlElements","./KmlGeometry","../../../geom/Location","../util/KmlNodeTransformers","../../../shapes/Polygon","../../../geom/Position"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){i.call(this,t),this._shape=null};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{kmlPosition:{get:function(){var t=this._factory.specific(this,{name:"coordinates",transformer:n.string}).split(",");return new s(t[1],t[0],t[2]||0)}},kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:n.boolean})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:n.string})}},kmlCenter:{get:function(){return this.kmlPosition; }}}),a.prototype.getTagNames=function(){return["Point"]},e.addKey(a.prototype.getTagNames()[0],a),a}),i("formats/kml/util/KmlViewVolume",["../KmlElements","../KmlObject","./KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlLeftFov:{get:function(){return this._factory.specific(this,{name:"leftFov",transformer:i.number})}},kmlRightFov:{get:function(){return this._factory.specific(this,{name:"rightFov",transformer:i.number})}},kmlBottomFov:{get:function(){return this._factory.specific(this,{name:"bottomFov",transformer:i.number})}},kmlTopFov:{get:function(){return this._factory.specific(this,{name:"topFov",transformer:i.number})}},kmlNear:{get:function(){return this._factory.specific(this,{name:"near",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["ViewVolume"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlPhotoOverlay",["../util/KmlImagePyramid","./../KmlElements","./KmlOverlay","../geom/KmlPoint","../util/KmlNodeTransformers","../util/KmlViewVolume"],function(t,e,i,r,n,o){"use strict";var s=function(t){i.call(this,t)};return s.prototype=Object.create(i.prototype),Object.defineProperties(s.prototype,{kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:n.string})}},kmlShape:{get:function(){return this._factory.specific(this,{name:"shape",transformer:n.string})}},kmlPoint:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}},kmlViewVolume:{get:function(){return this._factory.any(this,{name:o.prototype.getTagNames()})}},kmlImagePyramid:{get:function(){return this._factory.any(this,{name:t.prototype.getTagNames()})}}}),s.prototype.getTagNames=function(){return["PhotoOverlay"]},e.addKey(s.prototype.getTagNames[0],s),s}),i("formats/kml/features/KmlPlacemark",["./../KmlElements","./KmlFeature","../geom/KmlGeometry","../styles/KmlStyle","../KmlTimeSpan","../KmlTimeStamp","../../../shapes/PlacemarkAttributes","../../../shapes/Placemark","../../../util/Color","../../../shapes/ShapeAttributes","../../../shapes/TextAttributes","../../../util/Offset","../../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t){e.call(this,t)};return p.prototype=Object.create(e.prototype),Object.defineProperties(p.prototype,{kmlGeometry:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}}}),p.prototype.render=function(t,i){e.prototype.render.call(this,t,i),i=d.clone(i),i.lastStyle&&!this._renderable&&this.kmlGeometry&&(this._renderable=new a(this.kmlGeometry.kmlCenter,!1,this.prepareAttributes(i.lastStyle.normal,i.fileCache)),i.lastStyle.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(i.lastStyle.highlight,i.fileCache)),this.moveValidProperties(),t.redrawRequested=!0),this._renderable&&this.kmlGeometry&&(this.kmlGeometry.render(t,i),this._renderable.render(t))},p.prototype.prepareAttributes=function(t,e){var i=t&&t.generate({},e)||{normal:{},highlight:{}},n=new s(r.placemarkAttributes(i));return n.imageOffset=new c(WorldWind.OFFSET_FRACTION,.3,WorldWind.OFFSET_FRACTION,0),n.imageColor=l.WHITE,n.labelAttributes=new u(r.textAttributes({_offset:new c(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,1),_color:l.YELLOW})),n.drawLeaderLine=!0,n.leaderLineAttributes=new h(r.shapeAttributes({_outlineColor:l.RED})),n},p.prototype.moveValidProperties=function(){this._renderable.label=this.kmlName||"",this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.RELATIVE_TO_GROUND,this._renderable.enableLeaderLinePicking=!0},p.prototype.getTagNames=function(){return["Placemark"]},t.addKey(p.prototype.getTagNames()[0],p),p}),i("formats/kml/geom/KmlPolygon",["../../../util/Color","../KmlElements","./KmlGeometry","./KmlLinearRing","../styles/KmlStyle","../../../geom/Location","../util/KmlNodeTransformers","../../../shapes/Polygon","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolygon"],function(t,e,i,r,n,o,s,a,l,h){"use strict";var u=function(t){i.call(this,t),this.initialized=!1};return u.prototype=Object.create(i.prototype),Object.defineProperties(u.prototype,{kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:s.boolean})}},kmlTessellate:{get:function(){return this._factory.specific(this,{name:"tessellate",transformer:s.boolean})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:s.string})}},kmlOuterBoundary:{get:function(){return this._factory.specific(this,{name:"outerBoundaryIs",transformer:s.linearRing})}},kmlInnerBoundary:{get:function(){return this._factory.specific(this,{name:"innerBoundaryIs",transformer:s.linearRing})}},kmlCenter:{get:function(){return this.kmlOuterBoundary.kmlCenter}}}),u.prototype.createPolygon=function(t,e){this.kmlAltitudeMode===WorldWind.CLAMP_TO_GROUND||this.kmlInnerBoundary&&this.kmlInnerBoundary.kmlAltitudeMode===WorldWind.CLAMP_TO_GROUND||this.kmlOuterBoundary&&this.kmlOuterBoundary.kmlAltitudeMode===WorldWind.CLAMP_TO_GROUND?this._renderable=new h(this.prepareLocations(),this.prepareAttributes(t.normal,e)):this._renderable=new a(this.prepareLocations(),this.prepareAttributes(t.normal,e)),t.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(t.highlight,e)),this.moveValidProperties()},u.prototype.render=function(t,e){i.prototype.render.call(this,t,e),e.lastStyle&&!this._renderable&&(this.createPolygon(e.lastStyle,e.fileCache),t.redrawRequested=!0),this._renderable&&(this._renderable.enabled=this.enabled,this._renderable.render(t))},u.prototype.moveValidProperties=function(){this._renderable.extrude=this.kmlExtrude||!0,this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.CLAMP_TO_GROUND},u.prototype.prepareAttributes=function(t,e){var i=t&&t.generate(e)||{};return i._drawVerticals=this.kmlExtrude||!1,i._applyLighting=!0,i._depthTest=!0,i._outlineStippleFactor=0,i._outlineStipplePattern=61680,i._enableLighting=!0,new l(n.shapeAttributes(i))},u.prototype.prepareLocations=function(){var t=[];return null!=this.kmlInnerBoundary?(t[0]=this.kmlInnerBoundary.kmlPositions,t[1]=this.kmlOuterBoundary.kmlPositions):t=this.kmlOuterBoundary.kmlPositions,t},u.prototype.getStyle=function(){return this._style},u.prototype.getTagNames=function(){return["Polygon"]},e.addKey(u.prototype.getTagNames()[0],u),u}),i("formats/kml/util/KmlScale",["./../KmlElements","../KmlObject","./KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlX:{get:function(){return this._factory.specific(this,{name:"x",transformer:i.number})}},kmlY:{get:function(){return this._factory.specific(this,{name:"y",transformer:i.number})}},kmlZ:{get:function(){return this._factory.specific(this,{name:"z",transformer:i.number})}}}),r.prototype.getTagNames=function(){return["Scale"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlScreenOverlay",["./../KmlElements","./KmlFeature","./KmlOverlay","../util/KmlNodeTransformers","../../../util/Offset","../../../shapes/ScreenImage"],function(t,e,i,r,n,o){"use strict";var s=function(t){i.call(this,t)};return s.prototype=Object.create(i.prototype),Object.defineProperties(s.prototype,{kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:r.number})}},kmlOverlayXYx:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("x"),attribute:"kmlOverlayXYx"})}},kmlOverlayXYy:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("y"),attribute:"kmlOverlayXYy"})}},kmlOverlayXYxunits:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("xunits"),attribute:"kmlOverlayXYxunits"})}},kmlOverlayXYyunits:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("yunits"),attribute:"kmlOverlayXYyunits"})}},kmlScreenXYx:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("x"),attribute:"kmlScreenXYx"})}},kmlScreenXYy:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("y"),attribute:"kmlScreenXYy"})}},kmlScreenXYxunits:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("xunits"),attribute:"kmlScreenXYxunits"})}},kmlScreenXYyunits:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("yunits"),attribute:"kmlScreenXYyunits"})}},kmlRotationXYx:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("x"),attribute:"kmlRotationXYx"})}},kmlRotationXYy:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("y"),attribute:"kmlRotationXYy"})}},kmlRotationXYxunits:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("xunits"),attribute:"kmlRotationXYxunits"})}},kmlRotationXYyunits:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("yunits"),attribute:"kmlRotationXYyunits"})}},kmlSizex:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("x"),attribute:"kmlSizex"})}},kmlSizey:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("y"),attribute:"kmlSizey"})}},kmlSizexunits:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("xunits"),attribute:"kmlSizexunits"})}},kmlSizeyunits:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("yunits"),attribute:"kmlSizeyunits"})}}}),s.prototype.render=function(t,i){e.prototype.render.call(this,t,i),this._renderable||this.kmlIcon&&(this._renderable=new o(new n(this.kmlScreenXYxunits,this.kmlScreenXYx,this.kmlScreenXYyunits,this.kmlScreenXYy),this.kmlIcon.kmlHref(i.fileCache)),this._renderable.imageOffset=new n(this.kmlOverlayXYxunits,this.kmlOverlayXYx,this.kmlOverlayXYyunits,this.kmlOverlayXYy),t.redrawRequested=!0),this._renderable&&this._renderable.render(t)},s.prototype.getTagNames=function(){return["ScreenOverlay"]},t.addKey(s.prototype.getTagNames()[0],s),s}),i("formats/kml/features/KmlTour",["./../KmlElements","./KmlFeature"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["gx:Tour"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/geom/KmlTrack",["./../KmlElements","./KmlGeometry"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["gx:Track"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/controls/KmlTreeVisibility",["../../../util/WWUtil","./KmlControls"],function(t,e){"use strict";var i=function(t,i){e.apply(this),this._visualElementId=t,this._wwd=i};return i.prototype=Object.create(e.prototype),i.prototype.hook=function(t,e){e.isFeature&&this.createControls(t)},i.prototype.createControls=function(e){function i(){o=!o,h.updateDescendants(e,o)}function r(){e.kmlAbstractView&&e.kmlAbstractView.update({wwd:h._wwd})}var n=e.kmlName||e.id||t.guid(),o=e.enabled&&e.kmlVisibility===!0,s=document.createElement("div"),a=document.createElement("input");a.setAttribute("type","checkbox"),o&&a.setAttribute("checked","checked"),a.addEventListener("click",i,!0),s.appendChild(a);var l;l=e.kmlAbstractView?document.createElement("a"):document.createElement("span"),l.appendChild(document.createTextNode(n)),l.addEventListener("click",r,!0),s.appendChild(l),document.getElementById(this._visualElementId).appendChild(s);var h=this},i.prototype.updateDescendants=function(t,e){t.controlledVisibility=e,this._wwd.redraw()},i}),i("layer/LandsatRestLayer",["../error/ArgumentError","../geom/Location","../util/Logger","../geom/Sector","../layer/TiledImageLayer","../util/LevelRowColumnUrlBuilder","../util/WWUtil"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,a){var l=s.urlPath(t+"/"+i);n.call(this,r.FULL_SPHERE,new e(36,36),10,"image/png",l,512,512),this.displayName=a,this.pickEnabled=!1,this.urlBuilder=new o(t,i)};return a.prototype=Object.create(n.prototype),a}),i("util/measure/LengthMeasurer",["../../error/ArgumentError","../../geom/Location","../Logger","./MeasurerUtils","../../geom/Position","../../geom/Vec3"],function(t,e,i,r,n,o){var s=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"LengthMeasurer","constructor","missingWorldWindow"));this.wwd=e,this.DEFAULT_MIN_SEGMENT_LENGTH=30,this._maxSegmentLength=1e5,this._lengthTerrainSamplingSteps=128,this.subdividedPositions=null};return Object.defineProperties(s.prototype,{maxSegmentLength:{get:function(){return this._maxSegmentLength},set:function(t){this._maxSegmentLength=t}},lengthTerrainSamplingSteps:{get:function(){return this._lengthTerrainSamplingSteps},set:function(t){this._lengthTerrainSamplingSteps=t}}}),s.prototype.getLength=function(t,e,i){return i=i||WorldWind.GREAT_CIRCLE,this.subdividedPositions=null,this.computeLength(t,e,i)},s.prototype.getPathLength=function(t){return this.subdividedPositions=null,this.computeLength(t.positions,t.followTerrain,t.pathType)},s.prototype.getGeographicDistance=function(t,i){if(t instanceof WorldWind.Path)var r=t.positions,n=t.pathType;else Array.isArray(t)&&(r=t,n=i||WorldWind.GREAT_CIRCLE);if(!r||r.length<2)return-1;var o=e.greatCircleDistance;n===WorldWind.RHUMB_LINE?o=e.rhumbDistance:n===WorldWind.LINEAR&&(o=e.linearDistance);for(var s=0,a=0,l=r.length-1;a0&&e._dimensions.forEach(function(e){var i=e.name,r=!0;t.forEach(function(t){t.name===i&&(r=!1)}),r&&t.push(e)}),e=e.parent;return t.length>0?t:void 0}},extents:{get:function(){for(var t=[],e=this;e&&e instanceof i;)e._extents&&e._extents.length>0&&e._extents.forEach(function(e){var i=e.name,r=!0;t.forEach(function(t){t.name===i&&(r=!1)}),r&&t.push(e)}),e=e.parent;return t.length>0?t:void 0}},attribution:{get:function(){return i.replace(this,"_attribution")}},authorityUrls:{get:function(){return i.accumulate(this,"_authorityUrls",[])}},minScaleDenominator:{get:function(){return i.replace(this,"_minScaleDenominator")}},maxScaleDenominator:{get:function(){return i.replace(this,"_maxScaleDenominator")}},scaleHint:{get:function(){return i.replace(this,"_scaleHint")}}}),i.prototype.style=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsLayerCapabilities","style","Style name is null or undefined."));var r=this.styles;if(!r)return null;for(var n,o=0,s=r.length;o0?r:null},i.replace=function(t,e){for(;t&&t instanceof i;){var r=t[e];if(r)return r;t=t.parent}},i.prototype.assembleLayer=function(t){var e,r;e=t.getAttribute("queryable"),e&&(this._queryable="1"===e||"true"===e),e=t.getAttribute("opaque"),e&&(this._opaque="1"===e||"true"===e),e=t.getAttribute("noSubsets"),e&&(this._noSubsets="1"===e||"true"===e),e=t.getAttribute("cascaded"),e&&(this._cascaded=parseInt("10")),e=t.getAttribute("fixedWidth"),e&&(this._fixedWidth=parseInt("10")),e=t.getAttribute("fixedHeight"),e&&(this._fixedHeight=parseInt("10"));var n=t.children||t.childNodes;for(r=0;rMath.max(e*n,.5)},s.prototype.update=function(t){var e=t.globe.elevationTimestamp(),i=t.verticalExaggeration,r=t.globeStateKey;this.updateTimestamp==e&&this.updateVerticalExaggeration==i&&this.updateGlobeStateKey==r||(this.doUpdate(t),t.frameStatistics.incrementTileUpdateCount(1),this.updateTimestamp=e,this.updateVerticalExaggeration=i,this.updateGlobeStateKey=r)},s.prototype.doUpdate=function(t){var e=t.globe,r=t.verticalExaggeration,s=e.minAndMaxElevationsForSector(this.sector),a=s[0]*r,l=s[1]*r;a===l&&(a=l+10),this.extent||(this.extent=new i),this.extent.setToSector(this.sector,e,a,l),this.samplePoints||(this.sampleElevations=new Float64Array(9),this.samplePoints=new Float64Array(3*this.sampleElevations.length)),o.fillArray(this.sampleElevations,.5*(a+l)),e.computePointsForGrid(this.sector,3,3,this.sampleElevations,n.ZERO,this.samplePoints),this.referencePoint||(this.referencePoint=new n(0,0,0)),e.computePointFromPosition(this.sector.centroidLatitude(),this.sector.centroidLongitude(),0,this.referencePoint)},s.prototype.bind=function(t){var e=t.gpuResourceCache.resourceForKey(this.gpuCacheKey);return!(!e||!e.bind(t))||!!this.fallbackTile&&this.fallbackTile.bind(t)},s.prototype.applyInternalTransform=function(t,e){},s}),i("layer/WmtsLayer",["../util/AbsentResourceList","../error/ArgumentError","../util/Logger","../geom/Matrix","../geom/Sector","../layer/Layer","../cache/MemoryCache","../render/Texture","../util/WmsUrlBuilder","../layer/WmtsLayerTile","../util/WWMath","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c){"use strict";var d=function(a,l){if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No layer configuration specified."));if(o.call(this,"WMTS Layer"),this.layerIdentifier=a.identifier,this.styleIdentifier=a.style,this.timeString=l,this.imageFormat=a.format,this.resourceUrl=a.resourceUrl,this.serviceUrl=a.service,this.tileMatrixSet=a.tileMatrixSet,this.lasTtMVP=r.fromIdentity(),a.wgs84BoundingBox||a.boundingBox){if(a.wgs84BoundingBox)this.sector=a.wgs84BoundingBox.getSector();else if(this.tileMatrixSet.boundingBox&&d.isEpsg4326Crs(this.tileMatrixSet.boundingBox.crs))this.sector=new n(this.tileMatrixSet.boundingBox.lowerCorner[1],this.tileMatrixSet.boundingBox.upperCorner[1],this.tileMatrixSet.boundingBox.lowerCorner[0],this.tileMatrixSet.boundingBox.upperCorner[0]);else if(d.isEpsg4326Crs(this.tileMatrixSet.supportedCRS))throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No EPSG:4326 bounding box was specified in the layer or tile matrix set capabilities."))}else{if(!this.tileMatrixSet.boundingBox)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No bounding box was specified in the layer or tile matrix set capabilities."));this.sector=new n(a.tileMatrixSet.boundingBox.lowerCorner[1],a.tileMatrixSet.boundingBox.upperCorner[1],a.tileMatrixSet.boundingBox.lowerCorner[0],a.tileMatrixSet.boundingBox.upperCorner[0])}if(!d.isTileSubdivisionCompatible(this.tileMatrixSet))throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","TileMatrixSet level division not compatible."));var h=this.tileMatrixSet.supportedCRS,u=d.isEpsg3857Crs(h)||d.isEpsg4326Crs(h)||d.isOGCCrs84(h);if(!u)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","Provided CRS is not compatible."));this.cachePath=(this.resourceUrl||this.serviceUrl)+this.layerIdentifier+this.styleIdentifier+this.tileMatrixSet.identifier,l&&(this.cachePath=this.cachePath+l),this.displayName=a.title,this.currentTiles=[],this.currentTilesInvalid=!0,this.tileCache=new s(1e3,850),this.currentRetrievals=[],this.absentResourceList=new t(3,5e4),this.pickEnabled=!1,this.detailControl=1.75,this.retrievalQueueSize=WorldWind.configuration.layerRetrievalQueueSize};return d.isTileSubdivisionCompatible=function(t){if(!t||!t.tileMatrix||t.tileMatrix.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","isTileSubdivisionCompatible","Empty tile matrix set"));for(var r,n,o,s=t.tileMatrix[0],a=1,l=t.tileMatrix.length;a=0?s.format="image/png":t.format.indexOf("image/jpeg")>=0?s.format="image/jpeg":t.format.indexOf("image/tiff")>=0?s.format="image/tiff":t.format.indexOf("image/gif")>=0?s.format="image/gif":s.format=t.format[0]),!s.format)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","formLayerConfiguration","Layer does not provide a supported image format."));if(t.resourceUrl&&t.resourceUrl.length>=1){for(var h=0;h0?s.title=t.titles[0].value:s.title=t.identifier,s},d.prototype=Object.create(o.prototype),d.prototype.doRender=function(t){t.terrain&&(!this.currentTilesInvalid&&t.modelviewProjection.equals(this.lasTtMVP)&&t.globeStateKey===this.lastGlobeStateKey||(this.currentTilesInvalid=!1,this.assembleTiles(t)),this.lasTtMVP.copy(t.modelviewProjection),this.lastGlobeStateKey=t.globeStateKey,this.currentTiles.length>0&&(t.surfaceTileRenderer.renderTiles(t,this.currentTiles,this.opacity),t.frameStatistics.incrementImageTileCount(this.currentTiles.length),this.inCurrentFrame=!0))},d.prototype.isLayerInView=function(t){return t.terrain&&t.terrain.sector&&t.terrain.sector.intersects(this.sector)},d.prototype.isTileVisible=function(t,e){return!(t.globe.projectionLimits&&!e.sector.overlaps(t.globe.projectionLimits))&&e.extent.intersectsFrustum(t.frustumInModelCoordinates)},d.prototype.assembleTiles=function(t){this.currentTiles=[],this.topLevelTiles&&0!==this.topLevelTiles.length||this.createTopLevelTiles(t);for(var e=0,i=this.topLevelTiles.length;e=e.tileMatrix.matrixWidth&&(e.column=e.column-e.tileMatrix.matrixWidth),e.column<0&&(e.column=e.column+e.tileMatrix.matrixWidth),this.tileMeetsRenderingCriteria(t,e))return void this.addTile(t,e);var i=null;try{(this.isTileTextureInMemory(t,e)||0===e.tileMatrix.levelNumber)&&(i=this.currentAncestorTile,this.currentAncestorTile=e);for(var r=this.tileMatrixSet.tileMatrix[e.tileMatrix.levelNumber+1],n=e.subdivideToCache(r,this,this.tileCache),o=0,s=n.length;o=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.tileMatrix.levelNumber===this.tileMatrixSet.tileMatrix.length-1||!e.mustSubdivide(t,i)},d.prototype.retrieveTileImage=function(t,e){if(this.currentRetrievals.indexOf(e.imagePath)<0){if(this.currentRetrievals.length>this.retrievalQueueSize)return;if(this.absentResourceList.isResourceAbsent(e.imagePath))return;var r=this.resourceUrlForTile(e,this.imageFormat),n=new Image,o=e.imagePath,s=t.gpuResourceCache,a=t.currentGlContext.canvas,l=this;if(!r)return void(this.currentTilesInvalid=!0);n.onload=function(){i.log(i.LEVEL_INFO,"Image retrieval succeeded: "+r);var h=l.createTexture(t,e,n);if(l.removeFromCurrentRetrievals(o),h){s.putResource(o,h,h.size),l.currentTilesInvalid=!0,l.absentResourceList.unmarkResourceAbsent(o);var u=document.createEvent("Event");u.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),a.dispatchEvent(u)}},n.onerror=function(){l.removeFromCurrentRetrievals(o),l.absentResourceList.markResourceAbsent(o),i.log(i.LEVEL_WARNING,"Image retrieval failed: "+r)},this.currentRetrievals.push(o),n.crossOrigin="anonymous",n.src=r}},d.prototype.resourceUrlForTile=function(t,e){var i;return this.resourceUrl?(i=this.resourceUrl.replace("{Style}",this.styleIdentifier).replace("{TileMatrixSet}",this.tileMatrixSet.identifier).replace("{TileMatrix}",t.tileMatrix.identifier).replace("{TileCol}",t.column).replace("{TileRow}",t.row),this.timeString&&(i=i.replace("{Time}",this.timeString))):(i=this.serviceUrl+"service=WMTS&request=GetTile&version=1.0.0",i+="&Layer="+this.layerIdentifier,this.styleIdentifier&&(i+="&Style="+this.styleIdentifier),i+="&Format="+e,this.timeString&&(i+="&Time="+this.timeString),i+="&TileMatrixSet="+this.tileMatrixSet.identifier,i+="&TileMatrix="+t.tileMatrix.identifier,i+="&TileRow="+t.row,i+="&TileCol="+t.column),i},d.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},d.prototype.createTopLevelTiles=function(t){var e=this.tileMatrixSet.tileMatrix[0];this.topLevelTiles=[];for(var i=0;i=0&&t.indexOf("4326")>=0},d.isEpsg3857Crs=function(t){return t.indexOf("EPSG")>=0&&(t.indexOf("3857")>=0||t.indexOf("900913")>=0)},d.isOGCCrs84=function(t){return t.indexOf("OGC")>=0&&t.indexOf("CRS84")>=0},d}),i("layer/OpenStreetMapImageLayer",["../util/Color","../layer/Layer","../util/Logger","../ogc/wmts/WmtsCapabilities","../layer/WmtsLayer"],function(t,e,i,r,n){"use strict";var o=function(t){e.call(this,this.displayName),this.displayName=t||"Open Street Map",this.layer=null,this.xhr=null,this.pickEnabled=!0};return o.prototype=Object.create(e.prototype),o.prototype.doRender=function(e){this.configureLayer(e),this.layer&&(this.layer.opacity=this.opacity,this.layer.doRender(e),this.inCurrentFrame=this.layer.inCurrentFrame,this.inCurrentFrame&&(e.screenCreditController.addCredit("OpenStreetMap ©",t.DARK_GRAY),e.screenCreditController.addCredit("EOX.at ©",t.DARK_GRAY)))},o.prototype.configureLayer=function(t){if(!this.xhr){var e=this,o=t.currentGlContext.canvas;this.xhr=new XMLHttpRequest,this.xhr.open("GET","https://tiles.maps.eox.at/wmts/1.0.0/WMTSCapabilities.xml",!0),this.xhr.onreadystatechange=function(){if(4===e.xhr.readyState)if(200===e.xhr.status){var t=new r(e.xhr.responseXML),s=t.getLayer("osm"),a=n.formLayerConfiguration(s);a.title=e.displayName,e.layer=new n(a);var l=document.createEvent("Event");l.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),o.dispatchEvent(l)}else i.log(i.LEVEL_WARNING,"OSM retrieval failed ("+xhr.statusText+"): "+url)},this.xhr.onerror=function(){i.log(i.LEVEL_WARNING,"OSM retrieval failed: "+url)},this.xhr.ontimeout=function(){i.log(i.LEVEL_WARNING,"OSM retrieval timed out: "+url)},this.xhr.send(null)}},o}),i("projections/ProjectionGnomonic",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t){this.north=!("South"===t);var e=this.north?new n(30,90,-180,180):new n(-90,-30,-180,180);i.call(this,"Polar Gnomonic",!1,e),this._pole=t,this.displayName=this.north?"North Gnomonic":"South Gnomonic",this._stateKey="projection polar gnomonic "+this._pole+" "};return s.prototype=Object.create(i.prototype),Object.defineProperties(s.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this.projectionLimits=this.north?new n(30,90,-180,180):new n(-90,-30,-180,180),this._stateKey="projection polar gnomonic "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),s.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&n===-90)l[0]=0,l[1]=0,l[2]=s;else{var h=this.north?1:-1,u=i.equatorialRadius/Math.tan(n*t.DEGREES_TO_RADIANS);l[0]=u*Math.sin(o*t.DEGREES_TO_RADIANS)*h,l[1]=u*-Math.cos(o*t.DEGREES_TO_RADIANS),l[2]=s}return l},s.prototype.geographicToCartesianGrid=function(i,n,s,a,l,h,u,c){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","missingSector"));if(!l||l.length1?s-1:1),w=(b-_)/(a>1?a-1:1),L=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,T=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,R=this.north?1:-1,x=h?h:new Vec3(0,0,0),M=0,C=0;for(d=0,f=E;dMath.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},s.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},s.prototype.northTangentAtPoint=function(t,i,n,o,s,a){if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},s}),i("projections/ProjectionMercator",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(){i.call(this,"Mercator",!0,new n(-78,78,-180,180))};return a.prototype=Object.create(i.prototype),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingResult"));n>this.projectionLimits.maxLatitude&&(n=this.projectionLimits.maxLatitude),n1?a-1:1),M=(R-T)/(l>1?l-1:1),C=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,A=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,P=u?u:new o(0,0,0),N=c?c[0]:0,O=0,I=0;for(p=0,g=w;p1?o-1:1),S=(_-v)/(s>1?s-1:1),w=this.north?-1:1,L=l?l:new Vec3(0,0,0),T=Math.PI/2,R=0,x=0,M=new Float64Array(s),C=new Float64Array(s);for(d=0,f=v;dMath.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},n.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},n.prototype.northTangentAtPoint=function(t,i,n,o,s,a){if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},n}),i("projections/ProjectionUPS",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){this.north=!("South"===t);var e=this.north?new n(0,90,-180,180):new n(-90,0,-180,180);i.call(this,"Uniform Polar Stereographic",!1,e),this._pole=t,this.displayName=this.north?"North UPS":"South UPS",this._stateKey="projection ups "+this._pole+" "};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this.projectionLimits=this.north?new n(0,90,-180,180):new n(-90,0,-180,180),this._stateKey="projection ups "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&n===-90)l[0]=0,l[1]=0,l[2]=s;else{var h,u,c,d=this.north?1:-1,p=n*t.DEGREES_TO_RADIANS,f=o*t.DEGREES_TO_RADIANS,g=.994,m=Math.sqrt(i.eccentricitySquared),y=Math.sqrt(Math.pow(1+m,1+m)*Math.pow(1-m,1-m));(this.north&&p<0||!this.north&&p>0)&&(p=0),h=Math.sin(p*d),u=Math.sqrt((1-h)/(1+h)*Math.pow((1+m*h)/(1-m*h),m)),c=2*i.equatorialRadius*g*u/y,l[0]=c*Math.sin(f),l[1]=-c*Math.cos(f)*d,l[2]=s}return l},a.prototype.geographicToCartesianGrid=function(i,n,a,l,h,u,c,d){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingSector"));if(!h||h.length1?a-1:1),x=(T-L)/(l>1?l-1:1),M=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,C=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,A=.994,P=Math.sqrt(i.eccentricitySquared),N=Math.sqrt(Math.pow(1+P,1+P)*Math.pow(1-P,1-P)),O=this.north?1:-1,I=u?u:new o(0,0,0),D=0,k=0;for(p=0,g=S;pt.TWO_PI&&(r%=t.TWO_PI),t.RADIANS_TO_DEGREES*(r>=0?r:r+t.TWO_PI)},u.prototype.deepCopyLocations=function(t){var e=[];if(t.length>0&&Array.isArray(t[0]))for(var r=0,n=t.length;r0&&Array.isArray(e[0]))for(var o=0,a=e.length;o0&&Array.isArray(n[0]))for(var l=0,h=n.length;ln.magnitude()?o.copy(i):new e(t,s).pointAt(l,o)},u}),i("util/editor/ShapeEditorConstants",[],function(){"use strict";var t={LOCATION:"location",ROTATION:"rotation",WIDTH:"width",HEIGHT:"height",RADIUS:"radius",DRAG:"drag",MIN_CORNER:"min_corner",MAX_CORNER:"max_corner"};return t}),i("util/editor/PlacemarkEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","./ShapeEditorConstants","../../shapes/Placemark"],function(t,e,i,r){"use strict";var n=function(){};return n.prototype=Object.create(t.prototype),n.prototype.canHandle=function(t){return t instanceof r},n.prototype.createShadowShape=function(t){return new r(t.position,null,t.attributes)},n.prototype.getShapeCenter=function(t){return t.position},n.prototype.initializeControlElements=function(t,e,r,n,o,s){this.createControlPoint(e,s,i.DRAG)},n.prototype.updateControlElements=function(t,e,i){i[0].position=t.position},n.prototype.reshape=function(t,e,i,r,n){return!1},n}),i("shapes/SurfaceEllipse",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,n,s,l){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceEllipse","constructor","missingLocation"));if(i<0||n<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceEllipse","constructor","Radius is negative."));o.call(this,l),this._center=t,this._majorRadius=i,this._minorRadius=n,this._heading=s,this._intervals=a.DEFAULT_NUM_INTERVALS};return a.prototype=Object.create(o.prototype),Object.defineProperties(a.prototype,{center:{get:function(){return this._center},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._center=t}},majorRadius:{get:function(){return this._majorRadius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._majorRadius=t}},minorRadius:{get:function(){return this._minorRadius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._minorRadius=t}},heading:{get:function(){return this._heading},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._heading=t}},intervals:{get:function(){return this._intervals},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._intervals=t}}}),a.staticStateKey=function(t){var e=o.staticStateKey(t);return e+" ce "+t.center.toString()+" ma "+t.majorRadius.toString()+" mi "+t.minorRadius.toString()+" he "+t.heading.toString()+" in "+t.intervals.toString()},a.prototype.computeStateKey=function(){return a.staticStateKey(this)},a.prototype.computeBoundaries=function(e){if(0==this.majorRadius&&0==this.minorRadius)return null;var r=e.globe,n=1+Math.max(a.MIN_NUM_INTERVALS,this.intervals),o=2*Math.PI/(n-1),l=r.radiusAt(this.center.latitude,this.center.longitude);this._boundaries=new Array(n);for(var h=0;h0&&(t.majorRadius=h)}else if(n.userProperties.purpose===i.HEIGHT){var u=t.minorRadius+2*a.dot(l);u>0&&(t.minorRadius=u)}else if(n.userProperties.purpose===i.ROTATION){var c=e.greatCircleAzimuth(t.center,s),d=e.greatCircleAzimuth(t.center,o)-c;t.heading=this.normalizedHeading(t.heading,d)}},n}),i("shapes/SurfaceCircle",["../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r,n){"use strict";var o=function(e,r,s){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceCircle","constructor","missingLocation"));if(r<0)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceCircle","constructor","Radius is negative"));n.call(this,s),this._center=e,this._radius=r,this._intervals=o.DEFAULT_NUM_INTERVALS};return o.prototype=Object.create(n.prototype),Object.defineProperties(o.prototype,{center:{get:function(){return this._center},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._center=t}},radius:{get:function(){return this._radius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._radius=t}},intervals:{get:function(){return this._intervals},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._intervals=t}}}),o.staticStateKey=function(t){var e=n.staticStateKey(t);return e+" ce "+t.center.toString()+" ra "+t.radius.toString()},o.prototype.computeStateKey=function(){return o.staticStateKey(this)},o.prototype.computeBoundaries=function(t){if(0===this.radius)return null;var i=1+Math.max(o.MIN_NUM_INTERVALS,this.intervals),r=360/(i-1),n=this.radius/t.globe.radiusAt(this.center.latitude,this.center.longitude);this._boundaries=new Array(i);for(var s=0;s0&&(t.radius=l)}},n}),i("util/editor/SurfacePolygonEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","../../geom/Position","./ShapeEditorConstants","../../shapes/SurfacePolygon","../../geom/Vec3"],function(t,e,i,r,n,o){"use strict";var s=function(){this.currentHeading=0,this.moveControlPointAttributes=null};return s.prototype=Object.create(t.prototype),s.prototype.canHandle=function(t){return t instanceof Function?"SurfacePolygon"===t.name:t instanceof n},s.prototype.createShadowShape=function(t){return new n(this.deepCopyLocations(t.boundaries),t.attributes)},s.prototype.getShapeCenter=function(t,e){return this.getCenterFromLocations(e,t.boundaries)},s.prototype.isRegularShape=function(){return!1},s.prototype.initializeControlElements=function(t,e,i,n,o,s){this.currentHeading=0,this.moveControlPointAttributes=s;for(var a=this.getLocations(t),l=0,h=a.length;l=l&&this.createControlPoint(n,this.moveControlPointAttributes,r.LOCATION,u),n[u].position=s[u];l>h&&n.splice(h,l-h);var c=this.getCenterFromLocations(i,s),d=1.2*this.getAverageDistance(i,c,s);e.greatCircleLocation(c,this.currentHeading,d,a.position),a.userProperties.rotation=this.currentHeading,n.push(a),this.updateRotationAccessory(c,a.position,o)},s.prototype.reshape=function(t,e,i,o,s,a){var l=this.getLocations(t);if(i.userProperties.purpose===r.ROTATION){var h=this.rotateLocations(e,o,s,l);this.currentHeading=this.normalizedHeading(this.currentHeading,h),t.resetBoundaries(),t._stateId=n.stateId++,t.stateKeyInvalid=!0}else if(i.userProperties.purpose===r.LOCATION){var u=i.userProperties.index;if(a){var c=t.boundaries,d=c.length;if(d>0&&Array.isArray(c[0])){for(var p=-1,f=0,g=-1,m=0;mu&&(p=m,g=u-f),f+=y}if(p!==-1){var E=c[p];E.length>3?E.splice(g,1):d>2&&c.splice(p,1)}}else c.length>3&&c.splice(u,1)}else this.moveLocation(e,i,s,o,l[u]);t.resetBoundaries(),t._stateId=n.stateId++,t.stateKeyInvalid=!0}},s.prototype.addNewVertex=function(t,e,r){var s=new o(0,0,0),a=new o(0,0,0),l=new o(0,0,0),h=t.boundaries,u=e.computePointFromPosition(r.latitude,r.longitude,0,new o(0,0,0)),c=new o(0,0,0),d=-1,p=Number.MAX_VALUE;if(Array.isArray(t.boundaries[0])){for(var f=-1,g=0,m=h.length;g0&&Array.isArray(t.boundaries[0]))for(var i=0,r=t.boundaries.length;i=l&&this.createControlPoint(n,this.moveControlPointAttributes,r.LOCATION,u),n[u].position=s[u];l>h&&n.splice(h,l-h);var c=this.getCenterFromLocations(i,s),d=1.2*this.getAverageDistance(i,c,s);e.greatCircleLocation(c,this.currentHeading,d,a.position),a.userProperties.rotation=this.currentHeading,n.push(a),this.updateRotationAccessory(c,a.position,o)},s.prototype.reshape=function(t,e,i,o,s,a){var l=t.boundaries;if(i.userProperties.purpose===r.ROTATION){var h=this.rotateLocations(e,o,s,l);this.currentHeading=this.normalizedHeading(this.currentHeading,h),t.resetBoundaries(),t._stateId=n.stateId++,t.stateKeyInvalid=!0}else if(i.userProperties.purpose===r.LOCATION){var u=i.userProperties.index;a?l.length>2&&l.splice(u,1):this.moveLocation(e,i,s,o,l[u]),t.resetBoundaries(),t._stateId=n.stateId++,t.stateKeyInvalid=!0}},s.prototype.addNewVertex=function(t,e,r){for(var s=new o(0,0,0),a=new o(0,0,0),l=new o(0,0,0),h=t.boundaries,u=e.computePointFromPosition(r.latitude,r.longitude,0,new o(0,0,0)),c=new o(0,0,0),d=-1,p=Number.MAX_VALUE,f=1,g=h.length;f0&&(t.width=h)}else if(n.userProperties.purpose===i.HEIGHT){var u=t.height+2*a.dot(l);u>0&&(t.height=u)}else if(n.userProperties.purpose===i.ROTATION){var c=e.greatCircleAzimuth(t.center,s),d=e.greatCircleAzimuth(t.center,o)-c;t.heading=this.normalizedHeading(t.heading,d)}},n}),i("shapes/SurfaceSector",["../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r,n){"use strict";var o=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceSector","constructor","missingSector"));n.call(this,r),this._sector=e};return o.prototype=Object.create(n.prototype),Object.defineProperties(o.prototype,{sector:{get:function(){return this._sector},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._sector=t}}}),o.staticStateKey=function(t){var e=n.staticStateKey(t);return e},o.prototype.computeStateKey=function(){return o.staticStateKey(this)},o.prototype.computeBoundaries=function(t){var i=this._sector;this._boundaries=new Array(4),this._boundaries[0]=new e(i.minLatitude,i.minLongitude),this._boundaries[1]=new e(i.maxLatitude,i.minLongitude),this._boundaries[2]=new e(i.maxLatitude,i.maxLongitude),this._boundaries[3]=new e(i.minLatitude,i.maxLongitude)},o.prototype.getReferencePosition=function(){return new e(this.sector.centroidLatitude(),this.sector.centroidLongitude())},o.prototype.moveTo=function(t,i){var r=this._sector,n=new Array(3);n[0]=new e(r.minLatitude,r.minLongitude),n[1]=new e(r.maxLatitude,r.minLongitude),n[2]=new e(r.maxLatitude,r.maxLongitude),n=this.computeShiftedLocations(t,this.getReferencePosition(),i,n),this.sector=new WorldWind.Sector(n[0].latitude,n[1].latitude,n[1].longitude,n[2].longitude)},o}),i("util/editor/SurfaceSectorEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","../../geom/Position","../../geom/Sector","./ShapeEditorConstants","../../shapes/SurfaceSector"],function(t,e,i,r,n,o){"use strict";var s=function(){};return s.prototype=Object.create(t.prototype),s.prototype.canHandle=function(t){return t instanceof Function?"SurfaceSector"===t.name:t instanceof o},s.prototype.createShadowShape=function(t){return new o(new r(t._boundaries[0].latitude,t._boundaries[1].latitude,t._boundaries[0].longitude,t._boundaries[2].longitude),t.attributes)},s.prototype.getShapeCenter=function(t,e){return this.getCenterFromLocations(e,t._boundaries)},s.prototype.isRegularShape=function(){return!0},s.prototype.initializeControlElements=function(t,e,i,r){this.createControlPoint(e,r,n.MIN_CORNER),this.createControlPoint(e,r,n.MAX_CORNER)},s.prototype.updateControlElements=function(t,i,r){r[0].position=new e(t._sector.minLatitude,t._sector.minLongitude),r[1].position=new e(t._sector.maxLatitude,t._sector.maxLongitude)},s.prototype.reshape=function(t,e,i,o,s){i.userProperties.purpose===n.MIN_CORNER?t.sector=new r(o.latitude,t._sector.maxLatitude,o.longitude,t._sector.maxLongitude):i.userProperties.purpose===n.MAX_CORNER&&(t.sector=new r(t._sector.minLatitude,o.latitude,t._sector.minLongitude,o.longitude))},s}),i("util/editor/ShapeEditor",["../../shapes/Annotation","../../shapes/AnnotationAttributes","../../error/ArgumentError","../Color","../Font","../Insets","../../geom/Location","../Logger","../../shapes/Placemark","../../shapes/PlacemarkAttributes","./PlacemarkEditorFragment","../../geom/Position","../Promise","../../layer/RenderableLayer","../../shapes/ShapeAttributes","./ShapeEditorConstants","./SurfaceEllipseEditorFragment","./SurfaceCircleEditorFragment","../../shapes/SurfacePolygon","./SurfacePolygonEditorFragment","./SurfacePolylineEditorFragment","./SurfaceRectangleEditorFragment","./SurfaceSectorEditorFragment","../../geom/Vec2","../../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_,b,S,w,L){"use strict";var T=function(t){if(!t)throw new i(a.logMessage(a.LEVEL_SEVERE,"ShapeEditor","constructor","missingWorldWindow"));this._worldWindow=t,this._shape=null,this._allowMove=!1,this._allowReshape=!1,this._allowRotate=!1,this._allowManageControlPoint=!1,this._moveControlPointAttributes=new h(null),this._moveControlPointAttributes.imageColor=WorldWind.Color.BLUE,this._moveControlPointAttributes.imageScale=6,this._resizeControlPointAttributes=new h(null),this._resizeControlPointAttributes.imageColor=WorldWind.Color.CYAN,this._resizeControlPointAttributes.imageScale=6,this._rotateControlPointAttributes=new h(null),this._rotateControlPointAttributes.imageColor=WorldWind.Color.GREEN,this._rotateControlPointAttributes.imageScale=6,this._annotationAttributes=new e(null),this._annotationAttributes.altitudeMode=WorldWind.CLAMP_TO_GROUND,this._annotationAttributes.cornerRadius=5,this._annotationAttributes.backgroundColor=new r(.67,.67,.67,.8),this._annotationAttributes.leaderGapHeight=0,this._annotationAttributes.drawLeader=!1,this._annotationAttributes.scale=1,this._annotationAttributes.textAttributes.color=r.BLACK,this._annotationAttributes.textAttributes.font=new n(10),this._annotationAttributes.insets=new o(5,5,5,5),this.creatorEnabled=!1,this.creatorShapeProperties=null,this.newCreatedShapeLayer=new p("Shape Editor Shadow Shape"),this.annotation=new WorldWind.Annotation(new WorldWind.Position(0,0,0),this._annotationAttributes),this.editorFragments=[new u,new y,new m,new v,new _,new b,new S],this.controlPointsLayer=new p("Shape Editor Control Points"),this.accessoriesLayer=new p("Shape Editor Accessories"),this.accessoriesLayer.pickEnabled=!1,this.annotationLayer=new p("Shape Editor Annotation"),this.annotationLayer.pickEnabled=!1,this.annotationLayer.enabled=!1,this.annotationLayer.addRenderable(this.annotation),this.shadowShapeLayer=new p("Shape Editor Shadow Shape"),this.shadowShapeLayer.pickEnabled=!1,this.activeEditorFragment=null,this.actionType=null,this.actionControlPoint=null,this.actionControlPosition=null,this.actionSecondaryBehavior=!1,this.actionStartX=null,this.actionStartY=null,this.actionCurrentX=null,this.actionCurrentY=null,this.originalHighlightAttributes=new f(null),this.originalPlacemarkHighlightAttributes=new h(null),this._clicked0X=null,this._clicked0Y=null,this._clicked1X=null,this._clicked1Y=null,this._click0Time=0,this._click1Time=0,this._dbclickTimeout=0,this._clickDelay=500,this._longPressTimeout=0,this._longPressDelay=1500,this._worldWindow.worldWindowController.addGestureListener(this)};return Object.defineProperties(T.prototype,{worldWindow:{get:function(){return this._worldWindow}},shape:{get:function(){return this._shape}},moveControlPointAttributes:{get:function(){return this._moveControlPointAttributes},set:function(t){this._moveControlPointAttributes=t}},resizeControlPointAttributes:{get:function(){return this._resizeControlPointAttributes},set:function(t){this._resizeControlPointAttributes=t}},rotateControlPointAttributes:{get:function(){return this._rotateControlPointAttributes},set:function(t){this._rotateControlPointAttributes=t}},annotationAttributes:{get:function(){return this._annotationAttributes},set:function(t){this._annotationAttributes=t,this.annotation.attributes=t}}}),T.prototype.enableCreator=function(t,e,i){this.stop(),this.setCreatorEnabled(!0);for(var r=0,n=this.editorFragments.length;r "+d.toString()+" ["+t+"]")}}},o}),i("formats/shapefile/DBaseFile",["../../error/ArgumentError","../../util/ByteBuffer","../../formats/shapefile/DBaseField","../../formats/shapefile/DBaseRecord","../../util/Logger"],function(t,e,i,r,n){"use strict";var o=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"DBaseFile","constructor","missingUrl"));this.url=e,this.header=null,this.fields=null,this.buffer=null,this.boolean=!0,this.numRecordsRead=0,this._completionCallback=null};return o.prototype.getLastModificationDate=function(){return this.header.lastModificationDate},o.prototype.getNumberOfRecords=function(){return this.header.numberOfRecords},o.prototype.getHeaderLength=function(){return this.header.headerLength},o.prototype.getRecordLength=function(){return this.header.recordLength},o.prototype.getNumberOfFields=function(){return(this.header.headerLength-1-o.FIXED_HEADER_LENGTH)/o.FIELD_DESCRIPTOR_LENGTH},o.prototype.getFields=function(){return this.fields},o.prototype.hasNext=function(){return this.numRecordsRead=this.getNumberOfRecords()?null:this.readNextRecord(this._buffer,++this.numRecordsRead)},o.prototype.load=function(t){this._completionCallback=t,this.requestUrl(this.url)},o.prototype.requestUrl=function(t){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){4===i.readyState&&(200===i.status?(this._buffer=new e(i.response),this.parse(),this._completionCallback&&this._completionCallback(this)):(n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed ("+i.statusText+"): "+t),this._completionCallback&&this._completionCallback(this)))}.bind(this),i.onerror=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed: "+t),this._completionCallback&&this._completionCallback(this)},i.ontimeout=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval timed out: "+t),this._completionCallback&&this._completionCallback(this)},i.send(null)},o.prototype.parse=function(){this.header=this.readHeader(this._buffer),this.fields=this.readFieldDescriptors(this._buffer,this.getNumberOfFields())},o.prototype.readHeader=function(t){var i=t.position;t.order(e.LITTLE_ENDIAN);var r=t.getByte();if(r>5)throw new Error("???");var n=t.getByte(),s=t.getByte(),a=t.getByte(),l=t.getInt32(),h=t.getInt16(),u=t.getInt16(),c={year:1900+n,month:s-1,day:a},d={fileCode:r,lastModificationDate:c,numberOfRecords:l,headerLength:h,recordLength:u};return t.seek(i+o.FIXED_HEADER_LENGTH),d},o.prototype.readFieldDescriptors=function(t,e){for(var r=t.position,n=[],s=0;s=0&&t0&&this._numberOfPoints>0)for(var e=this._buffer.getInt32Array(this.numberOfParts),i=0;i=8*this.numberOfPoints)if(t){this._mValues=this._buffer.getDoubleArray(1);var e=this._mValues[0];this._mRange=[e,e]}else this._mRange=this._buffer.getDoubleArray(2),this._mValues=this._buffer.getDoubleArray(this.numberOfPoints)},s.normalizeLocations=function(e){for(var i=0,r=e.length;i90&&(n=t.normalizedDegreesLatitude(i[1]),i[1]=90,r=!0,i[0]>n&&(i[0]=n)),(i[2]<-180||i[3]>180)&&(i[2]=-180,i[3]=180,r=!0),{coords:i,isNormalized:r}},L.prototype.readProjectedBoundingRectangle=function(t){throw new a(s.log(s.LEVEL_SEVERE,"Shapefile.readProjectedBoundingRectangle() not yet implemented"))},L.prototype.readBoundingRectangleCoordinates=function(t){var e=t.getDouble(),i=t.getDouble(),r=t.getDouble(),n=t.getDouble();return[i,n,e,r]},L.prototype.readRecord=function(t){var e=this.createRecord(t);if(null!=e&&null!=this.attributeFile&&this.attributeFile.hasNext()){var i=this.attributeFile.nextRecord();e.setAttributes(i)}return e},L.prototype.createRecord=function(t){return this.isNullType()?this.createNull(t):this.isPointType()?this.createPoint(t):this.isMultiPointType()?this.createMultiPoint(t):this.isPolygonType()?this.createPolygon(t):this.isPolylineType()?this.createPolyline(t):null},L.prototype.createNull=function(t){return new E(this,t)},L.prototype.createPoint=function(t){return new v(this,t)},L.prototype.createMultiPoint=function(t){return new y(this,t)},L.prototype.createPolyline=function(t){return new b(this,t)},L.prototype.createPolygon=function(t){return new _(this,t)},L.prototype.getShapeType=function(t){switch(t){case 0:return L.NULL;case 1:return L.POINT;case 3:return L.POLYLINE;case 5:return L.POLYGON;case 8:return L.MULTI_POINT;case 11:return L.POINT_Z;case 13:return L.POLYLINE_Z;case 15:return L.POLYGON_Z;case 18:return L.MULTI_POINT_Z;case 21:return L.POINT_M;case 23:return L.POLYLINE_M;case 25:return L.POLYGON_M;case 28:return L.MULTI_POINT_M;default:return null}},L.prototype.isMeasureType=function(){return L.measureTypes.hasOwnProperty(this._shapeType)},L.prototype.isZType=function(){return L.zTypes.hasOwnProperty(this._shapeType)},L.prototype.isNullType=function(){return this._shapeType===L.NULL},L.prototype.isPointType=function(){return L.pointTypes.hasOwnProperty(this._shapeType)},L.prototype.isMultiPointType=function(){return L.multiPointTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolylineType=function(){return L.polylineTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolygonType=function(){return L.polygonTypes.hasOwnProperty(this._shapeType)},L.NULL="null",L.POINT="point",L.MULTI_POINT="multiPoint",L.POLYLINE="polyline",L.POLYGON="polygon",L.POINT_M=L.POINT+"M",L.MULTI_POINT_M=L.MULTI_POINT+"M",L.POLYLINE_M=L.POLYLINE+"M",L.POLYGON_M=L.POLYGON+"M",L.POINT_Z=L.POINT+"Z",L.MULTI_POINT_Z=L.MULTI_POINT+"Z",L.POLYLINE_Z=L.POLYLINE+"Z",L.POLYGON_Z=L.POLYGON+"Z",L.SHAPE_MULTI_PATCH="multiPatch",L.measureTypes={pointM:L.POINT_M,pointZ:L.POINT_Z,multiPointM:L.MULTI_POINT_M,multiPointZ:L.MULTI_POINT_Z,polylineM:L.POLYLINE_M,polylineZ:L.POLYLINE_Z,polygonM:L.POLYGON_M,polygonZ:L.POLYGON_Z},L.zTypes={pointZ:L.POINT_Z,multiPointZ:L.MULTI_POINT_Z,polylineZ:L.POLYLINE_Z,polygonZ:L.POLYGON_Z},L.pointTypes={point:L.POINT,pointZ:L.POINT_Z,pointM:L.POINT_M},L.multiPointTypes={multiPoint:L.MULTI_POINT,multiPointZ:L.MULTI_POINT_Z,multiPointM:L.MULTI_POINT_M},L.polylineTypes={polyline:L.POLYLINE,polylineZ:L.POLYLINE_Z,polylineM:L.POLYLINE_M},L.polygonTypes={polygon:L.POLYGON,polygonZ:L.POLYGON_Z,polygonM:L.POLYGON_M},L.FILE_CODE=9994,L}),i("layer/ShowTessellationLayer",["../shaders/BasicProgram","../layer/Layer"],function(t,e){"use strict";var i=function(){e.call(this,"Show Tessellation"),this.enableTerrainGeometry=!0,this.enableTerrainExtent=!1};return i.prototype=Object.create(e.prototype),i.prototype.doRender=function(t){try{this.beginRendering(t),this.enableTerrainGeometry&&this.drawTerrainGeometry(t),this.enableTerrainExtent&&this.drawTerrainExtent(t)}finally{this.endRendering(t)}},i.prototype.beginRendering=function(t){var e=t.currentGlContext;e.depthMask(!1)},i.prototype.endRendering=function(t){var e=t.currentGlContext;e.depthMask(!0)},i.prototype.drawTerrainGeometry=function(e){if(e.terrain&&e.terrain.tessellator){var i,r,n=e.currentGlContext,o=e.terrain,s=o.tessellator,a=o.surfaceGeometry;try{i=e.findAndBindProgram(t),s.beginRendering(e);for(var l=0,h=a.length;lthis._MAX_GL_POINT_SIZE&&e.log(e.LEVEL_WARNING,"StarFieldLayer - sunSize is to big, max size allowed is: "+this._MAX_GL_POINT_SIZE);var s=n.getAsCelestialLocation(this.time||new Date);this._sunBufferView[0]=s.declination,this._sunBufferView[1]=s.rightAscension,this._sunBufferView[2]=Math.min(this.sunSize,this._MAX_GL_POINT_SIZE),this._sunBufferView[3]=1,this._sunPositionsCacheKey||(this._sunPositionsCacheKey=o.generateCacheKey());var a=o.resourceForKey(this._sunPositionsCacheKey);a?(i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferSubData(i.ARRAY_BUFFER,0,this._sunBufferView)):(a=i.createBuffer(),o.putResource(this._sunPositionsCacheKey,a,4*this._sunBufferView.length),i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferData(i.ARRAY_BUFFER,this._sunBufferView,i.DYNAMIC_DRAW)),t.frameStatistics.incrementVboLoadCount(1),i.vertexAttribPointer(0,4,i.FLOAT,!1,0,0),r.loadTextureEnabled(i,!0);var l=t.gpuResourceCache.resourceForKey(this._sunImageSource);l.bind(t),i.drawArrays(i.POINTS,0,1)},o.prototype.endRendering=function(t){var e=t.currentGlContext;e.depthMask(!0),e.disableVertexAttribArray(0)},o.prototype.fetchStarData=function(){if(!this._loadStarted){this._loadStarted=!0;var t=this,i=new XMLHttpRequest;i.onload=function(){if(this.status>=200&&this.status<300)try{t._starData=JSON.parse(this.response),t.sendRedrawRequest()}catch(t){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to parse JSON for star data "+t.toString())}else e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data. Status: "+this.status+" "+this.statusText);t._loadStarted=!1},i.onerror=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data"),t._loadStarted=!1},i.ontimeout=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer fetch star data has timeout"),t._loadStarted=!1},i.open("GET",this._starDataSource,!0),i.send()}},o.prototype.createStarsGeometry=function(){var t=this.parseStarsMetadata(this._starData.metadata);if(t.raIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing ra field in star data."));if(t.decIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing dec field in star data."));if(t.magIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing vmag field in star data."));var i=this._starData.data,r=[];this._minMagnitude=Number.MAX_VALUE,this._maxMagnitude=Number.MIN_VALUE;for(var n=0,o=i.length;n65536)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too many positions. Must be fewer than 65537. Use TriangleMesh.split to split the shape."));if(!r)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Indices array is null or undefined"));if(r.length<3)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too few indices."));t.call(this,n),this._positions=i,this._indices=r,this.referencePosition=this._positions[0]};return g.prototype=Object.create(t.prototype),Object.defineProperties(g.prototype,{positions:{get:function(){return this._positions},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","positions","missingPositions"));this._positions=t,this.referencePosition=this._positions[0],this.reset()}},indices:{get:function(){return this._indices},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","indices","Indices array is null or undefined"));this._indices=t,this.meshIndices=null,this.reset()}},outlineIndices:{get:function(){return this._outlineIndices},set:function(t){this._outlineIndices=t,this.meshOutlineIndices=null,this.reset()}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(t){if(t&&t.length!=this._positions.length)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","textureCoordinates","Number of texture coordinates is inconsistent with the currently specified positions."));this._textureCoordinates=t,this.reset(),this.texCoords=null}}}),g.prototype.createSurfaceShape=function(){if(this._outlineIndices){for(var t=[],e=0;e65533&&l.length%3===0){if(s.length>0){var d={positions:s,indices:l};if(i&&(d.textureCoords=a),r){for(var p=[],f=0;f=n.screenOffset.x&&s<=n.screenOffset.x+n.size&&a>=n.screenOffset.y&&a<=n.screenOffset.y+n.size)return n;return null},l.prototype.determineOperation=function(t,e){var i=null;return e&&e instanceof s&&(e===this.panControl?i=this.handlePan:e===this.zoomInControl||e===this.zoomOutControl?i=this.handleZoom:e===this.headingLeftControl||e===this.headingRightControl?i=this.handleHeading:e===this.tiltUpControl||e===this.tiltDownControl?i=this.handleTilt:e===this.exaggerationUpControl||e===this.exaggerationDownControl?i=this.handleExaggeration:e!==this.fovNarrowControl&&e!==this.fovWideControl||(i=this.handleFov)),i},l.prototype.isCurrentTouch=function(t){for(var e=0;e=0?(r=a[0],n=a[1]):(r=a[1],n=a[0]),i+="&VERSION="+this.service.capabilities.version,i+="&COVERAGEID="+this.coverageId,i+="&FORMAT="+e,i+="&SCALESIZE="+s[0]+"("+t.tileWidth+"),",i+=s[1]+"("+t.tileHeight+")",i+="&OVERVIEWPOLICY=NEAREST",i+="&SUBSET="+r+"("+l.minLatitude+","+l.maxLatitude+")",i+="&SUBSET="+n+"("+l.minLongitude+","+l.maxLongitude+")",encodeURI(i)},i.prototype.fixGetCoverageString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","fixGetMapString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/),r<0&&(i+="&")),i},i}),i("ogc/wcs/WcsCoverage",["../../error/ArgumentError","../../util/Logger","../../ogc/wcs/WcsUrlBuilder"],function(t,e,i){"use strict";var r=function(i,r){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsCoverage","constructor","missingId"));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsCoverage","constructor","missingWebCoverageService"));this.coverageId=i,this.service=r,this.sector=this.service.coverageDescriptions.getSector(this.coverageId),this.resolution=this.service.coverageDescriptions.getResolution(this.coverageId),this.elevationConfig=this.createElevationConfig()};return r.PREFERRED_FORMATS={GeoTIFF:!0,"image/tiff":!0,TIFF:!0},r.DEFAULT_FORMAT="image/tiff",r.prototype.createElevationConfig=function(){return{resolution:this.resolution,coverageSector:this.sector,retrievalImageFormat:this.determineFormatFromService(),urlBuilder:new i(this.coverageId,this.service)}},r.prototype.determineFormatFromService=function(){var t,e,i,n=this.service.capabilities.version;if("1.0.0"===n){for(e=0,i=this.service.coverageDescriptions.coverages.length;e0?n:"1.0.0",this.crs="EPSG:4326"};return i.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","The coverage format is null or undefined."));var o=r.sector,s=i.fixGetCoverageString(this.serviceAddress);return s.search(/service=wcs/i)<0&&(s+="service=WCS"),s+="&request=GetCoverage",s=s+"&version="+this.wcsVersion,s=s+"&coverage="+this.coverageName,s=s+"&format="+n,s=s+"&width="+r.tileWidth,s=s+"&height="+r.tileHeight,s=s+"&crs="+this.crs,s+="&bbox=",s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude,s=s.replace(" ","%20")},i.fixGetCoverageString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsTileUrlBuilder","fixGetCoverageString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/),r<0&&(i+="&")),i},i}),i("globe/WcsEarthElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WcsTileUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:e.FULL_SPHERE,resolution:.008333333333333,retrievalImageFormat:"image/tiff",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/wms2","NASA_SRTM30_900m_Tiled","1.0.0")}),this.displayName="WCS Earth Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("ogc/wcs/WebCoverageService",["../../error/ArgumentError","../../util/Logger","../../util/Promise","../../ogc/wcs/WcsCapabilities","../../ogc/wcs/WcsCoverage","../../ogc/wcs/WcsCoverageDescriptions"],function(t,e,i,r,n,o){"use strict";var s=function(){this.serviceAddress=null,this.coverages=[],this.capabilities=null,this.coverageDescriptions=null};return s.WCS_XLMNS="http://www.opengis.net/wcs",s.WCS_2_XLMNS="http://www.opengis.net/wcs/2.0",s.create=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WebCoverageService","constructor","missingUrl"));var r=new s;return r.serviceAddress=i,r.retrieveCapabilities().then(function(t){return r.capabilities=t,r.retrieveCoverageDescriptions(t)}).then(function(t){return r.parseCoverages(t),r})},s.prototype.getCoverage=function(t){},s.prototype.retrieveCapabilities=function(){var t,e=this;return e.retrieveXml(e.buildCapabilitiesXmlRequest("2.0.1")).then(function(i){return t=i.documentElement.getAttribute("version"),"2.0.1"===t||"2.0.0"===t?i:e.retrieveXml(e.buildCapabilitiesXmlRequest("1.0.0"))}).then(function(t){return new r(t)})},s.prototype.retrieveCoverageDescriptions=function(){return this.retrieveXml(this.buildDescribeCoverageXmlRequest())},s.prototype.parseCoverages=function(t){this.coverageDescriptions=new o(t);for(var e,i,r=this.coverageDescriptions.coverages.length,s=0;s0&&""!=o[0]&&this.setOptions(o,r);var s=i[e]&&new i[e];s||(s=new n),o&&o.length>0&&""!=o[0]&&s.setOptions(o[0],s),this.add(s)}},n.prototype.rightParenthesis=function(t){t.rightParenthesis++,t.coordinates&&(this.addCoordinates(t.coordinates),t.coordinates=null)},n.prototype.leftParenthesis=function(t){t.leftParenthesis++},n.prototype.comma=function(t){t.coordinates?(this.addCoordinates(t.coordinates),t.coordinates=null):this.commaWithoutCoordinates(t)},n.prototype.commaWithoutCoordinates=function(t){},n.prototype.number=function(t,e){t.coordinates=t.coordinates||[],t.coordinates.push(e)},n.prototype.setOptions=function(t,e){"Z"==t?e.set3d():"M"==t?e.setLrs():"MZ"==t&&(e.set3d(),e.setLrs())},n.prototype.isFinished=function(){return this.options.leftParenthesis===this.options.rightParenthesis&&this.options.leftParenthesis>0},n}),i("formats/wkt/WktTokens",["./WktElements","./geom/WktObject","./WktType"],function(t,e,i){var r=function(t){this.sourceText=t};return r.prototype.objects=function(){var i,r=[];return this.tokenize(this.sourceText).forEach(function(n){if(i&&i.isFinished()||!i){var o=n.value,s=o.match("[M]?[Z]?$");s&&s.length>0&&""!=s[0]&&(o=o.substring(0,o.length-s.length)),i=t[o]&&new t[o],i||(i=new e),s&&s.length>0&&""!=s[0]&&i.setOptions(s[0],i),r.push(i)}else i.handleToken(n)}),r},r.prototype.tokenize=function(t){this.currentPosition=0;for(var e=[];this.currentPosition="a"&&t<="z"||t>="A"&&t<="Z"},r.prototype.isNumeric=function(t){return t>="0"&&t<="9"||"."==t||"-"==t},r.prototype.isWhiteSpace=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},r.prototype.readText=function(t){for(var e="";this.isAlpha(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,e},r.prototype.readNumeric=function(t){for(var e="";this.isNumeric(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,Number(e)},r}),i("formats/wkt/Wkt",["../../error/ArgumentError","../../util/Logger","./WktTokens"],function(t,e,i){var r=function(t){this.textRepresentation=t,this._parserCompletionCallback=this.defaultParserCompletionCallback,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this._layer=null};return Object.defineProperties(r.prototype,{parserCompletionCallback:{get:function(){return this._parserCompletionCallback}},shapeConfigurationCallback:{get:function(){return this._shapeConfigurationCallback}},layer:{get:function(){return this._layer}}}),r.prototype.load=function(t,e,r){r&&(this._layer=r),t&&(this._parserCompletionCallback=t),e&&(this._shapeConfigurationCallback=e),this.parserCompletionCallback(this,new i(this.textRepresentation).objects())},r.prototype.defaultShapeConfigurationCallback=function(t){},r.prototype.defaultParserCompletionCallback=function(t,e){var i=t.shapeConfigurationCallback,r=[];e.forEach(function(t){t.shapes().forEach(function(e){var n=i(t);n&&n.attributes&&(e.attributes=n.attributes),n&&n.highlightAttributes&&(e.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(e.pickDelegate=n.pickDelegate),n&&n.userProperties&&(e.userProperties=n.userProperties),r.push(e)})}),t.layer&&t.layer.addRenderables(r)},r}),i("formats/wkt/WktExporter",["../../error/ArgumentError","../../util/Logger","./WktType"],function(t,e,i){"use strict";var r={exportRenderable:function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WktExporter","exportRenderable","missingRenderable"));return i instanceof WorldWind.Placemark?this.exportPlacemark(i):i instanceof WorldWind.Path?this.exportPath(i):i instanceof WorldWind.Polygon?this.exportPolygon(i):i instanceof WorldWind.SurfacePolyline?this.exportSurfacePolyline(i):i instanceof WorldWind.SurfacePolygon?this.exportSurfacePolygon(i):i instanceof WorldWind.SurfaceEllipse?this.exportSurfaceEllipse(i):i instanceof WorldWind.SurfaceCircle?this.exportSurfaceCircle(i):i instanceof WorldWind.SurfaceRectangle?this.exportSurfaceRectangle(i):i instanceof WorldWind.SurfaceSector?this.exportSurfaceSector(i):(e.log(e.LEVEL_WARNING,"Export renderable not implemented: "+i),null)},exportRenderables:function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WktExporter","exportRenderables","missingRenderables"));if(0!=r.length){if(r.length>1){for(var n=i.SupportedGeometries.GEOMETRY_COLLECTION+"(",o=0;o0&&r.boundaries[0].length>2){ -for(var o=0;o0&&r.boundaries[0].length>2){for(var o=0;o=0?i.format="image/png":s.indexOf("image/jpeg")>=0?i.format="image/jpeg":s.indexOf("image/tiff")>=0?i.format="image/tiff":s.indexOf("image/gif")>=0&&(i.format="image/gif"),i.service=o.getUrl;var l=t.crses;l||(l=t.srses),l&&(l.indexOf("EPSG:4326")>=0||l.indexOf("epsg:4326")>=0?i.coordinateSystem="EPSG:4326":(l.indexOf("CRS84")>=0||l.indexOf("CRS:84")>=0)&&(i.coordinateSystem="CRS:84"));var h=a.parseTimeDimensions(t);return h&&h.length>0&&(i.timeSequences=h),i},a.parseTimeDimensions=function(t){var e=t.extents||t.dimensions,i=null;if(e){i=[];for(var n=0;n0){var y=L.perspectiveNearDistance(c.width,c.height,g);f>y&&(f=y)}f<1&&(f=1),e.setToPerspectiveProjection(c.width,c.height,f,p)}},T.prototype.computePixelMetrics=function(t){var e=f.fromIdentity();e.invertMatrix(t);var i=new w(-1,-1,-1),r=new w(1,1,-1),n=new w(-1,-1,1),o=new w(1,1,1);i.multiplyByMatrix(e),r.multiplyByMatrix(e),n.multiplyByMatrix(e),o.multiplyByMatrix(e);var s=L.fabs(r[0]-i[0]),a=L.fabs(o[0]-n[0]),l=-i[2],h=-n[2],u=(a-s)/(h-l),c=s-u*l;return{pixelSizeFactor:u/this.viewport.width,pixelSizeOffset:c/this.viewport.height}},T.prototype.pixelSizeAtDistance=function(t){this.computeViewingTransform(this.scratchProjection,this.scratchModelview);var e=this.computePixelMetrics(this.scratchProjection);return e.pixelSizeFactor*t+e.pixelSizeOffset},T.prototype.computeDrawContext=function(){var t=this.drawContext;this.computeViewingTransform(t.projection,t.modelview),t.viewport=this.viewport,t.eyePoint=t.modelview.extractEyePoint(new w(0,0,0)),t.modelviewProjection.setToIdentity(),t.modelviewProjection.setToMultiply(t.projection,t.modelview);var e=this.computePixelMetrics(t.projection);t.pixelSizeFactor=e.pixelSizeFactor,t.pixelSizeOffset=e.pixelSizeOffset;var i=f.fromIdentity();i.invertOrthonormalMatrix(t.modelview),t.modelviewNormalTransform=f.fromIdentity().setToTransposeOfMatrix(i.upper3By3());var r=f.fromIdentity();r.setToTransposeOfMatrix(t.modelview),t.frustumInModelCoordinates=o.fromProjectionMatrix(t.projection),t.frustumInModelCoordinates.transformByMatrix(r),t.frustumInModelCoordinates.normalize()},T.prototype.resetDrawContext=function(){this.globe.offset=0;var t=this.drawContext;t.reset(),t.globe=this.globe,t.navigator=this.navigator,t.layers=this.layers.slice(),t.layers.push(t.screenCreditController),this.computeDrawContext(),t.verticalExaggeration=this.verticalExaggeration,t.surfaceOpacity=this.surfaceOpacity,t.deepPicking=this.deepPicking,t.frameStatistics=this.frameStatistics,t.pixelScale=this.pixelScale,t.update()},T.prototype.drawFrame=function(){try{this.drawContext.frameStatistics.beginFrame(),this.beginFrame(),this.drawContext.globe.is2D()&&this.drawContext.globe.continuous?this.do2DContiguousRepaint():this.doNormalRepaint()}finally{this.endFrame(),this.drawContext.frameStatistics.endFrame()}},T.prototype.doNormalRepaint=function(){this.createTerrain(),this.clearFrame(),this.deferOrderedRendering=!1,this.drawContext.pickingMode?this.drawContext.makePickFrustum()&&(this.doPick(),this.resolvePick()):(this.doDraw(),this.subsurfaceMode&&this.hasStencilBuffer&&(this.redrawSurface(),this.drawScreenRenderables()))},T.prototype.do2DContiguousRepaint=function(){this.createTerrain2DContiguous(),this.clearFrame(),this.drawContext.pickingMode?this.drawContext.makePickFrustum()&&(this.pick2DContiguous(),this.resolvePick()):this.draw2DContiguous()},T.prototype.resolvePick=function(){this.drawContext.pickTerrainOnly?this.resolveTerrainPick():this.drawContext.regionPicking?this.resolveRegionPick():this.resolveTopPick()},T.prototype.beginFrame=function(){var t=this.drawContext.currentGlContext;t.enable(t.BLEND),t.enable(t.CULL_FACE),t.enable(t.DEPTH_TEST),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.depthFunc(t.LEQUAL),this.drawContext.pickingMode&&(this.drawContext.makePickFramebuffer(),this.drawContext.bindFramebuffer(this.drawContext.pickFramebuffer))},T.prototype.endFrame=function(){var t=this.drawContext.currentGlContext;t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.blendFunc(t.ONE,t.ZERO),t.depthFunc(t.LESS),t.clearColor(0,0,0,1),this.drawContext.bindFramebuffer(null),this.drawContext.bindProgram(null)},T.prototype.clearFrame=function(){var t=this.drawContext,e=t.currentGlContext;e.clearColor(t.clearColor.red,t.clearColor.green,t.clearColor.blue,t.clearColor.alpha),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)},T.prototype.doDraw=function(){this.drawContext.renderShapes=!0,this.subsurfaceMode&&this.hasStencilBuffer?(this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawContext.currentGlContext.clear(this.drawContext.currentGlContext.DEPTH_BUFFER_BIT|this.drawContext.currentGlContext.STENCIL_BUFFER_BIT),this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.ALWAYS,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE),this.drawOrderedRenderables())):(this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawOrderedRenderables(),this.drawScreenRenderables()))},T.prototype.redrawSurface=function(){this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.EQUAL,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.KEEP,this.drawContext.currentGlContext.KEEP,this.drawContext.currentGlContext.KEEP),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!1),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST)},T.prototype.doPick=function(){this.drawContext.terrain&&this.drawContext.terrain.pick(this.drawContext),this.drawContext.pickTerrainOnly||(this.subsurfaceMode&&this.hasStencilBuffer?(this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawContext.currentGlContext.clear(this.drawContext.currentGlContext.DEPTH_BUFFER_BIT|this.drawContext.currentGlContext.STENCIL_BUFFER_BIT),this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.ALWAYS,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE),this.drawOrderedRenderables(),this.drawContext.terrain.pick(this.drawContext),this.drawScreenRenderables())):(this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawOrderedRenderables(),this.drawScreenRenderables())))},T.prototype.createTerrain=function(){var t=this.drawContext;t.terrain=this.globe.tessellator.tessellate(t),t.frameStatistics.setTerrainTileCount(t.terrain?t.terrain.surfaceGeometry.length:0)},T.prototype.makeCurrent=function(t){var e=this.drawContext;switch(e.globe.offset=t,e.globeStateKey=e.globe.stateKey,t){case-1:e.terrain=this.terrainLeft;break;case 0:e.terrain=this.terrainCenter;break;case 1:e.terrain=this.terrainRight}},T.prototype.createTerrain2DContiguous=function(){var t=this.drawContext;this.terrainCenter=null,t.globe.offset=0,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainCenter=t.globe.tessellator.tessellate(t)),this.terrainRight=null,t.globe.offset=1,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainRight=t.globe.tessellator.tessellate(t)),this.terrainLeft=null,t.globe.offset=-1,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainLeft=t.globe.tessellator.tessellate(t))},T.prototype.draw2DContiguous=function(){var t="";this.terrainCenter&&(t+=" 0 ",this.makeCurrent(0),this.deferOrderedRendering=this.terrainLeft||this.terrainRight,this.doDraw()),this.terrainRight&&(t+=" 1 ",this.makeCurrent(1),this.deferOrderedRendering=this.terrainLeft||this.terrainLeft,this.doDraw()),this.deferOrderedRendering=!1,this.terrainLeft&&(t+=" -1 ",this.makeCurrent(-1),this.doDraw()),this.subsurfaceMode&&this.hasStencilBuffer&&(this.deferOrderedRendering=!0,this.terrainCenter&&(t+=" 0 ",this.makeCurrent(0),this.redrawSurface()),this.terrainRight&&(t+=" 1 ",this.makeCurrent(1),this.redrawSurface()),this.terrainLeft&&(t+=" -1 ",this.makeCurrent(-1),this.redrawSurface())),this.drawScreenRenderables()},T.prototype.pick2DContiguous=function(){this.terrainCenter&&(this.makeCurrent(0),this.deferOrderedRendering=this.terrainLeft||this.terrainRight,this.doPick()),this.terrainRight&&(this.makeCurrent(1),this.deferOrderedRendering=this.terrainLeft||this.terrainLeft,this.doPick()),this.deferOrderedRendering=!1,this.terrainLeft&&(this.makeCurrent(-1),this.doPick())},T.prototype.drawLayers=function(t){var e,i=Date.now(),r=this.drawContext,n=r.layers;r.accumulateOrderedRenderables=t;for(var o=0,s=n.length;o=0&&this.layers.splice(e,1)},T.prototype.insertLayer=function(t,e){e&&this.layers.splice(t,0,e)},T.prototype.indexOfLayer=function(t){return this.layers.indexOf(t)},T.prototype.drawSurfaceRenderables=function(){var t,e=this.drawContext;for(e.reverseSurfaceRenderables();t=e.popSurfaceRenderable();)try{t.renderSurface(e)}catch(t){d.logMessage(d.LEVEL_WARNING,"WorldWindow","drawSurfaceRenderables","Error while rendering a surface renderable.\n"+t.message)}},T.prototype.drawOrderedRenderables=function(){var t,e=Date.now(),i=this.drawContext;if(i.sortOrderedRenderables(),this._orderedRenderingFilters)for(var r=0;r=0&&t.indexOf("4326")>=0},d.isEpsg3857Crs=function(t){return t.indexOf("EPSG")>=0&&(t.indexOf("3857")>=0||t.indexOf("900913")>=0)},d.isOGCCrs84=function(t){return t.indexOf("OGC")>=0&&t.indexOf("CRS84")>=0},d}),i("layer/OpenStreetMapImageLayer",["../util/Color","../layer/Layer","../util/Logger","../ogc/wmts/WmtsCapabilities","../layer/WmtsLayer"],function(t,e,i,r,n){"use strict";var o=function(t){e.call(this,this.displayName),this.displayName=t||"Open Street Map",this.layer=null,this.xhr=null,this.pickEnabled=!0};return o.prototype=Object.create(e.prototype),o.prototype.doRender=function(e){this.configureLayer(e),this.layer&&(this.layer.opacity=this.opacity,this.layer.doRender(e),this.inCurrentFrame=this.layer.inCurrentFrame,this.inCurrentFrame&&(e.screenCreditController.addCredit("OpenStreetMap ©",t.DARK_GRAY),e.screenCreditController.addCredit("EOX.at ©",t.DARK_GRAY)))},o.prototype.configureLayer=function(t){if(!this.xhr){var e=this,o=t.currentGlContext.canvas;this.xhr=new XMLHttpRequest,this.xhr.open("GET","https://tiles.maps.eox.at/wmts/1.0.0/WMTSCapabilities.xml",!0),this.xhr.onreadystatechange=function(){if(4===e.xhr.readyState)if(200===e.xhr.status){var t=new r(e.xhr.responseXML),s=t.getLayer("osm"),a=n.formLayerConfiguration(s);a.title=e.displayName,e.layer=new n(a);var l=document.createEvent("Event");l.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),o.dispatchEvent(l)}else i.log(i.LEVEL_WARNING,"OSM retrieval failed ("+xhr.statusText+"): "+url)},this.xhr.onerror=function(){i.log(i.LEVEL_WARNING,"OSM retrieval failed: "+url)},this.xhr.ontimeout=function(){i.log(i.LEVEL_WARNING,"OSM retrieval timed out: "+url)},this.xhr.send(null)}},o}),i("projections/ProjectionGnomonic",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t){this.north=!("South"===t);var e=this.north?new n(30,90,-180,180):new n(-90,-30,-180,180);i.call(this,"Polar Gnomonic",!1,e),this._pole=t,this.displayName=this.north?"North Gnomonic":"South Gnomonic",this._stateKey="projection polar gnomonic "+this._pole+" "};return s.prototype=Object.create(i.prototype),Object.defineProperties(s.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this.projectionLimits=this.north?new n(30,90,-180,180):new n(-90,-30,-180,180),this._stateKey="projection polar gnomonic "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),s.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&n===-90)l[0]=0,l[1]=0,l[2]=s;else{var h=this.north?1:-1,u=i.equatorialRadius/Math.tan(n*t.DEGREES_TO_RADIANS);l[0]=u*Math.sin(o*t.DEGREES_TO_RADIANS)*h,l[1]=u*-Math.cos(o*t.DEGREES_TO_RADIANS),l[2]=s}return l},s.prototype.geographicToCartesianGrid=function(i,n,s,a,l,h,u,c){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","missingSector"));if(!l||l.length1?s-1:1),S=(b-_)/(a>1?a-1:1),L=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,T=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,R=this.north?1:-1,x=h?h:new Vec3(0,0,0),M=0,C=0;for(d=0,f=E;dMath.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},s.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},s.prototype.northTangentAtPoint=function(t,i,n,o,s,a){if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},s}),i("projections/ProjectionMercator",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(){i.call(this,"Mercator",!0,new n(-78,78,-180,180))};return a.prototype=Object.create(i.prototype),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingResult"));n>this.projectionLimits.maxLatitude&&(n=this.projectionLimits.maxLatitude),n1?a-1:1),M=(R-T)/(l>1?l-1:1),C=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,A=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,P=u?u:new o(0,0,0),O=c?c[0]:0,N=0,I=0;for(p=0,g=S;p1?o-1:1),w=(_-v)/(s>1?s-1:1),S=this.north?-1:1,L=l?l:new Vec3(0,0,0),T=Math.PI/2,R=0,x=0,M=new Float64Array(s),C=new Float64Array(s);for(d=0,f=v;dMath.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},n.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},n.prototype.northTangentAtPoint=function(t,i,n,o,s,a){if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},n}),i("projections/ProjectionUPS",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){this.north=!("South"===t);var e=this.north?new n(0,90,-180,180):new n(-90,0,-180,180);i.call(this,"Uniform Polar Stereographic",!1,e),this._pole=t,this.displayName=this.north?"North UPS":"South UPS",this._stateKey="projection ups "+this._pole+" "};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this.projectionLimits=this.north?new n(0,90,-180,180):new n(-90,0,-180,180),this._stateKey="projection ups "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&n===-90)l[0]=0,l[1]=0,l[2]=s;else{var h,u,c,d=this.north?1:-1,p=n*t.DEGREES_TO_RADIANS,f=o*t.DEGREES_TO_RADIANS,g=.994,m=Math.sqrt(i.eccentricitySquared),y=Math.sqrt(Math.pow(1+m,1+m)*Math.pow(1-m,1-m));(this.north&&p<0||!this.north&&p>0)&&(p=0),h=Math.sin(p*d),u=Math.sqrt((1-h)/(1+h)*Math.pow((1+m*h)/(1-m*h),m)),c=2*i.equatorialRadius*g*u/y,l[0]=c*Math.sin(f),l[1]=-c*Math.cos(f)*d,l[2]=s}return l},a.prototype.geographicToCartesianGrid=function(i,n,a,l,h,u,c,d){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingSector"));if(!h||h.length1?a-1:1),x=(T-L)/(l>1?l-1:1),M=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,C=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,A=.994,P=Math.sqrt(i.eccentricitySquared),O=Math.sqrt(Math.pow(1+P,1+P)*Math.pow(1-P,1-P)),N=this.north?1:-1,I=u?u:new o(0,0,0),D=0,k=0;for(p=0,g=w;pt.TWO_PI&&(r%=t.TWO_PI),t.RADIANS_TO_DEGREES*(r>=0?r:r+t.TWO_PI)},u.prototype.deepCopyLocations=function(t){var e=[];if(t.length>0&&Array.isArray(t[0]))for(var r=0,n=t.length;r0&&Array.isArray(e[0]))for(var o=0,a=e.length;o0&&Array.isArray(n[0]))for(var l=0,h=n.length;ln.magnitude()?o.copy(i):new e(t,s).pointAt(l,o)},u.prototype.computeShadowPointLocations=function(t,e,r,n){var o=null,s=null;t.pathType===WorldWind.LINEAR?e.position=new i((r.latitude+n.latitude)/2,(r.longitude+n.longitude)/2):t.pathType===WorldWind.RHUMB_LINE?(null==o&&(o=i.rhumbAzimuth(r,n),s=i.rhumbDistance(r,n)),e.position=i.rhumbLocation(r,o,.5*s,e.position)):(null==o&&(o=i.greatCircleAzimuth(r,n),s=i.greatCircleDistance(r,n)),e.position=i.greatCircleLocation(r,o,.5*s,e.position))},u}),i("util/editor/ShapeEditorConstants",[],function(){"use strict";var t={LOCATION:"location",ROTATION:"rotation",WIDTH:"width",HEIGHT:"height",RADIUS:"radius",DRAG:"drag",MIN_CORNER:"min_corner",MAX_CORNER:"max_corner",SHADOW:"shadow"};return t}),i("util/editor/PlacemarkEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","./ShapeEditorConstants","../../shapes/Placemark"],function(t,e,i,r){"use strict";var n=function(){};return n.prototype=Object.create(t.prototype),n.prototype.canHandle=function(t){return t instanceof r},n.prototype.createShadowShape=function(t){return new r(t.position,null,t.attributes)},n.prototype.getShapeCenter=function(t){return t.position},n.prototype.initializeControlElements=function(t,e,r,n,o,s,a){a&&(t.userProperties.purpose=i.DRAG,e.push(t))},n.prototype.updateControlElements=function(t,e,i){i[0].position=t.position},n.prototype.reshape=function(t,e,i,r,n){return!1},n}),i("shapes/SurfaceEllipse",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,n,s,l){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceEllipse","constructor","missingLocation"));if(i<0||n<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceEllipse","constructor","Radius is negative."));o.call(this,l),this._center=t,this._majorRadius=i,this._minorRadius=n,this._heading=s,this._intervals=a.DEFAULT_NUM_INTERVALS};return a.prototype=Object.create(o.prototype),Object.defineProperties(a.prototype,{center:{get:function(){return this._center},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._center=t}},majorRadius:{get:function(){return this._majorRadius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._majorRadius=t}},minorRadius:{get:function(){return this._minorRadius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._minorRadius=t}},heading:{get:function(){return this._heading},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._heading=t}},intervals:{get:function(){return this._intervals},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._intervals=t}}}),a.staticStateKey=function(t){var e=o.staticStateKey(t);return e+" ce "+t.center.toString()+" ma "+t.majorRadius.toString()+" mi "+t.minorRadius.toString()+" he "+t.heading.toString()+" in "+t.intervals.toString()},a.prototype.computeStateKey=function(){return a.staticStateKey(this)},a.prototype.computeBoundaries=function(e){if(0==this.majorRadius&&0==this.minorRadius)return null;var r=e.globe,n=1+Math.max(a.MIN_NUM_INTERVALS,this.intervals),o=2*Math.PI/(n-1),l=r.radiusAt(this.center.latitude,this.center.longitude);this._boundaries=new Array(n);for(var h=0;h0)for(var l=0;l0&&(t.majorRadius=h)}else if(n.userProperties.purpose===i.HEIGHT){var u=t.minorRadius+2*a.dot(l);u>0&&(t.minorRadius=u)}else if(n.userProperties.purpose===i.ROTATION){var c=e.greatCircleAzimuth(t.center,s),d=e.greatCircleAzimuth(t.center,o)-c;t.heading=this.normalizedHeading(t.heading,d)}},n}),i("shapes/SurfaceCircle",["../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r,n){"use strict";var o=function(e,r,s){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceCircle","constructor","missingLocation"));if(r<0)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceCircle","constructor","Radius is negative"));n.call(this,s),this._center=e,this._radius=r,this._intervals=o.DEFAULT_NUM_INTERVALS};return o.prototype=Object.create(n.prototype),Object.defineProperties(o.prototype,{center:{get:function(){return this._center},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._center=t}},radius:{get:function(){return this._radius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._radius=t}},intervals:{get:function(){return this._intervals},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._intervals=t}}}),o.staticStateKey=function(t){var e=n.staticStateKey(t);return e+" ce "+t.center.toString()+" ra "+t.radius.toString()},o.prototype.computeStateKey=function(){return o.staticStateKey(this)},o.prototype.computeBoundaries=function(t){if(0===this.radius)return null;var i=1+Math.max(o.MIN_NUM_INTERVALS,this.intervals),r=360/(i-1),n=this.radius/t.globe.radiusAt(this.center.latitude,this.center.longitude);this._boundaries=new Array(i);for(var s=0;s0&&(e.greatCircleLocation(t.center,90,t.radius/i.equatorialRadius,r[0].position),r[0].userProperties.size=t.radius)},n.prototype.reshape=function(t,e,r,n,o){if(r.userProperties.purpose===i.RADIUS){var s=this.computeControlPointDelta(e,n,o),a=this.computeControlPointDelta(e,r.position,t.center).normalize(),l=t.radius+s.dot(a);l>0&&(t.radius=l)}},n}),i("util/editor/SurfacePolygonEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","../../geom/Position","./ShapeEditorConstants","../../shapes/SurfacePolygon","../../geom/Vec3"],function(t,e,i,r,n,o){"use strict";var s=function(){this.currentHeading=0,this.moveControlPointAttributes=null,this.shadowControlPointAttributes=null};return s.prototype=Object.create(t.prototype),s.prototype.canHandle=function(t){return t instanceof Function?"SurfacePolygon"===t.name:t instanceof n},s.prototype.createShadowShape=function(t){return new n(this.deepCopyLocations(t.boundaries),t.attributes)},s.prototype.getShapeCenter=function(t,e){return this.getCenterFromLocations(e,t.boundaries)},s.prototype.isRegularShape=function(){return!1},s.prototype.initializeControlElements=function(t,e,i,n,o,s,a,l){if(this.currentHeading=0,a){this.moveControlPointAttributes=a,this.shadowControlPointAttributes=l;for(var h=this.getLocations(t),u=0,c=h.length;u0)for(var d=h-1;d>-1;d--){if(n[d].userProperties.purpose===r.ROTATION){c=n[d];var p=this.getCenterFromLocations(i,a),f=1.2*this.getAverageDistance(i,p,a);e.greatCircleLocation(p,this.currentHeading,f,c.position),c.userProperties.rotation=this.currentHeading,this.updateRotationAccessory(p,c.position,s)}n[d].userProperties.purpose===r.LOCATION&&u.push(n[d]),n.pop()}u.reverse();for(var g=u.length,d=0;d=g&&this.createControlPoint(u,this.moveControlPointAttributes,r.LOCATION,d),u[d].position=a[d];u.length>l&&u.splice(l,u.length-l);for(var d=0;d0&&Array.isArray(c[0])){ +for(var p=-1,f=0,g=-1,m=0;mu&&(p=m,g=u-f),f+=y}if(p!==-1){var E=c[p];E.length>3?E.splice(g,1):d>2&&c.splice(p,1)}}else c.length>3&&c.splice(u,1)}else this.moveLocation(e,i,s,o,l[u]);t.resetBoundaries(),t._stateId=n.stateId++,t.stateKeyInvalid=!0}},s.prototype.addNewVertex=function(t,e,r){var s=new o(0,0,0),a=new o(0,0,0),l=new o(0,0,0),h=t.boundaries,u=e.computePointFromPosition(r.latitude,r.longitude,0,new o(0,0,0)),c=new o(0,0,0),d=-1,p=Number.MAX_VALUE;if(Array.isArray(t.boundaries[0])){for(var f=-1,g=0,m=h.length;g0&&Array.isArray(t.boundaries[0]))for(var i=0,r=t.boundaries.length;i-1;d--){if(n[d].userProperties.purpose===r.ROTATION){c=n[d];var p=this.getCenterFromLocations(i,a),f=1.2*this.getAverageDistance(i,p,a);e.greatCircleLocation(p,this.currentHeading,f,c.position),c.userProperties.rotation=this.currentHeading,this.updateRotationAccessory(p,c.position,s)}n[d].userProperties.purpose===r.LOCATION&&u.push(n[d]),n.pop()}u.reverse();for(var g=u.length,d=0;d=g&&this.createControlPoint(u,this.moveControlPointAttributes,r.LOCATION,d),u[d].position=a[d];u.length>l&&u.splice(l,u.length-l);for(var d=0;d2&&l.splice(u,1):this.moveLocation(e,i,s,o,l[u]),t.resetBoundaries(),t._stateId=n.stateId++,t.stateKeyInvalid=!0}},s.prototype.addNewVertex=function(t,e,r){for(var s=new o(0,0,0),a=new o(0,0,0),l=new o(0,0,0),h=t.boundaries,u=e.computePointFromPosition(r.latitude,r.longitude,0,new o(0,0,0)),c=new o(0,0,0),d=-1,p=Number.MAX_VALUE,f=1,g=h.length;f0)for(var l=0;l0&&(t.width=h)}else if(n.userProperties.purpose===i.HEIGHT){var u=t.height+2*a.dot(l);u>0&&(t.height=u)}else if(n.userProperties.purpose===i.ROTATION){var c=e.greatCircleAzimuth(t.center,s),d=e.greatCircleAzimuth(t.center,o)-c;t.heading=this.normalizedHeading(t.heading,d)}},n}),i("shapes/SurfaceSector",["../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r,n){"use strict";var o=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceSector","constructor","missingSector"));n.call(this,r),this._sector=e};return o.prototype=Object.create(n.prototype),Object.defineProperties(o.prototype,{sector:{get:function(){return this._sector},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._sector=t}}}),o.staticStateKey=function(t){var e=n.staticStateKey(t);return e},o.prototype.computeStateKey=function(){return o.staticStateKey(this)},o.prototype.computeBoundaries=function(t){var i=this._sector;this._boundaries=new Array(4),this._boundaries[0]=new e(i.minLatitude,i.minLongitude),this._boundaries[1]=new e(i.maxLatitude,i.minLongitude),this._boundaries[2]=new e(i.maxLatitude,i.maxLongitude),this._boundaries[3]=new e(i.minLatitude,i.maxLongitude)},o.prototype.getReferencePosition=function(){return new e(this.sector.centroidLatitude(),this.sector.centroidLongitude())},o.prototype.moveTo=function(t,i){var r=this._sector,n=new Array(3);n[0]=new e(r.minLatitude,r.minLongitude),n[1]=new e(r.maxLatitude,r.minLongitude),n[2]=new e(r.maxLatitude,r.maxLongitude),n=this.computeShiftedLocations(t,this.getReferencePosition(),i,n),this.sector=new WorldWind.Sector(n[0].latitude,n[1].latitude,n[1].longitude,n[2].longitude)},o}),i("util/editor/SurfaceSectorEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","../../geom/Position","../../geom/Sector","./ShapeEditorConstants","../../shapes/SurfaceSector"],function(t,e,i,r,n,o){"use strict";var s=function(){};return s.prototype=Object.create(t.prototype),s.prototype.canHandle=function(t){return t instanceof Function?"SurfaceSector"===t.name:t instanceof o},s.prototype.createShadowShape=function(t){return new o(new r(t._boundaries[0].latitude,t._boundaries[1].latitude,t._boundaries[0].longitude,t._boundaries[2].longitude),t.attributes)},s.prototype.getShapeCenter=function(t,e){return this.getCenterFromLocations(e,t._boundaries)},s.prototype.isRegularShape=function(){return!0},s.prototype.initializeControlElements=function(t,e,i,r,o){o&&(this.createControlPoint(e,o,n.MIN_CORNER),this.createControlPoint(e,o,n.MAX_CORNER))},s.prototype.updateControlElements=function(t,i,r){r.length>0&&(r[0].position=new e(t._sector.minLatitude,t._sector.minLongitude),r[1].position=new e(t._sector.maxLatitude,t._sector.maxLongitude))},s.prototype.reshape=function(t,e,i,o,s){i.userProperties.purpose===n.MIN_CORNER?t.sector=new r(o.latitude,t._sector.maxLatitude,o.longitude,t._sector.maxLongitude):i.userProperties.purpose===n.MAX_CORNER&&(t.sector=new r(t._sector.minLatitude,o.latitude,t._sector.minLongitude,o.longitude))},s}),i("util/editor/ShapeEditor",["../../shapes/Annotation","../../shapes/AnnotationAttributes","../../error/ArgumentError","../Color","../Font","../Insets","../../geom/Location","../Logger","../../shapes/Placemark","../../shapes/PlacemarkAttributes","./PlacemarkEditorFragment","../../geom/Position","../Promise","../../layer/RenderableLayer","../../shapes/ShapeAttributes","./ShapeEditorConstants","./SurfaceEllipseEditorFragment","./SurfaceCircleEditorFragment","../../shapes/SurfacePolygon","./SurfacePolygonEditorFragment","./SurfacePolylineEditorFragment","./SurfaceRectangleEditorFragment","./SurfaceSectorEditorFragment","../../geom/Vec2","../../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_,b,w,S,L){"use strict";var T=function(t){if(!t)throw new i(a.logMessage(a.LEVEL_SEVERE,"ShapeEditor","constructor","missingWorldWindow"));this._worldWindow=t,this._shape=null,this._allowMove=!0,this._allowReshape=!0,this._allowRotate=!0,this._allowManageControlPoint=!0,this._moveControlPointAttributes=new h(null),this._moveControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/blue-dot.png",this._moveControlPointAttributes.imageScale=.15,this._shadowControlPointAttributes=new h(null),this._shadowControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/gray-dot.png",this._shadowControlPointAttributes.imageScale=.15,this._resizeControlPointAttributes=new h(null),this._resizeControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/yellow-dot.png",this._resizeControlPointAttributes.imageScale=.15,this._rotateControlPointAttributes=new h(null),this._rotateControlPointAttributes.imageColor=WorldWind.Color.GREEN,this._rotateControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/green-dot.png",this._rotateControlPointAttributes.imageScale=.15,this._annotationAttributes=new e(null),this._annotationAttributes.altitudeMode=WorldWind.CLAMP_TO_GROUND,this._annotationAttributes.cornerRadius=5,this._annotationAttributes.backgroundColor=new r(.67,.67,.67,.8),this._annotationAttributes.leaderGapHeight=0,this._annotationAttributes.drawLeader=!1,this._annotationAttributes.scale=1,this._annotationAttributes.textAttributes.color=r.BLACK,this._annotationAttributes.textAttributes.font=new n(10),this._annotationAttributes.insets=new o(5,5,5,5),this.creatorEnabled=!1,this.creatorShapeProperties=null,this.newCreatedShapeLayer=new p("Shape Editor Shadow Shape"),this.annotation=new WorldWind.Annotation(new WorldWind.Position(0,0,0),this._annotationAttributes),this.editorFragments=[new u,new y,new m,new v,new _,new b,new w],this.controlPointsLayer=new p("Shape Editor Control Points"),this.shadowControlPointsLayer=new p("Shape Editor Shadow Control Points"),this.accessoriesLayer=new p("Shape Editor Accessories"),this.accessoriesLayer.pickEnabled=!1,this.annotationLayer=new p("Shape Editor Annotation"),this.annotationLayer.pickEnabled=!1,this.annotationLayer.enabled=!1,this.annotationLayer.addRenderable(this.annotation),this.shadowShapeLayer=new p("Shape Editor Shadow Shape"),this.shadowShapeLayer.pickEnabled=!1,this.activeEditorFragment=null,this.actionType=null,this.actionControlPoint=null,this.actionControlPosition=null,this.actionSecondaryBehavior=!1,this.actionCurrentX=null,this.actionCurrentY=null,this.originalHighlightAttributes=new f(null),this.originalPlacemarkHighlightAttributes=new h(null),this._clicked0X=null,this._clicked0Y=null,this._clicked1X=null,this._clicked1Y=null,this._click0Time=0,this._click1Time=0,this._dbclickTimeout=0,this._clickDelay=500,this._worldWindow.worldWindowController.addGestureListener(this)};return Object.defineProperties(T.prototype,{worldWindow:{get:function(){return this._worldWindow}},shape:{get:function(){return this._shape}},moveControlPointAttributes:{get:function(){return this._moveControlPointAttributes},set:function(t){this._moveControlPointAttributes=t}},shadowControlPointAttributes:{get:function(){return this._shadowControlPointAttributes},set:function(t){this._shadowControlPointAttributes=t}},resizeControlPointAttributes:{get:function(){return this._resizeControlPointAttributes},set:function(t){this._resizeControlPointAttributes=t}},rotateControlPointAttributes:{get:function(){return this._rotateControlPointAttributes},set:function(t){this._rotateControlPointAttributes=t}},annotationAttributes:{get:function(){return this._annotationAttributes},set:function(t){this._annotationAttributes=t,this.annotation.attributes=t}}}),T.prototype.enableCreator=function(t,e,i){this.stop(),this.setCreatorEnabled(!0);for(var r=0,n=this.editorFragments.length;r "+d.toString()+" ["+t+"]")}}},o}),i("formats/shapefile/DBaseFile",["../../error/ArgumentError","../../util/ByteBuffer","../../formats/shapefile/DBaseField","../../formats/shapefile/DBaseRecord","../../util/Logger"],function(t,e,i,r,n){"use strict"; +var o=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"DBaseFile","constructor","missingUrl"));this.url=e,this.header=null,this.fields=null,this.buffer=null,this.boolean=!0,this.numRecordsRead=0,this._completionCallback=null};return o.prototype.getLastModificationDate=function(){return this.header.lastModificationDate},o.prototype.getNumberOfRecords=function(){return this.header.numberOfRecords},o.prototype.getHeaderLength=function(){return this.header.headerLength},o.prototype.getRecordLength=function(){return this.header.recordLength},o.prototype.getNumberOfFields=function(){return(this.header.headerLength-1-o.FIXED_HEADER_LENGTH)/o.FIELD_DESCRIPTOR_LENGTH},o.prototype.getFields=function(){return this.fields},o.prototype.hasNext=function(){return this.numRecordsRead=this.getNumberOfRecords()?null:this.readNextRecord(this._buffer,++this.numRecordsRead)},o.prototype.load=function(t){this._completionCallback=t,this.requestUrl(this.url)},o.prototype.requestUrl=function(t){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){4===i.readyState&&(200===i.status?(this._buffer=new e(i.response),this.parse(),this._completionCallback&&this._completionCallback(this)):(n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed ("+i.statusText+"): "+t),this._completionCallback&&this._completionCallback(this)))}.bind(this),i.onerror=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed: "+t),this._completionCallback&&this._completionCallback(this)},i.ontimeout=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval timed out: "+t),this._completionCallback&&this._completionCallback(this)},i.send(null)},o.prototype.parse=function(){this.header=this.readHeader(this._buffer),this.fields=this.readFieldDescriptors(this._buffer,this.getNumberOfFields())},o.prototype.readHeader=function(t){var i=t.position;t.order(e.LITTLE_ENDIAN);var r=t.getByte();if(r>5)throw new Error("???");var n=t.getByte(),s=t.getByte(),a=t.getByte(),l=t.getInt32(),h=t.getInt16(),u=t.getInt16(),c={year:1900+n,month:s-1,day:a},d={fileCode:r,lastModificationDate:c,numberOfRecords:l,headerLength:h,recordLength:u};return t.seek(i+o.FIXED_HEADER_LENGTH),d},o.prototype.readFieldDescriptors=function(t,e){for(var r=t.position,n=[],s=0;s=0&&t0&&this._numberOfPoints>0)for(var e=this._buffer.getInt32Array(this.numberOfParts),i=0;i=8*this.numberOfPoints)if(t){this._mValues=this._buffer.getDoubleArray(1);var e=this._mValues[0];this._mRange=[e,e]}else this._mRange=this._buffer.getDoubleArray(2),this._mValues=this._buffer.getDoubleArray(this.numberOfPoints)},s.normalizeLocations=function(e){for(var i=0,r=e.length;i90&&(n=t.normalizedDegreesLatitude(i[1]),i[1]=90,r=!0,i[0]>n&&(i[0]=n)),(i[2]<-180||i[3]>180)&&(i[2]=-180,i[3]=180,r=!0),{coords:i,isNormalized:r}},L.prototype.readProjectedBoundingRectangle=function(t){throw new a(s.log(s.LEVEL_SEVERE,"Shapefile.readProjectedBoundingRectangle() not yet implemented"))},L.prototype.readBoundingRectangleCoordinates=function(t){var e=t.getDouble(),i=t.getDouble(),r=t.getDouble(),n=t.getDouble();return[i,n,e,r]},L.prototype.readRecord=function(t){var e=this.createRecord(t);if(null!=e&&null!=this.attributeFile&&this.attributeFile.hasNext()){var i=this.attributeFile.nextRecord();e.setAttributes(i)}return e},L.prototype.createRecord=function(t){return this.isNullType()?this.createNull(t):this.isPointType()?this.createPoint(t):this.isMultiPointType()?this.createMultiPoint(t):this.isPolygonType()?this.createPolygon(t):this.isPolylineType()?this.createPolyline(t):null},L.prototype.createNull=function(t){return new E(this,t)},L.prototype.createPoint=function(t){return new v(this,t)},L.prototype.createMultiPoint=function(t){return new y(this,t)},L.prototype.createPolyline=function(t){return new b(this,t)},L.prototype.createPolygon=function(t){return new _(this,t)},L.prototype.getShapeType=function(t){switch(t){case 0:return L.NULL;case 1:return L.POINT;case 3:return L.POLYLINE;case 5:return L.POLYGON;case 8:return L.MULTI_POINT;case 11:return L.POINT_Z;case 13:return L.POLYLINE_Z;case 15:return L.POLYGON_Z;case 18:return L.MULTI_POINT_Z;case 21:return L.POINT_M;case 23:return L.POLYLINE_M;case 25:return L.POLYGON_M;case 28:return L.MULTI_POINT_M;default:return null}},L.prototype.isMeasureType=function(){return L.measureTypes.hasOwnProperty(this._shapeType)},L.prototype.isZType=function(){return L.zTypes.hasOwnProperty(this._shapeType)},L.prototype.isNullType=function(){return this._shapeType===L.NULL},L.prototype.isPointType=function(){return L.pointTypes.hasOwnProperty(this._shapeType)},L.prototype.isMultiPointType=function(){return L.multiPointTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolylineType=function(){return L.polylineTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolygonType=function(){return L.polygonTypes.hasOwnProperty(this._shapeType)},L.NULL="null",L.POINT="point",L.MULTI_POINT="multiPoint",L.POLYLINE="polyline",L.POLYGON="polygon",L.POINT_M=L.POINT+"M",L.MULTI_POINT_M=L.MULTI_POINT+"M",L.POLYLINE_M=L.POLYLINE+"M",L.POLYGON_M=L.POLYGON+"M",L.POINT_Z=L.POINT+"Z",L.MULTI_POINT_Z=L.MULTI_POINT+"Z",L.POLYLINE_Z=L.POLYLINE+"Z",L.POLYGON_Z=L.POLYGON+"Z",L.SHAPE_MULTI_PATCH="multiPatch",L.measureTypes={pointM:L.POINT_M,pointZ:L.POINT_Z,multiPointM:L.MULTI_POINT_M,multiPointZ:L.MULTI_POINT_Z,polylineM:L.POLYLINE_M,polylineZ:L.POLYLINE_Z,polygonM:L.POLYGON_M,polygonZ:L.POLYGON_Z},L.zTypes={pointZ:L.POINT_Z,multiPointZ:L.MULTI_POINT_Z,polylineZ:L.POLYLINE_Z,polygonZ:L.POLYGON_Z},L.pointTypes={point:L.POINT,pointZ:L.POINT_Z,pointM:L.POINT_M},L.multiPointTypes={multiPoint:L.MULTI_POINT,multiPointZ:L.MULTI_POINT_Z,multiPointM:L.MULTI_POINT_M},L.polylineTypes={polyline:L.POLYLINE,polylineZ:L.POLYLINE_Z,polylineM:L.POLYLINE_M},L.polygonTypes={polygon:L.POLYGON,polygonZ:L.POLYGON_Z,polygonM:L.POLYGON_M},L.FILE_CODE=9994,L}),i("layer/ShowTessellationLayer",["../shaders/BasicProgram","../layer/Layer"],function(t,e){"use strict";var i=function(){e.call(this,"Show Tessellation"),this.enableTerrainGeometry=!0,this.enableTerrainExtent=!1};return i.prototype=Object.create(e.prototype),i.prototype.doRender=function(t){try{this.beginRendering(t),this.enableTerrainGeometry&&this.drawTerrainGeometry(t),this.enableTerrainExtent&&this.drawTerrainExtent(t)}finally{this.endRendering(t)}},i.prototype.beginRendering=function(t){var e=t.currentGlContext;e.depthMask(!1)},i.prototype.endRendering=function(t){var e=t.currentGlContext;e.depthMask(!0)},i.prototype.drawTerrainGeometry=function(e){if(e.terrain&&e.terrain.tessellator){var i,r,n=e.currentGlContext,o=e.terrain,s=o.tessellator,a=o.surfaceGeometry;try{i=e.findAndBindProgram(t),s.beginRendering(e);for(var l=0,h=a.length;lthis._MAX_GL_POINT_SIZE&&e.log(e.LEVEL_WARNING,"StarFieldLayer - sunSize is to big, max size allowed is: "+this._MAX_GL_POINT_SIZE);var s=n.getAsCelestialLocation(this.time||new Date);this._sunBufferView[0]=s.declination,this._sunBufferView[1]=s.rightAscension,this._sunBufferView[2]=Math.min(this.sunSize,this._MAX_GL_POINT_SIZE), +this._sunBufferView[3]=1,this._sunPositionsCacheKey||(this._sunPositionsCacheKey=o.generateCacheKey());var a=o.resourceForKey(this._sunPositionsCacheKey);a?(i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferSubData(i.ARRAY_BUFFER,0,this._sunBufferView)):(a=i.createBuffer(),o.putResource(this._sunPositionsCacheKey,a,4*this._sunBufferView.length),i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferData(i.ARRAY_BUFFER,this._sunBufferView,i.DYNAMIC_DRAW)),t.frameStatistics.incrementVboLoadCount(1),i.vertexAttribPointer(0,4,i.FLOAT,!1,0,0),r.loadTextureEnabled(i,!0);var l=t.gpuResourceCache.resourceForKey(this._sunImageSource);l.bind(t),i.drawArrays(i.POINTS,0,1)},o.prototype.endRendering=function(t){var e=t.currentGlContext;e.depthMask(!0),e.disableVertexAttribArray(0)},o.prototype.fetchStarData=function(){if(!this._loadStarted){this._loadStarted=!0;var t=this,i=new XMLHttpRequest;i.onload=function(){if(this.status>=200&&this.status<300)try{t._starData=JSON.parse(this.response),t.sendRedrawRequest()}catch(t){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to parse JSON for star data "+t.toString())}else e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data. Status: "+this.status+" "+this.statusText);t._loadStarted=!1},i.onerror=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data"),t._loadStarted=!1},i.ontimeout=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer fetch star data has timeout"),t._loadStarted=!1},i.open("GET",this._starDataSource,!0),i.send()}},o.prototype.createStarsGeometry=function(){var t=this.parseStarsMetadata(this._starData.metadata);if(t.raIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing ra field in star data."));if(t.decIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing dec field in star data."));if(t.magIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing vmag field in star data."));var i=this._starData.data,r=[];this._minMagnitude=Number.MAX_VALUE,this._maxMagnitude=Number.MIN_VALUE;for(var n=0,o=i.length;n65536)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too many positions. Must be fewer than 65537. Use TriangleMesh.split to split the shape."));if(!r)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Indices array is null or undefined"));if(r.length<3)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too few indices."));t.call(this,n),this._positions=i,this._indices=r,this.referencePosition=this._positions[0]};return g.prototype=Object.create(t.prototype),Object.defineProperties(g.prototype,{positions:{get:function(){return this._positions},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","positions","missingPositions"));this._positions=t,this.referencePosition=this._positions[0],this.reset()}},indices:{get:function(){return this._indices},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","indices","Indices array is null or undefined"));this._indices=t,this.meshIndices=null,this.reset()}},outlineIndices:{get:function(){return this._outlineIndices},set:function(t){this._outlineIndices=t,this.meshOutlineIndices=null,this.reset()}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(t){if(t&&t.length!=this._positions.length)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","textureCoordinates","Number of texture coordinates is inconsistent with the currently specified positions."));this._textureCoordinates=t,this.reset(),this.texCoords=null}}}),g.prototype.createSurfaceShape=function(){if(this._outlineIndices){for(var t=[],e=0;e65533&&l.length%3===0){if(s.length>0){var d={positions:s,indices:l};if(i&&(d.textureCoords=a),r){for(var p=[],f=0;f=n.screenOffset.x&&s<=n.screenOffset.x+n.size&&a>=n.screenOffset.y&&a<=n.screenOffset.y+n.size)return n;return null},l.prototype.determineOperation=function(t,e){var i=null;return e&&e instanceof s&&(e===this.panControl?i=this.handlePan:e===this.zoomInControl||e===this.zoomOutControl?i=this.handleZoom:e===this.headingLeftControl||e===this.headingRightControl?i=this.handleHeading:e===this.tiltUpControl||e===this.tiltDownControl?i=this.handleTilt:e===this.exaggerationUpControl||e===this.exaggerationDownControl?i=this.handleExaggeration:e!==this.fovNarrowControl&&e!==this.fovWideControl||(i=this.handleFov)),i},l.prototype.isCurrentTouch=function(t){for(var e=0;e=0?(r=a[0],n=a[1]):(r=a[1],n=a[0]),i+="&VERSION="+this.service.capabilities.version,i+="&COVERAGEID="+this.coverageId,i+="&FORMAT="+e,i+="&SCALESIZE="+s[0]+"("+t.tileWidth+"),",i+=s[1]+"("+t.tileHeight+")",i+="&OVERVIEWPOLICY=NEAREST",i+="&SUBSET="+r+"("+l.minLatitude+","+l.maxLatitude+")",i+="&SUBSET="+n+"("+l.minLongitude+","+l.maxLongitude+")", +encodeURI(i)},i.prototype.fixGetCoverageString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","fixGetMapString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/),r<0&&(i+="&")),i},i}),i("ogc/wcs/WcsCoverage",["../../error/ArgumentError","../../util/Logger","../../ogc/wcs/WcsUrlBuilder"],function(t,e,i){"use strict";var r=function(i,r){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsCoverage","constructor","missingId"));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsCoverage","constructor","missingWebCoverageService"));this.coverageId=i,this.service=r,this.sector=this.service.coverageDescriptions.getSector(this.coverageId),this.resolution=this.service.coverageDescriptions.getResolution(this.coverageId),this.elevationConfig=this.createElevationConfig()};return r.PREFERRED_FORMATS={GeoTIFF:!0,"image/tiff":!0,TIFF:!0},r.DEFAULT_FORMAT="image/tiff",r.prototype.createElevationConfig=function(){return{resolution:this.resolution,coverageSector:this.sector,retrievalImageFormat:this.determineFormatFromService(),urlBuilder:new i(this.coverageId,this.service)}},r.prototype.determineFormatFromService=function(){var t,e,i,n=this.service.capabilities.version;if("1.0.0"===n){for(e=0,i=this.service.coverageDescriptions.coverages.length;e0?n:"1.0.0",this.crs="EPSG:4326"};return i.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","The coverage format is null or undefined."));var o=r.sector,s=i.fixGetCoverageString(this.serviceAddress);return s.search(/service=wcs/i)<0&&(s+="service=WCS"),s+="&request=GetCoverage",s=s+"&version="+this.wcsVersion,s=s+"&coverage="+this.coverageName,s=s+"&format="+n,s=s+"&width="+r.tileWidth,s=s+"&height="+r.tileHeight,s=s+"&crs="+this.crs,s+="&bbox=",s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude,s=s.replace(" ","%20")},i.fixGetCoverageString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsTileUrlBuilder","fixGetCoverageString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/),r<0&&(i+="&")),i},i}),i("globe/WcsEarthElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WcsTileUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:e.FULL_SPHERE,resolution:.008333333333333,retrievalImageFormat:"image/tiff",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/wms2","NASA_SRTM30_900m_Tiled","1.0.0")}),this.displayName="WCS Earth Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("ogc/wcs/WebCoverageService",["../../error/ArgumentError","../../util/Logger","../../util/Promise","../../ogc/wcs/WcsCapabilities","../../ogc/wcs/WcsCoverage","../../ogc/wcs/WcsCoverageDescriptions"],function(t,e,i,r,n,o){"use strict";var s=function(){this.serviceAddress=null,this.coverages=[],this.capabilities=null,this.coverageDescriptions=null};return s.WCS_XLMNS="http://www.opengis.net/wcs",s.WCS_2_XLMNS="http://www.opengis.net/wcs/2.0",s.create=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WebCoverageService","constructor","missingUrl"));var r=new s;return r.serviceAddress=i,r.retrieveCapabilities().then(function(t){return r.capabilities=t,r.retrieveCoverageDescriptions(t)}).then(function(t){return r.parseCoverages(t),r})},s.prototype.getCoverage=function(t){},s.prototype.retrieveCapabilities=function(){var t,e=this;return e.retrieveXml(e.buildCapabilitiesXmlRequest("2.0.1")).then(function(i){return t=i.documentElement.getAttribute("version"),"2.0.1"===t||"2.0.0"===t?i:e.retrieveXml(e.buildCapabilitiesXmlRequest("1.0.0"))}).then(function(t){return new r(t)})},s.prototype.retrieveCoverageDescriptions=function(){return this.retrieveXml(this.buildDescribeCoverageXmlRequest())},s.prototype.parseCoverages=function(t){this.coverageDescriptions=new o(t);for(var e,i,r=this.coverageDescriptions.coverages.length,s=0;s0&&""!=o[0]&&this.setOptions(o,r);var s=i[e]&&new i[e];s||(s=new n),o&&o.length>0&&""!=o[0]&&s.setOptions(o[0],s),this.add(s)}},n.prototype.rightParenthesis=function(t){t.rightParenthesis++,t.coordinates&&(this.addCoordinates(t.coordinates),t.coordinates=null)},n.prototype.leftParenthesis=function(t){t.leftParenthesis++},n.prototype.comma=function(t){t.coordinates?(this.addCoordinates(t.coordinates),t.coordinates=null):this.commaWithoutCoordinates(t)},n.prototype.commaWithoutCoordinates=function(t){},n.prototype.number=function(t,e){t.coordinates=t.coordinates||[],t.coordinates.push(e)},n.prototype.setOptions=function(t,e){"Z"==t?e.set3d():"M"==t?e.setLrs():"MZ"==t&&(e.set3d(),e.setLrs())},n.prototype.isFinished=function(){return this.options.leftParenthesis===this.options.rightParenthesis&&this.options.leftParenthesis>0},n}),i("formats/wkt/WktTokens",["./WktElements","./geom/WktObject","./WktType"],function(t,e,i){var r=function(t){this.sourceText=t};return r.prototype.objects=function(){var i,r=[];return this.tokenize(this.sourceText).forEach(function(n){if(i&&i.isFinished()||!i){var o=n.value,s=o.match("[M]?[Z]?$");s&&s.length>0&&""!=s[0]&&(o=o.substring(0,o.length-s.length)),i=t[o]&&new t[o],i||(i=new e),s&&s.length>0&&""!=s[0]&&i.setOptions(s[0],i),r.push(i)}else i.handleToken(n)}),r},r.prototype.tokenize=function(t){this.currentPosition=0;for(var e=[];this.currentPosition="a"&&t<="z"||t>="A"&&t<="Z"},r.prototype.isNumeric=function(t){return t>="0"&&t<="9"||"."==t||"-"==t},r.prototype.isWhiteSpace=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},r.prototype.readText=function(t){for(var e="";this.isAlpha(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,e},r.prototype.readNumeric=function(t){for(var e="";this.isNumeric(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,Number(e)},r}),i("formats/wkt/Wkt",["../../error/ArgumentError","../../util/Logger","./WktTokens"],function(t,e,i){var r=function(t){this.textRepresentation=t,this._parserCompletionCallback=this.defaultParserCompletionCallback,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this._layer=null};return Object.defineProperties(r.prototype,{parserCompletionCallback:{ +get:function(){return this._parserCompletionCallback}},shapeConfigurationCallback:{get:function(){return this._shapeConfigurationCallback}},layer:{get:function(){return this._layer}}}),r.prototype.load=function(t,e,r){r&&(this._layer=r),t&&(this._parserCompletionCallback=t),e&&(this._shapeConfigurationCallback=e),this.parserCompletionCallback(this,new i(this.textRepresentation).objects())},r.prototype.defaultShapeConfigurationCallback=function(t){},r.prototype.defaultParserCompletionCallback=function(t,e){var i=t.shapeConfigurationCallback,r=[];e.forEach(function(t){t.shapes().forEach(function(e){var n=i(t);n&&n.attributes&&(e.attributes=n.attributes),n&&n.highlightAttributes&&(e.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(e.pickDelegate=n.pickDelegate),n&&n.userProperties&&(e.userProperties=n.userProperties),r.push(e)})}),t.layer&&t.layer.addRenderables(r)},r}),i("formats/wkt/WktExporter",["../../error/ArgumentError","../../util/Logger","./WktType"],function(t,e,i){"use strict";var r={exportRenderable:function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WktExporter","exportRenderable","missingRenderable"));return i instanceof WorldWind.Placemark?this.exportPlacemark(i):i instanceof WorldWind.Path?this.exportPath(i):i instanceof WorldWind.Polygon?this.exportPolygon(i):i instanceof WorldWind.SurfacePolyline?this.exportSurfacePolyline(i):i instanceof WorldWind.SurfacePolygon?this.exportSurfacePolygon(i):i instanceof WorldWind.SurfaceEllipse?this.exportSurfaceEllipse(i):i instanceof WorldWind.SurfaceCircle?this.exportSurfaceCircle(i):i instanceof WorldWind.SurfaceRectangle?this.exportSurfaceRectangle(i):i instanceof WorldWind.SurfaceSector?this.exportSurfaceSector(i):(e.log(e.LEVEL_WARNING,"Export renderable not implemented: "+i),null)},exportRenderables:function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WktExporter","exportRenderables","missingRenderables"));if(0!=r.length){if(r.length>1){for(var n=i.SupportedGeometries.GEOMETRY_COLLECTION+"(",o=0;o0&&r.boundaries[0].length>2){for(var o=0;o0&&r.boundaries[0].length>2){for(var o=0;o=0?i.format="image/png":s.indexOf("image/jpeg")>=0?i.format="image/jpeg":s.indexOf("image/tiff")>=0?i.format="image/tiff":s.indexOf("image/gif")>=0&&(i.format="image/gif"),i.service=o.getUrl;var l=t.crses;l||(l=t.srses),l&&(l.indexOf("EPSG:4326")>=0||l.indexOf("epsg:4326")>=0?i.coordinateSystem="EPSG:4326":(l.indexOf("CRS84")>=0||l.indexOf("CRS:84")>=0)&&(i.coordinateSystem="CRS:84"));var h=a.parseTimeDimensions(t);return h&&h.length>0&&(i.timeSequences=h),i},a.parseTimeDimensions=function(t){var e=t.extents||t.dimensions,i=null;if(e){i=[];for(var n=0;n0){var y=L.perspectiveNearDistance(c.width,c.height,g);f>y&&(f=y)}f<1&&(f=1),e.setToPerspectiveProjection(c.width,c.height,f,p)}},T.prototype.computePixelMetrics=function(t){var e=f.fromIdentity();e.invertMatrix(t);var i=new S(-1,-1,-1),r=new S(1,1,-1),n=new S(-1,-1,1),o=new S(1,1,1);i.multiplyByMatrix(e),r.multiplyByMatrix(e),n.multiplyByMatrix(e),o.multiplyByMatrix(e);var s=L.fabs(r[0]-i[0]),a=L.fabs(o[0]-n[0]),l=-i[2],h=-n[2],u=(a-s)/(h-l),c=s-u*l;return{pixelSizeFactor:u/this.viewport.width,pixelSizeOffset:c/this.viewport.height}},T.prototype.pixelSizeAtDistance=function(t){this.computeViewingTransform(this.scratchProjection,this.scratchModelview);var e=this.computePixelMetrics(this.scratchProjection);return e.pixelSizeFactor*t+e.pixelSizeOffset},T.prototype.computeDrawContext=function(){var t=this.drawContext;this.computeViewingTransform(t.projection,t.modelview),t.viewport=this.viewport,t.eyePoint=t.modelview.extractEyePoint(new S(0,0,0)),t.modelviewProjection.setToIdentity(),t.modelviewProjection.setToMultiply(t.projection,t.modelview);var e=this.computePixelMetrics(t.projection);t.pixelSizeFactor=e.pixelSizeFactor,t.pixelSizeOffset=e.pixelSizeOffset;var i=f.fromIdentity();i.invertOrthonormalMatrix(t.modelview),t.modelviewNormalTransform=f.fromIdentity().setToTransposeOfMatrix(i.upper3By3());var r=f.fromIdentity();r.setToTransposeOfMatrix(t.modelview),t.frustumInModelCoordinates=o.fromProjectionMatrix(t.projection),t.frustumInModelCoordinates.transformByMatrix(r),t.frustumInModelCoordinates.normalize()},T.prototype.resetDrawContext=function(){this.globe.offset=0;var t=this.drawContext;t.reset(),t.globe=this.globe,t.navigator=this.navigator,t.layers=this.layers.slice(),t.layers.push(t.screenCreditController),this.computeDrawContext(),t.verticalExaggeration=this.verticalExaggeration,t.surfaceOpacity=this.surfaceOpacity,t.deepPicking=this.deepPicking,t.frameStatistics=this.frameStatistics,t.pixelScale=this.pixelScale,t.update()},T.prototype.drawFrame=function(){try{this.drawContext.frameStatistics.beginFrame(),this.beginFrame(),this.drawContext.globe.is2D()&&this.drawContext.globe.continuous?this.do2DContiguousRepaint():this.doNormalRepaint()}finally{this.endFrame(),this.drawContext.frameStatistics.endFrame()}},T.prototype.doNormalRepaint=function(){this.createTerrain(),this.clearFrame(),this.deferOrderedRendering=!1,this.drawContext.pickingMode?this.drawContext.makePickFrustum()&&(this.doPick(),this.resolvePick()):(this.doDraw(),this.subsurfaceMode&&this.hasStencilBuffer&&(this.redrawSurface(),this.drawScreenRenderables()))},T.prototype.do2DContiguousRepaint=function(){this.createTerrain2DContiguous(),this.clearFrame(),this.drawContext.pickingMode?this.drawContext.makePickFrustum()&&(this.pick2DContiguous(),this.resolvePick()):this.draw2DContiguous()},T.prototype.resolvePick=function(){this.drawContext.pickTerrainOnly?this.resolveTerrainPick():this.drawContext.regionPicking?this.resolveRegionPick():this.resolveTopPick()},T.prototype.beginFrame=function(){var t=this.drawContext.currentGlContext;t.enable(t.BLEND),t.enable(t.CULL_FACE),t.enable(t.DEPTH_TEST),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.depthFunc(t.LEQUAL),this.drawContext.pickingMode&&(this.drawContext.makePickFramebuffer(),this.drawContext.bindFramebuffer(this.drawContext.pickFramebuffer))},T.prototype.endFrame=function(){var t=this.drawContext.currentGlContext;t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.blendFunc(t.ONE,t.ZERO),t.depthFunc(t.LESS),t.clearColor(0,0,0,1),this.drawContext.bindFramebuffer(null),this.drawContext.bindProgram(null)},T.prototype.clearFrame=function(){var t=this.drawContext,e=t.currentGlContext;e.clearColor(t.clearColor.red,t.clearColor.green,t.clearColor.blue,t.clearColor.alpha),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)},T.prototype.doDraw=function(){this.drawContext.renderShapes=!0,this.subsurfaceMode&&this.hasStencilBuffer?(this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawContext.currentGlContext.clear(this.drawContext.currentGlContext.DEPTH_BUFFER_BIT|this.drawContext.currentGlContext.STENCIL_BUFFER_BIT),this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.ALWAYS,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE),this.drawOrderedRenderables())):(this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawOrderedRenderables(),this.drawScreenRenderables()))},T.prototype.redrawSurface=function(){this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.EQUAL,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.KEEP,this.drawContext.currentGlContext.KEEP,this.drawContext.currentGlContext.KEEP),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!1),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST)},T.prototype.doPick=function(){this.drawContext.terrain&&this.drawContext.terrain.pick(this.drawContext),this.drawContext.pickTerrainOnly||(this.subsurfaceMode&&this.hasStencilBuffer?(this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawContext.currentGlContext.clear(this.drawContext.currentGlContext.DEPTH_BUFFER_BIT|this.drawContext.currentGlContext.STENCIL_BUFFER_BIT),this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.ALWAYS,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE),this.drawOrderedRenderables(),this.drawContext.terrain.pick(this.drawContext),this.drawScreenRenderables())):(this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawOrderedRenderables(),this.drawScreenRenderables())))},T.prototype.createTerrain=function(){var t=this.drawContext;t.terrain=this.globe.tessellator.tessellate(t),t.frameStatistics.setTerrainTileCount(t.terrain?t.terrain.surfaceGeometry.length:0)},T.prototype.makeCurrent=function(t){ +var e=this.drawContext;switch(e.globe.offset=t,e.globeStateKey=e.globe.stateKey,t){case-1:e.terrain=this.terrainLeft;break;case 0:e.terrain=this.terrainCenter;break;case 1:e.terrain=this.terrainRight}},T.prototype.createTerrain2DContiguous=function(){var t=this.drawContext;this.terrainCenter=null,t.globe.offset=0,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainCenter=t.globe.tessellator.tessellate(t)),this.terrainRight=null,t.globe.offset=1,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainRight=t.globe.tessellator.tessellate(t)),this.terrainLeft=null,t.globe.offset=-1,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainLeft=t.globe.tessellator.tessellate(t))},T.prototype.draw2DContiguous=function(){var t="";this.terrainCenter&&(t+=" 0 ",this.makeCurrent(0),this.deferOrderedRendering=this.terrainLeft||this.terrainRight,this.doDraw()),this.terrainRight&&(t+=" 1 ",this.makeCurrent(1),this.deferOrderedRendering=this.terrainLeft||this.terrainLeft,this.doDraw()),this.deferOrderedRendering=!1,this.terrainLeft&&(t+=" -1 ",this.makeCurrent(-1),this.doDraw()),this.subsurfaceMode&&this.hasStencilBuffer&&(this.deferOrderedRendering=!0,this.terrainCenter&&(t+=" 0 ",this.makeCurrent(0),this.redrawSurface()),this.terrainRight&&(t+=" 1 ",this.makeCurrent(1),this.redrawSurface()),this.terrainLeft&&(t+=" -1 ",this.makeCurrent(-1),this.redrawSurface())),this.drawScreenRenderables()},T.prototype.pick2DContiguous=function(){this.terrainCenter&&(this.makeCurrent(0),this.deferOrderedRendering=this.terrainLeft||this.terrainRight,this.doPick()),this.terrainRight&&(this.makeCurrent(1),this.deferOrderedRendering=this.terrainLeft||this.terrainLeft,this.doPick()),this.deferOrderedRendering=!1,this.terrainLeft&&(this.makeCurrent(-1),this.doPick())},T.prototype.drawLayers=function(t){var e,i=Date.now(),r=this.drawContext,n=r.layers;r.accumulateOrderedRenderables=t;for(var o=0,s=n.length;o=0&&this.layers.splice(e,1)},T.prototype.insertLayer=function(t,e){e&&this.layers.splice(t,0,e)},T.prototype.indexOfLayer=function(t){return this.layers.indexOf(t)},T.prototype.drawSurfaceRenderables=function(){var t,e=this.drawContext;for(e.reverseSurfaceRenderables();t=e.popSurfaceRenderable();)try{t.renderSurface(e)}catch(t){d.logMessage(d.LEVEL_WARNING,"WorldWindow","drawSurfaceRenderables","Error while rendering a surface renderable.\n"+t.message)}},T.prototype.drawOrderedRenderables=function(){var t,e=Date.now(),i=this.drawContext;if(i.sortOrderedRenderables(),this._orderedRenderingFilters)for(var r=0;r Date: Mon, 14 Jan 2019 07:34:49 -0800 Subject: [PATCH 111/112] Updated README --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aee593880..43453cebd 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ___Note: This is personal project and is not the official Web WorldWind library __WorldWindJS__ is a fork of the popular [Web WorldWind](https://github.com/NASAWorldWind/WebWorldWind) library from NASA (with contributions from ESA). This fork provides a release channel for builds based on the latest fixes -and features from WebWorldWind's develop branch plus several "cherry-picked" enhancements from the WorldWind community. +and features from WebWorldWind's [develop branch](https://github.com/NASAWorldWind/WebWorldWind/commits/develop) plus several "cherry-picked" enhancements from the WorldWind community. This fork exists to support the development of several personal projects, including: @@ -28,6 +28,7 @@ WorldWindJS is made available in the spirit of the NASA motto: _For the benefit - Improved the resolution of Bing imagery - Support for a translucent night-image - Removed dependency vulnerabilities +- Fixed WMTS tile geo-registration ### Migrating from NASA WebWorldWind @@ -39,6 +40,8 @@ WorldWindJS is made available in the spirit of the NASA motto: _For the benefit #### Changes from WebWorldWind release 0.9.0 - `NavigatorState` has been deprecated. Its properties have migrated to `DrawContext`. +- Added the `HeatMap` from the WorldWind `NASAWorldWind/feature/heatmap` branch. +- Added the `ShapeEditor` from the WorldWind `NASAWorldWind/enhancement/shape_editor_refactoring` branch. #### Changes from the WebWorldWind develop branch - WorldWindJS is a drop in replacement for WebWorldWind's __worldwind.js__ and __worldwind.min.js__ libraries built from the WebWorldWind develop branch. There are no changes to the API other than additions. @@ -94,6 +97,10 @@ Web WorldWind release provides many simple examples showing how to use all of We - `npm run test:watch` automatically runs WorldWind's unit tests when source code changes +- `npm version ` changes the version number in package.json + +- `npm publish` publishes the build to npm + ## License Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the From 27e131f563e7aea69630a5965aef8c24689d3ebe Mon Sep 17 00:00:00 2001 From: Bruce Schubert Date: Mon, 14 Jan 2019 07:37:28 -0800 Subject: [PATCH 112/112] Updated build. --- build/dist/README.md | 9 +++- build/dist/worldwind.js | 83 +++++++++++++++++-------------------- build/dist/worldwind.min.js | 14 +++---- 3 files changed, 54 insertions(+), 52 deletions(-) diff --git a/build/dist/README.md b/build/dist/README.md index aee593880..43453cebd 100644 --- a/build/dist/README.md +++ b/build/dist/README.md @@ -8,7 +8,7 @@ ___Note: This is personal project and is not the official Web WorldWind library __WorldWindJS__ is a fork of the popular [Web WorldWind](https://github.com/NASAWorldWind/WebWorldWind) library from NASA (with contributions from ESA). This fork provides a release channel for builds based on the latest fixes -and features from WebWorldWind's develop branch plus several "cherry-picked" enhancements from the WorldWind community. +and features from WebWorldWind's [develop branch](https://github.com/NASAWorldWind/WebWorldWind/commits/develop) plus several "cherry-picked" enhancements from the WorldWind community. This fork exists to support the development of several personal projects, including: @@ -28,6 +28,7 @@ WorldWindJS is made available in the spirit of the NASA motto: _For the benefit - Improved the resolution of Bing imagery - Support for a translucent night-image - Removed dependency vulnerabilities +- Fixed WMTS tile geo-registration ### Migrating from NASA WebWorldWind @@ -39,6 +40,8 @@ WorldWindJS is made available in the spirit of the NASA motto: _For the benefit #### Changes from WebWorldWind release 0.9.0 - `NavigatorState` has been deprecated. Its properties have migrated to `DrawContext`. +- Added the `HeatMap` from the WorldWind `NASAWorldWind/feature/heatmap` branch. +- Added the `ShapeEditor` from the WorldWind `NASAWorldWind/enhancement/shape_editor_refactoring` branch. #### Changes from the WebWorldWind develop branch - WorldWindJS is a drop in replacement for WebWorldWind's __worldwind.js__ and __worldwind.min.js__ libraries built from the WebWorldWind develop branch. There are no changes to the API other than additions. @@ -94,6 +97,10 @@ Web WorldWind release provides many simple examples showing how to use all of We - `npm run test:watch` automatically runs WorldWind's unit tests when source code changes +- `npm version ` changes the version number in package.json + +- `npm publish` publishes the build to npm + ## License Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the diff --git a/build/dist/worldwind.js b/build/dist/worldwind.js index 750353637..c5755ec10 100644 --- a/build/dist/worldwind.js +++ b/build/dist/worldwind.js @@ -75866,32 +75866,28 @@ define('util/editor/SurfacePolygonEditorFragment',[ var locationControlPoints = []; var rotationControlPoint = null; - if (lenControlPoints > 0) { - for (var i = lenControlPoints - 1; i > -1; i--) { - if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { - rotationControlPoint = controlPoints[i]; - - var polygonCenter = this.getCenterFromLocations(globe, locations); - var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); - - Location.greatCircleLocation( - polygonCenter, - this.currentHeading, - polygonRadius, - rotationControlPoint.position - ); + for (var i = lenControlPoints - 1; i > -1; i--) { + if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.ROTATION) { + rotationControlPoint = controlPoints[i]; - rotationControlPoint.userProperties.rotation = this.currentHeading; + var polygonCenter = this.getCenterFromLocations(globe, locations); + var polygonRadius = 1.2 * this.getAverageDistance(globe, polygonCenter, locations); - this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); - } + Location.greatCircleLocation( + polygonCenter, + this.currentHeading, + polygonRadius, + rotationControlPoint.position + ); - if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.LOCATION) { - locationControlPoints.push(controlPoints[i]); - } + rotationControlPoint.userProperties.rotation = this.currentHeading; - controlPoints.pop(); + this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); + } else { + locationControlPoints.push(controlPoints[i]); } + + controlPoints.pop(); } locationControlPoints.reverse(); @@ -75917,25 +75913,25 @@ define('util/editor/SurfacePolygonEditorFragment',[ controlPoints.push(locationControlPoints[i]); } - for (var i = 0; i < lenLocations - 1; i++) { + for (var i = 0; i < controlPoints.length - 1; i++) { this.createControlPoint( - controlPoints, + shadowControlPoints, this.shadowControlPointAttributes, ShapeEditorConstants.SHADOW, - lenLocations + i + i ); - this.computeShadowPointLocations(shape, controlPoints[lenLocations + i], locations[i], locations[i + 1]); + this.computeShadowPointLocations(shape, shadowControlPoints[i], locations[i], locations[i + 1]); if (i == lenLocations - 2) { this.createControlPoint( - controlPoints, + shadowControlPoints, this.shadowControlPointAttributes, ShapeEditorConstants.SHADOW, - lenLocations + i + 1 + i + 1 ); - this.computeShadowPointLocations(shape, controlPoints[lenLocations + i + 1], locations[i + 1], locations[0]); + this.computeShadowPointLocations(shape, shadowControlPoints[i + 1], locations[i + 1], locations[0]); } } @@ -76237,16 +76233,16 @@ define('util/editor/SurfacePolylineEditorFragment',[ this.createRotationAccessory(accessories, rotateControlPointAttributes); } - // if (shadowControlPointAttributes) { - // for (var i = 0, len = locations.length - 1; i < len; i++) { - // this.createControlPoint( - // shadowControlPoints, - // shadowControlPointAttributes, - // ShapeEditorConstants.SHADOW, - // i - // ); - // } - // } + if (shadowControlPointAttributes) { + for (var i = 0, len = locations.length - 1; i < len; i++) { + this.createControlPoint( + shadowControlPoints, + shadowControlPointAttributes, + ShapeEditorConstants.SHADOW, + i + ); + } + } }; // Internal use only. @@ -76279,11 +76275,10 @@ define('util/editor/SurfacePolylineEditorFragment',[ rotationControlPoint.userProperties.rotation = this.currentHeading; this.updateRotationAccessory(polygonCenter, rotationControlPoint.position, accessories); - } - - if (controlPoints[i].userProperties.purpose === ShapeEditorConstants.LOCATION) { + } else { locationControlPoints.push(controlPoints[i]); } + controlPoints.pop(); } @@ -76310,12 +76305,12 @@ define('util/editor/SurfacePolylineEditorFragment',[ controlPoints.push(locationControlPoints[i]); } - for (var i = 0; i < lenLocations - 1; i++) { + for (var i = 0; i < controlPoints.length - 1; i++) { this.createControlPoint( shadowControlPoints, this.shadowControlPointAttributes, ShapeEditorConstants.SHADOW, - lenLocations + i + i ); this.computeShadowPointLocations(shape, shadowControlPoints[i], locations[i], locations[i + 1]); @@ -76418,6 +76413,7 @@ define('util/editor/SurfacePolylineEditorFragment',[ return SurfacePolylineEditorFragment; } ); + /* * Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the * National Aeronautics and Space Administration. All rights reserved. @@ -77780,7 +77776,6 @@ define('util/editor/ShapeEditor',[ // The editor provides vertex insertion and removal for SurfacePolygon and SurfacePolyline. // Double click when the cursor is over a control point will remove it. // Single click when the cursor is over a shadow control point will add it. - console.dir(this.actionType) if (this.actionType) { if (this._click0Time && this._click1Time) { if (this._click1Time <= this._clickDelay) { diff --git a/build/dist/worldwind.min.js b/build/dist/worldwind.min.js index 0958f2a32..bc6eb6dfc 100644 --- a/build/dist/worldwind.min.js +++ b/build/dist/worldwind.min.js @@ -179,10 +179,10 @@ xt[2]=ht>>>16&255,xt[3]=ht>>>24&255,i.check=f(i.check,xt,4,0)),ht=0,ut=0,i.mode= get:function(){return this._factory.specific(this,{name:"minLodPixels",transformer:i.number})}},kmlMaxLodPixels:{get:function(){return this._factory.specific(this,{name:"maxLodPixels",transformer:i.number})}},kmlMinFadeExtent:{get:function(){return this._factory.specific(this,{name:"minFadeExtent",transformer:i.number})}},kmlMaxFadeExtent:{get:function(){return this._factory.specific(this,{name:"maxFadeExtent",transformer:i.number})}}}),r.prototype.getTagNames=function(){return["Lod"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlRegion",["../../geom/BoundingBox","../../util/Color","./KmlElements","./KmlLatLonAltBox","./KmlLod","./KmlObject","./styles/KmlStyle","./util/KmlNodeTransformers","../../geom/Sector"],function(t,e,i,r,n,o,s,a,l){"use strict";var h=function(t){o.call(this,t)};return h.prototype=Object.create(o.prototype),Object.defineProperties(h.prototype,{kmlLatLonAltBox:{get:function(){return this._factory.specific(this,{name:r.prototype.getTagNames(),transformer:a.kmlObject})}},kmlLod:{get:function(){return this._factory.specific(this,{name:n.prototype.getTagNames(),transformer:a.kmlObject})}}}),h.prototype.intersectsVisible=function(e){var i=this.kmlLatLonAltBox,r=new t;return r.setToSector(new l(i.kmlSouth,i.kmlNorth,i.kmlWest,i.kmlEast),e.globe,i.kmlMinAltitude,i.kmlMaxAltitude),r.intersectsFrustum(e.frustumInModelCoordinates)&&(!i.kmlMinAltitude||e.eyePosition.altitude>i.kmlMinAltitude)&&(!i.kmlMaxAltitude||e.eyePosition.altituder||e.to>r))return!1}return!0},h.prototype.getStyle=function(t,e){if(!this._pStyle){var i=this;return e.styleResolver.handleRemoteStyle(i.kmlStyleUrl,i.kmlStyleSelector).then(function(e){i._pStyle=e,t.redrawRequested=!0})}},h.prototype.getTagNames=function(){return["NetworkLink","Placemark","PhotoOverlay","ScreenOverlay","GroundOverlay","Folder","Document"]},h}),i("formats/kml/features/KmlContainer",["./KmlFeature"],function(t){"use strict";var e=function(e){t.call(this,e)};return e.prototype=Object.create(t.prototype),Object.defineProperties(e.prototype,{kmlShapes:{get:function(){var t=this._factory.all(this);return t.filter(function(t){return t.isFeature})}}}),e.prototype.render=function(e,i){t.prototype.render.call(this,e,i);var r=this;this.kmlShapes.forEach(function(t){t.render(e,{lastStyle:i.lastStyle,lastVisibility:r.enabled,currentTimeInterval:i.currentTimeInterval,regionInvisible:i.regionInvisible,fileCache:i.fileCache,styleResolver:i.styleResolver,listener:i.listener,activeEvents:i.activeEvents})})},e.prototype.getTagNames=function(){return["Folder","Document"]},e}),i("formats/kml/controls/KmlControls",["../../../util/Logger"],function(t){"use strict";var e=function(){};return e.prototype.hook=function(){t.logMessage(t.LEVEL_WARNING,"KmlControls","hook","Every KML controls should override hook method.")},e}),i("formats/kml/util/KmlCreate",["../KmlElements","../KmlObject"],function(t,e){var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),Object.defineProperties(i.prototype,{shapes:{get:function(){return this._factory.all(this)}}}),i.prototype.getTagNames=function(){return["Create"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/util/KmlDelete",["../KmlElements","../KmlObject"],function(t,e){var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),Object.defineProperties(i.prototype,{shapes:{get:function(){return this._factory.all(this)}}}),i.prototype.getTagNames=function(){return["Delete"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/util/KmlSchema",["./../KmlElements","../KmlObject"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["Schema"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/features/KmlDocument",["./KmlContainer","../KmlElements","./KmlFeature","../util/KmlSchema"],function(t,e,i,r){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),Object.defineProperties(n.prototype,{kmlSchemas:{get:function(){var t=this._factory.all(this);return t.filter(function(t){return t instanceof r})}}}),n.prototype.getTagNames=function(){return["Document"]},e.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/features/KmlFolder",["./KmlContainer","./../KmlElements"],function(t,e){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),i.prototype.getTagNames=function(){return["Folder"]},e.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/geom/KmlGeometry",["../KmlObject"],function(t){"use strict";var e=function(e){t.call(this,e),this._renderable=null};return e.prototype=Object.create(t.prototype),e.prototype.render=function(e,i){t.prototype.render.call(this,e,i),this.enabled=i.lastVisibility},e.prototype.getTagNames=e.getTagNames=function(){return["Point","LinearRing","LineString","MultiGeometry","Polygon"]},e}),i("formats/kml/KmlLatLonBox",["./KmlElements","./KmlObject","./util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlNorth:{get:function(){return this._factory.specific(this,{name:"north",transformer:i.number})}},kmlSouth:{get:function(){return this._factory.specific(this,{name:"south",transformer:i.number})}},kmlEast:{get:function(){return this._factory.specific(this,{name:"east",transformer:i.number})}},kmlWest:{get:function(){return this._factory.specific(this,{name:"west",transformer:i.number})}},kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["LatLonBox"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlLatLonQuad",["./KmlElements","./KmlObject","./util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlCoordinates:{get:function(){return this._factory.specific(this,{name:"coordinates",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["gx:LatLonQuad"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlOverlay",["./KmlFeature","./../KmlIcon","../util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(e){t.call(this,e)};return r.prototype=Object.create(t.prototype),Object.defineProperties(r.prototype,{kmlColor:{get:function(){return this._factory.specific(this,{name:"color",transformer:i.string})}},kmlDrawOrder:{get:function(){return this._factory.specific(this,{name:"drawOrder",transformer:i.string})}},kmlIcon:{get:function(){return this._factory.any(this,{name:e.prototype.getTagNames()})}}}),r.prototype.getTagNames=function(){return["PhotoOverlay","ScreenOverlay","GroundOverlay"]},r}),i("formats/kml/features/KmlGroundOverlay",["./../KmlElements","./KmlFeature","../KmlLatLonBox","../KmlLatLonQuad","./KmlOverlay","../util/KmlNodeTransformers","../../../geom/Sector","../../../shapes/SurfaceImage"],function(t,e,i,r,n,o,s,a){"use strict";var l=function(t){this.isGroundOverlay=!0,n.call(this,t)};return l.prototype=Object.create(n.prototype),Object.defineProperties(l.prototype,{kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:o.string})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:o.string})}},kmlLatLonBox:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}},kmlLatLonQuad:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}}}),l.prototype.render=function(t,i){e.prototype.render.call(this,t,i),!this._renderable&&this.enabled&&this.kmlIcon&&this.kmlLatLonBox&&(this._renderable=new a(new s(this.kmlLatLonBox.kmlSouth,this.kmlLatLonBox.kmlNorth,this.kmlLatLonBox.kmlWest,this.kmlLatLonBox.kmlEast),this.kmlIcon.kmlHref(i.fileCache)),t.redrawRequested=!0),this._renderable&&this._renderable.render(t)},l.prototype.getTagNames=function(){return["GroundOverlay"]},t.addKey(l.prototype.getTagNames()[0],l),l}),i("formats/kml/util/KmlImagePyramid",["../KmlElements","../KmlObject","../util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlTileSize:{get:function(){return this._factory.specific(this,{name:"tileSize",transformer:i.number})}},kmlMaxWidth:{get:function(){return this._factory.specific(this,{name:"maxWidth",transformer:i.number})}},kmlMaxHeight:{get:function(){return this._factory.specific(this,{name:"maxHeight",transformer:i.number})}},kmlGridOrigin:{get:function(){return this._factory.specific(this,{name:"gridOrigin",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["ImagePyramid"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("shapes/Path",["../shapes/AbstractShape","../error/ArgumentError","../shaders/BasicTextureProgram","../geom/BoundingBox","../util/Color","../geom/Location","../util/Logger","../geom/Matrix","../pick/PickedObject","../geom/Position","../shapes/ShapeAttributes","../shapes/SurfacePolyline","../geom/Vec2","../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p){"use strict";var f=function(i,r){if(!i)throw new e(s.logMessage(s.LEVEL_SEVERE,"Path","constructor","missingPositions"));t.call(this,r),this._positions=i,this._pathType=WorldWind.GREAT_CIRCLE,this._terrainConformance=10,this._numSubSegments=10,this.referencePosition=this.determineReferencePosition(this._positions),this.scratchPoint=new p(0,0,0)};return f.prototype=Object.create(t.prototype),Object.defineProperties(f.prototype,{positions:{get:function(){return this._positions},set:function(t){if(!t)throw new e(s.logMessage(s.LEVEL_SEVERE,"Path","constructor","missingPositions"));this._positions=t,this.referencePosition=this.determineReferencePosition(this._positions),this.reset()}},followTerrain:{get:function(){return this._followTerrain},set:function(t){this._followTerrain=t,this.reset()}},terrainConformance:{get:function(){return this._terrainConformance},set:function(t){this._terrainConformance=t,this.reset()}},numSubSegments:{get:function(){return this._numSubSegments},set:function(t){this._numSubSegments=t>=0?t:0,this.reset()}},pathType:{get:function(){return this._pathType},set:function(t){this._pathType=t,this.reset()}},extrude:{get:function(){return this._extrude},set:function(t){this._extrude=t,this.reset()}}}),f.prototype.determineReferencePosition=function(t){return t.length>0?t[0]:null},f.prototype.mustGenerateGeometry=function(t){return!this.currentData.tessellatedPoints||(this.currentData.drawInterior!==this.activeAttributes.drawInterior||this.currentData.drawVerticals!==this.activeAttributes.drawVerticals||(!this.followTerrain&&this.currentData.numSubSegments!==this.numSubSegments||(!(!this.followTerrain||this.currentData.terrainConformance===this.terrainConformance)||this.altitudeMode!==WorldWind.ABSOLUTE&&this.currentData.isExpired)))},f.prototype.createSurfaceShape=function(){return new c(this.positions,null)},f.prototype.doMakeOrderedRenderable=function(t){if(!this.referencePosition)return null;if(!this.mustGenerateGeometry(t))return this;var e=this.currentData.referencePoint;t.surfacePointForMode(this.referencePosition.latitude,this.referencePosition.longitude,this.referencePosition.altitude,this._altitudeMode,e),this.currentData.transformationMatrix.setToTranslation(e[0],e[1],e[2]);var i=this.makeTessellatedPositions(t);if(i.length<2)return null;var n=this.computeRenderedPath(t,i);return this.currentData.tessellatedPoints=n,this.currentData.drawInterior=this.activeAttributes.drawInterior,this.currentData.drawVerticals=this.activeAttributes.drawVerticals,this.currentData.numSubSegments=this.numSubSegments,this.currentData.terrainConformance=this.terrainConformance,this.resetExpiration(this.currentData),this.currentData.fillVbo=!0,this.currentData.extent||(this.currentData.extent=new r),this.currentData.extent.setToPoints(n),this.currentData.extent.translate(this.currentData.referencePoint),this},f.prototype.makeTessellatedPositions=function(t){var e,i,r,n=[],o=t.eyePoint,s=this.mustDrawVerticals(t),a=new p(0,0,0),l=new p(0,0,0),h=this._positions[0];s&&(this.currentData.verticalIndices=new Int16Array(2*this.positions.length),this.currentData.verticalIndices[0]=0,this.currentData.verticalIndices[1]=1),n.push(h),t.surfacePointForMode(h.latitude,h.longitude,h.altitude,this._altitudeMode,a);for(var u=1,c=this._positions.length;u=1||t.pickingMode),a.loadColor(s,t.pickingMode?r:i),a.loadOpacity(s,t.pickingMode?1:this.layer.opacity),s.vertexAttribPointer(a.vertexPointLocation,3,s.FLOAT,!1,0,0),s.drawArrays(s.TRIANGLE_STRIP,0,u)),this.activeAttributes.drawOutline&&((this.mustDrawVerticals(t)&&this.mustDrawInterior(t)||this.altitudeMode===WorldWind.CLAMP_TO_GROUND)&&this.applyMvpMatrixForOutline(t),i=this.activeAttributes.outlineColor,s.depthMask(i.alpha*this.layer.opacity>=1||t.pickingMode),a.loadColor(s,t.pickingMode?r:i),a.loadOpacity(s,t.pickingMode?1:this.layer.opacity),s.lineWidth(this.activeAttributes.outlineWidth),this.currentData.pointBufferHasExtrusionPoints?(n=24,o=u/2):(n=12,o=u),s.vertexAttribPointer(a.vertexPointLocation,3,s.FLOAT,!1,n,0),s.drawArrays(s.LINE_STRIP,0,o),this.mustDrawVerticals(t)&&(h.verticalIndicesVboCacheKey||(h.verticalIndicesVboCacheKey=t.gpuResourceCache.generateCacheKey()),e=t.gpuResourceCache.resourceForKey(h.verticalIndicesVboCacheKey),e||(e=s.createBuffer(),t.gpuResourceCache.putResource(h.verticalIndicesVboCacheKey,e,4*h.verticalIndices.length),h.fillVbo=!0),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e),h.fillVbo&&(s.bufferData(s.ELEMENT_ARRAY_BUFFER,h.verticalIndices,s.STATIC_DRAW),t.frameStatistics.incrementVboLoadCount(1)),s.vertexAttribPointer(a.vertexPointLocation,3,s.FLOAT,!1,0,0),s.drawElements(s.LINES,h.verticalIndices.length,s.UNSIGNED_SHORT,0))),h.fillVbo=!1,t.pickingMode){var c=new l(r,this.pickDelegate?this.pickDelegate:this,null,this.layer,!1);t.resolvePick(c)}},f.prototype.beginDrawing=function(t){var e=t.currentGlContext;this.mustDrawInterior(t)&&e.disable(e.CULL_FACE),t.findAndBindProgram(i),e.enableVertexAttribArray(t.currentProgram.vertexPointLocation)},f.prototype.endDrawing=function(t){var e=t.currentGlContext;e.disableVertexAttribArray(t.currentProgram.vertexPointLocation),e.depthMask(!0),e.lineWidth(1),e.enable(e.CULL_FACE)},f}),i("formats/kml/geom/KmlLineString",["../../../util/Color","../KmlElements","./KmlGeometry","../styles/KmlStyle","../../../geom/Location","../util/KmlNodeTransformers","../../../shapes/Path","../../../geom/Position","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolyline","../../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u){"use strict";var c=function(t){i.call(this,t),this._style=null};return c.prototype=Object.create(i.prototype),Object.defineProperties(c.prototype,{kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:o.boolean})||!1}},kmlTessellate:{get:function(){return this._factory.specific(this,{name:"tessellate",transformer:o.boolean})||!1}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:o.string})||WorldWind.ABSOLUTE}},kmlPositions:{get:function(){return this._factory.specific(this,{name:"coordinates",transformer:o.positions})}},kmlCenter:{get:function(){var t=this.kmlPositions,e=0,i=0,r=0;return t.forEach(function(t){e+=t.latitude,i+=t.longitude,r+=t.altitude}),new a(e/this.kmlPositions.length,i/this.kmlPositions.length,r/this.kmlPositions.length)}}}),c.prototype.createPath=function(t,e){this.kmlAltitudeMode==WorldWind.CLAMP_TO_GROUND?this._renderable=new h(this.prepareLocations(),this.prepareAttributes(t.normal,e)):this._renderable=new s(this.prepareLocations(),this.prepareAttributes(t.normal,e)),t.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(t.highlight,e)),this.moveValidProperties()},c.prototype.render=function(t,e){i.prototype.render.call(this,t,e),e.lastStyle&&!this._renderable&&(this.createPath(e.lastStyle,e.fileCache),t.redrawRequested=!0),this._renderable&&(this._renderable.enabled=this.enabled,this._renderable.render(t))},c.prototype.prepareAttributes=function(t,e){var i=t&&t.generate(e)||{};return i._applyLighting=!0,i._drawOutline=!0,i._drawInterior=!0,i._drawVerticals=this.kmlExtrude||!1,i._outlineStippleFactor=0,i._outlineStipplePattern=61680,i._enableLighting=!0,new l(r.shapeAttributes(i))},c.prototype.prepareLocations=function(){return this.kmlPositions},c.prototype.moveValidProperties=function(){this._renderable.extrude=this.kmlExtrude||!1,this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.ABSOLUTE,this._renderable.tesselate=this.kmlTesselate||!1},c.prototype.equals=function(t){if(!t)return!1;var e=u.arrayEquals(t.kmlPositions,this.kmlPositions);return e&&t.kmlExtrude==this.kmlExtrude&&t.kmlTessellate==this.kmlTessellate&&t.kmlAltitudeMode==this.kmlAltitudeMode},c.prototype.getTagNames=function(){return["LineString"]},e.addKey(c.prototype.getTagNames()[0],c),c}),i("formats/kml/geom/KmlLinearRing",["./KmlLineString","../KmlElements"],function(t,e){"use strict";var i=function(e){t.call(this,e)};return i.prototype=Object.create(t.prototype),i.prototype.getTagNames=function(){return["LinearRing"]},e.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/KmlLocation",["./KmlElements","./KmlObject","./util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlLongitude:{get:function(){return this._factory.specific(this,{name:"longitude",transformer:i.string})}},kmlLatitude:{get:function(){return this._factory.specific(this,{name:"latitude",transformer:i.string})}},kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["Location"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/KmlLookAt",["./KmlAbstractView","./KmlElements","./util/KmlNodeTransformers","../../geom/Position"],function(t,e,i,r){"use strict";var n=function(e){t.call(this,e)};return n.prototype=Object.create(t.prototype),Object.defineProperties(n.prototype,{kmlLongitude:{get:function(){return this._factory.specific(this,{name:"longitude",transformer:i.number})}},kmlLatitude:{get:function(){return this._factory.specific(this,{name:"latitude",transformer:i.number})}},kmlAltitude:{get:function(){return this._factory.specific(this,{name:"altitude",transformer:i.number})}},kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:i.number})}},kmlTilt:{get:function(){return this._factory.specific(this,{name:"tilt",transformer:i.number})}},kmlRange:{get:function(){return this._factory.specific(this,{name:"range",transformer:i.number})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:i.string})}}}),n.prototype.update=function(t){if(t.wwd){var e=this.kmlAltitude||4e3;t.wwd.goTo(new r(this.kmlLatitude,this.kmlLongitude,e))}},n.prototype.getTagNames=function(){return["LookAt"]},e.addKey(n.prototype.getTagNames()[0],n),n}),i("formats/kml/geom/KmlMultiGeometry",["./../KmlElements","./KmlGeometry","../../../geom/Position"],function(t,e,i){"use strict";var r=function(t){e.call(this,t),this._style=t.style};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlShapes:{get:function(){return this._factory.all(this)}},kmlCenter:{get:function(){var t=this.kmlShapes.map(function(t){return t.kmlCenter}),e=0,r=0,n=0;return t.forEach(function(t){e+=t.latitude,r+=t.longitude,n+=t.altitude}),new i(e/t.length,r/t.length,n/t.length)}}}),r.prototype.render=function(t,i){e.prototype.render.call(this,t,i),this.kmlShapes.forEach(function(e){e.render(t,i)})},r.prototype.getTagNames=function(){return["MultiGeometry"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/geom/KmlMultiTrack",["./../KmlElements","./KmlGeometry"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["gx:MultiTrack"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/features/KmlNetworkLink",["./../KmlElements","./KmlFeature","../KmlFile","../KmlLink","../util/KmlNodeTransformers","../util/KmlRefreshListener"],function(t,e,i,r,n,o){"use strict";var s="refreshNetworkLinkEvent",a=function(t){e.call(this,t),this.isFeature=!0,this.resolvedFile=null,this.displayed=!1,this.isDownloading=!1};return a.prototype=Object.create(e.prototype),Object.defineProperties(a.prototype,{kmlRefreshVisibility:{get:function(){return this._factory.specific(this,{name:"refreshVisibility",transformer:n.boolean})}},kmlFlyToView:{get:function(){return this._factory.specific(this,{name:"flyToView",transformer:n.boolean})}},kmlLink:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}}}),a.prototype.getTagNames=function(){return["NetworkLink"]},a.prototype.render=function(t,r){if(e.prototype.render.call(this,t,r),r.lastVisibility||this.displayed){if(!this.isDownloading&&!this.resolvedFile){this.isDownloading=!0;var n=this;new i(n.buildUrl(r.fileCache)).then(function(t){n.resolvedFile=t,n.isDownloading=!1,n.fireEvent(r)})}this.resolvedFile&&!this.displayed&&(this.resolvedFile.render(t,r),this.handleRefresh(r))}},a.prototype.buildUrl=function(t){return this.kmlLink.kmlHref(t)},a.prototype.handleRefresh=function(t){var e=t.activeEvents;if(e=e.filter(function(t){return t.type==s}),e.length>0){var r=this;new i(r.buildUrl(t.fileCache)).then(function(e){r.resolvedFile=e,r.fireEvent(t)})}},a.prototype.fireEvent=function(t){var e=0;if("onInterval"==this.kmlLink.kmlRefreshMode)e=1e3*this.kmlLink.kmlRefreshInterval;else{if("onExpire"!=this.kmlLink.kmlRefreshMode)return;if(!this.resolvedFile)return;e=this.resolvedFile.getExpired()}t.listener.addEvent(new o.Event(s,e,null))},t.addKey(a.prototype.getTagNames()[0],a),a}),i("formats/kml/util/KmlUpdate",["./KmlChange","./KmlCreate","./KmlDelete","../KmlElements","../KmlObject","./KmlNodeTransformers"],function(t,e,i,r,n,o){var s=function(t){n.call(this,t)};return s.prototype=Object.create(n.prototype),Object.defineProperties(s.prototype,{targetHref:{get:function(){return this._factory.specific(this,{name:"minRefreshPeriod",transformer:o.number})}},Change:{get:function(){return this._factory.any(this,{name:t.prototype.getTagNames()})}},Create:{get:function(){return this._factory.any(this,{name:e.prototype.getTagNames()})}},Delete:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}}}),s.prototype.getTagNames=function(){return["Update"]},r.addKey(s.prototype.getTagNames()[0],s),s}),i("formats/kml/util/KmlNetworkLinkControl",["../KmlAbstractView","../KmlElements","../KmlObject","./KmlNodeTransformers","./KmlUpdate"],function(t,e,i,r,n){var o=function(t){i.call(this,t)};return o.prototype=Object.create(i.prototype),Object.defineProperties(o.prototype,{minRefreshPeriod:{get:function(){return this._factory.specific(this,{name:"minRefreshPeriod",transformer:r.number})}},maxSessionLength:{get:function(){return this._factory.specific(this,{name:"maxSessionLength",transformer:r.number})}},cookie:{get:function(){return this._factory.specific(this,{name:"cookie",transformer:r.string})}},message:{get:function(){return this._factory.specific(this,{name:"message",transformer:r.string})}},linkName:{get:function(){return this._factory.specific(this,{name:"linkName",transformer:r.string})}},linkDescription:{get:function(){return this._factory.specific(this,{name:"linkDescription",transformer:r.string})}},linkSnippet:{get:function(){return this._factory.specific(this,{name:"linkSnippet",transformer:r.string})}},expires:{get:function(){return this._factory.specific(this,{name:"expires",transformer:r.date})}},Update:{get:function(){return this._factory.any(this,{name:n.prototype.getTagNames()})}},AbstractView:{get:function(){return this._factory.any(this,{name:t.prototype.getTagNames()})}}}),o.prototype.getTagNames=function(){return["NetworkLinkControl"]},e.addKey(o.prototype.getTagNames()[0],o),o}),i("formats/kml/KmlOrientation",["./KmlElements","./KmlObject","./util/KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlHeading:{get:function(){return this._factory.specific(this,{name:"heading",transformer:i.number})}},kmlTilt:{get:function(){return this._factory.specific(this,{name:"tilt",transformer:i.number})}},kmlRoll:{get:function(){return this._factory.specific(this,{name:"roll",transformer:i.number})}}}),r.prototype.getTagNames=function(){return["Orientation"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/geom/KmlPoint",["../../../util/Color","../KmlElements","./KmlGeometry","../../../geom/Location","../util/KmlNodeTransformers","../../../shapes/Polygon","../../../geom/Position"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){i.call(this,t),this._shape=null};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{kmlPosition:{get:function(){var t=this._factory.specific(this,{name:"coordinates",transformer:n.string}).split(",");return new s(t[1],t[0],t[2]||0)}},kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:n.boolean})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:n.string})}},kmlCenter:{get:function(){return this.kmlPosition; }}}),a.prototype.getTagNames=function(){return["Point"]},e.addKey(a.prototype.getTagNames()[0],a),a}),i("formats/kml/util/KmlViewVolume",["../KmlElements","../KmlObject","./KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlLeftFov:{get:function(){return this._factory.specific(this,{name:"leftFov",transformer:i.number})}},kmlRightFov:{get:function(){return this._factory.specific(this,{name:"rightFov",transformer:i.number})}},kmlBottomFov:{get:function(){return this._factory.specific(this,{name:"bottomFov",transformer:i.number})}},kmlTopFov:{get:function(){return this._factory.specific(this,{name:"topFov",transformer:i.number})}},kmlNear:{get:function(){return this._factory.specific(this,{name:"near",transformer:i.string})}}}),r.prototype.getTagNames=function(){return["ViewVolume"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlPhotoOverlay",["../util/KmlImagePyramid","./../KmlElements","./KmlOverlay","../geom/KmlPoint","../util/KmlNodeTransformers","../util/KmlViewVolume"],function(t,e,i,r,n,o){"use strict";var s=function(t){i.call(this,t)};return s.prototype=Object.create(i.prototype),Object.defineProperties(s.prototype,{kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:n.string})}},kmlShape:{get:function(){return this._factory.specific(this,{name:"shape",transformer:n.string})}},kmlPoint:{get:function(){return this._factory.any(this,{name:r.prototype.getTagNames()})}},kmlViewVolume:{get:function(){return this._factory.any(this,{name:o.prototype.getTagNames()})}},kmlImagePyramid:{get:function(){return this._factory.any(this,{name:t.prototype.getTagNames()})}}}),s.prototype.getTagNames=function(){return["PhotoOverlay"]},e.addKey(s.prototype.getTagNames[0],s),s}),i("formats/kml/features/KmlPlacemark",["./../KmlElements","./KmlFeature","../geom/KmlGeometry","../styles/KmlStyle","../KmlTimeSpan","../KmlTimeStamp","../../../shapes/PlacemarkAttributes","../../../shapes/Placemark","../../../util/Color","../../../shapes/ShapeAttributes","../../../shapes/TextAttributes","../../../util/Offset","../../../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c,d){"use strict";var p=function(t){e.call(this,t)};return p.prototype=Object.create(e.prototype),Object.defineProperties(p.prototype,{kmlGeometry:{get:function(){return this._factory.any(this,{name:i.prototype.getTagNames()})}}}),p.prototype.render=function(t,i){e.prototype.render.call(this,t,i),i=d.clone(i),i.lastStyle&&!this._renderable&&this.kmlGeometry&&(this._renderable=new a(this.kmlGeometry.kmlCenter,!1,this.prepareAttributes(i.lastStyle.normal,i.fileCache)),i.lastStyle.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(i.lastStyle.highlight,i.fileCache)),this.moveValidProperties(),t.redrawRequested=!0),this._renderable&&this.kmlGeometry&&(this.kmlGeometry.render(t,i),this._renderable.render(t))},p.prototype.prepareAttributes=function(t,e){var i=t&&t.generate({},e)||{normal:{},highlight:{}},n=new s(r.placemarkAttributes(i));return n.imageOffset=new c(WorldWind.OFFSET_FRACTION,.3,WorldWind.OFFSET_FRACTION,0),n.imageColor=l.WHITE,n.labelAttributes=new u(r.textAttributes({_offset:new c(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,1),_color:l.YELLOW})),n.drawLeaderLine=!0,n.leaderLineAttributes=new h(r.shapeAttributes({_outlineColor:l.RED})),n},p.prototype.moveValidProperties=function(){this._renderable.label=this.kmlName||"",this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.RELATIVE_TO_GROUND,this._renderable.enableLeaderLinePicking=!0},p.prototype.getTagNames=function(){return["Placemark"]},t.addKey(p.prototype.getTagNames()[0],p),p}),i("formats/kml/geom/KmlPolygon",["../../../util/Color","../KmlElements","./KmlGeometry","./KmlLinearRing","../styles/KmlStyle","../../../geom/Location","../util/KmlNodeTransformers","../../../shapes/Polygon","../../../shapes/ShapeAttributes","../../../shapes/SurfacePolygon"],function(t,e,i,r,n,o,s,a,l,h){"use strict";var u=function(t){i.call(this,t),this.initialized=!1};return u.prototype=Object.create(i.prototype),Object.defineProperties(u.prototype,{kmlExtrude:{get:function(){return this._factory.specific(this,{name:"extrude",transformer:s.boolean})}},kmlTessellate:{get:function(){return this._factory.specific(this,{name:"tessellate",transformer:s.boolean})}},kmlAltitudeMode:{get:function(){return this._factory.specific(this,{name:"altitudeMode",transformer:s.string})}},kmlOuterBoundary:{get:function(){return this._factory.specific(this,{name:"outerBoundaryIs",transformer:s.linearRing})}},kmlInnerBoundary:{get:function(){return this._factory.specific(this,{name:"innerBoundaryIs",transformer:s.linearRing})}},kmlCenter:{get:function(){return this.kmlOuterBoundary.kmlCenter}}}),u.prototype.createPolygon=function(t,e){this.kmlAltitudeMode===WorldWind.CLAMP_TO_GROUND||this.kmlInnerBoundary&&this.kmlInnerBoundary.kmlAltitudeMode===WorldWind.CLAMP_TO_GROUND||this.kmlOuterBoundary&&this.kmlOuterBoundary.kmlAltitudeMode===WorldWind.CLAMP_TO_GROUND?this._renderable=new h(this.prepareLocations(),this.prepareAttributes(t.normal,e)):this._renderable=new a(this.prepareLocations(),this.prepareAttributes(t.normal,e)),t.highlight&&(this._renderable.highlightAttributes=this.prepareAttributes(t.highlight,e)),this.moveValidProperties()},u.prototype.render=function(t,e){i.prototype.render.call(this,t,e),e.lastStyle&&!this._renderable&&(this.createPolygon(e.lastStyle,e.fileCache),t.redrawRequested=!0),this._renderable&&(this._renderable.enabled=this.enabled,this._renderable.render(t))},u.prototype.moveValidProperties=function(){this._renderable.extrude=this.kmlExtrude||!0,this._renderable.altitudeMode=this.kmlAltitudeMode||WorldWind.CLAMP_TO_GROUND},u.prototype.prepareAttributes=function(t,e){var i=t&&t.generate(e)||{};return i._drawVerticals=this.kmlExtrude||!1,i._applyLighting=!0,i._depthTest=!0,i._outlineStippleFactor=0,i._outlineStipplePattern=61680,i._enableLighting=!0,new l(n.shapeAttributes(i))},u.prototype.prepareLocations=function(){var t=[];return null!=this.kmlInnerBoundary?(t[0]=this.kmlInnerBoundary.kmlPositions,t[1]=this.kmlOuterBoundary.kmlPositions):t=this.kmlOuterBoundary.kmlPositions,t},u.prototype.getStyle=function(){return this._style},u.prototype.getTagNames=function(){return["Polygon"]},e.addKey(u.prototype.getTagNames()[0],u),u}),i("formats/kml/util/KmlScale",["./../KmlElements","../KmlObject","./KmlNodeTransformers"],function(t,e,i){"use strict";var r=function(t){e.call(this,t)};return r.prototype=Object.create(e.prototype),Object.defineProperties(r.prototype,{kmlX:{get:function(){return this._factory.specific(this,{name:"x",transformer:i.number})}},kmlY:{get:function(){return this._factory.specific(this,{name:"y",transformer:i.number})}},kmlZ:{get:function(){return this._factory.specific(this,{name:"z",transformer:i.number})}}}),r.prototype.getTagNames=function(){return["Scale"]},t.addKey(r.prototype.getTagNames()[0],r),r}),i("formats/kml/features/KmlScreenOverlay",["./../KmlElements","./KmlFeature","./KmlOverlay","../util/KmlNodeTransformers","../../../util/Offset","../../../shapes/ScreenImage"],function(t,e,i,r,n,o){"use strict";var s=function(t){i.call(this,t)};return s.prototype=Object.create(i.prototype),Object.defineProperties(s.prototype,{kmlRotation:{get:function(){return this._factory.specific(this,{name:"rotation",transformer:r.number})}},kmlOverlayXYx:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("x"),attribute:"kmlOverlayXYx"})}},kmlOverlayXYy:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("y"),attribute:"kmlOverlayXYy"})}},kmlOverlayXYxunits:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("xunits"),attribute:"kmlOverlayXYxunits"})}},kmlOverlayXYyunits:{get:function(){return this._factory.specific(this,{name:"overlayXY",transformer:r.attribute("yunits"),attribute:"kmlOverlayXYyunits"})}},kmlScreenXYx:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("x"),attribute:"kmlScreenXYx"})}},kmlScreenXYy:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("y"),attribute:"kmlScreenXYy"})}},kmlScreenXYxunits:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("xunits"),attribute:"kmlScreenXYxunits"})}},kmlScreenXYyunits:{get:function(){return this._factory.specific(this,{name:"screenXY",transformer:r.attribute("yunits"),attribute:"kmlScreenXYyunits"})}},kmlRotationXYx:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("x"),attribute:"kmlRotationXYx"})}},kmlRotationXYy:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("y"),attribute:"kmlRotationXYy"})}},kmlRotationXYxunits:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("xunits"),attribute:"kmlRotationXYxunits"})}},kmlRotationXYyunits:{get:function(){return this._factory.specific(this,{name:"rotationXY",transformer:r.attribute("yunits"),attribute:"kmlRotationXYyunits"})}},kmlSizex:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("x"),attribute:"kmlSizex"})}},kmlSizey:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("y"),attribute:"kmlSizey"})}},kmlSizexunits:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("xunits"),attribute:"kmlSizexunits"})}},kmlSizeyunits:{get:function(){return this._factory.specific(this,{name:"size",transformer:r.attribute("yunits"),attribute:"kmlSizeyunits"})}}}),s.prototype.render=function(t,i){e.prototype.render.call(this,t,i),this._renderable||this.kmlIcon&&(this._renderable=new o(new n(this.kmlScreenXYxunits,this.kmlScreenXYx,this.kmlScreenXYyunits,this.kmlScreenXYy),this.kmlIcon.kmlHref(i.fileCache)),this._renderable.imageOffset=new n(this.kmlOverlayXYxunits,this.kmlOverlayXYx,this.kmlOverlayXYyunits,this.kmlOverlayXYy),t.redrawRequested=!0),this._renderable&&this._renderable.render(t)},s.prototype.getTagNames=function(){return["ScreenOverlay"]},t.addKey(s.prototype.getTagNames()[0],s),s}),i("formats/kml/features/KmlTour",["./../KmlElements","./KmlFeature"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["gx:Tour"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/geom/KmlTrack",["./../KmlElements","./KmlGeometry"],function(t,e){"use strict";var i=function(t){e.call(this,t)};return i.prototype=Object.create(e.prototype),i.prototype.getTagNames=function(){return["gx:Track"]},t.addKey(i.prototype.getTagNames()[0],i),i}),i("formats/kml/controls/KmlTreeVisibility",["../../../util/WWUtil","./KmlControls"],function(t,e){"use strict";var i=function(t,i){e.apply(this),this._visualElementId=t,this._wwd=i};return i.prototype=Object.create(e.prototype),i.prototype.hook=function(t,e){e.isFeature&&this.createControls(t)},i.prototype.createControls=function(e){function i(){o=!o,h.updateDescendants(e,o)}function r(){e.kmlAbstractView&&e.kmlAbstractView.update({wwd:h._wwd})}var n=e.kmlName||e.id||t.guid(),o=e.enabled&&e.kmlVisibility===!0,s=document.createElement("div"),a=document.createElement("input");a.setAttribute("type","checkbox"),o&&a.setAttribute("checked","checked"),a.addEventListener("click",i,!0),s.appendChild(a);var l;l=e.kmlAbstractView?document.createElement("a"):document.createElement("span"),l.appendChild(document.createTextNode(n)),l.addEventListener("click",r,!0),s.appendChild(l),document.getElementById(this._visualElementId).appendChild(s);var h=this},i.prototype.updateDescendants=function(t,e){t.controlledVisibility=e,this._wwd.redraw()},i}),i("layer/LandsatRestLayer",["../error/ArgumentError","../geom/Location","../util/Logger","../geom/Sector","../layer/TiledImageLayer","../util/LevelRowColumnUrlBuilder","../util/WWUtil"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,a){var l=s.urlPath(t+"/"+i);n.call(this,r.FULL_SPHERE,new e(36,36),10,"image/png",l,512,512),this.displayName=a,this.pickEnabled=!1,this.urlBuilder=new o(t,i)};return a.prototype=Object.create(n.prototype),a}),i("util/measure/LengthMeasurer",["../../error/ArgumentError","../../geom/Location","../Logger","./MeasurerUtils","../../geom/Position","../../geom/Vec3"],function(t,e,i,r,n,o){var s=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"LengthMeasurer","constructor","missingWorldWindow"));this.wwd=e,this.DEFAULT_MIN_SEGMENT_LENGTH=30,this._maxSegmentLength=1e5,this._lengthTerrainSamplingSteps=128,this.subdividedPositions=null};return Object.defineProperties(s.prototype,{maxSegmentLength:{get:function(){return this._maxSegmentLength},set:function(t){this._maxSegmentLength=t}},lengthTerrainSamplingSteps:{get:function(){return this._lengthTerrainSamplingSteps},set:function(t){this._lengthTerrainSamplingSteps=t}}}),s.prototype.getLength=function(t,e,i){return i=i||WorldWind.GREAT_CIRCLE,this.subdividedPositions=null,this.computeLength(t,e,i)},s.prototype.getPathLength=function(t){return this.subdividedPositions=null,this.computeLength(t.positions,t.followTerrain,t.pathType)},s.prototype.getGeographicDistance=function(t,i){if(t instanceof WorldWind.Path)var r=t.positions,n=t.pathType;else Array.isArray(t)&&(r=t,n=i||WorldWind.GREAT_CIRCLE);if(!r||r.length<2)return-1;var o=e.greatCircleDistance;n===WorldWind.RHUMB_LINE?o=e.rhumbDistance:n===WorldWind.LINEAR&&(o=e.linearDistance);for(var s=0,a=0,l=r.length-1;a0&&e._dimensions.forEach(function(e){var i=e.name,r=!0;t.forEach(function(t){t.name===i&&(r=!1)}),r&&t.push(e)}),e=e.parent;return t.length>0?t:void 0}},extents:{get:function(){for(var t=[],e=this;e&&e instanceof i;)e._extents&&e._extents.length>0&&e._extents.forEach(function(e){var i=e.name,r=!0;t.forEach(function(t){t.name===i&&(r=!1)}),r&&t.push(e)}),e=e.parent;return t.length>0?t:void 0}},attribution:{get:function(){return i.replace(this,"_attribution")}},authorityUrls:{get:function(){return i.accumulate(this,"_authorityUrls",[])}},minScaleDenominator:{get:function(){return i.replace(this,"_minScaleDenominator")}},maxScaleDenominator:{get:function(){return i.replace(this,"_maxScaleDenominator")}},scaleHint:{get:function(){return i.replace(this,"_scaleHint")}}}),i.prototype.style=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsLayerCapabilities","style","Style name is null or undefined."));var r=this.styles;if(!r)return null;for(var n,o=0,s=r.length;o0?r:null},i.replace=function(t,e){for(;t&&t instanceof i;){var r=t[e];if(r)return r;t=t.parent}},i.prototype.assembleLayer=function(t){var e,r;e=t.getAttribute("queryable"),e&&(this._queryable="1"===e||"true"===e),e=t.getAttribute("opaque"),e&&(this._opaque="1"===e||"true"===e),e=t.getAttribute("noSubsets"),e&&(this._noSubsets="1"===e||"true"===e),e=t.getAttribute("cascaded"),e&&(this._cascaded=parseInt("10")),e=t.getAttribute("fixedWidth"),e&&(this._fixedWidth=parseInt("10")),e=t.getAttribute("fixedHeight"),e&&(this._fixedHeight=parseInt("10"));var n=t.children||t.childNodes;for(r=0;rMath.max(e*n,.5)},s.prototype.update=function(t){var e=t.globe.elevationTimestamp(),i=t.verticalExaggeration,r=t.globeStateKey;this.updateTimestamp==e&&this.updateVerticalExaggeration==i&&this.updateGlobeStateKey==r||(this.doUpdate(t),t.frameStatistics.incrementTileUpdateCount(1),this.updateTimestamp=e,this.updateVerticalExaggeration=i,this.updateGlobeStateKey=r)},s.prototype.doUpdate=function(t){var e=t.globe,r=t.verticalExaggeration,s=e.minAndMaxElevationsForSector(this.sector),a=s[0]*r,l=s[1]*r;a===l&&(a=l+10),this.extent||(this.extent=new i),this.extent.setToSector(this.sector,e,a,l),this.samplePoints||(this.sampleElevations=new Float64Array(9),this.samplePoints=new Float64Array(3*this.sampleElevations.length)),o.fillArray(this.sampleElevations,.5*(a+l)),e.computePointsForGrid(this.sector,3,3,this.sampleElevations,n.ZERO,this.samplePoints),this.referencePoint||(this.referencePoint=new n(0,0,0)),e.computePointFromPosition(this.sector.centroidLatitude(),this.sector.centroidLongitude(),0,this.referencePoint)},s.prototype.bind=function(t){var e=t.gpuResourceCache.resourceForKey(this.gpuCacheKey);return!(!e||!e.bind(t))||!!this.fallbackTile&&this.fallbackTile.bind(t)},s.prototype.applyInternalTransform=function(t,e){},s}),i("layer/WmtsLayer",["../util/AbsentResourceList","../error/ArgumentError","../util/Logger","../geom/Matrix","../geom/Sector","../layer/Layer","../cache/MemoryCache","../render/Texture","../util/WmsUrlBuilder","../layer/WmtsLayerTile","../util/WWMath","../util/WWUtil"],function(t,e,i,r,n,o,s,a,l,h,u,c){"use strict";var d=function(a,l){if(!a)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No layer configuration specified."));if(o.call(this,"WMTS Layer"),this.layerIdentifier=a.identifier,this.styleIdentifier=a.style,this.timeString=l,this.imageFormat=a.format,this.resourceUrl=a.resourceUrl,this.serviceUrl=a.service,this.tileMatrixSet=a.tileMatrixSet,this.lasTtMVP=r.fromIdentity(),a.wgs84BoundingBox||a.boundingBox){if(a.wgs84BoundingBox)this.sector=a.wgs84BoundingBox.getSector();else if(this.tileMatrixSet.boundingBox&&d.isEpsg4326Crs(this.tileMatrixSet.boundingBox.crs))this.sector=new n(this.tileMatrixSet.boundingBox.lowerCorner[1],this.tileMatrixSet.boundingBox.upperCorner[1],this.tileMatrixSet.boundingBox.lowerCorner[0],this.tileMatrixSet.boundingBox.upperCorner[0]);else if(d.isEpsg4326Crs(this.tileMatrixSet.supportedCRS))throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No EPSG:4326 bounding box was specified in the layer or tile matrix set capabilities."))}else{if(!this.tileMatrixSet.boundingBox)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","No bounding box was specified in the layer or tile matrix set capabilities."));this.sector=new n(a.tileMatrixSet.boundingBox.lowerCorner[1],a.tileMatrixSet.boundingBox.upperCorner[1],a.tileMatrixSet.boundingBox.lowerCorner[0],a.tileMatrixSet.boundingBox.upperCorner[0])}if(!d.isTileSubdivisionCompatible(this.tileMatrixSet))throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","TileMatrixSet level division not compatible."));var h=this.tileMatrixSet.supportedCRS,u=d.isEpsg3857Crs(h)||d.isEpsg4326Crs(h)||d.isOGCCrs84(h);if(!u)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","constructor","Provided CRS is not compatible."));this.cachePath=(this.resourceUrl||this.serviceUrl)+this.layerIdentifier+this.styleIdentifier+this.tileMatrixSet.identifier,l&&(this.cachePath=this.cachePath+l),this.displayName=a.title,this.currentTiles=[],this.currentTilesInvalid=!0,this.tileCache=new s(1e3,850),this.currentRetrievals=[],this.absentResourceList=new t(3,5e4),this.pickEnabled=!1,this.detailControl=1.75,this.retrievalQueueSize=WorldWind.configuration.layerRetrievalQueueSize};return d.isTileSubdivisionCompatible=function(t){if(!t||!t.tileMatrix||t.tileMatrix.length<1)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","isTileSubdivisionCompatible","Empty tile matrix set"));for(var r,n,o,s=t.tileMatrix[0],a=1,l=t.tileMatrix.length;a=0?s.format="image/png":t.format.indexOf("image/jpeg")>=0?s.format="image/jpeg":t.format.indexOf("image/tiff")>=0?s.format="image/tiff":t.format.indexOf("image/gif")>=0?s.format="image/gif":s.format=t.format[0]),!s.format)throw new e(i.logMessage(i.LEVEL_SEVERE,"WmtsLayer","formLayerConfiguration","Layer does not provide a supported image format."));if(t.resourceUrl&&t.resourceUrl.length>=1){for(var h=0;h0?s.title=t.titles[0].value:s.title=t.identifier,s},d.prototype=Object.create(o.prototype),d.prototype.doRender=function(t){t.terrain&&(!this.currentTilesInvalid&&t.modelviewProjection.equals(this.lasTtMVP)&&t.globeStateKey===this.lastGlobeStateKey||(this.currentTilesInvalid=!1,this.assembleTiles(t)),this.lasTtMVP.copy(t.modelviewProjection),this.lastGlobeStateKey=t.globeStateKey,this.currentTiles.length>0&&(t.surfaceTileRenderer.renderTiles(t,this.currentTiles,this.opacity),t.frameStatistics.incrementImageTileCount(this.currentTiles.length),this.inCurrentFrame=!0))},d.prototype.isLayerInView=function(t){return t.terrain&&t.terrain.sector&&t.terrain.sector.intersects(this.sector)},d.prototype.isTileVisible=function(t,e){return!(t.globe.projectionLimits&&!e.sector.overlaps(t.globe.projectionLimits))&&e.extent.intersectsFrustum(t.frustumInModelCoordinates)},d.prototype.assembleTiles=function(t){this.currentTiles=[],this.topLevelTiles&&0!==this.topLevelTiles.length||this.createTopLevelTiles(t);for(var e=0,i=this.topLevelTiles.length;e=e.tileMatrix.matrixWidth&&(e.column=e.column-e.tileMatrix.matrixWidth),e.column<0&&(e.column=e.column+e.tileMatrix.matrixWidth),this.tileMeetsRenderingCriteria(t,e))return void this.addTile(t,e);var i=null;try{(this.isTileTextureInMemory(t,e)||0===e.tileMatrix.levelNumber)&&(i=this.currentAncestorTile,this.currentAncestorTile=e);for(var r=this.tileMatrixSet.tileMatrix[e.tileMatrix.levelNumber+1],n=e.subdivideToCache(r,this,this.tileCache),o=0,s=n.length;o=75||e.sector.maxLatitude<=-75)&&(i*=1.2),e.tileMatrix.levelNumber===this.tileMatrixSet.tileMatrix.length-1||!e.mustSubdivide(t,i)},d.prototype.retrieveTileImage=function(t,e){if(this.currentRetrievals.indexOf(e.imagePath)<0){if(this.currentRetrievals.length>this.retrievalQueueSize)return;if(this.absentResourceList.isResourceAbsent(e.imagePath))return;var r=this.resourceUrlForTile(e,this.imageFormat),n=new Image,o=e.imagePath,s=t.gpuResourceCache,a=t.currentGlContext.canvas,l=this;if(!r)return void(this.currentTilesInvalid=!0);n.onload=function(){i.log(i.LEVEL_INFO,"Image retrieval succeeded: "+r);var h=l.createTexture(t,e,n);if(l.removeFromCurrentRetrievals(o),h){s.putResource(o,h,h.size),l.currentTilesInvalid=!0,l.absentResourceList.unmarkResourceAbsent(o);var u=document.createEvent("Event");u.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),a.dispatchEvent(u)}},n.onerror=function(){l.removeFromCurrentRetrievals(o),l.absentResourceList.markResourceAbsent(o),i.log(i.LEVEL_WARNING,"Image retrieval failed: "+r)},this.currentRetrievals.push(o),n.crossOrigin="anonymous",n.src=r}},d.prototype.resourceUrlForTile=function(t,e){var i;return this.resourceUrl?(i=this.resourceUrl.replace("{Style}",this.styleIdentifier).replace("{TileMatrixSet}",this.tileMatrixSet.identifier).replace("{TileMatrix}",t.tileMatrix.identifier).replace("{TileCol}",t.column).replace("{TileRow}",t.row),this.timeString&&(i=i.replace("{Time}",this.timeString))):(i=this.serviceUrl+"service=WMTS&request=GetTile&version=1.0.0",i+="&Layer="+this.layerIdentifier,this.styleIdentifier&&(i+="&Style="+this.styleIdentifier),i+="&Format="+e,this.timeString&&(i+="&Time="+this.timeString),i+="&TileMatrixSet="+this.tileMatrixSet.identifier,i+="&TileMatrix="+t.tileMatrix.identifier,i+="&TileRow="+t.row,i+="&TileCol="+t.column),i},d.prototype.removeFromCurrentRetrievals=function(t){var e=this.currentRetrievals.indexOf(t);e>-1&&this.currentRetrievals.splice(e,1)},d.prototype.createTopLevelTiles=function(t){var e=this.tileMatrixSet.tileMatrix[0];this.topLevelTiles=[];for(var i=0;i=0&&t.indexOf("4326")>=0},d.isEpsg3857Crs=function(t){return t.indexOf("EPSG")>=0&&(t.indexOf("3857")>=0||t.indexOf("900913")>=0)},d.isOGCCrs84=function(t){return t.indexOf("OGC")>=0&&t.indexOf("CRS84")>=0},d}),i("layer/OpenStreetMapImageLayer",["../util/Color","../layer/Layer","../util/Logger","../ogc/wmts/WmtsCapabilities","../layer/WmtsLayer"],function(t,e,i,r,n){"use strict";var o=function(t){e.call(this,this.displayName),this.displayName=t||"Open Street Map",this.layer=null,this.xhr=null,this.pickEnabled=!0};return o.prototype=Object.create(e.prototype),o.prototype.doRender=function(e){this.configureLayer(e),this.layer&&(this.layer.opacity=this.opacity,this.layer.doRender(e),this.inCurrentFrame=this.layer.inCurrentFrame,this.inCurrentFrame&&(e.screenCreditController.addCredit("OpenStreetMap ©",t.DARK_GRAY),e.screenCreditController.addCredit("EOX.at ©",t.DARK_GRAY)))},o.prototype.configureLayer=function(t){if(!this.xhr){var e=this,o=t.currentGlContext.canvas;this.xhr=new XMLHttpRequest,this.xhr.open("GET","https://tiles.maps.eox.at/wmts/1.0.0/WMTSCapabilities.xml",!0),this.xhr.onreadystatechange=function(){if(4===e.xhr.readyState)if(200===e.xhr.status){var t=new r(e.xhr.responseXML),s=t.getLayer("osm"),a=n.formLayerConfiguration(s);a.title=e.displayName,e.layer=new n(a);var l=document.createEvent("Event");l.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),o.dispatchEvent(l)}else i.log(i.LEVEL_WARNING,"OSM retrieval failed ("+xhr.statusText+"): "+url)},this.xhr.onerror=function(){i.log(i.LEVEL_WARNING,"OSM retrieval failed: "+url)},this.xhr.ontimeout=function(){i.log(i.LEVEL_WARNING,"OSM retrieval timed out: "+url)},this.xhr.send(null)}},o}),i("projections/ProjectionGnomonic",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t){this.north=!("South"===t);var e=this.north?new n(30,90,-180,180):new n(-90,-30,-180,180);i.call(this,"Polar Gnomonic",!1,e),this._pole=t,this.displayName=this.north?"North Gnomonic":"South Gnomonic",this._stateKey="projection polar gnomonic "+this._pole+" "};return s.prototype=Object.create(i.prototype),Object.defineProperties(s.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this.projectionLimits=this.north?new n(30,90,-180,180):new n(-90,-30,-180,180),this._stateKey="projection polar gnomonic "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),s.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&n===-90)l[0]=0,l[1]=0,l[2]=s;else{var h=this.north?1:-1,u=i.equatorialRadius/Math.tan(n*t.DEGREES_TO_RADIANS);l[0]=u*Math.sin(o*t.DEGREES_TO_RADIANS)*h,l[1]=u*-Math.cos(o*t.DEGREES_TO_RADIANS),l[2]=s}return l},s.prototype.geographicToCartesianGrid=function(i,n,s,a,l,h,u,c){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","missingSector"));if(!l||l.length1?s-1:1),S=(b-_)/(a>1?a-1:1),L=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,T=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,R=this.north?1:-1,x=h?h:new Vec3(0,0,0),M=0,C=0;for(d=0,f=E;dMath.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},s.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},s.prototype.northTangentAtPoint=function(t,i,n,o,s,a){if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},s}),i("projections/ProjectionMercator",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(){i.call(this,"Mercator",!0,new n(-78,78,-180,180))};return a.prototype=Object.create(i.prototype),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingResult"));n>this.projectionLimits.maxLatitude&&(n=this.projectionLimits.maxLatitude),n1?a-1:1),M=(R-T)/(l>1?l-1:1),C=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,A=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,P=u?u:new o(0,0,0),O=c?c[0]:0,N=0,I=0;for(p=0,g=S;p1?o-1:1),w=(_-v)/(s>1?s-1:1),S=this.north?-1:1,L=l?l:new Vec3(0,0,0),T=Math.PI/2,R=0,x=0,M=new Float64Array(s),C=new Float64Array(s);for(d=0,f=v;dMath.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},n.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},n.prototype.northTangentAtPoint=function(t,i,n,o,s,a){if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},n}),i("projections/ProjectionUPS",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){this.north=!("South"===t);var e=this.north?new n(0,90,-180,180):new n(-90,0,-180,180);i.call(this,"Uniform Polar Stereographic",!1,e),this._pole=t,this.displayName=this.north?"North UPS":"South UPS",this._stateKey="projection ups "+this._pole+" "};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this.projectionLimits=this.north?new n(0,90,-180,180):new n(-90,0,-180,180),this._stateKey="projection ups "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&n===-90)l[0]=0,l[1]=0,l[2]=s;else{var h,u,c,d=this.north?1:-1,p=n*t.DEGREES_TO_RADIANS,f=o*t.DEGREES_TO_RADIANS,g=.994,m=Math.sqrt(i.eccentricitySquared),y=Math.sqrt(Math.pow(1+m,1+m)*Math.pow(1-m,1-m));(this.north&&p<0||!this.north&&p>0)&&(p=0),h=Math.sin(p*d),u=Math.sqrt((1-h)/(1+h)*Math.pow((1+m*h)/(1-m*h),m)),c=2*i.equatorialRadius*g*u/y,l[0]=c*Math.sin(f),l[1]=-c*Math.cos(f)*d,l[2]=s}return l},a.prototype.geographicToCartesianGrid=function(i,n,a,l,h,u,c,d){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingSector"));if(!h||h.length1?a-1:1),x=(T-L)/(l>1?l-1:1),M=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,C=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,A=.994,P=Math.sqrt(i.eccentricitySquared),O=Math.sqrt(Math.pow(1+P,1+P)*Math.pow(1-P,1-P)),N=this.north?1:-1,I=u?u:new o(0,0,0),D=0,k=0;for(p=0,g=w;pt.TWO_PI&&(r%=t.TWO_PI),t.RADIANS_TO_DEGREES*(r>=0?r:r+t.TWO_PI)},u.prototype.deepCopyLocations=function(t){var e=[];if(t.length>0&&Array.isArray(t[0]))for(var r=0,n=t.length;r0&&Array.isArray(e[0]))for(var o=0,a=e.length;o0&&Array.isArray(n[0]))for(var l=0,h=n.length;ln.magnitude()?o.copy(i):new e(t,s).pointAt(l,o)},u.prototype.computeShadowPointLocations=function(t,e,r,n){var o=null,s=null;t.pathType===WorldWind.LINEAR?e.position=new i((r.latitude+n.latitude)/2,(r.longitude+n.longitude)/2):t.pathType===WorldWind.RHUMB_LINE?(null==o&&(o=i.rhumbAzimuth(r,n),s=i.rhumbDistance(r,n)),e.position=i.rhumbLocation(r,o,.5*s,e.position)):(null==o&&(o=i.greatCircleAzimuth(r,n),s=i.greatCircleDistance(r,n)),e.position=i.greatCircleLocation(r,o,.5*s,e.position))},u}),i("util/editor/ShapeEditorConstants",[],function(){"use strict";var t={LOCATION:"location",ROTATION:"rotation",WIDTH:"width",HEIGHT:"height",RADIUS:"radius",DRAG:"drag",MIN_CORNER:"min_corner",MAX_CORNER:"max_corner",SHADOW:"shadow"};return t}),i("util/editor/PlacemarkEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","./ShapeEditorConstants","../../shapes/Placemark"],function(t,e,i,r){"use strict";var n=function(){};return n.prototype=Object.create(t.prototype),n.prototype.canHandle=function(t){return t instanceof r},n.prototype.createShadowShape=function(t){return new r(t.position,null,t.attributes)},n.prototype.getShapeCenter=function(t){return t.position},n.prototype.initializeControlElements=function(t,e,r,n,o,s,a){a&&(t.userProperties.purpose=i.DRAG,e.push(t))},n.prototype.updateControlElements=function(t,e,i){i[0].position=t.position},n.prototype.reshape=function(t,e,i,r,n){return!1},n}),i("shapes/SurfaceEllipse",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,n,s,l){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceEllipse","constructor","missingLocation"));if(i<0||n<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceEllipse","constructor","Radius is negative."));o.call(this,l),this._center=t,this._majorRadius=i,this._minorRadius=n,this._heading=s,this._intervals=a.DEFAULT_NUM_INTERVALS};return a.prototype=Object.create(o.prototype),Object.defineProperties(a.prototype,{center:{get:function(){return this._center},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._center=t}},majorRadius:{get:function(){return this._majorRadius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._majorRadius=t}},minorRadius:{get:function(){return this._minorRadius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._minorRadius=t}},heading:{get:function(){return this._heading},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._heading=t}},intervals:{get:function(){return this._intervals},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._intervals=t}}}),a.staticStateKey=function(t){var e=o.staticStateKey(t);return e+" ce "+t.center.toString()+" ma "+t.majorRadius.toString()+" mi "+t.minorRadius.toString()+" he "+t.heading.toString()+" in "+t.intervals.toString()},a.prototype.computeStateKey=function(){return a.staticStateKey(this)},a.prototype.computeBoundaries=function(e){if(0==this.majorRadius&&0==this.minorRadius)return null;var r=e.globe,n=1+Math.max(a.MIN_NUM_INTERVALS,this.intervals),o=2*Math.PI/(n-1),l=r.radiusAt(this.center.latitude,this.center.longitude);this._boundaries=new Array(n);for(var h=0;h0)for(var l=0;l0&&(t.majorRadius=h)}else if(n.userProperties.purpose===i.HEIGHT){var u=t.minorRadius+2*a.dot(l);u>0&&(t.minorRadius=u)}else if(n.userProperties.purpose===i.ROTATION){var c=e.greatCircleAzimuth(t.center,s),d=e.greatCircleAzimuth(t.center,o)-c;t.heading=this.normalizedHeading(t.heading,d)}},n}),i("shapes/SurfaceCircle",["../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r,n){"use strict";var o=function(e,r,s){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceCircle","constructor","missingLocation"));if(r<0)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceCircle","constructor","Radius is negative"));n.call(this,s),this._center=e,this._radius=r,this._intervals=o.DEFAULT_NUM_INTERVALS};return o.prototype=Object.create(n.prototype),Object.defineProperties(o.prototype,{center:{get:function(){return this._center},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._center=t}},radius:{get:function(){return this._radius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._radius=t}},intervals:{get:function(){return this._intervals},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._intervals=t}}}),o.staticStateKey=function(t){var e=n.staticStateKey(t);return e+" ce "+t.center.toString()+" ra "+t.radius.toString()},o.prototype.computeStateKey=function(){return o.staticStateKey(this)},o.prototype.computeBoundaries=function(t){if(0===this.radius)return null;var i=1+Math.max(o.MIN_NUM_INTERVALS,this.intervals),r=360/(i-1),n=this.radius/t.globe.radiusAt(this.center.latitude,this.center.longitude);this._boundaries=new Array(i);for(var s=0;s0&&(e.greatCircleLocation(t.center,90,t.radius/i.equatorialRadius,r[0].position),r[0].userProperties.size=t.radius)},n.prototype.reshape=function(t,e,r,n,o){if(r.userProperties.purpose===i.RADIUS){var s=this.computeControlPointDelta(e,n,o),a=this.computeControlPointDelta(e,r.position,t.center).normalize(),l=t.radius+s.dot(a);l>0&&(t.radius=l)}},n}),i("util/editor/SurfacePolygonEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","../../geom/Position","./ShapeEditorConstants","../../shapes/SurfacePolygon","../../geom/Vec3"],function(t,e,i,r,n,o){"use strict";var s=function(){this.currentHeading=0,this.moveControlPointAttributes=null,this.shadowControlPointAttributes=null};return s.prototype=Object.create(t.prototype),s.prototype.canHandle=function(t){return t instanceof Function?"SurfacePolygon"===t.name:t instanceof n},s.prototype.createShadowShape=function(t){return new n(this.deepCopyLocations(t.boundaries),t.attributes)},s.prototype.getShapeCenter=function(t,e){return this.getCenterFromLocations(e,t.boundaries)},s.prototype.isRegularShape=function(){return!1},s.prototype.initializeControlElements=function(t,e,i,n,o,s,a,l){if(this.currentHeading=0,a){this.moveControlPointAttributes=a,this.shadowControlPointAttributes=l;for(var h=this.getLocations(t),u=0,c=h.length;u0)for(var d=h-1;d>-1;d--){if(n[d].userProperties.purpose===r.ROTATION){c=n[d];var p=this.getCenterFromLocations(i,a),f=1.2*this.getAverageDistance(i,p,a);e.greatCircleLocation(p,this.currentHeading,f,c.position),c.userProperties.rotation=this.currentHeading,this.updateRotationAccessory(p,c.position,s)}n[d].userProperties.purpose===r.LOCATION&&u.push(n[d]),n.pop()}u.reverse();for(var g=u.length,d=0;d=g&&this.createControlPoint(u,this.moveControlPointAttributes,r.LOCATION,d),u[d].position=a[d];u.length>l&&u.splice(l,u.length-l);for(var d=0;d0&&Array.isArray(c[0])){ -for(var p=-1,f=0,g=-1,m=0;mu&&(p=m,g=u-f),f+=y}if(p!==-1){var E=c[p];E.length>3?E.splice(g,1):d>2&&c.splice(p,1)}}else c.length>3&&c.splice(u,1)}else this.moveLocation(e,i,s,o,l[u]);t.resetBoundaries(),t._stateId=n.stateId++,t.stateKeyInvalid=!0}},s.prototype.addNewVertex=function(t,e,r){var s=new o(0,0,0),a=new o(0,0,0),l=new o(0,0,0),h=t.boundaries,u=e.computePointFromPosition(r.latitude,r.longitude,0,new o(0,0,0)),c=new o(0,0,0),d=-1,p=Number.MAX_VALUE;if(Array.isArray(t.boundaries[0])){for(var f=-1,g=0,m=h.length;g0&&Array.isArray(t.boundaries[0]))for(var i=0,r=t.boundaries.length;i-1;d--){if(n[d].userProperties.purpose===r.ROTATION){c=n[d];var p=this.getCenterFromLocations(i,a),f=1.2*this.getAverageDistance(i,p,a);e.greatCircleLocation(p,this.currentHeading,f,c.position),c.userProperties.rotation=this.currentHeading,this.updateRotationAccessory(p,c.position,s)}n[d].userProperties.purpose===r.LOCATION&&u.push(n[d]),n.pop()}u.reverse();for(var g=u.length,d=0;d=g&&this.createControlPoint(u,this.moveControlPointAttributes,r.LOCATION,d),u[d].position=a[d];u.length>l&&u.splice(l,u.length-l);for(var d=0;d2&&l.splice(u,1):this.moveLocation(e,i,s,o,l[u]),t.resetBoundaries(),t._stateId=n.stateId++,t.stateKeyInvalid=!0}},s.prototype.addNewVertex=function(t,e,r){for(var s=new o(0,0,0),a=new o(0,0,0),l=new o(0,0,0),h=t.boundaries,u=e.computePointFromPosition(r.latitude,r.longitude,0,new o(0,0,0)),c=new o(0,0,0),d=-1,p=Number.MAX_VALUE,f=1,g=h.length;f0)for(var l=0;l0&&(t.width=h)}else if(n.userProperties.purpose===i.HEIGHT){var u=t.height+2*a.dot(l);u>0&&(t.height=u)}else if(n.userProperties.purpose===i.ROTATION){var c=e.greatCircleAzimuth(t.center,s),d=e.greatCircleAzimuth(t.center,o)-c;t.heading=this.normalizedHeading(t.heading,d)}},n}),i("shapes/SurfaceSector",["../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r,n){"use strict";var o=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceSector","constructor","missingSector"));n.call(this,r),this._sector=e};return o.prototype=Object.create(n.prototype),Object.defineProperties(o.prototype,{sector:{get:function(){return this._sector},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._sector=t}}}),o.staticStateKey=function(t){var e=n.staticStateKey(t);return e},o.prototype.computeStateKey=function(){return o.staticStateKey(this)},o.prototype.computeBoundaries=function(t){var i=this._sector;this._boundaries=new Array(4),this._boundaries[0]=new e(i.minLatitude,i.minLongitude),this._boundaries[1]=new e(i.maxLatitude,i.minLongitude),this._boundaries[2]=new e(i.maxLatitude,i.maxLongitude),this._boundaries[3]=new e(i.minLatitude,i.maxLongitude)},o.prototype.getReferencePosition=function(){return new e(this.sector.centroidLatitude(),this.sector.centroidLongitude())},o.prototype.moveTo=function(t,i){var r=this._sector,n=new Array(3);n[0]=new e(r.minLatitude,r.minLongitude),n[1]=new e(r.maxLatitude,r.minLongitude),n[2]=new e(r.maxLatitude,r.maxLongitude),n=this.computeShiftedLocations(t,this.getReferencePosition(),i,n),this.sector=new WorldWind.Sector(n[0].latitude,n[1].latitude,n[1].longitude,n[2].longitude)},o}),i("util/editor/SurfaceSectorEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","../../geom/Position","../../geom/Sector","./ShapeEditorConstants","../../shapes/SurfaceSector"],function(t,e,i,r,n,o){"use strict";var s=function(){};return s.prototype=Object.create(t.prototype),s.prototype.canHandle=function(t){return t instanceof Function?"SurfaceSector"===t.name:t instanceof o},s.prototype.createShadowShape=function(t){return new o(new r(t._boundaries[0].latitude,t._boundaries[1].latitude,t._boundaries[0].longitude,t._boundaries[2].longitude),t.attributes)},s.prototype.getShapeCenter=function(t,e){return this.getCenterFromLocations(e,t._boundaries)},s.prototype.isRegularShape=function(){return!0},s.prototype.initializeControlElements=function(t,e,i,r,o){o&&(this.createControlPoint(e,o,n.MIN_CORNER),this.createControlPoint(e,o,n.MAX_CORNER))},s.prototype.updateControlElements=function(t,i,r){r.length>0&&(r[0].position=new e(t._sector.minLatitude,t._sector.minLongitude),r[1].position=new e(t._sector.maxLatitude,t._sector.maxLongitude))},s.prototype.reshape=function(t,e,i,o,s){i.userProperties.purpose===n.MIN_CORNER?t.sector=new r(o.latitude,t._sector.maxLatitude,o.longitude,t._sector.maxLongitude):i.userProperties.purpose===n.MAX_CORNER&&(t.sector=new r(t._sector.minLatitude,o.latitude,t._sector.minLongitude,o.longitude))},s}),i("util/editor/ShapeEditor",["../../shapes/Annotation","../../shapes/AnnotationAttributes","../../error/ArgumentError","../Color","../Font","../Insets","../../geom/Location","../Logger","../../shapes/Placemark","../../shapes/PlacemarkAttributes","./PlacemarkEditorFragment","../../geom/Position","../Promise","../../layer/RenderableLayer","../../shapes/ShapeAttributes","./ShapeEditorConstants","./SurfaceEllipseEditorFragment","./SurfaceCircleEditorFragment","../../shapes/SurfacePolygon","./SurfacePolygonEditorFragment","./SurfacePolylineEditorFragment","./SurfaceRectangleEditorFragment","./SurfaceSectorEditorFragment","../../geom/Vec2","../../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_,b,w,S,L){"use strict";var T=function(t){if(!t)throw new i(a.logMessage(a.LEVEL_SEVERE,"ShapeEditor","constructor","missingWorldWindow"));this._worldWindow=t,this._shape=null,this._allowMove=!0,this._allowReshape=!0,this._allowRotate=!0,this._allowManageControlPoint=!0,this._moveControlPointAttributes=new h(null),this._moveControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/blue-dot.png",this._moveControlPointAttributes.imageScale=.15,this._shadowControlPointAttributes=new h(null),this._shadowControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/gray-dot.png",this._shadowControlPointAttributes.imageScale=.15,this._resizeControlPointAttributes=new h(null),this._resizeControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/yellow-dot.png",this._resizeControlPointAttributes.imageScale=.15,this._rotateControlPointAttributes=new h(null),this._rotateControlPointAttributes.imageColor=WorldWind.Color.GREEN,this._rotateControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/green-dot.png",this._rotateControlPointAttributes.imageScale=.15,this._annotationAttributes=new e(null),this._annotationAttributes.altitudeMode=WorldWind.CLAMP_TO_GROUND,this._annotationAttributes.cornerRadius=5,this._annotationAttributes.backgroundColor=new r(.67,.67,.67,.8),this._annotationAttributes.leaderGapHeight=0,this._annotationAttributes.drawLeader=!1,this._annotationAttributes.scale=1,this._annotationAttributes.textAttributes.color=r.BLACK,this._annotationAttributes.textAttributes.font=new n(10),this._annotationAttributes.insets=new o(5,5,5,5),this.creatorEnabled=!1,this.creatorShapeProperties=null,this.newCreatedShapeLayer=new p("Shape Editor Shadow Shape"),this.annotation=new WorldWind.Annotation(new WorldWind.Position(0,0,0),this._annotationAttributes),this.editorFragments=[new u,new y,new m,new v,new _,new b,new w],this.controlPointsLayer=new p("Shape Editor Control Points"),this.shadowControlPointsLayer=new p("Shape Editor Shadow Control Points"),this.accessoriesLayer=new p("Shape Editor Accessories"),this.accessoriesLayer.pickEnabled=!1,this.annotationLayer=new p("Shape Editor Annotation"),this.annotationLayer.pickEnabled=!1,this.annotationLayer.enabled=!1,this.annotationLayer.addRenderable(this.annotation),this.shadowShapeLayer=new p("Shape Editor Shadow Shape"),this.shadowShapeLayer.pickEnabled=!1,this.activeEditorFragment=null,this.actionType=null,this.actionControlPoint=null,this.actionControlPosition=null,this.actionSecondaryBehavior=!1,this.actionCurrentX=null,this.actionCurrentY=null,this.originalHighlightAttributes=new f(null),this.originalPlacemarkHighlightAttributes=new h(null),this._clicked0X=null,this._clicked0Y=null,this._clicked1X=null,this._clicked1Y=null,this._click0Time=0,this._click1Time=0,this._dbclickTimeout=0,this._clickDelay=500,this._worldWindow.worldWindowController.addGestureListener(this)};return Object.defineProperties(T.prototype,{worldWindow:{get:function(){return this._worldWindow}},shape:{get:function(){return this._shape}},moveControlPointAttributes:{get:function(){return this._moveControlPointAttributes},set:function(t){this._moveControlPointAttributes=t}},shadowControlPointAttributes:{get:function(){return this._shadowControlPointAttributes},set:function(t){this._shadowControlPointAttributes=t}},resizeControlPointAttributes:{get:function(){return this._resizeControlPointAttributes},set:function(t){this._resizeControlPointAttributes=t}},rotateControlPointAttributes:{get:function(){return this._rotateControlPointAttributes},set:function(t){this._rotateControlPointAttributes=t}},annotationAttributes:{get:function(){return this._annotationAttributes},set:function(t){this._annotationAttributes=t,this.annotation.attributes=t}}}),T.prototype.enableCreator=function(t,e,i){this.stop(),this.setCreatorEnabled(!0);for(var r=0,n=this.editorFragments.length;r "+d.toString()+" ["+t+"]")}}},o}),i("formats/shapefile/DBaseFile",["../../error/ArgumentError","../../util/ByteBuffer","../../formats/shapefile/DBaseField","../../formats/shapefile/DBaseRecord","../../util/Logger"],function(t,e,i,r,n){"use strict"; -var o=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"DBaseFile","constructor","missingUrl"));this.url=e,this.header=null,this.fields=null,this.buffer=null,this.boolean=!0,this.numRecordsRead=0,this._completionCallback=null};return o.prototype.getLastModificationDate=function(){return this.header.lastModificationDate},o.prototype.getNumberOfRecords=function(){return this.header.numberOfRecords},o.prototype.getHeaderLength=function(){return this.header.headerLength},o.prototype.getRecordLength=function(){return this.header.recordLength},o.prototype.getNumberOfFields=function(){return(this.header.headerLength-1-o.FIXED_HEADER_LENGTH)/o.FIELD_DESCRIPTOR_LENGTH},o.prototype.getFields=function(){return this.fields},o.prototype.hasNext=function(){return this.numRecordsRead=this.getNumberOfRecords()?null:this.readNextRecord(this._buffer,++this.numRecordsRead)},o.prototype.load=function(t){this._completionCallback=t,this.requestUrl(this.url)},o.prototype.requestUrl=function(t){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){4===i.readyState&&(200===i.status?(this._buffer=new e(i.response),this.parse(),this._completionCallback&&this._completionCallback(this)):(n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed ("+i.statusText+"): "+t),this._completionCallback&&this._completionCallback(this)))}.bind(this),i.onerror=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed: "+t),this._completionCallback&&this._completionCallback(this)},i.ontimeout=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval timed out: "+t),this._completionCallback&&this._completionCallback(this)},i.send(null)},o.prototype.parse=function(){this.header=this.readHeader(this._buffer),this.fields=this.readFieldDescriptors(this._buffer,this.getNumberOfFields())},o.prototype.readHeader=function(t){var i=t.position;t.order(e.LITTLE_ENDIAN);var r=t.getByte();if(r>5)throw new Error("???");var n=t.getByte(),s=t.getByte(),a=t.getByte(),l=t.getInt32(),h=t.getInt16(),u=t.getInt16(),c={year:1900+n,month:s-1,day:a},d={fileCode:r,lastModificationDate:c,numberOfRecords:l,headerLength:h,recordLength:u};return t.seek(i+o.FIXED_HEADER_LENGTH),d},o.prototype.readFieldDescriptors=function(t,e){for(var r=t.position,n=[],s=0;s=0&&t0&&this._numberOfPoints>0)for(var e=this._buffer.getInt32Array(this.numberOfParts),i=0;i=8*this.numberOfPoints)if(t){this._mValues=this._buffer.getDoubleArray(1);var e=this._mValues[0];this._mRange=[e,e]}else this._mRange=this._buffer.getDoubleArray(2),this._mValues=this._buffer.getDoubleArray(this.numberOfPoints)},s.normalizeLocations=function(e){for(var i=0,r=e.length;i90&&(n=t.normalizedDegreesLatitude(i[1]),i[1]=90,r=!0,i[0]>n&&(i[0]=n)),(i[2]<-180||i[3]>180)&&(i[2]=-180,i[3]=180,r=!0),{coords:i,isNormalized:r}},L.prototype.readProjectedBoundingRectangle=function(t){throw new a(s.log(s.LEVEL_SEVERE,"Shapefile.readProjectedBoundingRectangle() not yet implemented"))},L.prototype.readBoundingRectangleCoordinates=function(t){var e=t.getDouble(),i=t.getDouble(),r=t.getDouble(),n=t.getDouble();return[i,n,e,r]},L.prototype.readRecord=function(t){var e=this.createRecord(t);if(null!=e&&null!=this.attributeFile&&this.attributeFile.hasNext()){var i=this.attributeFile.nextRecord();e.setAttributes(i)}return e},L.prototype.createRecord=function(t){return this.isNullType()?this.createNull(t):this.isPointType()?this.createPoint(t):this.isMultiPointType()?this.createMultiPoint(t):this.isPolygonType()?this.createPolygon(t):this.isPolylineType()?this.createPolyline(t):null},L.prototype.createNull=function(t){return new E(this,t)},L.prototype.createPoint=function(t){return new v(this,t)},L.prototype.createMultiPoint=function(t){return new y(this,t)},L.prototype.createPolyline=function(t){return new b(this,t)},L.prototype.createPolygon=function(t){return new _(this,t)},L.prototype.getShapeType=function(t){switch(t){case 0:return L.NULL;case 1:return L.POINT;case 3:return L.POLYLINE;case 5:return L.POLYGON;case 8:return L.MULTI_POINT;case 11:return L.POINT_Z;case 13:return L.POLYLINE_Z;case 15:return L.POLYGON_Z;case 18:return L.MULTI_POINT_Z;case 21:return L.POINT_M;case 23:return L.POLYLINE_M;case 25:return L.POLYGON_M;case 28:return L.MULTI_POINT_M;default:return null}},L.prototype.isMeasureType=function(){return L.measureTypes.hasOwnProperty(this._shapeType)},L.prototype.isZType=function(){return L.zTypes.hasOwnProperty(this._shapeType)},L.prototype.isNullType=function(){return this._shapeType===L.NULL},L.prototype.isPointType=function(){return L.pointTypes.hasOwnProperty(this._shapeType)},L.prototype.isMultiPointType=function(){return L.multiPointTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolylineType=function(){return L.polylineTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolygonType=function(){return L.polygonTypes.hasOwnProperty(this._shapeType)},L.NULL="null",L.POINT="point",L.MULTI_POINT="multiPoint",L.POLYLINE="polyline",L.POLYGON="polygon",L.POINT_M=L.POINT+"M",L.MULTI_POINT_M=L.MULTI_POINT+"M",L.POLYLINE_M=L.POLYLINE+"M",L.POLYGON_M=L.POLYGON+"M",L.POINT_Z=L.POINT+"Z",L.MULTI_POINT_Z=L.MULTI_POINT+"Z",L.POLYLINE_Z=L.POLYLINE+"Z",L.POLYGON_Z=L.POLYGON+"Z",L.SHAPE_MULTI_PATCH="multiPatch",L.measureTypes={pointM:L.POINT_M,pointZ:L.POINT_Z,multiPointM:L.MULTI_POINT_M,multiPointZ:L.MULTI_POINT_Z,polylineM:L.POLYLINE_M,polylineZ:L.POLYLINE_Z,polygonM:L.POLYGON_M,polygonZ:L.POLYGON_Z},L.zTypes={pointZ:L.POINT_Z,multiPointZ:L.MULTI_POINT_Z,polylineZ:L.POLYLINE_Z,polygonZ:L.POLYGON_Z},L.pointTypes={point:L.POINT,pointZ:L.POINT_Z,pointM:L.POINT_M},L.multiPointTypes={multiPoint:L.MULTI_POINT,multiPointZ:L.MULTI_POINT_Z,multiPointM:L.MULTI_POINT_M},L.polylineTypes={polyline:L.POLYLINE,polylineZ:L.POLYLINE_Z,polylineM:L.POLYLINE_M},L.polygonTypes={polygon:L.POLYGON,polygonZ:L.POLYGON_Z,polygonM:L.POLYGON_M},L.FILE_CODE=9994,L}),i("layer/ShowTessellationLayer",["../shaders/BasicProgram","../layer/Layer"],function(t,e){"use strict";var i=function(){e.call(this,"Show Tessellation"),this.enableTerrainGeometry=!0,this.enableTerrainExtent=!1};return i.prototype=Object.create(e.prototype),i.prototype.doRender=function(t){try{this.beginRendering(t),this.enableTerrainGeometry&&this.drawTerrainGeometry(t),this.enableTerrainExtent&&this.drawTerrainExtent(t)}finally{this.endRendering(t)}},i.prototype.beginRendering=function(t){var e=t.currentGlContext;e.depthMask(!1)},i.prototype.endRendering=function(t){var e=t.currentGlContext;e.depthMask(!0)},i.prototype.drawTerrainGeometry=function(e){if(e.terrain&&e.terrain.tessellator){var i,r,n=e.currentGlContext,o=e.terrain,s=o.tessellator,a=o.surfaceGeometry;try{i=e.findAndBindProgram(t),s.beginRendering(e);for(var l=0,h=a.length;lthis._MAX_GL_POINT_SIZE&&e.log(e.LEVEL_WARNING,"StarFieldLayer - sunSize is to big, max size allowed is: "+this._MAX_GL_POINT_SIZE);var s=n.getAsCelestialLocation(this.time||new Date);this._sunBufferView[0]=s.declination,this._sunBufferView[1]=s.rightAscension,this._sunBufferView[2]=Math.min(this.sunSize,this._MAX_GL_POINT_SIZE), -this._sunBufferView[3]=1,this._sunPositionsCacheKey||(this._sunPositionsCacheKey=o.generateCacheKey());var a=o.resourceForKey(this._sunPositionsCacheKey);a?(i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferSubData(i.ARRAY_BUFFER,0,this._sunBufferView)):(a=i.createBuffer(),o.putResource(this._sunPositionsCacheKey,a,4*this._sunBufferView.length),i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferData(i.ARRAY_BUFFER,this._sunBufferView,i.DYNAMIC_DRAW)),t.frameStatistics.incrementVboLoadCount(1),i.vertexAttribPointer(0,4,i.FLOAT,!1,0,0),r.loadTextureEnabled(i,!0);var l=t.gpuResourceCache.resourceForKey(this._sunImageSource);l.bind(t),i.drawArrays(i.POINTS,0,1)},o.prototype.endRendering=function(t){var e=t.currentGlContext;e.depthMask(!0),e.disableVertexAttribArray(0)},o.prototype.fetchStarData=function(){if(!this._loadStarted){this._loadStarted=!0;var t=this,i=new XMLHttpRequest;i.onload=function(){if(this.status>=200&&this.status<300)try{t._starData=JSON.parse(this.response),t.sendRedrawRequest()}catch(t){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to parse JSON for star data "+t.toString())}else e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data. Status: "+this.status+" "+this.statusText);t._loadStarted=!1},i.onerror=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data"),t._loadStarted=!1},i.ontimeout=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer fetch star data has timeout"),t._loadStarted=!1},i.open("GET",this._starDataSource,!0),i.send()}},o.prototype.createStarsGeometry=function(){var t=this.parseStarsMetadata(this._starData.metadata);if(t.raIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing ra field in star data."));if(t.decIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing dec field in star data."));if(t.magIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing vmag field in star data."));var i=this._starData.data,r=[];this._minMagnitude=Number.MAX_VALUE,this._maxMagnitude=Number.MIN_VALUE;for(var n=0,o=i.length;n65536)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too many positions. Must be fewer than 65537. Use TriangleMesh.split to split the shape."));if(!r)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Indices array is null or undefined"));if(r.length<3)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too few indices."));t.call(this,n),this._positions=i,this._indices=r,this.referencePosition=this._positions[0]};return g.prototype=Object.create(t.prototype),Object.defineProperties(g.prototype,{positions:{get:function(){return this._positions},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","positions","missingPositions"));this._positions=t,this.referencePosition=this._positions[0],this.reset()}},indices:{get:function(){return this._indices},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","indices","Indices array is null or undefined"));this._indices=t,this.meshIndices=null,this.reset()}},outlineIndices:{get:function(){return this._outlineIndices},set:function(t){this._outlineIndices=t,this.meshOutlineIndices=null,this.reset()}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(t){if(t&&t.length!=this._positions.length)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","textureCoordinates","Number of texture coordinates is inconsistent with the currently specified positions."));this._textureCoordinates=t,this.reset(),this.texCoords=null}}}),g.prototype.createSurfaceShape=function(){if(this._outlineIndices){for(var t=[],e=0;e65533&&l.length%3===0){if(s.length>0){var d={positions:s,indices:l};if(i&&(d.textureCoords=a),r){for(var p=[],f=0;f=n.screenOffset.x&&s<=n.screenOffset.x+n.size&&a>=n.screenOffset.y&&a<=n.screenOffset.y+n.size)return n;return null},l.prototype.determineOperation=function(t,e){var i=null;return e&&e instanceof s&&(e===this.panControl?i=this.handlePan:e===this.zoomInControl||e===this.zoomOutControl?i=this.handleZoom:e===this.headingLeftControl||e===this.headingRightControl?i=this.handleHeading:e===this.tiltUpControl||e===this.tiltDownControl?i=this.handleTilt:e===this.exaggerationUpControl||e===this.exaggerationDownControl?i=this.handleExaggeration:e!==this.fovNarrowControl&&e!==this.fovWideControl||(i=this.handleFov)),i},l.prototype.isCurrentTouch=function(t){for(var e=0;e=0?(r=a[0],n=a[1]):(r=a[1],n=a[0]),i+="&VERSION="+this.service.capabilities.version,i+="&COVERAGEID="+this.coverageId,i+="&FORMAT="+e,i+="&SCALESIZE="+s[0]+"("+t.tileWidth+"),",i+=s[1]+"("+t.tileHeight+")",i+="&OVERVIEWPOLICY=NEAREST",i+="&SUBSET="+r+"("+l.minLatitude+","+l.maxLatitude+")",i+="&SUBSET="+n+"("+l.minLongitude+","+l.maxLongitude+")", -encodeURI(i)},i.prototype.fixGetCoverageString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","fixGetMapString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/),r<0&&(i+="&")),i},i}),i("ogc/wcs/WcsCoverage",["../../error/ArgumentError","../../util/Logger","../../ogc/wcs/WcsUrlBuilder"],function(t,e,i){"use strict";var r=function(i,r){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsCoverage","constructor","missingId"));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsCoverage","constructor","missingWebCoverageService"));this.coverageId=i,this.service=r,this.sector=this.service.coverageDescriptions.getSector(this.coverageId),this.resolution=this.service.coverageDescriptions.getResolution(this.coverageId),this.elevationConfig=this.createElevationConfig()};return r.PREFERRED_FORMATS={GeoTIFF:!0,"image/tiff":!0,TIFF:!0},r.DEFAULT_FORMAT="image/tiff",r.prototype.createElevationConfig=function(){return{resolution:this.resolution,coverageSector:this.sector,retrievalImageFormat:this.determineFormatFromService(),urlBuilder:new i(this.coverageId,this.service)}},r.prototype.determineFormatFromService=function(){var t,e,i,n=this.service.capabilities.version;if("1.0.0"===n){for(e=0,i=this.service.coverageDescriptions.coverages.length;e0?n:"1.0.0",this.crs="EPSG:4326"};return i.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","The coverage format is null or undefined."));var o=r.sector,s=i.fixGetCoverageString(this.serviceAddress);return s.search(/service=wcs/i)<0&&(s+="service=WCS"),s+="&request=GetCoverage",s=s+"&version="+this.wcsVersion,s=s+"&coverage="+this.coverageName,s=s+"&format="+n,s=s+"&width="+r.tileWidth,s=s+"&height="+r.tileHeight,s=s+"&crs="+this.crs,s+="&bbox=",s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude,s=s.replace(" ","%20")},i.fixGetCoverageString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsTileUrlBuilder","fixGetCoverageString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/),r<0&&(i+="&")),i},i}),i("globe/WcsEarthElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WcsTileUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:e.FULL_SPHERE,resolution:.008333333333333,retrievalImageFormat:"image/tiff",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/wms2","NASA_SRTM30_900m_Tiled","1.0.0")}),this.displayName="WCS Earth Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("ogc/wcs/WebCoverageService",["../../error/ArgumentError","../../util/Logger","../../util/Promise","../../ogc/wcs/WcsCapabilities","../../ogc/wcs/WcsCoverage","../../ogc/wcs/WcsCoverageDescriptions"],function(t,e,i,r,n,o){"use strict";var s=function(){this.serviceAddress=null,this.coverages=[],this.capabilities=null,this.coverageDescriptions=null};return s.WCS_XLMNS="http://www.opengis.net/wcs",s.WCS_2_XLMNS="http://www.opengis.net/wcs/2.0",s.create=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WebCoverageService","constructor","missingUrl"));var r=new s;return r.serviceAddress=i,r.retrieveCapabilities().then(function(t){return r.capabilities=t,r.retrieveCoverageDescriptions(t)}).then(function(t){return r.parseCoverages(t),r})},s.prototype.getCoverage=function(t){},s.prototype.retrieveCapabilities=function(){var t,e=this;return e.retrieveXml(e.buildCapabilitiesXmlRequest("2.0.1")).then(function(i){return t=i.documentElement.getAttribute("version"),"2.0.1"===t||"2.0.0"===t?i:e.retrieveXml(e.buildCapabilitiesXmlRequest("1.0.0"))}).then(function(t){return new r(t)})},s.prototype.retrieveCoverageDescriptions=function(){return this.retrieveXml(this.buildDescribeCoverageXmlRequest())},s.prototype.parseCoverages=function(t){this.coverageDescriptions=new o(t);for(var e,i,r=this.coverageDescriptions.coverages.length,s=0;s0&&""!=o[0]&&this.setOptions(o,r);var s=i[e]&&new i[e];s||(s=new n),o&&o.length>0&&""!=o[0]&&s.setOptions(o[0],s),this.add(s)}},n.prototype.rightParenthesis=function(t){t.rightParenthesis++,t.coordinates&&(this.addCoordinates(t.coordinates),t.coordinates=null)},n.prototype.leftParenthesis=function(t){t.leftParenthesis++},n.prototype.comma=function(t){t.coordinates?(this.addCoordinates(t.coordinates),t.coordinates=null):this.commaWithoutCoordinates(t)},n.prototype.commaWithoutCoordinates=function(t){},n.prototype.number=function(t,e){t.coordinates=t.coordinates||[],t.coordinates.push(e)},n.prototype.setOptions=function(t,e){"Z"==t?e.set3d():"M"==t?e.setLrs():"MZ"==t&&(e.set3d(),e.setLrs())},n.prototype.isFinished=function(){return this.options.leftParenthesis===this.options.rightParenthesis&&this.options.leftParenthesis>0},n}),i("formats/wkt/WktTokens",["./WktElements","./geom/WktObject","./WktType"],function(t,e,i){var r=function(t){this.sourceText=t};return r.prototype.objects=function(){var i,r=[];return this.tokenize(this.sourceText).forEach(function(n){if(i&&i.isFinished()||!i){var o=n.value,s=o.match("[M]?[Z]?$");s&&s.length>0&&""!=s[0]&&(o=o.substring(0,o.length-s.length)),i=t[o]&&new t[o],i||(i=new e),s&&s.length>0&&""!=s[0]&&i.setOptions(s[0],i),r.push(i)}else i.handleToken(n)}),r},r.prototype.tokenize=function(t){this.currentPosition=0;for(var e=[];this.currentPosition="a"&&t<="z"||t>="A"&&t<="Z"},r.prototype.isNumeric=function(t){return t>="0"&&t<="9"||"."==t||"-"==t},r.prototype.isWhiteSpace=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},r.prototype.readText=function(t){for(var e="";this.isAlpha(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,e},r.prototype.readNumeric=function(t){for(var e="";this.isNumeric(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,Number(e)},r}),i("formats/wkt/Wkt",["../../error/ArgumentError","../../util/Logger","./WktTokens"],function(t,e,i){var r=function(t){this.textRepresentation=t,this._parserCompletionCallback=this.defaultParserCompletionCallback,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this._layer=null};return Object.defineProperties(r.prototype,{parserCompletionCallback:{ -get:function(){return this._parserCompletionCallback}},shapeConfigurationCallback:{get:function(){return this._shapeConfigurationCallback}},layer:{get:function(){return this._layer}}}),r.prototype.load=function(t,e,r){r&&(this._layer=r),t&&(this._parserCompletionCallback=t),e&&(this._shapeConfigurationCallback=e),this.parserCompletionCallback(this,new i(this.textRepresentation).objects())},r.prototype.defaultShapeConfigurationCallback=function(t){},r.prototype.defaultParserCompletionCallback=function(t,e){var i=t.shapeConfigurationCallback,r=[];e.forEach(function(t){t.shapes().forEach(function(e){var n=i(t);n&&n.attributes&&(e.attributes=n.attributes),n&&n.highlightAttributes&&(e.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(e.pickDelegate=n.pickDelegate),n&&n.userProperties&&(e.userProperties=n.userProperties),r.push(e)})}),t.layer&&t.layer.addRenderables(r)},r}),i("formats/wkt/WktExporter",["../../error/ArgumentError","../../util/Logger","./WktType"],function(t,e,i){"use strict";var r={exportRenderable:function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WktExporter","exportRenderable","missingRenderable"));return i instanceof WorldWind.Placemark?this.exportPlacemark(i):i instanceof WorldWind.Path?this.exportPath(i):i instanceof WorldWind.Polygon?this.exportPolygon(i):i instanceof WorldWind.SurfacePolyline?this.exportSurfacePolyline(i):i instanceof WorldWind.SurfacePolygon?this.exportSurfacePolygon(i):i instanceof WorldWind.SurfaceEllipse?this.exportSurfaceEllipse(i):i instanceof WorldWind.SurfaceCircle?this.exportSurfaceCircle(i):i instanceof WorldWind.SurfaceRectangle?this.exportSurfaceRectangle(i):i instanceof WorldWind.SurfaceSector?this.exportSurfaceSector(i):(e.log(e.LEVEL_WARNING,"Export renderable not implemented: "+i),null)},exportRenderables:function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WktExporter","exportRenderables","missingRenderables"));if(0!=r.length){if(r.length>1){for(var n=i.SupportedGeometries.GEOMETRY_COLLECTION+"(",o=0;o0&&r.boundaries[0].length>2){for(var o=0;o0&&r.boundaries[0].length>2){for(var o=0;o=0?i.format="image/png":s.indexOf("image/jpeg")>=0?i.format="image/jpeg":s.indexOf("image/tiff")>=0?i.format="image/tiff":s.indexOf("image/gif")>=0&&(i.format="image/gif"),i.service=o.getUrl;var l=t.crses;l||(l=t.srses),l&&(l.indexOf("EPSG:4326")>=0||l.indexOf("epsg:4326")>=0?i.coordinateSystem="EPSG:4326":(l.indexOf("CRS84")>=0||l.indexOf("CRS:84")>=0)&&(i.coordinateSystem="CRS:84"));var h=a.parseTimeDimensions(t);return h&&h.length>0&&(i.timeSequences=h),i},a.parseTimeDimensions=function(t){var e=t.extents||t.dimensions,i=null;if(e){i=[];for(var n=0;n0){var y=L.perspectiveNearDistance(c.width,c.height,g);f>y&&(f=y)}f<1&&(f=1),e.setToPerspectiveProjection(c.width,c.height,f,p)}},T.prototype.computePixelMetrics=function(t){var e=f.fromIdentity();e.invertMatrix(t);var i=new S(-1,-1,-1),r=new S(1,1,-1),n=new S(-1,-1,1),o=new S(1,1,1);i.multiplyByMatrix(e),r.multiplyByMatrix(e),n.multiplyByMatrix(e),o.multiplyByMatrix(e);var s=L.fabs(r[0]-i[0]),a=L.fabs(o[0]-n[0]),l=-i[2],h=-n[2],u=(a-s)/(h-l),c=s-u*l;return{pixelSizeFactor:u/this.viewport.width,pixelSizeOffset:c/this.viewport.height}},T.prototype.pixelSizeAtDistance=function(t){this.computeViewingTransform(this.scratchProjection,this.scratchModelview);var e=this.computePixelMetrics(this.scratchProjection);return e.pixelSizeFactor*t+e.pixelSizeOffset},T.prototype.computeDrawContext=function(){var t=this.drawContext;this.computeViewingTransform(t.projection,t.modelview),t.viewport=this.viewport,t.eyePoint=t.modelview.extractEyePoint(new S(0,0,0)),t.modelviewProjection.setToIdentity(),t.modelviewProjection.setToMultiply(t.projection,t.modelview);var e=this.computePixelMetrics(t.projection);t.pixelSizeFactor=e.pixelSizeFactor,t.pixelSizeOffset=e.pixelSizeOffset;var i=f.fromIdentity();i.invertOrthonormalMatrix(t.modelview),t.modelviewNormalTransform=f.fromIdentity().setToTransposeOfMatrix(i.upper3By3());var r=f.fromIdentity();r.setToTransposeOfMatrix(t.modelview),t.frustumInModelCoordinates=o.fromProjectionMatrix(t.projection),t.frustumInModelCoordinates.transformByMatrix(r),t.frustumInModelCoordinates.normalize()},T.prototype.resetDrawContext=function(){this.globe.offset=0;var t=this.drawContext;t.reset(),t.globe=this.globe,t.navigator=this.navigator,t.layers=this.layers.slice(),t.layers.push(t.screenCreditController),this.computeDrawContext(),t.verticalExaggeration=this.verticalExaggeration,t.surfaceOpacity=this.surfaceOpacity,t.deepPicking=this.deepPicking,t.frameStatistics=this.frameStatistics,t.pixelScale=this.pixelScale,t.update()},T.prototype.drawFrame=function(){try{this.drawContext.frameStatistics.beginFrame(),this.beginFrame(),this.drawContext.globe.is2D()&&this.drawContext.globe.continuous?this.do2DContiguousRepaint():this.doNormalRepaint()}finally{this.endFrame(),this.drawContext.frameStatistics.endFrame()}},T.prototype.doNormalRepaint=function(){this.createTerrain(),this.clearFrame(),this.deferOrderedRendering=!1,this.drawContext.pickingMode?this.drawContext.makePickFrustum()&&(this.doPick(),this.resolvePick()):(this.doDraw(),this.subsurfaceMode&&this.hasStencilBuffer&&(this.redrawSurface(),this.drawScreenRenderables()))},T.prototype.do2DContiguousRepaint=function(){this.createTerrain2DContiguous(),this.clearFrame(),this.drawContext.pickingMode?this.drawContext.makePickFrustum()&&(this.pick2DContiguous(),this.resolvePick()):this.draw2DContiguous()},T.prototype.resolvePick=function(){this.drawContext.pickTerrainOnly?this.resolveTerrainPick():this.drawContext.regionPicking?this.resolveRegionPick():this.resolveTopPick()},T.prototype.beginFrame=function(){var t=this.drawContext.currentGlContext;t.enable(t.BLEND),t.enable(t.CULL_FACE),t.enable(t.DEPTH_TEST),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.depthFunc(t.LEQUAL),this.drawContext.pickingMode&&(this.drawContext.makePickFramebuffer(),this.drawContext.bindFramebuffer(this.drawContext.pickFramebuffer))},T.prototype.endFrame=function(){var t=this.drawContext.currentGlContext;t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.blendFunc(t.ONE,t.ZERO),t.depthFunc(t.LESS),t.clearColor(0,0,0,1),this.drawContext.bindFramebuffer(null),this.drawContext.bindProgram(null)},T.prototype.clearFrame=function(){var t=this.drawContext,e=t.currentGlContext;e.clearColor(t.clearColor.red,t.clearColor.green,t.clearColor.blue,t.clearColor.alpha),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)},T.prototype.doDraw=function(){this.drawContext.renderShapes=!0,this.subsurfaceMode&&this.hasStencilBuffer?(this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawContext.currentGlContext.clear(this.drawContext.currentGlContext.DEPTH_BUFFER_BIT|this.drawContext.currentGlContext.STENCIL_BUFFER_BIT),this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.ALWAYS,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE),this.drawOrderedRenderables())):(this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawOrderedRenderables(),this.drawScreenRenderables()))},T.prototype.redrawSurface=function(){this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.EQUAL,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.KEEP,this.drawContext.currentGlContext.KEEP,this.drawContext.currentGlContext.KEEP),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!1),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST)},T.prototype.doPick=function(){this.drawContext.terrain&&this.drawContext.terrain.pick(this.drawContext),this.drawContext.pickTerrainOnly||(this.subsurfaceMode&&this.hasStencilBuffer?(this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawContext.currentGlContext.clear(this.drawContext.currentGlContext.DEPTH_BUFFER_BIT|this.drawContext.currentGlContext.STENCIL_BUFFER_BIT),this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.ALWAYS,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE),this.drawOrderedRenderables(),this.drawContext.terrain.pick(this.drawContext),this.drawScreenRenderables())):(this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawOrderedRenderables(),this.drawScreenRenderables())))},T.prototype.createTerrain=function(){var t=this.drawContext;t.terrain=this.globe.tessellator.tessellate(t),t.frameStatistics.setTerrainTileCount(t.terrain?t.terrain.surfaceGeometry.length:0)},T.prototype.makeCurrent=function(t){ -var e=this.drawContext;switch(e.globe.offset=t,e.globeStateKey=e.globe.stateKey,t){case-1:e.terrain=this.terrainLeft;break;case 0:e.terrain=this.terrainCenter;break;case 1:e.terrain=this.terrainRight}},T.prototype.createTerrain2DContiguous=function(){var t=this.drawContext;this.terrainCenter=null,t.globe.offset=0,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainCenter=t.globe.tessellator.tessellate(t)),this.terrainRight=null,t.globe.offset=1,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainRight=t.globe.tessellator.tessellate(t)),this.terrainLeft=null,t.globe.offset=-1,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainLeft=t.globe.tessellator.tessellate(t))},T.prototype.draw2DContiguous=function(){var t="";this.terrainCenter&&(t+=" 0 ",this.makeCurrent(0),this.deferOrderedRendering=this.terrainLeft||this.terrainRight,this.doDraw()),this.terrainRight&&(t+=" 1 ",this.makeCurrent(1),this.deferOrderedRendering=this.terrainLeft||this.terrainLeft,this.doDraw()),this.deferOrderedRendering=!1,this.terrainLeft&&(t+=" -1 ",this.makeCurrent(-1),this.doDraw()),this.subsurfaceMode&&this.hasStencilBuffer&&(this.deferOrderedRendering=!0,this.terrainCenter&&(t+=" 0 ",this.makeCurrent(0),this.redrawSurface()),this.terrainRight&&(t+=" 1 ",this.makeCurrent(1),this.redrawSurface()),this.terrainLeft&&(t+=" -1 ",this.makeCurrent(-1),this.redrawSurface())),this.drawScreenRenderables()},T.prototype.pick2DContiguous=function(){this.terrainCenter&&(this.makeCurrent(0),this.deferOrderedRendering=this.terrainLeft||this.terrainRight,this.doPick()),this.terrainRight&&(this.makeCurrent(1),this.deferOrderedRendering=this.terrainLeft||this.terrainLeft,this.doPick()),this.deferOrderedRendering=!1,this.terrainLeft&&(this.makeCurrent(-1),this.doPick())},T.prototype.drawLayers=function(t){var e,i=Date.now(),r=this.drawContext,n=r.layers;r.accumulateOrderedRenderables=t;for(var o=0,s=n.length;o=0&&this.layers.splice(e,1)},T.prototype.insertLayer=function(t,e){e&&this.layers.splice(t,0,e)},T.prototype.indexOfLayer=function(t){return this.layers.indexOf(t)},T.prototype.drawSurfaceRenderables=function(){var t,e=this.drawContext;for(e.reverseSurfaceRenderables();t=e.popSurfaceRenderable();)try{t.renderSurface(e)}catch(t){d.logMessage(d.LEVEL_WARNING,"WorldWindow","drawSurfaceRenderables","Error while rendering a surface renderable.\n"+t.message)}},T.prototype.drawOrderedRenderables=function(){var t,e=Date.now(),i=this.drawContext;if(i.sortOrderedRenderables(),this._orderedRenderingFilters)for(var r=0;r=0&&t.indexOf("4326")>=0},d.isEpsg3857Crs=function(t){return t.indexOf("EPSG")>=0&&(t.indexOf("3857")>=0||t.indexOf("900913")>=0)},d.isOGCCrs84=function(t){return t.indexOf("OGC")>=0&&t.indexOf("CRS84")>=0},d}),i("layer/OpenStreetMapImageLayer",["../util/Color","../layer/Layer","../util/Logger","../ogc/wmts/WmtsCapabilities","../layer/WmtsLayer"],function(t,e,i,r,n){"use strict";var o=function(t){e.call(this,this.displayName),this.displayName=t||"Open Street Map",this.layer=null,this.xhr=null,this.pickEnabled=!0};return o.prototype=Object.create(e.prototype),o.prototype.doRender=function(e){this.configureLayer(e),this.layer&&(this.layer.opacity=this.opacity,this.layer.doRender(e),this.inCurrentFrame=this.layer.inCurrentFrame,this.inCurrentFrame&&(e.screenCreditController.addCredit("OpenStreetMap ©",t.DARK_GRAY),e.screenCreditController.addCredit("EOX.at ©",t.DARK_GRAY)))},o.prototype.configureLayer=function(t){if(!this.xhr){var e=this,o=t.currentGlContext.canvas;this.xhr=new XMLHttpRequest,this.xhr.open("GET","https://tiles.maps.eox.at/wmts/1.0.0/WMTSCapabilities.xml",!0),this.xhr.onreadystatechange=function(){if(4===e.xhr.readyState)if(200===e.xhr.status){var t=new r(e.xhr.responseXML),s=t.getLayer("osm"),a=n.formLayerConfiguration(s);a.title=e.displayName,e.layer=new n(a);var l=document.createEvent("Event");l.initEvent(WorldWind.REDRAW_EVENT_TYPE,!0,!0),o.dispatchEvent(l)}else i.log(i.LEVEL_WARNING,"OSM retrieval failed ("+xhr.statusText+"): "+url)},this.xhr.onerror=function(){i.log(i.LEVEL_WARNING,"OSM retrieval failed: "+url)},this.xhr.ontimeout=function(){i.log(i.LEVEL_WARNING,"OSM retrieval timed out: "+url)},this.xhr.send(null)}},o}),i("projections/ProjectionGnomonic",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../util/WWMath"],function(t,e,i,r,n,o){"use strict";var s=function(t){this.north=!("South"===t);var e=this.north?new n(30,90,-180,180):new n(-90,-30,-180,180);i.call(this,"Polar Gnomonic",!1,e),this._pole=t,this.displayName=this.north?"North Gnomonic":"South Gnomonic",this._stateKey="projection polar gnomonic "+this._pole+" "};return s.prototype=Object.create(i.prototype),Object.defineProperties(s.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this.projectionLimits=this.north?new n(30,90,-180,180):new n(-90,-30,-180,180),this._stateKey="projection polar gnomonic "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),s.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&n===-90)l[0]=0,l[1]=0,l[2]=s;else{var h=this.north?1:-1,u=i.equatorialRadius/Math.tan(n*t.DEGREES_TO_RADIANS);l[0]=u*Math.sin(o*t.DEGREES_TO_RADIANS)*h,l[1]=u*-Math.cos(o*t.DEGREES_TO_RADIANS),l[2]=s}return l},s.prototype.geographicToCartesianGrid=function(i,n,s,a,l,h,u,c){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","geographicToCartesianGrid","missingSector"));if(!l||l.length1?s-1:1),S=(b-_)/(a>1?a-1:1),L=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,T=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,R=this.north?1:-1,x=h?h:new Vec3(0,0,0),M=0,C=0;for(d=0,f=E;dMath.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},s.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},s.prototype.northTangentAtPoint=function(t,i,n,o,s,a){if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionGnomonic","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},s}),i("projections/ProjectionMercator",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(){i.call(this,"Mercator",!0,new n(-78,78,-180,180))};return a.prototype=Object.create(i.prototype),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionMercator","geographicToCartesian","missingResult"));n>this.projectionLimits.maxLatitude&&(n=this.projectionLimits.maxLatitude),n1?a-1:1),M=(R-T)/(l>1?l-1:1),C=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,A=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,P=u?u:new o(0,0,0),O=c?c[0]:0,N=0,I=0;for(p=0,g=S;p1?o-1:1),w=(_-v)/(s>1?s-1:1),S=this.north?-1:1,L=l?l:new Vec3(0,0,0),T=Math.PI/2,R=0,x=0,M=new Float64Array(s),C=new Float64Array(s);for(d=0,f=v;dMath.PI&&(h=Math.PI),l.latitude=Math.asin(Math.cos(h)*(this.north?1:-1))*t.RADIANS_TO_DEGREES,l.longitude=Math.atan2(n,o*(this.north?-1:1))*t.RADIANS_TO_DEGREES,l.altitude=s),l},n.prototype.northTangentAtLocation=function(i,n,o,s){if(!s)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));return s[0]=Math.sin(o*t.DEGREES_TO_RADIANS)*(this.north?-1:1),s[1]=Math.cos(o*t.DEGREES_TO_RADIANS),s[2]=0,s},n.prototype.northTangentAtPoint=function(t,i,n,o,s,a){if(!a)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionPolarEquidistant","northTangentAtLocation","missingResult"));var l=Math.sqrt(i*i+n*n);return l<1e-4?(a[0]=0,a[1]=1,a[2]=0):(a[0]=i/l*(this.north?-1:1),a[1]=n/l*(this.north?-1:1),a[2]=0),a},n}),i("projections/ProjectionUPS",["../geom/Angle","../error/ArgumentError","../projections/GeographicProjection","../util/Logger","../geom/Sector","../geom/Vec3","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t){this.north=!("South"===t);var e=this.north?new n(0,90,-180,180):new n(-90,0,-180,180);i.call(this,"Uniform Polar Stereographic",!1,e),this._pole=t,this.displayName=this.north?"North UPS":"South UPS",this._stateKey="projection ups "+this._pole+" "};return a.prototype=Object.create(i.prototype),Object.defineProperties(a.prototype,{pole:{get:function(){return this._pole},set:function(t){this._pole=t,this.north=!("South"===this._pole),this.projectionLimits=this.north?new n(0,90,-180,180):new n(-90,0,-180,180),this._stateKey="projection ups "+this._pole+" "}},stateKey:{get:function(){return this._stateKey}}}),a.prototype.geographicToCartesian=function(i,n,o,s,a,l){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingGlobe"));if(!l)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesian","missingResult"));if(this.north&&90===n||!this.north&&n===-90)l[0]=0,l[1]=0,l[2]=s;else{var h,u,c,d=this.north?1:-1,p=n*t.DEGREES_TO_RADIANS,f=o*t.DEGREES_TO_RADIANS,g=.994,m=Math.sqrt(i.eccentricitySquared),y=Math.sqrt(Math.pow(1+m,1+m)*Math.pow(1-m,1-m));(this.north&&p<0||!this.north&&p>0)&&(p=0),h=Math.sin(p*d),u=Math.sqrt((1-h)/(1+h)*Math.pow((1+m*h)/(1-m*h),m)),c=2*i.equatorialRadius*g*u/y,l[0]=c*Math.sin(f),l[1]=-c*Math.cos(f)*d,l[2]=s}return l},a.prototype.geographicToCartesianGrid=function(i,n,a,l,h,u,c,d){if(!i)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingGlobe"));if(!n)throw new e(r.logMessage(r.LEVEL_SEVERE,"ProjectionUPS","geographicToCartesianGrid","missingSector"));if(!h||h.length1?a-1:1),x=(T-L)/(l>1?l-1:1),M=this.projectionLimits.minLatitude*t.DEGREES_TO_RADIANS,C=this.projectionLimits.maxLatitude*t.DEGREES_TO_RADIANS,A=.994,P=Math.sqrt(i.eccentricitySquared),O=Math.sqrt(Math.pow(1+P,1+P)*Math.pow(1-P,1-P)),N=this.north?1:-1,I=u?u:new o(0,0,0),D=0,k=0;for(p=0,g=w;pt.TWO_PI&&(r%=t.TWO_PI),t.RADIANS_TO_DEGREES*(r>=0?r:r+t.TWO_PI)},u.prototype.deepCopyLocations=function(t){var e=[];if(t.length>0&&Array.isArray(t[0]))for(var r=0,n=t.length;r0&&Array.isArray(e[0]))for(var o=0,a=e.length;o0&&Array.isArray(n[0]))for(var l=0,h=n.length;ln.magnitude()?o.copy(i):new e(t,s).pointAt(l,o)},u.prototype.computeShadowPointLocations=function(t,e,r,n){var o=null,s=null;t.pathType===WorldWind.LINEAR?e.position=new i((r.latitude+n.latitude)/2,(r.longitude+n.longitude)/2):t.pathType===WorldWind.RHUMB_LINE?(null==o&&(o=i.rhumbAzimuth(r,n),s=i.rhumbDistance(r,n)),e.position=i.rhumbLocation(r,o,.5*s,e.position)):(null==o&&(o=i.greatCircleAzimuth(r,n),s=i.greatCircleDistance(r,n)),e.position=i.greatCircleLocation(r,o,.5*s,e.position))},u}),i("util/editor/ShapeEditorConstants",[],function(){"use strict";var t={LOCATION:"location",ROTATION:"rotation",WIDTH:"width",HEIGHT:"height",RADIUS:"radius",DRAG:"drag",MIN_CORNER:"min_corner",MAX_CORNER:"max_corner",SHADOW:"shadow"};return t}),i("util/editor/PlacemarkEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","./ShapeEditorConstants","../../shapes/Placemark"],function(t,e,i,r){"use strict";var n=function(){};return n.prototype=Object.create(t.prototype),n.prototype.canHandle=function(t){return t instanceof r},n.prototype.createShadowShape=function(t){return new r(t.position,null,t.attributes)},n.prototype.getShapeCenter=function(t){return t.position},n.prototype.initializeControlElements=function(t,e,r,n,o,s,a){a&&(t.userProperties.purpose=i.DRAG,e.push(t))},n.prototype.updateControlElements=function(t,e,i){i[0].position=t.position},n.prototype.reshape=function(t,e,i,r,n){return!1},n}),i("shapes/SurfaceEllipse",["../geom/Angle","../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape","../util/WWMath"],function(t,e,i,r,n,o,s){"use strict";var a=function(t,i,n,s,l){if(!t)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceEllipse","constructor","missingLocation"));if(i<0||n<0)throw new e(r.logMessage(r.LEVEL_SEVERE,"SurfaceEllipse","constructor","Radius is negative."));o.call(this,l),this._center=t,this._majorRadius=i,this._minorRadius=n,this._heading=s,this._intervals=a.DEFAULT_NUM_INTERVALS};return a.prototype=Object.create(o.prototype),Object.defineProperties(a.prototype,{center:{get:function(){return this._center},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._center=t}},majorRadius:{get:function(){return this._majorRadius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._majorRadius=t}},minorRadius:{get:function(){return this._minorRadius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._minorRadius=t}},heading:{get:function(){return this._heading},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._heading=t}},intervals:{get:function(){return this._intervals},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._intervals=t}}}),a.staticStateKey=function(t){var e=o.staticStateKey(t);return e+" ce "+t.center.toString()+" ma "+t.majorRadius.toString()+" mi "+t.minorRadius.toString()+" he "+t.heading.toString()+" in "+t.intervals.toString()},a.prototype.computeStateKey=function(){return a.staticStateKey(this)},a.prototype.computeBoundaries=function(e){if(0==this.majorRadius&&0==this.minorRadius)return null;var r=e.globe,n=1+Math.max(a.MIN_NUM_INTERVALS,this.intervals),o=2*Math.PI/(n-1),l=r.radiusAt(this.center.latitude,this.center.longitude);this._boundaries=new Array(n);for(var h=0;h0)for(var l=0;l0&&(t.majorRadius=h)}else if(n.userProperties.purpose===i.HEIGHT){var u=t.minorRadius+2*a.dot(l);u>0&&(t.minorRadius=u)}else if(n.userProperties.purpose===i.ROTATION){var c=e.greatCircleAzimuth(t.center,s),d=e.greatCircleAzimuth(t.center,o)-c;t.heading=this.normalizedHeading(t.heading,d)}},n}),i("shapes/SurfaceCircle",["../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r,n){"use strict";var o=function(e,r,s){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceCircle","constructor","missingLocation"));if(r<0)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceCircle","constructor","Radius is negative"));n.call(this,s),this._center=e,this._radius=r,this._intervals=o.DEFAULT_NUM_INTERVALS};return o.prototype=Object.create(n.prototype),Object.defineProperties(o.prototype,{center:{get:function(){return this._center},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._center=t}},radius:{get:function(){return this._radius},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._radius=t}},intervals:{get:function(){return this._intervals},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._intervals=t}}}),o.staticStateKey=function(t){var e=n.staticStateKey(t);return e+" ce "+t.center.toString()+" ra "+t.radius.toString()},o.prototype.computeStateKey=function(){return o.staticStateKey(this)},o.prototype.computeBoundaries=function(t){if(0===this.radius)return null;var i=1+Math.max(o.MIN_NUM_INTERVALS,this.intervals),r=360/(i-1),n=this.radius/t.globe.radiusAt(this.center.latitude,this.center.longitude);this._boundaries=new Array(i);for(var s=0;s0&&(e.greatCircleLocation(t.center,90,t.radius/i.equatorialRadius,r[0].position),r[0].userProperties.size=t.radius)},n.prototype.reshape=function(t,e,r,n,o){if(r.userProperties.purpose===i.RADIUS){var s=this.computeControlPointDelta(e,n,o),a=this.computeControlPointDelta(e,r.position,t.center).normalize(),l=t.radius+s.dot(a);l>0&&(t.radius=l)}},n}),i("util/editor/SurfacePolygonEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","../../geom/Position","./ShapeEditorConstants","../../shapes/SurfacePolygon","../../geom/Vec3"],function(t,e,i,r,n,o){"use strict";var s=function(){this.currentHeading=0,this.moveControlPointAttributes=null,this.shadowControlPointAttributes=null};return s.prototype=Object.create(t.prototype),s.prototype.canHandle=function(t){return t instanceof Function?"SurfacePolygon"===t.name:t instanceof n},s.prototype.createShadowShape=function(t){return new n(this.deepCopyLocations(t.boundaries),t.attributes)},s.prototype.getShapeCenter=function(t,e){return this.getCenterFromLocations(e,t.boundaries)},s.prototype.isRegularShape=function(){return!1},s.prototype.initializeControlElements=function(t,e,i,n,o,s,a,l){if(this.currentHeading=0,a){this.moveControlPointAttributes=a,this.shadowControlPointAttributes=l;for(var h=this.getLocations(t),u=0,c=h.length;u-1;d--){if(n[d].userProperties.purpose===r.ROTATION){c=n[d];var p=this.getCenterFromLocations(i,a),f=1.2*this.getAverageDistance(i,p,a);e.greatCircleLocation(p,this.currentHeading,f,c.position),c.userProperties.rotation=this.currentHeading,this.updateRotationAccessory(p,c.position,s)}else u.push(n[d]);n.pop()}u.reverse();for(var g=u.length,d=0;d=g&&this.createControlPoint(u,this.moveControlPointAttributes,r.LOCATION,d),u[d].position=a[d];u.length>l&&u.splice(l,u.length-l);for(var d=0;d0&&Array.isArray(c[0])){for(var p=-1,f=0,g=-1,m=0;mu&&(p=m,g=u-f),f+=y}if(p!==-1){var E=c[p];E.length>3?E.splice(g,1):d>2&&c.splice(p,1)}}else c.length>3&&c.splice(u,1)}else this.moveLocation(e,i,s,o,l[u]);t.resetBoundaries(),t._stateId=n.stateId++,t.stateKeyInvalid=!0}},s.prototype.addNewVertex=function(t,e,r){var s=new o(0,0,0),a=new o(0,0,0),l=new o(0,0,0),h=t.boundaries,u=e.computePointFromPosition(r.latitude,r.longitude,0,new o(0,0,0)),c=new o(0,0,0),d=-1,p=Number.MAX_VALUE;if(Array.isArray(t.boundaries[0])){for(var f=-1,g=0,m=h.length;g0&&Array.isArray(t.boundaries[0]))for(var i=0,r=t.boundaries.length;i-1;d--){if(n[d].userProperties.purpose===r.ROTATION){c=n[d];var p=this.getCenterFromLocations(i,a),f=1.2*this.getAverageDistance(i,p,a);e.greatCircleLocation(p,this.currentHeading,f,c.position),c.userProperties.rotation=this.currentHeading,this.updateRotationAccessory(p,c.position,s)}else u.push(n[d]);n.pop()}u.reverse();for(var g=u.length,d=0;d=g&&this.createControlPoint(u,this.moveControlPointAttributes,r.LOCATION,d),u[d].position=a[d];u.length>l&&u.splice(l,u.length-l);for(var d=0;d2&&l.splice(u,1):this.moveLocation(e,i,s,o,l[u]),t.resetBoundaries(),t._stateId=n.stateId++,t.stateKeyInvalid=!0}},s.prototype.addNewVertex=function(t,e,r){for(var s=new o(0,0,0),a=new o(0,0,0),l=new o(0,0,0),h=t.boundaries,u=e.computePointFromPosition(r.latitude,r.longitude,0,new o(0,0,0)),c=new o(0,0,0),d=-1,p=Number.MAX_VALUE,f=1,g=h.length;f0)for(var l=0;l0&&(t.width=h)}else if(n.userProperties.purpose===i.HEIGHT){var u=t.height+2*a.dot(l);u>0&&(t.height=u)}else if(n.userProperties.purpose===i.ROTATION){var c=e.greatCircleAzimuth(t.center,s),d=e.greatCircleAzimuth(t.center,o)-c;t.heading=this.normalizedHeading(t.heading,d)}},n}),i("shapes/SurfaceSector",["../error/ArgumentError","../geom/Location","../util/Logger","../shapes/ShapeAttributes","../shapes/SurfaceShape"],function(t,e,i,r,n){"use strict";var o=function(e,r){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"SurfaceSector","constructor","missingSector"));n.call(this,r),this._sector=e};return o.prototype=Object.create(n.prototype),Object.defineProperties(o.prototype,{sector:{get:function(){return this._sector},set:function(t){this.stateKeyInvalid=!0,this.resetBoundaries(),this._sector=t}}}),o.staticStateKey=function(t){var e=n.staticStateKey(t);return e},o.prototype.computeStateKey=function(){return o.staticStateKey(this)},o.prototype.computeBoundaries=function(t){var i=this._sector;this._boundaries=new Array(4),this._boundaries[0]=new e(i.minLatitude,i.minLongitude),this._boundaries[1]=new e(i.maxLatitude,i.minLongitude),this._boundaries[2]=new e(i.maxLatitude,i.maxLongitude),this._boundaries[3]=new e(i.minLatitude,i.maxLongitude)},o.prototype.getReferencePosition=function(){return new e(this.sector.centroidLatitude(),this.sector.centroidLongitude())},o.prototype.moveTo=function(t,i){var r=this._sector,n=new Array(3);n[0]=new e(r.minLatitude,r.minLongitude),n[1]=new e(r.maxLatitude,r.minLongitude),n[2]=new e(r.maxLatitude,r.maxLongitude),n=this.computeShiftedLocations(t,this.getReferencePosition(),i,n),this.sector=new WorldWind.Sector(n[0].latitude,n[1].latitude,n[1].longitude,n[2].longitude)},o}),i("util/editor/SurfaceSectorEditorFragment",["./BaseSurfaceEditorFragment","../../geom/Location","../../geom/Position","../../geom/Sector","./ShapeEditorConstants","../../shapes/SurfaceSector"],function(t,e,i,r,n,o){"use strict";var s=function(){};return s.prototype=Object.create(t.prototype),s.prototype.canHandle=function(t){return t instanceof Function?"SurfaceSector"===t.name:t instanceof o},s.prototype.createShadowShape=function(t){return new o(new r(t._boundaries[0].latitude,t._boundaries[1].latitude,t._boundaries[0].longitude,t._boundaries[2].longitude),t.attributes)},s.prototype.getShapeCenter=function(t,e){return this.getCenterFromLocations(e,t._boundaries)},s.prototype.isRegularShape=function(){return!0},s.prototype.initializeControlElements=function(t,e,i,r,o){o&&(this.createControlPoint(e,o,n.MIN_CORNER),this.createControlPoint(e,o,n.MAX_CORNER))},s.prototype.updateControlElements=function(t,i,r){r.length>0&&(r[0].position=new e(t._sector.minLatitude,t._sector.minLongitude),r[1].position=new e(t._sector.maxLatitude,t._sector.maxLongitude))},s.prototype.reshape=function(t,e,i,o,s){i.userProperties.purpose===n.MIN_CORNER?t.sector=new r(o.latitude,t._sector.maxLatitude,o.longitude,t._sector.maxLongitude):i.userProperties.purpose===n.MAX_CORNER&&(t.sector=new r(t._sector.minLatitude,o.latitude,t._sector.minLongitude,o.longitude))},s}),i("util/editor/ShapeEditor",["../../shapes/Annotation","../../shapes/AnnotationAttributes","../../error/ArgumentError","../Color","../Font","../Insets","../../geom/Location","../Logger","../../shapes/Placemark","../../shapes/PlacemarkAttributes","./PlacemarkEditorFragment","../../geom/Position","../Promise","../../layer/RenderableLayer","../../shapes/ShapeAttributes","./ShapeEditorConstants","./SurfaceEllipseEditorFragment","./SurfaceCircleEditorFragment","../../shapes/SurfacePolygon","./SurfacePolygonEditorFragment","./SurfacePolylineEditorFragment","./SurfaceRectangleEditorFragment","./SurfaceSectorEditorFragment","../../geom/Vec2","../../geom/Vec3"],function(t,e,i,r,n,o,s,a,l,h,u,c,d,p,f,g,m,y,E,v,_,b,w,S,L){"use strict";var T=function(t){if(!t)throw new i(a.logMessage(a.LEVEL_SEVERE,"ShapeEditor","constructor","missingWorldWindow"));this._worldWindow=t,this._shape=null,this._allowMove=!0,this._allowReshape=!0,this._allowRotate=!0,this._allowManageControlPoint=!0,this._moveControlPointAttributes=new h(null),this._moveControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/blue-dot.png",this._moveControlPointAttributes.imageScale=.15,this._shadowControlPointAttributes=new h(null),this._shadowControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/gray-dot.png",this._shadowControlPointAttributes.imageScale=.15,this._resizeControlPointAttributes=new h(null),this._resizeControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/yellow-dot.png",this._resizeControlPointAttributes.imageScale=.15,this._rotateControlPointAttributes=new h(null),this._rotateControlPointAttributes.imageColor=WorldWind.Color.GREEN,this._rotateControlPointAttributes.imageSource=WorldWind.configuration.baseUrl+"images/green-dot.png",this._rotateControlPointAttributes.imageScale=.15,this._annotationAttributes=new e(null),this._annotationAttributes.altitudeMode=WorldWind.CLAMP_TO_GROUND,this._annotationAttributes.cornerRadius=5,this._annotationAttributes.backgroundColor=new r(.67,.67,.67,.8),this._annotationAttributes.leaderGapHeight=0,this._annotationAttributes.drawLeader=!1,this._annotationAttributes.scale=1,this._annotationAttributes.textAttributes.color=r.BLACK,this._annotationAttributes.textAttributes.font=new n(10),this._annotationAttributes.insets=new o(5,5,5,5),this.creatorEnabled=!1,this.creatorShapeProperties=null,this.newCreatedShapeLayer=new p("Shape Editor Shadow Shape"),this.annotation=new WorldWind.Annotation(new WorldWind.Position(0,0,0),this._annotationAttributes),this.editorFragments=[new u,new y,new m,new v,new _,new b,new w],this.controlPointsLayer=new p("Shape Editor Control Points"),this.shadowControlPointsLayer=new p("Shape Editor Shadow Control Points"),this.accessoriesLayer=new p("Shape Editor Accessories"),this.accessoriesLayer.pickEnabled=!1,this.annotationLayer=new p("Shape Editor Annotation"),this.annotationLayer.pickEnabled=!1,this.annotationLayer.enabled=!1,this.annotationLayer.addRenderable(this.annotation),this.shadowShapeLayer=new p("Shape Editor Shadow Shape"),this.shadowShapeLayer.pickEnabled=!1,this.activeEditorFragment=null,this.actionType=null,this.actionControlPoint=null,this.actionControlPosition=null,this.actionSecondaryBehavior=!1,this.actionCurrentX=null,this.actionCurrentY=null,this.originalHighlightAttributes=new f(null),this.originalPlacemarkHighlightAttributes=new h(null),this._clicked0X=null,this._clicked0Y=null,this._clicked1X=null,this._clicked1Y=null,this._click0Time=0,this._click1Time=0,this._dbclickTimeout=0,this._clickDelay=500,this._worldWindow.worldWindowController.addGestureListener(this)};return Object.defineProperties(T.prototype,{worldWindow:{get:function(){return this._worldWindow}},shape:{get:function(){return this._shape}},moveControlPointAttributes:{get:function(){return this._moveControlPointAttributes},set:function(t){this._moveControlPointAttributes=t}},shadowControlPointAttributes:{get:function(){return this._shadowControlPointAttributes},set:function(t){this._shadowControlPointAttributes=t}},resizeControlPointAttributes:{get:function(){return this._resizeControlPointAttributes},set:function(t){this._resizeControlPointAttributes=t}},rotateControlPointAttributes:{get:function(){return this._rotateControlPointAttributes},set:function(t){this._rotateControlPointAttributes=t}},annotationAttributes:{get:function(){return this._annotationAttributes},set:function(t){this._annotationAttributes=t,this.annotation.attributes=t}}}),T.prototype.enableCreator=function(t,e,i){this.stop(),this.setCreatorEnabled(!0);for(var r=0,n=this.editorFragments.length;r "+d.toString()+" ["+t+"]")}}},o}),i("formats/shapefile/DBaseFile",["../../error/ArgumentError","../../util/ByteBuffer","../../formats/shapefile/DBaseField","../../formats/shapefile/DBaseRecord","../../util/Logger"],function(t,e,i,r,n){"use strict";var o=function(e){if(!e)throw new t(n.logMessage(n.LEVEL_SEVERE,"DBaseFile","constructor","missingUrl")); +this.url=e,this.header=null,this.fields=null,this.buffer=null,this.boolean=!0,this.numRecordsRead=0,this._completionCallback=null};return o.prototype.getLastModificationDate=function(){return this.header.lastModificationDate},o.prototype.getNumberOfRecords=function(){return this.header.numberOfRecords},o.prototype.getHeaderLength=function(){return this.header.headerLength},o.prototype.getRecordLength=function(){return this.header.recordLength},o.prototype.getNumberOfFields=function(){return(this.header.headerLength-1-o.FIXED_HEADER_LENGTH)/o.FIELD_DESCRIPTOR_LENGTH},o.prototype.getFields=function(){return this.fields},o.prototype.hasNext=function(){return this.numRecordsRead=this.getNumberOfRecords()?null:this.readNextRecord(this._buffer,++this.numRecordsRead)},o.prototype.load=function(t){this._completionCallback=t,this.requestUrl(this.url)},o.prototype.requestUrl=function(t){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){4===i.readyState&&(200===i.status?(this._buffer=new e(i.response),this.parse(),this._completionCallback&&this._completionCallback(this)):(n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed ("+i.statusText+"): "+t),this._completionCallback&&this._completionCallback(this)))}.bind(this),i.onerror=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval failed: "+t),this._completionCallback&&this._completionCallback(this)},i.ontimeout=function(){n.log(n.LEVEL_WARNING,"DBaseFile retrieval timed out: "+t),this._completionCallback&&this._completionCallback(this)},i.send(null)},o.prototype.parse=function(){this.header=this.readHeader(this._buffer),this.fields=this.readFieldDescriptors(this._buffer,this.getNumberOfFields())},o.prototype.readHeader=function(t){var i=t.position;t.order(e.LITTLE_ENDIAN);var r=t.getByte();if(r>5)throw new Error("???");var n=t.getByte(),s=t.getByte(),a=t.getByte(),l=t.getInt32(),h=t.getInt16(),u=t.getInt16(),c={year:1900+n,month:s-1,day:a},d={fileCode:r,lastModificationDate:c,numberOfRecords:l,headerLength:h,recordLength:u};return t.seek(i+o.FIXED_HEADER_LENGTH),d},o.prototype.readFieldDescriptors=function(t,e){for(var r=t.position,n=[],s=0;s=0&&t0&&this._numberOfPoints>0)for(var e=this._buffer.getInt32Array(this.numberOfParts),i=0;i=8*this.numberOfPoints)if(t){this._mValues=this._buffer.getDoubleArray(1);var e=this._mValues[0];this._mRange=[e,e]}else this._mRange=this._buffer.getDoubleArray(2),this._mValues=this._buffer.getDoubleArray(this.numberOfPoints)},s.normalizeLocations=function(e){for(var i=0,r=e.length;i90&&(n=t.normalizedDegreesLatitude(i[1]),i[1]=90,r=!0,i[0]>n&&(i[0]=n)),(i[2]<-180||i[3]>180)&&(i[2]=-180,i[3]=180,r=!0),{coords:i,isNormalized:r}},L.prototype.readProjectedBoundingRectangle=function(t){throw new a(s.log(s.LEVEL_SEVERE,"Shapefile.readProjectedBoundingRectangle() not yet implemented"))},L.prototype.readBoundingRectangleCoordinates=function(t){var e=t.getDouble(),i=t.getDouble(),r=t.getDouble(),n=t.getDouble();return[i,n,e,r]},L.prototype.readRecord=function(t){var e=this.createRecord(t);if(null!=e&&null!=this.attributeFile&&this.attributeFile.hasNext()){var i=this.attributeFile.nextRecord();e.setAttributes(i)}return e},L.prototype.createRecord=function(t){return this.isNullType()?this.createNull(t):this.isPointType()?this.createPoint(t):this.isMultiPointType()?this.createMultiPoint(t):this.isPolygonType()?this.createPolygon(t):this.isPolylineType()?this.createPolyline(t):null},L.prototype.createNull=function(t){return new E(this,t)},L.prototype.createPoint=function(t){return new v(this,t)},L.prototype.createMultiPoint=function(t){return new y(this,t)},L.prototype.createPolyline=function(t){return new b(this,t)},L.prototype.createPolygon=function(t){return new _(this,t)},L.prototype.getShapeType=function(t){switch(t){case 0:return L.NULL;case 1:return L.POINT;case 3:return L.POLYLINE;case 5:return L.POLYGON;case 8:return L.MULTI_POINT;case 11:return L.POINT_Z;case 13:return L.POLYLINE_Z;case 15:return L.POLYGON_Z;case 18:return L.MULTI_POINT_Z;case 21:return L.POINT_M;case 23:return L.POLYLINE_M;case 25:return L.POLYGON_M;case 28:return L.MULTI_POINT_M;default:return null}},L.prototype.isMeasureType=function(){return L.measureTypes.hasOwnProperty(this._shapeType)},L.prototype.isZType=function(){return L.zTypes.hasOwnProperty(this._shapeType)},L.prototype.isNullType=function(){return this._shapeType===L.NULL},L.prototype.isPointType=function(){return L.pointTypes.hasOwnProperty(this._shapeType)},L.prototype.isMultiPointType=function(){return L.multiPointTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolylineType=function(){return L.polylineTypes.hasOwnProperty(this._shapeType)},L.prototype.isPolygonType=function(){return L.polygonTypes.hasOwnProperty(this._shapeType)},L.NULL="null",L.POINT="point",L.MULTI_POINT="multiPoint",L.POLYLINE="polyline",L.POLYGON="polygon",L.POINT_M=L.POINT+"M",L.MULTI_POINT_M=L.MULTI_POINT+"M",L.POLYLINE_M=L.POLYLINE+"M",L.POLYGON_M=L.POLYGON+"M",L.POINT_Z=L.POINT+"Z",L.MULTI_POINT_Z=L.MULTI_POINT+"Z",L.POLYLINE_Z=L.POLYLINE+"Z",L.POLYGON_Z=L.POLYGON+"Z",L.SHAPE_MULTI_PATCH="multiPatch",L.measureTypes={pointM:L.POINT_M,pointZ:L.POINT_Z,multiPointM:L.MULTI_POINT_M,multiPointZ:L.MULTI_POINT_Z,polylineM:L.POLYLINE_M,polylineZ:L.POLYLINE_Z,polygonM:L.POLYGON_M,polygonZ:L.POLYGON_Z},L.zTypes={pointZ:L.POINT_Z,multiPointZ:L.MULTI_POINT_Z,polylineZ:L.POLYLINE_Z,polygonZ:L.POLYGON_Z},L.pointTypes={point:L.POINT,pointZ:L.POINT_Z,pointM:L.POINT_M},L.multiPointTypes={multiPoint:L.MULTI_POINT,multiPointZ:L.MULTI_POINT_Z,multiPointM:L.MULTI_POINT_M},L.polylineTypes={polyline:L.POLYLINE,polylineZ:L.POLYLINE_Z,polylineM:L.POLYLINE_M},L.polygonTypes={polygon:L.POLYGON,polygonZ:L.POLYGON_Z,polygonM:L.POLYGON_M},L.FILE_CODE=9994,L}),i("layer/ShowTessellationLayer",["../shaders/BasicProgram","../layer/Layer"],function(t,e){"use strict";var i=function(){e.call(this,"Show Tessellation"),this.enableTerrainGeometry=!0,this.enableTerrainExtent=!1};return i.prototype=Object.create(e.prototype),i.prototype.doRender=function(t){try{this.beginRendering(t),this.enableTerrainGeometry&&this.drawTerrainGeometry(t),this.enableTerrainExtent&&this.drawTerrainExtent(t)}finally{this.endRendering(t)}},i.prototype.beginRendering=function(t){var e=t.currentGlContext;e.depthMask(!1)},i.prototype.endRendering=function(t){var e=t.currentGlContext;e.depthMask(!0)},i.prototype.drawTerrainGeometry=function(e){if(e.terrain&&e.terrain.tessellator){var i,r,n=e.currentGlContext,o=e.terrain,s=o.tessellator,a=o.surfaceGeometry;try{i=e.findAndBindProgram(t),s.beginRendering(e);for(var l=0,h=a.length;lthis._MAX_GL_POINT_SIZE&&e.log(e.LEVEL_WARNING,"StarFieldLayer - sunSize is to big, max size allowed is: "+this._MAX_GL_POINT_SIZE);var s=n.getAsCelestialLocation(this.time||new Date);this._sunBufferView[0]=s.declination,this._sunBufferView[1]=s.rightAscension,this._sunBufferView[2]=Math.min(this.sunSize,this._MAX_GL_POINT_SIZE),this._sunBufferView[3]=1,this._sunPositionsCacheKey||(this._sunPositionsCacheKey=o.generateCacheKey()); +var a=o.resourceForKey(this._sunPositionsCacheKey);a?(i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferSubData(i.ARRAY_BUFFER,0,this._sunBufferView)):(a=i.createBuffer(),o.putResource(this._sunPositionsCacheKey,a,4*this._sunBufferView.length),i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferData(i.ARRAY_BUFFER,this._sunBufferView,i.DYNAMIC_DRAW)),t.frameStatistics.incrementVboLoadCount(1),i.vertexAttribPointer(0,4,i.FLOAT,!1,0,0),r.loadTextureEnabled(i,!0);var l=t.gpuResourceCache.resourceForKey(this._sunImageSource);l.bind(t),i.drawArrays(i.POINTS,0,1)},o.prototype.endRendering=function(t){var e=t.currentGlContext;e.depthMask(!0),e.disableVertexAttribArray(0)},o.prototype.fetchStarData=function(){if(!this._loadStarted){this._loadStarted=!0;var t=this,i=new XMLHttpRequest;i.onload=function(){if(this.status>=200&&this.status<300)try{t._starData=JSON.parse(this.response),t.sendRedrawRequest()}catch(t){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to parse JSON for star data "+t.toString())}else e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data. Status: "+this.status+" "+this.statusText);t._loadStarted=!1},i.onerror=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer unable to fetch star data"),t._loadStarted=!1},i.ontimeout=function(){e.log(e.LEVEL_SEVERE,"StarFieldLayer fetch star data has timeout"),t._loadStarted=!1},i.open("GET",this._starDataSource,!0),i.send()}},o.prototype.createStarsGeometry=function(){var t=this.parseStarsMetadata(this._starData.metadata);if(t.raIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing ra field in star data."));if(t.decIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing dec field in star data."));if(t.magIndex===-1)throw new Error(e.logMessage(e.LEVEL_SEVERE,"StarFieldLayer","createStarsGeometry","Missing vmag field in star data."));var i=this._starData.data,r=[];this._minMagnitude=Number.MAX_VALUE,this._maxMagnitude=Number.MIN_VALUE;for(var n=0,o=i.length;n65536)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too many positions. Must be fewer than 65537. Use TriangleMesh.split to split the shape."));if(!r)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Indices array is null or undefined"));if(r.length<3)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","constructor","Too few indices."));t.call(this,n),this._positions=i,this._indices=r,this.referencePosition=this._positions[0]};return g.prototype=Object.create(t.prototype),Object.defineProperties(g.prototype,{positions:{get:function(){return this._positions},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","positions","missingPositions"));this._positions=t,this.referencePosition=this._positions[0],this.reset()}},indices:{get:function(){return this._indices},set:function(t){if(!t)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","indices","Indices array is null or undefined"));this._indices=t,this.meshIndices=null,this.reset()}},outlineIndices:{get:function(){return this._outlineIndices},set:function(t){this._outlineIndices=t,this.meshOutlineIndices=null,this.reset()}},textureCoordinates:{get:function(){return this._textureCoordinates},set:function(t){if(t&&t.length!=this._positions.length)throw new e(a.logMessage(a.LEVEL_SEVERE,"TriangleMesh","textureCoordinates","Number of texture coordinates is inconsistent with the currently specified positions."));this._textureCoordinates=t,this.reset(),this.texCoords=null}}}),g.prototype.createSurfaceShape=function(){if(this._outlineIndices){for(var t=[],e=0;e65533&&l.length%3===0){if(s.length>0){var d={positions:s,indices:l};if(i&&(d.textureCoords=a),r){for(var p=[],f=0;f=n.screenOffset.x&&s<=n.screenOffset.x+n.size&&a>=n.screenOffset.y&&a<=n.screenOffset.y+n.size)return n;return null},l.prototype.determineOperation=function(t,e){var i=null;return e&&e instanceof s&&(e===this.panControl?i=this.handlePan:e===this.zoomInControl||e===this.zoomOutControl?i=this.handleZoom:e===this.headingLeftControl||e===this.headingRightControl?i=this.handleHeading:e===this.tiltUpControl||e===this.tiltDownControl?i=this.handleTilt:e===this.exaggerationUpControl||e===this.exaggerationDownControl?i=this.handleExaggeration:e!==this.fovNarrowControl&&e!==this.fovWideControl||(i=this.handleFov)),i},l.prototype.isCurrentTouch=function(t){for(var e=0;e=0?(r=a[0],n=a[1]):(r=a[1],n=a[0]),i+="&VERSION="+this.service.capabilities.version,i+="&COVERAGEID="+this.coverageId,i+="&FORMAT="+e,i+="&SCALESIZE="+s[0]+"("+t.tileWidth+"),",i+=s[1]+"("+t.tileHeight+")",i+="&OVERVIEWPOLICY=NEAREST",i+="&SUBSET="+r+"("+l.minLatitude+","+l.maxLatitude+")",i+="&SUBSET="+n+"("+l.minLongitude+","+l.maxLongitude+")",encodeURI(i)},i.prototype.fixGetCoverageString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WmsUrlBuilder","fixGetMapString","The specified service address is null or undefined.")); +var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/),r<0&&(i+="&")),i},i}),i("ogc/wcs/WcsCoverage",["../../error/ArgumentError","../../util/Logger","../../ogc/wcs/WcsUrlBuilder"],function(t,e,i){"use strict";var r=function(i,r){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsCoverage","constructor","missingId"));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsCoverage","constructor","missingWebCoverageService"));this.coverageId=i,this.service=r,this.sector=this.service.coverageDescriptions.getSector(this.coverageId),this.resolution=this.service.coverageDescriptions.getResolution(this.coverageId),this.elevationConfig=this.createElevationConfig()};return r.PREFERRED_FORMATS={GeoTIFF:!0,"image/tiff":!0,TIFF:!0},r.DEFAULT_FORMAT="image/tiff",r.prototype.createElevationConfig=function(){return{resolution:this.resolution,coverageSector:this.sector,retrievalImageFormat:this.determineFormatFromService(),urlBuilder:new i(this.coverageId,this.service)}},r.prototype.determineFormatFromService=function(){var t,e,i,n=this.service.capabilities.version;if("1.0.0"===n){for(e=0,i=this.service.coverageDescriptions.coverages.length;e0?n:"1.0.0",this.crs="EPSG:4326"};return i.prototype.urlForTile=function(r,n){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","missingTile"));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsUrlBuilder","urlForTile","The coverage format is null or undefined."));var o=r.sector,s=i.fixGetCoverageString(this.serviceAddress);return s.search(/service=wcs/i)<0&&(s+="service=WCS"),s+="&request=GetCoverage",s=s+"&version="+this.wcsVersion,s=s+"&coverage="+this.coverageName,s=s+"&format="+n,s=s+"&width="+r.tileWidth,s=s+"&height="+r.tileHeight,s=s+"&crs="+this.crs,s+="&bbox=",s=s+o.minLongitude+","+o.minLatitude+",",s=s+o.maxLongitude+","+o.maxLatitude,s=s.replace(" ","%20")},i.fixGetCoverageString=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WcsTileUrlBuilder","fixGetCoverageString","The specified service address is null or undefined."));var r=i.indexOf("?");return r<0?i+="?":r!==i.length-1&&(r=i.search(/&$/),r<0&&(i+="&")),i},i}),i("globe/WcsEarthElevationCoverage",["../geom/Location","../geom/Sector","../globe/TiledElevationCoverage","../util/WcsTileUrlBuilder"],function(t,e,i,r){"use strict";var n=function(){i.call(this,{coverageSector:e.FULL_SPHERE,resolution:.008333333333333,retrievalImageFormat:"image/tiff",minElevation:-11e3,maxElevation:8850,urlBuilder:new r("https://worldwind26.arc.nasa.gov/wms2","NASA_SRTM30_900m_Tiled","1.0.0")}),this.displayName="WCS Earth Elevation Coverage"};return n.prototype=Object.create(i.prototype),n}),i("ogc/wcs/WebCoverageService",["../../error/ArgumentError","../../util/Logger","../../util/Promise","../../ogc/wcs/WcsCapabilities","../../ogc/wcs/WcsCoverage","../../ogc/wcs/WcsCoverageDescriptions"],function(t,e,i,r,n,o){"use strict";var s=function(){this.serviceAddress=null,this.coverages=[],this.capabilities=null,this.coverageDescriptions=null};return s.WCS_XLMNS="http://www.opengis.net/wcs",s.WCS_2_XLMNS="http://www.opengis.net/wcs/2.0",s.create=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WebCoverageService","constructor","missingUrl"));var r=new s;return r.serviceAddress=i,r.retrieveCapabilities().then(function(t){return r.capabilities=t,r.retrieveCoverageDescriptions(t)}).then(function(t){return r.parseCoverages(t),r})},s.prototype.getCoverage=function(t){},s.prototype.retrieveCapabilities=function(){var t,e=this;return e.retrieveXml(e.buildCapabilitiesXmlRequest("2.0.1")).then(function(i){return t=i.documentElement.getAttribute("version"),"2.0.1"===t||"2.0.0"===t?i:e.retrieveXml(e.buildCapabilitiesXmlRequest("1.0.0"))}).then(function(t){return new r(t)})},s.prototype.retrieveCoverageDescriptions=function(){return this.retrieveXml(this.buildDescribeCoverageXmlRequest())},s.prototype.parseCoverages=function(t){this.coverageDescriptions=new o(t);for(var e,i,r=this.coverageDescriptions.coverages.length,s=0;s0&&""!=o[0]&&this.setOptions(o,r);var s=i[e]&&new i[e];s||(s=new n),o&&o.length>0&&""!=o[0]&&s.setOptions(o[0],s),this.add(s)}},n.prototype.rightParenthesis=function(t){t.rightParenthesis++,t.coordinates&&(this.addCoordinates(t.coordinates),t.coordinates=null)},n.prototype.leftParenthesis=function(t){t.leftParenthesis++},n.prototype.comma=function(t){t.coordinates?(this.addCoordinates(t.coordinates),t.coordinates=null):this.commaWithoutCoordinates(t)},n.prototype.commaWithoutCoordinates=function(t){},n.prototype.number=function(t,e){t.coordinates=t.coordinates||[],t.coordinates.push(e)},n.prototype.setOptions=function(t,e){"Z"==t?e.set3d():"M"==t?e.setLrs():"MZ"==t&&(e.set3d(),e.setLrs())},n.prototype.isFinished=function(){return this.options.leftParenthesis===this.options.rightParenthesis&&this.options.leftParenthesis>0},n}),i("formats/wkt/WktTokens",["./WktElements","./geom/WktObject","./WktType"],function(t,e,i){var r=function(t){this.sourceText=t};return r.prototype.objects=function(){var i,r=[];return this.tokenize(this.sourceText).forEach(function(n){if(i&&i.isFinished()||!i){var o=n.value,s=o.match("[M]?[Z]?$");s&&s.length>0&&""!=s[0]&&(o=o.substring(0,o.length-s.length)),i=t[o]&&new t[o],i||(i=new e),s&&s.length>0&&""!=s[0]&&i.setOptions(s[0],i),r.push(i)}else i.handleToken(n)}),r},r.prototype.tokenize=function(t){this.currentPosition=0;for(var e=[];this.currentPosition="a"&&t<="z"||t>="A"&&t<="Z"},r.prototype.isNumeric=function(t){return t>="0"&&t<="9"||"."==t||"-"==t},r.prototype.isWhiteSpace=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},r.prototype.readText=function(t){for(var e="";this.isAlpha(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,e},r.prototype.readNumeric=function(t){for(var e="";this.isNumeric(t.charAt(this.currentPosition));)e+=t.charAt(this.currentPosition),this.currentPosition++;return this.currentPosition--,Number(e)},r}),i("formats/wkt/Wkt",["../../error/ArgumentError","../../util/Logger","./WktTokens"],function(t,e,i){var r=function(t){this.textRepresentation=t,this._parserCompletionCallback=this.defaultParserCompletionCallback,this._shapeConfigurationCallback=this.defaultShapeConfigurationCallback,this._layer=null};return Object.defineProperties(r.prototype,{parserCompletionCallback:{get:function(){return this._parserCompletionCallback}},shapeConfigurationCallback:{get:function(){return this._shapeConfigurationCallback}},layer:{get:function(){return this._layer}}}),r.prototype.load=function(t,e,r){ +r&&(this._layer=r),t&&(this._parserCompletionCallback=t),e&&(this._shapeConfigurationCallback=e),this.parserCompletionCallback(this,new i(this.textRepresentation).objects())},r.prototype.defaultShapeConfigurationCallback=function(t){},r.prototype.defaultParserCompletionCallback=function(t,e){var i=t.shapeConfigurationCallback,r=[];e.forEach(function(t){t.shapes().forEach(function(e){var n=i(t);n&&n.attributes&&(e.attributes=n.attributes),n&&n.highlightAttributes&&(e.highlightAttributes=n.highlightAttributes),n&&n.pickDelegate&&(e.pickDelegate=n.pickDelegate),n&&n.userProperties&&(e.userProperties=n.userProperties),r.push(e)})}),t.layer&&t.layer.addRenderables(r)},r}),i("formats/wkt/WktExporter",["../../error/ArgumentError","../../util/Logger","./WktType"],function(t,e,i){"use strict";var r={exportRenderable:function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"WktExporter","exportRenderable","missingRenderable"));return i instanceof WorldWind.Placemark?this.exportPlacemark(i):i instanceof WorldWind.Path?this.exportPath(i):i instanceof WorldWind.Polygon?this.exportPolygon(i):i instanceof WorldWind.SurfacePolyline?this.exportSurfacePolyline(i):i instanceof WorldWind.SurfacePolygon?this.exportSurfacePolygon(i):i instanceof WorldWind.SurfaceEllipse?this.exportSurfaceEllipse(i):i instanceof WorldWind.SurfaceCircle?this.exportSurfaceCircle(i):i instanceof WorldWind.SurfaceRectangle?this.exportSurfaceRectangle(i):i instanceof WorldWind.SurfaceSector?this.exportSurfaceSector(i):(e.log(e.LEVEL_WARNING,"Export renderable not implemented: "+i),null)},exportRenderables:function(r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"WktExporter","exportRenderables","missingRenderables"));if(0!=r.length){if(r.length>1){for(var n=i.SupportedGeometries.GEOMETRY_COLLECTION+"(",o=0;o0&&r.boundaries[0].length>2){for(var o=0;o0&&r.boundaries[0].length>2){for(var o=0;o=0?i.format="image/png":s.indexOf("image/jpeg")>=0?i.format="image/jpeg":s.indexOf("image/tiff")>=0?i.format="image/tiff":s.indexOf("image/gif")>=0&&(i.format="image/gif"),i.service=o.getUrl;var l=t.crses;l||(l=t.srses),l&&(l.indexOf("EPSG:4326")>=0||l.indexOf("epsg:4326")>=0?i.coordinateSystem="EPSG:4326":(l.indexOf("CRS84")>=0||l.indexOf("CRS:84")>=0)&&(i.coordinateSystem="CRS:84"));var h=a.parseTimeDimensions(t);return h&&h.length>0&&(i.timeSequences=h),i},a.parseTimeDimensions=function(t){var e=t.extents||t.dimensions,i=null;if(e){i=[];for(var n=0;n0){var y=L.perspectiveNearDistance(c.width,c.height,g);f>y&&(f=y)}f<1&&(f=1),e.setToPerspectiveProjection(c.width,c.height,f,p)}},T.prototype.computePixelMetrics=function(t){var e=f.fromIdentity();e.invertMatrix(t);var i=new S(-1,-1,-1),r=new S(1,1,-1),n=new S(-1,-1,1),o=new S(1,1,1);i.multiplyByMatrix(e),r.multiplyByMatrix(e),n.multiplyByMatrix(e),o.multiplyByMatrix(e);var s=L.fabs(r[0]-i[0]),a=L.fabs(o[0]-n[0]),l=-i[2],h=-n[2],u=(a-s)/(h-l),c=s-u*l;return{pixelSizeFactor:u/this.viewport.width,pixelSizeOffset:c/this.viewport.height}},T.prototype.pixelSizeAtDistance=function(t){this.computeViewingTransform(this.scratchProjection,this.scratchModelview);var e=this.computePixelMetrics(this.scratchProjection);return e.pixelSizeFactor*t+e.pixelSizeOffset},T.prototype.computeDrawContext=function(){var t=this.drawContext;this.computeViewingTransform(t.projection,t.modelview),t.viewport=this.viewport,t.eyePoint=t.modelview.extractEyePoint(new S(0,0,0)),t.modelviewProjection.setToIdentity(),t.modelviewProjection.setToMultiply(t.projection,t.modelview);var e=this.computePixelMetrics(t.projection);t.pixelSizeFactor=e.pixelSizeFactor,t.pixelSizeOffset=e.pixelSizeOffset;var i=f.fromIdentity();i.invertOrthonormalMatrix(t.modelview),t.modelviewNormalTransform=f.fromIdentity().setToTransposeOfMatrix(i.upper3By3());var r=f.fromIdentity();r.setToTransposeOfMatrix(t.modelview),t.frustumInModelCoordinates=o.fromProjectionMatrix(t.projection),t.frustumInModelCoordinates.transformByMatrix(r),t.frustumInModelCoordinates.normalize()},T.prototype.resetDrawContext=function(){this.globe.offset=0;var t=this.drawContext;t.reset(),t.globe=this.globe,t.navigator=this.navigator,t.layers=this.layers.slice(),t.layers.push(t.screenCreditController),this.computeDrawContext(),t.verticalExaggeration=this.verticalExaggeration,t.surfaceOpacity=this.surfaceOpacity,t.deepPicking=this.deepPicking,t.frameStatistics=this.frameStatistics,t.pixelScale=this.pixelScale,t.update()},T.prototype.drawFrame=function(){try{this.drawContext.frameStatistics.beginFrame(),this.beginFrame(),this.drawContext.globe.is2D()&&this.drawContext.globe.continuous?this.do2DContiguousRepaint():this.doNormalRepaint()}finally{this.endFrame(),this.drawContext.frameStatistics.endFrame()}},T.prototype.doNormalRepaint=function(){this.createTerrain(),this.clearFrame(),this.deferOrderedRendering=!1,this.drawContext.pickingMode?this.drawContext.makePickFrustum()&&(this.doPick(),this.resolvePick()):(this.doDraw(),this.subsurfaceMode&&this.hasStencilBuffer&&(this.redrawSurface(),this.drawScreenRenderables()))},T.prototype.do2DContiguousRepaint=function(){this.createTerrain2DContiguous(),this.clearFrame(),this.drawContext.pickingMode?this.drawContext.makePickFrustum()&&(this.pick2DContiguous(),this.resolvePick()):this.draw2DContiguous()},T.prototype.resolvePick=function(){this.drawContext.pickTerrainOnly?this.resolveTerrainPick():this.drawContext.regionPicking?this.resolveRegionPick():this.resolveTopPick()},T.prototype.beginFrame=function(){var t=this.drawContext.currentGlContext;t.enable(t.BLEND),t.enable(t.CULL_FACE),t.enable(t.DEPTH_TEST),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.depthFunc(t.LEQUAL),this.drawContext.pickingMode&&(this.drawContext.makePickFramebuffer(),this.drawContext.bindFramebuffer(this.drawContext.pickFramebuffer))},T.prototype.endFrame=function(){var t=this.drawContext.currentGlContext;t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.blendFunc(t.ONE,t.ZERO),t.depthFunc(t.LESS),t.clearColor(0,0,0,1),this.drawContext.bindFramebuffer(null),this.drawContext.bindProgram(null)},T.prototype.clearFrame=function(){var t=this.drawContext,e=t.currentGlContext;e.clearColor(t.clearColor.red,t.clearColor.green,t.clearColor.blue,t.clearColor.alpha),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)},T.prototype.doDraw=function(){this.drawContext.renderShapes=!0,this.subsurfaceMode&&this.hasStencilBuffer?(this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawContext.currentGlContext.clear(this.drawContext.currentGlContext.DEPTH_BUFFER_BIT|this.drawContext.currentGlContext.STENCIL_BUFFER_BIT),this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.ALWAYS,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE),this.drawOrderedRenderables())):(this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawOrderedRenderables(),this.drawScreenRenderables()))},T.prototype.redrawSurface=function(){this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.EQUAL,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.KEEP,this.drawContext.currentGlContext.KEEP,this.drawContext.currentGlContext.KEEP),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!1),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST)},T.prototype.doPick=function(){this.drawContext.terrain&&this.drawContext.terrain.pick(this.drawContext),this.drawContext.pickTerrainOnly||(this.subsurfaceMode&&this.hasStencilBuffer?(this.drawContext.currentGlContext.disable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawContext.currentGlContext.clear(this.drawContext.currentGlContext.DEPTH_BUFFER_BIT|this.drawContext.currentGlContext.STENCIL_BUFFER_BIT),this.drawContext.currentGlContext.enable(this.drawContext.currentGlContext.STENCIL_TEST),this.drawContext.currentGlContext.stencilFunc(this.drawContext.currentGlContext.ALWAYS,1,1),this.drawContext.currentGlContext.stencilOp(this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE,this.drawContext.currentGlContext.REPLACE),this.drawOrderedRenderables(),this.drawContext.terrain.pick(this.drawContext),this.drawScreenRenderables())):(this.drawContext.surfaceShapeTileBuilder.clear(),this.drawLayers(!0),this.drawSurfaceRenderables(),this.drawContext.surfaceShapeTileBuilder.doRender(this.drawContext),this.deferOrderedRendering||(this.drawOrderedRenderables(),this.drawScreenRenderables())))},T.prototype.createTerrain=function(){var t=this.drawContext;t.terrain=this.globe.tessellator.tessellate(t),t.frameStatistics.setTerrainTileCount(t.terrain?t.terrain.surfaceGeometry.length:0)},T.prototype.makeCurrent=function(t){var e=this.drawContext;switch(e.globe.offset=t,e.globeStateKey=e.globe.stateKey,t){case-1:e.terrain=this.terrainLeft;break;case 0:e.terrain=this.terrainCenter;break;case 1:e.terrain=this.terrainRight}},T.prototype.createTerrain2DContiguous=function(){ +var t=this.drawContext;this.terrainCenter=null,t.globe.offset=0,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainCenter=t.globe.tessellator.tessellate(t)),this.terrainRight=null,t.globe.offset=1,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainRight=t.globe.tessellator.tessellate(t)),this.terrainLeft=null,t.globe.offset=-1,t.globeStateKey=t.globe.stateKey,t.globe.intersectsFrustum(t.frustumInModelCoordinates)&&(this.terrainLeft=t.globe.tessellator.tessellate(t))},T.prototype.draw2DContiguous=function(){var t="";this.terrainCenter&&(t+=" 0 ",this.makeCurrent(0),this.deferOrderedRendering=this.terrainLeft||this.terrainRight,this.doDraw()),this.terrainRight&&(t+=" 1 ",this.makeCurrent(1),this.deferOrderedRendering=this.terrainLeft||this.terrainLeft,this.doDraw()),this.deferOrderedRendering=!1,this.terrainLeft&&(t+=" -1 ",this.makeCurrent(-1),this.doDraw()),this.subsurfaceMode&&this.hasStencilBuffer&&(this.deferOrderedRendering=!0,this.terrainCenter&&(t+=" 0 ",this.makeCurrent(0),this.redrawSurface()),this.terrainRight&&(t+=" 1 ",this.makeCurrent(1),this.redrawSurface()),this.terrainLeft&&(t+=" -1 ",this.makeCurrent(-1),this.redrawSurface())),this.drawScreenRenderables()},T.prototype.pick2DContiguous=function(){this.terrainCenter&&(this.makeCurrent(0),this.deferOrderedRendering=this.terrainLeft||this.terrainRight,this.doPick()),this.terrainRight&&(this.makeCurrent(1),this.deferOrderedRendering=this.terrainLeft||this.terrainLeft,this.doPick()),this.deferOrderedRendering=!1,this.terrainLeft&&(this.makeCurrent(-1),this.doPick())},T.prototype.drawLayers=function(t){var e,i=Date.now(),r=this.drawContext,n=r.layers;r.accumulateOrderedRenderables=t;for(var o=0,s=n.length;o=0&&this.layers.splice(e,1)},T.prototype.insertLayer=function(t,e){e&&this.layers.splice(t,0,e)},T.prototype.indexOfLayer=function(t){return this.layers.indexOf(t)},T.prototype.drawSurfaceRenderables=function(){var t,e=this.drawContext;for(e.reverseSurfaceRenderables();t=e.popSurfaceRenderable();)try{t.renderSurface(e)}catch(t){d.logMessage(d.LEVEL_WARNING,"WorldWindow","drawSurfaceRenderables","Error while rendering a surface renderable.\n"+t.message)}},T.prototype.drawOrderedRenderables=function(){var t,e=Date.now(),i=this.drawContext;if(i.sortOrderedRenderables(),this._orderedRenderingFilters)for(var r=0;r