diff --git a/Apps/Sandcastle/gallery/Animations.html b/Apps/Sandcastle/gallery/Animations.html index 013e1e884028..29061a26d8cb 100644 --- a/Apps/Sandcastle/gallery/Animations.html +++ b/Apps/Sandcastle/gallery/Animations.html @@ -27,7 +27,7 @@ require(['Cesium'], function(Cesium) { "use strict"; - var extent; + var rectangle; var rectangularSensor; function addAlphaAnimation(primitive, scene) { @@ -40,9 +40,9 @@ scene.animations.addOffsetIncrement(primitive.material); } - function resetExtentPropeties(extent) { - extent.material.uniforms.time = 1.0; - extent.material.uniforms.color = new Cesium.Color(1.0, 0.0, 0.0, 0.5); + function resetRectanglePropeties(rectangle) { + rectangle.material.uniforms.time = 1.0; + rectangle.material.uniforms.color = new Cesium.Color(1.0, 0.0, 0.0, 0.5); } function createPrimitives(widget) { @@ -50,15 +50,15 @@ var scene = widget.scene; var primitives = scene.primitives; - extent = new Cesium.ExtentPrimitive({ - extent : new Cesium.Extent( + rectangle = new Cesium.RectanglePrimitive({ + rectangle : new Cesium.Rectangle( Cesium.Math.toRadians(-120.0), Cesium.Math.toRadians(20.0), Cesium.Math.toRadians(-80.0), Cesium.Math.toRadians(50.0)), material : Cesium.Material.fromType('Color') }); - primitives.add(extent); + primitives.add(rectangle); var modelMatrix = Cesium.Transforms.northEastDownToFixedFrame( ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-45.0, 45.0))); @@ -87,8 +87,8 @@ Sandcastle.addToolbarButton('Alpha Animation', function() { scene.animations.removeAll(); - resetExtentPropeties(extent); - addAlphaAnimation(extent, scene); + resetRectanglePropeties(rectangle); + addAlphaAnimation(rectangle, scene); Sandcastle.highlight(addAlphaAnimation); }); diff --git a/Apps/Sandcastle/gallery/CZML.html b/Apps/Sandcastle/gallery/CZML.html index 3c93bd189fce..4e43e329f163 100644 --- a/Apps/Sandcastle/gallery/CZML.html +++ b/Apps/Sandcastle/gallery/CZML.html @@ -141,8 +141,8 @@ viewer.dataSources.add(czmlDataSource); // Zoom in a little closer... - var extent = new Cesium.Extent(-2.056, 0.587, -2.010, 0.633); - viewer.scene.camera.viewExtent(extent); + var rectangle = new Cesium.Rectangle(-2.056, 0.587, -2.010, 0.633); + viewer.scene.camera.viewRectangle(rectangle); } var viewer = new Cesium.Viewer('cesiumContainer'); diff --git a/Apps/Sandcastle/gallery/Camera.html b/Apps/Sandcastle/gallery/Camera.html index 85f325827a39..b49d7f945db1 100644 --- a/Apps/Sandcastle/gallery/Camera.html +++ b/Apps/Sandcastle/gallery/Camera.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE --> <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> - <meta name="description" content="Fly to a specified location or view a geographic extent."> + <meta name="description" content="Fly to a specified location or view a geographic rectangle."> <meta name="cesium-sandcastle-labels" content="Showcases"> <title>Cesium Demo</title> <script type="text/javascript" src="../Sandcastle-header.js"></script> @@ -54,17 +54,17 @@ navigator.geolocation.getCurrentPosition(fly); } - function viewAnExtent(scene) { - Sandcastle.declare(viewAnExtent); // For highlighting in Sandcastle. + function viewAnRectangle(scene) { + Sandcastle.declare(viewAnRectangle); // For highlighting in Sandcastle. var west = Cesium.Math.toRadians(-77.0); var south = Cesium.Math.toRadians(38.0); var east = Cesium.Math.toRadians(-72.0); var north = Cesium.Math.toRadians(42.0); - var extent = new Cesium.Extent(west, south, east, north); - scene.camera.viewExtent(extent, ellipsoid); + var rectangle = new Cesium.Rectangle(west, south, east, north); + scene.camera.viewRectangle(rectangle, ellipsoid); - // Show the extent. Not required; just for show. + // Show the rectangle. Not required; just for show. var polylines = new Cesium.PolylineCollection(); polylines.add({ positions : ellipsoid.cartographicArrayToCartesianArray( @@ -79,21 +79,21 @@ scene.primitives.add(polylines); } - function flyToExtent(scene) { - Sandcastle.declare(flyToExtent); // For highlighting in Sandcastle. + function flyToRectangle(scene) { + Sandcastle.declare(flyToRectangle); // For highlighting in Sandcastle. var west = Cesium.Math.toRadians(-90.0); var south = Cesium.Math.toRadians(38.0); var east = Cesium.Math.toRadians(-87.0); var north = Cesium.Math.toRadians(40.0); - var extent = new Cesium.Extent(west, south, east, north); + var rectangle = new Cesium.Rectangle(west, south, east, north); - var flight = Cesium.CameraFlightPath.createAnimationExtent(scene, { - destination : extent + var flight = Cesium.CameraFlightPath.createAnimationRectangle(scene, { + destination : rectangle }); scene.animations.add(flight); - // Show the extent. Not required; just for show. + // Show the rectangle. Not required; just for show. var polylines = new Cesium.PolylineCollection(); polylines.add({ positions : ellipsoid.cartographicArrayToCartesianArray( @@ -200,16 +200,16 @@ Sandcastle.highlight(flyToMyLocation); }); - Sandcastle.addToolbarButton('Fly to Extent', function() { + Sandcastle.addToolbarButton('Fly to Rectangle', function() { reset(scene); - flyToExtent(scene); - Sandcastle.highlight(flyToExtent); + flyToRectangle(scene); + Sandcastle.highlight(flyToRectangle); }); - Sandcastle.addToolbarButton('View an Extent', function() { + Sandcastle.addToolbarButton('View an Rectangle', function() { reset(scene); - viewAnExtent(scene); - Sandcastle.highlight(viewAnExtent); + viewAnRectangle(scene); + Sandcastle.highlight(viewAnRectangle); }); Sandcastle.addToolbarButton('Set camera reference frame', function() { diff --git a/Apps/Sandcastle/gallery/Cesium Inspector.html b/Apps/Sandcastle/gallery/Cesium Inspector.html index 9c4ed51f1933..bc1e3a514120 100644 --- a/Apps/Sandcastle/gallery/Cesium Inspector.html +++ b/Apps/Sandcastle/gallery/Cesium Inspector.html @@ -69,8 +69,8 @@ primitives.add(new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : Cesium.Extent.fromDegrees(-100.0, 30.0, -93.0, 37.0), + geometry : new Cesium.RectangleGeometry({ + rectangle : Cesium.Rectangle.fromDegrees(-100.0, 30.0, -93.0, 37.0), height: 100000, vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT }), diff --git a/Apps/Sandcastle/gallery/Ellipsoid Surface.html b/Apps/Sandcastle/gallery/Ellipsoid Surface.html index 59e5dbb3abc6..ed8dca2a0e48 100644 --- a/Apps/Sandcastle/gallery/Ellipsoid Surface.html +++ b/Apps/Sandcastle/gallery/Ellipsoid Surface.html @@ -33,8 +33,8 @@ // Stripe Material primitives.add(new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : Cesium.Extent.fromDegrees(-120.0, 30.0, -110.0, 40.0), + geometry : new Cesium.RectangleGeometry({ + rectangle : Cesium.Rectangle.fromDegrees(-120.0, 30.0, -110.0, 40.0), vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT }) }), @@ -46,8 +46,8 @@ // Dot Material primitives.add(new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : Cesium.Extent.fromDegrees(-110.0, 30.0, -100.0, 40.0), + geometry : new Cesium.RectangleGeometry({ + rectangle : Cesium.Rectangle.fromDegrees(-110.0, 30.0, -100.0, 40.0), vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT }) }), @@ -59,8 +59,8 @@ // Checkerboard Material primitives.add(new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : Cesium.Extent.fromDegrees(-100.0, 30.0, -90.0, 40.0), + geometry : new Cesium.RectangleGeometry({ + rectangle : Cesium.Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0), vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT }) }), @@ -72,8 +72,8 @@ // Grid Material primitives.add(new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : Cesium.Extent.fromDegrees(-90.0, 30.0, -80.0, 40.0), + geometry : new Cesium.RectangleGeometry({ + rectangle : Cesium.Rectangle.fromDegrees(-90.0, 30.0, -80.0, 40.0), vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT }) }), diff --git a/Apps/Sandcastle/gallery/Geometry and Appearances.html b/Apps/Sandcastle/gallery/Geometry and Appearances.html index cfef93bef45e..8d580892ba53 100644 --- a/Apps/Sandcastle/gallery/Geometry and Appearances.html +++ b/Apps/Sandcastle/gallery/Geometry and Appearances.html @@ -34,19 +34,19 @@ var ellipsoid = viewer.centralBody.ellipsoid; var solidWhite = Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.WHITE); - // Combine instances for an extent, polygon, ellipse, and circle into a single primitive. + // Combine instances for an rectangle, polygon, ellipse, and circle into a single primitive. - var extent = Cesium.Extent.fromDegrees(-92.0, 20.0, -86.0, 27.0); - var extentInstance = new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : extent, + var rectangle = Cesium.Rectangle.fromDegrees(-92.0, 20.0, -86.0, 27.0); + var rectangleInstance = new Cesium.GeometryInstance({ + geometry : new Cesium.RectangleGeometry({ + rectangle : rectangle, vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT, stRotation : Cesium.Math.toRadians(45) }) }); - var extentOutlineInstance = new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentOutlineGeometry({ - extent : extent + var rectangleOutlineInstance = new Cesium.GeometryInstance({ + geometry : new Cesium.RectangleOutlineGeometry({ + rectangle : rectangle }), attributes : { color : solidWhite @@ -123,13 +123,13 @@ }); primitives.add(new Cesium.Primitive({ - geometryInstances : [extentInstance, polygonInstance, ellipseInstance, circleInstance], + geometryInstances : [rectangleInstance, polygonInstance, ellipseInstance, circleInstance], appearance : new Cesium.EllipsoidSurfaceAppearance({ material : Cesium.Material.fromType('Stripe') }) })); primitives.add(new Cesium.Primitive({ - geometryInstances : [extentOutlineInstance, polygonOutlineInstance, ellipseOutlineInstance, circleOutlineInstance], + geometryInstances : [rectangleOutlineInstance, polygonOutlineInstance, ellipseOutlineInstance, circleOutlineInstance], appearance : new Cesium.PerInstanceColorAppearance({ flat : true, translucent : false, @@ -142,12 +142,12 @@ }) })); - // Create extruded extent - extent = Cesium.Extent.fromDegrees(-118.0, 38.0, -116.0, 40.0); + // Create extruded rectangle + rectangle = Cesium.Rectangle.fromDegrees(-118.0, 38.0, -116.0, 40.0); var extrudedHeight = 500000.0; - var extrudedExtent = new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : extent, + var extrudedRectangle = new Cesium.GeometryInstance({ + geometry : new Cesium.RectangleGeometry({ + rectangle : rectangle, vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, extrudedHeight : extrudedHeight }), @@ -156,9 +156,9 @@ } }); - var extrudedOutlineExtent = new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentOutlineGeometry({ - extent : extent, + var extrudedOutlineRectangle = new Cesium.GeometryInstance({ + geometry : new Cesium.RectangleOutlineGeometry({ + rectangle : rectangle, extrudedHeight : extrudedHeight }), attributes : { @@ -266,14 +266,14 @@ }); primitives.add(new Cesium.Primitive({ - geometryInstances : [extrudedPolygon, extrudedExtent, extrudedEllipse, cylinderInstance], + geometryInstances : [extrudedPolygon, extrudedRectangle, extrudedEllipse, cylinderInstance], appearance : new Cesium.PerInstanceColorAppearance({ translucent : false, closed : true }) })); primitives.add(new Cesium.Primitive({ - geometryInstances : [extrudedOutlineExtent, extrudedOutlineEllipse, extrudedOutlinePolygon, cylinderOutlineInstance], + geometryInstances : [extrudedOutlineRectangle, extrudedOutlineEllipse, extrudedOutlinePolygon, cylinderOutlineInstance], appearance : new Cesium.PerInstanceColorAppearance({ flat : true, translucent : false, @@ -450,10 +450,10 @@ }) })); - extent = Cesium.Extent.fromDegrees(-92.0, 30.0, -85.0, 40.0); - extentInstance = new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : extent, + rectangle = Cesium.Rectangle.fromDegrees(-92.0, 30.0, -85.0, 40.0); + rectangleInstance = new Cesium.GeometryInstance({ + geometry : new Cesium.RectangleGeometry({ + rectangle : rectangle, vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT }) }); @@ -522,20 +522,20 @@ }); primitives.add(new Cesium.Primitive({ - geometryInstances : [extentInstance, polygonInstance, ellipseInstance, circleInstance], + geometryInstances : [rectangleInstance, polygonInstance, ellipseInstance, circleInstance], appearance : new Cesium.EllipsoidSurfaceAppearance({ material : Cesium.Material.fromType('Stripe') }) })); - // Create extruded extent - extent = Cesium.Extent.fromDegrees(-110.0, 38.0, -107.0, 40.0); + // Create extruded rectangle + rectangle = Cesium.Rectangle.fromDegrees(-110.0, 38.0, -107.0, 40.0); height = 700000.0; extrudedHeight = 1000000.0; rotation = Cesium.Math.toRadians(45.0); - extrudedExtent = new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : extent, + extrudedRectangle = new Cesium.GeometryInstance({ + geometry : new Cesium.RectangleGeometry({ + rectangle : rectangle, vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, height : height, rotation : rotation, @@ -610,7 +610,7 @@ }); primitives.add(new Cesium.Primitive({ - geometryInstances : [extrudedPolygon, extrudedExtent, extrudedEllipse, cylinderInstance], + geometryInstances : [extrudedPolygon, extrudedRectangle, extrudedEllipse, cylinderInstance], appearance : new Cesium.PerInstanceColorAppearance({ translucent : false, closed : true @@ -624,7 +624,7 @@ center = ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-65.0, 35.0)); radius = 200000.0; - extent = Cesium.Extent.fromDegrees(-67.0, 27.0, -63.0, 32.0); + rectangle = Cesium.Rectangle.fromDegrees(-67.0, 27.0, -63.0, 32.0); for (i = 0; i < 5; ++i) { height = 200000.0 * i; @@ -641,8 +641,8 @@ })); instances.push(new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : extent, + geometry : new Cesium.RectangleGeometry({ + rectangle : rectangle, height : height, vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT }), diff --git a/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html b/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html index e6af59f52afe..da54a5bd2c16 100644 --- a/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html +++ b/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html @@ -146,7 +146,7 @@ 'Single image', new Cesium.SingleTileImageryProvider({ url : '../images/Cesium_Logo_overlay.png', - extent : new Cesium.Extent( + rectangle : new Cesium.Rectangle( Cesium.Math.toRadians(-115.0), Cesium.Math.toRadians(38.0), Cesium.Math.toRadians(-107), diff --git a/Apps/Sandcastle/gallery/Imagery Layers.html b/Apps/Sandcastle/gallery/Imagery Layers.html index d54bae8491be..3b045d22bdc6 100644 --- a/Apps/Sandcastle/gallery/Imagery Layers.html +++ b/Apps/Sandcastle/gallery/Imagery Layers.html @@ -42,7 +42,7 @@ blackMarble.brightness = 2.0; layers.addImageryProvider(new Cesium.SingleTileImageryProvider({ url : '../images/Cesium_Logo_overlay.png', - extent : new Cesium.Extent( + rectangle : new Cesium.Rectangle( Cesium.Math.toRadians(-75.0), Cesium.Math.toRadians(28.0), Cesium.Math.toRadians(-67.0), diff --git a/Apps/Sandcastle/gallery/Materials.html b/Apps/Sandcastle/gallery/Materials.html index ee5d8d3b0b75..1d672049aa76 100644 --- a/Apps/Sandcastle/gallery/Materials.html +++ b/Apps/Sandcastle/gallery/Materials.html @@ -27,8 +27,8 @@ require(['Cesium'], function(Cesium) { "use strict"; - var extent; - var worldExtent; + var rectangle; + var worldRectangle; var polyline; function applyAlphaMapMaterial(primitive, scene) { @@ -390,22 +390,22 @@ var scene = widget.scene; var primitives = scene.primitives; - function toggleExtentVisibility() { - extent.show = true; - worldExtent.show = false; + function toggleRectangleVisibility() { + rectangle.show = true; + worldRectangle.show = false; polyline.show = false; } - function toggleWorldExtentVisibility() { - worldExtent.show = true; - extent.show = false; + function toggleWorldRectangleVisibility() { + worldRectangle.show = true; + rectangle.show = false; polyline.show = false; } function togglePolylineVisibility() { polyline.show = true; - worldExtent.show = false; - extent.show = false; + worldRectangle.show = false; + rectangle.show = false; } function selectMenuOption(menu, options) { @@ -420,15 +420,15 @@ }, { text : 'Color', onselect : function() { - toggleExtentVisibility(); - applyColorMaterial(extent, scene); + toggleRectangleVisibility(); + applyColorMaterial(rectangle, scene); Sandcastle.highlight(applyColorMaterial); } }, { text : 'Image', onselect : function() { - toggleExtentVisibility(); - applyImageMaterial(extent, scene); + toggleRectangleVisibility(); + applyImageMaterial(rectangle, scene); Sandcastle.highlight(applyImageMaterial); } }]; @@ -442,29 +442,29 @@ }, { text : 'Checkerboard', onselect : function() { - toggleExtentVisibility(); - applyCheckerboardMaterial(extent, scene); + toggleRectangleVisibility(); + applyCheckerboardMaterial(rectangle, scene); Sandcastle.highlight(applyCheckerboardMaterial); } }, { text : 'Dot', onselect : function() { - toggleExtentVisibility(); - applyDotMaterial(extent, scene); + toggleRectangleVisibility(); + applyDotMaterial(rectangle, scene); Sandcastle.highlight(applyDotMaterial); } }, { text : 'Grid', onselect : function() { - toggleExtentVisibility(extent, worldExtent); - applyGridMaterial(extent, scene); + toggleRectangleVisibility(rectangle, worldRectangle); + applyGridMaterial(rectangle, scene); Sandcastle.highlight(applyGridMaterial); } }, { text : 'Stripe', onselect : function() { - toggleExtentVisibility(); - applyStripeMaterial(extent, scene); + toggleRectangleVisibility(); + applyStripeMaterial(rectangle, scene); Sandcastle.highlight(applyStripeMaterial); } }]; @@ -478,64 +478,64 @@ }, { text : 'Alpha Map', onselect : function() { - toggleExtentVisibility(); - applyAlphaMapMaterial(extent, scene); + toggleRectangleVisibility(); + applyAlphaMapMaterial(rectangle, scene); Sandcastle.highlight(applyAlphaMapMaterial); } }, { text : 'Bump Map', onselect : function() { - toggleExtentVisibility(); - applyBumpMapMaterial(extent, scene); + toggleRectangleVisibility(); + applyBumpMapMaterial(rectangle, scene); Sandcastle.highlight(applyBumpMapMaterial); } }, { text : 'Diffuse', onselect : function() { - toggleExtentVisibility(); - applyDiffuseMaterial(extent, scene); + toggleRectangleVisibility(); + applyDiffuseMaterial(rectangle, scene); Sandcastle.highlight(applyDiffuseMaterial); } }, { text : 'Emission Map', onselect : function() { - toggleExtentVisibility(); - applyEmissionMapMaterial(extent, scene); + toggleRectangleVisibility(); + applyEmissionMapMaterial(rectangle, scene); Sandcastle.highlight(applyEmissionMapMaterial); } }, { text : 'Fresnel', onselect : function() { - toggleWorldExtentVisibility(); - applyFresnelMaterial(worldExtent, scene); + toggleWorldRectangleVisibility(); + applyFresnelMaterial(worldRectangle, scene); Sandcastle.highlight(applyFresnelMaterial); } }, { text : 'Normal Map', onselect : function() { - toggleExtentVisibility(); - applyNormalMapMaterial(extent, scene); + toggleRectangleVisibility(); + applyNormalMapMaterial(rectangle, scene); Sandcastle.highlight(applyNormalMapMaterial); } }, { text : 'Reflection', onselect : function() { - toggleWorldExtentVisibility(); - applyReflectionMaterial(worldExtent, scene); + toggleWorldRectangleVisibility(); + applyReflectionMaterial(worldRectangle, scene); Sandcastle.highlight(applyReflectionMaterial); } }, { text : 'Refraction', onselect : function() { - toggleWorldExtentVisibility(); - applyRefractionMaterial(worldExtent, scene); + toggleWorldRectangleVisibility(); + applyRefractionMaterial(worldRectangle, scene); Sandcastle.highlight(applyRefractionMaterial); } }, { text : 'Specular Map', onselect : function() { - toggleExtentVisibility(); - applySpecularMapMaterial(extent, scene); + toggleRectangleVisibility(); + applySpecularMapMaterial(rectangle, scene); Sandcastle.highlight(applySpecularMapMaterial); } }]; @@ -549,15 +549,15 @@ }, { text : 'Rim Lighting', onselect : function() { - toggleWorldExtentVisibility(); - applyRimLightingMaterial(worldExtent, scene); + toggleWorldRectangleVisibility(); + applyRimLightingMaterial(worldRectangle, scene); Sandcastle.highlight(applyRimLightingMaterial); } }, { text : 'Water', onselect : function() { - toggleWorldExtentVisibility(); - applyWaterMaterial(worldExtent, scene); + toggleWorldRectangleVisibility(); + applyWaterMaterial(worldRectangle, scene); Sandcastle.highlight(applyWaterMaterial); } }]; @@ -571,8 +571,8 @@ }, { text : 'Composite Example', onselect : function() { - toggleWorldExtentVisibility(); - applyCompositeMaterial(worldExtent, scene); + toggleWorldRectangleVisibility(); + applyCompositeMaterial(worldRectangle, scene); Sandcastle.highlight(applyCompositeMaterial); } }]; @@ -616,25 +616,25 @@ var primitives = scene.primitives; var ellipsoid = widget.centralBody.ellipsoid; - extent = new Cesium.ExtentPrimitive({ - extent : new Cesium.Extent( + rectangle = new Cesium.RectanglePrimitive({ + rectangle : new Cesium.Rectangle( Cesium.Math.toRadians(-120.0), Cesium.Math.toRadians(20.0), Cesium.Math.toRadians(-60.0), Cesium.Math.toRadians(40.0)) }); - primitives.add(extent); + primitives.add(rectangle); - worldExtent = new Cesium.Polygon(); - worldExtent = new Cesium.ExtentPrimitive({ - extent : new Cesium.Extent( + worldRectangle = new Cesium.Polygon(); + worldRectangle = new Cesium.RectanglePrimitive({ + rectangle : new Cesium.Rectangle( Cesium.Math.toRadians(-180.0), Cesium.Math.toRadians(-90.0), Cesium.Math.toRadians(180.0), Cesium.Math.toRadians(90.0)), show : false }); - primitives.add(worldExtent); + primitives.add(worldRectangle); var polylines = new Cesium.PolylineCollection(); polyline = polylines.add({ diff --git a/Apps/Sandcastle/gallery/Per Instance Color.html b/Apps/Sandcastle/gallery/Per Instance Color.html index 6f5b7a44d785..d6b8ea3c88ec 100644 --- a/Apps/Sandcastle/gallery/Per Instance Color.html +++ b/Apps/Sandcastle/gallery/Per Instance Color.html @@ -34,8 +34,8 @@ for (var i = 0; i < 4; i++) { instances.push(new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : Cesium.Extent.fromDegrees(-120.0 + i * 10, 30.0, -110.0 + i * 10, 40.0), + geometry : new Cesium.RectangleGeometry({ + rectangle : Cesium.Rectangle.fromDegrees(-120.0 + i * 10, 30.0, -110.0 + i * 10, 40.0), vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT }), attributes : { diff --git a/Apps/Sandcastle/gallery/Picking.html b/Apps/Sandcastle/gallery/Picking.html index 5acf20e01e86..a4c6bcffe58d 100644 --- a/Apps/Sandcastle/gallery/Picking.html +++ b/Apps/Sandcastle/gallery/Picking.html @@ -316,32 +316,32 @@ } - function drawExtent(scene, ellipsoid) { - Sandcastle.declare(drawExtent); // For highlighting in Sandcastle. + function drawRectangle(scene, ellipsoid) { + Sandcastle.declare(drawRectangle); // For highlighting in Sandcastle. - var DrawExtentHelper = function(scene, handler) { + var DrawRectangleHelper = function(scene, handler) { this._canvas = scene.canvas; this._scene = scene; this._ellipsoid = scene.primitives.centralBody.ellipsoid; this._finishHandler = handler; this._mouseHandler = new Cesium.ScreenSpaceEventHandler(this._canvas); - this._extentPrimitive = new Cesium.ExtentPrimitive(); - this._extentPrimitive.asynchronous = false; - this._scene.primitives.add(this._extentPrimitive); + this._rectanglePrimitive = new Cesium.RectanglePrimitive(); + this._rectanglePrimitive.asynchronous = false; + this._scene.primitives.add(this._rectanglePrimitive); }; - DrawExtentHelper.prototype.enableInput = function() { + DrawRectangleHelper.prototype.enableInput = function() { var controller = this._scene.screenSpaceCameraController; controller.enableInputs = true; }; - DrawExtentHelper.prototype.disableInput = function() { + DrawRectangleHelper.prototype.disableInput = function() { var controller = this._scene.screenSpaceCameraController; controller.enableInputs = false; }; - DrawExtentHelper.prototype.getExtent = function(mn, mx) { - var e = new Cesium.Extent(); + DrawRectangleHelper.prototype.getRectangle = function(mn, mx) { + var e = new Cesium.Rectangle(); // Re-order so west < east and south < north e.west = Math.min(mn.longitude, mx.longitude); @@ -363,18 +363,18 @@ return e; }; - DrawExtentHelper.prototype.setPolyPts = function(mn, mx) { - this._extentPrimitive.extent = this.getExtent(mn, mx); + DrawRectangleHelper.prototype.setPolyPts = function(mn, mx) { + this._rectanglePrimitive.rectangle = this.getRectangle(mn, mx); }; - DrawExtentHelper.prototype.setToDegrees = function(w, s, e, n) { + DrawRectangleHelper.prototype.setToDegrees = function(w, s, e, n) { var toRad = Cesium.Math.toRadians; var mn = new Cesium.Cartographic(toRad(w), toRad(s)); var mx = new Cesium.Cartographic(toRad(e), toRad(n)); this.setPolyPts(mn, mx); }; - DrawExtentHelper.prototype.handleRegionStop = function(movement) { + DrawRectangleHelper.prototype.handleRegionStop = function(movement) { this.enableInput(); var cartesian = this._scene.camera.pickEllipsoid(movement.position, this._ellipsoid); @@ -383,10 +383,10 @@ } this._mouseHandler.destroy(); - this._finishHandler(this.getExtent(this._click1, this._click2)); + this._finishHandler(this.getRectangle(this._click1, this._click2)); }; - DrawExtentHelper.prototype.handleRegionInter = function(movement) { + DrawRectangleHelper.prototype.handleRegionInter = function(movement) { var cartesian = this._scene.camera.pickEllipsoid(movement.endPosition, this._ellipsoid); if (cartesian) { @@ -395,7 +395,7 @@ } }; - DrawExtentHelper.prototype.handleRegionStart = function(movement) { + DrawRectangleHelper.prototype.handleRegionStart = function(movement) { var cartesian = this._scene.camera.pickEllipsoid(movement.position, this._ellipsoid); if (cartesian) { @@ -410,7 +410,7 @@ } }; - DrawExtentHelper.prototype.start = function() { + DrawRectangleHelper.prototype.start = function() { this.disableInput(); var that = this; @@ -434,11 +434,11 @@ Cesium.Math.toDegrees(e.east).toFixed(2) + ', ' + Cesium.Math.toDegrees(e.north).toFixed(2) + ')'; label.scale = 0.7; - label.position = widget.centralBody.ellipsoid.cartographicToCartesian(Cesium.Extent.getCenter(e)); + label.position = widget.centralBody.ellipsoid.cartographicToCartesian(Cesium.Rectangle.getCenter(e)); label.horizontalOrigin = Cesium.HorizontalOrigin.CENTER; }; - var drawExtentHelper = new DrawExtentHelper(scene, myHandler); - drawExtentHelper.start(); + var drawRectangleHelper = new DrawRectangleHelper(scene, myHandler); + drawRectangleHelper.start(); } var widget = new Cesium.CesiumWidget('cesiumContainer'); @@ -484,10 +484,10 @@ Sandcastle.highlight(multiPickPrimitives); }); - Sandcastle.addToolbarButton('Drag to Draw Extent', function() { + Sandcastle.addToolbarButton('Drag to Draw Rectangle', function() { cleanup(); - drawExtent(scene, ellipsoid); - Sandcastle.highlight(drawExtent); + drawRectangle(scene, ellipsoid); + Sandcastle.highlight(drawRectangle); }); Sandcastle.finishedLoading(); diff --git a/Apps/Sandcastle/gallery/Polygons.html b/Apps/Sandcastle/gallery/Polygons.html index 191da2184257..25f433fd23c2 100644 --- a/Apps/Sandcastle/gallery/Polygons.html +++ b/Apps/Sandcastle/gallery/Polygons.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE --> <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> - <meta name="description" content="Construct polygons from a set of points, an extent, or a nested hierarchy and apply materials to them."> + <meta name="description" content="Construct polygons from a set of points, an rectangle, or a nested hierarchy and apply materials to them."> <meta name="cesium-sandcastle-labels" content="Showcases"> <title>Cesium Demo</title> <script type="text/javascript" src="../Sandcastle-header.js"></script> @@ -41,8 +41,8 @@ })); Sandcastle.declare(polygon); // For highlighting on mouseover in Sandcastle. - polygon = primitives.add(new Cesium.ExtentPrimitive({ - extent : new Cesium.Extent( + polygon = primitives.add(new Cesium.RectanglePrimitive({ + rectangle : new Cesium.Rectangle( Cesium.Math.toRadians(-110.0), Cesium.Math.toRadians(0.0), Cesium.Math.toRadians(-90.0), @@ -95,15 +95,15 @@ })); Sandcastle.declare(polygonHierarchy); // For highlighting on mouseover in Sandcastle. - // Create a polygon from an extent - var polygonExtent = primitives.add(new Cesium.ExtentPrimitive({ - extent : new Cesium.Extent( + // Create a polygon from an rectangle + var polygonRectangle = primitives.add(new Cesium.RectanglePrimitive({ + rectangle : new Cesium.Rectangle( Cesium.Math.toRadians(-180.0), Cesium.Math.toRadians(50.0), Cesium.Math.toRadians(180.0), Cesium.Math.toRadians(90.0)) })); - Sandcastle.declare(polygonExtent); // For highlighting on mouseover in Sandcastle. + Sandcastle.declare(polygonRectangle); // For highlighting on mouseover in Sandcastle. // Apply a material to a polygon var checkeredPolygon = primitives.add(new Cesium.Polygon({ diff --git a/Apps/Sandcastle/gallery/Extent Outline.html b/Apps/Sandcastle/gallery/Rectangle Outline.html similarity index 85% rename from Apps/Sandcastle/gallery/Extent Outline.html rename to Apps/Sandcastle/gallery/Rectangle Outline.html index 80c259d8cd89..8c66472ac2e7 100644 --- a/Apps/Sandcastle/gallery/Extent Outline.html +++ b/Apps/Sandcastle/gallery/Rectangle Outline.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE --> <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> - <meta name="description" content="The outline of an extent."> + <meta name="description" content="The outline of an rectangle."> <meta name="cesium-sandcastle-labels" content="Geometries"> <title>Cesium Demo</title> <script type="text/javascript" src="../Sandcastle-header.js"></script> @@ -31,13 +31,13 @@ var scene = viewer.scene; var primitives = scene.primitives; - var extent = Cesium.Extent.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var rectangle = Cesium.Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); - // Extent outline + // Rectangle outline primitives.add(new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentOutlineGeometry({ - extent : extent + geometry : new Cesium.RectangleOutlineGeometry({ + rectangle : rectangle }), attributes : { color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.WHITE) @@ -54,11 +54,11 @@ }) })); - // Extent + // Rectangle primitives.add(new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : extent, + geometry : new Cesium.RectangleGeometry({ + rectangle : rectangle, vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT }), attributes : { diff --git a/Apps/Sandcastle/gallery/Extent Outline.jpg b/Apps/Sandcastle/gallery/Rectangle Outline.jpg similarity index 100% rename from Apps/Sandcastle/gallery/Extent Outline.jpg rename to Apps/Sandcastle/gallery/Rectangle Outline.jpg diff --git a/Apps/Sandcastle/gallery/Extent.html b/Apps/Sandcastle/gallery/Rectangle.html similarity index 75% rename from Apps/Sandcastle/gallery/Extent.html rename to Apps/Sandcastle/gallery/Rectangle.html index f13bb7b819eb..006f6134093f 100644 --- a/Apps/Sandcastle/gallery/Extent.html +++ b/Apps/Sandcastle/gallery/Rectangle.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE --> <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> - <meta name="description" content="An extent."> + <meta name="description" content="An rectangle."> <meta name="cesium-sandcastle-labels" content="Geometries"> <title>Cesium Demo</title> <script type="text/javascript" src="../Sandcastle-header.js"></script> @@ -31,11 +31,11 @@ var scene = viewer.scene; var primitives = scene.primitives; - // Red extent - var extent = Cesium.Extent.fromDegrees(-110.0, 20.0, -80.0, 25.0); - var redExtentInstance = new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : extent, + // Red rectangle + var rectangle = Cesium.Rectangle.fromDegrees(-110.0, 20.0, -80.0, 25.0); + var redRectangleInstance = new Cesium.GeometryInstance({ + geometry : new Cesium.RectangleGeometry({ + rectangle : rectangle, vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT }), attributes: { @@ -43,11 +43,11 @@ } }); - // Green extruded extent - extent = Cesium.Extent.fromDegrees(-100.0, 30.0, -90.0, 40.0); - var greenExtentInstance = new Cesium.GeometryInstance({ - geometry : new Cesium.ExtentGeometry({ - extent : extent, + // Green extruded rectangle + rectangle = Cesium.Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var greenRectangleInstance = new Cesium.GeometryInstance({ + geometry : new Cesium.RectangleGeometry({ + rectangle : rectangle, rotation : Cesium.Math.toRadians(45), extrudedHeight : 300000.0, height : 100000.0, @@ -58,9 +58,9 @@ } }); - // Add extent instances to primitives + // Add rectangle instances to primitives primitives.add(new Cesium.Primitive({ - geometryInstances : [redExtentInstance, greenExtentInstance], + geometryInstances : [redRectangleInstance, greenRectangleInstance], appearance : new Cesium.PerInstanceColorAppearance({ closed : true }) diff --git a/Apps/Sandcastle/gallery/Extent.jpg b/Apps/Sandcastle/gallery/Rectangle.jpg similarity index 100% rename from Apps/Sandcastle/gallery/Extent.jpg rename to Apps/Sandcastle/gallery/Rectangle.jpg diff --git a/Apps/Sandcastle/gallery/Terrain.html b/Apps/Sandcastle/gallery/Terrain.html index a1a755a26947..08df86ff1fb4 100644 --- a/Apps/Sandcastle/gallery/Terrain.html +++ b/Apps/Sandcastle/gallery/Terrain.html @@ -57,7 +57,7 @@ up = new Cesium.Cartesian3(-0.4501898855076042, -0.0000291369789812141, 0.8929328452557279); scene.camera.lookAt(eye, target, up); } else { - scene.camera.viewExtent(new Cesium.Extent(1.516102969, 0.48744464, 1.518102969, 0.48944464)); + scene.camera.viewRectangle(new Cesium.Rectangle(1.516102969, 0.48744464, 1.518102969, 0.48944464)); } }, 'zoomButtons'); @@ -75,7 +75,7 @@ up = new Cesium.Cartesian3(0.2679197697914868, 0.011480478929947842, 0.9633728227203466); scene.camera.lookAt(eye, target, up); } else { - scene.camera.viewExtent(new Cesium.Extent(-2.08724538, 0.6577939, -2.08524538, 0.6597939)); + scene.camera.viewRectangle(new Cesium.Rectangle(-2.08724538, 0.6577939, -2.08524538, 0.6597939)); } }, 'zoomButtons'); @@ -93,7 +93,7 @@ up = new Cesium.Cartesian3(-0.3806859699462094, 0.18891270085627615, 0.905201736488051); scene.camera.lookAt(eye, target, up); } else { - scene.camera.viewExtent(new Cesium.Extent(-2.147621889, 0.64829691, -2.125621889, 0.67029691)); + scene.camera.viewRectangle(new Cesium.Rectangle(-2.147621889, 0.64829691, -2.125621889, 0.67029691)); } }, 'zoomButtons'); @@ -150,8 +150,8 @@ var gridHeight = 41; var everestLatitude = Cesium.Math.toRadians(27.988257); var everestLongitude = Cesium.Math.toRadians(86.925145); - var extentHalfSize = 0.005; - var e = new Cesium.Extent(everestLongitude - extentHalfSize,everestLatitude - extentHalfSize,everestLongitude + extentHalfSize,everestLatitude + extentHalfSize); + var rectangleHalfSize = 0.005; + var e = new Cesium.Rectangle(everestLongitude - rectangleHalfSize,everestLatitude - rectangleHalfSize,everestLongitude + rectangleHalfSize,everestLatitude + rectangleHalfSize); terrainSamplePositions = []; for (var y = 0; y < gridHeight; ++y) { for (var x = 0; x < gridWidth; ++x) { diff --git a/CHANGES.md b/CHANGES.md index 4addee184254..ca37509dff5a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,26 @@ Change Log Beta Releases ------------- +### b28 - 2014-05-01 + +* Breaking changes: + * Rename Extent to Rectangle + * `Extent` -> `Rectangle` + * `ExtentGeometry` -> `RectangleGeomtry` + * `ExtentGeometryOutline` -> `RectangleGeometryOutline` + * `ExtentPrimitive` -> `RectanglePrimitive` + * `BoundingRectangle.fromExtent` -> `BoundingRectangle.fromRectangle` + * `BoundingSphere.fromExtent2D` -> `BoundingSphere.fromRectangle2D` + * `BoundingSphere.fromExtentWithHeights2D` -> `BoundingSphere.fromRectangleWithHeights2D` + * `BoundingSphere.fromExtent3D` -> `BoundingSphere.fromRectangle3D` + * `EllipsoidalOccluder.computeHorizonCullingPointFromExtent` -> `EllipsoidalOccluder.computeHorizonCullingPointFromRectangle` + * `Occluder.computeOccludeePointFromExtent` -> `Occluder.computeOccludeePointFromRectangle` + * `Camera.getExtentCameraCoordinates` -> `Camera.getRectangleCameraCoordinates` + * `Camera.viewExtent` -> `Camera.viewRectangle` + * `CameraFlightPath.createAnimationExtent` -> `CameraFlightPath.createAnimationRectangle` + * `TilingScheme.extentToNativeRectangle` -> `TilingScheme.rectangleToNativeRectangle` + * `TilingScheme.tileXYToNativeExtent` -> `TilingScheme.tileXYToNativeRectangle` + * `TilingScheme.tileXYToExtent` -> `TilingScheme.tileXYToRectangle` ### b27 - 2014-04-01 diff --git a/Source/Core/BoundingRectangle.js b/Source/Core/BoundingRectangle.js index d7f28f7e54e8..4be75a5e1b62 100644 --- a/Source/Core/BoundingRectangle.js +++ b/Source/Core/BoundingRectangle.js @@ -5,7 +5,7 @@ define([ './DeveloperError', './Cartesian2', './Cartographic', - './Extent', + './Rectangle', './GeographicProjection', './Intersect' ], function( @@ -14,7 +14,7 @@ define([ DeveloperError, Cartesian2, Cartographic, - Extent, + Rectangle, GeographicProjection, Intersect) { "use strict"; @@ -110,23 +110,23 @@ define([ }; var defaultProjection = new GeographicProjection(); - var fromExtentLowerLeft = new Cartographic(); - var fromExtentUpperRight = new Cartographic(); + var fromRectangleLowerLeft = new Cartographic(); + var fromRectangleUpperRight = new Cartographic(); /** - * Computes a bounding rectangle from an extent. + * Computes a bounding rectangle from an rectangle. * @memberof BoundingRectangle * - * @param {Extent} extent The valid extent used to create a bounding rectangle. - * @param {Object} [projection=GeographicProjection] The projection used to project the extent into 2D. + * @param {Rectangle} rectangle The valid rectangle used to create a bounding rectangle. + * @param {Object} [projection=GeographicProjection] The projection used to project the rectangle into 2D. * @param {BoundingRectangle} [result] The object onto which to store the result. * @returns {BoundingRectangle} The modified result parameter or a new BoundingRectangle instance if one was not provided. */ - BoundingRectangle.fromExtent = function(extent, projection, result) { + BoundingRectangle.fromRectangle = function(rectangle, projection, result) { if (!defined(result)) { result = new BoundingRectangle(); } - if (!defined(extent)) { + if (!defined(rectangle)) { result.x = 0; result.y = 0; result.width = 0; @@ -136,8 +136,8 @@ define([ projection = defaultValue(projection, defaultProjection); - var lowerLeft = projection.project(Extent.getSouthwest(extent, fromExtentLowerLeft)); - var upperRight = projection.project(Extent.getNortheast(extent, fromExtentUpperRight)); + var lowerLeft = projection.project(Rectangle.getSouthwest(rectangle, fromRectangleLowerLeft)); + var upperRight = projection.project(Rectangle.getNortheast(rectangle, fromRectangleUpperRight)); Cartesian2.subtract(upperRight, lowerLeft, upperRight); diff --git a/Source/Core/BoundingSphere.js b/Source/Core/BoundingSphere.js index 6c809bb9f3c5..9a9df6b2770d 100644 --- a/Source/Core/BoundingSphere.js +++ b/Source/Core/BoundingSphere.js @@ -6,7 +6,7 @@ define([ './defined', './DeveloperError', './Ellipsoid', - './Extent', + './Rectangle', './GeographicProjection', './Intersect', './Interval', @@ -18,7 +18,7 @@ define([ defined, DeveloperError, Ellipsoid, - Extent, + Rectangle, GeographicProjection, Intersect, Interval, @@ -214,44 +214,44 @@ define([ }; var defaultProjection = new GeographicProjection(); - var fromExtent2DLowerLeft = new Cartesian3(); - var fromExtent2DUpperRight = new Cartesian3(); - var fromExtent2DSouthwest = new Cartographic(); - var fromExtent2DNortheast = new Cartographic(); + var fromRectangle2DLowerLeft = new Cartesian3(); + var fromRectangle2DUpperRight = new Cartesian3(); + var fromRectangle2DSouthwest = new Cartographic(); + var fromRectangle2DNortheast = new Cartographic(); /** - * Computes a bounding sphere from an extent projected in 2D. + * Computes a bounding sphere from an rectangle projected in 2D. * * @memberof BoundingSphere * - * @param {Extent} extent The extent around which to create a bounding sphere. - * @param {Object} [projection=GeographicProjection] The projection used to project the extent into 2D. + * @param {Rectangle} rectangle The rectangle around which to create a bounding sphere. + * @param {Object} [projection=GeographicProjection] The projection used to project the rectangle into 2D. * @param {BoundingSphere} [result] The object onto which to store the result. * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided. */ - BoundingSphere.fromExtent2D = function(extent, projection, result) { - return BoundingSphere.fromExtentWithHeights2D(extent, projection, 0.0, 0.0, result); + BoundingSphere.fromRectangle2D = function(rectangle, projection, result) { + return BoundingSphere.fromRectangleWithHeights2D(rectangle, projection, 0.0, 0.0, result); }; /** - * Computes a bounding sphere from an extent projected in 2D. The bounding sphere accounts for the - * object's minimum and maximum heights over the extent. + * Computes a bounding sphere from an rectangle projected in 2D. The bounding sphere accounts for the + * object's minimum and maximum heights over the rectangle. * * @memberof BoundingSphere * - * @param {Extent} extent The extent around which to create a bounding sphere. - * @param {Object} [projection=GeographicProjection] The projection used to project the extent into 2D. - * @param {Number} [minimumHeight=0.0] The minimum height over the extent. - * @param {Number} [maximumHeight=0.0] The maximum height over the extent. + * @param {Rectangle} rectangle The rectangle around which to create a bounding sphere. + * @param {Object} [projection=GeographicProjection] The projection used to project the rectangle into 2D. + * @param {Number} [minimumHeight=0.0] The minimum height over the rectangle. + * @param {Number} [maximumHeight=0.0] The maximum height over the rectangle. * @param {BoundingSphere} [result] The object onto which to store the result. * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided. */ - BoundingSphere.fromExtentWithHeights2D = function(extent, projection, minimumHeight, maximumHeight, result) { + BoundingSphere.fromRectangleWithHeights2D = function(rectangle, projection, minimumHeight, maximumHeight, result) { if (!defined(result)) { result = new BoundingSphere(); } - if (!defined(extent)) { + if (!defined(rectangle)) { result.center = Cartesian3.clone(Cartesian3.ZERO, result.center); result.radius = 0.0; return result; @@ -259,13 +259,13 @@ define([ projection = defaultValue(projection, defaultProjection); - Extent.getSouthwest(extent, fromExtent2DSouthwest); - fromExtent2DSouthwest.height = minimumHeight; - Extent.getNortheast(extent, fromExtent2DNortheast); - fromExtent2DNortheast.height = maximumHeight; + Rectangle.getSouthwest(rectangle, fromRectangle2DSouthwest); + fromRectangle2DSouthwest.height = minimumHeight; + Rectangle.getNortheast(rectangle, fromRectangle2DNortheast); + fromRectangle2DNortheast.height = maximumHeight; - var lowerLeft = projection.project(fromExtent2DSouthwest, fromExtent2DLowerLeft); - var upperRight = projection.project(fromExtent2DNortheast, fromExtent2DUpperRight); + var lowerLeft = projection.project(fromRectangle2DSouthwest, fromRectangle2DLowerLeft); + var upperRight = projection.project(fromRectangle2DNortheast, fromRectangle2DUpperRight); var width = upperRight.x - lowerLeft.x; var height = upperRight.y - lowerLeft.y; @@ -279,26 +279,26 @@ define([ return result; }; - var fromExtent3DScratch = []; + var fromRectangle3DScratch = []; /** - * Computes a bounding sphere from an extent in 3D. The bounding sphere is created using a subsample of points - * on the ellipsoid and contained in the extent. It may not be accurate for all extents on all types of ellipsoids. + * Computes a bounding sphere from an rectangle in 3D. The bounding sphere is created using a subsample of points + * on the ellipsoid and contained in the rectangle. It may not be accurate for all rectangles on all types of ellipsoids. * @memberof BoundingSphere * - * @param {Extent} extent The valid extent used to create a bounding sphere. - * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid used to determine positions of the extent. + * @param {Rectangle} rectangle The valid rectangle used to create a bounding sphere. + * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid used to determine positions of the rectangle. * @param {Number} [surfaceHeight=0.0] The height above the surface of the ellipsoid. * @param {BoundingSphere} [result] The object onto which to store the result. * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided. */ - BoundingSphere.fromExtent3D = function(extent, ellipsoid, surfaceHeight, result) { + BoundingSphere.fromRectangle3D = function(rectangle, ellipsoid, surfaceHeight, result) { ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84); surfaceHeight = defaultValue(surfaceHeight, 0.0); var positions; - if (defined(extent)) { - positions = Extent.subsample(extent, ellipsoid, surfaceHeight, fromExtent3DScratch); + if (defined(rectangle)) { + positions = Rectangle.subsample(rectangle, ellipsoid, surfaceHeight, fromRectangle3DScratch); } return BoundingSphere.fromPoints(positions, result); @@ -496,8 +496,8 @@ define([ * * @memberof BoundingSphere * - * @param {Number} [corner] The minimum height over the extent. - * @param {Number} [oppositeCorner] The maximum height over the extent. + * @param {Number} [corner] The minimum height over the rectangle. + * @param {Number} [oppositeCorner] The maximum height over the rectangle. * @param {BoundingSphere} [result] The object onto which to store the result. * * @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided. diff --git a/Source/Core/EllipsoidalOccluder.js b/Source/Core/EllipsoidalOccluder.js index dd774c691915..276e53883420 100644 --- a/Source/Core/EllipsoidalOccluder.js +++ b/Source/Core/EllipsoidalOccluder.js @@ -6,7 +6,7 @@ define([ './DeveloperError', './Cartesian3', './BoundingSphere', - './Extent' + './Rectangle' ], function( defaultValue, defined, @@ -14,7 +14,7 @@ define([ DeveloperError, Cartesian3, BoundingSphere, - Extent) { + Rectangle) { "use strict"; /** @@ -235,25 +235,25 @@ define([ var subsampleScratch = []; /** - * Computes a point that can be used for horizon culling of an extent. If the point is below - * the horizon, the ellipsoid-conforming extent is guaranteed to be below the horizon as well. + * Computes a point that can be used for horizon culling of an rectangle. If the point is below + * the horizon, the ellipsoid-conforming rectangle is guaranteed to be below the horizon as well. * The returned point is expressed in the ellipsoid-scaled space and is suitable for use with * {@link EllipsoidalOccluder#isScaledSpacePointVisible}. * - * @param {Extent} extent The extent for which to compute the horizon culling point. - * @param {Ellipsoid} ellipsoid The ellipsoid on which the extent is defined. This may be different from + * @param {Rectangle} rectangle The rectangle for which to compute the horizon culling point. + * @param {Ellipsoid} ellipsoid The ellipsoid on which the rectangle is defined. This may be different from * the ellipsoid used by this instance for occlusion testing. * @param {Cartesian3} [result] The instance on which to store the result instead of allocating a new instance. * @returns {Cartesian3} The computed horizon culling point, expressed in the ellipsoid-scaled space. */ - EllipsoidalOccluder.prototype.computeHorizonCullingPointFromExtent = function(extent, ellipsoid, result) { + EllipsoidalOccluder.prototype.computeHorizonCullingPointFromRectangle = function(rectangle, ellipsoid, result) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required.'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required.'); } //>>includeEnd('debug'); - var positions = Extent.subsample(extent, ellipsoid, 0.0, subsampleScratch); + var positions = Rectangle.subsample(rectangle, ellipsoid, 0.0, subsampleScratch); var bs = BoundingSphere.fromPoints(positions); // If the bounding sphere center is too close to the center of the occluder, it doesn't make diff --git a/Source/Core/Geometry.js b/Source/Core/Geometry.js index ff5859aa77b1..e732d1a20a84 100644 --- a/Source/Core/Geometry.js +++ b/Source/Core/Geometry.js @@ -55,7 +55,7 @@ define([ * @demo <a href="http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Geometry%20and%20Appearances.html">Geometry and Appearances Demo</a> * * @see PolygonGeometry - * @see ExtentGeometry + * @see RectangleGeometry * @see EllipseGeometry * @see CircleGeometry * @see WallGeometry diff --git a/Source/Core/HeightmapTessellator.js b/Source/Core/HeightmapTessellator.js index 56d3e9a8e52a..654426c6485e 100644 --- a/Source/Core/HeightmapTessellator.js +++ b/Source/Core/HeightmapTessellator.js @@ -55,11 +55,11 @@ define([ * @param {Number} description.width The width of the heightmap, in height samples. * @param {Number} description.height The height of the heightmap, in height samples. * @param {Number} description.skirtHeight The height of skirts to drape at the edges of the heightmap. - * @param {Extent} description.nativeExtent An extent in the native coordinates of the heightmap's projection. For + * @param {Rectangle} description.nativeRectangle An rectangle in the native coordinates of the heightmap's projection. For * a heightmap with a geographic projection, this is degrees. For the web mercator * projection, this is meters. - * @param {Extent} [description.extent] The extent covered by the heightmap, in geodetic coordinates with north, south, east and - * west properties in radians. Either extent or nativeExtent must be provided. If both + * @param {Rectangle} [description.rectangle] The rectangle covered by the heightmap, in geodetic coordinates with north, south, east and + * west properties in radians. Either rectangle or nativeRectangle must be provided. If both * are provided, they're assumed to be consistent. * @param {Boolean} [description.isGeographic=true] True if the heightmap uses a {@link GeographicProjection}, or false if it uses * a {@link WebMercatorProjection}. @@ -99,7 +99,7 @@ define([ * width : width, * height : height, * skirtHeight : 0.0, - * nativeExtent : { + * nativeRectangle : { * west : 10.0, * east : 20.0, * south : 30.0, @@ -118,8 +118,8 @@ define([ if (!defined(description.vertices)) { throw new DeveloperError('description.vertices is required.'); } - if (!defined(description.nativeExtent)) { - throw new DeveloperError('description.nativeExtent is required.'); + if (!defined(description.nativeRectangle)) { + throw new DeveloperError('description.nativeRectangle is required.'); } if (!defined(description.skirtHeight)) { throw new DeveloperError('description.skirtHeight is required.'); @@ -150,31 +150,31 @@ define([ var oneOverCentralBodySemimajorAxis = 1.0 / ellipsoid.maximumRadius; - var nativeExtent = description.nativeExtent; + var nativeRectangle = description.nativeRectangle; var geographicWest; var geographicSouth; var geographicEast; var geographicNorth; - var extent = description.extent; - if (!defined(extent)) { + var rectangle = description.rectangle; + if (!defined(rectangle)) { if (isGeographic) { - geographicWest = toRadians(nativeExtent.west); - geographicSouth = toRadians(nativeExtent.south); - geographicEast = toRadians(nativeExtent.east); - geographicNorth = toRadians(nativeExtent.north); + geographicWest = toRadians(nativeRectangle.west); + geographicSouth = toRadians(nativeRectangle.south); + geographicEast = toRadians(nativeRectangle.east); + geographicNorth = toRadians(nativeRectangle.north); } else { - geographicWest = nativeExtent.west * oneOverCentralBodySemimajorAxis; - geographicSouth = piOverTwo - (2.0 * atan(exp(-nativeExtent.south * oneOverCentralBodySemimajorAxis))); - geographicEast = nativeExtent.east * oneOverCentralBodySemimajorAxis; - geographicNorth = piOverTwo - (2.0 * atan(exp(-nativeExtent.north * oneOverCentralBodySemimajorAxis))); + geographicWest = nativeRectangle.west * oneOverCentralBodySemimajorAxis; + geographicSouth = piOverTwo - (2.0 * atan(exp(-nativeRectangle.south * oneOverCentralBodySemimajorAxis))); + geographicEast = nativeRectangle.east * oneOverCentralBodySemimajorAxis; + geographicNorth = piOverTwo - (2.0 * atan(exp(-nativeRectangle.north * oneOverCentralBodySemimajorAxis))); } } else { - geographicWest = extent.west; - geographicSouth = extent.south; - geographicEast = extent.east; - geographicNorth = extent.north; + geographicWest = rectangle.west; + geographicSouth = rectangle.south; + geographicEast = rectangle.east; + geographicNorth = rectangle.north; } var relativeToCenter = defaultValue(description.relativeToCenter, Cartesian3.ZERO); @@ -187,8 +187,8 @@ define([ var elementMultiplier = defaultValue(structure.elementMultiplier, HeightmapTessellator.DEFAULT_STRUCTURE.elementMultiplier); var isBigEndian = defaultValue(structure.isBigEndian, HeightmapTessellator.DEFAULT_STRUCTURE.isBigEndian); - var granularityX = (nativeExtent.east - nativeExtent.west) / (width - 1); - var granularityY = (nativeExtent.north - nativeExtent.south) / (height - 1); + var granularityX = (nativeRectangle.east - nativeRectangle.west) / (width - 1); + var granularityY = (nativeRectangle.north - nativeRectangle.south) / (height - 1); var radiiSquared = ellipsoid.radiiSquared; var radiiSquaredX = radiiSquared.x; @@ -221,7 +221,7 @@ define([ row = height - 1; } - var latitude = nativeExtent.north - granularityY * row; + var latitude = nativeRectangle.north - granularityY * row; if (!isGeographic) { latitude = piOverTwo - (2.0 * atan(exp(-latitude * oneOverCentralBodySemimajorAxis))); @@ -244,7 +244,7 @@ define([ col = width - 1; } - var longitude = nativeExtent.west + granularityX * col; + var longitude = nativeRectangle.west + granularityX * col; if (!isGeographic) { longitude = longitude * oneOverCentralBodySemimajorAxis; diff --git a/Source/Core/ObjectOrientedBoundingBox.js b/Source/Core/ObjectOrientedBoundingBox.js index 52b01429f6cf..99aae6ba9ad5 100644 --- a/Source/Core/ObjectOrientedBoundingBox.js +++ b/Source/Core/ObjectOrientedBoundingBox.js @@ -368,7 +368,7 @@ define([ (defined(right)) && Cartesian3.equals(left.transformedPosition, right.transformedPosition) && Matrix3.equals(left.transformMatrix, right.transformMatrix) && - Cartesian3.equals(left.extent, right.extent)); + Cartesian3.equals(left.rectangle, right.rectangle)); }; /** diff --git a/Source/Core/Occluder.js b/Source/Core/Occluder.js index 1fed2966c5c1..b8f2cdf4ae90 100644 --- a/Source/Core/Occluder.js +++ b/Source/Core/Occluder.js @@ -7,7 +7,7 @@ define([ './defineProperties', './DeveloperError', './Ellipsoid', - './Extent', + './Rectangle', './Math', './Visibility' ], function( @@ -18,7 +18,7 @@ define([ defineProperties, DeveloperError, Ellipsoid, - Extent, + Rectangle, CesiumMath, Visibility) { "use strict"; @@ -405,27 +405,27 @@ define([ return Cartesian3.add(occluderPosition, Cartesian3.multiplyByScalar(occluderPlaneNormal, distance)); }; - var computeOccludeePointFromExtentScratch = []; + var computeOccludeePointFromRectangleScratch = []; /** - * Computes a point that can be used as the occludee position to the visibility functions from an extent. + * Computes a point that can be used as the occludee position to the visibility functions from an rectangle. * * @memberof Occluder * - * @param {Extent} extent The extent used to create a bounding sphere. - * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid used to determine positions of the extent. + * @param {Rectangle} rectangle The rectangle used to create a bounding sphere. + * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid used to determine positions of the rectangle. * * @returns {Object} An object containing two attributes: <code>occludeePoint</code> and <code>valid</code> * which is a boolean value. */ - Occluder.computeOccludeePointFromExtent = function(extent, ellipsoid) { + Occluder.computeOccludeePointFromRectangle = function(rectangle, ellipsoid) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required.'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required.'); } //>>includeEnd('debug'); ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84); - var positions = Extent.subsample(extent, ellipsoid, 0.0, computeOccludeePointFromExtentScratch); + var positions = Rectangle.subsample(rectangle, ellipsoid, 0.0, computeOccludeePointFromRectangleScratch); var bs = BoundingSphere.fromPoints(positions); // TODO: get correct ellipsoid center diff --git a/Source/Core/Extent.js b/Source/Core/Rectangle.js similarity index 57% rename from Source/Core/Extent.js rename to Source/Core/Rectangle.js index 7e0e7b3513ec..d6d1b5ba4c76 100644 --- a/Source/Core/Extent.js +++ b/Source/Core/Rectangle.js @@ -20,7 +20,7 @@ define([ /** * A two dimensional region specified as longitude and latitude coordinates. * - * @alias Extent + * @alias Rectangle * @constructor * * @param {Number} [west=0.0] The westernmost longitude, in radians, in the range [-Pi, Pi]. @@ -28,7 +28,7 @@ define([ * @param {Number} [east=0.0] The easternmost longitude, in radians, in the range [-Pi, Pi]. * @param {Number} [north=0.0] The northernmost latitude, in radians, in the range [-Pi/2, Pi/2]. */ - var Extent = function(west, south, east, north) { + var Rectangle = function(west, south, east, north) { /** * The westernmost longitude in radians in the range [-Pi, Pi]. * @@ -63,29 +63,29 @@ define([ }; /** - * Creates an extent given the boundary longitude and latitude in degrees. + * Creates an rectangle given the boundary longitude and latitude in degrees. * - * @memberof Extent + * @memberof Rectangle * * @param {Number} [west=0.0] The westernmost longitude in degrees in the range [-180.0, 180.0]. * @param {Number} [south=0.0] The southernmost latitude in degrees in the range [-90.0, 90.0]. * @param {Number} [east=0.0] The easternmost longitude in degrees in the range [-180.0, 180.0]. * @param {Number} [north=0.0] The northernmost latitude in degrees in the range [-90.0, 90.0]. - * @param {Extent} [result] The object onto which to store the result, or undefined if a new instance should be created. + * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created. * - * @returns {Extent} The modified result parameter or a new Extent instance if none was provided. + * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided. * * @example - * var extent = Cesium.Extent.fromDegrees(0.0, 20.0, 10.0, 30.0); + * var rectangle = Cesium.Rectangle.fromDegrees(0.0, 20.0, 10.0, 30.0); */ - Extent.fromDegrees = function(west, south, east, north, result) { + Rectangle.fromDegrees = function(west, south, east, north, result) { west = CesiumMath.toRadians(defaultValue(west, 0.0)); south = CesiumMath.toRadians(defaultValue(south, 0.0)); east = CesiumMath.toRadians(defaultValue(east, 0.0)); north = CesiumMath.toRadians(defaultValue(north, 0.0)); if (!defined(result)) { - return new Extent(west, south, east, north); + return new Rectangle(west, south, east, north); } result.west = west; @@ -97,14 +97,14 @@ define([ }; /** - * Creates the smallest possible Extent that encloses all positions in the provided array. - * @memberof Extent + * Creates the smallest possible Rectangle that encloses all positions in the provided array. + * @memberof Rectangle * * @param {Array} cartographics The list of Cartographic instances. - * @param {Extent} [result] The object onto which to store the result, or undefined if a new instance should be created. - * @returns {Extent} The modified result parameter or a new Extent instance if none was provided. + * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created. + * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided. */ - Extent.fromCartographicArray = function(cartographics, result) { + Rectangle.fromCartographicArray = function(cartographics, result) { //>>includeStart('debug', pragmas.debug); if (!defined(cartographics)) { throw new DeveloperError('cartographics is required.'); @@ -125,7 +125,7 @@ define([ } if (!defined(result)) { - return new Extent(minLon, minLat, maxLon, maxLat); + return new Rectangle(minLon, minLat, maxLon, maxLat); } result.west = minLon; @@ -136,66 +136,66 @@ define([ }; /** - * Duplicates an Extent. + * Duplicates an Rectangle. * - * @memberof Extent + * @memberof Rectangle * - * @param {Extent} extent The extent to clone. - * @param {Extent} [result] The object onto which to store the result, or undefined if a new instance should be created. - * @returns {Extent} The modified result parameter or a new Extent instance if none was provided. (Returns undefined if extent is undefined) + * @param {Rectangle} rectangle The rectangle to clone. + * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created. + * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided. (Returns undefined if rectangle is undefined) */ - Extent.clone = function(extent, result) { - if (!defined(extent)) { + Rectangle.clone = function(rectangle, result) { + if (!defined(rectangle)) { return undefined; } if (!defined(result)) { - return new Extent(extent.west, extent.south, extent.east, extent.north); + return new Rectangle(rectangle.west, rectangle.south, rectangle.east, rectangle.north); } - result.west = extent.west; - result.south = extent.south; - result.east = extent.east; - result.north = extent.north; + result.west = rectangle.west; + result.south = rectangle.south; + result.east = rectangle.east; + result.north = rectangle.north; return result; }; /** - * Duplicates this Extent. + * Duplicates this Rectangle. * - * @memberof Extent + * @memberof Rectangle * - * @param {Extent} [result] The object onto which to store the result. - * @returns {Extent} The modified result parameter or a new Extent instance if none was provided. + * @param {Rectangle} [result] The object onto which to store the result. + * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided. */ - Extent.prototype.clone = function(result) { - return Extent.clone(this, result); + Rectangle.prototype.clone = function(result) { + return Rectangle.clone(this, result); }; /** - * Compares the provided Extent with this Extent componentwise and returns + * Compares the provided Rectangle with this Rectangle componentwise and returns * <code>true</code> if they are equal, <code>false</code> otherwise. - * @memberof Extent + * @memberof Rectangle * - * @param {Extent} [other] The Extent to compare. - * @returns {Boolean} <code>true</code> if the Extents are equal, <code>false</code> otherwise. + * @param {Rectangle} [other] The Rectangle to compare. + * @returns {Boolean} <code>true</code> if the Rectangles are equal, <code>false</code> otherwise. */ - Extent.prototype.equals = function(other) { - return Extent.equals(this, other); + Rectangle.prototype.equals = function(other) { + return Rectangle.equals(this, other); }; /** - * Compares the provided extents and returns <code>true</code> if they are equal, + * Compares the provided rectangles and returns <code>true</code> if they are equal, * <code>false</code> otherwise. * - * @memberof Extent + * @memberof Rectangle * - * @param {Extent} [left] The first Extent. - * @param {Extent} [right] The second Extent. + * @param {Rectangle} [left] The first Rectangle. + * @param {Rectangle} [right] The second Rectangle. * * @returns {Boolean} <code>true</code> if left and right are equal; otherwise <code>false</code>. */ - Extent.equals = function(left, right) { + Rectangle.equals = function(left, right) { return (left === right) || ((defined(left)) && (defined(right)) && @@ -206,16 +206,16 @@ define([ }; /** - * Compares the provided Extent with this Extent componentwise and returns + * Compares the provided Rectangle with this Rectangle componentwise and returns * <code>true</code> if they are within the provided epsilon, * <code>false</code> otherwise. - * @memberof Extent + * @memberof Rectangle * - * @param {Extent} [other] The Extent to compare. + * @param {Rectangle} [other] The Rectangle to compare. * @param {Number} epsilon The epsilon to use for equality testing. - * @returns {Boolean} <code>true</code> if the Extents are within the provided epsilon, <code>false</code> otherwise. + * @returns {Boolean} <code>true</code> if the Rectangles are within the provided epsilon, <code>false</code> otherwise. */ - Extent.prototype.equalsEpsilon = function(other, epsilon) { + Rectangle.prototype.equalsEpsilon = function(other, epsilon) { //>>includeStart('debug', pragmas.debug); if (typeof epsilon !== 'number') { throw new DeveloperError('epsilon is required and must be a number.'); @@ -230,22 +230,22 @@ define([ }; /** - * Checks an Extent's properties and throws if they are not in valid ranges. + * Checks an Rectangle's properties and throws if they are not in valid ranges. * - * @param {Extent} extent The extent to validate + * @param {Rectangle} rectangle The rectangle to validate * * @exception {DeveloperError} <code>north</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>]. * @exception {DeveloperError} <code>south</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>]. * @exception {DeveloperError} <code>east</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>]. * @exception {DeveloperError} <code>west</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>]. */ - Extent.validate = function(extent) { + Rectangle.validate = function(rectangle) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required'); } - var north = extent.north; + var north = rectangle.north; if (typeof north !== 'number') { throw new DeveloperError('north is required to be a number.'); } @@ -254,7 +254,7 @@ define([ throw new DeveloperError('north must be in the interval [-Pi/2, Pi/2].'); } - var south = extent.south; + var south = rectangle.south; if (typeof south !== 'number') { throw new DeveloperError('south is required to be a number.'); } @@ -263,7 +263,7 @@ define([ throw new DeveloperError('south must be in the interval [-Pi/2, Pi/2].'); } - var west = extent.west; + var west = rectangle.west; if (typeof west !== 'number') { throw new DeveloperError('west is required to be a number.'); } @@ -272,7 +272,7 @@ define([ throw new DeveloperError('west must be in the interval [-Pi, Pi].'); } - var east = extent.east; + var east = rectangle.east; if (typeof east !== 'number') { throw new DeveloperError('east is required to be a number.'); } @@ -284,150 +284,150 @@ define([ }; /** - * Computes the southwest corner of an extent. - * @memberof Extent + * Computes the southwest corner of an rectangle. + * @memberof Rectangle * - * @param {Extent} extent The extent for which to find the corner + * @param {Rectangle} rectangle The rectangle for which to find the corner * @param {Cartographic} [result] The object onto which to store the result. * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided. */ - Extent.getSouthwest = function(extent, result) { + Rectangle.getSouthwest = function(rectangle, result) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required'); } //>>includeEnd('debug'); if (!defined(result)) { - return new Cartographic(extent.west, extent.south); + return new Cartographic(rectangle.west, rectangle.south); } - result.longitude = extent.west; - result.latitude = extent.south; + result.longitude = rectangle.west; + result.latitude = rectangle.south; result.height = 0.0; return result; }; /** - * Computes the northwest corner of an extent. - * @memberof Extent + * Computes the northwest corner of an rectangle. + * @memberof Rectangle * - * @param {Extent} extent The extent for which to find the corner + * @param {Rectangle} rectangle The rectangle for which to find the corner * @param {Cartographic} [result] The object onto which to store the result. * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided. */ - Extent.getNorthwest = function(extent, result) { + Rectangle.getNorthwest = function(rectangle, result) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required'); } //>>includeEnd('debug'); if (!defined(result)) { - return new Cartographic(extent.west, extent.north); + return new Cartographic(rectangle.west, rectangle.north); } - result.longitude = extent.west; - result.latitude = extent.north; + result.longitude = rectangle.west; + result.latitude = rectangle.north; result.height = 0.0; return result; }; /** - * Computes the northeast corner of an extent. - * @memberof Extent + * Computes the northeast corner of an rectangle. + * @memberof Rectangle * - * @param {Extent} extent The extent for which to find the corner + * @param {Rectangle} rectangle The rectangle for which to find the corner * @param {Cartographic} [result] The object onto which to store the result. * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided. */ - Extent.getNortheast = function(extent, result) { + Rectangle.getNortheast = function(rectangle, result) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required'); } //>>includeEnd('debug'); if (!defined(result)) { - return new Cartographic(extent.east, extent.north); + return new Cartographic(rectangle.east, rectangle.north); } - result.longitude = extent.east; - result.latitude = extent.north; + result.longitude = rectangle.east; + result.latitude = rectangle.north; result.height = 0.0; return result; }; /** - * Computes the southeast corner of an extent. - * @memberof Extent + * Computes the southeast corner of an rectangle. + * @memberof Rectangle * - * @param {Extent} extent The extent for which to find the corner + * @param {Rectangle} rectangle The rectangle for which to find the corner * @param {Cartographic} [result] The object onto which to store the result. * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided. */ - Extent.getSoutheast = function(extent, result) { + Rectangle.getSoutheast = function(rectangle, result) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required'); } //>>includeEnd('debug'); if (!defined(result)) { - return new Cartographic(extent.east, extent.south); + return new Cartographic(rectangle.east, rectangle.south); } - result.longitude = extent.east; - result.latitude = extent.south; + result.longitude = rectangle.east; + result.latitude = rectangle.south; result.height = 0.0; return result; }; /** - * Computes the center of an extent. - * @memberof Extent + * Computes the center of an rectangle. + * @memberof Rectangle * - * @param {Extent} extent The extent for which to find the center + * @param {Rectangle} rectangle The rectangle for which to find the center * @param {Cartographic} [result] The object onto which to store the result. * @returns {Cartographic} The modified result parameter or a new Cartographic instance if none was provided. */ - Extent.getCenter = function(extent, result) { + Rectangle.getCenter = function(rectangle, result) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required'); } //>>includeEnd('debug'); if (!defined(result)) { - return new Cartographic((extent.west + extent.east) * 0.5, (extent.south + extent.north) * 0.5); + return new Cartographic((rectangle.west + rectangle.east) * 0.5, (rectangle.south + rectangle.north) * 0.5); } - result.longitude = (extent.west + extent.east) * 0.5; - result.latitude = (extent.south + extent.north) * 0.5; + result.longitude = (rectangle.west + rectangle.east) * 0.5; + result.latitude = (rectangle.south + rectangle.north) * 0.5; result.height = 0.0; return result; }; /** - * Computes the intersection of two extents - * @memberof Extent + * Computes the intersection of two rectangles + * @memberof Rectangle * - * @param {Extent} extent On extent to find an intersection - * @param otherExtent Another extent to find an intersection - * @param {Extent} [result] The object onto which to store the result. - * @returns {Extent} The modified result parameter or a new Extent instance if none was provided. + * @param {Rectangle} rectangle On rectangle to find an intersection + * @param otherRectangle Another rectangle to find an intersection + * @param {Rectangle} [result] The object onto which to store the result. + * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided. */ - Extent.intersectWith = function(extent, otherExtent, result) { + Rectangle.intersectWith = function(rectangle, otherRectangle, result) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required'); } - if (!defined(otherExtent)) { - throw new DeveloperError('otherExtent is required.'); + if (!defined(otherRectangle)) { + throw new DeveloperError('otherRectangle is required.'); } //>>includeEnd('debug'); - var west = Math.max(extent.west, otherExtent.west); - var south = Math.max(extent.south, otherExtent.south); - var east = Math.min(extent.east, otherExtent.east); - var north = Math.min(extent.north, otherExtent.north); + var west = Math.max(rectangle.west, otherRectangle.west); + var south = Math.max(rectangle.south, otherRectangle.south); + var east = Math.min(rectangle.east, otherRectangle.east); + var north = Math.min(rectangle.north, otherRectangle.north); if (!defined(result)) { - return new Extent(west, south, east, north); + return new Rectangle(west, south, east, north); } result.west = west; result.south = south; @@ -437,64 +437,64 @@ define([ }; /** - * Returns true if the cartographic is on or inside the extent, false otherwise. - * @memberof Extent + * Returns true if the cartographic is on or inside the rectangle, false otherwise. + * @memberof Rectangle * - * @param {Extent} extent The extent + * @param {Rectangle} rectangle The rectangle * @param {Cartographic} cartographic The cartographic to test. - * @returns {Boolean} true if the provided cartographic is inside the extent, false otherwise. + * @returns {Boolean} true if the provided cartographic is inside the rectangle, false otherwise. */ - Extent.contains = function(extent, cartographic) { + Rectangle.contains = function(rectangle, cartographic) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required'); } if (!defined(cartographic)) { throw new DeveloperError('cartographic is required.'); } //>>includeEnd('debug'); - return cartographic.longitude >= extent.west && - cartographic.longitude <= extent.east && - cartographic.latitude >= extent.south && - cartographic.latitude <= extent.north; + return cartographic.longitude >= rectangle.west && + cartographic.longitude <= rectangle.east && + cartographic.latitude >= rectangle.south && + cartographic.latitude <= rectangle.north; }; /** - * Determines if the extent is empty, i.e., if <code>west >= east</code> + * Determines if the rectangle is empty, i.e., if <code>west >= east</code> * or <code>south >= north</code>. * - * @memberof Extent + * @memberof Rectangle * - * @param {Extent} extent The extent - * @returns {Boolean} True if the extent is empty; otherwise, false. + * @param {Rectangle} rectangle The rectangle + * @returns {Boolean} True if the rectangle is empty; otherwise, false. */ - Extent.isEmpty = function(extent) { + Rectangle.isEmpty = function(rectangle) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required'); } //>>includeEnd('debug'); - return extent.west >= extent.east || extent.south >= extent.north; + return rectangle.west >= rectangle.east || rectangle.south >= rectangle.north; }; var subsampleLlaScratch = new Cartographic(); /** - * Samples an extent so that it includes a list of Cartesian points suitable for passing to + * Samples an rectangle so that it includes a list of Cartesian points suitable for passing to * {@link BoundingSphere#fromPoints}. Sampling is necessary to account - * for extents that cover the poles or cross the equator. + * for rectangles that cover the poles or cross the equator. * - * @param {Extent} extent The extent to subsample. + * @param {Rectangle} rectangle The rectangle to subsample. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid to use. - * @param {Number} [surfaceHeight=0.0] The height of the extent above the ellipsoid. + * @param {Number} [surfaceHeight=0.0] The height of the rectangle above the ellipsoid. * @param {Array} [result] The array of Cartesians onto which to store the result. * @returns {Array} The modified result parameter or a new Array of Cartesians instances if none was provided. */ - Extent.subsample = function(extent, ellipsoid, surfaceHeight, result) { + Rectangle.subsample = function(rectangle, ellipsoid, surfaceHeight, result) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required'); } //>>includeEnd('debug'); @@ -506,10 +506,10 @@ define([ } var length = 0; - var north = extent.north; - var south = extent.south; - var east = extent.east; - var west = extent.west; + var north = rectangle.north; + var south = rectangle.south; + var east = rectangle.east; + var west = rectangle.west; var lla = subsampleLlaScratch; lla.height = surfaceHeight; @@ -561,11 +561,11 @@ define([ }; /** - * The largest possible extent. - * @memberof Extent - * @type Extent + * The largest possible rectangle. + * @memberof Rectangle + * @type Rectangle */ - Extent.MAX_VALUE = freezeObject(new Extent(-Math.PI, -CesiumMath.PI_OVER_TWO, Math.PI, CesiumMath.PI_OVER_TWO)); + Rectangle.MAX_VALUE = freezeObject(new Rectangle(-Math.PI, -CesiumMath.PI_OVER_TWO, Math.PI, CesiumMath.PI_OVER_TWO)); - return Extent; + return Rectangle; }); diff --git a/Source/Core/ExtentGeometry.js b/Source/Core/RectangleGeometry.js similarity index 83% rename from Source/Core/ExtentGeometry.js rename to Source/Core/RectangleGeometry.js index 85078ed63dcd..95198ee55552 100644 --- a/Source/Core/ExtentGeometry.js +++ b/Source/Core/RectangleGeometry.js @@ -10,7 +10,7 @@ define([ './IndexDatatype', './DeveloperError', './Ellipsoid', - './Extent', + './Rectangle', './Geometry', './GeometryInstance', './GeometryPipeline', @@ -34,7 +34,7 @@ define([ IndexDatatype, DeveloperError, Ellipsoid, - Extent, + Rectangle, Geometry, GeometryInstance, GeometryPipeline, @@ -63,7 +63,7 @@ define([ var nwCartographic = new Cartographic(); var centerCartographic = new Cartographic(); var center = new Cartesian3(); - var stExtent = new Extent(); + var stRectangle = new Rectangle(); var textureMatrix = new Matrix2(); var rotationMatrix = new Matrix2(); var tangentRotationMatrix = new Matrix3(); @@ -305,8 +305,8 @@ define([ } function calculateST(vertexFormat, stIndex, wallTextureCoordinates, params, offset) { - textureCoordsScratch.x = (stLongitude - stExtent.west) * params.lonScalar - 0.5; - textureCoordsScratch.y = (stLatitude - stExtent.south) * params.latScalar - 0.5; + textureCoordsScratch.x = (stLongitude - stRectangle.west) * params.lonScalar - 0.5; + textureCoordsScratch.y = (stLatitude - stRectangle.south) * params.latScalar - 0.5; Matrix2.multiplyByVector(textureMatrix, textureCoordsScratch, textureCoordsScratch); @@ -332,7 +332,7 @@ define([ return wallPositions; } - function constructExtent(vertexFormat, params) { + function constructRectangle(vertexFormat, params) { var ellipsoid = params.ellipsoid; var size = params.size; var height = params.height; @@ -354,8 +354,8 @@ define([ positions[posIndex++] = position.z; if (vertexFormat.st) { - textureCoordsScratch.x = (stLongitude - stExtent.west) * params.lonScalar - 0.5; - textureCoordsScratch.y = (stLatitude - stExtent.south) * params.latScalar - 0.5; + textureCoordsScratch.x = (stLongitude - stRectangle.west) * params.lonScalar - 0.5; + textureCoordsScratch.y = (stLatitude - stRectangle.south) * params.latScalar - 0.5; Matrix2.multiplyByVector(textureMatrix, textureCoordsScratch, textureCoordsScratch); @@ -401,18 +401,18 @@ define([ } return { - boundingSphere : BoundingSphere.fromExtent3D(params.extent, ellipsoid, surfaceHeight), + boundingSphere : BoundingSphere.fromRectangle3D(params.rectangle, ellipsoid, surfaceHeight), geometry : geo }; } - function constructExtrudedExtent(vertexFormat, params) { + function constructExtrudedRectangle(vertexFormat, params) { var surfaceHeight = params.surfaceHeight; var extrudedHeight = params.extrudedHeight; var minHeight = Math.min(extrudedHeight, surfaceHeight); var maxHeight = Math.max(extrudedHeight, surfaceHeight); if (CesiumMath.equalsEpsilon(minHeight, maxHeight, 0.1)) { - return constructExtent(vertexFormat, params); + return constructRectangle(vertexFormat, params); } var height = params.height; @@ -605,8 +605,8 @@ define([ ]); } - var topBS = BoundingSphere.fromExtent3D(params.extent, ellipsoid, maxHeight, topBoundingSphere); - var bottomBS = BoundingSphere.fromExtent3D(params.extent, ellipsoid, minHeight, bottomBoundingSphere); + var topBS = BoundingSphere.fromRectangle3D(params.rectangle, ellipsoid, maxHeight, topBoundingSphere); + var bottomBS = BoundingSphere.fromRectangle3D(params.rectangle, ellipsoid, minHeight, bottomBoundingSphere); var boundingSphere = BoundingSphere.union(topBS, bottomBS); return { @@ -616,54 +616,54 @@ define([ } /** - * A description of a cartographic extent on an ellipsoid centered at the origin. + * A description of a cartographic rectangle on an ellipsoid centered at the origin. * - * @alias ExtentGeometry + * @alias RectangleGeometry * @constructor * - * @param {Extent} options.extent A cartographic extent with north, south, east and west properties in radians. + * @param {Rectangle} options.rectangle A cartographic rectangle with north, south, east and west properties in radians. * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed. - * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the extent lies. + * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the rectangle lies. * @param {Number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer. * @param {Number} [options.height=0.0] The height from the surface of the ellipsoid. - * @param {Number} [options.rotation=0.0] The rotation of the extent, in radians. A positive rotation is counter-clockwise. + * @param {Number} [options.rotation=0.0] The rotation of the rectangle, in radians. A positive rotation is counter-clockwise. * @param {Number} [options.stRotation=0.0] The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise. * @param {Number} [options.extrudedHeight] Height of extruded surface. - * @param {Boolean} [options.closeTop=true] <code>true</code> to render top of an extruded extent; <code>false</code> otherwise. (Only applicable if options.extrudedHeight is not equal to options.height.) - * @param {Boolean} [options.closeBottom=true] <code>true</code> to render bottom of an extruded extent; <code>false</code> otherwise. (Only applicable if options.extrudedHeight is not equal to options.height.) + * @param {Boolean} [options.closeTop=true] <code>true</code> to render top of an extruded rectangle; <code>false</code> otherwise. (Only applicable if options.extrudedHeight is not equal to options.height.) + * @param {Boolean} [options.closeBottom=true] <code>true</code> to render bottom of an extruded rectangle; <code>false</code> otherwise. (Only applicable if options.extrudedHeight is not equal to options.height.) * - * @exception {DeveloperError} <code>options.extent.north</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>]. - * @exception {DeveloperError} <code>options.extent.south</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>]. - * @exception {DeveloperError} <code>options.extent.east</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>]. - * @exception {DeveloperError} <code>options.extent.west</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>]. - * @exception {DeveloperError} <code>options.extent.north</code> must be greater than <code>options.extent.south</code>. - * @exception {DeveloperError} <code>options.extent.east</code> must be greater than <code>options.extent.west</code>. + * @exception {DeveloperError} <code>options.rectangle.north</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>]. + * @exception {DeveloperError} <code>options.rectangle.south</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>]. + * @exception {DeveloperError} <code>options.rectangle.east</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>]. + * @exception {DeveloperError} <code>options.rectangle.west</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>]. + * @exception {DeveloperError} <code>options.rectangle.north</code> must be greater than <code>options.rectangle.south</code>. + * @exception {DeveloperError} <code>options.rectangle.east</code> must be greater than <code>options.rectangle.west</code>. * - * @see ExtentGeometry#createGeometry + * @see RectangleGeometry#createGeometry * * @example - * // 1. create an extent - * var extent = new Cesium.ExtentGeometry({ + * // 1. create an rectangle + * var rectangle = new Cesium.RectangleGeometry({ * ellipsoid : Cesium.Ellipsoid.WGS84, - * extent : Cesium.Extent.fromDegrees(-80.0, 39.0, -74.0, 42.0), + * rectangle : Cesium.Rectangle.fromDegrees(-80.0, 39.0, -74.0, 42.0), * height : 10000.0 * }); - * var geometry = Cesium.ExtentGeometry.createGeometry(extent); + * var geometry = Cesium.RectangleGeometry.createGeometry(rectangle); * - * // 2. create an extruded extent without a top - * var extent = new Cesium.ExtentGeometry({ + * // 2. create an extruded rectangle without a top + * var rectangle = new Cesium.RectangleGeometry({ * ellipsoid : Cesium.Ellipsoid.WGS84, - * extent : Cesium.Extent.fromDegrees(-80.0, 39.0, -74.0, 42.0), + * rectangle : Cesium.Rectangle.fromDegrees(-80.0, 39.0, -74.0, 42.0), * height : 10000.0, * extrudedHieght: 300000, * closeTop: false * }); - * var geometry = Cesium.ExtentGeometry.createGeometry(extent); + * var geometry = Cesium.RectangleGeometry.createGeometry(rectangle); */ - var ExtentGeometry = function(options) { + var RectangleGeometry = function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); - var extent = options.extent; + var rectangle = options.rectangle; var granularity = defaultValue(options.granularity, CesiumMath.RADIANS_PER_DEGREE); var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84); var surfaceHeight = defaultValue(options.height, 0.0); @@ -672,19 +672,19 @@ define([ var vertexFormat = defaultValue(options.vertexFormat, VertexFormat.DEFAULT); //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required.'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required.'); } - Extent.validate(extent); - if (extent.east < extent.west) { - throw new DeveloperError('options.extent.east must be greater than options.extent.west'); + Rectangle.validate(rectangle); + if (rectangle.east < rectangle.west) { + throw new DeveloperError('options.rectangle.east must be greater than options.rectangle.west'); } - if (extent.north < extent.south) { - throw new DeveloperError('options.extent.north must be greater than options.extent.south'); + if (rectangle.north < rectangle.south) { + throw new DeveloperError('options.rectangle.north must be greater than options.rectangle.south'); } //>>includeEnd('debug'); - this._extent = extent; + this._rectangle = rectangle; this._granularity = granularity; this._ellipsoid = ellipsoid; this._surfaceHeight = surfaceHeight; @@ -694,40 +694,40 @@ define([ this._extrudedHeight = options.extrudedHeight; this._closeTop = options.closeTop; this._closeBottom = options.closeBottom; - this._workerName = 'createExtentGeometry'; + this._workerName = 'createRectangleGeometry'; }; /** - * Computes the geometric representation of an extent, including its vertices, indices, and a bounding sphere. - * @memberof ExtentGeometry + * Computes the geometric representation of an rectangle, including its vertices, indices, and a bounding sphere. + * @memberof RectangleGeometry * - * @param {ExtentGeometry} extentGeometry A description of the extent. + * @param {RectangleGeometry} rectangleGeometry A description of the rectangle. * @returns {Geometry} The computed vertices and indices. * - * @exception {DeveloperError} Rotated extent is invalid. + * @exception {DeveloperError} Rotated rectangle is invalid. */ - ExtentGeometry.createGeometry = function(extentGeometry) { - var extent = extentGeometry._extent; - var granularity = extentGeometry._granularity; - var ellipsoid = extentGeometry._ellipsoid; - var surfaceHeight = extentGeometry._surfaceHeight; - var rotation = extentGeometry._rotation; - var stRotation = extentGeometry._stRotation; - var vertexFormat = extentGeometry._vertexFormat; - var extrudedHeight = extentGeometry._extrudedHeight; - var closeTop = extentGeometry._closeTop; - var closeBottom = extentGeometry._closeBottom; - - var width = Math.ceil((extent.east - extent.west) / granularity) + 1; - var height = Math.ceil((extent.north - extent.south) / granularity) + 1; - var granularityX = (extent.east - extent.west) / (width - 1); - var granularityY = (extent.north - extent.south) / (height - 1); + RectangleGeometry.createGeometry = function(rectangleGeometry) { + var rectangle = rectangleGeometry._rectangle; + var granularity = rectangleGeometry._granularity; + var ellipsoid = rectangleGeometry._ellipsoid; + var surfaceHeight = rectangleGeometry._surfaceHeight; + var rotation = rectangleGeometry._rotation; + var stRotation = rectangleGeometry._stRotation; + var vertexFormat = rectangleGeometry._vertexFormat; + var extrudedHeight = rectangleGeometry._extrudedHeight; + var closeTop = rectangleGeometry._closeTop; + var closeBottom = rectangleGeometry._closeBottom; + + var width = Math.ceil((rectangle.east - rectangle.west) / granularity) + 1; + var height = Math.ceil((rectangle.north - rectangle.south) / granularity) + 1; + var granularityX = (rectangle.east - rectangle.west) / (width - 1); + var granularityY = (rectangle.north - rectangle.south) / (height - 1); var radiiSquared = ellipsoid.radiiSquared; - Extent.clone(extent, stExtent); - Extent.getNorthwest(extent, nwCartographic); - Extent.getCenter(extent, centerCartographic); + Rectangle.clone(rectangle, stRectangle); + Rectangle.getNorthwest(rectangle, nwCartographic); + Rectangle.getCenter(rectangle, centerCartographic); var granYCos = granularityY; var granXCos = granularityX; @@ -770,17 +770,17 @@ define([ if (!isValidLatLon(north, west) || !isValidLatLon(north, east) || !isValidLatLon(south, west) || !isValidLatLon(south, east)) { - throw new DeveloperError('Rotated extent is invalid.'); + throw new DeveloperError('Rotated rectangle is invalid.'); } - stExtent.north = north; - stExtent.south = south; - stExtent.east = east; - stExtent.west = west; + stRectangle.north = north; + stRectangle.south = south; + stRectangle.east = east; + stRectangle.west = west; } - var lonScalar = 1.0 / (stExtent.east - stExtent.west); - var latScalar = 1.0 / (stExtent.north - stExtent.south); + var lonScalar = 1.0 / (stRectangle.east - stRectangle.west); + var latScalar = 1.0 / (stRectangle.north - stRectangle.south); var size = width * height; @@ -806,7 +806,7 @@ define([ ellipsoid : ellipsoid, lonScalar : lonScalar, latScalar : latScalar, - extent : extent, + rectangle : rectangle, width : width, height : height, surfaceHeight : surfaceHeight, @@ -818,9 +818,9 @@ define([ var geometry; if (defined(extrudedHeight)) { - geometry = constructExtrudedExtent(vertexFormat, params); + geometry = constructExtrudedRectangle(vertexFormat, params); } else { - geometry = constructExtent(vertexFormat, params); + geometry = constructRectangle(vertexFormat, params); } var boundingSphere = geometry.boundingSphere; @@ -834,5 +834,5 @@ define([ }); }; - return ExtentGeometry; + return RectangleGeometry; }); diff --git a/Source/Core/ExtentOutlineGeometry.js b/Source/Core/RectangleOutlineGeometry.js similarity index 75% rename from Source/Core/ExtentOutlineGeometry.js rename to Source/Core/RectangleOutlineGeometry.js index 1fa714f1f5f0..8e6d79cd8faa 100644 --- a/Source/Core/ExtentOutlineGeometry.js +++ b/Source/Core/RectangleOutlineGeometry.js @@ -5,7 +5,7 @@ define([ './BoundingSphere', './Cartesian3', './Cartographic', - './Extent', + './Rectangle', './ComponentDatatype', './IndexDatatype', './DeveloperError', @@ -23,7 +23,7 @@ define([ BoundingSphere, Cartesian3, Cartographic, - Extent, + Rectangle, ComponentDatatype, IndexDatatype, DeveloperError, @@ -98,8 +98,8 @@ define([ } } - function constructExtent(params) { - var extent = params.extent; + function constructRectangle(params) { + var rectangle = params.rectangle; var ellipsoid = params.ellipsoid; var size = params.size; var height = params.height; @@ -154,20 +154,20 @@ define([ indices[index++] = 0; return { - boundingSphere : BoundingSphere.fromExtent3D(extent, ellipsoid, surfaceHeight), + boundingSphere : BoundingSphere.fromRectangle3D(rectangle, ellipsoid, surfaceHeight), positions: positions, indices: indices }; } - function constructExtrudedExtent(params, extrudedHeight) { + function constructExtrudedRectangle(params, extrudedHeight) { var surfaceHeight = params.surfaceHeight; var minHeight = Math.min(extrudedHeight, surfaceHeight); var maxHeight = Math.max(extrudedHeight, surfaceHeight); if (CesiumMath.equalsEpsilon(minHeight, maxHeight, 0.1)) { - return constructExtent(params); + return constructRectangle(params); } - var extent = params.extent; + var rectangle = params.rectangle; var height = params.height; var width = params.width; var size = params.size * 3; @@ -250,8 +250,8 @@ define([ indices[index++] = 2*width + height - 3 + length; - var topBS = BoundingSphere.fromExtent3D(extent, ellipsoid, maxHeight, topBoundingSphere); - var bottomBS = BoundingSphere.fromExtent3D(extent, ellipsoid, minHeight, bottomBoundingSphere); + var topBS = BoundingSphere.fromRectangle3D(rectangle, ellipsoid, maxHeight, topBoundingSphere); + var bottomBS = BoundingSphere.fromRectangle3D(rectangle, ellipsoid, minHeight, bottomBoundingSphere); var boundingSphere = BoundingSphere.union(topBS, bottomBS); return { @@ -262,92 +262,92 @@ define([ } /** - * A description of the outline of a a cartographic extent on an ellipsoid centered at the origin. + * A description of the outline of a a cartographic rectangle on an ellipsoid centered at the origin. * - * @alias ExtentOutlineGeometry + * @alias RectangleOutlineGeometry * @constructor * - * @param {Extent} options.extent A cartographic extent with north, south, east and west properties in radians. - * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the extent lies. + * @param {Rectangle} options.rectangle A cartographic rectangle with north, south, east and west properties in radians. + * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the rectangle lies. * @param {Number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer. * @param {Number} [options.height=0.0] The height from the surface of the ellipsoid. - * @param {Number} [options.rotation=0.0] The rotation of the extent, in radians. A positive rotation is counter-clockwise. + * @param {Number} [options.rotation=0.0] The rotation of the rectangle, in radians. A positive rotation is counter-clockwise. * @param {Number} [options.extrudedHeight] Height of extruded surface. * - * @exception {DeveloperError} <code>options.extent.north</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>]. - * @exception {DeveloperError} <code>options.extent.south</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>]. - * @exception {DeveloperError} <code>options.extent.east</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>]. - * @exception {DeveloperError} <code>options.extent.west</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>]. - * @exception {DeveloperError} <code>options.extent.north</code> must be greater than <code>extent.south</code>. - * @exception {DeveloperError} <code>options.extent.east</code> must be greater than <code>extent.west</code>. + * @exception {DeveloperError} <code>options.rectangle.north</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>]. + * @exception {DeveloperError} <code>options.rectangle.south</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>]. + * @exception {DeveloperError} <code>options.rectangle.east</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>]. + * @exception {DeveloperError} <code>options.rectangle.west</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>]. + * @exception {DeveloperError} <code>options.rectangle.north</code> must be greater than <code>rectangle.south</code>. + * @exception {DeveloperError} <code>options.rectangle.east</code> must be greater than <code>rectangle.west</code>. * - * @see ExtentOutlineGeometry#createGeometry + * @see RectangleOutlineGeometry#createGeometry * * @example - * var extent = new Cesium.ExtentOutlineGeometry({ + * var rectangle = new Cesium.RectangleOutlineGeometry({ * ellipsoid : Cesium.Ellipsoid.WGS84, - * extent : Cesium.Extent.fromDegrees(-80.0, 39.0, -74.0, 42.0), + * rectangle : Cesium.Rectangle.fromDegrees(-80.0, 39.0, -74.0, 42.0), * height : 10000.0 * }); - * var geometry = Cesium.ExtentOutlineGeometry.createGeometry(extent); + * var geometry = Cesium.RectangleOutlineGeometry.createGeometry(rectangle); */ - var ExtentOutlineGeometry = function(options) { + var RectangleOutlineGeometry = function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); - var extent = options.extent; + var rectangle = options.rectangle; var granularity = defaultValue(options.granularity, CesiumMath.RADIANS_PER_DEGREE); var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84); var surfaceHeight = defaultValue(options.height, 0.0); var rotation = options.rotation; //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required.'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required.'); } - Extent.validate(extent); - if (extent.east < extent.west) { - throw new DeveloperError('options.extent.east must be greater than options.extent.west'); + Rectangle.validate(rectangle); + if (rectangle.east < rectangle.west) { + throw new DeveloperError('options.rectangle.east must be greater than options.rectangle.west'); } - if (extent.north < extent.south) { - throw new DeveloperError('options.extent.north must be greater than options.extent.south'); + if (rectangle.north < rectangle.south) { + throw new DeveloperError('options.rectangle.north must be greater than options.rectangle.south'); } //>>includeEnd('debug'); - this._extent = extent; + this._rectangle = rectangle; this._granularity = granularity; this._ellipsoid = ellipsoid; this._surfaceHeight = surfaceHeight; this._rotation = rotation; this._extrudedHeight = options.extrudedHeight; - this._workerName = 'createExtentOutlineGeometry'; + this._workerName = 'createRectangleOutlineGeometry'; }; /** - * Computes the geometric representation of an outline of an extent, including its vertices, indices, and a bounding sphere. - * @memberof ExtentOutlineGeometry + * Computes the geometric representation of an outline of an rectangle, including its vertices, indices, and a bounding sphere. + * @memberof RectangleOutlineGeometry * - * @param {ExtentOutlineGeometry} extentGeometry A description of the extent outline. + * @param {RectangleOutlineGeometry} rectangleGeometry A description of the rectangle outline. * @returns {Geometry} The computed vertices and indices. * - * @exception {DeveloperError} Rotated extent is invalid. + * @exception {DeveloperError} Rotated rectangle is invalid. */ - ExtentOutlineGeometry.createGeometry = function(extentGeometry) { - var extent = extentGeometry._extent; - var granularity = extentGeometry._granularity; - var ellipsoid = extentGeometry._ellipsoid; - var surfaceHeight = extentGeometry._surfaceHeight; - var rotation = extentGeometry._rotation; - var extrudedHeight = extentGeometry._extrudedHeight; - - var width = Math.ceil((extent.east - extent.west) / granularity) + 1; - var height = Math.ceil((extent.north - extent.south) / granularity) + 1; - var granularityX = (extent.east - extent.west) / (width - 1); - var granularityY = (extent.north - extent.south) / (height - 1); + RectangleOutlineGeometry.createGeometry = function(rectangleGeometry) { + var rectangle = rectangleGeometry._rectangle; + var granularity = rectangleGeometry._granularity; + var ellipsoid = rectangleGeometry._ellipsoid; + var surfaceHeight = rectangleGeometry._surfaceHeight; + var rotation = rectangleGeometry._rotation; + var extrudedHeight = rectangleGeometry._extrudedHeight; + + var width = Math.ceil((rectangle.east - rectangle.west) / granularity) + 1; + var height = Math.ceil((rectangle.north - rectangle.south) / granularity) + 1; + var granularityX = (rectangle.east - rectangle.west) / (width - 1); + var granularityY = (rectangle.north - rectangle.south) / (height - 1); var radiiSquared = ellipsoid.radiiSquared; - Extent.getNorthwest(extent, nwCartographic); - Extent.getCenter(extent, centerCartographic); + Rectangle.getNorthwest(rectangle, nwCartographic); + Rectangle.getCenter(rectangle, centerCartographic); var granYCos = granularityY; var granXCos = granularityX; @@ -390,7 +390,7 @@ define([ if (!isValidLatLon(north, west) || !isValidLatLon(north, east) || !isValidLatLon(south, west) || !isValidLatLon(south, east)) { - throw new DeveloperError('Rotated extent is invalid.'); + throw new DeveloperError('Rotated rectangle is invalid.'); } } @@ -403,7 +403,7 @@ define([ granXSin : granXSin, radiiSquared : radiiSquared, ellipsoid : ellipsoid, - extent : extent, + rectangle : rectangle, width : width, height : height, surfaceHeight : surfaceHeight, @@ -412,9 +412,9 @@ define([ var geometry; if (defined(extrudedHeight)) { - geometry = constructExtrudedExtent(params, extrudedHeight); + geometry = constructExtrudedRectangle(params, extrudedHeight); } else { - geometry = constructExtent(params); + geometry = constructRectangle(params); } var attributes = new GeometryAttributes({ @@ -433,5 +433,5 @@ define([ }); }; - return ExtentOutlineGeometry; + return RectangleOutlineGeometry; }); diff --git a/Source/Core/WebMercatorProjection.js b/Source/Core/WebMercatorProjection.js index b736649f683b..f3769385aa44 100644 --- a/Source/Core/WebMercatorProjection.js +++ b/Source/Core/WebMercatorProjection.js @@ -89,7 +89,7 @@ define([ * to cut it off sooner because it grows exponentially with increasing latitude. * The logic behind this particular cutoff value, which is the one used by * Google Maps, Bing Maps, and Esri, is that it makes the projection - * square. That is, the extent is equal in the X and Y directions. + * square. That is, the rectangle is equal in the X and Y directions. * * The constant value is computed by calling: * WebMercatorProjection.mercatorAngleToGeodeticLatitude(Math.PI) diff --git a/Source/Scene/ArcGisImageServerTerrainProvider.js b/Source/Scene/ArcGisImageServerTerrainProvider.js index 7e841c61d8e6..86acbe9e1245 100644 --- a/Source/Scene/ArcGisImageServerTerrainProvider.js +++ b/Source/Scene/ArcGisImageServerTerrainProvider.js @@ -166,21 +166,21 @@ define([ * pending and the request will be retried later. */ ArcGisImageServerTerrainProvider.prototype.requestTileGeometry = function(x, y, level) { - var extent = this._tilingScheme.tileXYToExtent(x, y, level); + var rectangle = this._tilingScheme.tileXYToRectangle(x, y, level); // Each pixel in the heightmap represents the height at the center of that - // pixel. So expand the extent by half a sample spacing in each direction - // so that the first height is on the edge of the extent we need rather than - // half a sample spacing into the extent. - var xSpacing = (extent.east - extent.west) / (this._heightmapWidth - 1); - var ySpacing = (extent.north - extent.south) / (this._heightmapWidth - 1); - - extent.west -= xSpacing * 0.5; - extent.east += xSpacing * 0.5; - extent.south -= ySpacing * 0.5; - extent.north += ySpacing * 0.5; - - var bbox = CesiumMath.toDegrees(extent.west) + '%2C' + CesiumMath.toDegrees(extent.south) + '%2C' + CesiumMath.toDegrees(extent.east) + '%2C' + CesiumMath.toDegrees(extent.north); + // pixel. So expand the rectangle by half a sample spacing in each direction + // so that the first height is on the edge of the rectangle we need rather than + // half a sample spacing into the rectangle. + var xSpacing = (rectangle.east - rectangle.west) / (this._heightmapWidth - 1); + var ySpacing = (rectangle.north - rectangle.south) / (this._heightmapWidth - 1); + + rectangle.west -= xSpacing * 0.5; + rectangle.east += xSpacing * 0.5; + rectangle.south -= ySpacing * 0.5; + rectangle.north += ySpacing * 0.5; + + var bbox = CesiumMath.toDegrees(rectangle.west) + '%2C' + CesiumMath.toDegrees(rectangle.south) + '%2C' + CesiumMath.toDegrees(rectangle.east) + '%2C' + CesiumMath.toDegrees(rectangle.north); var url = this._url + '/exportImage?interpolation=RSP_BilinearInterpolation&format=tiff&f=image&size=' + this._heightmapWidth + '%2C' + this._heightmapWidth + '&bboxSR=4326&imageSR=4326&bbox=' + bbox; if (this._token) { diff --git a/Source/Scene/ArcGisMapServerImageryProvider.js b/Source/Scene/ArcGisMapServerImageryProvider.js index a482a1a1e9a9..37e5ec46ab09 100644 --- a/Source/Scene/ArcGisMapServerImageryProvider.js +++ b/Source/Scene/ArcGisMapServerImageryProvider.js @@ -164,8 +164,8 @@ define([ if (imageryProvider._useTiles) { url = imageryProvider._url + '/tile/' + level + '/' + y + '/' + x; } else { - var nativeExtent = imageryProvider._tilingScheme.tileXYToNativeExtent(x, y, level); - var bbox = nativeExtent.west + '%2C' + nativeExtent.south + '%2C' + nativeExtent.east + '%2C' + nativeExtent.north; + var nativeRectangle = imageryProvider._tilingScheme.tileXYToNativeRectangle(x, y, level); + var bbox = nativeRectangle.west + '%2C' + nativeRectangle.south + '%2C' + nativeRectangle.east + '%2C' + nativeRectangle.north; url = imageryProvider._url + '/export?'; url += 'bbox=' + bbox; @@ -294,20 +294,20 @@ define([ }, /** - * Gets the extent, in radians, of the imagery provided by this instance. This function should + * Gets the rectangle, in radians, of the imagery provided by this instance. This function should * not be called before {@link ArcGisMapServerImageryProvider#ready} returns true. * @memberof ArcGisMapServerImageryProvider.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : function() { //>>includeStart('debug', pragmas.debug); if (!this._ready) { - throw new DeveloperError('extent must not be called before the imagery provider is ready.'); + throw new DeveloperError('rectangle must not be called before the imagery provider is ready.'); } //>>includeEnd('debug'); - return this._tilingScheme.extent; + return this._tilingScheme.rectangle; } }, diff --git a/Source/Scene/BingMapsImageryProvider.js b/Source/Scene/BingMapsImageryProvider.js index 8d2c19039a28..afb3e15f90cc 100644 --- a/Source/Scene/BingMapsImageryProvider.js +++ b/Source/Scene/BingMapsImageryProvider.js @@ -8,7 +8,7 @@ define([ '../Core/Cartesian2', '../Core/DeveloperError', '../Core/Event', - '../Core/Extent', + '../Core/Rectangle', '../Core/Math', './BingMapsStyle', './DiscardMissingTileImagePolicy', @@ -26,7 +26,7 @@ define([ Cartesian2, DeveloperError, Event, - Extent, + Rectangle, CesiumMath, BingMapsStyle, DiscardMissingTileImagePolicy, @@ -178,7 +178,7 @@ define([ for (var areaIndex = 0, areaLength = attribution.coverageAreas.length; areaIndex < areaLength; ++areaIndex) { var area = coverageAreas[areaIndex]; var bbox = area.bbox; - area.bbox = new Extent( + area.bbox = new Rectangle( CesiumMath.toRadians(bbox[1]), CesiumMath.toRadians(bbox[0]), CesiumMath.toRadians(bbox[3]), @@ -344,20 +344,20 @@ define([ }, /** - * Gets the extent, in radians, of the imagery provided by this instance. This function should + * Gets the rectangle, in radians, of the imagery provided by this instance. This function should * not be called before {@link BingMapsImageryProvider#ready} returns true. * @memberof BingMapsImageryProvider.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : function() { //>>includeStart('debug', pragmas.debug); if (!this._ready) { - throw new DeveloperError('extent must not be called before the imagery provider is ready.'); + throw new DeveloperError('rectangle must not be called before the imagery provider is ready.'); } //>>includeEnd('debug'); - return this._tilingScheme.extent; + return this._tilingScheme.rectangle; } }, @@ -418,7 +418,7 @@ define([ } }); - var extentScratch = new Extent(); + var rectangleScratch = new Rectangle(); /** * Gets the credits to be displayed when a given tile is displayed. @@ -438,8 +438,8 @@ define([ throw new DeveloperError('getTileCredits must not be called before the imagery provider is ready.'); } - var extent = this._tilingScheme.tileXYToExtent(x, y, level, extentScratch); - return getExtentAttribution(this._attributionList, level, extent); + var rectangle = this._tilingScheme.tileXYToRectangle(x, y, level, rectangleScratch); + return getRectangleAttribution(this._attributionList, level, rectangle); }; /** @@ -556,9 +556,9 @@ define([ return imageUrl; } - var intersectionScratch = new Extent(); + var intersectionScratch = new Rectangle(); - function getExtentAttribution(attributionList, level, extent) { + function getRectangleAttribution(attributionList, level, rectangle) { // Bing levels start at 1, while ours start at 0. ++level; @@ -573,8 +573,8 @@ define([ for (var areaIndex = 0, areaLength = attribution.coverageAreas.length; !included && areaIndex < areaLength; ++areaIndex) { var area = coverageAreas[areaIndex]; if (level >= area.zoomMin && level <= area.zoomMax) { - var intersection = Extent.intersectWith(extent, area.bbox, intersectionScratch); - if (!Extent.isEmpty(intersection)) { + var intersection = Rectangle.intersectWith(rectangle, area.bbox, intersectionScratch); + if (!Rectangle.isEmpty(intersection)) { included = true; } } diff --git a/Source/Scene/Camera.js b/Source/Scene/Camera.js index d533be1a0942..c68b45cd8cc6 100644 --- a/Source/Scene/Camera.js +++ b/Source/Scene/Camera.js @@ -1242,40 +1242,40 @@ define([ this.up = Cartesian3.cross(this.right, this.direction, this.up); }; - var viewExtent3DCartographic = new Cartographic(); - var viewExtent3DNorthEast = new Cartesian3(); - var viewExtent3DSouthWest = new Cartesian3(); - var viewExtent3DNorthWest = new Cartesian3(); - var viewExtent3DSouthEast = new Cartesian3(); - var viewExtent3DCenter = new Cartesian3(); + var viewRectangle3DCartographic = new Cartographic(); + var viewRectangle3DNorthEast = new Cartesian3(); + var viewRectangle3DSouthWest = new Cartesian3(); + var viewRectangle3DNorthWest = new Cartesian3(); + var viewRectangle3DSouthEast = new Cartesian3(); + var viewRectangle3DCenter = new Cartesian3(); var defaultRF = {direction: new Cartesian3(), right: new Cartesian3(), up: new Cartesian3()}; - function extentCameraPosition3D (camera, extent, ellipsoid, result, positionOnly) { + function rectangleCameraPosition3D (camera, rectangle, ellipsoid, result, positionOnly) { var cameraRF = camera; if (positionOnly) { cameraRF = defaultRF; } - var north = extent.north; - var south = extent.south; - var east = extent.east; - var west = extent.west; + var north = rectangle.north; + var south = rectangle.south; + var east = rectangle.east; + var west = rectangle.west; // If we go across the International Date Line if (west > east) { east += CesiumMath.TWO_PI; } - var cart = viewExtent3DCartographic; + var cart = viewRectangle3DCartographic; cart.longitude = east; cart.latitude = north; - var northEast = ellipsoid.cartographicToCartesian(cart, viewExtent3DNorthEast); + var northEast = ellipsoid.cartographicToCartesian(cart, viewRectangle3DNorthEast); cart.latitude = south; - var southEast = ellipsoid.cartographicToCartesian(cart, viewExtent3DSouthEast); + var southEast = ellipsoid.cartographicToCartesian(cart, viewRectangle3DSouthEast); cart.longitude = west; - var southWest = ellipsoid.cartographicToCartesian(cart, viewExtent3DSouthWest); + var southWest = ellipsoid.cartographicToCartesian(cart, viewRectangle3DSouthWest); cart.latitude = north; - var northWest = ellipsoid.cartographicToCartesian(cart, viewExtent3DNorthWest); + var northWest = ellipsoid.cartographicToCartesian(cart, viewRectangle3DNorthWest); - var center = Cartesian3.subtract(northEast, southWest, viewExtent3DCenter); + var center = Cartesian3.subtract(northEast, southWest, viewRectangle3DCenter); Cartesian3.multiplyByScalar(center, 0.5, center); Cartesian3.add(southWest, center, center); @@ -1320,26 +1320,26 @@ define([ return Cartesian3.multiplyByScalar(center, scalar, result); } - var viewExtentCVCartographic = new Cartographic(); - var viewExtentCVNorthEast = new Cartesian3(); - var viewExtentCVSouthWest = new Cartesian3(); - function extentCameraPositionColumbusView(camera, extent, projection, result, positionOnly) { - var north = extent.north; - var south = extent.south; - var east = extent.east; - var west = extent.west; + var viewRectangleCVCartographic = new Cartographic(); + var viewRectangleCVNorthEast = new Cartesian3(); + var viewRectangleCVSouthWest = new Cartesian3(); + function rectangleCameraPositionColumbusView(camera, rectangle, projection, result, positionOnly) { + var north = rectangle.north; + var south = rectangle.south; + var east = rectangle.east; + var west = rectangle.west; var invTransform = camera.inverseTransform; - var cart = viewExtentCVCartographic; + var cart = viewRectangleCVCartographic; cart.longitude = east; cart.latitude = north; - var northEast = projection.project(cart, viewExtentCVNorthEast); + var northEast = projection.project(cart, viewRectangleCVNorthEast); Matrix4.multiplyByPoint(camera.transform, northEast, northEast); Matrix4.multiplyByPoint(invTransform, northEast, northEast); cart.longitude = west; cart.latitude = south; - var southWest = projection.project(cart, viewExtentCVSouthWest); + var southWest = projection.project(cart, viewRectangleCVSouthWest); Matrix4.multiplyByPoint(camera.transform, southWest, southWest); Matrix4.multiplyByPoint(invTransform, southWest, southWest); @@ -1363,22 +1363,22 @@ define([ return result; } - var viewExtent2DCartographic = new Cartographic(); - var viewExtent2DNorthEast = new Cartesian3(); - var viewExtent2DSouthWest = new Cartesian3(); - function extentCameraPosition2D (camera, extent, projection, result, positionOnly) { - var north = extent.north; - var south = extent.south; - var east = extent.east; - var west = extent.west; + var viewRectangle2DCartographic = new Cartographic(); + var viewRectangle2DNorthEast = new Cartesian3(); + var viewRectangle2DSouthWest = new Cartesian3(); + function rectangleCameraPosition2D (camera, rectangle, projection, result, positionOnly) { + var north = rectangle.north; + var south = rectangle.south; + var east = rectangle.east; + var west = rectangle.west; - var cart = viewExtent2DCartographic; + var cart = viewRectangle2DCartographic; cart.longitude = east; cart.latitude = north; - var northEast = projection.project(cart, viewExtent2DNorthEast); + var northEast = projection.project(cart, viewRectangle2DNorthEast); cart.longitude = west; cart.latitude = south; - var southWest = projection.project(cart, viewExtent2DSouthWest); + var southWest = projection.project(cart, viewRectangle2DSouthWest); var width = Math.abs(northEast.x - southWest.x) * 0.5; var height = Math.abs(northEast.y - southWest.y) * 0.5; @@ -1422,55 +1422,55 @@ define([ return result; } /** - * Get the camera position needed to view an extent on an ellipsoid or map + * Get the camera position needed to view an rectangle on an ellipsoid or map * * @memberof Camera * - * @param {Extent} extent The extent to view. - * @param {Cartesian3} [result] The camera position needed to view the extent + * @param {Rectangle} rectangle The rectangle to view. + * @param {Cartesian3} [result] The camera position needed to view the rectangle * - * @returns {Cartesian3} The camera position needed to view the extent + * @returns {Cartesian3} The camera position needed to view the rectangle */ - Camera.prototype.getExtentCameraCoordinates = function(extent, result) { + Camera.prototype.getRectangleCameraCoordinates = function(rectangle, result) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required'); } //>>includeEnd('debug'); if (this._mode === SceneMode.SCENE3D) { - return extentCameraPosition3D(this, extent, this._projection.ellipsoid, result, true); + return rectangleCameraPosition3D(this, rectangle, this._projection.ellipsoid, result, true); } else if (this._mode === SceneMode.COLUMBUS_VIEW) { - return extentCameraPositionColumbusView(this, extent, this._projection, result, true); + return rectangleCameraPositionColumbusView(this, rectangle, this._projection, result, true); } else if (this._mode === SceneMode.SCENE2D) { - return extentCameraPosition2D(this, extent, this._projection, result, true); + return rectangleCameraPosition2D(this, rectangle, this._projection, result, true); } return undefined; }; /** - * View an extent on an ellipsoid or map. + * View an rectangle on an ellipsoid or map. * * @memberof Camera * - * @param {Extent} extent The extent to view. + * @param {Rectangle} rectangle The rectangle to view. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid to view. */ - Camera.prototype.viewExtent = function(extent, ellipsoid) { + Camera.prototype.viewRectangle = function(rectangle, ellipsoid) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required.'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required.'); } //>>includeEnd('debug'); ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84); if (this._mode === SceneMode.SCENE3D) { - extentCameraPosition3D(this, extent, ellipsoid, this.position); + rectangleCameraPosition3D(this, rectangle, ellipsoid, this.position); } else if (this._mode === SceneMode.COLUMBUS_VIEW) { - extentCameraPositionColumbusView(this, extent, this._projection, this.position); + rectangleCameraPositionColumbusView(this, rectangle, this._projection, this.position); } else if (this._mode === SceneMode.SCENE2D) { - extentCameraPosition2D(this, extent, this._projection, this.position); + rectangleCameraPosition2D(this, rectangle, this._projection, this.position); } }; diff --git a/Source/Scene/CameraFlightPath.js b/Source/Scene/CameraFlightPath.js index 6786f3530c37..a76c117844c0 100644 --- a/Source/Scene/CameraFlightPath.js +++ b/Source/Scene/CameraFlightPath.js @@ -583,11 +583,11 @@ define([ }; /** - * Creates an animation to fly the camera from it's current position to a position in which the entire extent will be visible. All arguments should + * Creates an animation to fly the camera from it's current position to a position in which the entire rectangle will be visible. All arguments should * be given in world coordinates. * * @param {Scene} scene The scene instance to use. - * @param {Extent} description.destination The final position of the camera. + * @param {Rectangle} description.destination The final position of the camera. * @param {Number} [description.duration=3000] The duration of the animation in milliseconds. * @param {Function} [onComplete] The function to execute when the animation has completed. * @param {Function} [onCancel] The function to execute if the animation is cancelled. @@ -599,16 +599,16 @@ define([ * * @see Scene#animations */ - CameraFlightPath.createAnimationExtent = function(scene, description) { + CameraFlightPath.createAnimationRectangle = function(scene, description) { description = defaultValue(description, defaultValue.EMPTY_OBJECT); - var extent = description.destination; + var rectangle = description.destination; var frameState = scene.frameState; //>>includeStart('debug', pragmas.debug); if (!defined(frameState)) { throw new DeveloperError('frameState is required.'); } - if (!defined(extent)) { + if (!defined(rectangle)) { throw new DeveloperError('description.destination is required.'); } if (frameState.mode === SceneMode.MORPHING) { @@ -618,7 +618,7 @@ define([ var createAnimationDescription = clone(description); var camera = frameState.camera; - camera.getExtentCameraCoordinates(extent, c3destination); + camera.getRectangleCameraCoordinates(rectangle, c3destination); createAnimationDescription.destination = c3destination; return this.createAnimation(scene, createAnimationDescription); diff --git a/Source/Scene/CentralBody.js b/Source/Scene/CentralBody.js index d28f0facafd0..cb7afd87ebb9 100644 --- a/Source/Scene/CentralBody.js +++ b/Source/Scene/CentralBody.js @@ -14,7 +14,7 @@ define([ '../Core/Cartographic', '../Core/ComponentDatatype', '../Core/Ellipsoid', - '../Core/Extent', + '../Core/Rectangle', '../Core/FeatureDetection', '../Core/GeographicProjection', '../Core/Geometry', @@ -59,7 +59,7 @@ define([ Cartographic, ComponentDatatype, Ellipsoid, - Extent, + Rectangle, FeatureDetection, GeographicProjection, Geometry, @@ -390,7 +390,7 @@ define([ if (!terrainProvider.ready) { return; } - var terrainMaxExtent = terrainProvider.tilingScheme.extent; + var terrainMaxRectangle = terrainProvider.tilingScheme.rectangle; var viewProjMatrix = context.uniformState.viewProjection; var viewport = viewportScratch; @@ -399,7 +399,7 @@ define([ var viewportTransformation = Matrix4.computeViewportTransformation(viewport, 0.0, 1.0, vpTransformScratch); var latitudeExtension = 0.05; - var extent; + var rectangle; var boundingVolume; var frustumCull; var occludeePoint; @@ -409,21 +409,21 @@ define([ var occluder = centralBody._occluder; // handle north pole - if (terrainMaxExtent.north < CesiumMath.PI_OVER_TWO) { - extent = new Extent( + if (terrainMaxRectangle.north < CesiumMath.PI_OVER_TWO) { + rectangle = new Rectangle( -Math.PI, - terrainMaxExtent.north, + terrainMaxRectangle.north, Math.PI, CesiumMath.PI_OVER_TWO ); - boundingVolume = BoundingSphere.fromExtent3D(extent, centralBody._ellipsoid); + boundingVolume = BoundingSphere.fromRectangle3D(rectangle, centralBody._ellipsoid); frustumCull = frameState.cullingVolume.getVisibility(boundingVolume) === Intersect.OUTSIDE; - occludeePoint = Occluder.computeOccludeePointFromExtent(extent, centralBody._ellipsoid); + occludeePoint = Occluder.computeOccludeePointFromRectangle(rectangle, centralBody._ellipsoid); occluded = (occludeePoint && !occluder.isPointVisible(occludeePoint, 0.0)) || !occluder.isBoundingSphereVisible(boundingVolume); centralBody._drawNorthPole = !frustumCull && !occluded; if (centralBody._drawNorthPole) { - rect = computePoleQuad(centralBody, frameState, extent.north, extent.south - latitudeExtension, viewProjMatrix, viewportTransformation); + rect = computePoleQuad(centralBody, frameState, rectangle.north, rectangle.south - latitudeExtension, viewProjMatrix, viewportTransformation); polePositionsScratch[0] = rect.x; polePositionsScratch[1] = rect.y; polePositionsScratch[2] = rect.x + rect.width; @@ -434,7 +434,7 @@ define([ polePositionsScratch[7] = rect.y + rect.height; if (!defined(centralBody._northPoleCommand.vertexArray)) { - centralBody._northPoleCommand.boundingVolume = BoundingSphere.fromExtent3D(extent, centralBody._ellipsoid); + centralBody._northPoleCommand.boundingVolume = BoundingSphere.fromRectangle3D(rectangle, centralBody._ellipsoid); geometry = new Geometry({ attributes : { position : new GeometryAttribute({ @@ -458,21 +458,21 @@ define([ } // handle south pole - if (terrainMaxExtent.south > -CesiumMath.PI_OVER_TWO) { - extent = new Extent( + if (terrainMaxRectangle.south > -CesiumMath.PI_OVER_TWO) { + rectangle = new Rectangle( -Math.PI, -CesiumMath.PI_OVER_TWO, Math.PI, - terrainMaxExtent.south + terrainMaxRectangle.south ); - boundingVolume = BoundingSphere.fromExtent3D(extent, centralBody._ellipsoid); + boundingVolume = BoundingSphere.fromRectangle3D(rectangle, centralBody._ellipsoid); frustumCull = frameState.cullingVolume.getVisibility(boundingVolume) === Intersect.OUTSIDE; - occludeePoint = Occluder.computeOccludeePointFromExtent(extent, centralBody._ellipsoid); + occludeePoint = Occluder.computeOccludeePointFromRectangle(rectangle, centralBody._ellipsoid); occluded = (occludeePoint && !occluder.isPointVisible(occludeePoint)) || !occluder.isBoundingSphereVisible(boundingVolume); centralBody._drawSouthPole = !frustumCull && !occluded; if (centralBody._drawSouthPole) { - rect = computePoleQuad(centralBody, frameState, extent.south, extent.north + latitudeExtension, viewProjMatrix, viewportTransformation); + rect = computePoleQuad(centralBody, frameState, rectangle.south, rectangle.north + latitudeExtension, viewProjMatrix, viewportTransformation); polePositionsScratch[0] = rect.x; polePositionsScratch[1] = rect.y; polePositionsScratch[2] = rect.x + rect.width; @@ -483,7 +483,7 @@ define([ polePositionsScratch[7] = rect.y + rect.height; if (!defined(centralBody._southPoleCommand.vertexArray)) { - centralBody._southPoleCommand.boundingVolume = BoundingSphere.fromExtent3D(extent, centralBody._ellipsoid); + centralBody._southPoleCommand.boundingVolume = BoundingSphere.fromRectangle3D(rectangle, centralBody._ellipsoid); geometry = new Geometry({ attributes : { position : new GeometryAttribute({ diff --git a/Source/Scene/CentralBodySurface.js b/Source/Scene/CentralBodySurface.js index dc161565038d..54895848fe40 100644 --- a/Source/Scene/CentralBodySurface.js +++ b/Source/Scene/CentralBodySurface.js @@ -10,7 +10,7 @@ define([ '../Core/destroyObject', '../Core/DeveloperError', '../Core/EllipsoidalOccluder', - '../Core/Extent', + '../Core/Rectangle', '../Core/FeatureDetection', '../Core/getTimestamp', '../Core/Intersect', @@ -38,7 +38,7 @@ define([ destroyObject, DeveloperError, EllipsoidalOccluder, - Extent, + Rectangle, FeatureDetection, getTimestamp, Intersect, @@ -522,7 +522,7 @@ define([ if (frameState.mode !== SceneMode.SCENE3D) { boundingVolume = boundingSphereScratch; - BoundingSphere.fromExtentWithHeights2D(tile.extent, frameState.scene2D.projection, tile.minimumHeight, tile.maximumHeight, boundingVolume); + BoundingSphere.fromRectangleWithHeights2D(tile.rectangle, frameState.scene2D.projection, tile.minimumHeight, tile.maximumHeight, boundingVolume); Cartesian3.fromElements(boundingVolume.center.z, boundingVolume.center.x, boundingVolume.center.y, boundingVolume.center); if (frameState.mode === SceneMode.MORPHING) { @@ -562,11 +562,11 @@ define([ var maximumHeight = tile.maximumHeight; if (frameState.mode !== SceneMode.SCENE3D) { - southwestCornerCartesian = frameState.scene2D.projection.project(Extent.getSouthwest(tile.extent), southwestCornerScratch); + southwestCornerCartesian = frameState.scene2D.projection.project(Rectangle.getSouthwest(tile.rectangle), southwestCornerScratch); southwestCornerCartesian.z = southwestCornerCartesian.y; southwestCornerCartesian.y = southwestCornerCartesian.x; southwestCornerCartesian.x = 0.0; - northeastCornerCartesian = frameState.scene2D.projection.project(Extent.getNortheast(tile.extent), northeastCornerScratch); + northeastCornerCartesian = frameState.scene2D.projection.project(Rectangle.getNortheast(tile.rectangle), northeastCornerScratch); northeastCornerCartesian.z = northeastCornerCartesian.y; northeastCornerCartesian.y = northeastCornerCartesian.x; northeastCornerCartesian.x = 0.0; @@ -668,7 +668,7 @@ define([ // This is debug code to render the bounding sphere of the tile in // CentralBodySurface._debug.boundingSphereTile. CentralBodySurface.prototype.debugShowBoundingSphereOfTileAt = function(cartographicPick) { - // Find the tile in the render list that overlaps this extent + // Find the tile in the render list that overlaps this rectangle var tilesToRenderByTextureCount = this._tilesToRenderByTextureCount; var result; var tile; @@ -679,7 +679,7 @@ define([ } for (var j = 0; j < tileSet.length; ++j) { tile = tileSet[j]; - if (Extent.contains(tile.extent, cartographicPick)) { + if (Rectangle.contains(tile.rectangle, cartographicPick)) { result = tile; break; } @@ -714,8 +714,8 @@ define([ u_center3D : function() { return this.center3D; }, - u_tileExtent : function() { - return this.tileExtent; + u_tileRectangle : function() { + return this.tileRectangle; }, u_modifiedModelView : function() { return this.modifiedModelView; @@ -726,8 +726,8 @@ define([ u_dayTextureTranslationAndScale : function() { return this.dayTextureTranslationAndScale; }, - u_dayTextureTexCoordsExtent : function() { - return this.dayTextureTexCoordsExtent; + u_dayTextureTexCoordsRectangle : function() { + return this.dayTextureTexCoordsRectangle; }, u_dayTextureAlpha : function() { return this.dayTextureAlpha; @@ -765,11 +765,11 @@ define([ center3D : undefined, modifiedModelView : new Matrix4(), - tileExtent : new Cartesian4(), + tileRectangle : new Cartesian4(), dayTextures : [], dayTextureTranslationAndScale : [], - dayTextureTexCoordsExtent : [], + dayTextureTexCoordsRectangle : [], dayTextureAlpha : [], dayTextureBrightness : [], dayTextureContrast : [], @@ -792,7 +792,7 @@ define([ var float32ArrayScratch = FeatureDetection.supportsTypedArrays() ? new Float32Array(1) : undefined; var modifiedModelViewScratch = new Matrix4(); - var tileExtentScratch = new Cartesian4(); + var tileRectangleScratch = new Cartesian4(); var rtcScratch = new Cartesian3(); var centerEyeScratch = new Cartesian4(); var southwestScratch = new Cartesian3(); @@ -824,7 +824,7 @@ define([ var rtc = tile.center; // Not used in 3D. - var tileExtent = tileExtentScratch; + var tileRectangle = tileRectangleScratch; // Only used for Mercator projections. var southLatitude = 0.0; @@ -834,29 +834,29 @@ define([ var oneOverMercatorHeight = 0.0; if (frameState.mode !== SceneMode.SCENE3D) { - var southwest = projection.project(Extent.getSouthwest(tile.extent), southwestScratch); - var northeast = projection.project(Extent.getNortheast(tile.extent), northeastScratch); + var southwest = projection.project(Rectangle.getSouthwest(tile.rectangle), southwestScratch); + var northeast = projection.project(Rectangle.getNortheast(tile.rectangle), northeastScratch); - tileExtent.x = southwest.x; - tileExtent.y = southwest.y; - tileExtent.z = northeast.x; - tileExtent.w = northeast.y; + tileRectangle.x = southwest.x; + tileRectangle.y = southwest.y; + tileRectangle.z = northeast.x; + tileRectangle.w = northeast.y; // In 2D and Columbus View, use the center of the tile for RTC rendering. if (frameState.mode !== SceneMode.MORPHING) { rtc = rtcScratch; rtc.x = 0.0; - rtc.y = (tileExtent.z + tileExtent.x) * 0.5; - rtc.z = (tileExtent.w + tileExtent.y) * 0.5; - tileExtent.x -= rtc.y; - tileExtent.y -= rtc.z; - tileExtent.z -= rtc.y; - tileExtent.w -= rtc.z; + rtc.y = (tileRectangle.z + tileRectangle.x) * 0.5; + rtc.z = (tileRectangle.w + tileRectangle.y) * 0.5; + tileRectangle.x -= rtc.y; + tileRectangle.y -= rtc.z; + tileRectangle.z -= rtc.y; + tileRectangle.w -= rtc.z; } if (projection instanceof WebMercatorProjection) { - southLatitude = tile.extent.south; - northLatitude = tile.extent.north; + southLatitude = tile.rectangle.south; + northLatitude = tile.rectangle.north; var southMercatorY = WebMercatorProjection.geodeticLatitudeToMercatorAngle(southLatitude); var northMercatorY = WebMercatorProjection.geodeticLatitudeToMercatorAngle(northLatitude); @@ -903,7 +903,7 @@ define([ uniformMap.center3D = tile.center; - Cartesian4.clone(tileExtent, uniformMap.tileExtent); + Cartesian4.clone(tileRectangle, uniformMap.tileRectangle); uniformMap.southAndNorthLatitude.x = southLatitude; uniformMap.southAndNorthLatitude.y = northLatitude; uniformMap.southMercatorYLowAndHighAndOneOverHeight.x = southMercatorYLow; @@ -935,7 +935,7 @@ define([ uniformMap.dayTextures[numberOfDayTextures] = imagery.texture; uniformMap.dayTextureTranslationAndScale[numberOfDayTextures] = tileImagery.textureTranslationAndScale; - uniformMap.dayTextureTexCoordsExtent[numberOfDayTextures] = tileImagery.textureCoordinateExtent; + uniformMap.dayTextureTexCoordsRectangle[numberOfDayTextures] = tileImagery.textureCoordinateRectangle; if (typeof imageryLayer.alpha === 'function') { uniformMap.dayTextureAlpha[numberOfDayTextures] = imageryLayer.alpha(frameState, imageryLayer, imagery.x, imagery.y, imagery.level); @@ -1016,7 +1016,7 @@ define([ var boundingVolume = command.boundingVolume; if (frameState.mode !== SceneMode.SCENE3D) { - BoundingSphere.fromExtentWithHeights2D(tile.extent, frameState.scene2D.projection, tile.minimumHeight, tile.maximumHeight, boundingVolume); + BoundingSphere.fromRectangleWithHeights2D(tile.rectangle, frameState.scene2D.projection, tile.minimumHeight, tile.maximumHeight, boundingVolume); Cartesian3.fromElements(boundingVolume.center.z, boundingVolume.center.x, boundingVolume.center.y, boundingVolume.center); if (frameState.mode === SceneMode.MORPHING) { diff --git a/Source/Scene/CentralBodySurfaceShaderSet.js b/Source/Scene/CentralBodySurfaceShaderSet.js index 2fc9cbfd5103..d5bad70eaf9f 100644 --- a/Source/Scene/CentralBodySurfaceShaderSet.js +++ b/Source/Scene/CentralBodySurfaceShaderSet.js @@ -86,7 +86,7 @@ define([ ' color,\n' + ' u_dayTextures[' + i + '],\n' + ' textureCoordinates,\n' + - ' u_dayTextureTexCoordsExtent[' + i + '],\n' + + ' u_dayTextureTexCoordsRectangle[' + i + '],\n' + ' u_dayTextureTranslationAndScale[' + i + '],\n' + (applyAlpha ? ' u_dayTextureAlpha[' + i + '],\n' : '1.0,\n') + (applyBrightness ? ' u_dayTextureBrightness[' + i + '],\n' : '0.0,\n') + diff --git a/Source/Scene/EllipsoidSurfaceAppearance.js b/Source/Scene/EllipsoidSurfaceAppearance.js index 16d3ed9c54df..7c1b948a56f7 100644 --- a/Source/Scene/EllipsoidSurfaceAppearance.js +++ b/Source/Scene/EllipsoidSurfaceAppearance.js @@ -19,7 +19,7 @@ define([ /** * An appearance for geometry on the surface of the ellipsoid like {@link PolygonGeometry} - * and {@link ExtentGeometry}, which supports all materials like {@link MaterialAppearance} + * and {@link RectangleGeometry}, which supports all materials like {@link MaterialAppearance} * with {@link MaterialAppearance.MaterialSupport.ALL}. However, this appearance requires * fewer vertex attributes since the fragment shader can procedurally compute <code>normal</code>, * <code>binormal</code>, and <code>tangent</code>. diff --git a/Source/Scene/GeographicTilingScheme.js b/Source/Scene/GeographicTilingScheme.js index 9355f8491c2b..1a5845b89467 100644 --- a/Source/Scene/GeographicTilingScheme.js +++ b/Source/Scene/GeographicTilingScheme.js @@ -7,7 +7,7 @@ define([ '../Core/Math', '../Core/Cartesian2', '../Core/Ellipsoid', - '../Core/Extent', + '../Core/Rectangle', '../Core/GeographicProjection', './TilingScheme' ], function( @@ -18,7 +18,7 @@ define([ CesiumMath, Cartesian2, Ellipsoid, - Extent, + Rectangle, GeographicProjection, TilingScheme) { "use strict"; @@ -33,7 +33,7 @@ define([ * * @param {Ellipsoid} [description.ellipsoid=Ellipsoid.WGS84] The ellipsoid whose surface is being tiled. Defaults to * the WGS84 ellipsoid. - * @param {Extent} [description.extent=Extent.MAX_VALUE] The extent, in radians, covered by the tiling scheme. + * @param {Rectangle} [description.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the tiling scheme. * @param {Number} [description.numberOfLevelZeroTilesX=2] The number of tiles in the X direction at level zero of * the tile tree. * @param {Number} [description.numberOfLevelZeroTilesY=1] The number of tiles in the Y direction at level zero of @@ -43,7 +43,7 @@ define([ description = defaultValue(description, {}); this._ellipsoid = defaultValue(description.ellipsoid, Ellipsoid.WGS84); - this._extent = defaultValue(description.extent, Extent.MAX_VALUE); + this._rectangle = defaultValue(description.rectangle, Rectangle.MAX_VALUE); this._projection = new GeographicProjection(this._ellipsoid); this._numberOfLevelZeroTilesX = defaultValue(description.numberOfLevelZeroTilesX, 2); this._numberOfLevelZeroTilesY = defaultValue(description.numberOfLevelZeroTilesY, 1); @@ -63,13 +63,13 @@ define([ }, /** - * Gets the extent, in radians, covered by this tiling scheme. + * Gets the rectangle, in radians, covered by this tiling scheme. * @memberof GeographicTilingScheme.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : function() { - return this._extent; + return this._rectangle; } }, @@ -122,31 +122,31 @@ define([ }; /** - * Transforms an extent specified in geodetic radians to the native coordinate system + * Transforms an rectangle specified in geodetic radians to the native coordinate system * of this tiling scheme. * * @memberof GeographicTilingScheme * - * @param {Extent} extent The extent to transform. - * @param {Extent} [result] The instance to which to copy the result, or undefined if a new instance + * @param {Rectangle} rectangle The rectangle to transform. + * @param {Rectangle} [result] The instance to which to copy the result, or undefined if a new instance * should be created. - * @returns {Extent} The specified 'result', or a new object containing the native extent if 'result' + * @returns {Rectangle} The specified 'result', or a new object containing the native rectangle if 'result' * is undefined. */ - GeographicTilingScheme.prototype.extentToNativeExtent = function(extent, result) { + GeographicTilingScheme.prototype.rectangleToNativeRectangle = function(rectangle, result) { //>>includeStart('debug', pragmas.debug); - if (!defined(extent)) { - throw new DeveloperError('extent is required.'); + if (!defined(rectangle)) { + throw new DeveloperError('rectangle is required.'); } //>>includeEnd('debug'); - var west = CesiumMath.toDegrees(extent.west); - var south = CesiumMath.toDegrees(extent.south); - var east = CesiumMath.toDegrees(extent.east); - var north = CesiumMath.toDegrees(extent.north); + var west = CesiumMath.toDegrees(rectangle.west); + var south = CesiumMath.toDegrees(rectangle.south); + var east = CesiumMath.toDegrees(rectangle.east); + var north = CesiumMath.toDegrees(rectangle.north); if (!defined(result)) { - return new Extent(west, south, east, north); + return new Rectangle(west, south, east, north); } result.west = west; @@ -157,7 +157,7 @@ define([ }; /** - * Converts tile x, y coordinates and level to an extent expressed in the native coordinates + * Converts tile x, y coordinates and level to an rectangle expressed in the native coordinates * of the tiling scheme. * * @memberof GeographicTilingScheme @@ -168,20 +168,20 @@ define([ * @param {Object} [result] The instance to which to copy the result, or undefined if a new instance * should be created. * - * @returns {Extent} The specified 'result', or a new object containing the extent + * @returns {Rectangle} The specified 'result', or a new object containing the rectangle * if 'result' is undefined. */ - GeographicTilingScheme.prototype.tileXYToNativeExtent = function(x, y, level, result) { - var extentRadians = this.tileXYToExtent(x, y, level, result); - extentRadians.west = CesiumMath.toDegrees(extentRadians.west); - extentRadians.south = CesiumMath.toDegrees(extentRadians.south); - extentRadians.east = CesiumMath.toDegrees(extentRadians.east); - extentRadians.north = CesiumMath.toDegrees(extentRadians.north); - return extentRadians; + GeographicTilingScheme.prototype.tileXYToNativeRectangle = function(x, y, level, result) { + var rectangleRadians = this.tileXYToRectangle(x, y, level, result); + rectangleRadians.west = CesiumMath.toDegrees(rectangleRadians.west); + rectangleRadians.south = CesiumMath.toDegrees(rectangleRadians.south); + rectangleRadians.east = CesiumMath.toDegrees(rectangleRadians.east); + rectangleRadians.north = CesiumMath.toDegrees(rectangleRadians.north); + return rectangleRadians; }; /** - * Converts tile x, y coordinates and level to a cartographic extent in radians. + * Converts tile x, y coordinates and level to a cartographic rectangle in radians. * * @memberof GeographicTilingScheme * @@ -191,25 +191,25 @@ define([ * @param {Object} [result] The instance to which to copy the result, or undefined if a new instance * should be created. * - * @returns {Extent} The specified 'result', or a new object containing the extent + * @returns {Rectangle} The specified 'result', or a new object containing the rectangle * if 'result' is undefined. */ - GeographicTilingScheme.prototype.tileXYToExtent = function(x, y, level, result) { - var extent = this._extent; + GeographicTilingScheme.prototype.tileXYToRectangle = function(x, y, level, result) { + var rectangle = this._rectangle; var xTiles = this.getNumberOfXTilesAtLevel(level); var yTiles = this.getNumberOfYTilesAtLevel(level); - var xTileWidth = (extent.east - extent.west) / xTiles; - var west = x * xTileWidth + extent.west; - var east = (x + 1) * xTileWidth + extent.west; + var xTileWidth = (rectangle.east - rectangle.west) / xTiles; + var west = x * xTileWidth + rectangle.west; + var east = (x + 1) * xTileWidth + rectangle.west; - var yTileHeight = (extent.north - extent.south) / yTiles; - var north = extent.north - y * yTileHeight; - var south = extent.north - (y + 1) * yTileHeight; + var yTileHeight = (rectangle.north - rectangle.south) / yTiles; + var north = rectangle.north - y * yTileHeight; + var south = rectangle.north - (y + 1) * yTileHeight; if (!defined(result)) { - result = new Extent(west, south, east, north); + result = new Rectangle(west, south, east, north); } result.west = west; @@ -234,11 +234,11 @@ define([ * if 'result' is undefined. */ GeographicTilingScheme.prototype.positionToTileXY = function(position, level, result) { - var extent = this._extent; - if (position.latitude > extent.north || - position.latitude < extent.south || - position.longitude < extent.west || - position.longitude > extent.east) { + var rectangle = this._rectangle; + if (position.latitude > rectangle.north || + position.latitude < rectangle.south || + position.longitude < rectangle.west || + position.longitude > rectangle.east) { // outside the bounds of the tiling scheme return undefined; } @@ -246,15 +246,15 @@ define([ var xTiles = this.getNumberOfXTilesAtLevel(level); var yTiles = this.getNumberOfYTilesAtLevel(level); - var xTileWidth = (extent.east - extent.west) / xTiles; - var yTileHeight = (extent.north - extent.south) / yTiles; + var xTileWidth = (rectangle.east - rectangle.west) / xTiles; + var yTileHeight = (rectangle.north - rectangle.south) / yTiles; - var xTileCoordinate = (position.longitude - extent.west) / xTileWidth | 0; + var xTileCoordinate = (position.longitude - rectangle.west) / xTileWidth | 0; if (xTileCoordinate >= xTiles) { xTileCoordinate = xTiles - 1; } - var yTileCoordinate = (extent.north - position.latitude) / yTileHeight | 0; + var yTileCoordinate = (rectangle.north - position.latitude) / yTileHeight | 0; if (yTileCoordinate >= yTiles) { yTileCoordinate = yTiles - 1; } diff --git a/Source/Scene/GoogleEarthImageryProvider.js b/Source/Scene/GoogleEarthImageryProvider.js index 1ce219151e30..a8580fcaf057 100644 --- a/Source/Scene/GoogleEarthImageryProvider.js +++ b/Source/Scene/GoogleEarthImageryProvider.js @@ -7,7 +7,7 @@ define([ '../Core/DeveloperError', '../Core/RuntimeError', '../Core/Event', - '../Core/Extent', + '../Core/Rectangle', './ImageryProvider', './TileProviderError', './WebMercatorTilingScheme', @@ -22,7 +22,7 @@ define([ DeveloperError, RuntimeError, Event, - Extent, + Rectangle, ImageryProvider, TileProviderError, WebMercatorTilingScheme, @@ -180,7 +180,7 @@ define([ that._tilingScheme = new GeographicTilingScheme({ numberOfLevelZeroTilesX : 2, numberOfLevelZeroTilesY : 2, - extent: new Extent(-Math.PI, -Math.PI, Math.PI, Math.PI) + rectangle: new Rectangle(-Math.PI, -Math.PI, Math.PI, Math.PI) }); // Default to mercator projection when projection is undefined } else if(!defined(data.projection) || data.projection === 'mercator') { @@ -388,20 +388,20 @@ define([ } }, /** - * Gets the extent, in radians, of the imagery provided by this instance. This function should + * Gets the rectangle, in radians, of the imagery provided by this instance. This function should * not be called before {@link GoogleEarthImageryProvider#ready} returns true. * @memberof GoogleEarthImageryProvider.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : function() { //>>includeStart('debug', pragmas.debug); if (!this._ready) { - throw new DeveloperError('extent must not be called before the imagery provider is ready.'); + throw new DeveloperError('rectangle must not be called before the imagery provider is ready.'); } //>>includeEnd('debug'); - return this._tilingScheme.extent; + return this._tilingScheme.rectangle; } }, diff --git a/Source/Scene/GridImageryProvider.js b/Source/Scene/GridImageryProvider.js index 3345a7bf07e2..dd686f804083 100644 --- a/Source/Scene/GridImageryProvider.js +++ b/Source/Scene/GridImageryProvider.js @@ -126,14 +126,14 @@ define([ }, /** - * Gets the extent, in radians, of the imagery provided by this instance. This function should + * Gets the rectangle, in radians, of the imagery provided by this instance. This function should * not be called before {@link GridImageryProvider#ready} returns true. * @memberof GridImageryProvider.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : function() { - return this._tilingScheme.extent; + return this._tilingScheme.rectangle; } }, diff --git a/Source/Scene/HeightmapTerrainData.js b/Source/Scene/HeightmapTerrainData.js index 7e5a24ee03b8..4389fbe0d6d2 100644 --- a/Source/Scene/HeightmapTerrainData.js +++ b/Source/Scene/HeightmapTerrainData.js @@ -4,7 +4,7 @@ define([ '../Core/defined', '../Core/defineProperties', '../Core/DeveloperError', - '../Core/Extent', + '../Core/Rectangle', '../Core/HeightmapTessellator', '../Core/Math', '../Core/TaskProcessor', @@ -17,7 +17,7 @@ define([ defined, defineProperties, DeveloperError, - Extent, + Rectangle, HeightmapTessellator, CesiumMath, TaskProcessor, @@ -175,11 +175,11 @@ define([ //>>includeEnd('debug'); var ellipsoid = tilingScheme.ellipsoid; - var nativeExtent = tilingScheme.tileXYToNativeExtent(x, y, level); - var extent = tilingScheme.tileXYToExtent(x, y, level); + var nativeRectangle = tilingScheme.tileXYToNativeRectangle(x, y, level); + var rectangle = tilingScheme.tileXYToRectangle(x, y, level); // Compute the center of the tile for RTC rendering. - var center = ellipsoid.cartographicToCartesian(Extent.getCenter(extent)); + var center = ellipsoid.cartographicToCartesian(Rectangle.getCenter(rectangle)); var structure = this._structure; @@ -191,8 +191,8 @@ define([ structure : structure, width : this._width, height : this._height, - nativeExtent : nativeExtent, - extent : extent, + nativeRectangle : nativeRectangle, + rectangle : rectangle, relativeToCenter : center, ellipsoid : ellipsoid, skirtHeight : Math.min(thisLevelMaxError * 4.0, 1000.0), @@ -221,14 +221,14 @@ define([ * * @memberof HeightmapTerrainData * - * @param {Extent} extent The extent covered by this terrain data. + * @param {Rectangle} rectangle The rectangle covered by this terrain data. * @param {Number} longitude The longitude in radians. * @param {Number} latitude The latitude in radians. * @returns {Number} The terrain height at the specified position. If the position - * is outside the extent, this method will extrapolate the height, which is likely to be wildly - * incorrect for positions far outside the extent. + * is outside the rectangle, this method will extrapolate the height, which is likely to be wildly + * incorrect for positions far outside the rectangle. */ - HeightmapTerrainData.prototype.interpolateHeight = function(extent, longitude, latitude) { + HeightmapTerrainData.prototype.interpolateHeight = function(rectangle, longitude, latitude) { var width = this._width; var height = this._height; @@ -241,9 +241,9 @@ define([ var elementMultiplier = structure.elementMultiplier; var isBigEndian = structure.isBigEndian; - heightSample = interpolateHeightWithStride(this._buffer, elementsPerHeight, elementMultiplier, stride, isBigEndian, extent, width, height, longitude, latitude); + heightSample = interpolateHeightWithStride(this._buffer, elementsPerHeight, elementMultiplier, stride, isBigEndian, rectangle, width, height, longitude, latitude); } else { - heightSample = interpolateHeight(this._buffer, extent, width, height, longitude, latitude); + heightSample = interpolateHeight(this._buffer, rectangle, width, height, longitude, latitude); } return heightSample * structure.heightScale + structure.heightOffset; @@ -448,9 +448,9 @@ define([ var sourceHeights = terrainData._buffer; var heights = new sourceHeights.constructor(width * height * stride); - // PERFORMANCE_IDEA: don't recompute these extents - the caller already knows them. - var sourceExtent = tilingScheme.tileXYToExtent(thisX, thisY, thisLevel); - var destinationExtent = tilingScheme.tileXYToExtent(descendantX, descendantY, descendantLevel); + // PERFORMANCE_IDEA: don't recompute these rectangles - the caller already knows them. + var sourceRectangle = tilingScheme.tileXYToRectangle(thisX, thisY, thisLevel); + var destinationRectangle = tilingScheme.tileXYToRectangle(descendantX, descendantY, descendantLevel); var i, j, latitude, longitude; @@ -462,19 +462,19 @@ define([ var divisor = Math.pow(elementMultiplier, elementsPerHeight - 1); for (j = 0; j < height; ++j) { - latitude = CesiumMath.lerp(destinationExtent.north, destinationExtent.south, j / (height - 1)); + latitude = CesiumMath.lerp(destinationRectangle.north, destinationRectangle.south, j / (height - 1)); for (i = 0; i < width; ++i) { - longitude = CesiumMath.lerp(destinationExtent.west, destinationExtent.east, i / (width - 1)); - var heightSample = interpolateHeightWithStride(sourceHeights, elementsPerHeight, elementMultiplier, stride, isBigEndian, sourceExtent, width, height, longitude, latitude); + longitude = CesiumMath.lerp(destinationRectangle.west, destinationRectangle.east, i / (width - 1)); + var heightSample = interpolateHeightWithStride(sourceHeights, elementsPerHeight, elementMultiplier, stride, isBigEndian, sourceRectangle, width, height, longitude, latitude); setHeight(heights, elementsPerHeight, elementMultiplier, divisor, stride, isBigEndian, j * width + i, heightSample); } } } else { for (j = 0; j < height; ++j) { - latitude = CesiumMath.lerp(destinationExtent.north, destinationExtent.south, j / (height - 1)); + latitude = CesiumMath.lerp(destinationRectangle.north, destinationRectangle.south, j / (height - 1)); for (i = 0; i < width; ++i) { - longitude = CesiumMath.lerp(destinationExtent.west, destinationExtent.east, i / (width - 1)); - heights[j * width + i] = interpolateHeight(sourceHeights, sourceExtent, width, height, longitude, latitude); + longitude = CesiumMath.lerp(destinationRectangle.west, destinationRectangle.east, i / (width - 1)); + heights[j * width + i] = interpolateHeight(sourceHeights, sourceRectangle, width, height, longitude, latitude); } } } @@ -489,9 +489,9 @@ define([ }); } - function interpolateHeight(sourceHeights, sourceExtent, width, height, longitude, latitude) { - var fromWest = (longitude - sourceExtent.west) * (width - 1) / (sourceExtent.east - sourceExtent.west); - var fromSouth = (latitude - sourceExtent.south) * (height - 1) / (sourceExtent.north - sourceExtent.south); + function interpolateHeight(sourceHeights, sourceRectangle, width, height, longitude, latitude) { + var fromWest = (longitude - sourceRectangle.west) * (width - 1) / (sourceRectangle.east - sourceRectangle.west); + var fromSouth = (latitude - sourceRectangle.south) * (height - 1) / (sourceRectangle.north - sourceRectangle.south); var westInteger = fromWest | 0; var eastInteger = westInteger + 1; @@ -521,9 +521,9 @@ define([ return triangleInterpolateHeight(dx, dy, southwestHeight, southeastHeight, northwestHeight, northeastHeight); } - function interpolateHeightWithStride(sourceHeights, elementsPerHeight, elementMultiplier, stride, isBigEndian, sourceExtent, width, height, longitude, latitude) { - var fromWest = (longitude - sourceExtent.west) * (width - 1) / (sourceExtent.east - sourceExtent.west); - var fromSouth = (latitude - sourceExtent.south) * (height - 1) / (sourceExtent.north - sourceExtent.south); + function interpolateHeightWithStride(sourceHeights, elementsPerHeight, elementMultiplier, stride, isBigEndian, sourceRectangle, width, height, longitude, latitude) { + var fromWest = (longitude - sourceRectangle.west) * (width - 1) / (sourceRectangle.east - sourceRectangle.west); + var fromSouth = (latitude - sourceRectangle.south) * (height - 1) / (sourceRectangle.north - sourceRectangle.south); var westInteger = fromWest | 0; var eastInteger = westInteger + 1; diff --git a/Source/Scene/Imagery.js b/Source/Scene/Imagery.js index b97d05bac97b..322b6c72692c 100644 --- a/Source/Scene/Imagery.js +++ b/Source/Scene/Imagery.js @@ -15,7 +15,7 @@ define([ * @alias Imagery * @private */ - var Imagery = function(imageryLayer, x, y, level, extent) { + var Imagery = function(imageryLayer, x, y, level, rectangle) { this.imageryLayer = imageryLayer; this.x = x; this.y = y; @@ -35,12 +35,12 @@ define([ this.credits = undefined; this.referenceCount = 0; - if (!defined(extent) && imageryLayer.imageryProvider.ready) { + if (!defined(rectangle) && imageryLayer.imageryProvider.ready) { var tilingScheme = imageryLayer.imageryProvider.tilingScheme; - extent = tilingScheme.tileXYToExtent(x, y, level); + rectangle = tilingScheme.tileXYToRectangle(x, y, level); } - this.extent = extent; + this.rectangle = rectangle; }; Imagery.createPlaceholder = function(imageryLayer) { diff --git a/Source/Scene/ImageryLayer.js b/Source/Scene/ImageryLayer.js index 48fa50470307..b3a7cb2ed370 100644 --- a/Source/Scene/ImageryLayer.js +++ b/Source/Scene/ImageryLayer.js @@ -9,7 +9,7 @@ define([ '../Core/Cartesian2', '../Core/Cartesian4', '../Core/Color', - '../Core/Extent', + '../Core/Rectangle', '../Core/FeatureDetection', '../Core/Math', '../Core/PrimitiveType', @@ -40,7 +40,7 @@ define([ Cartesian2, Cartesian4, Color, - Extent, + Rectangle, FeatureDetection, CesiumMath, PrimitiveType, @@ -71,7 +71,7 @@ define([ * @constructor * * @param {ImageryProvider} imageryProvider The imagery provider to use. - * @param {Extent} [description.extent=imageryProvider.extent] The extent of the layer. This extent + * @param {Rectangle} [description.rectangle=imageryProvider.rectangle] The rectangle of the layer. This rectangle * can limit the visible portion of the imagery provider. * @param {Number|Function} [description.alpha=1.0] The alpha blending value of this layer, from 0.0 to 1.0. * This can either be a simple number or a function with the signature @@ -228,7 +228,7 @@ define([ this._minimumTerrainLevel = description.minimumTerrainLevel; this._maximumTerrainLevel = description.maximumTerrainLevel; - this._extent = defaultValue(description.extent, Extent.MAX_VALUE); + this._rectangle = defaultValue(description.rectangle, Rectangle.MAX_VALUE); this._maximumAnisotropy = description.maximumAnisotropy; this._imageryCache = {}; @@ -262,15 +262,15 @@ define([ }, /** - * Gets the extent of this layer. If this extent is smaller than the extent of the + * Gets the rectangle of this layer. If this rectangle is smaller than the rectangle of the * {@link ImageryProvider}, only a portion of the imagery provider is shown. * @memberof ImageryLayer.prototype - * @type {Extent} + * @type {Rectangle} * @readonly */ - extent: { + rectangle: { get: function() { - return this._extent; + return this._rectangle; } } }); @@ -315,7 +315,7 @@ define([ /** * Gets a value indicating whether this layer is the base layer in the * {@link ImageryLayerCollection}. The base layer is the one that underlies all - * others. It is special in that it is treated as if it has global extent, even if + * others. It is special in that it is treated as if it has global rectangle, even if * it actually does not, by stretching the texels at the edges over the entire * globe. * @@ -401,14 +401,14 @@ define([ return true; } - // Compute the extent of the imagery from this imageryProvider that overlaps + // Compute the rectangle of the imagery from this imageryProvider that overlaps // the geometry tile. The ImageryProvider and ImageryLayer both have the - // opportunity to constrain the extent. The imagery TilingScheme's extent - // always fully contains the ImageryProvider's extent. - var extent = Extent.intersectWith(tile.extent, imageryProvider.extent); - extent = Extent.intersectWith(extent, this._extent); + // opportunity to constrain the rectangle. The imagery TilingScheme's rectangle + // always fully contains the ImageryProvider's rectangle. + var rectangle = Rectangle.intersectWith(tile.rectangle, imageryProvider.rectangle); + rectangle = Rectangle.intersectWith(rectangle, this._rectangle); - if (extent.east <= extent.west || extent.north <= extent.south) { + if (rectangle.east <= rectangle.west || rectangle.north <= rectangle.south) { // There is no overlap between this terrain tile and this imagery // provider. Unless this is the base layer, no skeletons need to be created. // We stretch texels at the edge of the base layer over the entire globe. @@ -416,27 +416,27 @@ define([ return false; } - var baseImageryExtent = Extent.intersectWith(imageryProvider.extent, this._extent); - var baseTerrainExtent = tile.extent; + var baseImageryRectangle = Rectangle.intersectWith(imageryProvider.rectangle, this._rectangle); + var baseTerrainRectangle = tile.rectangle; - if (baseTerrainExtent.south >= baseImageryExtent.north) { - extent.north = extent.south = baseImageryExtent.north; - } else if (baseTerrainExtent.north <= baseImageryExtent.south) { - extent.north = extent.south = baseImageryExtent.south; + if (baseTerrainRectangle.south >= baseImageryRectangle.north) { + rectangle.north = rectangle.south = baseImageryRectangle.north; + } else if (baseTerrainRectangle.north <= baseImageryRectangle.south) { + rectangle.north = rectangle.south = baseImageryRectangle.south; } - if (baseTerrainExtent.west >= baseImageryExtent.east) { - extent.west = extent.east = baseImageryExtent.east; - } else if (baseTerrainExtent.east <= baseImageryExtent.west) { - extent.west = extent.east = baseImageryExtent.west; + if (baseTerrainRectangle.west >= baseImageryRectangle.east) { + rectangle.west = rectangle.east = baseImageryRectangle.east; + } else if (baseTerrainRectangle.east <= baseImageryRectangle.west) { + rectangle.west = rectangle.east = baseImageryRectangle.west; } } var latitudeClosestToEquator = 0.0; - if (extent.south > 0.0) { - latitudeClosestToEquator = extent.south; - } else if (extent.north < 0.0) { - latitudeClosestToEquator = extent.north; + if (rectangle.south > 0.0) { + latitudeClosestToEquator = rectangle.south; + } else if (rectangle.north < 0.0) { + latitudeClosestToEquator = rectangle.north; } // Compute the required level in the imagery tiling scheme. @@ -460,40 +460,40 @@ define([ } var imageryTilingScheme = imageryProvider.tilingScheme; - var northwestTileCoordinates = imageryTilingScheme.positionToTileXY(Extent.getNorthwest(extent), imageryLevel); - var southeastTileCoordinates = imageryTilingScheme.positionToTileXY(Extent.getSoutheast(extent), imageryLevel); + var northwestTileCoordinates = imageryTilingScheme.positionToTileXY(Rectangle.getNorthwest(rectangle), imageryLevel); + var southeastTileCoordinates = imageryTilingScheme.positionToTileXY(Rectangle.getSoutheast(rectangle), imageryLevel); - // If the southeast corner of the extent lies very close to the north or west side + // If the southeast corner of the rectangle lies very close to the north or west side // of the southeast tile, we don't actually need the southernmost or easternmost // tiles. - // Similarly, if the northwest corner of the extent lies very close to the south or east side + // Similarly, if the northwest corner of the rectangle lies very close to the south or east side // of the northwest tile, we don't actually need the northernmost or westernmost tiles. // We define "very close" as being within 1/512 of the width of the tile. - var veryCloseX = (tile.extent.north - tile.extent.south) / 512.0; - var veryCloseY = (tile.extent.east - tile.extent.west) / 512.0; + var veryCloseX = (tile.rectangle.north - tile.rectangle.south) / 512.0; + var veryCloseY = (tile.rectangle.east - tile.rectangle.west) / 512.0; - var northwestTileExtent = imageryTilingScheme.tileXYToExtent(northwestTileCoordinates.x, northwestTileCoordinates.y, imageryLevel); - if (Math.abs(northwestTileExtent.south - tile.extent.north) < veryCloseY && northwestTileCoordinates.y < southeastTileCoordinates.y) { + var northwestTileRectangle = imageryTilingScheme.tileXYToRectangle(northwestTileCoordinates.x, northwestTileCoordinates.y, imageryLevel); + if (Math.abs(northwestTileRectangle.south - tile.rectangle.north) < veryCloseY && northwestTileCoordinates.y < southeastTileCoordinates.y) { ++northwestTileCoordinates.y; } - if (Math.abs(northwestTileExtent.east - tile.extent.west) < veryCloseX && northwestTileCoordinates.x < southeastTileCoordinates.x) { + if (Math.abs(northwestTileRectangle.east - tile.rectangle.west) < veryCloseX && northwestTileCoordinates.x < southeastTileCoordinates.x) { ++northwestTileCoordinates.x; } - var southeastTileExtent = imageryTilingScheme.tileXYToExtent(southeastTileCoordinates.x, southeastTileCoordinates.y, imageryLevel); - if (Math.abs(southeastTileExtent.north - tile.extent.south) < veryCloseY && southeastTileCoordinates.y > northwestTileCoordinates.y) { + var southeastTileRectangle = imageryTilingScheme.tileXYToRectangle(southeastTileCoordinates.x, southeastTileCoordinates.y, imageryLevel); + if (Math.abs(southeastTileRectangle.north - tile.rectangle.south) < veryCloseY && southeastTileCoordinates.y > northwestTileCoordinates.y) { --southeastTileCoordinates.y; } - if (Math.abs(southeastTileExtent.west - tile.extent.east) < veryCloseX && southeastTileCoordinates.x > northwestTileCoordinates.x) { + if (Math.abs(southeastTileRectangle.west - tile.rectangle.east) < veryCloseX && southeastTileCoordinates.x > northwestTileCoordinates.x) { --southeastTileCoordinates.x; } // Create TileImagery instances for each imagery tile overlapping this terrain tile. // We need to do all texture coordinate computations in the imagery tile's tiling scheme. - var terrainExtent = tile.extent; - var imageryExtent = imageryTilingScheme.tileXYToExtent(northwestTileCoordinates.x, northwestTileCoordinates.y, imageryLevel); + var terrainRectangle = tile.rectangle; + var imageryRectangle = imageryTilingScheme.tileXYToRectangle(northwestTileCoordinates.x, northwestTileCoordinates.y, imageryLevel); var minU; var maxU = 0.0; @@ -504,12 +504,12 @@ define([ // If this is the northern-most or western-most tile in the imagery tiling scheme, // it may not start at the northern or western edge of the terrain tile. // Calculate where it does start. - if (!this.isBaseLayer() && Math.abs(imageryExtent.west - tile.extent.west) >= veryCloseX) { - maxU = Math.min(1.0, (imageryExtent.west - terrainExtent.west) / (terrainExtent.east - terrainExtent.west)); + if (!this.isBaseLayer() && Math.abs(imageryRectangle.west - tile.rectangle.west) >= veryCloseX) { + maxU = Math.min(1.0, (imageryRectangle.west - terrainRectangle.west) / (terrainRectangle.east - terrainRectangle.west)); } - if (!this.isBaseLayer() && Math.abs(imageryExtent.north - tile.extent.north) >= veryCloseY) { - minV = Math.max(0.0, (imageryExtent.north - terrainExtent.south) / (terrainExtent.north - terrainExtent.south)); + if (!this.isBaseLayer() && Math.abs(imageryRectangle.north - tile.rectangle.north) >= veryCloseY) { + minV = Math.max(0.0, (imageryRectangle.north - terrainRectangle.south) / (terrainRectangle.north - terrainRectangle.south)); } var initialMinV = minV; @@ -517,14 +517,14 @@ define([ for ( var i = northwestTileCoordinates.x; i <= southeastTileCoordinates.x; i++) { minU = maxU; - imageryExtent = imageryTilingScheme.tileXYToExtent(i, northwestTileCoordinates.y, imageryLevel); - maxU = Math.min(1.0, (imageryExtent.east - terrainExtent.west) / (terrainExtent.east - terrainExtent.west)); + imageryRectangle = imageryTilingScheme.tileXYToRectangle(i, northwestTileCoordinates.y, imageryLevel); + maxU = Math.min(1.0, (imageryRectangle.east - terrainRectangle.west) / (terrainRectangle.east - terrainRectangle.west)); // If this is the eastern-most imagery tile mapped to this terrain tile, // and there are more imagery tiles to the east of this one, the maxU // should be 1.0 to make sure rounding errors don't make the last // image fall shy of the edge of the terrain tile. - if (i === southeastTileCoordinates.x && (this.isBaseLayer() || Math.abs(imageryExtent.east - tile.extent.east) < veryCloseX)) { + if (i === southeastTileCoordinates.x && (this.isBaseLayer() || Math.abs(imageryRectangle.east - tile.rectangle.east) < veryCloseX)) { maxU = 1.0; } @@ -533,20 +533,20 @@ define([ for ( var j = northwestTileCoordinates.y; j <= southeastTileCoordinates.y; j++) { maxV = minV; - imageryExtent = imageryTilingScheme.tileXYToExtent(i, j, imageryLevel); - minV = Math.max(0.0, (imageryExtent.south - terrainExtent.south) / (terrainExtent.north - terrainExtent.south)); + imageryRectangle = imageryTilingScheme.tileXYToRectangle(i, j, imageryLevel); + minV = Math.max(0.0, (imageryRectangle.south - terrainRectangle.south) / (terrainRectangle.north - terrainRectangle.south)); // If this is the southern-most imagery tile mapped to this terrain tile, // and there are more imagery tiles to the south of this one, the minV // should be 0.0 to make sure rounding errors don't make the last // image fall shy of the edge of the terrain tile. - if (j === southeastTileCoordinates.y && (this.isBaseLayer() || Math.abs(imageryExtent.south - tile.extent.south) < veryCloseY)) { + if (j === southeastTileCoordinates.y && (this.isBaseLayer() || Math.abs(imageryRectangle.south - tile.rectangle.south) < veryCloseY)) { minV = 0.0; } - var texCoordsExtent = new Cartesian4(minU, minV, maxU, maxV); - var imagery = this.getImageryFromCache(i, j, imageryLevel, imageryExtent); - tile.imagery.splice(insertionPoint, 0, new TileImagery(imagery, texCoordsExtent)); + var texCoordsRectangle = new Cartesian4(minU, minV, maxU, maxV); + var imagery = this.getImageryFromCache(i, j, imageryLevel, imageryRectangle); + tile.imagery.splice(insertionPoint, 0, new TileImagery(imagery, texCoordsRectangle)); ++insertionPoint; } } @@ -567,16 +567,16 @@ define([ * are the scale. */ ImageryLayer.prototype._calculateTextureTranslationAndScale = function(tile, tileImagery) { - var imageryExtent = tileImagery.readyImagery.extent; - var terrainExtent = tile.extent; - var terrainWidth = terrainExtent.east - terrainExtent.west; - var terrainHeight = terrainExtent.north - terrainExtent.south; + var imageryRectangle = tileImagery.readyImagery.rectangle; + var terrainRectangle = tile.rectangle; + var terrainWidth = terrainRectangle.east - terrainRectangle.west; + var terrainHeight = terrainRectangle.north - terrainRectangle.south; - var scaleX = terrainWidth / (imageryExtent.east - imageryExtent.west); - var scaleY = terrainHeight / (imageryExtent.north - imageryExtent.south); + var scaleX = terrainWidth / (imageryRectangle.east - imageryRectangle.west); + var scaleY = terrainHeight / (imageryRectangle.north - imageryRectangle.south); return new Cartesian4( - scaleX * (terrainExtent.west - imageryExtent.west) / terrainWidth, - scaleY * (terrainExtent.south - imageryExtent.south) / terrainHeight, + scaleX * (terrainRectangle.west - imageryRectangle.west) / terrainWidth, + scaleY * (terrainRectangle.south - imageryRectangle.south) / terrainHeight, scaleX, scaleY); }; @@ -695,15 +695,15 @@ define([ */ ImageryLayer.prototype._reprojectTexture = function(context, imagery) { var texture = imagery.texture; - var extent = imagery.extent; + var rectangle = imagery.rectangle; // Reproject this texture if it is not already in a geographic projection and // the pixels are more than 1e-5 radians apart. The pixel spacing cutoff // avoids precision problems in the reprojection transformation while making // no noticeable difference in the georeferencing of the image. if (!(this._imageryProvider.tilingScheme instanceof GeographicTilingScheme) && - (extent.east - extent.west) / texture.width > 1e-5) { - var reprojectedTexture = reprojectToGeographic(this, context, texture, imagery.extent); + (rectangle.east - rectangle.west) / texture.width > 1e-5) { + var reprojectedTexture = reprojectToGeographic(this, context, texture, imagery.rectangle); texture.destroy(); imagery.texture = texture = reprojectedTexture; } @@ -739,12 +739,12 @@ define([ imagery.state = ImageryState.READY; }; - ImageryLayer.prototype.getImageryFromCache = function(x, y, level, imageryExtent) { + ImageryLayer.prototype.getImageryFromCache = function(x, y, level, imageryRectangle) { var cacheKey = getImageryCacheKey(x, y, level); var imagery = this._imageryCache[cacheKey]; if (!defined(imagery)) { - imagery = new Imagery(this, x, y, level, imageryExtent); + imagery = new Imagery(this, x, y, level, imageryRectangle); this._imageryCache[cacheKey] = imagery; } @@ -795,7 +795,7 @@ define([ var float32ArrayScratch = FeatureDetection.supportsTypedArrays() ? new Float32Array(1) : undefined; - function reprojectToGeographic(imageryLayer, context, texture, extent) { + function reprojectToGeographic(imageryLayer, context, texture, rectangle) { var reproject = context.cache.imageryLayer_reproject; if (!defined(reproject)) { @@ -883,17 +883,17 @@ define([ uniformMap.textureDimensions.y = height; uniformMap.texture = texture; - uniformMap.northLatitude = extent.north; - uniformMap.southLatitude = extent.south; + uniformMap.northLatitude = rectangle.north; + uniformMap.southLatitude = rectangle.south; - var sinLatitude = Math.sin(extent.south); + var sinLatitude = Math.sin(rectangle.south); var southMercatorY = 0.5 * Math.log((1 + sinLatitude) / (1 - sinLatitude)); float32ArrayScratch[0] = southMercatorY; uniformMap.southMercatorYHigh = float32ArrayScratch[0]; uniformMap.southMercatorYLow = southMercatorY - float32ArrayScratch[0]; - sinLatitude = Math.sin(extent.north); + sinLatitude = Math.sin(rectangle.north); var northMercatorY = 0.5 * Math.log((1 + sinLatitude) / (1 - sinLatitude)); uniformMap.oneOverMercatorHeight = 1.0 / (northMercatorY - southMercatorY); @@ -959,8 +959,8 @@ define([ var tilingScheme = imageryProvider.tilingScheme; var ellipsoid = tilingScheme.ellipsoid; var latitudeFactor = !(layer._imageryProvider.tilingScheme instanceof GeographicTilingScheme) ? Math.cos(latitudeClosestToEquator) : 1.0; - var tilingSchemeExtent = tilingScheme.extent; - var levelZeroMaximumTexelSpacing = ellipsoid.maximumRadius * (tilingSchemeExtent.east - tilingSchemeExtent.west) * latitudeFactor / (imageryProvider.tileWidth * tilingScheme.getNumberOfXTilesAtLevel(0)); + var tilingSchemeRectangle = tilingScheme.rectangle; + var levelZeroMaximumTexelSpacing = ellipsoid.maximumRadius * (tilingSchemeRectangle.east - tilingSchemeRectangle.west) * latitudeFactor / (imageryProvider.tileWidth * tilingScheme.getNumberOfXTilesAtLevel(0)); var twoToTheLevelPower = levelZeroMaximumTexelSpacing / texelSpacing; var level = Math.log(twoToTheLevelPower) / Math.log(2); diff --git a/Source/Scene/ImageryProvider.js b/Source/Scene/ImageryProvider.js index 3be8a633e230..aba4c20b86f7 100644 --- a/Source/Scene/ImageryProvider.js +++ b/Source/Scene/ImageryProvider.js @@ -132,12 +132,12 @@ define([ }, /** - * Gets the extent, in radians, of the imagery provided by the instance. This function should + * Gets the rectangle, in radians, of the imagery provided by the instance. This function should * not be called before {@link ImageryProvider#ready} returns true. * @memberof ImageryProvider.prototype - * @type {Extent} + * @type {Rectangle} */ - extent: { + rectangle: { get : DeveloperError.throwInstantiationError }, @@ -174,7 +174,7 @@ define([ /** * Gets the minimum level-of-detail that can be requested. This function should * not be called before {@link ImageryProvider#ready} returns true. Generally, - * a minimum level should only be used when the extent of the imagery is small + * a minimum level should only be used when the rectangle of the imagery is small * enough that the number of tiles at the minimum level is small. An imagery * provider with more than a few tiles at the minimum level will lead to * rendering problems. diff --git a/Source/Scene/OpenStreetMapImageryProvider.js b/Source/Scene/OpenStreetMapImageryProvider.js index 811865f6a09b..5516f0748a37 100644 --- a/Source/Scene/OpenStreetMapImageryProvider.js +++ b/Source/Scene/OpenStreetMapImageryProvider.js @@ -5,7 +5,7 @@ define([ '../Core/defineProperties', '../Core/DeveloperError', '../Core/Event', - '../Core/Extent', + '../Core/Rectangle', './ImageryProvider', './WebMercatorTilingScheme', './Credit' @@ -15,7 +15,7 @@ define([ defineProperties, DeveloperError, Event, - Extent, + Rectangle, ImageryProvider, WebMercatorTilingScheme, Credit) { @@ -36,7 +36,7 @@ define([ * @param {String} [description.url='http://tile.openstreetmap.org'] The OpenStreetMap server url. * @param {String} [description.fileExtension='png'] The file extension for images on the server. * @param {Object} [description.proxy] A proxy to use for requests. This object is expected to have a getURL function which returns the proxied URL. - * @param {Extent} [description.extent=Extent.MAX_VALUE] The extent of the layer. + * @param {Rectangle} [description.rectangle=Rectangle.MAX_VALUE] The rectangle of the layer. * @param {Number} [description.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. * @param {Number} [description.maximumLevel=18] The maximum level-of-detail supported by the imagery provider. * @param {Credit|String} [description.credit='MapQuest, Open Street Map and contributors, CC-BY-SA'] A credit for the data source, which is displayed on the canvas. @@ -78,16 +78,16 @@ define([ this._minimumLevel = defaultValue(description.minimumLevel, 0); this._maximumLevel = defaultValue(description.maximumLevel, 18); - this._extent = defaultValue(description.extent, this._tilingScheme.extent); + this._rectangle = defaultValue(description.rectangle, this._tilingScheme.rectangle); // Check the number of tiles at the minimum level. If it's more than four, // throw an exception, because starting at the higher minimum // level will cause too many tiles to be downloaded and rendered. - var swTile = this._tilingScheme.positionToTileXY(Extent.getSouthwest(this._extent), this._minimumLevel); - var neTile = this._tilingScheme.positionToTileXY(Extent.getNortheast(this._extent), this._minimumLevel); + var swTile = this._tilingScheme.positionToTileXY(Rectangle.getSouthwest(this._rectangle), this._minimumLevel); + var neTile = this._tilingScheme.positionToTileXY(Rectangle.getNortheast(this._rectangle), this._minimumLevel); var tileCount = (Math.abs(neTile.x - swTile.x) + 1) * (Math.abs(neTile.y - swTile.y) + 1); if (tileCount > 4) { - throw new DeveloperError('The imagery provider\'s extent and minimumLevel indicate that there are ' + tileCount + ' tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.'); + throw new DeveloperError('The imagery provider\'s rectangle and minimumLevel indicate that there are ' + tileCount + ' tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.'); } this._errorEvent = new Event(); @@ -226,20 +226,20 @@ define([ }, /** - * Gets the extent, in radians, of the imagery provided by this instance. This function should + * Gets the rectangle, in radians, of the imagery provided by this instance. This function should * not be called before {@link OpenStreetMapImageryProvider#ready} returns true. * @memberof OpenStreetMapImageryProviderr.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : function() { //>>includeStart('debug', pragmas.debug); if (!this._ready) { - throw new DeveloperError('extent must not be called before the imagery provider is ready.'); + throw new DeveloperError('rectangle must not be called before the imagery provider is ready.'); } //>>includeEnd('debug'); - return this._extent; + return this._rectangle; } }, diff --git a/Source/Scene/PerInstanceColorAppearance.js b/Source/Scene/PerInstanceColorAppearance.js index 3e076afa771c..c5efa60f99a3 100644 --- a/Source/Scene/PerInstanceColorAppearance.js +++ b/Source/Scene/PerInstanceColorAppearance.js @@ -53,22 +53,22 @@ define([ * }) * })); * - * // Two extents in a primitive, each with a different color + * // Two rectangles in a primitive, each with a different color * var instance = new Cesium.GeometryInstance({ - * geometry : new Cesium.ExtentGeometry({ - * extent : Cesium.Extent.fromDegrees(0.0, 20.0, 10.0, 30.0) + * geometry : new Cesium.RectangleGeometry({ + * rectangle : Cesium.Rectangle.fromDegrees(0.0, 20.0, 10.0, 30.0) * }), * color : new Cesium.Color(1.0, 0.0, 0.0, 0.5) * }); * * var anotherInstance = new Cesium.GeometryInstance({ - * geometry : new Cesium.ExtentGeometry({ - * extent : Cesium.Extent.fromDegrees(0.0, 40.0, 10.0, 50.0) + * geometry : new Cesium.RectangleGeometry({ + * rectangle : Cesium.Rectangle.fromDegrees(0.0, 40.0, 10.0, 50.0) * }), * color : new Cesium.Color(0.0, 0.0, 1.0, 0.5) * }); * - * var extentPrimitive = new Cesium.Primitive({ + * var rectanglePrimitive = new Cesium.Primitive({ * geometryInstances : [instance, anotherInstance], * appearance : new Cesium.PerInstanceColorAppearance() * }); diff --git a/Source/Scene/Polygon.js b/Source/Scene/Polygon.js index 7f28c7f618b7..cde5dde24f99 100644 --- a/Source/Scene/Polygon.js +++ b/Source/Scene/Polygon.js @@ -39,7 +39,7 @@ define([ * @param {Array} [options.positions=undefined] The cartesian positions of the polygon. * @param {Object} [options.polygonHierarchy=undefined] An object defining the vertex positions of each nested polygon as defined in {@link Polygon#configureFromPolygonHierarchy}. * @param {Number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude in the underlying geometry. - * @param {Number} [options.height=0.0] The height, in meters, that the extent is raised above the {@link ExtentPrimitive#ellipsoid}. + * @param {Number} [options.height=0.0] The height, in meters, that the rectangle is raised above the {@link RectanglePrimitive#ellipsoid}. * @param {Number} [options.textureRotationAngle=0.0] The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise. * @param {Boolean} [options.show=true] Determines if this primitive will be shown. * @param {Material} [options.material=undefined] The surface appearance of the primitive. diff --git a/Source/Scene/Primitive.js b/Source/Scene/Primitive.js index 5b577c2171ee..cae363cd62a9 100644 --- a/Source/Scene/Primitive.js +++ b/Source/Scene/Primitive.js @@ -60,7 +60,7 @@ define([ /** * A primitive represents geometry in the {@link Scene}. The geometry can be from a single {@link GeometryInstance} * as shown in example 1 below, or from an array of instances, even if the geometry is from different - * geometry types, e.g., an {@link ExtentGeometry} and an {@link EllipsoidGeometry} as shown in Code Example 2. + * geometry types, e.g., an {@link RectangleGeometry} and an {@link EllipsoidGeometry} as shown in Code Example 2. * <p> * A primitive combines geometry instances with an {@link Appearance} that describes the full shading, including * {@link Material} and {@link RenderState}. Roughly, the geometry instance defines the structure and placement, @@ -113,16 +113,16 @@ define([ * scene.primitives.add(primitive); * * // 2. Draw different instances each with a unique color - * var extentInstance = new Cesium.GeometryInstance({ - * geometry : new Cesium.ExtentGeometry({ + * var rectangleInstance = new Cesium.GeometryInstance({ + * geometry : new Cesium.RectangleGeometry({ * vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL, - * extent : new Cesium.Extent( + * rectangle : new Cesium.Rectangle( * Cesium.Math.toRadians(-140.0), * Cesium.Math.toRadians(30.0), * Cesium.Math.toRadians(-100.0), * Cesium.Math.toRadians(40.0)) * }), - * id : 'extent', + * id : 'rectangle', * attribute : { * color : new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 0.5) * } @@ -140,7 +140,7 @@ define([ * } * }); * var primitive = new Cesium.Primitive({ - * geometryInstances : [extentInstance, ellipsoidInstance], + * geometryInstances : [rectangleInstance, ellipsoidInstance], * appearance : new Cesium.PerInstanceColorAppearance() * }); * scene.primitives.add(primitive); diff --git a/Source/Scene/QuantizedMeshTerrainData.js b/Source/Scene/QuantizedMeshTerrainData.js index 034b767226a1..a55f662e56be 100644 --- a/Source/Scene/QuantizedMeshTerrainData.js +++ b/Source/Scene/QuantizedMeshTerrainData.js @@ -246,7 +246,7 @@ define([ //>>includeEnd('debug'); var ellipsoid = tilingScheme.ellipsoid; - var extent = tilingScheme.tileXYToExtent(x, y, level); + var rectangle = tilingScheme.tileXYToRectangle(x, y, level); var verticesPromise = createMeshTaskProcessor.scheduleTask({ minimumHeight : this._minimumHeight, @@ -261,7 +261,7 @@ define([ southSkirtHeight : this._southSkirtHeight, eastSkirtHeight : this._eastSkirtHeight, northSkirtHeight : this._northSkirtHeight, - extent : extent, + rectangle : rectangle, relativeToCenter : this._boundingSphere.center, ellipsoid : ellipsoid }); @@ -337,7 +337,7 @@ define([ var isNorthChild = thisY * 2 === descendantY; var ellipsoid = tilingScheme.ellipsoid; - var childExtent = tilingScheme.tileXYToExtent(descendantX, descendantY, descendantLevel); + var childRectangle = tilingScheme.tileXYToRectangle(descendantX, descendantY, descendantLevel); var upsamplePromise = upsampleTaskProcessor.scheduleTask({ vertices : this._quantizedVertices, @@ -346,7 +346,7 @@ define([ maximumHeight : this._maximumHeight, isEastChild : isEastChild, isNorthChild : isNorthChild, - childExtent : childExtent, + childRectangle : childRectangle, ellipsoid : ellipsoid }); @@ -394,17 +394,17 @@ define([ * * @memberof QuantizedMeshTerrainData * - * @param {Extent} extent The extent covered by this terrain data. + * @param {Rectangle} rectangle The rectangle covered by this terrain data. * @param {Number} longitude The longitude in radians. * @param {Number} latitude The latitude in radians. * @returns {Number} The terrain height at the specified position. If the position - * is outside the extent, this method will extrapolate the height, which is likely to be wildly - * incorrect for positions far outside the extent. + * is outside the rectangle, this method will extrapolate the height, which is likely to be wildly + * incorrect for positions far outside the rectangle. */ - QuantizedMeshTerrainData.prototype.interpolateHeight = function(extent, longitude, latitude) { - var u = (longitude - extent.west) / (extent.east - extent.west); + QuantizedMeshTerrainData.prototype.interpolateHeight = function(rectangle, longitude, latitude) { + var u = (longitude - rectangle.west) / (rectangle.east - rectangle.west); u *= maxShort; - var v = (latitude - extent.south) / (extent.north - extent.south); + var v = (latitude - rectangle.south) / (rectangle.north - rectangle.south); v *= maxShort; var uBuffer = this._uValues; diff --git a/Source/Scene/ExtentPrimitive.js b/Source/Scene/RectanglePrimitive.js similarity index 79% rename from Source/Scene/ExtentPrimitive.js rename to Source/Scene/RectanglePrimitive.js index 28733342b527..5e565ac2c80e 100644 --- a/Source/Scene/ExtentPrimitive.js +++ b/Source/Scene/RectanglePrimitive.js @@ -6,10 +6,10 @@ define([ '../Core/Color', '../Core/destroyObject', '../Core/Math', - '../Core/Extent', + '../Core/Rectangle', '../Core/Ellipsoid', '../Core/GeometryInstance', - '../Core/ExtentGeometry', + '../Core/RectangleGeometry', './EllipsoidSurfaceAppearance', './Primitive', './Material' @@ -20,44 +20,44 @@ define([ Color, destroyObject, CesiumMath, - Extent, + Rectangle, Ellipsoid, GeometryInstance, - ExtentGeometry, + RectangleGeometry, EllipsoidSurfaceAppearance, Primitive, Material) { "use strict"; /** - * A renderable rectangular extent. + * A renderable rectangular rectangle. * - * @alias ExtentPrimitive + * @alias RectanglePrimitive * @constructor * - * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid that the extent is drawn on. - * @param {Extent} [options.extent=undefined] The extent, which defines the rectangular region to draw. + * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid that the rectangle is drawn on. + * @param {Rectangle} [options.rectangle=undefined] The rectangle, which defines the rectangular region to draw. * @param {Number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude in the underlying geometry. - * @param {Number} [options.height=0.0] The height, in meters, that the extent is raised above the {@link ExtentPrimitive#ellipsoid}. - * @param {Number} [options.rotation=0.0] The angle, in radians, relative to north that the extent is rotated. Positive angles rotate counter-clockwise. + * @param {Number} [options.height=0.0] The height, in meters, that the rectangle is raised above the {@link RectanglePrimitive#ellipsoid}. + * @param {Number} [options.rotation=0.0] The angle, in radians, relative to north that the rectangle is rotated. Positive angles rotate counter-clockwise. * @param {Number} [options.textureRotationAngle=0.0] The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise. * @param {Boolean} [options.show=true] Determines if this primitive will be shown. * @param {Material} [options.material=undefined] The surface appearance of the primitive. * @param {Object} [options.id=undefined] A user-defined object to return when the instance is picked with {@link Scene#pick} - * @param {Boolean} [options.asynchronous=true] Determines if the extent will be created asynchronously or block until ready. + * @param {Boolean} [options.asynchronous=true] Determines if the rectangle will be created asynchronously or block until ready. * @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. Determines if the primitive's commands' bounding spheres are shown. * * @example - * var extentPrimitive = new Cesium.ExtentPrimitive({ - * extent : Cesium.Extent.fromDegrees(0.0, 20.0, 10.0, 30.0) + * var rectanglePrimitive = new Cesium.RectanglePrimitive({ + * rectangle : Cesium.Rectangle.fromDegrees(0.0, 20.0, 10.0, 30.0) * }); - * primitives.add(extentPrimitive); + * primitives.add(rectanglePrimitive); */ - var ExtentPrimitive = function(options) { + var RectanglePrimitive = function(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); /** - * The ellipsoid that the extent is drawn on. + * The ellipsoid that the rectangle is drawn on. * * @type Ellipsoid * @@ -67,18 +67,18 @@ define([ this._ellipsoid = undefined; /** - * The extent, which defines the rectangular region to draw. + * The rectangle, which defines the rectangular region to draw. * - * @type Extent + * @type Rectangle * * @default undefined */ - this.extent = Extent.clone(options.extent); - this._extent = undefined; + this.rectangle = Rectangle.clone(options.rectangle); + this._rectangle = undefined; /** * The distance, in radians, between each latitude and longitude in the underlying geometry. - * A lower granularity fits the curvature of the {@link ExtentPrimitive#ellipsoid} better, + * A lower granularity fits the curvature of the {@link RectanglePrimitive#ellipsoid} better, * but uses more triangles. * * @type Number @@ -89,7 +89,7 @@ define([ this._granularity = undefined; /** - * The height, in meters, that the extent is raised above the {@link ExtentPrimitive#ellipsoid}. + * The height, in meters, that the rectangle is raised above the {@link RectanglePrimitive#ellipsoid}. * * @type Number * @@ -99,7 +99,7 @@ define([ this._height = undefined; /** - * The angle, in radians, relative to north that the extent is rotated. + * The angle, in radians, relative to north that the rectangle is rotated. * Positive angles rotate counter-clockwise. * * @type Number @@ -144,17 +144,17 @@ define([ * * @example * // 1. Change the color of the default material to yellow - * extent.material.uniforms.color = new Cesium.Color(1.0, 1.0, 0.0, 1.0); + * rectangle.material.uniforms.color = new Cesium.Color(1.0, 1.0, 0.0, 1.0); * * // 2. Change material to horizontal stripes - * extent.material = Cesium.Material.fromType(Material.StripeType); + * rectangle.material = Cesium.Material.fromType(Material.StripeType); * * @see <a href='https://github.com/AnalyticalGraphicsInc/cesium/wiki/Fabric'>Fabric</a> */ this.material = defaultValue(options.material, material); /** - * User-defined object returned when the extent is picked. + * User-defined object returned when the rectangle is picked. * * @type Object * @@ -193,7 +193,7 @@ define([ /** * @private */ - ExtentPrimitive.prototype.update = function(context, frameState, commandList) { + RectanglePrimitive.prototype.update = function(context, frameState, commandList) { //>>includeStart('debug', pragmas.debug); if (!defined(this.ellipsoid)) { throw new DeveloperError('this.ellipsoid must be defined.'); @@ -206,11 +206,11 @@ define([ } //>>includeEnd('debug'); - if (!this.show || (!defined(this.extent))) { + if (!this.show || (!defined(this.rectangle))) { return; } - if (!Extent.equals(this._extent, this.extent) || + if (!Rectangle.equals(this._rectangle, this.rectangle) || (this._ellipsoid !== this.ellipsoid) || (this._granularity !== this.granularity) || (this._height !== this.height) || @@ -218,7 +218,7 @@ define([ (this._textureRotationAngle !== this.textureRotationAngle) || (this._id !== this.id)) { - this._extent = Extent.clone(this.extent, this._extent); + this._rectangle = Rectangle.clone(this.rectangle, this._rectangle); this._ellipsoid = this.ellipsoid; this._granularity = this.granularity; this._height = this.height; @@ -227,8 +227,8 @@ define([ this._id = this.id; var instance = new GeometryInstance({ - geometry : new ExtentGeometry({ - extent : this.extent, + geometry : new RectangleGeometry({ + rectangle : this.rectangle, vertexFormat : EllipsoidSurfaceAppearance.VERTEX_FORMAT, ellipsoid : this.ellipsoid, granularity : this.granularity, @@ -265,13 +265,13 @@ define([ * If this object was destroyed, it should not be used; calling any function other than * <code>isDestroyed</code> will result in a {@link DeveloperError} exception. * - * @memberof Extent + * @memberof Rectangle * * @returns {Boolean} <code>true</code> if this object was destroyed; otherwise, <code>false</code>. * - * @see Extent#destroy + * @see Rectangle#destroy */ - ExtentPrimitive.prototype.isDestroyed = function() { + RectanglePrimitive.prototype.isDestroyed = function() { return false; }; @@ -283,21 +283,21 @@ define([ * <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore, * assign the return value (<code>undefined</code>) to the object as done in the example. * - * @memberof Extent + * @memberof Rectangle * * @returns {undefined} * * @exception {DeveloperError} This object was destroyed, i.e., destroy() was called. * - * @see Extent#isDestroyed + * @see Rectangle#isDestroyed * * @example - * extent = extent && extent.destroy(); + * rectangle = rectangle && rectangle.destroy(); */ - ExtentPrimitive.prototype.destroy = function() { + RectanglePrimitive.prototype.destroy = function() { this._primitive = this._primitive && this._primitive.destroy(); return destroyObject(this); }; - return ExtentPrimitive; + return RectanglePrimitive; }); diff --git a/Source/Scene/RectangularPyramidSensorVolume.js b/Source/Scene/RectangularPyramidSensorVolume.js index 2c55466999d5..0cf6089d8174 100644 --- a/Source/Scene/RectangularPyramidSensorVolume.js +++ b/Source/Scene/RectangularPyramidSensorVolume.js @@ -69,7 +69,7 @@ define([ /** * The 4x4 transformation matrix that transforms this sensor from model to world coordinates. In it's model * coordinates, the sensor's principal direction is along the positive z-axis. Half angles measured from the - * principal direction and in the direction of the x-axis and y-axis define the extent of the rectangular + * principal direction and in the direction of the x-axis and y-axis define the rectangle of the rectangular * cross section. This matrix is available to GLSL vertex and fragment shaders via * {@link czm_model} and derived uniforms. * <br /><br /> diff --git a/Source/Scene/SingleTileImageryProvider.js b/Source/Scene/SingleTileImageryProvider.js index 95b575415661..5d22eadb655a 100644 --- a/Source/Scene/SingleTileImageryProvider.js +++ b/Source/Scene/SingleTileImageryProvider.js @@ -6,7 +6,7 @@ define([ '../Core/loadImage', '../Core/DeveloperError', '../Core/Event', - '../Core/Extent', + '../Core/Rectangle', './Credit', './GeographicTilingScheme', './TileProviderError', @@ -18,7 +18,7 @@ define([ loadImage, DeveloperError, Event, - Extent, + Rectangle, Credit, GeographicTilingScheme, TileProviderError, @@ -33,7 +33,7 @@ define([ * @constructor * * @param {String} description.url The url for the tile. - * @param {Extent} [description.extent=Extent.MAX_VALUE] The extent, in radians, covered by the image. + * @param {Rectangle} [description.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. * @param {Credit|String} [description.credit] A credit for the data source, which is displayed on the canvas. * @param {Object} [description.proxy] A proxy to use for requests. This object is expected to have a getURL function which returns the proxied URL, if needed. * @@ -59,9 +59,9 @@ define([ var proxy = description.proxy; this._proxy = proxy; - var extent = defaultValue(description.extent, Extent.MAX_VALUE); + var rectangle = defaultValue(description.rectangle, Rectangle.MAX_VALUE); var tilingScheme = new GeographicTilingScheme({ - extent : extent, + rectangle : rectangle, numberOfLevelZeroTilesX : 1, numberOfLevelZeroTilesY : 1 }); @@ -231,14 +231,14 @@ define([ }, /** - * Gets the extent, in radians, of the imagery provided by this instance. This function should + * Gets the rectangle, in radians, of the imagery provided by this instance. This function should * not be called before {@link SingleTileImageryProvider#ready} returns true. * @memberof SingleTileImageryProvider.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : function() { - return this._tilingScheme.extent; + return this._tilingScheme.rectangle; } }, diff --git a/Source/Scene/TerrainData.js b/Source/Scene/TerrainData.js index b09209ee5a2f..536339c5e9d0 100644 --- a/Source/Scene/TerrainData.js +++ b/Source/Scene/TerrainData.js @@ -39,12 +39,12 @@ define([ * @memberof TerrainData * @function * - * @param {Extent} extent The extent covered by this terrain data. + * @param {Rectangle} rectangle The rectangle covered by this terrain data. * @param {Number} longitude The longitude in radians. * @param {Number} latitude The latitude in radians. * @returns {Number} The terrain height at the specified position. If the position - * is outside the extent, this method will extrapolate the height, which is likely to be wildly - * incorrect for positions far outside the extent. + * is outside the rectangle, this method will extrapolate the height, which is likely to be wildly + * incorrect for positions far outside the rectangle. */ TerrainData.prototype.interpolateHeight = DeveloperError.throwInstantiationError; diff --git a/Source/Scene/Tile.js b/Source/Scene/Tile.js index 4937ed459612..c2627e2d60b5 100644 --- a/Source/Scene/Tile.js +++ b/Source/Scene/Tile.js @@ -7,7 +7,7 @@ define([ '../Core/defined', '../Core/defineProperties', '../Core/DeveloperError', - '../Core/Extent', + '../Core/Rectangle', './ImageryState', './TerrainState', './TileState', @@ -25,7 +25,7 @@ define([ defined, defineProperties, DeveloperError, - Extent, + Rectangle, ImageryState, TerrainState, TileState, @@ -39,7 +39,7 @@ define([ /** * A node in the quadtree representing the surface of a {@link CentralBody}. - * A tile holds the surface geometry for its horizontal extent and zero or + * A tile holds the surface geometry for its horizontal rectangle and zero or * more imagery textures overlaid on the geometry. * * @alias Tile @@ -106,11 +106,11 @@ define([ this.parent = description.parent; /** - * The cartographic extent of the tile, with north, south, east and + * The cartographic rectangle of the tile, with north, south, east and * west properties in radians. - * @type {Extent} + * @type {Rectangle} */ - this.extent = this.tilingScheme.tileXYToExtent(this.x, this.y, this.level); + this.rectangle = this.tilingScheme.tileXYToRectangle(this.x, this.y, this.level); /** * The current state of the tile in the tile load pipeline. @@ -150,7 +150,7 @@ define([ this.distance = 0.0; /** - * The world coordinates of the southwest corner of the tile's extent. + * The world coordinates of the southwest corner of the tile's rectangle. * * @type {Cartesian3} * @default Cartesian3() @@ -158,7 +158,7 @@ define([ this.southwestCornerCartesian = new Cartesian3(); /** - * The world coordinates of the northeast corner of the tile's extent. + * The world coordinates of the northeast corner of the tile's rectangle. * * @type {Cartesian3} * @default Cartesian3() @@ -425,15 +425,15 @@ define([ var ellipsoid = tile.tilingScheme.ellipsoid; - // Compute tile extent boundaries for estimating the distance to the tile. - var extent = tile.extent; + // Compute tile rectangle boundaries for estimating the distance to the tile. + var rectangle = tile.rectangle; - ellipsoid.cartographicToCartesian(Extent.getSouthwest(extent), tile.southwestCornerCartesian); - ellipsoid.cartographicToCartesian(Extent.getNortheast(extent), tile.northeastCornerCartesian); + ellipsoid.cartographicToCartesian(Rectangle.getSouthwest(rectangle), tile.southwestCornerCartesian); + ellipsoid.cartographicToCartesian(Rectangle.getNortheast(rectangle), tile.northeastCornerCartesian); // The middle latitude on the western edge. - cartographicScratch.longitude = extent.west; - cartographicScratch.latitude = (extent.south + extent.north) * 0.5; + cartographicScratch.longitude = rectangle.west; + cartographicScratch.latitude = (rectangle.south + rectangle.north) * 0.5; cartographicScratch.height = 0.0; var westernMidpointCartesian = ellipsoid.cartographicToCartesian(cartographicScratch, westernMidpointScratch); @@ -442,7 +442,7 @@ define([ Cartesian3.normalize(westNormal, tile.westNormal); // The middle latitude on the eastern edge. - cartographicScratch.longitude = extent.east; + cartographicScratch.longitude = rectangle.east; var easternMidpointCartesian = ellipsoid.cartographicToCartesian(cartographicScratch, easternMidpointScratch); // Compute the normal of the plane on the eastern edge of the tile. @@ -450,13 +450,13 @@ define([ Cartesian3.normalize(eastNormal, tile.eastNormal); // Compute the normal of the plane bounding the southern edge of the tile. - var southeastCornerNormal = ellipsoid.geodeticSurfaceNormalCartographic(Extent.getSoutheast(extent), cartesian3Scratch2); + var southeastCornerNormal = ellipsoid.geodeticSurfaceNormalCartographic(Rectangle.getSoutheast(rectangle), cartesian3Scratch2); var westVector = Cartesian3.subtract(westernMidpointCartesian, easternMidpointCartesian, cartesian3Scratch); var southNormal = Cartesian3.cross(southeastCornerNormal, westVector, cartesian3Scratch2); Cartesian3.normalize(southNormal, tile.southNormal); // Compute the normal of the plane bounding the northern edge of the tile. - var northwestCornerNormal = ellipsoid.geodeticSurfaceNormalCartographic(Extent.getNorthwest(extent), cartesian3Scratch2); + var northwestCornerNormal = ellipsoid.geodeticSurfaceNormalCartographic(Rectangle.getNorthwest(rectangle), cartesian3Scratch2); var northNormal = Cartesian3.cross(westVector, northwestCornerNormal, cartesian3Scratch2); Cartesian3.normalize(northNormal, tile.northNormal); } @@ -751,15 +751,15 @@ define([ ++tile.waterMaskTexture.referenceCount; // Compute the water mask translation and scale - var sourceTileExtent = sourceTile.extent; - var tileExtent = tile.extent; - var tileWidth = tileExtent.east - tileExtent.west; - var tileHeight = tileExtent.north - tileExtent.south; - - var scaleX = tileWidth / (sourceTileExtent.east - sourceTileExtent.west); - var scaleY = tileHeight / (sourceTileExtent.north - sourceTileExtent.south); - tile.waterMaskTranslationAndScale.x = scaleX * (tileExtent.west - sourceTileExtent.west) / tileWidth; - tile.waterMaskTranslationAndScale.y = scaleY * (tileExtent.south - sourceTileExtent.south) / tileHeight; + var sourceTileRectangle = sourceTile.rectangle; + var tileRectangle = tile.rectangle; + var tileWidth = tileRectangle.east - tileRectangle.west; + var tileHeight = tileRectangle.north - tileRectangle.south; + + var scaleX = tileWidth / (sourceTileRectangle.east - sourceTileRectangle.west); + var scaleY = tileHeight / (sourceTileRectangle.north - sourceTileRectangle.south); + tile.waterMaskTranslationAndScale.x = scaleX * (tileRectangle.west - sourceTileRectangle.west) / tileWidth; + tile.waterMaskTranslationAndScale.y = scaleY * (tileRectangle.south - sourceTileRectangle.south) / tileHeight; tile.waterMaskTranslationAndScale.z = scaleX; tile.waterMaskTranslationAndScale.w = scaleY; } diff --git a/Source/Scene/TileCoordinatesImageryProvider.js b/Source/Scene/TileCoordinatesImageryProvider.js index 494dff1926f5..71771fc857cd 100644 --- a/Source/Scene/TileCoordinatesImageryProvider.js +++ b/Source/Scene/TileCoordinatesImageryProvider.js @@ -110,14 +110,14 @@ define([ }, /** - * Gets the extent, in radians, of the imagery provided by this instance. This function should + * Gets the rectangle, in radians, of the imagery provided by this instance. This function should * not be called before {@link TileCoordinatesImageryProvider#ready} returns true. * @memberof TileCoordinatesImageryProvider.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : function() { - return this._tilingScheme.extent; + return this._tilingScheme.rectangle; } }, diff --git a/Source/Scene/TileImagery.js b/Source/Scene/TileImagery.js index 0a9abc2fd8e8..c9e961d17475 100644 --- a/Source/Scene/TileImagery.js +++ b/Source/Scene/TileImagery.js @@ -14,13 +14,13 @@ define([ * @private * * @param {Imagery} imagery The imagery tile. - * @param {Cartesian4} textureCoordinateExtent The texture extent of the tile that is covered + * @param {Cartesian4} textureCoordinateRectangle The texture rectangle of the tile that is covered * by the imagery, where X=west, Y=south, Z=east, W=north. */ - var TileImagery = function(imagery, textureCoordinateExtent) { + var TileImagery = function(imagery, textureCoordinateRectangle) { this.readyImagery = undefined; this.loadingImagery = imagery; - this.textureCoordinateExtent = textureCoordinateExtent; + this.textureCoordinateRectangle = textureCoordinateRectangle; this.textureTranslationAndScale = undefined; }; diff --git a/Source/Scene/TileMapServiceImageryProvider.js b/Source/Scene/TileMapServiceImageryProvider.js index 0a9b48071942..71658f0ec6d3 100644 --- a/Source/Scene/TileMapServiceImageryProvider.js +++ b/Source/Scene/TileMapServiceImageryProvider.js @@ -7,7 +7,7 @@ define([ '../Core/DeveloperError', '../Core/Event', '../Core/loadXML', - '../Core/Extent', + '../Core/Rectangle', './Credit', './ImageryProvider', './WebMercatorTilingScheme', @@ -20,7 +20,7 @@ define([ DeveloperError, Event, loadXML, - Extent, + Rectangle, Credit, ImageryProvider, WebMercatorTilingScheme, @@ -43,7 +43,7 @@ define([ * this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely * to result in rendering problems. * @param {Number} [description.maximumLevel=18] The maximum level-of-detail supported by the imagery provider. - * @param {Extent} [description.extent=Extent.MAX_VALUE] The extent, in radians, covered by the image. + * @param {Rectangle} [description.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image. * @param {TilingScheme} [description.tilingScheme] The tiling scheme specifying how the ellipsoidal * surface is broken into tiles. If this parameter is not provided, a {@link WebMercatorTilingScheme} * is used. @@ -67,7 +67,7 @@ define([ * url : '../images/cesium_maptiler/Cesium_Logo_Color', * fileExtension: 'png', * maximumLevel: 4, - * extent: new Cesium.Extent( + * rectangle: new Cesium.Rectangle( * Cesium.Math.toRadians(-120.0), * Cesium.Math.toRadians(20.0), * Cesium.Math.toRadians(-60.0), @@ -137,14 +137,14 @@ define([ that._minimumLevel = defaultValue(description.minimumLevel, parseInt(tilesetsList[0].getAttribute('order'), 10)); that._maximumLevel = defaultValue(description.maximumLevel, parseInt(tilesetsList[tilesetsList.length - 1].getAttribute('order'), 10)); - // extent handling - that._extent = description.extent; - if (!defined(that._extent)) { + // rectangle handling + that._rectangle = description.rectangle; + if (!defined(that._rectangle)) { var sw = Cartographic.fromDegrees(parseFloat(bbox.getAttribute('miny')), parseFloat(bbox.getAttribute('minx'))); var ne = Cartographic.fromDegrees(parseFloat(bbox.getAttribute('maxy')), parseFloat(bbox.getAttribute('maxx'))); - that._extent = new Extent(sw.longitude, sw.latitude, ne.longitude, ne.latitude); + that._rectangle = new Rectangle(sw.longitude, sw.latitude, ne.longitude, ne.latitude); } else { - that._extent = Extent.clone(that._extent); + that._rectangle = Rectangle.clone(that._rectangle); } // tiling scheme handling @@ -154,25 +154,25 @@ define([ tilingScheme = tilingSchemeName === 'geodetic' ? new GeographicTilingScheme() : new WebMercatorTilingScheme(); } - // The extent must not be outside the bounds allowed by the tiling scheme. - if (that._extent.west < tilingScheme.extent.west) { - that._extent.west = tilingScheme.extent.west; + // The rectangle must not be outside the bounds allowed by the tiling scheme. + if (that._rectangle.west < tilingScheme.rectangle.west) { + that._rectangle.west = tilingScheme.rectangle.west; } - if (that._extent.east > tilingScheme.extent.east) { - that._extent.east = tilingScheme.extent.east; + if (that._rectangle.east > tilingScheme.rectangle.east) { + that._rectangle.east = tilingScheme.rectangle.east; } - if (that._extent.south < tilingScheme.extent.south) { - that._extent.south = tilingScheme.extent.south; + if (that._rectangle.south < tilingScheme.rectangle.south) { + that._rectangle.south = tilingScheme.rectangle.south; } - if (that._extent.north > tilingScheme.extent.north) { - that._extent.north = tilingScheme.extent.north; + if (that._rectangle.north > tilingScheme.rectangle.north) { + that._rectangle.north = tilingScheme.rectangle.north; } // Check the number of tiles at the minimum level. If it's more than four, // try requesting the lower levels anyway, because starting at the higher minimum // level will cause too many tiles to be downloaded and rendered. - var swTile = tilingScheme.positionToTileXY(Extent.getSouthwest(that._extent), that._minimumLevel); - var neTile = tilingScheme.positionToTileXY(Extent.getNortheast(that._extent), that._minimumLevel); + var swTile = tilingScheme.positionToTileXY(Rectangle.getSouthwest(that._rectangle), that._minimumLevel); + var neTile = tilingScheme.positionToTileXY(Rectangle.getNortheast(that._rectangle), that._minimumLevel); var tileCount = (Math.abs(neTile.x - swTile.x) + 1) * (Math.abs(neTile.y - swTile.y) + 1); if (tileCount > 4) { that._minimumLevel = 0; @@ -188,7 +188,7 @@ define([ that._minimumLevel = defaultValue(description.minimumLevel, 0); that._maximumLevel = defaultValue(description.maximumLevel, 18); that._tilingScheme = defaultValue(description.tilingScheme, new WebMercatorTilingScheme()); - that._extent = defaultValue(description.extent, that._tilingScheme.extent); + that._rectangle = defaultValue(description.rectangle, that._tilingScheme.rectangle); that._ready = true; }); @@ -321,20 +321,20 @@ define([ }, /** - * Gets the extent, in radians, of the imagery provided by this instance. This function should + * Gets the rectangle, in radians, of the imagery provided by this instance. This function should * not be called before {@link TileMapServiceImageryProvider#ready} returns true. * @memberof TileMapServiceImageryProvider.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : function() { //>>includeStart('debug', pragmas.debug); if (!this._ready) { - throw new DeveloperError('extent must not be called before the imagery provider is ready.'); + throw new DeveloperError('rectangle must not be called before the imagery provider is ready.'); } //>>includeEnd('debug'); - return this._extent; + return this._rectangle; } }, diff --git a/Source/Scene/TilingScheme.js b/Source/Scene/TilingScheme.js index f95aef7f496e..0cd98e9ddc71 100644 --- a/Source/Scene/TilingScheme.js +++ b/Source/Scene/TilingScheme.js @@ -39,11 +39,11 @@ define([ }, /** - * Gets the extent, in radians, covered by this tiling scheme. + * Gets the rectangle, in radians, covered by this tiling scheme. * @memberof TilingScheme.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : DeveloperError.throwInstantiationError }, @@ -89,21 +89,21 @@ define([ TilingScheme.prototype.createLevelZeroTiles = DeveloperError.throwInstantiationError; /** - * Transforms an extent specified in geodetic radians to the native coordinate system + * Transforms an rectangle specified in geodetic radians to the native coordinate system * of this tiling scheme. * @memberof TilingScheme * @function * - * @param {Extent} extent The extent to transform. - * @param {Extent} [result] The instance to which to copy the result, or undefined if a new instance + * @param {Rectangle} rectangle The rectangle to transform. + * @param {Rectangle} [result] The instance to which to copy the result, or undefined if a new instance * should be created. - * @returns {Extent} The specified 'result', or a new object containing the native extent if 'result' + * @returns {Rectangle} The specified 'result', or a new object containing the native rectangle if 'result' * is undefined. */ - TilingScheme.prototype.extentToNativeExtent = DeveloperError.throwInstantiationError; + TilingScheme.prototype.rectangleToNativeRectangle = DeveloperError.throwInstantiationError; /** - * Converts tile x, y coordinates and level to an extent expressed in the native coordinates + * Converts tile x, y coordinates and level to an rectangle expressed in the native coordinates * of the tiling scheme. * @memberof TilingScheme * @function @@ -114,13 +114,13 @@ define([ * @param {Object} [result] The instance to which to copy the result, or undefined if a new instance * should be created. * - * @returns {Extent} The specified 'result', or a new object containing the extent + * @returns {Rectangle} The specified 'result', or a new object containing the rectangle * if 'result' is undefined. */ - TilingScheme.prototype.tileXYToNativeExtent = DeveloperError.throwInstantiationError; + TilingScheme.prototype.tileXYToNativeRectangle = DeveloperError.throwInstantiationError; /** - * Converts tile x, y coordinates and level to a cartographic extent in radians. + * Converts tile x, y coordinates and level to a cartographic rectangle in radians. * @memberof TilingScheme * @function * @@ -130,10 +130,10 @@ define([ * @param {Object} [result] The instance to which to copy the result, or undefined if a new instance * should be created. * - * @returns {Extent} The specified 'result', or a new object containing the extent + * @returns {Rectangle} The specified 'result', or a new object containing the rectangle * if 'result' is undefined. */ - TilingScheme.prototype.tileXYToExtent = DeveloperError.throwInstantiationError; + TilingScheme.prototype.tileXYToRectangle = DeveloperError.throwInstantiationError; /** * Calculates the tile x, y coordinates of the tile containing diff --git a/Source/Scene/VRTheWorldTerrainProvider.js b/Source/Scene/VRTheWorldTerrainProvider.js index 0ee635e3ff29..72a2943c6793 100644 --- a/Source/Scene/VRTheWorldTerrainProvider.js +++ b/Source/Scene/VRTheWorldTerrainProvider.js @@ -8,7 +8,7 @@ define([ '../Core/getImagePixels', '../Core/throttleRequestByServer', '../Core/DeveloperError', - '../Core/Extent', + '../Core/Rectangle', '../Core/Math', '../Core/Ellipsoid', '../Core/Event', @@ -27,7 +27,7 @@ define([ getImagePixels, throttleRequestByServer, DeveloperError, - Extent, + Rectangle, CesiumMath, Ellipsoid, Event, @@ -39,8 +39,8 @@ define([ when) { "use strict"; - function DataExtent(extent, maxLevel) { - this.extent = extent; + function DataRectangle(rectangle, maxLevel) { + this.rectangle = rectangle; this.maxLevel = maxLevel; } @@ -97,7 +97,7 @@ define([ this._credit = credit; this._tilingScheme = undefined; - this._extents = []; + this._rectangles = []; var that = this; var metadataError; @@ -117,18 +117,18 @@ define([ that._heightmapHeight = parseInt(tileFormat.getAttribute('height'), 10); that._levelZeroMaximumGeometricError = TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(ellipsoid, Math.min(that._heightmapWidth, that._heightmapHeight), that._tilingScheme.getNumberOfXTilesAtLevel(0)); - var dataExtents = xml.getElementsByTagName('DataExtent'); + var dataRectangles = xml.getElementsByTagName('DataExtent'); - for (var i = 0; i < dataExtents.length; ++i) { - var dataExtent = dataExtents[i]; + for (var i = 0; i < dataRectangles.length; ++i) { + var dataRectangle = dataRectangles[i]; - var west = CesiumMath.toRadians(parseFloat(dataExtent.getAttribute('minx'))); - var south = CesiumMath.toRadians(parseFloat(dataExtent.getAttribute('miny'))); - var east = CesiumMath.toRadians(parseFloat(dataExtent.getAttribute('maxx'))); - var north = CesiumMath.toRadians(parseFloat(dataExtent.getAttribute('maxy'))); - var maxLevel = parseInt(dataExtent.getAttribute('maxlevel'), 10); + var west = CesiumMath.toRadians(parseFloat(dataRectangle.getAttribute('minx'))); + var south = CesiumMath.toRadians(parseFloat(dataRectangle.getAttribute('miny'))); + var east = CesiumMath.toRadians(parseFloat(dataRectangle.getAttribute('maxx'))); + var north = CesiumMath.toRadians(parseFloat(dataRectangle.getAttribute('maxy'))); + var maxLevel = parseInt(dataRectangle.getAttribute('maxlevel'), 10); - that._extents.push(new DataExtent(new Extent(west, south, east, north), maxLevel)); + that._rectangles.push(new DataRectangle(new Rectangle(west, south, east, north), maxLevel)); } that._ready = true; @@ -282,36 +282,36 @@ define([ return false; }; - var extentScratch = new Extent(); + var rectangleScratch = new Rectangle(); function getChildMask(provider, x, y, level) { var tilingScheme = provider._tilingScheme; - var extents = provider._extents; - var parentExtent = tilingScheme.tileXYToExtent(x, y, level); + var rectangles = provider._rectangles; + var parentRectangle = tilingScheme.tileXYToRectangle(x, y, level); var childMask = 0; - for (var i = 0; i < extents.length && childMask !== 15; ++i) { - var extent = extents[i]; - if (extent.maxLevel <= level) { + for (var i = 0; i < rectangles.length && childMask !== 15; ++i) { + var rectangle = rectangles[i]; + if (rectangle.maxLevel <= level) { continue; } - var testExtent = extent.extent; + var testRectangle = rectangle.rectangle; - var intersection = Extent.intersectWith(testExtent, parentExtent, extentScratch); - if (!Extent.isEmpty(intersection)) { - // Parent tile is inside this extent, so at least one child is, too. - if (isTileInExtent(tilingScheme, testExtent, x * 2, y * 2, level + 1)) { + var intersection = Rectangle.intersectWith(testRectangle, parentRectangle, rectangleScratch); + if (!Rectangle.isEmpty(intersection)) { + // Parent tile is inside this rectangle, so at least one child is, too. + if (isTileInRectangle(tilingScheme, testRectangle, x * 2, y * 2, level + 1)) { childMask |= 4; // northwest } - if (isTileInExtent(tilingScheme, testExtent, x * 2 + 1, y * 2, level + 1)) { + if (isTileInRectangle(tilingScheme, testRectangle, x * 2 + 1, y * 2, level + 1)) { childMask |= 8; // northeast } - if (isTileInExtent(tilingScheme, testExtent, x * 2, y * 2 + 1, level + 1)) { + if (isTileInRectangle(tilingScheme, testRectangle, x * 2, y * 2 + 1, level + 1)) { childMask |= 1; // southwest } - if (isTileInExtent(tilingScheme, testExtent, x * 2 + 1, y * 2 + 1, level + 1)) { + if (isTileInRectangle(tilingScheme, testRectangle, x * 2 + 1, y * 2 + 1, level + 1)) { childMask |= 2; // southeast } } @@ -320,9 +320,9 @@ define([ return childMask; } - function isTileInExtent(tilingScheme, extent, x, y, level) { - var tileExtent = tilingScheme.tileXYToExtent(x, y, level); - return !Extent.isEmpty(Extent.intersectWith(tileExtent, extent, extentScratch)); + function isTileInRectangle(tilingScheme, rectangle, x, y, level) { + var tileRectangle = tilingScheme.tileXYToRectangle(x, y, level); + return !Rectangle.isEmpty(Rectangle.intersectWith(tileRectangle, rectangle, rectangleScratch)); } return VRTheWorldTerrainProvider; diff --git a/Source/Scene/WebMapServiceImageryProvider.js b/Source/Scene/WebMapServiceImageryProvider.js index 1e7cf864b52d..8902667f84de 100644 --- a/Source/Scene/WebMapServiceImageryProvider.js +++ b/Source/Scene/WebMapServiceImageryProvider.js @@ -7,7 +7,7 @@ define([ '../Core/freezeObject', '../Core/DeveloperError', '../Core/Event', - '../Core/Extent', + '../Core/Rectangle', './Credit', './ImageryProvider', './GeographicTilingScheme' @@ -19,7 +19,7 @@ define([ freezeObject, DeveloperError, Event, - Extent, + Rectangle, Credit, ImageryProvider, GeographicTilingScheme) { @@ -34,7 +34,7 @@ define([ * @param {String} description.url The URL of the WMS service. * @param {String} description.layers The layers to include, separated by commas. * @param {Object} [description.parameters=WebMapServiceImageryProvider.DefaultParameters] Additional parameters to pass to the WMS server in the GetMap URL. - * @param {Extent} [description.extent=Extent.MAX_VALUE] The extent of the layer. + * @param {Rectangle} [description.rectangle=Rectangle.MAX_VALUE] The rectangle of the layer. * @param {Number} [description.maximumLevel] The maximum level-of-detail supported by the imagery provider. * If not specified, there is no limit. * @param {Credit|String} [description.credit] A credit for the data source, which is displayed on the canvas. @@ -92,9 +92,9 @@ define([ this._tileHeight = 256; this._maximumLevel = description.maximumLevel; // undefined means no limit - var extent = defaultValue(description.extent, Extent.MAX_VALUE); + var rectangle = defaultValue(description.rectangle, Rectangle.MAX_VALUE); this._tilingScheme = new GeographicTilingScheme({ - extent : extent + rectangle : rectangle }); var credit = description.credit; @@ -135,8 +135,8 @@ define([ } if (!defined(parameters.bbox)) { - var nativeExtent = imageryProvider._tilingScheme.tileXYToNativeExtent(x, y, level); - var bbox = nativeExtent.west + ',' + nativeExtent.south + ',' + nativeExtent.east + ',' + nativeExtent.north; + var nativeRectangle = imageryProvider._tilingScheme.tileXYToNativeRectangle(x, y, level); + var bbox = nativeRectangle.west + ',' + nativeRectangle.south + ',' + nativeRectangle.east + ',' + nativeRectangle.north; url += 'bbox=' + bbox + '&'; } @@ -282,20 +282,20 @@ define([ }, /** - * Gets the extent, in radians, of the imagery provided by this instance. This function should + * Gets the rectangle, in radians, of the imagery provided by this instance. This function should * not be called before {@link WebMapServiceImageryProvider#ready} returns true. * @memberof WebMapServiceImageryProvider.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : function() { //>>includeStart('debug', pragmas.debug); if (!this._ready) { - throw new DeveloperError('extent must not be called before the imagery provider is ready.'); + throw new DeveloperError('rectangle must not be called before the imagery provider is ready.'); } //>>includeEnd('debug'); - return this._tilingScheme.extent; + return this._tilingScheme.rectangle; } }, diff --git a/Source/Scene/WebMercatorTilingScheme.js b/Source/Scene/WebMercatorTilingScheme.js index c055956b66e7..83e899257901 100644 --- a/Source/Scene/WebMercatorTilingScheme.js +++ b/Source/Scene/WebMercatorTilingScheme.js @@ -4,7 +4,7 @@ define([ '../Core/defined', '../Core/defineProperties', '../Core/Ellipsoid', - '../Core/Extent', + '../Core/Rectangle', '../Core/Cartesian2', '../Core/WebMercatorProjection', './TilingScheme' @@ -13,7 +13,7 @@ define([ defined, defineProperties, Ellipsoid, - Extent, + Rectangle, Cartesian2, WebMercatorProjection, TilingScheme) { @@ -32,12 +32,12 @@ define([ * the tile tree. * @param {Number} [description.numberOfLevelZeroTilesY=1] The number of tiles in the Y direction at level zero of * the tile tree. - * @param {Cartesian2} [description.extentSouthwestInMeters] The southwest corner of the extent covered by the - * tiling scheme, in meters. If this parameter or extentNortheastInMeters is not specified, the entire + * @param {Cartesian2} [description.rectangleSouthwestInMeters] The southwest corner of the rectangle covered by the + * tiling scheme, in meters. If this parameter or rectangleNortheastInMeters is not specified, the entire * globe is covered in the longitude direction and an equal distance is covered in the latitude * direction, resulting in a square projection. - * @param {Cartesian2} [description.extentNortheastInMeters] The northeast corner of the extent covered by the - * tiling scheme, in meters. If this parameter or extentSouthwestInMeters is not specified, the entire + * @param {Cartesian2} [description.rectangleNortheastInMeters] The northeast corner of the rectangle covered by the + * tiling scheme, in meters. If this parameter or rectangleSouthwestInMeters is not specified, the entire * globe is covered in the longitude direction and an equal distance is covered in the latitude * direction, resulting in a square projection. */ @@ -50,19 +50,19 @@ define([ this._projection = new WebMercatorProjection(this._ellipsoid); - if (defined(description.extentSouthwestInMeters) && - defined(description.extentNortheastInMeters)) { - this._extentSouthwestInMeters = description.extentSouthwestInMeters; - this._extentNortheastInMeters = description.extentNortheastInMeters; + if (defined(description.rectangleSouthwestInMeters) && + defined(description.rectangleNortheastInMeters)) { + this._rectangleSouthwestInMeters = description.rectangleSouthwestInMeters; + this._rectangleNortheastInMeters = description.rectangleNortheastInMeters; } else { var semimajorAxisTimesPi = this._ellipsoid.maximumRadius * Math.PI; - this._extentSouthwestInMeters = new Cartesian2(-semimajorAxisTimesPi, -semimajorAxisTimesPi); - this._extentNortheastInMeters = new Cartesian2(semimajorAxisTimesPi, semimajorAxisTimesPi); + this._rectangleSouthwestInMeters = new Cartesian2(-semimajorAxisTimesPi, -semimajorAxisTimesPi); + this._rectangleNortheastInMeters = new Cartesian2(semimajorAxisTimesPi, semimajorAxisTimesPi); } - var southwest = this._projection.unproject(this._extentSouthwestInMeters); - var northeast = this._projection.unproject(this._extentNortheastInMeters); - this._extent = new Extent(southwest.longitude, southwest.latitude, + var southwest = this._projection.unproject(this._rectangleSouthwestInMeters); + var northeast = this._projection.unproject(this._rectangleNortheastInMeters); + this._rectangle = new Rectangle(southwest.longitude, southwest.latitude, northeast.longitude, northeast.latitude); }; @@ -79,13 +79,13 @@ define([ }, /** - * Gets the extent, in radians, covered by this tiling scheme. + * Gets the rectangle, in radians, covered by this tiling scheme. * @memberof WebMercatorTilingScheme.prototype - * @type {Extent} + * @type {Rectangle} */ - extent : { + rectangle : { get : function() { - return this._extent; + return this._rectangle; } }, @@ -138,24 +138,24 @@ define([ }; /** - * Transforms an extent specified in geodetic radians to the native coordinate system + * Transforms an rectangle specified in geodetic radians to the native coordinate system * of this tiling scheme. * * @memberof WebMercatorTilingScheme * - * @param {Extent} extent The extent to transform. - * @param {Extent} [result] The instance to which to copy the result, or undefined if a new instance + * @param {Rectangle} rectangle The rectangle to transform. + * @param {Rectangle} [result] The instance to which to copy the result, or undefined if a new instance * should be created. - * @returns {Extent} The specified 'result', or a new object containing the native extent if 'result' + * @returns {Rectangle} The specified 'result', or a new object containing the native rectangle if 'result' * is undefined. */ - WebMercatorTilingScheme.prototype.extentToNativeExtent = function(extent, result) { + WebMercatorTilingScheme.prototype.rectangleToNativeRectangle = function(rectangle, result) { var projection = this._projection; - var southwest = projection.project(Extent.getSouthwest(extent)); - var northeast = projection.project(Extent.getNortheast(extent)); + var southwest = projection.project(Rectangle.getSouthwest(rectangle)); + var northeast = projection.project(Rectangle.getNortheast(rectangle)); if (!defined(result)) { - return new Extent(southwest.x, southwest.y, northeast.x, northeast.y); + return new Rectangle(southwest.x, southwest.y, northeast.x, northeast.y); } result.west = southwest.x; @@ -166,7 +166,7 @@ define([ }; /** - * Converts tile x, y coordinates and level to an extent expressed in the native coordinates + * Converts tile x, y coordinates and level to an rectangle expressed in the native coordinates * of the tiling scheme. * * @memberof WebMercatorTilingScheme @@ -177,23 +177,23 @@ define([ * @param {Object} [result] The instance to which to copy the result, or undefined if a new instance * should be created. * - * @returns {Extent} The specified 'result', or a new object containing the extent + * @returns {Rectangle} The specified 'result', or a new object containing the rectangle * if 'result' is undefined. */ - WebMercatorTilingScheme.prototype.tileXYToNativeExtent = function(x, y, level, result) { + WebMercatorTilingScheme.prototype.tileXYToNativeRectangle = function(x, y, level, result) { var xTiles = this.getNumberOfXTilesAtLevel(level); var yTiles = this.getNumberOfYTilesAtLevel(level); - var xTileWidth = (this._extentNortheastInMeters.x - this._extentSouthwestInMeters.x) / xTiles; - var west = this._extentSouthwestInMeters.x + x * xTileWidth; - var east = this._extentSouthwestInMeters.x + (x + 1) * xTileWidth; + var xTileWidth = (this._rectangleNortheastInMeters.x - this._rectangleSouthwestInMeters.x) / xTiles; + var west = this._rectangleSouthwestInMeters.x + x * xTileWidth; + var east = this._rectangleSouthwestInMeters.x + (x + 1) * xTileWidth; - var yTileHeight = (this._extentNortheastInMeters.y - this._extentSouthwestInMeters.y) / yTiles; - var north = this._extentNortheastInMeters.y - y * yTileHeight; - var south = this._extentNortheastInMeters.y - (y + 1) * yTileHeight; + var yTileHeight = (this._rectangleNortheastInMeters.y - this._rectangleSouthwestInMeters.y) / yTiles; + var north = this._rectangleNortheastInMeters.y - y * yTileHeight; + var south = this._rectangleNortheastInMeters.y - (y + 1) * yTileHeight; if (!defined(result)) { - return new Extent(west, south, east, north); + return new Rectangle(west, south, east, north); } result.west = west; @@ -204,7 +204,7 @@ define([ }; /** - * Converts tile x, y coordinates and level to a cartographic extent in radians. + * Converts tile x, y coordinates and level to a cartographic rectangle in radians. * * @memberof GeographicTilingScheme * @@ -214,21 +214,21 @@ define([ * @param {Object} [result] The instance to which to copy the result, or undefined if a new instance * should be created. * - * @returns {Extent} The specified 'result', or a new object containing the extent + * @returns {Rectangle} The specified 'result', or a new object containing the rectangle * if 'result' is undefined. */ - WebMercatorTilingScheme.prototype.tileXYToExtent = function(x, y, level, result) { - var nativeExtent = this.tileXYToNativeExtent(x, y, level, result); + WebMercatorTilingScheme.prototype.tileXYToRectangle = function(x, y, level, result) { + var nativeRectangle = this.tileXYToNativeRectangle(x, y, level, result); var projection = this._projection; - var southwest = projection.unproject(new Cartesian2(nativeExtent.west, nativeExtent.south)); - var northeast = projection.unproject(new Cartesian2(nativeExtent.east, nativeExtent.north)); + var southwest = projection.unproject(new Cartesian2(nativeRectangle.west, nativeRectangle.south)); + var northeast = projection.unproject(new Cartesian2(nativeRectangle.east, nativeRectangle.north)); - nativeExtent.west = southwest.longitude; - nativeExtent.south = southwest.latitude; - nativeExtent.east = northeast.longitude; - nativeExtent.north = northeast.latitude; - return nativeExtent; + nativeRectangle.west = southwest.longitude; + nativeRectangle.south = southwest.latitude; + nativeRectangle.east = northeast.longitude; + nativeRectangle.north = northeast.latitude; + return nativeRectangle; }; /** @@ -246,11 +246,11 @@ define([ * if 'result' is undefined. */ WebMercatorTilingScheme.prototype.positionToTileXY = function(position, level, result) { - var extent = this._extent; - if (position.latitude > extent.north || - position.latitude < extent.south || - position.longitude < extent.west || - position.longitude > extent.east) { + var rectangle = this._rectangle; + if (position.latitude > rectangle.north || + position.latitude < rectangle.south || + position.longitude < rectangle.west || + position.longitude > rectangle.east) { // outside the bounds of the tiling scheme return undefined; } @@ -258,16 +258,16 @@ define([ var xTiles = this.getNumberOfXTilesAtLevel(level); var yTiles = this.getNumberOfYTilesAtLevel(level); - var overallWidth = this._extentNortheastInMeters.x - this._extentSouthwestInMeters.x; + var overallWidth = this._rectangleNortheastInMeters.x - this._rectangleSouthwestInMeters.x; var xTileWidth = overallWidth / xTiles; - var overallHeight = this._extentNortheastInMeters.y - this._extentSouthwestInMeters.y; + var overallHeight = this._rectangleNortheastInMeters.y - this._rectangleSouthwestInMeters.y; var yTileHeight = overallHeight / yTiles; var projection = this._projection; var webMercatorPosition = projection.project(position); - var distanceFromWest = webMercatorPosition.x - this._extentSouthwestInMeters.x; - var distanceFromNorth = this._extentNortheastInMeters.y - webMercatorPosition.y; + var distanceFromWest = webMercatorPosition.x - this._rectangleSouthwestInMeters.x; + var distanceFromNorth = this._rectangleNortheastInMeters.y - webMercatorPosition.y; var xTileCoordinate = distanceFromWest / xTileWidth | 0; if (xTileCoordinate >= xTiles) { diff --git a/Source/Scene/sampleTerrain.js b/Source/Scene/sampleTerrain.js index eef01458cd18..cbf975d5c74b 100644 --- a/Source/Scene/sampleTerrain.js +++ b/Source/Scene/sampleTerrain.js @@ -102,11 +102,11 @@ define([ function createInterpolateFunction(tileRequest) { var tilePositions = tileRequest.positions; - var extent = tileRequest.tilingScheme.tileXYToExtent(tileRequest.x, tileRequest.y, tileRequest.level); + var rectangle = tileRequest.tilingScheme.tileXYToRectangle(tileRequest.x, tileRequest.y, tileRequest.level); return function(terrainData) { for (var i = 0; i < tilePositions.length; ++i) { var position = tilePositions[i]; - position.height = terrainData.interpolateHeight(extent, position.longitude, position.latitude); + position.height = terrainData.interpolateHeight(rectangle, position.longitude, position.latitude); } }; } diff --git a/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.glsl b/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.glsl index 4b318d81a08b..fb7d70eb324e 100644 --- a/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.glsl +++ b/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.glsl @@ -5,7 +5,7 @@ * to cut it off sooner because it grows exponentially with increasing latitude. * The logic behind this particular cutoff value, which is the one used by * Google Maps, Bing Maps, and Esri, is that it makes the projection - * square. That is, the extent is equal in the X and Y directions. + * square. That is, the rectangle is equal in the X and Y directions. * * The constant value is computed as follows: * czm_pi * 0.5 - (2.0 * atan(exp(-czm_pi))) diff --git a/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.glsl b/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.glsl index 150adeb88bf1..d52013f95768 100644 --- a/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.glsl +++ b/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.glsl @@ -1,16 +1,16 @@ /** - * Computes the fraction of a Web Wercator extent at which a given geodetic latitude is located. + * Computes the fraction of a Web Wercator rectangle at which a given geodetic latitude is located. * * @name czm_latitudeToWebMercatorFraction * @glslFunction * * @param {float} The geodetic latitude, in radians. - * @param {float} The low portion of the Web Mercator coordinate of the southern boundary of the extent. - * @param {float} The high portion of the Web Mercator coordinate of the southern boundary of the extent. - * @param {float} The total height of the extent in Web Mercator coordinates. + * @param {float} The low portion of the Web Mercator coordinate of the southern boundary of the rectangle. + * @param {float} The high portion of the Web Mercator coordinate of the southern boundary of the rectangle. + * @param {float} The total height of the rectangle in Web Mercator coordinates. * - * @returns {float} The fraction of the extent at which the latitude occurs. If the latitude is the southern - * boundary of the extent, the return value will be zero. If it is the northern boundary, the return + * @returns {float} The fraction of the rectangle at which the latitude occurs. If the latitude is the southern + * boundary of the rectangle, the return value will be zero. If it is the northern boundary, the return * value will be 1.0. Latitudes in between are mapped according to the Web Mercator projection. */ float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorYLow, float southMercatorYHigh, float oneOverMercatorHeight) diff --git a/Source/Shaders/CentralBodyFS.glsl b/Source/Shaders/CentralBodyFS.glsl index fbe78a7a2596..e313a8eed3b2 100644 --- a/Source/Shaders/CentralBodyFS.glsl +++ b/Source/Shaders/CentralBodyFS.glsl @@ -28,7 +28,7 @@ uniform float u_dayTextureSaturation[TEXTURE_UNITS]; uniform float u_dayTextureOneOverGamma[TEXTURE_UNITS]; #endif -uniform vec4 u_dayTextureTexCoordsExtent[TEXTURE_UNITS]; +uniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS]; #endif #ifdef SHOW_REFLECTIVE_OCEAN @@ -53,7 +53,7 @@ vec3 sampleAndBlend( vec3 previousColor, sampler2D texture, vec2 tileTextureCoordinates, - vec4 textureCoordinateExtent, + vec4 textureCoordinateRectangle, vec4 textureCoordinateTranslationAndScale, float textureAlpha, float textureBrightness, @@ -63,16 +63,16 @@ vec3 sampleAndBlend( float textureOneOverGamma) { // This crazy step stuff sets the alpha to 0.0 if this following condition is true: - // tileTextureCoordinates.s < textureCoordinateExtent.s || - // tileTextureCoordinates.s > textureCoordinateExtent.p || - // tileTextureCoordinates.t < textureCoordinateExtent.t || - // tileTextureCoordinates.t > textureCoordinateExtent.q - // In other words, the alpha is zero if the fragment is outside the extent + // tileTextureCoordinates.s < textureCoordinateRectangle.s || + // tileTextureCoordinates.s > textureCoordinateRectangle.p || + // tileTextureCoordinates.t < textureCoordinateRectangle.t || + // tileTextureCoordinates.t > textureCoordinateRectangle.q + // In other words, the alpha is zero if the fragment is outside the rectangle // covered by this texture. Would an actual 'if' yield better performance? - vec2 alphaMultiplier = step(textureCoordinateExtent.st, tileTextureCoordinates); + vec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates); textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y; - alphaMultiplier = step(vec2(0.0), textureCoordinateExtent.pq - tileTextureCoordinates); + alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates); textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y; vec2 translation = textureCoordinateTranslationAndScale.xy; diff --git a/Source/Shaders/CentralBodyVS.glsl b/Source/Shaders/CentralBodyVS.glsl index abf503ec9b98..538fb01548f4 100644 --- a/Source/Shaders/CentralBodyVS.glsl +++ b/Source/Shaders/CentralBodyVS.glsl @@ -3,7 +3,7 @@ attribute vec2 textureCoordinates; uniform vec3 u_center3D; uniform mat4 u_modifiedModelView; -uniform vec4 u_tileExtent; +uniform vec4 u_tileRectangle; // Uniforms for 2D Mercator projection uniform vec2 u_southAndNorthLatitude; @@ -55,7 +55,7 @@ float get2DGeographicYPositionFraction() vec4 getPositionPlanarEarth(vec3 position3DWC, float height2D) { float yPositionFraction = get2DYPositionFraction(); - vec4 rtcPosition2D = vec4(height2D, mix(u_tileExtent.st, u_tileExtent.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0); + vec4 rtcPosition2D = vec4(height2D, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0); return czm_projection * (u_modifiedModelView * rtcPosition2D); } @@ -74,7 +74,7 @@ vec4 getPositionMorphingMode(vec3 position3DWC) // We do not do RTC while morphing, so there is potential for jitter. // This is unlikely to be noticeable, though. float yPositionFraction = get2DYPositionFraction(); - vec4 position2DWC = vec4(0.0, mix(u_tileExtent.st, u_tileExtent.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0); + vec4 position2DWC = vec4(0.0, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0); vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime); return czm_modelViewProjection * morphPosition; } diff --git a/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js b/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js index 21fcc7ca36ce..1e96ffdaed29 100644 --- a/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js +++ b/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js @@ -4,7 +4,7 @@ define([ '../../Core/defined', '../../Core/defineProperties', '../../Core/DeveloperError', - '../../Core/Extent', + '../../Core/Rectangle', '../../Scene/DebugModelMatrixPrimitive', '../../Scene/PerformanceDisplay', '../../Scene/TileCoordinatesImageryProvider', @@ -15,7 +15,7 @@ define([ defined, defineProperties, DeveloperError, - Extent, + Rectangle, DebugModelMatrixPrimitive, PerformanceDisplay, TileCoordinatesImageryProvider, @@ -431,7 +431,7 @@ define([ for (var tileIndex = 0; !selectedTile && tileIndex < tilesRenderedByTextureCount.length; ++tileIndex) { var tile = tilesRenderedByTextureCount[tileIndex]; - if (Extent.contains(tile.extent, cartographic)) { + if (Rectangle.contains(tile.rectangle, cartographic)) { selectedTile = tile; } } @@ -783,8 +783,8 @@ define([ var oldTile = this._tile; if (newTile !== oldTile) { this.tileText = 'L: ' + newTile.level + ' X: ' + newTile.x + ' Y: ' + newTile.y; - this.tileText += '<br>SW corner: ' + newTile.extent.west + ', ' + newTile.extent.south; - this.tileText += '<br>NE corner: ' + newTile.extent.east + ', ' + newTile.extent.north; + this.tileText += '<br>SW corner: ' + newTile.rectangle.west + ', ' + newTile.rectangle.south; + this.tileText += '<br>NE corner: ' + newTile.rectangle.east + ', ' + newTile.rectangle.north; this.tileText += '<br>Min: ' + newTile.minimumHeight + ' Max: ' + newTile.maximumHeight; } this._tile = newTile; diff --git a/Source/Widgets/Geocoder/GeocoderViewModel.js b/Source/Widgets/Geocoder/GeocoderViewModel.js index e2a4edd13f07..bd0ea1693c18 100644 --- a/Source/Widgets/Geocoder/GeocoderViewModel.js +++ b/Source/Widgets/Geocoder/GeocoderViewModel.js @@ -6,7 +6,7 @@ define([ '../../Core/defineProperties', '../../Core/DeveloperError', '../../Core/Ellipsoid', - '../../Core/Extent', + '../../Core/Rectangle', '../../Core/jsonp', '../../Core/Matrix4', '../../Scene/CameraColumbusViewMode', @@ -22,7 +22,7 @@ define([ defineProperties, DeveloperError, Ellipsoid, - Extent, + Rectangle, jsonp, Matrix4, CameraColumbusViewMode, @@ -252,10 +252,10 @@ define([ var west = bbox[1]; var north = bbox[2]; var east = bbox[3]; - var extent = Extent.fromDegrees(west, south, east, north); + var rectangle = Rectangle.fromDegrees(west, south, east, north); var camera = viewModel._scene.camera; - var position = camera.getExtentCameraCoordinates(extent); + var position = camera.getRectangleCameraCoordinates(rectangle); if (!defined(position)) { // This can happen during a scene mode transition. return; diff --git a/Source/Widgets/HomeButton/HomeButtonViewModel.js b/Source/Widgets/HomeButton/HomeButtonViewModel.js index 9d3a5408a969..efa651f4436c 100644 --- a/Source/Widgets/HomeButton/HomeButtonViewModel.js +++ b/Source/Widgets/HomeButton/HomeButtonViewModel.js @@ -6,7 +6,7 @@ define([ '../../Core/defineProperties', '../../Core/DeveloperError', '../../Core/Ellipsoid', - '../../Core/Extent', + '../../Core/Rectangle', '../../Core/Matrix4', '../../Scene/Camera', '../../Scene/CameraColumbusViewMode', @@ -21,7 +21,7 @@ define([ defineProperties, DeveloperError, Ellipsoid, - Extent, + Rectangle, Matrix4, Camera, CameraColumbusViewMode, @@ -47,14 +47,14 @@ define([ if (mode === SceneMode.SCENE2D) { description = { - destination : Extent.MAX_VALUE, + destination : Rectangle.MAX_VALUE, duration : duration, endReferenceFrame : new Matrix4(0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1) }; - flight = CameraFlightPath.createAnimationExtent(scene, description); + flight = CameraFlightPath.createAnimationRectangle(scene, description); scene.animations.add(flight); } else if (mode === SceneMode.SCENE3D) { var defaultCamera = new Camera(context); diff --git a/Source/Workers/createExtentGeometry.js b/Source/Workers/createExtentGeometry.js deleted file mode 100644 index f17d3ed28fe6..000000000000 --- a/Source/Workers/createExtentGeometry.js +++ /dev/null @@ -1,18 +0,0 @@ -/*global define*/ -define(['../Core/ExtentGeometry', - '../Core/Ellipsoid', - '../Core/Extent' - ], function( - ExtentGeometry, - Ellipsoid, - Extent) { - "use strict"; - - function createExtentGeometry(extentGeometry) { - extentGeometry._ellipsoid = Ellipsoid.clone(extentGeometry._ellipsoid); - extentGeometry._extent = Extent.clone(extentGeometry._extent); - return ExtentGeometry.createGeometry(extentGeometry); - } - - return createExtentGeometry; -}); diff --git a/Source/Workers/createExtentOutlineGeometry.js b/Source/Workers/createExtentOutlineGeometry.js deleted file mode 100644 index 6ad0784a4ca8..000000000000 --- a/Source/Workers/createExtentOutlineGeometry.js +++ /dev/null @@ -1,18 +0,0 @@ -/*global define*/ -define(['../Core/ExtentOutlineGeometry', - '../Core/Ellipsoid', - '../Core/Extent' - ], function( - ExtentOutlineGeometry, - Ellipsoid, - Extent) { - "use strict"; - - function createExtentOutlineGeometry(extentGeometry) { - extentGeometry._ellipsoid = Ellipsoid.clone(extentGeometry._ellipsoid); - extentGeometry._extent = Extent.clone(extentGeometry._extent); - return ExtentOutlineGeometry.createGeometry(extentGeometry); - } - - return createExtentOutlineGeometry; -}); diff --git a/Source/Workers/createRectangleGeometry.js b/Source/Workers/createRectangleGeometry.js new file mode 100644 index 000000000000..30a7ca6c5b3f --- /dev/null +++ b/Source/Workers/createRectangleGeometry.js @@ -0,0 +1,18 @@ +/*global define*/ +define(['../Core/RectangleGeometry', + '../Core/Ellipsoid', + '../Core/Rectangle' + ], function( + RectangleGeometry, + Ellipsoid, + Rectangle) { + "use strict"; + + function createRectangleGeometry(rectangleGeometry) { + rectangleGeometry._ellipsoid = Ellipsoid.clone(rectangleGeometry._ellipsoid); + rectangleGeometry._rectangle = Rectangle.clone(rectangleGeometry._rectangle); + return RectangleGeometry.createGeometry(rectangleGeometry); + } + + return createRectangleGeometry; +}); diff --git a/Source/Workers/createRectangleOutlineGeometry.js b/Source/Workers/createRectangleOutlineGeometry.js new file mode 100644 index 000000000000..7471d16235c9 --- /dev/null +++ b/Source/Workers/createRectangleOutlineGeometry.js @@ -0,0 +1,18 @@ +/*global define*/ +define(['../Core/RectangleOutlineGeometry', + '../Core/Ellipsoid', + '../Core/Rectangle' + ], function( + RectangleOutlineGeometry, + Ellipsoid, + Rectangle) { + "use strict"; + + function createRectangleOutlineGeometry(rectangleGeometry) { + rectangleGeometry._ellipsoid = Ellipsoid.clone(rectangleGeometry._ellipsoid); + rectangleGeometry._rectangle = Rectangle.clone(rectangleGeometry._rectangle); + return RectangleOutlineGeometry.createGeometry(rectangleGeometry); + } + + return createRectangleOutlineGeometry; +}); diff --git a/Source/Workers/createVerticesFromHeightmap.js b/Source/Workers/createVerticesFromHeightmap.js index a520d84209ce..a278133b4f2a 100644 --- a/Source/Workers/createVerticesFromHeightmap.js +++ b/Source/Workers/createVerticesFromHeightmap.js @@ -3,14 +3,14 @@ define([ '../Core/BoundingSphere', '../Core/Ellipsoid', '../Core/EllipsoidalOccluder', - '../Core/Extent', + '../Core/Rectangle', '../Core/HeightmapTessellator', './createTaskProcessorWorker' ], function( BoundingSphere, Ellipsoid, EllipsoidalOccluder, - Extent, + Rectangle, HeightmapTessellator, createTaskProcessorWorker) { "use strict"; @@ -30,7 +30,7 @@ define([ transferableObjects.push(vertices.buffer); parameters.ellipsoid = Ellipsoid.clone(parameters.ellipsoid); - parameters.extent = Extent.clone(parameters.extent); + parameters.rectangle = Rectangle.clone(parameters.rectangle); parameters.vertices = vertices; diff --git a/Source/Workers/createVerticesFromQuantizedTerrainMesh.js b/Source/Workers/createVerticesFromQuantizedTerrainMesh.js index 102aed99532a..393f053e46eb 100644 --- a/Source/Workers/createVerticesFromQuantizedTerrainMesh.js +++ b/Source/Workers/createVerticesFromQuantizedTerrainMesh.js @@ -35,11 +35,11 @@ define([ var maximumHeight = parameters.maximumHeight; var center = parameters.relativeToCenter; - var extent = parameters.extent; - var west = extent.west; - var south = extent.south; - var east = extent.east; - var north = extent.north; + var rectangle = parameters.rectangle; + var west = rectangle.west; + var south = rectangle.south; + var east = rectangle.east; + var north = rectangle.north; var ellipsoid = Ellipsoid.clone(parameters.ellipsoid); @@ -75,13 +75,13 @@ define([ // Add skirts. var vertexBufferIndex = quantizedVertexCount * vertexStride; var indexBufferIndex = parameters.indices.length; - indexBufferIndex = addSkirt(vertexBuffer, vertexBufferIndex, indexBuffer, indexBufferIndex, parameters.westIndices, center, ellipsoid, extent, parameters.westSkirtHeight, true); + indexBufferIndex = addSkirt(vertexBuffer, vertexBufferIndex, indexBuffer, indexBufferIndex, parameters.westIndices, center, ellipsoid, rectangle, parameters.westSkirtHeight, true); vertexBufferIndex += parameters.westIndices.length * vertexStride; - indexBufferIndex = addSkirt(vertexBuffer, vertexBufferIndex, indexBuffer, indexBufferIndex, parameters.southIndices, center, ellipsoid, extent, parameters.southSkirtHeight, false); + indexBufferIndex = addSkirt(vertexBuffer, vertexBufferIndex, indexBuffer, indexBufferIndex, parameters.southIndices, center, ellipsoid, rectangle, parameters.southSkirtHeight, false); vertexBufferIndex += parameters.southIndices.length * vertexStride; - indexBufferIndex = addSkirt(vertexBuffer, vertexBufferIndex, indexBuffer, indexBufferIndex, parameters.eastIndices, center, ellipsoid, extent, parameters.eastSkirtHeight, false); + indexBufferIndex = addSkirt(vertexBuffer, vertexBufferIndex, indexBuffer, indexBufferIndex, parameters.eastIndices, center, ellipsoid, rectangle, parameters.eastSkirtHeight, false); vertexBufferIndex += parameters.eastIndices.length * vertexStride; - indexBufferIndex = addSkirt(vertexBuffer, vertexBufferIndex, indexBuffer, indexBufferIndex, parameters.northIndices, center, ellipsoid, extent, parameters.northSkirtHeight, true); + indexBufferIndex = addSkirt(vertexBuffer, vertexBufferIndex, indexBuffer, indexBufferIndex, parameters.northIndices, center, ellipsoid, rectangle, parameters.northSkirtHeight, true); vertexBufferIndex += parameters.northIndices.length * vertexStride; transferableObjects.push(vertexBuffer.buffer, indexBuffer.buffer); @@ -92,7 +92,7 @@ define([ }; } - function addSkirt(vertexBuffer, vertexBufferIndex, indexBuffer, indexBufferIndex, edgeVertices, center, ellipsoid, extent, skirtLength, isWestOrNorthEdge) { + function addSkirt(vertexBuffer, vertexBufferIndex, indexBuffer, indexBufferIndex, edgeVertices, center, ellipsoid, rectangle, skirtLength, isWestOrNorthEdge) { var start, end, increment; if (isWestOrNorthEdge) { start = edgeVertices.length - 1; @@ -115,8 +115,8 @@ define([ var v = vertexBuffer[offset + vIndex]; var h = vertexBuffer[offset + hIndex]; - cartographicScratch.longitude = CesiumMath.lerp(extent.west, extent.east, u); - cartographicScratch.latitude = CesiumMath.lerp(extent.south, extent.north, v); + cartographicScratch.longitude = CesiumMath.lerp(rectangle.west, rectangle.east, u); + cartographicScratch.latitude = CesiumMath.lerp(rectangle.south, rectangle.north, v); cartographicScratch.height = h - skirtLength; var position = ellipsoid.cartographicToCartesian(cartographicScratch, cartesian3Scratch); diff --git a/Source/Workers/upsampleQuantizedTerrainMesh.js b/Source/Workers/upsampleQuantizedTerrainMesh.js index 05757b80e821..c601559e2d27 100644 --- a/Source/Workers/upsampleQuantizedTerrainMesh.js +++ b/Source/Workers/upsampleQuantizedTerrainMesh.js @@ -162,7 +162,7 @@ define([ cartesianVertices.length = 0; var ellipsoid = Ellipsoid.clone(parameters.ellipsoid); - var extent = parameters.childExtent; + var rectangle = parameters.childRectangle; for (i = 0; i < uBuffer.length; ++i) { u = uBuffer[i]; @@ -201,8 +201,8 @@ define([ heightBuffer[i] = height; - cartographicScratch.longitude = CesiumMath.lerp(extent.west, extent.east, u); - cartographicScratch.latitude = CesiumMath.lerp(extent.south, extent.north, v); + cartographicScratch.longitude = CesiumMath.lerp(rectangle.west, rectangle.east, u); + cartographicScratch.latitude = CesiumMath.lerp(rectangle.south, rectangle.north, v); cartographicScratch.height = height; ellipsoid.cartographicToCartesian(cartographicScratch, cartesian3Scratch); diff --git a/Specs/Core/BoundingRectangleSpec.js b/Specs/Core/BoundingRectangleSpec.js index 1c7b7a9a6590..1b98f35a776b 100644 --- a/Specs/Core/BoundingRectangleSpec.js +++ b/Specs/Core/BoundingRectangleSpec.js @@ -4,14 +4,14 @@ defineSuite([ 'Core/Cartesian2', 'Core/Ellipsoid', 'Core/GeographicProjection', - 'Core/Extent', + 'Core/Rectangle', 'Core/Intersect' ], function( BoundingRectangle, Cartesian2, Ellipsoid, GeographicProjection, - Extent, + Rectangle, Intersect) { "use strict"; /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ @@ -102,28 +102,28 @@ defineSuite([ expect(rectangle.height).toEqual(0.0); }); - it('fromExtent creates an empty rectangle with no extent', function() { - var rectangle = BoundingRectangle.fromExtent(); + it('fromRectangle creates an empty rectangle with no rectangle', function() { + var rectangle = BoundingRectangle.fromRectangle(); expect(rectangle.x).toEqual(0.0); expect(rectangle.y).toEqual(0.0); expect(rectangle.width).toEqual(0.0); expect(rectangle.height).toEqual(0.0); }); - it('create a bounding rectangle from an extent', function() { - var extent = Extent.MAX_VALUE; + it('create a bounding rectangle from an rectangle', function() { + var rectangle = Rectangle.MAX_VALUE; var projection = new GeographicProjection(Ellipsoid.UNIT_SPHERE); - var expected = new BoundingRectangle(extent.west, extent.south, extent.east - extent.west, extent.north - extent.south); - expect(BoundingRectangle.fromExtent(extent, projection)).toEqual(expected); + var expected = new BoundingRectangle(rectangle.west, rectangle.south, rectangle.east - rectangle.west, rectangle.north - rectangle.south); + expect(BoundingRectangle.fromRectangle(rectangle, projection)).toEqual(expected); }); - it('fromExtent works with a result parameter', function() { - var extent = Extent.MAX_VALUE; - var expected = new BoundingRectangle(extent.west, extent.south, extent.east - extent.west, extent.north - extent.south); + it('fromRectangle works with a result parameter', function() { + var rectangle = Rectangle.MAX_VALUE; + var expected = new BoundingRectangle(rectangle.west, rectangle.south, rectangle.east - rectangle.west, rectangle.north - rectangle.south); var projection = new GeographicProjection(Ellipsoid.UNIT_SPHERE); var result = new BoundingRectangle(); - var returnedResult = BoundingRectangle.fromExtent(extent, projection, result); + var returnedResult = BoundingRectangle.fromRectangle(rectangle, projection, result); expect(result).toBe(returnedResult); expect(returnedResult).toEqual(expected); }); diff --git a/Specs/Core/BoundingSphereSpec.js b/Specs/Core/BoundingSphereSpec.js index 19e47aeaf927..caae59a02a4c 100644 --- a/Specs/Core/BoundingSphereSpec.js +++ b/Specs/Core/BoundingSphereSpec.js @@ -6,7 +6,7 @@ defineSuite([ 'Core/Cartographic', 'Core/Ellipsoid', 'Core/GeographicProjection', - 'Core/Extent', + 'Core/Rectangle', 'Core/Intersect', 'Core/Interval', 'Core/Math', @@ -18,7 +18,7 @@ defineSuite([ Cartographic, Ellipsoid, GeographicProjection, - Extent, + Rectangle, Intersect, Interval, CesiumMath, @@ -265,39 +265,39 @@ defineSuite([ expect(result.radius).toEqual(positionsRadius); }); - it('fromExtent2D creates an empty sphere if no extent provided', function() { - var sphere = BoundingSphere.fromExtent2D(); + it('fromRectangle2D creates an empty sphere if no rectangle provided', function() { + var sphere = BoundingSphere.fromRectangle2D(); expect(sphere.center).toEqual(Cartesian3.ZERO); expect(sphere.radius).toEqual(0.0); }); - it('fromExtent2D', function() { - var extent = Extent.MAX_VALUE; + it('fromRectangle2D', function() { + var rectangle = Rectangle.MAX_VALUE; var projection = new GeographicProjection(Ellipsoid.UNIT_SPHERE); - var expected = new BoundingSphere(Cartesian3.ZERO, Math.sqrt(extent.east * extent.east + extent.north * extent.north)); - expect(BoundingSphere.fromExtent2D(extent, projection)).toEqual(expected); + var expected = new BoundingSphere(Cartesian3.ZERO, Math.sqrt(rectangle.east * rectangle.east + rectangle.north * rectangle.north)); + expect(BoundingSphere.fromRectangle2D(rectangle, projection)).toEqual(expected); }); - it('fromExtent3D creates an empty sphere if no extent provided', function() { - var sphere = BoundingSphere.fromExtent3D(); + it('fromRectangle3D creates an empty sphere if no rectangle provided', function() { + var sphere = BoundingSphere.fromRectangle3D(); expect(sphere.center).toEqual(Cartesian3.ZERO); expect(sphere.radius).toEqual(0.0); }); - it('fromExtent3D', function() { - var extent = Extent.MAX_VALUE; + it('fromRectangle3D', function() { + var rectangle = Rectangle.MAX_VALUE; var ellipsoid = Ellipsoid.WGS84; var expected = new BoundingSphere(Cartesian3.ZERO, ellipsoid.maximumRadius); - expect(BoundingSphere.fromExtent3D(extent, ellipsoid)).toEqual(expected); + expect(BoundingSphere.fromRectangle3D(rectangle, ellipsoid)).toEqual(expected); }); - it('fromExtent3D with height', function() { - var extent = new Extent(0.1, -0.3, 0.2, -0.4); + it('fromRectangle3D with height', function() { + var rectangle = new Rectangle(0.1, -0.3, 0.2, -0.4); var height = 100000.0; var ellipsoid = Ellipsoid.WGS84; - var points = Extent.subsample(extent, ellipsoid, height); + var points = Rectangle.subsample(rectangle, ellipsoid, height); var expected = BoundingSphere.fromPoints(points); - expect(BoundingSphere.fromExtent3D(extent, ellipsoid, height)).toEqual(expected); + expect(BoundingSphere.fromRectangle3D(rectangle, ellipsoid, height)).toEqual(expected); }); it('fromCornerPoints', function() { @@ -643,78 +643,78 @@ defineSuite([ expect(distanceFromCenter).toBeLessThanOrEqualTo(boundingSphere.radius); } - it('fromExtentWithHeights2D includes specified min and max heights', function() { - var extent = new Extent(0.1, 0.5, 0.2, 0.6); + it('fromRectangleWithHeights2D includes specified min and max heights', function() { + var rectangle = new Rectangle(0.1, 0.5, 0.2, 0.6); var projection = new GeographicProjection(); var minHeight = -327.0; var maxHeight = 2456.0; - var boundingSphere = BoundingSphere.fromExtentWithHeights2D(extent, projection, minHeight, maxHeight); + var boundingSphere = BoundingSphere.fromRectangleWithHeights2D(rectangle, projection, minHeight, maxHeight); // Test that the corners are inside the bounding sphere. - var point = Extent.getSouthwest(extent).clone(); + var point = Rectangle.getSouthwest(rectangle).clone(); point.height = minHeight; expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = Extent.getSouthwest(extent).clone(); + point = Rectangle.getSouthwest(rectangle).clone(); point.height = maxHeight; expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = Extent.getNortheast(extent).clone(); + point = Rectangle.getNortheast(rectangle).clone(); point.height = minHeight; expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = Extent.getNortheast(extent).clone(); + point = Rectangle.getNortheast(rectangle).clone(); point.height = maxHeight; expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = Extent.getSoutheast(extent).clone(); + point = Rectangle.getSoutheast(rectangle).clone(); point.height = minHeight; expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = Extent.getSoutheast(extent).clone(); + point = Rectangle.getSoutheast(rectangle).clone(); point.height = maxHeight; expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = Extent.getNorthwest(extent).clone(); + point = Rectangle.getNorthwest(rectangle).clone(); point.height = minHeight; expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = Extent.getNorthwest(extent).clone(); + point = Rectangle.getNorthwest(rectangle).clone(); point.height = maxHeight; expectBoundingSphereToContainPoint(boundingSphere, point, projection); // Test that the center is inside the bounding sphere - point = Extent.getCenter(extent).clone(); + point = Rectangle.getCenter(rectangle).clone(); point.height = minHeight; expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = Extent.getCenter(extent).clone(); + point = Rectangle.getCenter(rectangle).clone(); point.height = maxHeight; expectBoundingSphereToContainPoint(boundingSphere, point, projection); // Test that the edge midpoints are inside the bounding sphere. - point = new Cartographic(Extent.getCenter(extent).longitude, extent.south, minHeight); + point = new Cartographic(Rectangle.getCenter(rectangle).longitude, rectangle.south, minHeight); expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = new Cartographic(Extent.getCenter(extent).longitude, extent.south, maxHeight); + point = new Cartographic(Rectangle.getCenter(rectangle).longitude, rectangle.south, maxHeight); expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = new Cartographic(Extent.getCenter(extent).longitude, extent.north, minHeight); + point = new Cartographic(Rectangle.getCenter(rectangle).longitude, rectangle.north, minHeight); expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = new Cartographic(Extent.getCenter(extent).longitude, extent.north, maxHeight); + point = new Cartographic(Rectangle.getCenter(rectangle).longitude, rectangle.north, maxHeight); expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = new Cartographic(extent.west, Extent.getCenter(extent).latitude, minHeight); + point = new Cartographic(rectangle.west, Rectangle.getCenter(rectangle).latitude, minHeight); expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = new Cartographic(extent.west, Extent.getCenter(extent).latitude, maxHeight); + point = new Cartographic(rectangle.west, Rectangle.getCenter(rectangle).latitude, maxHeight); expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = new Cartographic(extent.east, Extent.getCenter(extent).latitude, minHeight); + point = new Cartographic(rectangle.east, Rectangle.getCenter(rectangle).latitude, minHeight); expectBoundingSphereToContainPoint(boundingSphere, point, projection); - point = new Cartographic(extent.east, Extent.getCenter(extent).latitude, maxHeight); + point = new Cartographic(rectangle.east, Rectangle.getCenter(rectangle).latitude, maxHeight); expectBoundingSphereToContainPoint(boundingSphere, point, projection); }); }); diff --git a/Specs/Core/EllipsoidalOccluderSpec.js b/Specs/Core/EllipsoidalOccluderSpec.js index 146cefcacf24..e3c4c7568818 100644 --- a/Specs/Core/EllipsoidalOccluderSpec.js +++ b/Specs/Core/EllipsoidalOccluderSpec.js @@ -8,7 +8,7 @@ defineSuite([ 'Core/Visibility', 'Core/Math', 'Core/Ellipsoid', - 'Core/Extent', + 'Core/Rectangle', 'Core/Ray' ], function( EllipsoidalOccluder, @@ -19,7 +19,7 @@ defineSuite([ Visibility, CesiumMath, Ellipsoid, - Extent, + Rectangle, Ray) { "use strict"; /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ @@ -253,30 +253,30 @@ defineSuite([ }); }); - describe('computeHorizonCullingPointFromExtent', function() { - it('returns undefined for global extent', function() { + describe('computeHorizonCullingPointFromRectangle', function() { + it('returns undefined for global rectangle', function() { var ellipsoid = new Ellipsoid(12345.0, 12345.0, 12345.0); var ellipsoidalOccluder = new EllipsoidalOccluder(ellipsoid); - var extent = Extent.MAX_VALUE; - var result = ellipsoidalOccluder.computeHorizonCullingPointFromExtent(extent, ellipsoid); + var rectangle = Rectangle.MAX_VALUE; + var result = ellipsoidalOccluder.computeHorizonCullingPointFromRectangle(rectangle, ellipsoid); expect(result).toBeUndefined(); }); - it('computes a point with a grazing altitude close to zero for one of the extent corners and less than or equal to zero for the others', function() { + it('computes a point with a grazing altitude close to zero for one of the rectangle corners and less than or equal to zero for the others', function() { var ellipsoid = new Ellipsoid(12345.0, 12345.0, 12345.0); var ellipsoidalOccluder = new EllipsoidalOccluder(ellipsoid); - var extent = new Extent(0.1, 0.2, 0.3, 0.4); - var result = ellipsoidalOccluder.computeHorizonCullingPointFromExtent(extent, ellipsoid); + var rectangle = new Rectangle(0.1, 0.2, 0.3, 0.4); + var result = ellipsoidalOccluder.computeHorizonCullingPointFromRectangle(rectangle, ellipsoid); expect(result).toBeDefined(); var unscaledResult = Cartesian3.multiplyComponents(result, ellipsoid.radii); // The grazing altitude of the ray from the horizon culling point to the // position used to compute it should be very nearly zero. - var positions = [ellipsoid.cartographicToCartesian(Extent.getSouthwest(extent)), - ellipsoid.cartographicToCartesian(Extent.getSoutheast(extent)), - ellipsoid.cartographicToCartesian(Extent.getNorthwest(extent)), - ellipsoid.cartographicToCartesian(Extent.getNortheast(extent))]; + var positions = [ellipsoid.cartographicToCartesian(Rectangle.getSouthwest(rectangle)), + ellipsoid.cartographicToCartesian(Rectangle.getSoutheast(rectangle)), + ellipsoid.cartographicToCartesian(Rectangle.getNorthwest(rectangle)), + ellipsoid.cartographicToCartesian(Rectangle.getNortheast(rectangle))]; var foundOneNearZero = false; for (var i = 0; i < positions.length; ++i) { diff --git a/Specs/Core/ExtentSpec.js b/Specs/Core/ExtentSpec.js deleted file mode 100644 index 9b1ea2fdb464..000000000000 --- a/Specs/Core/ExtentSpec.js +++ /dev/null @@ -1,523 +0,0 @@ -/*global defineSuite*/ -defineSuite([ - 'Core/Extent', - 'Core/Math', - 'Core/Cartographic', - 'Core/Cartesian3', - 'Core/Ellipsoid' - ], function( - Extent, - CesiumMath, - Cartographic, - Cartesian3, - Ellipsoid) { - "use strict"; - /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ - - var west = -0.9; - var south = 0.5; - var east = 1.4; - var north = 1.0; - var center = new Cartographic((west + east) / 2.0, (south + north) / 2.0); - - it('default constructor sets expected values.', function() { - var extent = new Extent(); - expect(extent.west).toEqual(0.0); - expect(extent.south).toEqual(0.0); - expect(extent.north).toEqual(0.0); - expect(extent.east).toEqual(0.0); - }); - - it('constructor sets expected parameter values.', function() { - var extent = new Extent(west, south, east, north); - expect(extent.west).toEqual(west); - expect(extent.south).toEqual(south); - expect(extent.east).toEqual(east); - expect(extent.north).toEqual(north); - }); - - it('fromDegrees produces expected values.', function() { - var west = -10.0; - var south = -20.0; - var east = 10.0; - var north = 20.0; - - var extent = Extent.fromDegrees(west, south, east, north); - expect(extent.west).toEqual(CesiumMath.toRadians(west)); - expect(extent.south).toEqual(CesiumMath.toRadians(south)); - expect(extent.east).toEqual(CesiumMath.toRadians(east)); - expect(extent.north).toEqual(CesiumMath.toRadians(north)); - }); - - it('fromDegrees works with a result parameter.', function() { - var west = -10.0; - var south = -20.0; - var east = 10.0; - var north = 20.0; - - var result = new Extent(); - var extent = Extent.fromDegrees(west, south, east, north, result); - expect(result).toBe(extent); - expect(extent.west).toEqual(CesiumMath.toRadians(west)); - expect(extent.south).toEqual(CesiumMath.toRadians(south)); - expect(extent.east).toEqual(CesiumMath.toRadians(east)); - expect(extent.north).toEqual(CesiumMath.toRadians(north)); - }); - - it('fromCartographicArray produces expected values.', function() { - var minLon = new Cartographic(-0.1, 0.3, 0.0); - var minLat = new Cartographic(0.0, -0.2, 0.0); - var maxLon = new Cartographic(0.3, -0.1, 0.0); - var maxLat = new Cartographic(0.2, 0.4, 0.0); - - var extent = Extent.fromCartographicArray([minLat, minLon, maxLat, maxLon]); - expect(extent.west).toEqual(minLon.longitude); - expect(extent.south).toEqual(minLat.latitude); - expect(extent.east).toEqual(maxLon.longitude); - expect(extent.north).toEqual(maxLat.latitude); - }); - - it('fromCartographicArray works with a result parameter.', function() { - var minLon = new Cartographic(-0.1, 0.3, 0.0); - var minLat = new Cartographic(0.0, -0.2, 0.0); - var maxLon = new Cartographic(0.3, -0.1, 0.0); - var maxLat = new Cartographic(0.2, 0.4, 0.0); - - var result = new Extent(); - var extent = Extent.fromCartographicArray([minLat, minLon, maxLat, maxLon], result); - expect(result).toBe(extent); - expect(extent.west).toEqual(minLon.longitude); - expect(extent.south).toEqual(minLat.latitude); - expect(extent.east).toEqual(maxLon.longitude); - expect(extent.north).toEqual(maxLat.latitude); - }); - - it('clone works without a result parameter.', function() { - var extent = new Extent(west, south, east, north); - var returnedResult = extent.clone(); - expect(returnedResult).toEqual(extent); - expect(returnedResult).toNotBe(extent); - }); - - it('clone works with a result parameter.', function() { - var extent = new Extent(west, south, east, north); - var result = new Extent(); - var returnedResult = extent.clone(result); - expect(returnedResult).toEqual(extent); - expect(returnedResult).toNotBe(extent); - expect(returnedResult).toBe(result); - }); - - it('clone works with "this" result parameter.', function() { - var extent = new Extent(west, south, east, north); - var returnedResult = extent.clone(extent); - expect(returnedResult).toEqual(new Extent(west, south, east, north)); - expect(returnedResult).toBe(extent); - }); - - it('clone works without extent', function() { - expect(Extent.clone()).not.toBeDefined(); - }); - - it('Equals works in all cases', function() { - var extent = new Extent(0.1, 0.2, 0.3, 0.4); - expect(extent.equals(new Extent(0.1, 0.2, 0.3, 0.4))).toEqual(true); - expect(extent.equals(new Extent(0.5, 0.2, 0.3, 0.4))).toEqual(false); - expect(extent.equals(new Extent(0.1, 0.5, 0.3, 0.4))).toEqual(false); - expect(extent.equals(new Extent(0.1, 0.2, 0.5, 0.4))).toEqual(false); - expect(extent.equals(new Extent(0.1, 0.2, 0.3, 0.5))).toEqual(false); - expect(extent.equals(undefined)).toEqual(false); - }); - - it('Static equals works in all cases', function() { - var extent = new Extent(0.1, 0.2, 0.3, 0.4); - expect(Extent.equals(extent, new Extent(0.1, 0.2, 0.3, 0.4))).toEqual(true); - expect(Extent.equals(extent, new Extent(0.5, 0.2, 0.3, 0.4))).toEqual(false); - expect(Extent.equals(extent, new Extent(0.1, 0.5, 0.3, 0.4))).toEqual(false); - expect(Extent.equals(extent, new Extent(0.1, 0.2, 0.5, 0.4))).toEqual(false); - expect(Extent.equals(extent, new Extent(0.1, 0.2, 0.3, 0.5))).toEqual(false); - expect(Extent.equals(extent, undefined)).toEqual(false); - }); - - it('Equals epsilon works in all cases', function() { - var extent = new Extent(0.1, 0.2, 0.3, 0.4); - expect(extent.equalsEpsilon(new Extent(0.1, 0.2, 0.3, 0.4), 0.0)).toEqual(true); - expect(extent.equalsEpsilon(new Extent(0.5, 0.2, 0.3, 0.4), 0.0)).toEqual(false); - expect(extent.equalsEpsilon(new Extent(0.1, 0.5, 0.3, 0.4), 0.0)).toEqual(false); - expect(extent.equalsEpsilon(new Extent(0.1, 0.2, 0.5, 0.4), 0.0)).toEqual(false); - expect(extent.equalsEpsilon(new Extent(0.1, 0.2, 0.3, 0.5), 0.0)).toEqual(false); - expect(extent.equalsEpsilon(new Extent(0.5, 0.2, 0.3, 0.4), 0.4)).toEqual(true); - expect(extent.equalsEpsilon(new Extent(0.1, 0.5, 0.3, 0.4), 0.3)).toEqual(true); - expect(extent.equalsEpsilon(new Extent(0.1, 0.2, 0.5, 0.4), 0.2)).toEqual(true); - expect(extent.equalsEpsilon(new Extent(0.1, 0.2, 0.3, 0.5), 0.1)).toEqual(true); - expect(extent.equalsEpsilon(undefined, 0.0)).toEqual(false); - }); - - it('fromCartographicArray throws with no array', function() { - expect(function() { - Extent.fromCartographicArray(undefined, new Extent()); - }).toThrowDeveloperError(); - }); - - it('validate throws with no extent', function() { - expect(function() { - Extent.validate(); - }).toThrowDeveloperError(); - }); - - it('validate throws with no west', function() { - var extent = new Extent(west, south, east, north); - extent.west = undefined; - expect(function() { - Extent.validate(extent); - }).toThrowDeveloperError(); - }); - - it('validate throws with no south', function() { - var extent = new Extent(west, south, east, north); - extent.south = undefined; - expect(function() { - Extent.validate(extent); - }).toThrowDeveloperError(); - }); - - it('validate throws with no east', function() { - var extent = new Extent(west, south, east, north); - extent.east = undefined; - expect(function() { - Extent.validate(extent); - }).toThrowDeveloperError(); - }); - - it('validate throws with no north', function() { - var extent = new Extent(west, south, east, north); - extent.north = undefined; - expect(function() { - Extent.validate(extent); - }).toThrowDeveloperError(); - }); - - it('validate throws with bad west', function() { - var extent = new Extent(west, south, east, north); - extent.west = Math.PI * 2; - expect(function() { - Extent.validate(extent); - }).toThrowDeveloperError(); - }); - - it('validate throws with bad south', function() { - var extent = new Extent(west, south, east, north); - extent.south = Math.PI * 2; - expect(function() { - Extent.validate(extent); - }).toThrowDeveloperError(); - }); - - it('validate throws with bad east', function() { - var extent = new Extent(west, south, east, north); - extent.east = Math.PI * 2; - expect(function() { - Extent.validate(extent); - }).toThrowDeveloperError(); - }); - - it('validate throws with bad north', function() { - var extent = new Extent(west, south, east, north); - extent.north = Math.PI * 2; - expect(function() { - Extent.validate(extent); - }).toThrowDeveloperError(); - }); - - it('getSouthwest works without a result parameter', function() { - var extent = new Extent(west, south, east, north); - var returnedResult = Extent.getSouthwest(extent); - expect(returnedResult.longitude).toEqual(west); - expect(returnedResult.latitude).toEqual(south); - }); - - it('getSouthwest works with a result parameter', function() { - var extent = new Extent(west, south, east, north); - var result = new Cartographic(); - var returnedResult = Extent.getSouthwest(extent, result); - expect(returnedResult).toBe(result); - expect(returnedResult.longitude).toEqual(west); - expect(returnedResult.latitude).toEqual(south); - }); - - it('getSouthwest throws with no extent', function() { - expect(function() { - Extent.getSouthwest(); - }).toThrowDeveloperError(); - }); - - it('getNorthwest works without a result parameter', function() { - var extent = new Extent(west, south, east, north); - var returnedResult = Extent.getNorthwest(extent); - expect(returnedResult.longitude).toEqual(west); - expect(returnedResult.latitude).toEqual(north); - }); - - it('getNorthwest works with a result parameter', function() { - var extent = new Extent(west, south, east, north); - var result = new Cartographic(); - var returnedResult = Extent.getNorthwest(extent, result); - expect(returnedResult).toBe(result); - expect(returnedResult.longitude).toEqual(west); - expect(returnedResult.latitude).toEqual(north); - }); - - it('getNothwest throws with no extent', function() { - expect(function() { - Extent.getNorthwest(); - }).toThrowDeveloperError(); - }); - - it('getNortheast works without a result parameter', function() { - var extent = new Extent(west, south, east, north); - var returnedResult = Extent.getNortheast(extent); - expect(returnedResult.longitude).toEqual(east); - expect(returnedResult.latitude).toEqual(north); - }); - - it('getNortheast works with a result parameter', function() { - var extent = new Extent(west, south, east, north); - var result = new Cartographic(); - var returnedResult = Extent.getNortheast(extent, result); - expect(returnedResult).toBe(result); - expect(returnedResult.longitude).toEqual(east); - expect(returnedResult.latitude).toEqual(north); - }); - - it('getNotheast throws with no extent', function() { - expect(function() { - Extent.getNortheast(); - }).toThrowDeveloperError(); - }); - - it('getSoutheast works without a result parameter', function() { - var extent = new Extent(west, south, east, north); - var returnedResult = Extent.getSoutheast(extent); - expect(returnedResult.longitude).toEqual(east); - expect(returnedResult.latitude).toEqual(south); - }); - - it('getSoutheast works with a result parameter', function() { - var extent = new Extent(west, south, east, north); - var result = new Cartographic(); - var returnedResult = Extent.getSoutheast(extent, result); - expect(returnedResult).toBe(result); - expect(returnedResult.longitude).toEqual(east); - expect(returnedResult.latitude).toEqual(south); - }); - - it('getSoutheast throws with no extent', function() { - expect(function() { - Extent.getSoutheast(); - }).toThrowDeveloperError(); - }); - - it('getCenter works without a result parameter', function() { - var extent = new Extent(west, south, east, north); - var returnedResult = Extent.getCenter(extent); - expect(returnedResult).toEqual(center); - }); - - it('getCenter works with a result parameter', function() { - var extent = new Extent(west, south, east, north); - var result = new Cartographic(); - var returnedResult = Extent.getCenter(extent, result); - expect(result).toBe(returnedResult); - expect(returnedResult).toEqual(center); - }); - - it('getCenter throws with no extent', function() { - expect(function() { - Extent.getCenter(); - }).toThrowDeveloperError(); - }); - - it('intersectWith works without a result parameter', function() { - var extent = new Extent(0.5, 0.1, 0.75, 0.9); - var extent2 = new Extent(0.0, 0.25, 1.0, 0.8); - var expected = new Extent(0.5, 0.25, 0.75, 0.8); - var returnedResult = Extent.intersectWith(extent, extent2); - expect(returnedResult).toEqual(expected); - }); - - it('intersectWith works with a result parameter', function() { - var extent = new Extent(0.5, 0.1, 0.75, 0.9); - var extent2 = new Extent(0.0, 0.25, 1.0, 0.8); - var expected = new Extent(0.5, 0.25, 0.75, 0.8); - var result = new Extent(); - var returnedResult = Extent.intersectWith(extent, extent2, result); - expect(returnedResult).toEqual(expected); - expect(result).toBe(returnedResult); - }); - - it('contains works', function() { - var extent = new Extent(west, south, east, north); - expect(Extent.contains(extent, new Cartographic(west, south))).toEqual(true); - expect(Extent.contains(extent, new Cartographic(west, north))).toEqual(true); - expect(Extent.contains(extent, new Cartographic(east, south))).toEqual(true); - expect(Extent.contains(extent, new Cartographic(east, north))).toEqual(true); - expect(Extent.contains(extent, Extent.getCenter(extent))).toEqual(true); - expect(Extent.contains(extent, new Cartographic(west - 0.1, south))).toEqual(false); - expect(Extent.contains(extent, new Cartographic(west, north + 0.1))).toEqual(false); - expect(Extent.contains(extent, new Cartographic(east, south - 0.1))).toEqual(false); - expect(Extent.contains(extent, new Cartographic(east + 0.1, north))).toEqual(false); - }); - - it('isEmpty reports a non-empty extent', function() { - var extent = new Extent(1.0, 1.0, 2.0, 2.0); - expect(Extent.isEmpty(extent)).toEqual(false); - }); - - it('isEmpty reports true for a point', function() { - var extent = new Extent(2.0, 2.0, 2.0, 2.0); - expect(Extent.isEmpty(extent)).toEqual(true); - }); - - it('isEmpty reports true for a north-south line', function() { - var extent = new Extent(2.0, 2.0, 2.0, 2.1); - expect(Extent.isEmpty(extent)).toEqual(true); - }); - - it('isEmpty reports true for an east-west line', function() { - var extent = new Extent(2.0, 2.0, 2.1, 2.0); - expect(Extent.isEmpty(extent)).toEqual(true); - }); - - it('isEmpty reports true if north-south direction is degenerate', function() { - var extent = new Extent(1.0, 1.1, 2.0, 1.0); - expect(Extent.isEmpty(extent)).toEqual(true); - }); - - it('isEmpty reports true if east-west direction is degenerate', function() { - var extent = new Extent(1.1, 1.0, 1.0, 2.0); - expect(Extent.isEmpty(extent)).toEqual(true); - }); - - it('isEmpty throws with no extent', function() { - expect(function() { - Extent.isEmpty(); - }).toThrowDeveloperError(); - }); - - it('subsample works south of the equator', function() { - var west = 0.1; - var south = -0.3; - var east = 0.2; - var north = -0.4; - var extent = new Extent(west, south, east, north); - var returnedResult = Extent.subsample(extent); - expect(returnedResult).toEqual([Ellipsoid.WGS84.cartographicToCartesian(Extent.getNorthwest(extent)), - Ellipsoid.WGS84.cartographicToCartesian(Extent.getNortheast(extent)), - Ellipsoid.WGS84.cartographicToCartesian(Extent.getSoutheast(extent)), - Ellipsoid.WGS84.cartographicToCartesian(Extent.getSouthwest(extent))]); - }); - - it('subsample works with a result parameter', function() { - var west = 0.1; - var south = -0.3; - var east = 0.2; - var north = -0.4; - var extent = new Extent(west, south, east, north); - var cartesian0 = new Cartesian3(); - var results = [cartesian0]; - var returnedResult = Extent.subsample(extent, Ellipsoid.WGS84, 0.0, results); - expect(results).toBe(returnedResult); - expect(results[0]).toBe(cartesian0); - expect(returnedResult).toEqual([Ellipsoid.WGS84.cartographicToCartesian(Extent.getNorthwest(extent)), - Ellipsoid.WGS84.cartographicToCartesian(Extent.getNortheast(extent)), - Ellipsoid.WGS84.cartographicToCartesian(Extent.getSoutheast(extent)), - Ellipsoid.WGS84.cartographicToCartesian(Extent.getSouthwest(extent))]); - }); - - it('subsample works north of the equator', function() { - var west = 0.1; - var south = 0.3; - var east = 0.2; - var north = 0.4; - var extent = new Extent(west, south, east, north); - var returnedResult = Extent.subsample(extent); - expect(returnedResult).toEqual([Ellipsoid.WGS84.cartographicToCartesian(Extent.getNorthwest(extent)), - Ellipsoid.WGS84.cartographicToCartesian(Extent.getNortheast(extent)), - Ellipsoid.WGS84.cartographicToCartesian(Extent.getSoutheast(extent)), - Ellipsoid.WGS84.cartographicToCartesian(Extent.getSouthwest(extent))]); - }); - - it('subsample works on the equator', function() { - var west = 0.1; - var south = -0.1; - var east = 0.2; - var north = 0.0; - var extent = new Extent(west, south, east, north); - var returnedResult = Extent.subsample(extent); - expect(returnedResult.length).toEqual(6); - expect(returnedResult[0]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(Extent.getNorthwest(extent))); - expect(returnedResult[1]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(Extent.getNortheast(extent))); - expect(returnedResult[2]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(Extent.getSoutheast(extent))); - expect(returnedResult[3]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(Extent.getSouthwest(extent))); - - var cartographic4 = Ellipsoid.WGS84.cartesianToCartographic(returnedResult[4]); - expect(cartographic4.latitude).toEqual(0.0); - expect(cartographic4.longitude).toEqualEpsilon(west, CesiumMath.EPSILON16); - - var cartographic5 = Ellipsoid.WGS84.cartesianToCartographic(returnedResult[5]); - expect(cartographic5.latitude).toEqual(0.0); - expect(cartographic5.longitude).toEqualEpsilon(east, CesiumMath.EPSILON16); - }); - - it('subsample works at a height above the ellipsoid', function() { - var west = 0.1; - var south = -0.3; - var east = 0.2; - var north = -0.4; - var extent = new Extent(west, south, east, north); - var height = 100000.0; - var returnedResult = Extent.subsample(extent, Ellipsoid.WGS84, height); - - var nw = Extent.getNorthwest(extent); - nw.height = height; - var ne = Extent.getNortheast(extent); - ne.height = height; - var se = Extent.getSoutheast(extent); - se.height = height; - var sw = Extent.getSouthwest(extent); - sw.height = height; - - expect(returnedResult).toEqual([Ellipsoid.WGS84.cartographicToCartesian(nw), - Ellipsoid.WGS84.cartographicToCartesian(ne), - Ellipsoid.WGS84.cartographicToCartesian(se), - Ellipsoid.WGS84.cartographicToCartesian(sw)]); - }); - - it('subsample throws with no extent', function() { - expect(function() { - Extent.subsample(); - }).toThrowDeveloperError(); - }); - - it('equalsEpsilon throws with no epsilon', function() { - var extent = new Extent(west, south, east, north); - var other = new Extent(); - expect(function() { - extent.equalsEpsilon(other, undefined); - }).toThrowDeveloperError(); - }); - - it('intersectWith throws with no extent', function() { - var extent = new Extent(west, south, east, north); - expect(function() { - Extent.intersectWith(undefined); - }).toThrowDeveloperError(); - }); - - it('contains throws with no cartographic', function() { - var extent = new Extent(west, south, east, north); - expect(function() { - Extent.contains(extent, undefined); - }).toThrowDeveloperError(); - }); -}); \ No newline at end of file diff --git a/Specs/Core/OccluderSpec.js b/Specs/Core/OccluderSpec.js index 60f5dc603eb5..4cf5be268cb9 100644 --- a/Specs/Core/OccluderSpec.js +++ b/Specs/Core/OccluderSpec.js @@ -6,7 +6,7 @@ defineSuite([ 'Core/Visibility', 'Core/Math', 'Core/Ellipsoid', - 'Core/Extent' + 'Core/Rectangle' ], function( Occluder, Cartesian3, @@ -14,7 +14,7 @@ defineSuite([ Visibility, CesiumMath, Ellipsoid, - Extent) { + Rectangle) { "use strict"; /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ @@ -256,25 +256,25 @@ defineSuite([ expect(occluder.isBoundingSphereVisible(new BoundingSphere(result, 0.0))).toEqual(true); }); - it('compute occludee point from extent throws without an extent', function() { + it('compute occludee point from rectangle throws without an rectangle', function() { expect(function() { - return Occluder.computeOccludeePointFromExtent(); + return Occluder.computeOccludeePointFromRectangle(); }).toThrowDeveloperError(); }); - it('compute invalid occludee point from extent', function() { - var extent = Extent.MAX_VALUE; - expect(Occluder.computeOccludeePointFromExtent(extent)).toEqual(undefined); + it('compute invalid occludee point from rectangle', function() { + var rectangle = Rectangle.MAX_VALUE; + expect(Occluder.computeOccludeePointFromRectangle(rectangle)).toEqual(undefined); }); - it('compute valid occludee point from extent', function() { + it('compute valid occludee point from rectangle', function() { var edge = Math.PI / 32.0; - var extent = new Extent(-edge, -edge, edge, edge); + var rectangle = new Rectangle(-edge, -edge, edge, edge); var ellipsoid = Ellipsoid.WGS84; - var positions = Extent.subsample(extent, ellipsoid); + var positions = Rectangle.subsample(rectangle, ellipsoid); var bs = BoundingSphere.fromPoints(positions); var point = Occluder.getOccludeePoint(new BoundingSphere(Cartesian3.ZERO, ellipsoid.minimumRadius), bs.center, positions); - var actual = Occluder.computeOccludeePointFromExtent(extent); + var actual = Occluder.computeOccludeePointFromRectangle(rectangle); expect(actual).toEqual(point); }); diff --git a/Specs/Core/ExtentGeometrySpec.js b/Specs/Core/RectangleGeometrySpec.js similarity index 72% rename from Specs/Core/ExtentGeometrySpec.js rename to Specs/Core/RectangleGeometrySpec.js index dd45d841f122..ef0c7ff0daa6 100644 --- a/Specs/Core/ExtentGeometrySpec.js +++ b/Specs/Core/RectangleGeometrySpec.js @@ -1,18 +1,18 @@ /*global defineSuite*/ defineSuite([ - 'Core/ExtentGeometry', + 'Core/RectangleGeometry', 'Core/Cartesian3', 'Core/Ellipsoid', - 'Core/Extent', + 'Core/Rectangle', 'Core/GeographicProjection', 'Core/Math', 'Core/Matrix2', 'Core/VertexFormat' ], function( - ExtentGeometry, + RectangleGeometry, Cartesian3, Ellipsoid, - Extent, + Rectangle, GeographicProjection, CesiumMath, Matrix2, @@ -21,10 +21,10 @@ defineSuite([ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ it('computes positions', function() { - var extent = new Extent(-2.0, -1.0, 0.0, 1.0); - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ + var rectangle = new Rectangle(-2.0, -1.0, 0.0, 1.0); + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ vertexFormat : VertexFormat.POSITION_ONLY, - extent : extent, + rectangle : rectangle, granularity : 1.0 })); var positions = m.attributes.position.values; @@ -33,16 +33,16 @@ defineSuite([ expect(positions.length).toEqual(9 * 3); expect(m.indices.length).toEqual(8 * 3); - var expectedNWCorner = Ellipsoid.WGS84.cartographicToCartesian(Extent.getNorthwest(extent)); - var expectedSECorner = Ellipsoid.WGS84.cartographicToCartesian(Extent.getSoutheast(extent)); + var expectedNWCorner = Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getNorthwest(rectangle)); + var expectedSECorner = Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getSoutheast(rectangle)); expect(new Cartesian3(positions[0], positions[1], positions[2])).toEqualEpsilon(expectedNWCorner, CesiumMath.EPSILON9); expect(new Cartesian3(positions[length - 3], positions[length - 2], positions[length - 1])).toEqualEpsilon(expectedSECorner, CesiumMath.EPSILON9); }); it('computes all attributes', function() { - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ vertexFormat : VertexFormat.ALL, - extent : new Extent(-2.0, -1.0, 0.0, 1.0), + rectangle : new Rectangle(-2.0, -1.0, 0.0, 1.0), granularity : 1.0 })); expect(m.attributes.position.values.length).toEqual(9 * 3); @@ -54,11 +54,11 @@ defineSuite([ }); it('compute positions with rotation', function() { - var extent = new Extent(-1, -1, 1, 1); + var rectangle = new Rectangle(-1, -1, 1, 1); var angle = CesiumMath.PI_OVER_TWO; - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ vertexFormat : VertexFormat.POSITIONS_ONLY, - extent : extent, + rectangle : rectangle, rotation : angle, granularity : 1.0 })); @@ -68,7 +68,7 @@ defineSuite([ expect(length).toEqual(9 * 3); expect(m.indices.length).toEqual(8 * 3); - var unrotatedSECorner = Extent.getSoutheast(extent); + var unrotatedSECorner = Rectangle.getSoutheast(rectangle); var projection = new GeographicProjection(); var projectedSECorner = projection.project(unrotatedSECorner); var rotation = Matrix2.fromRotation(angle); @@ -79,9 +79,9 @@ defineSuite([ }); it('compute vertices with PI rotation', function() { - var extent = new Extent(-1, -1, 1, 1); - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ - extent : extent, + var rectangle = new Rectangle(-1, -1, 1, 1); + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ + rectangle : rectangle, rotation : CesiumMath.PI, granularity : 1.0 })); @@ -91,8 +91,8 @@ defineSuite([ expect(length).toEqual(9 * 3); expect(m.indices.length).toEqual(8 * 3); - var unrotatedNWCorner = Ellipsoid.WGS84.cartographicToCartesian(Extent.getNorthwest(extent)); - var unrotatedSECorner = Ellipsoid.WGS84.cartographicToCartesian(Extent.getSoutheast(extent)); + var unrotatedNWCorner = Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getNorthwest(rectangle)); + var unrotatedSECorner = Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getSoutheast(rectangle)); var actual = new Cartesian3(positions[0], positions[1], positions[2]); expect(actual).toEqualEpsilon(unrotatedSECorner, CesiumMath.EPSILON8); @@ -102,11 +102,11 @@ defineSuite([ }); it('compute texture coordinates with rotation', function() { - var extent = new Extent(-1, -1, 1, 1); + var rectangle = new Rectangle(-1, -1, 1, 1); var angle = CesiumMath.PI_OVER_TWO; - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ vertexFormat : VertexFormat.POSITION_AND_ST, - extent : extent, + rectangle : rectangle, stRotation : angle, granularity : 1.0 })); @@ -122,16 +122,16 @@ defineSuite([ expect(st[length - 1]).toEqualEpsilon(0.0, CesiumMath.EPSILON14); }); - it('throws without extent', function() { + it('throws without rectangle', function() { expect(function() { - return new ExtentGeometry({}); + return new RectangleGeometry({}); }).toThrowDeveloperError(); }); - it('throws if rotated extent is invalid', function() { + it('throws if rotated rectangle is invalid', function() { expect(function() { - return ExtentGeometry.createGeometry(new ExtentGeometry({ - extent : new Extent(-CesiumMath.PI_OVER_TWO, 1, CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO), + return RectangleGeometry.createGeometry(new RectangleGeometry({ + rectangle : new Rectangle(-CesiumMath.PI_OVER_TWO, 1, CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO), rotation : CesiumMath.PI_OVER_TWO })); }).toThrowDeveloperError(); @@ -139,25 +139,25 @@ defineSuite([ it('throws if east is less than west', function() { expect(function() { - return new ExtentGeometry({ - extent : new Extent(CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO) + return new RectangleGeometry({ + rectangle : new Rectangle(CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO) }); }).toThrowDeveloperError(); }); it('throws if north is less than south', function() { expect(function() { - return new ExtentGeometry({ - extent : new Extent(-CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO) + return new RectangleGeometry({ + rectangle : new Rectangle(-CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO) }); }).toThrowDeveloperError(); }); it('computes positions extruded', function() { - var extent = new Extent(-2.0, -1.0, 0.0, 1.0); - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ + var rectangle = new Rectangle(-2.0, -1.0, 0.0, 1.0); + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ vertexFormat : VertexFormat.POSITION_ONLY, - extent : extent, + rectangle : rectangle, granularity : 1.0, extrudedHeight : 2 })); @@ -168,9 +168,9 @@ defineSuite([ }); it('computes all attributes extruded', function() { - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ vertexFormat : VertexFormat.ALL, - extent : new Extent(-2.0, -1.0, 0.0, 1.0), + rectangle : new Rectangle(-2.0, -1.0, 0.0, 1.0), granularity : 1.0, extrudedHeight : 2 })); @@ -183,11 +183,11 @@ defineSuite([ }); it('compute positions with rotation extruded', function() { - var extent = new Extent(-1, -1, 1, 1); + var rectangle = new Rectangle(-1, -1, 1, 1); var angle = CesiumMath.PI_OVER_TWO; - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ vertexFormat : VertexFormat.POSITIONS_ONLY, - extent : extent, + rectangle : rectangle, rotation : angle, granularity : 1.0, extrudedHeight : 2 @@ -198,7 +198,7 @@ defineSuite([ expect(length).toEqual((9 + 8 + 4) * 3 * 2); expect(m.indices.length).toEqual((8 * 2 + 4 * 4) * 3); - var unrotatedSECorner = Extent.getSoutheast(extent); + var unrotatedSECorner = Rectangle.getSoutheast(rectangle); var projection = new GeographicProjection(); var projectedSECorner = projection.project(unrotatedSECorner); var rotation = Matrix2.fromRotation(angle); @@ -209,10 +209,10 @@ defineSuite([ }); it('computes extruded top open', function() { - var extent = new Extent(-2.0, -1.0, 0.0, 1.0); - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ + var rectangle = new Rectangle(-2.0, -1.0, 0.0, 1.0); + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ vertexFormat : VertexFormat.POSITION_ONLY, - extent : extent, + rectangle : rectangle, granularity : 1.0, extrudedHeight : 2, closeTop : false @@ -224,10 +224,10 @@ defineSuite([ }); it('computes extruded bottom open', function() { - var extent = new Extent(-2.0, -1.0, 0.0, 1.0); - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ + var rectangle = new Rectangle(-2.0, -1.0, 0.0, 1.0); + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ vertexFormat : VertexFormat.POSITION_ONLY, - extent : extent, + rectangle : rectangle, granularity : 1.0, extrudedHeight : 2, closeBottom : false @@ -239,10 +239,10 @@ defineSuite([ }); it('computes extruded top and bottom open', function() { - var extent = new Extent(-2.0, -1.0, 0.0, 1.0); - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ + var rectangle = new Rectangle(-2.0, -1.0, 0.0, 1.0); + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ vertexFormat : VertexFormat.POSITION_ONLY, - extent : extent, + rectangle : rectangle, granularity : 1.0, extrudedHeight : 2, closeTop : false, @@ -254,11 +254,11 @@ defineSuite([ expect(m.indices.length).toEqual(4 * 3 * 4); }); - it('computes non-extruded extent if height is small', function() { - var extent = new Extent(-2.0, -1.0, 0.0, 1.0); - var m = ExtentGeometry.createGeometry(new ExtentGeometry({ + it('computes non-extruded rectangle if height is small', function() { + var rectangle = new Rectangle(-2.0, -1.0, 0.0, 1.0); + var m = RectangleGeometry.createGeometry(new RectangleGeometry({ vertexFormat : VertexFormat.POSITION_ONLY, - extent : extent, + rectangle : rectangle, granularity : 1.0, extrudedHeight : 0.1 })); diff --git a/Specs/Core/ExtentOutlineGeometrySpec.js b/Specs/Core/RectangleOutlineGeometrySpec.js similarity index 65% rename from Specs/Core/ExtentOutlineGeometrySpec.js rename to Specs/Core/RectangleOutlineGeometrySpec.js index ca009d7229b0..1a5d015376d9 100644 --- a/Specs/Core/ExtentOutlineGeometrySpec.js +++ b/Specs/Core/RectangleOutlineGeometrySpec.js @@ -1,17 +1,17 @@ /*global defineSuite*/ defineSuite([ - 'Core/ExtentOutlineGeometry', + 'Core/RectangleOutlineGeometry', 'Core/Cartesian3', 'Core/Ellipsoid', - 'Core/Extent', + 'Core/Rectangle', 'Core/GeographicProjection', 'Core/Math', 'Core/Matrix2' ], function( - ExtentOutlineGeometry, + RectangleOutlineGeometry, Cartesian3, Ellipsoid, - Extent, + Rectangle, GeographicProjection, CesiumMath, Matrix2) { @@ -19,9 +19,9 @@ defineSuite([ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ it('computes positions', function() { - var extent = new Extent(-2.0, -1.0, 0.0, 1.0); - var m = ExtentOutlineGeometry.createGeometry(new ExtentOutlineGeometry({ - extent : extent, + var rectangle = new Rectangle(-2.0, -1.0, 0.0, 1.0); + var m = RectangleOutlineGeometry.createGeometry(new RectangleOutlineGeometry({ + rectangle : rectangle, granularity : 1.0 })); var positions = m.attributes.position.values; @@ -29,15 +29,15 @@ defineSuite([ expect(positions.length).toEqual(8 * 3); expect(m.indices.length).toEqual(8 * 2); - var expectedNWCorner = Ellipsoid.WGS84.cartographicToCartesian(Extent.getNorthwest(extent)); + var expectedNWCorner = Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getNorthwest(rectangle)); expect(new Cartesian3(positions[0], positions[1], positions[2])).toEqualEpsilon(expectedNWCorner, CesiumMath.EPSILON9); }); it('compute positions with rotation', function() { - var extent = new Extent(-1, -1, 1, 1); + var rectangle = new Rectangle(-1, -1, 1, 1); var angle = CesiumMath.PI_OVER_TWO; - var m = ExtentOutlineGeometry.createGeometry(new ExtentOutlineGeometry({ - extent : extent, + var m = RectangleOutlineGeometry.createGeometry(new RectangleOutlineGeometry({ + rectangle : rectangle, rotation : angle, granularity : 1.0 })); @@ -47,7 +47,7 @@ defineSuite([ expect(length).toEqual(8 * 3); expect(m.indices.length).toEqual(8 * 2); - var unrotatedNWCorner = Extent.getNorthwest(extent); + var unrotatedNWCorner = Rectangle.getNorthwest(rectangle); var projection = new GeographicProjection(); var projectedNWCorner = projection.project(unrotatedNWCorner); var rotation = Matrix2.fromRotation(angle); @@ -57,16 +57,16 @@ defineSuite([ expect(actual).toEqualEpsilon(rotatedNWCorner, CesiumMath.EPSILON6); }); - it('throws without extent', function() { + it('throws without rectangle', function() { expect(function() { - return new ExtentOutlineGeometry({}); + return new RectangleOutlineGeometry({}); }).toThrowDeveloperError(); }); - it('throws if rotated extent is invalid', function() { + it('throws if rotated rectangle is invalid', function() { expect(function() { - return ExtentOutlineGeometry.createGeometry(new ExtentOutlineGeometry({ - extent : new Extent(-CesiumMath.PI_OVER_TWO, 1, CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO), + return RectangleOutlineGeometry.createGeometry(new RectangleOutlineGeometry({ + rectangle : new Rectangle(-CesiumMath.PI_OVER_TWO, 1, CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO), rotation : CesiumMath.PI_OVER_TWO })); }).toThrowDeveloperError(); @@ -74,24 +74,24 @@ defineSuite([ it('throws if east is less than west', function() { expect(function() { - return new ExtentOutlineGeometry({ - extent : new Extent(CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO) + return new RectangleOutlineGeometry({ + rectangle : new Rectangle(CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO) }); }).toThrowDeveloperError(); }); it('throws if north is less than south', function() { expect(function() { - return new ExtentOutlineGeometry({ - extent : new Extent(-CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO) + return new RectangleOutlineGeometry({ + rectangle : new Rectangle(-CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO) }); }).toThrowDeveloperError(); }); it('computes positions extruded', function() { - var extent = new Extent(-2.0, -1.0, 0.0, 1.0); - var m = ExtentOutlineGeometry.createGeometry(new ExtentOutlineGeometry({ - extent : extent, + var rectangle = new Rectangle(-2.0, -1.0, 0.0, 1.0); + var m = RectangleOutlineGeometry.createGeometry(new RectangleOutlineGeometry({ + rectangle : rectangle, granularity : 1.0, extrudedHeight : 2 })); @@ -102,10 +102,10 @@ defineSuite([ }); it('compute positions with rotation extruded', function() { - var extent = new Extent(-1, -1, 1, 1); + var rectangle = new Rectangle(-1, -1, 1, 1); var angle = CesiumMath.PI_OVER_TWO; - var m = ExtentOutlineGeometry.createGeometry(new ExtentOutlineGeometry({ - extent : extent, + var m = RectangleOutlineGeometry.createGeometry(new RectangleOutlineGeometry({ + rectangle : rectangle, rotation : angle, granularity : 1.0, extrudedHeight : 2 @@ -116,7 +116,7 @@ defineSuite([ expect(length).toEqual(8 * 3 * 2); expect(m.indices.length).toEqual(8 * 2 * 2 + 4 * 2); - var unrotatedNWCorner = Extent.getNorthwest(extent); + var unrotatedNWCorner = Rectangle.getNorthwest(rectangle); var projection = new GeographicProjection(); var projectedNWCorner = projection.project(unrotatedNWCorner); var rotation = Matrix2.fromRotation(angle); @@ -128,10 +128,10 @@ defineSuite([ }); - it('computes non-extruded extent if height is small', function() { - var extent = new Extent(-2.0, -1.0, 0.0, 1.0); - var m = ExtentOutlineGeometry.createGeometry(new ExtentOutlineGeometry({ - extent : extent, + it('computes non-extruded rectangle if height is small', function() { + var rectangle = new Rectangle(-2.0, -1.0, 0.0, 1.0); + var m = RectangleOutlineGeometry.createGeometry(new RectangleOutlineGeometry({ + rectangle : rectangle, granularity : 1.0, extrudedHeight : 0.1 })); diff --git a/Specs/Core/RectangleSpec.js b/Specs/Core/RectangleSpec.js new file mode 100644 index 000000000000..d7dbde6438a4 --- /dev/null +++ b/Specs/Core/RectangleSpec.js @@ -0,0 +1,523 @@ +/*global defineSuite*/ +defineSuite([ + 'Core/Rectangle', + 'Core/Math', + 'Core/Cartographic', + 'Core/Cartesian3', + 'Core/Ellipsoid' + ], function( + Rectangle, + CesiumMath, + Cartographic, + Cartesian3, + Ellipsoid) { + "use strict"; + /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ + + var west = -0.9; + var south = 0.5; + var east = 1.4; + var north = 1.0; + var center = new Cartographic((west + east) / 2.0, (south + north) / 2.0); + + it('default constructor sets expected values.', function() { + var rectangle = new Rectangle(); + expect(rectangle.west).toEqual(0.0); + expect(rectangle.south).toEqual(0.0); + expect(rectangle.north).toEqual(0.0); + expect(rectangle.east).toEqual(0.0); + }); + + it('constructor sets expected parameter values.', function() { + var rectangle = new Rectangle(west, south, east, north); + expect(rectangle.west).toEqual(west); + expect(rectangle.south).toEqual(south); + expect(rectangle.east).toEqual(east); + expect(rectangle.north).toEqual(north); + }); + + it('fromDegrees produces expected values.', function() { + var west = -10.0; + var south = -20.0; + var east = 10.0; + var north = 20.0; + + var rectangle = Rectangle.fromDegrees(west, south, east, north); + expect(rectangle.west).toEqual(CesiumMath.toRadians(west)); + expect(rectangle.south).toEqual(CesiumMath.toRadians(south)); + expect(rectangle.east).toEqual(CesiumMath.toRadians(east)); + expect(rectangle.north).toEqual(CesiumMath.toRadians(north)); + }); + + it('fromDegrees works with a result parameter.', function() { + var west = -10.0; + var south = -20.0; + var east = 10.0; + var north = 20.0; + + var result = new Rectangle(); + var rectangle = Rectangle.fromDegrees(west, south, east, north, result); + expect(result).toBe(rectangle); + expect(rectangle.west).toEqual(CesiumMath.toRadians(west)); + expect(rectangle.south).toEqual(CesiumMath.toRadians(south)); + expect(rectangle.east).toEqual(CesiumMath.toRadians(east)); + expect(rectangle.north).toEqual(CesiumMath.toRadians(north)); + }); + + it('fromCartographicArray produces expected values.', function() { + var minLon = new Cartographic(-0.1, 0.3, 0.0); + var minLat = new Cartographic(0.0, -0.2, 0.0); + var maxLon = new Cartographic(0.3, -0.1, 0.0); + var maxLat = new Cartographic(0.2, 0.4, 0.0); + + var rectangle = Rectangle.fromCartographicArray([minLat, minLon, maxLat, maxLon]); + expect(rectangle.west).toEqual(minLon.longitude); + expect(rectangle.south).toEqual(minLat.latitude); + expect(rectangle.east).toEqual(maxLon.longitude); + expect(rectangle.north).toEqual(maxLat.latitude); + }); + + it('fromCartographicArray works with a result parameter.', function() { + var minLon = new Cartographic(-0.1, 0.3, 0.0); + var minLat = new Cartographic(0.0, -0.2, 0.0); + var maxLon = new Cartographic(0.3, -0.1, 0.0); + var maxLat = new Cartographic(0.2, 0.4, 0.0); + + var result = new Rectangle(); + var rectangle = Rectangle.fromCartographicArray([minLat, minLon, maxLat, maxLon], result); + expect(result).toBe(rectangle); + expect(rectangle.west).toEqual(minLon.longitude); + expect(rectangle.south).toEqual(minLat.latitude); + expect(rectangle.east).toEqual(maxLon.longitude); + expect(rectangle.north).toEqual(maxLat.latitude); + }); + + it('clone works without a result parameter.', function() { + var rectangle = new Rectangle(west, south, east, north); + var returnedResult = rectangle.clone(); + expect(returnedResult).toEqual(rectangle); + expect(returnedResult).toNotBe(rectangle); + }); + + it('clone works with a result parameter.', function() { + var rectangle = new Rectangle(west, south, east, north); + var result = new Rectangle(); + var returnedResult = rectangle.clone(result); + expect(returnedResult).toEqual(rectangle); + expect(returnedResult).toNotBe(rectangle); + expect(returnedResult).toBe(result); + }); + + it('clone works with "this" result parameter.', function() { + var rectangle = new Rectangle(west, south, east, north); + var returnedResult = rectangle.clone(rectangle); + expect(returnedResult).toEqual(new Rectangle(west, south, east, north)); + expect(returnedResult).toBe(rectangle); + }); + + it('clone works without rectangle', function() { + expect(Rectangle.clone()).not.toBeDefined(); + }); + + it('Equals works in all cases', function() { + var rectangle = new Rectangle(0.1, 0.2, 0.3, 0.4); + expect(rectangle.equals(new Rectangle(0.1, 0.2, 0.3, 0.4))).toEqual(true); + expect(rectangle.equals(new Rectangle(0.5, 0.2, 0.3, 0.4))).toEqual(false); + expect(rectangle.equals(new Rectangle(0.1, 0.5, 0.3, 0.4))).toEqual(false); + expect(rectangle.equals(new Rectangle(0.1, 0.2, 0.5, 0.4))).toEqual(false); + expect(rectangle.equals(new Rectangle(0.1, 0.2, 0.3, 0.5))).toEqual(false); + expect(rectangle.equals(undefined)).toEqual(false); + }); + + it('Static equals works in all cases', function() { + var rectangle = new Rectangle(0.1, 0.2, 0.3, 0.4); + expect(Rectangle.equals(rectangle, new Rectangle(0.1, 0.2, 0.3, 0.4))).toEqual(true); + expect(Rectangle.equals(rectangle, new Rectangle(0.5, 0.2, 0.3, 0.4))).toEqual(false); + expect(Rectangle.equals(rectangle, new Rectangle(0.1, 0.5, 0.3, 0.4))).toEqual(false); + expect(Rectangle.equals(rectangle, new Rectangle(0.1, 0.2, 0.5, 0.4))).toEqual(false); + expect(Rectangle.equals(rectangle, new Rectangle(0.1, 0.2, 0.3, 0.5))).toEqual(false); + expect(Rectangle.equals(rectangle, undefined)).toEqual(false); + }); + + it('Equals epsilon works in all cases', function() { + var rectangle = new Rectangle(0.1, 0.2, 0.3, 0.4); + expect(rectangle.equalsEpsilon(new Rectangle(0.1, 0.2, 0.3, 0.4), 0.0)).toEqual(true); + expect(rectangle.equalsEpsilon(new Rectangle(0.5, 0.2, 0.3, 0.4), 0.0)).toEqual(false); + expect(rectangle.equalsEpsilon(new Rectangle(0.1, 0.5, 0.3, 0.4), 0.0)).toEqual(false); + expect(rectangle.equalsEpsilon(new Rectangle(0.1, 0.2, 0.5, 0.4), 0.0)).toEqual(false); + expect(rectangle.equalsEpsilon(new Rectangle(0.1, 0.2, 0.3, 0.5), 0.0)).toEqual(false); + expect(rectangle.equalsEpsilon(new Rectangle(0.5, 0.2, 0.3, 0.4), 0.4)).toEqual(true); + expect(rectangle.equalsEpsilon(new Rectangle(0.1, 0.5, 0.3, 0.4), 0.3)).toEqual(true); + expect(rectangle.equalsEpsilon(new Rectangle(0.1, 0.2, 0.5, 0.4), 0.2)).toEqual(true); + expect(rectangle.equalsEpsilon(new Rectangle(0.1, 0.2, 0.3, 0.5), 0.1)).toEqual(true); + expect(rectangle.equalsEpsilon(undefined, 0.0)).toEqual(false); + }); + + it('fromCartographicArray throws with no array', function() { + expect(function() { + Rectangle.fromCartographicArray(undefined, new Rectangle()); + }).toThrowDeveloperError(); + }); + + it('validate throws with no rectangle', function() { + expect(function() { + Rectangle.validate(); + }).toThrowDeveloperError(); + }); + + it('validate throws with no west', function() { + var rectangle = new Rectangle(west, south, east, north); + rectangle.west = undefined; + expect(function() { + Rectangle.validate(rectangle); + }).toThrowDeveloperError(); + }); + + it('validate throws with no south', function() { + var rectangle = new Rectangle(west, south, east, north); + rectangle.south = undefined; + expect(function() { + Rectangle.validate(rectangle); + }).toThrowDeveloperError(); + }); + + it('validate throws with no east', function() { + var rectangle = new Rectangle(west, south, east, north); + rectangle.east = undefined; + expect(function() { + Rectangle.validate(rectangle); + }).toThrowDeveloperError(); + }); + + it('validate throws with no north', function() { + var rectangle = new Rectangle(west, south, east, north); + rectangle.north = undefined; + expect(function() { + Rectangle.validate(rectangle); + }).toThrowDeveloperError(); + }); + + it('validate throws with bad west', function() { + var rectangle = new Rectangle(west, south, east, north); + rectangle.west = Math.PI * 2; + expect(function() { + Rectangle.validate(rectangle); + }).toThrowDeveloperError(); + }); + + it('validate throws with bad south', function() { + var rectangle = new Rectangle(west, south, east, north); + rectangle.south = Math.PI * 2; + expect(function() { + Rectangle.validate(rectangle); + }).toThrowDeveloperError(); + }); + + it('validate throws with bad east', function() { + var rectangle = new Rectangle(west, south, east, north); + rectangle.east = Math.PI * 2; + expect(function() { + Rectangle.validate(rectangle); + }).toThrowDeveloperError(); + }); + + it('validate throws with bad north', function() { + var rectangle = new Rectangle(west, south, east, north); + rectangle.north = Math.PI * 2; + expect(function() { + Rectangle.validate(rectangle); + }).toThrowDeveloperError(); + }); + + it('getSouthwest works without a result parameter', function() { + var rectangle = new Rectangle(west, south, east, north); + var returnedResult = Rectangle.getSouthwest(rectangle); + expect(returnedResult.longitude).toEqual(west); + expect(returnedResult.latitude).toEqual(south); + }); + + it('getSouthwest works with a result parameter', function() { + var rectangle = new Rectangle(west, south, east, north); + var result = new Cartographic(); + var returnedResult = Rectangle.getSouthwest(rectangle, result); + expect(returnedResult).toBe(result); + expect(returnedResult.longitude).toEqual(west); + expect(returnedResult.latitude).toEqual(south); + }); + + it('getSouthwest throws with no rectangle', function() { + expect(function() { + Rectangle.getSouthwest(); + }).toThrowDeveloperError(); + }); + + it('getNorthwest works without a result parameter', function() { + var rectangle = new Rectangle(west, south, east, north); + var returnedResult = Rectangle.getNorthwest(rectangle); + expect(returnedResult.longitude).toEqual(west); + expect(returnedResult.latitude).toEqual(north); + }); + + it('getNorthwest works with a result parameter', function() { + var rectangle = new Rectangle(west, south, east, north); + var result = new Cartographic(); + var returnedResult = Rectangle.getNorthwest(rectangle, result); + expect(returnedResult).toBe(result); + expect(returnedResult.longitude).toEqual(west); + expect(returnedResult.latitude).toEqual(north); + }); + + it('getNothwest throws with no rectangle', function() { + expect(function() { + Rectangle.getNorthwest(); + }).toThrowDeveloperError(); + }); + + it('getNortheast works without a result parameter', function() { + var rectangle = new Rectangle(west, south, east, north); + var returnedResult = Rectangle.getNortheast(rectangle); + expect(returnedResult.longitude).toEqual(east); + expect(returnedResult.latitude).toEqual(north); + }); + + it('getNortheast works with a result parameter', function() { + var rectangle = new Rectangle(west, south, east, north); + var result = new Cartographic(); + var returnedResult = Rectangle.getNortheast(rectangle, result); + expect(returnedResult).toBe(result); + expect(returnedResult.longitude).toEqual(east); + expect(returnedResult.latitude).toEqual(north); + }); + + it('getNotheast throws with no rectangle', function() { + expect(function() { + Rectangle.getNortheast(); + }).toThrowDeveloperError(); + }); + + it('getSoutheast works without a result parameter', function() { + var rectangle = new Rectangle(west, south, east, north); + var returnedResult = Rectangle.getSoutheast(rectangle); + expect(returnedResult.longitude).toEqual(east); + expect(returnedResult.latitude).toEqual(south); + }); + + it('getSoutheast works with a result parameter', function() { + var rectangle = new Rectangle(west, south, east, north); + var result = new Cartographic(); + var returnedResult = Rectangle.getSoutheast(rectangle, result); + expect(returnedResult).toBe(result); + expect(returnedResult.longitude).toEqual(east); + expect(returnedResult.latitude).toEqual(south); + }); + + it('getSoutheast throws with no rectangle', function() { + expect(function() { + Rectangle.getSoutheast(); + }).toThrowDeveloperError(); + }); + + it('getCenter works without a result parameter', function() { + var rectangle = new Rectangle(west, south, east, north); + var returnedResult = Rectangle.getCenter(rectangle); + expect(returnedResult).toEqual(center); + }); + + it('getCenter works with a result parameter', function() { + var rectangle = new Rectangle(west, south, east, north); + var result = new Cartographic(); + var returnedResult = Rectangle.getCenter(rectangle, result); + expect(result).toBe(returnedResult); + expect(returnedResult).toEqual(center); + }); + + it('getCenter throws with no rectangle', function() { + expect(function() { + Rectangle.getCenter(); + }).toThrowDeveloperError(); + }); + + it('intersectWith works without a result parameter', function() { + var rectangle = new Rectangle(0.5, 0.1, 0.75, 0.9); + var rectangle2 = new Rectangle(0.0, 0.25, 1.0, 0.8); + var expected = new Rectangle(0.5, 0.25, 0.75, 0.8); + var returnedResult = Rectangle.intersectWith(rectangle, rectangle2); + expect(returnedResult).toEqual(expected); + }); + + it('intersectWith works with a result parameter', function() { + var rectangle = new Rectangle(0.5, 0.1, 0.75, 0.9); + var rectangle2 = new Rectangle(0.0, 0.25, 1.0, 0.8); + var expected = new Rectangle(0.5, 0.25, 0.75, 0.8); + var result = new Rectangle(); + var returnedResult = Rectangle.intersectWith(rectangle, rectangle2, result); + expect(returnedResult).toEqual(expected); + expect(result).toBe(returnedResult); + }); + + it('contains works', function() { + var rectangle = new Rectangle(west, south, east, north); + expect(Rectangle.contains(rectangle, new Cartographic(west, south))).toEqual(true); + expect(Rectangle.contains(rectangle, new Cartographic(west, north))).toEqual(true); + expect(Rectangle.contains(rectangle, new Cartographic(east, south))).toEqual(true); + expect(Rectangle.contains(rectangle, new Cartographic(east, north))).toEqual(true); + expect(Rectangle.contains(rectangle, Rectangle.getCenter(rectangle))).toEqual(true); + expect(Rectangle.contains(rectangle, new Cartographic(west - 0.1, south))).toEqual(false); + expect(Rectangle.contains(rectangle, new Cartographic(west, north + 0.1))).toEqual(false); + expect(Rectangle.contains(rectangle, new Cartographic(east, south - 0.1))).toEqual(false); + expect(Rectangle.contains(rectangle, new Cartographic(east + 0.1, north))).toEqual(false); + }); + + it('isEmpty reports a non-empty rectangle', function() { + var rectangle = new Rectangle(1.0, 1.0, 2.0, 2.0); + expect(Rectangle.isEmpty(rectangle)).toEqual(false); + }); + + it('isEmpty reports true for a point', function() { + var rectangle = new Rectangle(2.0, 2.0, 2.0, 2.0); + expect(Rectangle.isEmpty(rectangle)).toEqual(true); + }); + + it('isEmpty reports true for a north-south line', function() { + var rectangle = new Rectangle(2.0, 2.0, 2.0, 2.1); + expect(Rectangle.isEmpty(rectangle)).toEqual(true); + }); + + it('isEmpty reports true for an east-west line', function() { + var rectangle = new Rectangle(2.0, 2.0, 2.1, 2.0); + expect(Rectangle.isEmpty(rectangle)).toEqual(true); + }); + + it('isEmpty reports true if north-south direction is degenerate', function() { + var rectangle = new Rectangle(1.0, 1.1, 2.0, 1.0); + expect(Rectangle.isEmpty(rectangle)).toEqual(true); + }); + + it('isEmpty reports true if east-west direction is degenerate', function() { + var rectangle = new Rectangle(1.1, 1.0, 1.0, 2.0); + expect(Rectangle.isEmpty(rectangle)).toEqual(true); + }); + + it('isEmpty throws with no rectangle', function() { + expect(function() { + Rectangle.isEmpty(); + }).toThrowDeveloperError(); + }); + + it('subsample works south of the equator', function() { + var west = 0.1; + var south = -0.3; + var east = 0.2; + var north = -0.4; + var rectangle = new Rectangle(west, south, east, north); + var returnedResult = Rectangle.subsample(rectangle); + expect(returnedResult).toEqual([Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getNorthwest(rectangle)), + Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getNortheast(rectangle)), + Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getSoutheast(rectangle)), + Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getSouthwest(rectangle))]); + }); + + it('subsample works with a result parameter', function() { + var west = 0.1; + var south = -0.3; + var east = 0.2; + var north = -0.4; + var rectangle = new Rectangle(west, south, east, north); + var cartesian0 = new Cartesian3(); + var results = [cartesian0]; + var returnedResult = Rectangle.subsample(rectangle, Ellipsoid.WGS84, 0.0, results); + expect(results).toBe(returnedResult); + expect(results[0]).toBe(cartesian0); + expect(returnedResult).toEqual([Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getNorthwest(rectangle)), + Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getNortheast(rectangle)), + Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getSoutheast(rectangle)), + Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getSouthwest(rectangle))]); + }); + + it('subsample works north of the equator', function() { + var west = 0.1; + var south = 0.3; + var east = 0.2; + var north = 0.4; + var rectangle = new Rectangle(west, south, east, north); + var returnedResult = Rectangle.subsample(rectangle); + expect(returnedResult).toEqual([Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getNorthwest(rectangle)), + Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getNortheast(rectangle)), + Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getSoutheast(rectangle)), + Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getSouthwest(rectangle))]); + }); + + it('subsample works on the equator', function() { + var west = 0.1; + var south = -0.1; + var east = 0.2; + var north = 0.0; + var rectangle = new Rectangle(west, south, east, north); + var returnedResult = Rectangle.subsample(rectangle); + expect(returnedResult.length).toEqual(6); + expect(returnedResult[0]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getNorthwest(rectangle))); + expect(returnedResult[1]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getNortheast(rectangle))); + expect(returnedResult[2]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getSoutheast(rectangle))); + expect(returnedResult[3]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(Rectangle.getSouthwest(rectangle))); + + var cartographic4 = Ellipsoid.WGS84.cartesianToCartographic(returnedResult[4]); + expect(cartographic4.latitude).toEqual(0.0); + expect(cartographic4.longitude).toEqualEpsilon(west, CesiumMath.EPSILON16); + + var cartographic5 = Ellipsoid.WGS84.cartesianToCartographic(returnedResult[5]); + expect(cartographic5.latitude).toEqual(0.0); + expect(cartographic5.longitude).toEqualEpsilon(east, CesiumMath.EPSILON16); + }); + + it('subsample works at a height above the ellipsoid', function() { + var west = 0.1; + var south = -0.3; + var east = 0.2; + var north = -0.4; + var rectangle = new Rectangle(west, south, east, north); + var height = 100000.0; + var returnedResult = Rectangle.subsample(rectangle, Ellipsoid.WGS84, height); + + var nw = Rectangle.getNorthwest(rectangle); + nw.height = height; + var ne = Rectangle.getNortheast(rectangle); + ne.height = height; + var se = Rectangle.getSoutheast(rectangle); + se.height = height; + var sw = Rectangle.getSouthwest(rectangle); + sw.height = height; + + expect(returnedResult).toEqual([Ellipsoid.WGS84.cartographicToCartesian(nw), + Ellipsoid.WGS84.cartographicToCartesian(ne), + Ellipsoid.WGS84.cartographicToCartesian(se), + Ellipsoid.WGS84.cartographicToCartesian(sw)]); + }); + + it('subsample throws with no rectangle', function() { + expect(function() { + Rectangle.subsample(); + }).toThrowDeveloperError(); + }); + + it('equalsEpsilon throws with no epsilon', function() { + var rectangle = new Rectangle(west, south, east, north); + var other = new Rectangle(); + expect(function() { + rectangle.equalsEpsilon(other, undefined); + }).toThrowDeveloperError(); + }); + + it('intersectWith throws with no rectangle', function() { + var rectangle = new Rectangle(west, south, east, north); + expect(function() { + Rectangle.intersectWith(undefined); + }).toThrowDeveloperError(); + }); + + it('contains throws with no cartographic', function() { + var rectangle = new Rectangle(west, south, east, north); + expect(function() { + Rectangle.contains(rectangle, undefined); + }).toThrowDeveloperError(); + }); +}); \ No newline at end of file diff --git a/Specs/Scene/ArcGisImageServerTerrainProviderSpec.js b/Specs/Scene/ArcGisImageServerTerrainProviderSpec.js index f98e21111315..a0e7ba032288 100644 --- a/Specs/Scene/ArcGisImageServerTerrainProviderSpec.js +++ b/Specs/Scene/ArcGisImageServerTerrainProviderSpec.js @@ -114,7 +114,7 @@ defineSuite([ }); describe('requestTileGeometry', function() { - it('requests expanded extent to account for center versus edge', function() { + it('requests expanded rectangle to account for center versus edge', function() { var baseUrl = 'made/up/url'; loadImage.createImage = function(url, crossOrigin, deferred) { diff --git a/Specs/Scene/ArcGisMapServerImageryProviderSpec.js b/Specs/Scene/ArcGisMapServerImageryProviderSpec.js index f23f9cfbd061..223d95a2e30a 100644 --- a/Specs/Scene/ArcGisMapServerImageryProviderSpec.js +++ b/Specs/Scene/ArcGisMapServerImageryProviderSpec.js @@ -97,7 +97,7 @@ defineSuite([ expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme); expect(provider.credit).toBeDefined(); expect(provider.tileDiscardPolicy).toBeInstanceOf(DiscardMissingTileImagePolicy); - expect(provider.extent).toEqual(new WebMercatorTilingScheme().extent); + expect(provider.rectangle).toEqual(new WebMercatorTilingScheme().rectangle); expect(provider.usingPrecachedTiles).toEqual(true); loadImage.createImage = function(url, crossOrigin, deferred) { @@ -178,7 +178,7 @@ defineSuite([ expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme); expect(provider.credit).toBeDefined(); expect(provider.tileDiscardPolicy).toBeInstanceOf(DiscardMissingTileImagePolicy); - expect(provider.extent).toEqual(new GeographicTilingScheme().extent); + expect(provider.rectangle).toEqual(new GeographicTilingScheme().rectangle); expect(provider.usingPrecachedTiles).toEqual(true); loadImage.createImage = function(url, crossOrigin, deferred) { @@ -243,7 +243,7 @@ defineSuite([ expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme); expect(provider.credit).toBeDefined(); expect(provider.tileDiscardPolicy).toBeUndefined(); - expect(provider.extent).toEqual(new GeographicTilingScheme().extent); + expect(provider.rectangle).toEqual(new GeographicTilingScheme().rectangle); expect(provider.usingPrecachedTiles).toEqual(false); loadImage.createImage = function(url, crossOrigin, deferred) { @@ -327,7 +327,7 @@ defineSuite([ expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme); expect(provider.credit).toBeDefined(); expect(provider.tileDiscardPolicy).toBeInstanceOf(DiscardMissingTileImagePolicy); - expect(provider.extent).toEqual(new GeographicTilingScheme().extent); + expect(provider.rectangle).toEqual(new GeographicTilingScheme().rectangle); expect(provider.proxy).toEqual(proxy); expect(provider.usingPrecachedTiles).toEqual(true); diff --git a/Specs/Scene/BingMapsImageryProviderSpec.js b/Specs/Scene/BingMapsImageryProviderSpec.js index a72927429fdb..a04a5df03a76 100644 --- a/Specs/Scene/BingMapsImageryProviderSpec.js +++ b/Specs/Scene/BingMapsImageryProviderSpec.js @@ -143,7 +143,7 @@ defineSuite([ expect(provider.maximumLevel).toEqual(20); expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme); expect(provider.tileDiscardPolicy).toBeInstanceOf(DiscardMissingTileImagePolicy); - expect(provider.extent).toEqual(new WebMercatorTilingScheme().extent); + expect(provider.rectangle).toEqual(new WebMercatorTilingScheme().rectangle); }); waitsFor(function() { diff --git a/Specs/Scene/CameraFlightPathSpec.js b/Specs/Scene/CameraFlightPathSpec.js index 1df9c9160285..2e80be3616e8 100644 --- a/Specs/Scene/CameraFlightPathSpec.js +++ b/Specs/Scene/CameraFlightPathSpec.js @@ -5,7 +5,7 @@ defineSuite([ 'Core/Cartographic', 'Core/Ellipsoid', 'Core/Math', - 'Core/Extent', + 'Core/Rectangle', 'Core/Matrix4', 'Scene/OrthographicFrustum', 'Scene/SceneMode', @@ -17,7 +17,7 @@ defineSuite([ Cartographic, Ellipsoid, CesiumMath, - Extent, + Rectangle, Matrix4, OrthographicFrustum, SceneMode, @@ -99,17 +99,17 @@ defineSuite([ }).toThrowDeveloperError(); }); - it('create animation with extent throws without a scene', function() { + it('create animation with rectangle throws without a scene', function() { expect(function() { - CameraFlightPath.createAnimationExtent(undefined, { + CameraFlightPath.createAnimationRectangle(undefined, { destination : new Cartographic(0.0, 0.0, 1e6) }); }).toThrow(); }); - it('create animation with extent throws without a destination', function() { + it('create animation with rectangle throws without a destination', function() { expect(function() { - CameraFlightPath.createAnimationExtent(scene, {}); + CameraFlightPath.createAnimationRectangle(scene, {}); }).toThrowDeveloperError(); }); @@ -165,8 +165,8 @@ defineSuite([ expect(flight.easingFunction).toBeDefined(); }); - it('creates an animation with extent', function() { - var destination = new Extent(-1, -1, 1, 1); + it('creates an animation with rectangle', function() { + var destination = new Rectangle(-1, -1, 1, 1); var duration = 5000.0; var onComplete = function() { return true; @@ -175,7 +175,7 @@ defineSuite([ return true; }; - var flight = CameraFlightPath.createAnimationExtent(scene, { + var flight = CameraFlightPath.createAnimationRectangle(scene, { destination : destination, duration : duration, onComplete : onComplete, @@ -211,11 +211,11 @@ defineSuite([ }).toThrowDeveloperError(); }); - it('createAnimationExtent throws if mode is morphing', function() { + it('createAnimationRectangle throws if mode is morphing', function() { expect(function() { frameState.mode = SceneMode.MORPHING; - var destination = new Extent(-1, -1, 1, 1); - CameraFlightPath.createAnimationExtent(scene, { + var destination = new Rectangle(-1, -1, 1, 1); + CameraFlightPath.createAnimationRectangle(scene, { destination : destination }); }).toThrowDeveloperError(); @@ -282,7 +282,7 @@ defineSuite([ expect(camera.up).toEqualEpsilon(endUp, CesiumMath.EPSILON12); }); - it('creates an animation in 3d with extent', function() { + it('creates an animation in 3d with rectangle', function() { var camera = frameState.camera; var startPosition = frameState.scene2D.projection.ellipsoid.cartographicToCartesian(new Cartographic(CesiumMath.PI, 0, 20)); @@ -292,13 +292,13 @@ defineSuite([ var endPosition = Cartesian3.negate(startPosition); var endCartographic = frameState.scene2D.projection.ellipsoid.cartesianToCartographic(endPosition); - var extent = new Extent(endCartographic.longitude - 0.0000019, endCartographic.latitude - 0.0000019, endCartographic.longitude + 0.0000019, endCartographic.latitude + 0.0000019); + var rectangle = new Rectangle(endCartographic.longitude - 0.0000019, endCartographic.latitude - 0.0000019, endCartographic.longitude + 0.0000019, endCartographic.latitude + 0.0000019); var endDirection = Cartesian3.negate(startDirection); var endUp = Cartesian3.negate(startUp); var duration = 5000.0; - var flight = CameraFlightPath.createAnimationExtent(scene, { - destination : extent, + var flight = CameraFlightPath.createAnimationRectangle(scene, { + destination : rectangle, direction : endDirection, up : endUp, duration : duration @@ -396,7 +396,7 @@ defineSuite([ expect(camera.up).toEqualEpsilon(endUp, CesiumMath.EPSILON12); }); - it('creates an animation in Columbus view with extent', function() { + it('creates an animation in Columbus view with rectangle', function() { frameState.mode = SceneMode.COLUMBUS_VIEW; var camera = frameState.camera; camera._mode = SceneMode.COLUMBUS_VIEW; @@ -416,13 +416,13 @@ defineSuite([ var endPosition = Cartesian3.add(startPosition, new Cartesian3(-6e6 * Math.PI, 6e6 * CesiumMath.PI_OVER_FOUR, 20.0)); var endCartographic = frameState.scene2D.projection.unproject(endPosition); - var extent = new Extent(endCartographic.longitude - 0.0000019, endCartographic.latitude - 0.0000019, endCartographic.longitude + 0.0000019, endCartographic.latitude + 0.0000019); + var rectangle = new Rectangle(endCartographic.longitude - 0.0000019, endCartographic.latitude - 0.0000019, endCartographic.longitude + 0.0000019, endCartographic.latitude + 0.0000019); var endDirection = Cartesian3.clone(startDirection); var endUp = Cartesian3.negate(startUp); var duration = 5000.0; - var flight = CameraFlightPath.createAnimationExtent(scene, { - destination : extent, + var flight = CameraFlightPath.createAnimationRectangle(scene, { + destination : rectangle, direction : endDirection, up : endUp, duration : duration @@ -532,7 +532,7 @@ defineSuite([ expect(camera.frustum.right - camera.frustum.left).toEqual(endPosition.z); }); - it('creates an animation in 2D with extent', function() { + it('creates an animation in 2D with rectangle', function() { frameState.mode = SceneMode.SCENE2D; var camera = frameState.camera; camera._mode = SceneMode.SCENE2D; @@ -554,13 +554,13 @@ defineSuite([ var endPosition = Cartesian3.add(startPosition, new Cartesian3(-6e6 * Math.PI, 6e6 * CesiumMath.PI_OVER_FOUR, 0.0)); var endCartographic = frameState.scene2D.projection.unproject(endPosition); - var extent = new Extent(endCartographic.longitude - 0.0000019, endCartographic.latitude - 0.0000019, endCartographic.longitude + 0.0000019, endCartographic.latitude + 0.0000019); + var rectangle = new Rectangle(endCartographic.longitude - 0.0000019, endCartographic.latitude - 0.0000019, endCartographic.longitude + 0.0000019, endCartographic.latitude + 0.0000019); var endDirection = Cartesian3.clone(startDirection); var endUp = Cartesian3.negate(startUp); var duration = 5000.0; - var flight = CameraFlightPath.createAnimationExtent(scene, { - destination : extent, + var flight = CameraFlightPath.createAnimationRectangle(scene, { + destination : rectangle, direction : endDirection, up : endUp, duration : duration diff --git a/Specs/Scene/CameraSpec.js b/Specs/Scene/CameraSpec.js index 33de55e7f45e..af2088c746f8 100644 --- a/Specs/Scene/CameraSpec.js +++ b/Specs/Scene/CameraSpec.js @@ -6,7 +6,7 @@ defineSuite([ 'Core/Cartesian4', 'Core/Cartographic', 'Core/Ellipsoid', - 'Core/Extent', + 'Core/Rectangle', 'Core/GeographicProjection', 'Core/Math', 'Core/Matrix3', @@ -24,7 +24,7 @@ defineSuite([ Cartesian4, Cartographic, Ellipsoid, - Extent, + Rectangle, GeographicProjection, CesiumMath, Matrix3, @@ -758,65 +758,65 @@ defineSuite([ }).toThrowDeveloperError(); }); - it('viewExtent throws without extent', function() { + it('viewRectangle throws without rectangle', function() { expect(function () { - camera.viewExtent(); + camera.viewRectangle(); }).toThrowDeveloperError(); }); - it('views extent in 3D (1)', function() { - var extent = new Extent( + it('views rectangle in 3D (1)', function() { + var rectangle = new Rectangle( -Math.PI, -CesiumMath.PI_OVER_TWO, Math.PI, CesiumMath.PI_OVER_TWO); - camera.viewExtent(extent); + camera.viewRectangle(rectangle); expect(camera.position).toEqualEpsilon(new Cartesian3(11010217.979403382, 0.0, 0.0), CesiumMath.EPSILON6); expect(camera.direction).toEqualEpsilon(Cartesian3.negate(Cartesian3.UNIT_X), CesiumMath.EPSILON10); expect(camera.up).toEqualEpsilon(Cartesian3.UNIT_Z, CesiumMath.EPSILON10); expect(camera.right).toEqualEpsilon(Cartesian3.UNIT_Y, CesiumMath.EPSILON10); }); - it('views extent in 3D (2)', function() { - var extent = new Extent( + it('views rectangle in 3D (2)', function() { + var rectangle = new Rectangle( CesiumMath.toRadians(21.25), CesiumMath.toRadians(41.23), CesiumMath.toRadians(21.51), CesiumMath.toRadians(41.38)); - camera.viewExtent(extent, Ellipsoid.WGS84); + camera.viewRectangle(rectangle, Ellipsoid.WGS84); expect(camera.position).toEqualEpsilon(new Cartesian3(4478207.335705587, 1753173.8165311918, 4197410.895448539), CesiumMath.EPSILON6); expect(camera.direction).toEqualEpsilon(new Cartesian3(-0.6995107725362416, -0.2738515389883838, -0.6600681886740524), CesiumMath.EPSILON10); expect(camera.up).toEqualEpsilon(new Cartesian3(-0.6146449843355883, -0.24062742347984528, 0.7512056884106748), CesiumMath.EPSILON10); expect(camera.right).toEqualEpsilon(new Cartesian3(-0.36454934142973716, 0.9311840729217532, 0.0), CesiumMath.EPSILON10); }); - it('views extent in 3D (3)', function() { - var extent = new Extent( + it('views rectangle in 3D (3)', function() { + var rectangle = new Rectangle( CesiumMath.toRadians(90.0), CesiumMath.toRadians(-50.0), CesiumMath.toRadians(157.0), CesiumMath.toRadians(0.0)); - camera.viewExtent(extent); + camera.viewRectangle(rectangle); expect(camera.position).toEqualEpsilon(new Cartesian3(-6141929.663019788, 6904446.963087202, -5087100.779249599), CesiumMath.EPSILON6); expect(camera.direction).toEqualEpsilon(new Cartesian3(0.5813363216621468, -0.6535089167170689, 0.48474135050314004), CesiumMath.EPSILON10); expect(camera.up).toEqualEpsilon(new Cartesian3(-0.3221806693208934, 0.3621792280122498, 0.8746575461930182), CesiumMath.EPSILON10); expect(camera.right).toEqualEpsilon(new Cartesian3(-0.7471597536218517, -0.6646444933705039, 0.0), CesiumMath.EPSILON10); }); - it('views extent in 3D across IDL', function() { - var extent = new Extent( + it('views rectangle in 3D across IDL', function() { + var rectangle = new Rectangle( 0.1, -CesiumMath.PI_OVER_TWO, -0.1, CesiumMath.PI_OVER_TWO); - camera.viewExtent(extent); + camera.viewRectangle(rectangle); expect(camera.position).toEqualEpsilon(new Cartesian3(-11010217.979403382, 0.0, 0.0), CesiumMath.EPSILON6); expect(camera.direction).toEqualEpsilon(Cartesian3.UNIT_X, CesiumMath.EPSILON10); expect(camera.up).toEqualEpsilon(Cartesian3.UNIT_Z, CesiumMath.EPSILON10); expect(camera.right).toEqualEpsilon(Cartesian3.negate(Cartesian3.UNIT_Y), CesiumMath.EPSILON10); }); - it('views extent in 2D with larger longitude', function() { + it('views rectangle in 2D with larger longitude', function() { var frustum = new OrthographicFrustum(); frustum.left = -10.0; frustum.right = 10.0; @@ -826,7 +826,7 @@ defineSuite([ frustum.far = 21.0; camera.frustum = frustum; - var extent = new Extent( + var rectangle = new Rectangle( -CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_FOUR, CesiumMath.PI_OVER_TWO, @@ -837,7 +837,7 @@ defineSuite([ camera._mode = SceneMode.SCENE2D; camera._projection = projection; - camera.viewExtent(extent); + camera.viewRectangle(rectangle); expect(camera.position.x).toEqual(0); expect(camera.position.y).toEqual(0); @@ -847,7 +847,7 @@ defineSuite([ expect(frustum.bottom + expected <= CesiumMath.EPSILON14).toEqual(true); }); - it('views extent in 2D with larger latitude', function() { + it('views rectangle in 2D with larger latitude', function() { var frustum = new OrthographicFrustum(); frustum.left = -10.0; frustum.right = 10.0; @@ -857,7 +857,7 @@ defineSuite([ frustum.far = 21.0; camera.frustum = frustum; - var extent = new Extent( + var rectangle = new Rectangle( -CesiumMath.PI_OVER_FOUR, -CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_FOUR, @@ -868,7 +868,7 @@ defineSuite([ camera._mode = SceneMode.SCENE2D; camera._projection = projection; - camera.viewExtent(extent); + camera.viewRectangle(rectangle); expect(camera.position.x).toEqual(0); expect(camera.position.y).toEqual(0); @@ -878,8 +878,8 @@ defineSuite([ expect(frustum.bottom + expected <= CesiumMath.EPSILON14).toEqual(true); }); - it('views extent in Columbus View', function() { - var extent = new Extent( + it('views rectangle in Columbus View', function() { + var rectangle = new Rectangle( -CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO, @@ -887,21 +887,21 @@ defineSuite([ var projection = new GeographicProjection(); camera._mode = SceneMode.COLUMBUS_VIEW; camera._projection = projection; - camera.viewExtent(extent); + camera.viewRectangle(rectangle); expect(camera.position).toEqualEpsilon(new Cartesian3(0.0, 0.0, 17352991.253398113), CesiumMath.EPSILON8); expect(camera.direction).toEqualEpsilon(new Cartesian3(0.0, 0.0, -1.0), CesiumMath.EPSILON2); expect(camera.up).toEqualEpsilon(new Cartesian3(0.0, 1.0, 0.0), CesiumMath.EPSILON2); expect(camera.right).toEqualEpsilon(new Cartesian3(1.0, 0.0, 0.0), CesiumMath.EPSILON10); }); - it('getExtentCameraCoordinates throws without extent', function() { + it('getRectangleCameraCoordinates throws without rectangle', function() { expect(function () { - camera.getExtentCameraCoordinates(); + camera.getRectangleCameraCoordinates(); }).toThrowDeveloperError(); }); - it('getExtentCameraCoordinates extent in 3D', function() { - var extent = new Extent( + it('getRectangleCameraCoordinates rectangle in 3D', function() { + var rectangle = new Rectangle( -Math.PI, -CesiumMath.PI_OVER_TWO, Math.PI, @@ -911,15 +911,15 @@ defineSuite([ var up = Cartesian3.clone(camera.up); var right = Cartesian3.clone(camera.right); camera._mode = SceneMode.SCENE3D; - camera.getExtentCameraCoordinates(extent, position); + camera.getRectangleCameraCoordinates(rectangle, position); expect(position).toEqualEpsilon(new Cartesian3(11010217.979403382, 0.0, 0.0), CesiumMath.EPSILON6); expect(camera.direction).toEqual(direction); expect(camera.up).toEqual(up); expect(camera.right).toEqual(right); }); - it('gets coordinates for extent in 3D across IDL', function() { - var extent = new Extent( + it('gets coordinates for rectangle in 3D across IDL', function() { + var rectangle = new Rectangle( 0.1, -CesiumMath.PI_OVER_TWO, -0.1, @@ -929,15 +929,15 @@ defineSuite([ var up = Cartesian3.clone(camera.up); var right = Cartesian3.clone(camera.right); camera._mode = SceneMode.SCENE3D; - position = camera.getExtentCameraCoordinates(extent); + position = camera.getRectangleCameraCoordinates(rectangle); expect(position).toEqualEpsilon(new Cartesian3(-11010217.979403382, 0.0, 0.0), CesiumMath.EPSILON6); expect(camera.direction).toEqual(direction); expect(camera.up).toEqual(up); expect(camera.right).toEqual(right); }); - it('views extent in 2D with larger latitude', function() { - var extent = new Extent( + it('views rectangle in 2D with larger latitude', function() { + var rectangle = new Rectangle( -CesiumMath.PI_OVER_FOUR, -CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_FOUR, @@ -956,7 +956,7 @@ defineSuite([ cam._mode = SceneMode.SCENE2D; cam._projection = projection; - camera.position = cam.getExtentCameraCoordinates(extent); + camera.position = cam.getRectangleCameraCoordinates(rectangle); expect(camera.position.x).toEqual(0); expect(camera.position.y).toEqual(0); @@ -967,8 +967,8 @@ defineSuite([ }); - it('gets coordinates for extent in Columbus View', function() { - var extent = new Extent( + it('gets coordinates for rectangle in Columbus View', function() { + var rectangle = new Rectangle( -CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO, @@ -979,7 +979,7 @@ defineSuite([ var direction = Cartesian3.clone(camera.direction); var up = Cartesian3.clone(camera.up); var right = Cartesian3.clone(camera.right); - camera.position = camera.getExtentCameraCoordinates(extent); + camera.position = camera.getRectangleCameraCoordinates(rectangle); expect(camera.position).toEqualEpsilon(new Cartesian3(0.0, 0.0, 17352991.253398113), CesiumMath.EPSILON8); expect(camera.direction).toEqual(direction); expect(camera.up).toEqual(up); @@ -987,8 +987,8 @@ defineSuite([ }); - it('get extent coordinate returns camera position if scene mode is morphing', function() { - var extent = new Extent( + it('get rectangle coordinate returns camera position if scene mode is morphing', function() { + var rectangle = new Rectangle( -CesiumMath.PI_OVER_TWO, -CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO, @@ -1000,7 +1000,7 @@ defineSuite([ var direction = Cartesian3.clone(camera.direction); var up = Cartesian3.clone(camera.up); var right = Cartesian3.clone(camera.right); - camera.getExtentCameraCoordinates(extent, camera.position); + camera.getRectangleCameraCoordinates(rectangle, camera.position); expect(camera.position).toEqual(position); expect(camera.direction).toEqual(direction); expect(camera.up).toEqual(up); diff --git a/Specs/Scene/CentralBodySpec.js b/Specs/Scene/CentralBodySpec.js index 6d3651ad4334..27ca719bd3c3 100644 --- a/Specs/Scene/CentralBodySpec.js +++ b/Specs/Scene/CentralBodySpec.js @@ -3,7 +3,7 @@ defineSuite([ 'Scene/CentralBody', 'Core/defined', 'Core/Ellipsoid', - 'Core/Extent', + 'Core/Rectangle', 'Renderer/ClearCommand', 'Scene/SingleTileImageryProvider', 'Specs/createContext', @@ -14,7 +14,7 @@ defineSuite([ CentralBody, defined, Ellipsoid, - Extent, + Rectangle, ClearCommand, SingleTileImageryProvider, createContext, @@ -66,7 +66,7 @@ defineSuite([ layerCollection.removeAll(); layerCollection.addImageryProvider(new SingleTileImageryProvider({url : 'Data/Images/Red16x16.png'})); - frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); + frameState.camera.viewRectangle(new Rectangle(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); updateUntilDone(cb); diff --git a/Specs/Scene/CentralBodySurfaceSpec.js b/Specs/Scene/CentralBodySurfaceSpec.js index 361281df01b1..b5879f715755 100644 --- a/Specs/Scene/CentralBodySurfaceSpec.js +++ b/Specs/Scene/CentralBodySurfaceSpec.js @@ -8,7 +8,7 @@ defineSuite([ 'Core/Cartesian3', 'Core/defined', 'Core/Ellipsoid', - 'Core/Extent', + 'Core/Rectangle', 'Core/GeographicProjection', 'Core/WebMercatorProjection', 'Scene/CentralBody', @@ -27,7 +27,7 @@ defineSuite([ Cartesian3, defined, Ellipsoid, - Extent, + Rectangle, GeographicProjection, WebMercatorProjection, CentralBody, @@ -88,7 +88,7 @@ defineSuite([ frustum.bottom = -frustum.top; frameState.camera.frustum = frustum; frameState.camera.update(frameState.mode, frameState.scene2D); - frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0030, 0.0030), frameState.scene2D.projection); + frameState.camera.viewRectangle(new Rectangle(0.0001, 0.0001, 0.0030, 0.0030), frameState.scene2D.projection); } var context; @@ -289,7 +289,7 @@ defineSuite([ layerCollection.addImageryProvider(new SingleTileImageryProvider({url : 'Data/Images/Red16x16.png'})); frameState.camera.update(SceneMode.COLUMBUS_VIEW, { projection : new GeographicProjection(Ellipsoid.WGS84) }); - frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0030, 0.0030), Ellipsoid.WGS84); + frameState.camera.viewRectangle(new Rectangle(0.0001, 0.0001, 0.0030, 0.0030), Ellipsoid.WGS84); updateUntilDone(cb); @@ -304,7 +304,7 @@ defineSuite([ layerCollection.addImageryProvider(new SingleTileImageryProvider({url : 'Data/Images/Red16x16.png'})); frameState.camera.update(SceneMode.COLUMBUS_VIEW, { projection : new GeographicProjection(Ellipsoid.WGS84) }); - frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0030, 0.0030), Ellipsoid.WGS84); + frameState.camera.viewRectangle(new Rectangle(0.0001, 0.0001, 0.0030, 0.0030), Ellipsoid.WGS84); updateUntilDone(cb); @@ -318,7 +318,7 @@ defineSuite([ layerCollection.removeAll(); layerCollection.addImageryProvider(new SingleTileImageryProvider({url : 'Data/Images/Red16x16.png'})); - frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); + frameState.camera.viewRectangle(new Rectangle(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); updateUntilDone(cb); @@ -332,7 +332,7 @@ defineSuite([ layerCollection.removeAll(); layerCollection.addImageryProvider(new SingleTileImageryProvider({url : 'Data/Images/Red16x16.png'})); - frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); + frameState.camera.viewRectangle(new Rectangle(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); updateUntilDone(cb); @@ -340,7 +340,7 @@ defineSuite([ expect(render(context, frameState, cb)).toBeGreaterThan(0); frameState.camera.update(SceneMode.COLUMBUS_VIEW, { projection : new GeographicProjection(Ellipsoid.WGS84) }); - frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0030, 0.0030), Ellipsoid.WGS84); + frameState.camera.viewRectangle(new Rectangle(0.0001, 0.0001, 0.0030, 0.0030), Ellipsoid.WGS84); }); updateUntilDone(cb); @@ -361,7 +361,7 @@ defineSuite([ layerCollection.addImageryProvider(providerWithInvalidRootTiles); - frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); + frameState.camera.viewRectangle(new Rectangle(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); updateUntilDone(cb); @@ -382,7 +382,7 @@ defineSuite([ layer.saturation = 0.123; layer.hue = 0.456; - frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); + frameState.camera.viewRectangle(new Rectangle(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); updateUntilDone(cb); @@ -437,7 +437,7 @@ defineSuite([ layer.saturation = createFunction(0.123); layer.hue = createFunction(0.456); - frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); + frameState.camera.viewRectangle(new Rectangle(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); updateUntilDone(cb); @@ -476,7 +476,7 @@ defineSuite([ layer.alpha = 0.0; - frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); + frameState.camera.viewRectangle(new Rectangle(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84); updateUntilDone(cb); diff --git a/Specs/Scene/DebugAppearanceSpec.js b/Specs/Scene/DebugAppearanceSpec.js index 5a994f3c5b31..4eabd33f7ffe 100644 --- a/Specs/Scene/DebugAppearanceSpec.js +++ b/Specs/Scene/DebugAppearanceSpec.js @@ -3,8 +3,8 @@ defineSuite([ 'Scene/DebugAppearance', 'Scene/Appearance', 'Scene/Primitive', - 'Core/ExtentGeometry', - 'Core/Extent', + 'Core/RectangleGeometry', + 'Core/Rectangle', 'Core/GeometryInstance', 'Core/GeometryInstanceAttribute', 'Core/ComponentDatatype', @@ -18,8 +18,8 @@ defineSuite([ DebugAppearance, Appearance, Primitive, - ExtentGeometry, - Extent, + RectangleGeometry, + Rectangle, GeometryInstance, GeometryInstanceAttribute, ComponentDatatype, @@ -34,21 +34,21 @@ defineSuite([ var context; var frameState; - var extentInstance; + var rectangleInstance; beforeAll(function() { context = createContext(); frameState = createFrameState(); - var extent = Extent.fromDegrees(-10.0, -10.0, 10.0, 10.0); - extentInstance = new GeometryInstance({ - geometry : new ExtentGeometry({ + var rectangle = Rectangle.fromDegrees(-10.0, -10.0, 10.0, 10.0); + rectangleInstance = new GeometryInstance({ + geometry : new RectangleGeometry({ vertexFormat : VertexFormat.ALL, - extent : extent + rectangle : rectangle }) }); - frameState.camera.viewExtent(extent); + frameState.camera.viewRectangle(rectangle); var us = context.uniformState; us.update(context, frameState); }); @@ -177,7 +177,7 @@ defineSuite([ it('renders normal', function() { var primitive = new Primitive({ - geometryInstances : extentInstance, + geometryInstances : rectangleInstance, appearance : new DebugAppearance({ attributeName : 'normal' }), @@ -195,7 +195,7 @@ defineSuite([ it('renders binormal', function() { var primitive = new Primitive({ - geometryInstances : extentInstance, + geometryInstances : rectangleInstance, appearance : new DebugAppearance({ attributeName : 'binormal' }), @@ -213,7 +213,7 @@ defineSuite([ it('renders tangent', function() { var primitive = new Primitive({ - geometryInstances : extentInstance, + geometryInstances : rectangleInstance, appearance : new DebugAppearance({ attributeName : 'tangent' }), @@ -231,7 +231,7 @@ defineSuite([ it('renders st', function() { var primitive = new Primitive({ - geometryInstances : extentInstance, + geometryInstances : rectangleInstance, appearance : new DebugAppearance({ attributeName : 'st' }), @@ -248,7 +248,7 @@ defineSuite([ }); it('renders float', function() { - extentInstance.attributes = { + rectangleInstance.attributes = { debug : new GeometryInstanceAttribute({ componentDatatype : ComponentDatatype.FLOAT, componentsPerAttribute : 1, @@ -256,7 +256,7 @@ defineSuite([ }) }; var primitive = new Primitive({ - geometryInstances : extentInstance, + geometryInstances : rectangleInstance, appearance : new DebugAppearance({ attributeName : 'debug', glslDatatype : 'float' @@ -274,7 +274,7 @@ defineSuite([ }); it('renders vec2', function() { - extentInstance.attributes = { + rectangleInstance.attributes = { debug : new GeometryInstanceAttribute({ componentDatatype : ComponentDatatype.FLOAT, componentsPerAttribute : 2, @@ -282,7 +282,7 @@ defineSuite([ }) }; var primitive = new Primitive({ - geometryInstances : extentInstance, + geometryInstances : rectangleInstance, appearance : new DebugAppearance({ attributeName : 'debug', glslDatatype : 'vec2' @@ -300,7 +300,7 @@ defineSuite([ }); it('renders vec3', function() { - extentInstance.attributes = { + rectangleInstance.attributes = { debug : new GeometryInstanceAttribute({ componentDatatype : ComponentDatatype.FLOAT, componentsPerAttribute : 3, @@ -308,7 +308,7 @@ defineSuite([ }) }; var primitive = new Primitive({ - geometryInstances : extentInstance, + geometryInstances : rectangleInstance, appearance : new DebugAppearance({ attributeName : 'debug', glslDatatype : 'vec3' @@ -326,7 +326,7 @@ defineSuite([ }); it('renders vec4', function() { - extentInstance.attributes = { + rectangleInstance.attributes = { debug : new GeometryInstanceAttribute({ componentDatatype : ComponentDatatype.FLOAT, componentsPerAttribute : 3, @@ -334,7 +334,7 @@ defineSuite([ }) }; var primitive = new Primitive({ - geometryInstances : extentInstance, + geometryInstances : rectangleInstance, appearance : new DebugAppearance({ attributeName : 'debug', glslDatatype : 'vec4' diff --git a/Specs/Scene/EllipsoidSurfaceAppearanceSpec.js b/Specs/Scene/EllipsoidSurfaceAppearanceSpec.js index 83629ce0dc9c..19f3233a4064 100644 --- a/Specs/Scene/EllipsoidSurfaceAppearanceSpec.js +++ b/Specs/Scene/EllipsoidSurfaceAppearanceSpec.js @@ -4,8 +4,8 @@ defineSuite([ 'Scene/Appearance', 'Scene/Material', 'Scene/Primitive', - 'Core/ExtentGeometry', - 'Core/Extent', + 'Core/RectangleGeometry', + 'Core/Rectangle', 'Core/GeometryInstance', 'Core/ColorGeometryInstanceAttribute', 'Renderer/ClearCommand', @@ -18,8 +18,8 @@ defineSuite([ Appearance, Material, Primitive, - ExtentGeometry, - Extent, + RectangleGeometry, + Rectangle, GeometryInstance, ColorGeometryInstanceAttribute, ClearCommand, @@ -38,11 +38,11 @@ defineSuite([ context = createContext(); frameState = createFrameState(); - var extent = Extent.fromDegrees(-10.0, -10.0, 10.0, 10.0); + var rectangle = Rectangle.fromDegrees(-10.0, -10.0, 10.0, 10.0); primitive = new Primitive({ geometryInstances : new GeometryInstance({ - geometry : new ExtentGeometry({ - extent : extent + geometry : new RectangleGeometry({ + rectangle : rectangle }), attributes : { color : new ColorGeometryInstanceAttribute(1.0, 1.0, 0.0, 1.0) @@ -51,7 +51,7 @@ defineSuite([ asynchronous : false }); - frameState.camera.viewExtent(extent); + frameState.camera.viewRectangle(rectangle); var us = context.uniformState; us.update(context, frameState); }); diff --git a/Specs/Scene/GeographicTilingSchemeSpec.js b/Specs/Scene/GeographicTilingSchemeSpec.js index 8b2f5bf2ca59..02fcc82b70e1 100644 --- a/Specs/Scene/GeographicTilingSchemeSpec.js +++ b/Specs/Scene/GeographicTilingSchemeSpec.js @@ -3,7 +3,7 @@ defineSuite([ 'Scene/GeographicTilingScheme', 'Core/Cartesian2', 'Core/Cartographic', - 'Core/Extent', + 'Core/Rectangle', 'Core/GeographicProjection', 'Core/Math', 'Scene/TilingScheme' @@ -11,7 +11,7 @@ defineSuite([ GeographicTilingScheme, Cartesian2, Cartographic, - Extent, + Rectangle, GeographicProjection, CesiumMath, TilingScheme) { @@ -22,33 +22,33 @@ defineSuite([ expect(GeographicTilingScheme).toConformToInterface(TilingScheme); }); - describe('Conversions from tile indices to cartographic extents.', function() { - it('tileXYToExtent returns full extent for single root tile.', function() { + describe('Conversions from tile indices to cartographic rectangles.', function() { + it('tileXYToRectangle returns full rectangle for single root tile.', function() { var tilingScheme = new GeographicTilingScheme({ numberOfLevelZeroTilesX : 1, numberOfLevelZeroTilesY : 1 }); - var tilingSchemeExtent = tilingScheme.extent; - var extent = tilingScheme.tileXYToExtent(0, 0, 0); - expect(extent.west).toEqualEpsilon(tilingSchemeExtent.west, CesiumMath.EPSILON10); - expect(extent.south).toEqualEpsilon(tilingSchemeExtent.south, CesiumMath.EPSILON10); - expect(extent.east).toEqualEpsilon(tilingSchemeExtent.east, CesiumMath.EPSILON10); - expect(extent.north).toEqualEpsilon(tilingSchemeExtent.north, CesiumMath.EPSILON10); + var tilingSchemeRectangle = tilingScheme.rectangle; + var rectangle = tilingScheme.tileXYToRectangle(0, 0, 0); + expect(rectangle.west).toEqualEpsilon(tilingSchemeRectangle.west, CesiumMath.EPSILON10); + expect(rectangle.south).toEqualEpsilon(tilingSchemeRectangle.south, CesiumMath.EPSILON10); + expect(rectangle.east).toEqualEpsilon(tilingSchemeRectangle.east, CesiumMath.EPSILON10); + expect(rectangle.north).toEqualEpsilon(tilingSchemeRectangle.north, CesiumMath.EPSILON10); }); - it('tileXYToExtent uses result parameter if provided', function() { + it('tileXYToRectangle uses result parameter if provided', function() { var tilingScheme = new GeographicTilingScheme({ numberOfLevelZeroTilesX : 1, numberOfLevelZeroTilesY : 1 }); - var tilingSchemeExtent = tilingScheme.extent; - var result = new Extent(0.0, 0.0, 0.0); - var extent = tilingScheme.tileXYToExtent(0, 0, 0, result); - expect(result).toEqual(extent); - expect(extent.west).toEqualEpsilon(tilingSchemeExtent.west, CesiumMath.EPSILON10); - expect(extent.south).toEqualEpsilon(tilingSchemeExtent.south, CesiumMath.EPSILON10); - expect(extent.east).toEqualEpsilon(tilingSchemeExtent.east, CesiumMath.EPSILON10); - expect(extent.north).toEqualEpsilon(tilingSchemeExtent.north, CesiumMath.EPSILON10); + var tilingSchemeRectangle = tilingScheme.rectangle; + var result = new Rectangle(0.0, 0.0, 0.0); + var rectangle = tilingScheme.tileXYToRectangle(0, 0, 0, result); + expect(result).toEqual(rectangle); + expect(rectangle.west).toEqualEpsilon(tilingSchemeRectangle.west, CesiumMath.EPSILON10); + expect(rectangle.south).toEqualEpsilon(tilingSchemeRectangle.south, CesiumMath.EPSILON10); + expect(rectangle.east).toEqualEpsilon(tilingSchemeRectangle.east, CesiumMath.EPSILON10); + expect(rectangle.north).toEqualEpsilon(tilingSchemeRectangle.north, CesiumMath.EPSILON10); }); it('tiles are numbered from the northwest corner.', function() { @@ -56,10 +56,10 @@ defineSuite([ numberOfLevelZeroTilesX: 2, numberOfLevelZeroTilesY: 2 }); - var northwest = tilingScheme.tileXYToExtent(0, 0, 1); - var northeast = tilingScheme.tileXYToExtent(1, 0, 1); - var southeast = tilingScheme.tileXYToExtent(1, 1, 1); - var southwest = tilingScheme.tileXYToExtent(0, 1, 1); + var northwest = tilingScheme.tileXYToRectangle(0, 0, 1); + var northeast = tilingScheme.tileXYToRectangle(1, 0, 1); + var southeast = tilingScheme.tileXYToRectangle(1, 1, 1); + var southwest = tilingScheme.tileXYToRectangle(0, 1, 1); expect(northeast.north).toEqual(northwest.north); expect(northeast.south).toEqual(northwest.south); @@ -87,10 +87,10 @@ defineSuite([ numberOfLevelZeroTilesX: 2, numberOfLevelZeroTilesY: 2 }); - var northwest = tilingScheme.tileXYToExtent(0, 0, 1); - var northeast = tilingScheme.tileXYToExtent(1, 0, 1); - var southeast = tilingScheme.tileXYToExtent(1, 1, 1); - var southwest = tilingScheme.tileXYToExtent(0, 1, 1); + var northwest = tilingScheme.tileXYToRectangle(0, 0, 1); + var northeast = tilingScheme.tileXYToRectangle(1, 0, 1); + var southeast = tilingScheme.tileXYToRectangle(1, 1, 1); + var southwest = tilingScheme.tileXYToRectangle(0, 1, 1); expect(northeast.south).toEqualEpsilon(southeast.north, CesiumMath.EPSILON15); expect(northwest.south).toEqualEpsilon(southwest.north, CesiumMath.EPSILON15); @@ -105,34 +105,34 @@ defineSuite([ expect(tilingScheme.projection).toBeInstanceOf(GeographicProjection); }); - describe('extentToNativeExtent', function() { + describe('rectangleToNativeRectangle', function() { it('converts radians to degrees', function() { var tilingScheme = new GeographicTilingScheme(); - var extentInRadians = new Extent(0.1, 0.2, 0.3, 0.4); - var nativeExtent = tilingScheme.extentToNativeExtent(extentInRadians); - expect(nativeExtent.west).toEqualEpsilon(extentInRadians.west * 180 / Math.PI, CesiumMath.EPSILON13); - expect(nativeExtent.south).toEqualEpsilon(extentInRadians.south * 180 / Math.PI, CesiumMath.EPSILON13); - expect(nativeExtent.east).toEqualEpsilon(extentInRadians.east * 180 / Math.PI, CesiumMath.EPSILON13); - expect(nativeExtent.north).toEqualEpsilon(extentInRadians.north * 180 / Math.PI, CesiumMath.EPSILON13); + var rectangleInRadians = new Rectangle(0.1, 0.2, 0.3, 0.4); + var nativeRectangle = tilingScheme.rectangleToNativeRectangle(rectangleInRadians); + expect(nativeRectangle.west).toEqualEpsilon(rectangleInRadians.west * 180 / Math.PI, CesiumMath.EPSILON13); + expect(nativeRectangle.south).toEqualEpsilon(rectangleInRadians.south * 180 / Math.PI, CesiumMath.EPSILON13); + expect(nativeRectangle.east).toEqualEpsilon(rectangleInRadians.east * 180 / Math.PI, CesiumMath.EPSILON13); + expect(nativeRectangle.north).toEqualEpsilon(rectangleInRadians.north * 180 / Math.PI, CesiumMath.EPSILON13); }); it('uses result parameter if provided', function() { var tilingScheme = new GeographicTilingScheme(); - var extentInRadians = new Extent(0.1, 0.2, 0.3, 0.4); - var resultExtent = new Extent(0.0, 0.0, 0.0, 0.0); - var outputExtent = tilingScheme.extentToNativeExtent(extentInRadians, resultExtent); - expect(outputExtent).toEqual(resultExtent); - expect(resultExtent.west).toEqualEpsilon(extentInRadians.west * 180 / Math.PI, CesiumMath.EPSILON13); - expect(resultExtent.south).toEqualEpsilon(extentInRadians.south * 180 / Math.PI, CesiumMath.EPSILON13); - expect(resultExtent.east).toEqualEpsilon(extentInRadians.east * 180 / Math.PI, CesiumMath.EPSILON13); - expect(resultExtent.north).toEqualEpsilon(extentInRadians.north * 180 / Math.PI, CesiumMath.EPSILON13); + var rectangleInRadians = new Rectangle(0.1, 0.2, 0.3, 0.4); + var resultRectangle = new Rectangle(0.0, 0.0, 0.0, 0.0); + var outputRectangle = tilingScheme.rectangleToNativeRectangle(rectangleInRadians, resultRectangle); + expect(outputRectangle).toEqual(resultRectangle); + expect(resultRectangle.west).toEqualEpsilon(rectangleInRadians.west * 180 / Math.PI, CesiumMath.EPSILON13); + expect(resultRectangle.south).toEqualEpsilon(rectangleInRadians.south * 180 / Math.PI, CesiumMath.EPSILON13); + expect(resultRectangle.east).toEqualEpsilon(rectangleInRadians.east * 180 / Math.PI, CesiumMath.EPSILON13); + expect(resultRectangle.north).toEqualEpsilon(rectangleInRadians.north * 180 / Math.PI, CesiumMath.EPSILON13); }); }); describe('positionToTileXY', function() { - it('returns undefined when outside extent', function() { + it('returns undefined when outside rectangle', function() { var tilingScheme = new GeographicTilingScheme({ - extent : new Extent(0.1, 0.2, 0.3, 0.4) + rectangle : new Rectangle(0.1, 0.2, 0.3, 0.4) }); var tooFarWest = new Cartographic(0.05, 0.3); diff --git a/Specs/Scene/GeometryRenderingSpec.js b/Specs/Scene/GeometryRenderingSpec.js index 96b3298c1c7f..383e846da73f 100644 --- a/Specs/Scene/GeometryRenderingSpec.js +++ b/Specs/Scene/GeometryRenderingSpec.js @@ -7,7 +7,7 @@ defineSuite([ 'Core/EllipseGeometry', 'Core/EllipsoidGeometry', 'Core/SphereGeometry', - 'Core/ExtentGeometry', + 'Core/RectangleGeometry', 'Core/PolygonGeometry', 'Core/SimplePolylineGeometry', 'Core/PolylineGeometry', @@ -24,7 +24,7 @@ defineSuite([ 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Matrix4', - 'Core/Extent', + 'Core/Rectangle', 'Core/Ellipsoid', 'Core/PrimitiveType', 'Core/PolylineVolumeGeometry', @@ -54,7 +54,7 @@ defineSuite([ EllipseGeometry, EllipsoidGeometry, SphereGeometry, - ExtentGeometry, + RectangleGeometry, PolygonGeometry, SimplePolylineGeometry, PolylineGeometry, @@ -71,7 +71,7 @@ defineSuite([ Cartesian2, Cartesian3, Matrix4, - Extent, + Rectangle, Ellipsoid, PrimitiveType, PolylineVolumeGeometry, @@ -677,18 +677,18 @@ defineSuite([ }); }, 'WebGL'); - describe('ExtentGeometry', function() { + describe('RectangleGeometry', function() { var instance; - var extent; + var rectangle; beforeAll(function() { - extent = Extent.fromDegrees(0, 0, 1, 1); + rectangle = Rectangle.fromDegrees(0, 0, 1, 1); instance = new GeometryInstance({ - geometry : new ExtentGeometry({ + geometry : new RectangleGeometry({ vertexFormat : PerInstanceColorAppearance.FLAT_VERTEX_FORMAT, ellipsoid : ellipsoid, - extent : extent + rectangle : rectangle }), - id : 'extent', + id : 'rectangle', attributes : { color : new ColorGeometryInstanceAttribute(1.0, 1.0, 0.0, 1.0) } @@ -717,10 +717,10 @@ defineSuite([ it('rotated geometry', function() { var rotated = new GeometryInstance({ - geometry : new ExtentGeometry({ + geometry : new RectangleGeometry({ vertexFormat : PerInstanceColorAppearance.FLAT_VERTEX_FORMAT, ellipsoid : ellipsoid, - extent : extent, + rectangle : rectangle, rotation : CesiumMath.PI_OVER_FOUR }), attributes : { @@ -732,10 +732,10 @@ defineSuite([ it('rotated texture', function() { var rotated = new GeometryInstance({ - geometry : new ExtentGeometry({ + geometry : new RectangleGeometry({ vertexFormat : EllipsoidSurfaceAppearance.VERTEX_FORMAT, ellipsoid : ellipsoid, - extent : extent, + rectangle : rectangle, stRotation : CesiumMath.PI_OVER_TWO }) }); @@ -747,10 +747,10 @@ defineSuite([ it('at height', function() { var atHeight = new GeometryInstance({ - geometry : new ExtentGeometry({ + geometry : new RectangleGeometry({ vertexFormat : PerInstanceColorAppearance.FLAT_VERTEX_FORMAT, ellipsoid : ellipsoid, - extent : extent, + rectangle : rectangle, height : 100000.0 }), attributes : { @@ -761,24 +761,24 @@ defineSuite([ }); }, 'WebGL'); - describe('Extruded ExtentGeometry', function() { + describe('Extruded RectangleGeometry', function() { var instance; - var extent; + var rectangle; var extrudedHeight; var geometryHeight; beforeAll(function() { - extent = Extent.fromDegrees(-1, -1, 1, 1); + rectangle = Rectangle.fromDegrees(-1, -1, 1, 1); extrudedHeight = 200000.0; geometryHeight = 100000.0; instance = new GeometryInstance({ - geometry : new ExtentGeometry({ + geometry : new RectangleGeometry({ vertexFormat : PerInstanceColorAppearance.FLAT_VERTEX_FORMAT, ellipsoid : ellipsoid, - extent : extent, + rectangle : rectangle, height : geometryHeight, extrudedHeight : extrudedHeight }), - id : 'extent', + id : 'rectangle', attributes : { color : new ColorGeometryInstanceAttribute(1.0, 1.0, 0.0, 1.0) } diff --git a/Specs/Scene/GoogleEarthImageryProviderSpec.js b/Specs/Scene/GoogleEarthImageryProviderSpec.js index 2851c0186c14..067466c6a936 100644 --- a/Specs/Scene/GoogleEarthImageryProviderSpec.js +++ b/Specs/Scene/GoogleEarthImageryProviderSpec.js @@ -6,7 +6,7 @@ defineSuite([ 'Core/FeatureDetection', 'Core/loadImage', 'Core/loadWithXhr', - 'Core/Extent', + 'Core/Rectangle', 'Scene/Imagery', 'Scene/ImageryLayer', 'Scene/ImageryProvider', @@ -22,7 +22,7 @@ defineSuite([ FeatureDetection, loadImage, loadWithXhr, - Extent, + Rectangle, Imagery, ImageryLayer, ImageryProvider, @@ -95,7 +95,7 @@ defineSuite([ expect(provider.version).toEqual(version); expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme); expect(provider.tileDiscardPolicy).toBeUndefined(); - expect(provider.extent).toEqual(new WebMercatorTilingScheme().extent); + expect(provider.rectangle).toEqual(new WebMercatorTilingScheme().rectangle); }); waitsFor(function() { @@ -350,7 +350,7 @@ defineSuite([ runs(function() { expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme); - expect(provider.extent).toEqual(new WebMercatorTilingScheme().extent); + expect(provider.rectangle).toEqual(new WebMercatorTilingScheme().rectangle); }); }); @@ -385,7 +385,7 @@ defineSuite([ runs(function() { expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme); - expect(provider.extent).toEqual(new WebMercatorTilingScheme().extent); + expect(provider.rectangle).toEqual(new WebMercatorTilingScheme().rectangle); }); }); @@ -420,7 +420,7 @@ defineSuite([ runs(function() { expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme); - expect(provider.extent).toEqual(new Extent(-Math.PI, -Math.PI, Math.PI, Math.PI)); + expect(provider.rectangle).toEqual(new Rectangle(-Math.PI, -Math.PI, Math.PI, Math.PI)); }); }); diff --git a/Specs/Scene/GridImageryProviderSpec.js b/Specs/Scene/GridImageryProviderSpec.js index c47600d2e8b8..40b6e2951e13 100644 --- a/Specs/Scene/GridImageryProviderSpec.js +++ b/Specs/Scene/GridImageryProviderSpec.js @@ -35,7 +35,7 @@ defineSuite([ expect(provider.maximumLevel).toBeUndefined(); expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme); expect(provider.tileDiscardPolicy).toBeUndefined(); - expect(provider.extent).toEqual(new GeographicTilingScheme().extent); + expect(provider.rectangle).toEqual(new GeographicTilingScheme().rectangle); when(provider.requestImage(0, 0, 0), function(image) { tile000Image = image; diff --git a/Specs/Scene/HeightmapTessellatorSpec.js b/Specs/Scene/HeightmapTessellatorSpec.js index 0901078e08a5..eb00387d796a 100644 --- a/Specs/Scene/HeightmapTessellatorSpec.js +++ b/Specs/Scene/HeightmapTessellatorSpec.js @@ -4,7 +4,7 @@ defineSuite([ 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Ellipsoid', - 'Core/Extent', + 'Core/Rectangle', 'Core/Math', 'Core/WebMercatorProjection' ], function( @@ -12,7 +12,7 @@ defineSuite([ Cartesian2, Cartesian3, Ellipsoid, - Extent, + Rectangle, CesiumMath, WebMercatorProjection) { "use strict"; @@ -28,7 +28,7 @@ defineSuite([ width : 2, height : 2, vertices : [], - nativeExtent : { + nativeRectangle : { west : 10.0, south : 20.0, east : 20.0, @@ -45,7 +45,7 @@ defineSuite([ heightmap : [1.0, 2.0, 3.0, 4.0], height : 2, vertices : [], - nativeExtent : { + nativeRectangle : { west : 10.0, south : 20.0, east : 20.0, @@ -60,7 +60,7 @@ defineSuite([ heightmap : [1.0, 2.0, 3.0, 4.0], width : 2, vertices : [], - nativeExtent : { + nativeRectangle : { west : 10.0, south : 20.0, east : 20.0, @@ -77,7 +77,7 @@ defineSuite([ heightmap : [1.0, 2.0, 3.0, 4.0], width : 2, height : 2, - nativeExtent : { + nativeRectangle : { west : 10.0, south : 20.0, east : 20.0, @@ -88,7 +88,7 @@ defineSuite([ }).toThrowDeveloperError(); }); - it('throws when nativeExtent is not provided', function() { + it('throws when nativeRectangle is not provided', function() { expect(function() { HeightmapTessellator.computeVertices({ heightmap : [1.0, 2.0, 3.0, 4.0], @@ -107,7 +107,7 @@ defineSuite([ width : 2, height : 2, vertices : [], - nativeExtent : { + nativeRectangle : { west : 10.0, south : 20.0, east : 20.0, @@ -127,13 +127,13 @@ defineSuite([ width : width, height : height, skirtHeight : 0.0, - nativeExtent : { + nativeRectangle : { west : 10.0, south : 30.0, east : 20.0, north : 40.0 }, - extent : new Extent( + rectangle : new Rectangle( CesiumMath.toRadians(10.0), CesiumMath.toRadians(30.0), CesiumMath.toRadians(20.0), @@ -142,13 +142,13 @@ defineSuite([ HeightmapTessellator.computeVertices(description); var ellipsoid = Ellipsoid.WGS84; - var nativeExtent = description.nativeExtent; + var nativeRectangle = description.nativeRectangle; for (var j = 0; j < height; ++j) { - var latitude = CesiumMath.lerp(nativeExtent.north, nativeExtent.south, j / (height - 1)); + var latitude = CesiumMath.lerp(nativeRectangle.north, nativeRectangle.south, j / (height - 1)); latitude = CesiumMath.toRadians(latitude); for (var i = 0; i < width; ++i) { - var longitude = CesiumMath.lerp(nativeExtent.west, nativeExtent.east, i / (width - 1)); + var longitude = CesiumMath.lerp(nativeRectangle.west, nativeRectangle.east, i / (width - 1)); longitude = CesiumMath.toRadians(longitude); var heightSample = description.heightmap[j * width + i]; @@ -180,7 +180,7 @@ defineSuite([ width : width, height : height, skirtHeight : 10.0, - nativeExtent : { + nativeRectangle : { west : 10.0, east : 20.0, south : 30.0, @@ -190,15 +190,15 @@ defineSuite([ HeightmapTessellator.computeVertices(description); var ellipsoid = Ellipsoid.WGS84; - var nativeExtent = description.nativeExtent; + var nativeRectangle = description.nativeRectangle; for (var j = -1; j <= height; ++j) { var realJ = CesiumMath.clamp(j, 0, height - 1); - var latitude = CesiumMath.lerp(nativeExtent.north, nativeExtent.south, realJ / (height - 1)); + var latitude = CesiumMath.lerp(nativeRectangle.north, nativeRectangle.south, realJ / (height - 1)); latitude = CesiumMath.toRadians(latitude); for (var i = -1; i <= width; ++i) { var realI = CesiumMath.clamp(i, 0, width - 1); - var longitude = CesiumMath.lerp(nativeExtent.west, nativeExtent.east, realI / (width - 1)); + var longitude = CesiumMath.lerp(nativeRectangle.west, nativeRectangle.east, realI / (width - 1)); longitude = CesiumMath.toRadians(longitude); var heightSample = description.heightmap[realJ * width + realI]; @@ -234,7 +234,7 @@ defineSuite([ width : width, height : height, skirtHeight : 0.0, - nativeExtent : { + nativeRectangle : { west : 1000000.0, east : 2000000.0, south : 3000000.0, @@ -246,15 +246,15 @@ defineSuite([ var ellipsoid = Ellipsoid.WGS84; var projection = new WebMercatorProjection(ellipsoid); - var nativeExtent = description.nativeExtent; + var nativeRectangle = description.nativeRectangle; - var geographicSouthwest = projection.unproject(new Cartesian2(nativeExtent.west, nativeExtent.south)); - var geographicNortheast = projection.unproject(new Cartesian2(nativeExtent.east, nativeExtent.north)); + var geographicSouthwest = projection.unproject(new Cartesian2(nativeRectangle.west, nativeRectangle.south)); + var geographicNortheast = projection.unproject(new Cartesian2(nativeRectangle.east, nativeRectangle.north)); for (var j = 0; j < height; ++j) { - var y = CesiumMath.lerp(nativeExtent.north, nativeExtent.south, j / (height - 1)); + var y = CesiumMath.lerp(nativeRectangle.north, nativeRectangle.south, j / (height - 1)); for (var i = 0; i < width; ++i) { - var x = CesiumMath.lerp(nativeExtent.west, nativeExtent.east, i / (width - 1)); + var x = CesiumMath.lerp(nativeRectangle.west, nativeRectangle.east, i / (width - 1)); var latLon = projection.unproject(new Cartesian2(x, y)); var longitude = latLon.longitude; @@ -300,13 +300,13 @@ defineSuite([ width : width, height : height, skirtHeight : 0.0, - nativeExtent : { + nativeRectangle : { west : 10.0, south : 30.0, east : 20.0, north : 40.0 }, - extent : new Extent( + rectangle : new Rectangle( CesiumMath.toRadians(10.0), CesiumMath.toRadians(30.0), CesiumMath.toRadians(20.0), @@ -320,13 +320,13 @@ defineSuite([ HeightmapTessellator.computeVertices(description); var ellipsoid = Ellipsoid.WGS84; - var nativeExtent = description.nativeExtent; + var nativeRectangle = description.nativeRectangle; for (var j = 0; j < height; ++j) { - var latitude = CesiumMath.lerp(nativeExtent.north, nativeExtent.south, j / (height - 1)); + var latitude = CesiumMath.lerp(nativeRectangle.north, nativeRectangle.south, j / (height - 1)); latitude = CesiumMath.toRadians(latitude); for (var i = 0; i < width; ++i) { - var longitude = CesiumMath.lerp(nativeExtent.west, nativeExtent.east, i / (width - 1)); + var longitude = CesiumMath.lerp(nativeRectangle.west, nativeRectangle.east, i / (width - 1)); longitude = CesiumMath.toRadians(longitude); var heightSampleIndex = (j * width + i) * description.structure.stride; @@ -367,13 +367,13 @@ defineSuite([ width : width, height : height, skirtHeight : 0.0, - nativeExtent : { + nativeRectangle : { west : 10.0, south : 30.0, east : 20.0, north : 40.0 }, - extent : new Extent( + rectangle : new Rectangle( CesiumMath.toRadians(10.0), CesiumMath.toRadians(30.0), CesiumMath.toRadians(20.0), @@ -388,13 +388,13 @@ defineSuite([ HeightmapTessellator.computeVertices(description); var ellipsoid = Ellipsoid.WGS84; - var nativeExtent = description.nativeExtent; + var nativeRectangle = description.nativeRectangle; for (var j = 0; j < height; ++j) { - var latitude = CesiumMath.lerp(nativeExtent.north, nativeExtent.south, j / (height - 1)); + var latitude = CesiumMath.lerp(nativeRectangle.north, nativeRectangle.south, j / (height - 1)); latitude = CesiumMath.toRadians(latitude); for (var i = 0; i < width; ++i) { - var longitude = CesiumMath.lerp(nativeExtent.west, nativeExtent.east, i / (width - 1)); + var longitude = CesiumMath.lerp(nativeRectangle.west, nativeRectangle.east, i / (width - 1)); longitude = CesiumMath.toRadians(longitude); var heightSampleIndex = (j * width + i) * description.structure.stride; diff --git a/Specs/Scene/ImageryLayerSpec.js b/Specs/Scene/ImageryLayerSpec.js index ad04f8160faf..64b814160c72 100644 --- a/Specs/Scene/ImageryLayerSpec.js +++ b/Specs/Scene/ImageryLayerSpec.js @@ -3,7 +3,7 @@ defineSuite([ 'Scene/ImageryLayer', 'Specs/createContext', 'Specs/destroyContext', - 'Core/Extent', + 'Core/Rectangle', 'Core/jsonp', 'Core/loadImage', 'Core/loadWithXhr', @@ -20,7 +20,7 @@ defineSuite([ ImageryLayer, createContext, destroyContext, - Extent, + Rectangle, jsonp, loadImage, loadWithXhr, @@ -192,11 +192,11 @@ defineSuite([ url : 'Data/Images/Red16x16.png' }); - var extent = new Extent(0.1, 0.2, 0.3, 0.4); + var rectangle = new Rectangle(0.1, 0.2, 0.3, 0.4); var layer = new ImageryLayer(provider, { - extent : extent + rectangle : rectangle }); - expect(layer.extent).toEqual(extent); + expect(layer.rectangle).toEqual(rectangle); expect(layer.isDestroyed()).toEqual(false); layer.destroy(); expect(layer.isDestroyed()).toEqual(true); @@ -222,22 +222,22 @@ defineSuite([ // Both tiles should have imagery from this layer completely covering them. expect(tiles[0].imagery.length).toBe(4); - expect(tiles[0].imagery[0].textureCoordinateExtent.x).toBe(0.0); - expect(tiles[0].imagery[0].textureCoordinateExtent.w).toBe(1.0); - expect(tiles[0].imagery[1].textureCoordinateExtent.x).toBe(0.0); - expect(tiles[0].imagery[1].textureCoordinateExtent.y).toBe(0.0); - expect(tiles[0].imagery[2].textureCoordinateExtent.z).toBe(1.0); - expect(tiles[0].imagery[2].textureCoordinateExtent.w).toBe(1.0); - expect(tiles[0].imagery[3].textureCoordinateExtent.y).toBe(0.0); - expect(tiles[0].imagery[3].textureCoordinateExtent.z).toBe(1.0); + expect(tiles[0].imagery[0].textureCoordinateRectangle.x).toBe(0.0); + expect(tiles[0].imagery[0].textureCoordinateRectangle.w).toBe(1.0); + expect(tiles[0].imagery[1].textureCoordinateRectangle.x).toBe(0.0); + expect(tiles[0].imagery[1].textureCoordinateRectangle.y).toBe(0.0); + expect(tiles[0].imagery[2].textureCoordinateRectangle.z).toBe(1.0); + expect(tiles[0].imagery[2].textureCoordinateRectangle.w).toBe(1.0); + expect(tiles[0].imagery[3].textureCoordinateRectangle.y).toBe(0.0); + expect(tiles[0].imagery[3].textureCoordinateRectangle.z).toBe(1.0); expect(tiles[1].imagery.length).toBe(2); - expect(tiles[1].imagery[0].textureCoordinateExtent.x).toBe(0.0); - expect(tiles[1].imagery[0].textureCoordinateExtent.w).toBe(1.0); - expect(tiles[1].imagery[0].textureCoordinateExtent.z).toBe(1.0); - expect(tiles[1].imagery[1].textureCoordinateExtent.x).toBe(0.0); - expect(tiles[1].imagery[1].textureCoordinateExtent.y).toBe(0.0); - expect(tiles[1].imagery[1].textureCoordinateExtent.z).toBe(1.0); + expect(tiles[1].imagery[0].textureCoordinateRectangle.x).toBe(0.0); + expect(tiles[1].imagery[0].textureCoordinateRectangle.w).toBe(1.0); + expect(tiles[1].imagery[0].textureCoordinateRectangle.z).toBe(1.0); + expect(tiles[1].imagery[1].textureCoordinateRectangle.x).toBe(0.0); + expect(tiles[1].imagery[1].textureCoordinateRectangle.y).toBe(0.0); + expect(tiles[1].imagery[1].textureCoordinateRectangle.z).toBe(1.0); }); }); @@ -267,22 +267,22 @@ defineSuite([ // Only the western tile should have imagery from this layer. // And the imagery should not cover it completely. expect(tiles[0].imagery.length).toBe(4); - expect(tiles[0].imagery[0].textureCoordinateExtent.x).not.toBe(0.0); - expect(tiles[0].imagery[0].textureCoordinateExtent.y).not.toBe(0.0); - expect(tiles[0].imagery[0].textureCoordinateExtent.z).not.toBe(1.0); - expect(tiles[0].imagery[0].textureCoordinateExtent.w).not.toBe(1.0); - expect(tiles[0].imagery[1].textureCoordinateExtent.x).not.toBe(0.0); - expect(tiles[0].imagery[1].textureCoordinateExtent.y).not.toBe(0.0); - expect(tiles[0].imagery[1].textureCoordinateExtent.z).not.toBe(1.0); - expect(tiles[0].imagery[1].textureCoordinateExtent.w).not.toBe(1.0); - expect(tiles[0].imagery[2].textureCoordinateExtent.x).not.toBe(0.0); - expect(tiles[0].imagery[2].textureCoordinateExtent.y).not.toBe(0.0); - expect(tiles[0].imagery[2].textureCoordinateExtent.z).not.toBe(1.0); - expect(tiles[0].imagery[2].textureCoordinateExtent.w).not.toBe(1.0); - expect(tiles[0].imagery[3].textureCoordinateExtent.x).not.toBe(0.0); - expect(tiles[0].imagery[3].textureCoordinateExtent.y).not.toBe(0.0); - expect(tiles[0].imagery[3].textureCoordinateExtent.z).not.toBe(1.0); - expect(tiles[0].imagery[3].textureCoordinateExtent.w).not.toBe(1.0); + expect(tiles[0].imagery[0].textureCoordinateRectangle.x).not.toBe(0.0); + expect(tiles[0].imagery[0].textureCoordinateRectangle.y).not.toBe(0.0); + expect(tiles[0].imagery[0].textureCoordinateRectangle.z).not.toBe(1.0); + expect(tiles[0].imagery[0].textureCoordinateRectangle.w).not.toBe(1.0); + expect(tiles[0].imagery[1].textureCoordinateRectangle.x).not.toBe(0.0); + expect(tiles[0].imagery[1].textureCoordinateRectangle.y).not.toBe(0.0); + expect(tiles[0].imagery[1].textureCoordinateRectangle.z).not.toBe(1.0); + expect(tiles[0].imagery[1].textureCoordinateRectangle.w).not.toBe(1.0); + expect(tiles[0].imagery[2].textureCoordinateRectangle.x).not.toBe(0.0); + expect(tiles[0].imagery[2].textureCoordinateRectangle.y).not.toBe(0.0); + expect(tiles[0].imagery[2].textureCoordinateRectangle.z).not.toBe(1.0); + expect(tiles[0].imagery[2].textureCoordinateRectangle.w).not.toBe(1.0); + expect(tiles[0].imagery[3].textureCoordinateRectangle.x).not.toBe(0.0); + expect(tiles[0].imagery[3].textureCoordinateRectangle.y).not.toBe(0.0); + expect(tiles[0].imagery[3].textureCoordinateRectangle.z).not.toBe(1.0); + expect(tiles[0].imagery[3].textureCoordinateRectangle.w).not.toBe(1.0); expect(tiles[1].imagery.length).toBe(0); }); diff --git a/Specs/Scene/MaterialAppearanceSpec.js b/Specs/Scene/MaterialAppearanceSpec.js index ca6e54bb6725..105a0cefb62a 100644 --- a/Specs/Scene/MaterialAppearanceSpec.js +++ b/Specs/Scene/MaterialAppearanceSpec.js @@ -4,8 +4,8 @@ defineSuite([ 'Scene/Appearance', 'Scene/Material', 'Scene/Primitive', - 'Core/ExtentGeometry', - 'Core/Extent', + 'Core/RectangleGeometry', + 'Core/Rectangle', 'Core/GeometryInstance', 'Core/ColorGeometryInstanceAttribute', 'Renderer/ClearCommand', @@ -18,8 +18,8 @@ defineSuite([ Appearance, Material, Primitive, - ExtentGeometry, - Extent, + RectangleGeometry, + Rectangle, GeometryInstance, ColorGeometryInstanceAttribute, ClearCommand, @@ -38,12 +38,12 @@ defineSuite([ context = createContext(); frameState = createFrameState(); - var extent = Extent.fromDegrees(-10.0, -10.0, 10.0, 10.0); + var rectangle = Rectangle.fromDegrees(-10.0, -10.0, 10.0, 10.0); primitive = new Primitive({ geometryInstances : new GeometryInstance({ - geometry : new ExtentGeometry({ + geometry : new RectangleGeometry({ vertexFormat : MaterialAppearance.MaterialSupport.ALL.vertexFormat, - extent : extent + rectangle : rectangle }), attributes : { color : new ColorGeometryInstanceAttribute(1.0, 1.0, 0.0, 1.0) @@ -52,7 +52,7 @@ defineSuite([ asynchronous : false }); - frameState.camera.viewExtent(extent); + frameState.camera.viewRectangle(rectangle); var us = context.uniformState; us.update(context, frameState); }); diff --git a/Specs/Scene/OpenStreetMapImageryProviderSpec.js b/Specs/Scene/OpenStreetMapImageryProviderSpec.js index 90f5316273eb..494458d3ff2d 100644 --- a/Specs/Scene/OpenStreetMapImageryProviderSpec.js +++ b/Specs/Scene/OpenStreetMapImageryProviderSpec.js @@ -5,7 +5,7 @@ defineSuite([ 'Core/defined', 'Core/loadImage', 'Core/DefaultProxy', - 'Core/Extent', + 'Core/Rectangle', 'Scene/Imagery', 'Scene/ImageryLayer', 'Scene/ImageryProvider', @@ -18,7 +18,7 @@ defineSuite([ defined, loadImage, DefaultProxy, - Extent, + Rectangle, Imagery, ImageryLayer, ImageryProvider, @@ -112,7 +112,7 @@ defineSuite([ expect(provider.tileHeight).toEqual(256); expect(provider.maximumLevel).toEqual(18); expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme); - expect(provider.extent).toEqual(new WebMercatorTilingScheme().extent); + expect(provider.rectangle).toEqual(new WebMercatorTilingScheme().rectangle); loadImage.createImage = function(url, crossOrigin, deferred) { // Just return any old image. @@ -184,11 +184,11 @@ defineSuite([ }); }); - it('extent passed to constructor does not affect tile numbering', function() { - var extent = new Extent(0.1, 0.2, 0.3, 0.4); + it('rectangle passed to constructor does not affect tile numbering', function() { + var rectangle = new Rectangle(0.1, 0.2, 0.3, 0.4); var provider = new OpenStreetMapImageryProvider({ url : 'made/up/osm/server', - extent : extent + rectangle : rectangle }); waitsFor(function() { @@ -200,7 +200,7 @@ defineSuite([ expect(provider.tileHeight).toEqual(256); expect(provider.maximumLevel).toEqual(18); expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme); - expect(provider.extent).toEqual(extent); + expect(provider.rectangle).toEqual(rectangle); expect(provider.tileDiscardPolicy).toBeUndefined(); var calledLoadImage = false; diff --git a/Specs/Scene/PerInstanceColorAppearanceSpec.js b/Specs/Scene/PerInstanceColorAppearanceSpec.js index b76148233011..30720f0b13c9 100644 --- a/Specs/Scene/PerInstanceColorAppearanceSpec.js +++ b/Specs/Scene/PerInstanceColorAppearanceSpec.js @@ -4,8 +4,8 @@ defineSuite([ 'Scene/Appearance', 'Scene/Material', 'Scene/Primitive', - 'Core/ExtentGeometry', - 'Core/Extent', + 'Core/RectangleGeometry', + 'Core/Rectangle', 'Core/GeometryInstance', 'Core/ColorGeometryInstanceAttribute', 'Renderer/ClearCommand', @@ -18,8 +18,8 @@ defineSuite([ Appearance, Material, Primitive, - ExtentGeometry, - Extent, + RectangleGeometry, + Rectangle, GeometryInstance, ColorGeometryInstanceAttribute, ClearCommand, @@ -38,12 +38,12 @@ defineSuite([ context = createContext(); frameState = createFrameState(); - var extent = Extent.fromDegrees(-10.0, -10.0, 10.0, 10.0); + var rectangle = Rectangle.fromDegrees(-10.0, -10.0, 10.0, 10.0); primitive = new Primitive({ geometryInstances : new GeometryInstance({ - geometry : new ExtentGeometry({ + geometry : new RectangleGeometry({ vertexFormat : PerInstanceColorAppearance.VERTEX_FORMAT, - extent : extent + rectangle : rectangle }), attributes : { color : new ColorGeometryInstanceAttribute(1.0, 1.0, 0.0, 1.0) @@ -52,7 +52,7 @@ defineSuite([ asynchronous : false }); - frameState.camera.viewExtent(extent); + frameState.camera.viewRectangle(rectangle); var us = context.uniformState; us.update(context, frameState); }); diff --git a/Specs/Scene/PickSpec.js b/Specs/Scene/PickSpec.js index 3fb64b558ca5..d7e2597412eb 100644 --- a/Specs/Scene/PickSpec.js +++ b/Specs/Scene/PickSpec.js @@ -1,6 +1,6 @@ /*global defineSuite*/ defineSuite([ - 'Scene/ExtentPrimitive', + 'Scene/RectanglePrimitive', 'Specs/createScene', 'Specs/destroyScene', 'Specs/createCamera', @@ -8,14 +8,14 @@ defineSuite([ 'Core/Cartesian3', 'Core/Cartographic', 'Core/Ellipsoid', - 'Core/Extent', + 'Core/Rectangle', 'Core/Math', 'Core/Matrix4', 'Scene/OrthographicFrustum', 'Scene/PerspectiveFrustum', 'Scene/SceneMode' ], 'Scene/Pick', function( - ExtentPrimitive, + RectanglePrimitive, createScene, destroyScene, createCamera, @@ -23,7 +23,7 @@ defineSuite([ Cartesian3, Cartographic, Ellipsoid, - Extent, + Rectangle, CesiumMath, Matrix4, OrthographicFrustum, @@ -67,13 +67,13 @@ defineSuite([ primitives.removeAll(); }); - function createExtent() { + function createRectangle() { var ellipsoid = Ellipsoid.UNIT_SPHERE; - var e = new ExtentPrimitive({ + var e = new RectanglePrimitive({ ellipsoid : ellipsoid, granularity : CesiumMath.toRadians(20.0), - extent : Extent.fromDegrees(-50.0, -50.0, 50.0, 50.0), + rectangle : Rectangle.fromDegrees(-50.0, -50.0, 50.0, 50.0), asynchronous : false }); @@ -89,34 +89,34 @@ defineSuite([ }); it('is picked', function() { - var extent = createExtent(); + var rectangle = createRectangle(); var pickedObject = scene.pick(new Cartesian2(0, 0)); - expect(pickedObject.primitive).toEqual(extent); + expect(pickedObject.primitive).toEqual(rectangle); }); it('is not picked (show === false)', function() { - var extent = createExtent(); - extent.show = false; + var rectangle = createRectangle(); + rectangle.show = false; var pickedObject = scene.pick(new Cartesian2(0, 0)); expect(pickedObject).not.toBeDefined(); }); it('is not picked (alpha === 0.0)', function() { - var extent = createExtent(); - extent.material.uniforms.color.alpha = 0.0; + var rectangle = createRectangle(); + rectangle.material.uniforms.color.alpha = 0.0; var pickedObject = scene.pick(new Cartesian2(0, 0)); expect(pickedObject).not.toBeDefined(); }); it('is picked (top primitive only)', function() { - createExtent(); - var extent2 = createExtent(); - extent2.height = 0.01; + createRectangle(); + var rectangle2 = createRectangle(); + rectangle2.height = 0.01; var pickedObject = scene.pick(new Cartesian2(0, 0)); - expect(pickedObject.primitive).toEqual(extent2); + expect(pickedObject.primitive).toEqual(rectangle2); }); it('drill pick (undefined window position)', function() { @@ -126,36 +126,36 @@ defineSuite([ }); it('drill pick (all picked)', function() { - var extent1 = createExtent(); - var extent2 = createExtent(); - extent2.height = 0.01; + var rectangle1 = createRectangle(); + var rectangle2 = createRectangle(); + rectangle2.height = 0.01; var pickedObjects = scene.drillPick(new Cartesian2(0, 0)); expect(pickedObjects.length).toEqual(2); - expect(pickedObjects[0].primitive).toEqual(extent2); - expect(pickedObjects[1].primitive).toEqual(extent1); + expect(pickedObjects[0].primitive).toEqual(rectangle2); + expect(pickedObjects[1].primitive).toEqual(rectangle1); }); it('drill pick (show === false)', function() { - var extent1 = createExtent(); - var extent2 = createExtent(); - extent2.height = 0.01; - extent2.show = false; + var rectangle1 = createRectangle(); + var rectangle2 = createRectangle(); + rectangle2.height = 0.01; + rectangle2.show = false; var pickedObjects = scene.drillPick(new Cartesian2(0, 0)); expect(pickedObjects.length).toEqual(1); - expect(pickedObjects[0].primitive).toEqual(extent1); + expect(pickedObjects[0].primitive).toEqual(rectangle1); }); it('drill pick (alpha === 0.0)', function() { - var extent1 = createExtent(); - var extent2 = createExtent(); - extent2.height = 0.01; - extent2.material.uniforms.color.alpha = 0.0; + var rectangle1 = createRectangle(); + var rectangle2 = createRectangle(); + rectangle2.height = 0.01; + rectangle2.material.uniforms.color.alpha = 0.0; var pickedObjects = scene.drillPick(new Cartesian2(0, 0)); expect(pickedObjects.length).toEqual(1); - expect(pickedObjects[0].primitive).toEqual(extent1); + expect(pickedObjects[0].primitive).toEqual(rectangle1); }); it('pick in 2D', function() { @@ -184,9 +184,9 @@ defineSuite([ scene.mode = SceneMode.SCENE2D; scene.morphTime = scene.mode.morphTime; - var extent = createExtent(); + var rectangle = createRectangle(); var pickedObject = scene.pick(new Cartesian2(0, 0)); - expect(pickedObject.primitive).toEqual(extent); + expect(pickedObject.primitive).toEqual(rectangle); }); it('pick in 2D when rotated', function() { @@ -215,8 +215,8 @@ defineSuite([ scene.mode = SceneMode.SCENE2D; scene.morphTime = scene.mode.morphTime; - var extent = createExtent(); + var rectangle = createRectangle(); var pickedObject = scene.pick(new Cartesian2(0, 0)); - expect(pickedObject.primitive).toEqual(extent); + expect(pickedObject.primitive).toEqual(rectangle); }); }, 'WebGL'); diff --git a/Specs/Scene/PrimitiveSpec.js b/Specs/Scene/PrimitiveSpec.js index c871f38dc464..dbad5961f06c 100644 --- a/Specs/Scene/PrimitiveSpec.js +++ b/Specs/Scene/PrimitiveSpec.js @@ -1,7 +1,7 @@ /*global defineSuite*/ defineSuite([ 'Scene/Primitive', - 'Core/ExtentGeometry', + 'Core/RectangleGeometry', 'Core/Geometry', 'Core/GeometryAttribute', 'Core/GeometryInstance', @@ -11,7 +11,7 @@ defineSuite([ 'Core/ComponentDatatype', 'Core/Cartesian3', 'Core/Matrix4', - 'Core/Extent', + 'Core/Rectangle', 'Core/Ellipsoid', 'Core/PrimitiveType', 'Core/BoxGeometry', @@ -29,7 +29,7 @@ defineSuite([ 'Specs/destroyScene' ], function( Primitive, - ExtentGeometry, + RectangleGeometry, Geometry, GeometryAttribute, GeometryInstance, @@ -39,7 +39,7 @@ defineSuite([ ComponentDatatype, Cartesian3, Matrix4, - Extent, + Rectangle, Ellipsoid, PrimitiveType, BoxGeometry, @@ -64,11 +64,11 @@ defineSuite([ var ellipsoid; - var extent1; - var extent2; + var rectangle1; + var rectangle2; - var extentInstance1; - var extentInstance2; + var rectangleInstance1; + var rectangleInstance2; beforeAll(function() { context = createContext(); @@ -85,33 +85,33 @@ defineSuite([ }); beforeEach(function() { - extent1 = Extent.fromDegrees(-80.0, 20.0, -70.0, 30.0); - extent2 = Extent.fromDegrees(70.0, 20.0, 80.0, 30.0); + rectangle1 = Rectangle.fromDegrees(-80.0, 20.0, -70.0, 30.0); + rectangle2 = Rectangle.fromDegrees(70.0, 20.0, 80.0, 30.0); - var translation = Cartesian3.multiplyByScalar(Cartesian3.normalize(ellipsoid.cartographicToCartesian(Extent.getCenter(extent1))), 2.0); - extentInstance1 = new GeometryInstance({ - geometry : new ExtentGeometry({ + var translation = Cartesian3.multiplyByScalar(Cartesian3.normalize(ellipsoid.cartographicToCartesian(Rectangle.getCenter(rectangle1))), 2.0); + rectangleInstance1 = new GeometryInstance({ + geometry : new RectangleGeometry({ vertexFormat : PerInstanceColorAppearance.VERTEX_FORMAT, ellipsoid : ellipsoid, - extent : extent1 + rectangle : rectangle1 }), modelMatrix : Matrix4.fromTranslation(translation), - id : 'extent1', + id : 'rectangle1', attributes : { color : new ColorGeometryInstanceAttribute(1.0, 1.0, 0.0, 1.0), show : new ShowGeometryInstanceAttribute(true) } }); - translation = Cartesian3.multiplyByScalar(Cartesian3.normalize(ellipsoid.cartographicToCartesian(Extent.getCenter(extent2))), 3.0); - extentInstance2 = new GeometryInstance({ - geometry : new ExtentGeometry({ + translation = Cartesian3.multiplyByScalar(Cartesian3.normalize(ellipsoid.cartographicToCartesian(Rectangle.getCenter(rectangle2))), 3.0); + rectangleInstance2 = new GeometryInstance({ + geometry : new RectangleGeometry({ vertexFormat : PerInstanceColorAppearance.VERTEX_FORMAT, ellipsoid : ellipsoid, - extent : extent2 + rectangle : rectangle2 }), modelMatrix : Matrix4.fromTranslation(translation), - id : 'extent2', + id : 'rectangle2', attributes : { color : new ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 1.0), show : new ShowGeometryInstanceAttribute(true) @@ -135,7 +135,7 @@ defineSuite([ it('releases geometry instances when releaseGeometryInstances is true', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), releaseGeometryInstances : true, asynchronous : false @@ -150,7 +150,7 @@ defineSuite([ it('does not release geometry instances when releaseGeometryInstances is false', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), releaseGeometryInstances : false, asynchronous : false @@ -180,7 +180,7 @@ defineSuite([ it('does not render when show is false', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false @@ -200,7 +200,7 @@ defineSuite([ it('does not render other than for the color or pick pass', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false @@ -221,7 +221,7 @@ defineSuite([ it('does not render when allow3DOnly is true and the scene mode is SCENE2D', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false @@ -239,7 +239,7 @@ defineSuite([ it('does not render when allow3DOnly is true and the scene mode is COLUMBUS_VIEW', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false @@ -284,7 +284,7 @@ defineSuite([ it('renders in Columbus view when allow3DOnly is false', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), allow3DOnly : false, asynchronous : false @@ -298,7 +298,7 @@ defineSuite([ 0.0, 0.0, 0.0, 1.0); frameState.camera.update(frameState.mode, frameState.scene2D); - frameState.camera.viewExtent(extent1); + frameState.camera.viewRectangle(rectangle1); us.update(context, frameState); ClearCommand.ALL.execute(context); @@ -307,7 +307,7 @@ defineSuite([ render(context, frameState, primitive); expect(context.readPixels()).not.toEqual([0, 0, 0, 0]); - frameState.camera.viewExtent(extent2); + frameState.camera.viewRectangle(rectangle2); us.update(context, frameState); ClearCommand.ALL.execute(context); @@ -322,7 +322,7 @@ defineSuite([ it('renders in 2D when allow3DOnly is false', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), allow3DOnly : false, asynchronous : false @@ -342,7 +342,7 @@ defineSuite([ frameState.camera.frustum = frustum; frameState.camera.update(frameState.mode, frameState.scene2D); - frameState.camera.viewExtent(extent1); + frameState.camera.viewRectangle(rectangle1); us.update(context, frameState); ClearCommand.ALL.execute(context); @@ -351,7 +351,7 @@ defineSuite([ render(context, frameState, primitive); expect(context.readPixels()).not.toEqual([0, 0, 0, 0]); - frameState.camera.viewExtent(extent2); + frameState.camera.viewRectangle(rectangle2); us.update(context, frameState); ClearCommand.ALL.execute(context); @@ -367,12 +367,12 @@ defineSuite([ it('renders bounding volume with debugShowBoundingVolume', function() { var scene = createScene(); scene.primitives.add(new Primitive({ - geometryInstances : extentInstance1, + geometryInstances : rectangleInstance1, appearance : new PerInstanceColorAppearance(), asynchronous : false, debugShowBoundingVolume : true })); - scene.camera.viewExtent(extent1); + scene.camera.viewRectangle(rectangle1); scene.initializeFrame(); scene.render(); var pixels = scene.context.readPixels(); @@ -386,13 +386,13 @@ defineSuite([ it('transforms to world coordinates', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false }); - frameState.camera.viewExtent(extent1); + frameState.camera.viewRectangle(rectangle1); us.update(context, frameState); ClearCommand.ALL.execute(context); @@ -401,7 +401,7 @@ defineSuite([ render(context, frameState, primitive); expect(context.readPixels()).not.toEqual([0, 0, 0, 0]); - frameState.camera.viewExtent(extent2); + frameState.camera.viewRectangle(rectangle2); us.update(context, frameState); ClearCommand.ALL.execute(context); @@ -416,15 +416,15 @@ defineSuite([ }); it('does not transform to world coordinates', function() { - extentInstance2.modelMatrix = Matrix4.clone(extentInstance1.modelMatrix); + rectangleInstance2.modelMatrix = Matrix4.clone(rectangleInstance1.modelMatrix); var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false }); - frameState.camera.viewExtent(extent1); + frameState.camera.viewRectangle(rectangle1); us.update(context, frameState); ClearCommand.ALL.execute(context); @@ -433,7 +433,7 @@ defineSuite([ render(context, frameState, primitive); expect(context.readPixels()).not.toEqual([0, 0, 0, 0]); - frameState.camera.viewExtent(extent2); + frameState.camera.viewRectangle(rectangle2); us.update(context, frameState); ClearCommand.ALL.execute(context); @@ -448,25 +448,25 @@ defineSuite([ }); it('get common per instance attributes', function() { - extentInstance2.attributes.not_used = new GeometryInstanceAttribute({ + rectangleInstance2.attributes.not_used = new GeometryInstanceAttribute({ componentDatatype : ComponentDatatype.FLOAT, componentsPerAttribute : 1, value : [0.5] }); var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false }); primitive.update(context, frameState, []); - var attributes = primitive.getGeometryInstanceAttributes('extent1'); + var attributes = primitive.getGeometryInstanceAttributes('rectangle1'); expect(attributes.color).toBeDefined(); expect(attributes.show).toBeDefined(); - attributes = primitive.getGeometryInstanceAttributes('extent2'); + attributes = primitive.getGeometryInstanceAttributes('rectangle2'); expect(attributes.color).toBeDefined(); expect(attributes.show).toBeDefined(); expect(attributes.not_used).not.toBeDefined(); @@ -476,13 +476,13 @@ defineSuite([ it('modify color instance attribute', function() { var primitive = new Primitive({ - geometryInstances : extentInstance1, + geometryInstances : rectangleInstance1, appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false }); - frameState.camera.viewExtent(extent1); + frameState.camera.viewRectangle(rectangle1); us.update(context, frameState); ClearCommand.ALL.execute(context); @@ -492,7 +492,7 @@ defineSuite([ var pixels = context.readPixels(); expect(pixels).not.toEqual([0, 0, 0, 0]); - var attributes = primitive.getGeometryInstanceAttributes('extent1'); + var attributes = primitive.getGeometryInstanceAttributes('rectangle1'); expect(attributes.color).toBeDefined(); attributes.color = [255, 255, 255, 255]; @@ -509,13 +509,13 @@ defineSuite([ it('modify show instance attribute', function() { var primitive = new Primitive({ - geometryInstances : extentInstance1, + geometryInstances : rectangleInstance1, appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false }); - frameState.camera.viewExtent(extent1); + frameState.camera.viewRectangle(rectangle1); us.update(context, frameState); ClearCommand.ALL.execute(context); @@ -524,7 +524,7 @@ defineSuite([ render(context, frameState, primitive); expect(context.readPixels()).not.toEqual([0, 0, 0, 0]); - var attributes = primitive.getGeometryInstanceAttributes('extent1'); + var attributes = primitive.getGeometryInstanceAttributes('rectangle1'); expect(attributes.show).toBeDefined(); attributes.show = [0]; @@ -539,39 +539,39 @@ defineSuite([ it('picking', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false }); - frameState.camera.viewExtent(extent1); + frameState.camera.viewRectangle(rectangle1); us.update(context, frameState); var pickObject = pick(context, frameState, primitive); expect(pickObject.primitive).toEqual(primitive); - expect(pickObject.id).toEqual('extent1'); + expect(pickObject.id).toEqual('rectangle1'); - frameState.camera.viewExtent(extent2); + frameState.camera.viewRectangle(rectangle2); us.update(context, frameState); pickObject = pick(context, frameState, primitive); expect(pickObject.primitive).toEqual(primitive); - expect(pickObject.id).toEqual('extent2'); + expect(pickObject.id).toEqual('rectangle2'); primitive = primitive && primitive.destroy(); }); it('does not pick when allowPicking is false', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1], + geometryInstances : [rectangleInstance1], appearance : new PerInstanceColorAppearance(), allow3DOnly : true, allowPicking : false, asynchronous : false }); - frameState.camera.viewExtent(extent1); + frameState.camera.viewRectangle(rectangle1); us.update(context, frameState); var pickObject = pick(context, frameState, primitive); @@ -619,7 +619,7 @@ defineSuite([ it('shader validation', function() { var primitive = new Primitive({ - geometryInstances : [extentInstance1, extentInstance2], + geometryInstances : [rectangleInstance1, rectangleInstance2], allow3DOnly : true, appearance : new MaterialAppearance({ materialSupport : MaterialAppearance.MaterialSupport.ALL @@ -634,14 +634,14 @@ defineSuite([ it('setting per instance attribute throws when value is undefined', function() { var primitive = new Primitive({ - geometryInstances : extentInstance1, + geometryInstances : rectangleInstance1, appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false }); primitive.update(context, frameState, []); - var attributes = primitive.getGeometryInstanceAttributes('extent1'); + var attributes = primitive.getGeometryInstanceAttributes('rectangle1'); expect(function() { attributes.color = undefined; @@ -652,7 +652,7 @@ defineSuite([ it('getGeometryInstanceAttributes throws without id', function() { var primitive = new Primitive({ - geometryInstances : extentInstance1, + geometryInstances : rectangleInstance1, appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false @@ -669,14 +669,14 @@ defineSuite([ it('getGeometryInstanceAttributes throws if update was not called', function() { var primitive = new Primitive({ - geometryInstances : extentInstance1, + geometryInstances : rectangleInstance1, appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false }); expect(function() { - primitive.getGeometryInstanceAttributes('extent1'); + primitive.getGeometryInstanceAttributes('rectangle1'); }).toThrowDeveloperError(); primitive = primitive && primitive.destroy(); @@ -684,7 +684,7 @@ defineSuite([ it('getGeometryInstanceAttributes returns undefined if id does not exist', function() { var primitive = new Primitive({ - geometryInstances : extentInstance1, + geometryInstances : rectangleInstance1, appearance : new PerInstanceColorAppearance(), allow3DOnly : true, asynchronous : false @@ -706,11 +706,11 @@ defineSuite([ it('renders when using asynchronous pipeline', function() { var primitive = new Primitive({ - geometryInstances : extentInstance1, + geometryInstances : rectangleInstance1, appearance : new PerInstanceColorAppearance() }); - frameState.camera.viewExtent(extent1); + frameState.camera.viewRectangle(rectangle1); us.update(context, frameState); waitsFor(function() { @@ -731,7 +731,7 @@ defineSuite([ it('destroy before asynchonous pipeline is complete', function() { var primitive = new Primitive({ - geometryInstances : extentInstance1, + geometryInstances : rectangleInstance1, appearance : new PerInstanceColorAppearance(), allow3DOnly : true }); diff --git a/Specs/Scene/QuantizedMeshTerrainDataSpec.js b/Specs/Scene/QuantizedMeshTerrainDataSpec.js index fbde58c4013d..172adc00c2dd 100644 --- a/Specs/Scene/QuantizedMeshTerrainDataSpec.js +++ b/Specs/Scene/QuantizedMeshTerrainDataSpec.js @@ -313,11 +313,11 @@ defineSuite([ describe('interpolateHeight', function() { var tilingScheme; - var extent; + var rectangle; beforeEach(function() { tilingScheme = new GeographicTilingScheme(); - extent = tilingScheme.tileXYToExtent(7, 6, 5); + rectangle = tilingScheme.tileXYToRectangle(7, 6, 5); }); it('returns undefined if given a position outside the mesh', function() { @@ -349,7 +349,7 @@ defineSuite([ childTileMask : 15 }); - expect(mesh.interpolateHeight(extent, 0.0, 0.0)).toBeUndefined(); + expect(mesh.interpolateHeight(rectangle, 0.0, 0.0)).toBeUndefined(); }); it('returns a height interpolated from the correct triangle', function() { @@ -385,24 +385,24 @@ defineSuite([ // position in the northwest quadrant of the tile. - var longitude = extent.west + (extent.east - extent.west) * 0.25; - var latitude = extent.south + (extent.north - extent.south) * 0.75; + var longitude = rectangle.west + (rectangle.east - rectangle.west) * 0.25; + var latitude = rectangle.south + (rectangle.north - rectangle.south) * 0.75; - var result = mesh.interpolateHeight(extent, longitude, latitude); + var result = mesh.interpolateHeight(rectangle, longitude, latitude); expect(result).toBeLessThan(0.0); // position in the southeast quadrant of the tile. - longitude = extent.west + (extent.east - extent.west) * 0.75; - latitude = extent.south + (extent.north - extent.south) * 0.25; + longitude = rectangle.west + (rectangle.east - rectangle.west) * 0.75; + latitude = rectangle.south + (rectangle.north - rectangle.south) * 0.25; - result = mesh.interpolateHeight(extent, longitude, latitude); + result = mesh.interpolateHeight(rectangle, longitude, latitude); expect(result).toBeGreaterThan(0.0); // position on the line between the southwest and northeast corners. - longitude = extent.west + (extent.east - extent.west) * 0.5; - latitude = extent.south + (extent.north - extent.south) * 0.5; + longitude = rectangle.west + (rectangle.east - rectangle.west) * 0.5; + latitude = rectangle.south + (rectangle.north - rectangle.south) * 0.5; - result = mesh.interpolateHeight(extent, longitude, latitude); + result = mesh.interpolateHeight(rectangle, longitude, latitude); expect(result).toEqualEpsilon(0.0, 1e-10); }); }); diff --git a/Specs/Scene/ExtentPrimitiveSpec.js b/Specs/Scene/RectanglePrimitiveSpec.js similarity index 62% rename from Specs/Scene/ExtentPrimitiveSpec.js rename to Specs/Scene/RectanglePrimitiveSpec.js index 19e99a36a877..32bade13d62f 100644 --- a/Specs/Scene/ExtentPrimitiveSpec.js +++ b/Specs/Scene/RectanglePrimitiveSpec.js @@ -1,6 +1,6 @@ /*global defineSuite*/ defineSuite([ - 'Scene/ExtentPrimitive', + 'Scene/RectanglePrimitive', 'Specs/createContext', 'Specs/destroyContext', 'Specs/createCamera', @@ -15,12 +15,12 @@ defineSuite([ 'Core/Cartesian3', 'Core/Cartographic', 'Core/Ellipsoid', - 'Core/Extent', + 'Core/Rectangle', 'Core/Math', 'Renderer/ClearCommand', 'Scene/SceneMode' ], function( - ExtentPrimitive, + RectanglePrimitive, createContext, destroyContext, createCamera, @@ -35,7 +35,7 @@ defineSuite([ Cartesian3, Cartographic, Ellipsoid, - Extent, + Rectangle, CesiumMath, ClearCommand, SceneMode) { @@ -43,7 +43,7 @@ defineSuite([ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ var context; - var extent; + var rectangle; var us; beforeAll(function() { @@ -55,24 +55,24 @@ defineSuite([ }); beforeEach(function() { - extent = new ExtentPrimitive(); + rectangle = new RectanglePrimitive(); us = context.uniformState; us.update(context, createFrameState(createCamera(context, new Cartesian3(1.02, 0.0, 0.0), Cartesian3.ZERO, Cartesian3.UNIT_Z))); }); afterEach(function() { - extent = extent && extent.destroy(); + rectangle = rectangle && rectangle.destroy(); us = undefined; }); - function createExtent(options) { + function createRectangle(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); - var e = new ExtentPrimitive({ + var e = new RectanglePrimitive({ ellipsoid : Ellipsoid.UNIT_SPHERE, granularity : CesiumMath.toRadians(20.0), - extent : Extent.fromDegrees(-50.0, -50.0, 50.0, 50.0), + rectangle : Rectangle.fromDegrees(-50.0, -50.0, 50.0, 50.0), id : options.id, asynchronous : false, debugShowBoundingVolume : options.debugShowBoundingVolume @@ -83,25 +83,25 @@ defineSuite([ } it('gets defaults', function() { - expect(extent.show).toEqual(true); - expect(extent.ellipsoid).toEqual(Ellipsoid.WGS84); - expect(extent.granularity).toEqual(CesiumMath.RADIANS_PER_DEGREE); - expect(extent.height).toEqual(0.0); - expect(extent.rotation).toEqual(0.0); - expect(extent.textureRotationAngle).toEqual(0.0); - expect(extent.material.uniforms.color).toEqual({ + expect(rectangle.show).toEqual(true); + expect(rectangle.ellipsoid).toEqual(Ellipsoid.WGS84); + expect(rectangle.granularity).toEqual(CesiumMath.RADIANS_PER_DEGREE); + expect(rectangle.height).toEqual(0.0); + expect(rectangle.rotation).toEqual(0.0); + expect(rectangle.textureRotationAngle).toEqual(0.0); + expect(rectangle.material.uniforms.color).toEqual({ red : 1.0, green : 1.0, blue : 0.0, alpha : 0.5 }); - expect(extent.asynchronous).toEqual(true); - expect(extent.debugShowBoundingVolume).toEqual(false); + expect(rectangle.asynchronous).toEqual(true); + expect(rectangle.debugShowBoundingVolume).toEqual(false); }); it('renders', function() { - extent = createExtent(); - extent.material.uniforms.color = { + rectangle = createRectangle(); + rectangle.material.uniforms.color = { red : 1.0, green : 0.0, blue : 0.0, @@ -111,33 +111,33 @@ defineSuite([ ClearCommand.ALL.execute(context); expect(context.readPixels()).toEqual([0, 0, 0, 0]); - render(context, frameState, extent); + render(context, frameState, rectangle); expect(context.readPixels()).not.toEqual([0, 0, 0, 0]); }); it('does not render when show is false', function() { - extent = createExtent(); - extent.material.uniforms.color = { + rectangle = createRectangle(); + rectangle.material.uniforms.color = { red : 1.0, green : 0.0, blue : 0.0, alpha : 1.0 }; - extent.show = false; + rectangle.show = false; - expect(render(context, frameState, extent)).toEqual(0); + expect(render(context, frameState, rectangle)).toEqual(0); }); - it('does not render without extent', function() { - extent = new ExtentPrimitive(); - extent.ellipsoid = Ellipsoid.UNIT_SPHERE; - extent.granularity = CesiumMath.toRadians(20.0); - expect(render(context, frameState, extent)).toEqual(0); + it('does not render without rectangle', function() { + rectangle = new RectanglePrimitive(); + rectangle.ellipsoid = Ellipsoid.UNIT_SPHERE; + rectangle.granularity = CesiumMath.toRadians(20.0); + expect(render(context, frameState, rectangle)).toEqual(0); }); it('renders bounding volume with debugShowBoundingVolume', function() { var scene = createScene(); - scene.primitives.add(createExtent({ + scene.primitives.add(createRectangle({ debugShowBoundingVolume : true })); @@ -158,100 +158,100 @@ defineSuite([ }); it('is picked', function() { - extent = createExtent({ + rectangle = createRectangle({ id : 'id' }); - var pickedObject = pick(context, frameState, extent, 0, 0); - expect(pickedObject.primitive).toEqual(extent); + var pickedObject = pick(context, frameState, rectangle, 0, 0); + expect(pickedObject.primitive).toEqual(rectangle); expect(pickedObject.id).toEqual('id'); }); it('is not picked (show === false)', function() { - extent = createExtent(); - extent.show = false; + rectangle = createRectangle(); + rectangle.show = false; - var pickedObject = pick(context, frameState, extent, 0, 0); + var pickedObject = pick(context, frameState, rectangle, 0, 0); expect(pickedObject).not.toBeDefined(); }); it('is not picked (alpha === 0.0)', function() { - extent = createExtent(); - extent.material.uniforms.color.alpha = 0.0; + rectangle = createRectangle(); + rectangle.material.uniforms.color.alpha = 0.0; - var pickedObject = pick(context, frameState, extent, 0, 0); + var pickedObject = pick(context, frameState, rectangle, 0, 0); expect(pickedObject).not.toBeDefined(); }); it('test 3D bounding sphere', function() { - extent = createExtent(); + rectangle = createRectangle(); var commandList = []; - extent.update(context, frameState, commandList); + rectangle.update(context, frameState, commandList); var boundingVolume = commandList[0].boundingVolume; - expect(boundingVolume).toEqual(BoundingSphere.fromExtent3D(extent.extent, Ellipsoid.UNIT_SPHERE)); + expect(boundingVolume).toEqual(BoundingSphere.fromRectangle3D(rectangle.rectangle, Ellipsoid.UNIT_SPHERE)); }); it('test Columbus view bounding sphere', function() { - extent = createExtent(); + rectangle = createRectangle(); var mode = frameState.mode; frameState.mode = SceneMode.COLUMBUS_VIEW; var commandList = []; - extent.update(context, frameState, commandList); + rectangle.update(context, frameState, commandList); var boundingVolume = commandList[0].boundingVolume; frameState.mode = mode; - var b3D = BoundingSphere.fromExtent3D(extent.extent, Ellipsoid.UNIT_SPHERE); + var b3D = BoundingSphere.fromRectangle3D(rectangle.rectangle, Ellipsoid.UNIT_SPHERE); expect(boundingVolume).toEqual(BoundingSphere.projectTo2D(b3D, frameState.scene2D.projection)); }); it('test 2D bounding sphere', function() { - extent = createExtent(); + rectangle = createRectangle(); var mode = frameState.mode; frameState.mode = SceneMode.SCENE2D; var commandList = []; - extent.update(context, frameState, commandList); + rectangle.update(context, frameState, commandList); var boundingVolume = commandList[0].boundingVolume; frameState.mode = mode; - var b3D = BoundingSphere.fromExtent3D(extent.extent, Ellipsoid.UNIT_SPHERE); + var b3D = BoundingSphere.fromRectangle3D(rectangle.rectangle, Ellipsoid.UNIT_SPHERE); var b2D = BoundingSphere.projectTo2D(b3D, frameState.scene2D.projection); b2D.center.x = 0.0; expect(boundingVolume).toEqual(b2D); }); it('isDestroyed', function() { - var e = new ExtentPrimitive(); + var e = new RectanglePrimitive(); expect(e.isDestroyed()).toEqual(false); e.destroy(); expect(e.isDestroyed()).toEqual(true); }); it('throws when updated/rendered without a ellipsoid', function() { - extent = createExtent(); - extent.ellipsoid = undefined; + rectangle = createRectangle(); + rectangle.ellipsoid = undefined; expect(function() { - extent.update(context, frameState); + rectangle.update(context, frameState); }).toThrowDeveloperError(); }); it('throws when updated/rendered without an invalid granularity', function() { - extent = createExtent(); - extent.granularity = -1.0; + rectangle = createRectangle(); + rectangle.granularity = -1.0; expect(function() { - extent.update(context, frameState); + rectangle.update(context, frameState); }).toThrowDeveloperError(); }); it('throws when rendered without a material', function() { - extent = createExtent(); - extent.material = undefined; + rectangle = createRectangle(); + rectangle.material = undefined; expect(function() { - render(context, frameState, extent); + render(context, frameState, rectangle); }).toThrowDeveloperError(); }); }, 'WebGL'); \ No newline at end of file diff --git a/Specs/Scene/SceneSpec.js b/Specs/Scene/SceneSpec.js index db343bb4f8c6..0e7cbdaf4d89 100644 --- a/Specs/Scene/SceneSpec.js +++ b/Specs/Scene/SceneSpec.js @@ -6,7 +6,7 @@ defineSuite([ 'Core/Cartesian3', 'Core/BoundingSphere', 'Core/Event', - 'Core/Extent', + 'Core/Rectangle', 'Renderer/DrawCommand', 'Renderer/Context', 'Renderer/Pass', @@ -17,7 +17,7 @@ defineSuite([ 'Scene/AnimationCollection', 'Scene/Camera', 'Scene/CompositePrimitive', - 'Scene/ExtentPrimitive', + 'Scene/RectanglePrimitive', 'Scene/FrameState', 'Scene/OIT', 'Scene/ScreenSpaceCameraController', @@ -30,7 +30,7 @@ defineSuite([ Cartesian3, BoundingSphere, Event, - Extent, + Rectangle, DrawCommand, Context, Pass, @@ -41,7 +41,7 @@ defineSuite([ AnimationCollection, Camera, CompositePrimitive, - ExtentPrimitive, + RectanglePrimitive, FrameState, OIT, ScreenSpaceCameraController, @@ -216,26 +216,26 @@ defineSuite([ }); it('opaque/translucent render order (1)', function() { - var extent = Extent.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var rectangle = Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); - var extentPrimitive1 = new ExtentPrimitive({ - extent : extent, + var rectanglePrimitive1 = new RectanglePrimitive({ + rectangle : rectangle, asynchronous : false }); - extentPrimitive1.material.uniforms.color = new Color(1.0, 0.0, 0.0, 1.0); + rectanglePrimitive1.material.uniforms.color = new Color(1.0, 0.0, 0.0, 1.0); - var extentPrimitive2 = new ExtentPrimitive({ - extent : extent, + var rectanglePrimitive2 = new RectanglePrimitive({ + rectangle : rectangle, height : 1000.0, asynchronous : false }); - extentPrimitive2.material.uniforms.color = new Color(0.0, 1.0, 0.0, 0.5); + rectanglePrimitive2.material.uniforms.color = new Color(0.0, 1.0, 0.0, 0.5); var primitives = scene.primitives; - primitives.add(extentPrimitive1); - primitives.add(extentPrimitive2); + primitives.add(rectanglePrimitive1); + primitives.add(rectanglePrimitive2); - scene.camera.viewExtent(extent); + scene.camera.viewRectangle(rectangle); scene.initializeFrame(); scene.render(); @@ -244,7 +244,7 @@ defineSuite([ expect(pixels[1]).not.toEqual(0); expect(pixels[2]).toEqual(0); - primitives.raiseToTop(extentPrimitive1); + primitives.raiseToTop(rectanglePrimitive1); scene.initializeFrame(); scene.render(); @@ -255,26 +255,26 @@ defineSuite([ }); it('opaque/translucent render order (2)', function() { - var extent = Extent.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var rectangle = Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); - var extentPrimitive1 = new ExtentPrimitive({ - extent : extent, + var rectanglePrimitive1 = new RectanglePrimitive({ + rectangle : rectangle, height : 1000.0, asynchronous : false }); - extentPrimitive1.material.uniforms.color = new Color(1.0, 0.0, 0.0, 1.0); + rectanglePrimitive1.material.uniforms.color = new Color(1.0, 0.0, 0.0, 1.0); - var extentPrimitive2 = new ExtentPrimitive({ - extent : extent, + var rectanglePrimitive2 = new RectanglePrimitive({ + rectangle : rectangle, asynchronous : false }); - extentPrimitive2.material.uniforms.color = new Color(0.0, 1.0, 0.0, 0.5); + rectanglePrimitive2.material.uniforms.color = new Color(0.0, 1.0, 0.0, 0.5); var primitives = scene.primitives; - primitives.add(extentPrimitive1); - primitives.add(extentPrimitive2); + primitives.add(rectanglePrimitive1); + primitives.add(rectanglePrimitive2); - scene.camera.viewExtent(extent); + scene.camera.viewRectangle(rectangle); scene.initializeFrame(); scene.render(); @@ -283,7 +283,7 @@ defineSuite([ expect(pixels[1]).toEqual(0); expect(pixels[2]).toEqual(0); - primitives.raiseToTop(extentPrimitive1); + primitives.raiseToTop(rectanglePrimitive1); scene.initializeFrame(); scene.render(); @@ -294,19 +294,19 @@ defineSuite([ }); it('renders fast path with no translucent primitives', function() { - var extent = Extent.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var rectangle = Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); - var extentPrimitive = new ExtentPrimitive({ - extent : extent, + var rectanglePrimitive = new RectanglePrimitive({ + rectangle : rectangle, height : 1000.0, asynchronous : false }); - extentPrimitive.material.uniforms.color = new Color(1.0, 0.0, 0.0, 1.0); + rectanglePrimitive.material.uniforms.color = new Color(1.0, 0.0, 0.0, 1.0); var primitives = scene.primitives; - primitives.add(extentPrimitive); + primitives.add(rectanglePrimitive); - scene.camera.viewExtent(extent); + scene.camera.viewRectangle(rectangle); scene.initializeFrame(); scene.render(); @@ -317,19 +317,19 @@ defineSuite([ }); it('renders with OIT and without FXAA', function() { - var extent = Extent.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var rectangle = Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); - var extentPrimitive = new ExtentPrimitive({ - extent : extent, + var rectanglePrimitive = new RectanglePrimitive({ + rectangle : rectangle, height : 1000.0, asynchronous : false }); - extentPrimitive.material.uniforms.color = new Color(1.0, 0.0, 0.0, 0.5); + rectanglePrimitive.material.uniforms.color = new Color(1.0, 0.0, 0.0, 0.5); var primitives = scene.primitives; - primitives.add(extentPrimitive); + primitives.add(rectanglePrimitive); - scene.camera.viewExtent(extent); + scene.camera.viewRectangle(rectangle); scene.fxaaOrderIndependentTranslucency = false; scene.fxaa = false; @@ -377,19 +377,19 @@ defineSuite([ s.fxaa = true; - var extent = Extent.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var rectangle = Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); - var extentPrimitive = new ExtentPrimitive({ - extent : extent, + var rectanglePrimitive = new RectanglePrimitive({ + rectangle : rectangle, height : 1000.0, asynchronous : false }); - extentPrimitive.material.uniforms.color = new Color(1.0, 0.0, 0.0, 1.0); + rectanglePrimitive.material.uniforms.color = new Color(1.0, 0.0, 0.0, 1.0); var primitives = s.primitives; - primitives.add(extentPrimitive); + primitives.add(rectanglePrimitive); - s.camera.viewExtent(extent); + s.camera.viewRectangle(rectangle); s.initializeFrame(); s.render(); @@ -407,19 +407,19 @@ defineSuite([ s._oit._translucentMRTSupport = false; s._oit._translucentMultipassSupport = true; - var extent = Extent.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var rectangle = Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); - var extentPrimitive = new ExtentPrimitive({ - extent : extent, + var rectanglePrimitive = new RectanglePrimitive({ + rectangle : rectangle, height : 1000.0, asynchronous : false }); - extentPrimitive.material.uniforms.color = new Color(1.0, 0.0, 0.0, 0.5); + rectanglePrimitive.material.uniforms.color = new Color(1.0, 0.0, 0.0, 0.5); var primitives = s.primitives; - primitives.add(extentPrimitive); + primitives.add(rectanglePrimitive); - s.camera.viewExtent(extent); + s.camera.viewRectangle(rectangle); s.initializeFrame(); s.render(); @@ -438,19 +438,19 @@ defineSuite([ s._oit._translucentMRTSupport = false; s._oit._translucentMultipassSupport = false; - var extent = Extent.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var rectangle = Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); - var extentPrimitive = new ExtentPrimitive({ - extent : extent, + var rectanglePrimitive = new RectanglePrimitive({ + rectangle : rectangle, height : 1000.0, asynchronous : false }); - extentPrimitive.material.uniforms.color = new Color(1.0, 0.0, 0.0, 0.5); + rectanglePrimitive.material.uniforms.color = new Color(1.0, 0.0, 0.0, 0.5); var primitives = s.primitives; - primitives.add(extentPrimitive); + primitives.add(rectanglePrimitive); - s.camera.viewExtent(extent); + s.camera.viewRectangle(rectangle); s.initializeFrame(); s.render(); diff --git a/Specs/Scene/SingleTileImageryProviderSpec.js b/Specs/Scene/SingleTileImageryProviderSpec.js index dcc05581c8f0..b74d79293628 100644 --- a/Specs/Scene/SingleTileImageryProviderSpec.js +++ b/Specs/Scene/SingleTileImageryProviderSpec.js @@ -5,7 +5,7 @@ defineSuite([ 'Core/jsonp', 'Core/loadImage', 'Core/DefaultProxy', - 'Core/Extent', + 'Core/Rectangle', 'Scene/GeographicTilingScheme', 'Scene/Imagery', 'Scene/ImageryLayer', @@ -18,7 +18,7 @@ defineSuite([ jsonp, loadImage, DefaultProxy, - Extent, + Rectangle, GeographicTilingScheme, Imagery, ImageryLayer, @@ -39,16 +39,16 @@ defineSuite([ it('properties are gettable', function() { var url = 'Data/Images/Red16x16.png'; - var extent = new Extent(0.1, 0.2, 0.3, 0.4); + var rectangle = new Rectangle(0.1, 0.2, 0.3, 0.4); var credit = 'hi'; var provider = new SingleTileImageryProvider({ url : url, - extent : extent, + rectangle : rectangle, credit : credit }); expect(provider.url).toEqual(url); - expect(provider.extent).toEqual(extent); + expect(provider.rectangle).toEqual(rectangle); waitsFor(function() { return provider.ready; @@ -56,7 +56,7 @@ defineSuite([ runs(function() { expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme); - expect(provider.tilingScheme.extent).toEqual(extent); + expect(provider.tilingScheme.rectangle).toEqual(rectangle); expect(provider.tileWidth).toEqual(16); expect(provider.tileHeight).toEqual(16); expect(provider.maximumLevel).toEqual(0); diff --git a/Specs/Scene/TileCoordinatesImageryProviderSpec.js b/Specs/Scene/TileCoordinatesImageryProviderSpec.js index 1b04f54dafb3..de636e31d755 100644 --- a/Specs/Scene/TileCoordinatesImageryProviderSpec.js +++ b/Specs/Scene/TileCoordinatesImageryProviderSpec.js @@ -35,7 +35,7 @@ defineSuite([ expect(provider.maximumLevel).toBeUndefined(); expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme); expect(provider.tileDiscardPolicy).toBeUndefined(); - expect(provider.extent).toEqual(new GeographicTilingScheme().extent); + expect(provider.rectangle).toEqual(new GeographicTilingScheme().rectangle); when(provider.requestImage(0, 0, 0), function(image) { tile000Image = image; diff --git a/Specs/Scene/TileMapServiceImageryProviderSpec.js b/Specs/Scene/TileMapServiceImageryProviderSpec.js index 520fbe3fb559..08084912d035 100644 --- a/Specs/Scene/TileMapServiceImageryProviderSpec.js +++ b/Specs/Scene/TileMapServiceImageryProviderSpec.js @@ -6,7 +6,7 @@ defineSuite([ 'Core/loadImage', 'Core/loadWithXhr', 'Core/DefaultProxy', - 'Core/Extent', + 'Core/Rectangle', 'Core/Math', 'Core/WebMercatorProjection', 'Scene/Imagery', @@ -22,7 +22,7 @@ defineSuite([ loadImage, loadWithXhr, DefaultProxy, - Extent, + Rectangle, CesiumMath, WebMercatorProjection, Imagery, @@ -119,7 +119,7 @@ defineSuite([ expect(provider.tileHeight).toEqual(256); expect(provider.maximumLevel).toEqual(18); expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme); - expect(provider.extent).toEqual(new WebMercatorTilingScheme().extent); + expect(provider.rectangle).toEqual(new WebMercatorTilingScheme().rectangle); loadImage.createImage = function(url, crossOrigin, deferred) { // Just return any old image. @@ -191,11 +191,11 @@ defineSuite([ }); }); - it('extent passed to constructor does not affect tile numbering', function() { - var extent = new Extent(0.1, 0.2, 0.3, 0.4); + it('rectangle passed to constructor does not affect tile numbering', function() { + var rectangle = new Rectangle(0.1, 0.2, 0.3, 0.4); var provider = new TileMapServiceImageryProvider({ url : 'made/up/tms/server', - extent : extent + rectangle : rectangle }); waitsFor(function() { @@ -207,7 +207,7 @@ defineSuite([ expect(provider.tileHeight).toEqual(256); expect(provider.maximumLevel).toEqual(18); expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme); - expect(provider.extent).toEqual(extent); + expect(provider.rectangle).toEqual(rectangle); expect(provider.tileDiscardPolicy).toBeUndefined(); var calledLoadImage = false; @@ -287,7 +287,7 @@ defineSuite([ }); }); - it('keeps the extent within the bounds allowed by the tiling scheme no matter what the tilemapresource.xml says.', function() { + it('keeps the rectangle within the bounds allowed by the tiling scheme no matter what the tilemapresource.xml says.', function() { loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { var parser = new DOMParser(); var xmlString = @@ -315,14 +315,14 @@ defineSuite([ }, 'imagery provider to become ready'); runs(function() { - expect(provider.extent.west).toEqualEpsilon(CesiumMath.toRadians(-180.0), CesiumMath.EPSILON14); - expect(provider.extent.west).toBeGreaterThanOrEqualTo(provider.tilingScheme.extent.west); - expect(provider.extent.east).toEqualEpsilon(CesiumMath.toRadians(180.0), CesiumMath.EPSILON14); - expect(provider.extent.east).toBeLessThanOrEqualTo(provider.tilingScheme.extent.east); - expect(provider.extent.south).toEqualEpsilon(-WebMercatorProjection.MaximumLatitude, CesiumMath.EPSILON14); - expect(provider.extent.south).toBeGreaterThanOrEqualTo(provider.tilingScheme.extent.south); - expect(provider.extent.north).toEqualEpsilon(WebMercatorProjection.MaximumLatitude, CesiumMath.EPSILON14); - expect(provider.extent.north).toBeLessThanOrEqualTo(provider.tilingScheme.extent.north); + expect(provider.rectangle.west).toEqualEpsilon(CesiumMath.toRadians(-180.0), CesiumMath.EPSILON14); + expect(provider.rectangle.west).toBeGreaterThanOrEqualTo(provider.tilingScheme.rectangle.west); + expect(provider.rectangle.east).toEqualEpsilon(CesiumMath.toRadians(180.0), CesiumMath.EPSILON14); + expect(provider.rectangle.east).toBeLessThanOrEqualTo(provider.tilingScheme.rectangle.east); + expect(provider.rectangle.south).toEqualEpsilon(-WebMercatorProjection.MaximumLatitude, CesiumMath.EPSILON14); + expect(provider.rectangle.south).toBeGreaterThanOrEqualTo(provider.tilingScheme.rectangle.south); + expect(provider.rectangle.north).toEqualEpsilon(WebMercatorProjection.MaximumLatitude, CesiumMath.EPSILON14); + expect(provider.rectangle.north).toBeLessThanOrEqualTo(provider.tilingScheme.rectangle.north); }); }); diff --git a/Specs/Scene/TileSpec.js b/Specs/Scene/TileSpec.js index 9787cb22936d..665c01476c26 100644 --- a/Specs/Scene/TileSpec.js +++ b/Specs/Scene/TileSpec.js @@ -4,7 +4,7 @@ defineSuite([ 'Specs/createContext', 'Specs/destroyContext', 'Core/defined', - 'Core/Extent', + 'Core/Rectangle', 'Core/Math', 'Scene/CesiumTerrainProvider', 'Scene/ImageryLayerCollection', @@ -17,7 +17,7 @@ defineSuite([ createContext, destroyContext, defined, - Extent, + Rectangle, CesiumMath, CesiumTerrainProvider, ImageryLayerCollection, @@ -35,7 +35,7 @@ defineSuite([ }).toThrowDeveloperError(); }); - it('throws without description.extent', function() { + it('throws without description.rectangle', function() { expect(function() { return new Tile({ x : 0, @@ -47,7 +47,7 @@ defineSuite([ it('throws without description.level', function() { expect(function() { return new Tile({ - extent : new Extent( + rectangle : new Rectangle( -CesiumMath.PI_OVER_FOUR, 0.0, CesiumMath.PI_OVER_FOUR, @@ -69,11 +69,11 @@ defineSuite([ }).toThrowDeveloperError(); }); - it('creates extent on construction', function() { + it('creates rectangle on construction', function() { var desc = {tilingScheme : new WebMercatorTilingScheme(), x : 0, y : 0, level : 0}; var tile = new Tile(desc); - var extent = desc.tilingScheme.tileXYToExtent(desc.x, desc.y, desc.level); - expect(tile.extent).toEqual(extent); + var rectangle = desc.tilingScheme.tileXYToRectangle(desc.x, desc.y, desc.level); + expect(tile.rectangle).toEqual(rectangle); }); it('throws if constructed improperly', function() { @@ -87,7 +87,7 @@ defineSuite([ y : 0, level : 0, tilingScheme : { - tileXYToExtent : function() { + tileXYToRectangle : function() { return undefined; } } @@ -99,7 +99,7 @@ defineSuite([ y : 0, level : 0, tilingScheme : { - tileXYToExtent : function() { + tileXYToRectangle : function() { return undefined; } } @@ -111,7 +111,7 @@ defineSuite([ x : 0, level : 0, tilingScheme : { - tileXYToExtent : function() { + tileXYToRectangle : function() { return undefined; } } @@ -123,7 +123,7 @@ defineSuite([ x : 0, y : 0, tilingScheme : { - tileXYToExtent : function() { + tileXYToRectangle : function() { return undefined; } } diff --git a/Specs/Scene/TilingSchemeSpec.js b/Specs/Scene/TilingSchemeSpec.js index 04d7206e44c0..c19bdef71e1f 100644 --- a/Specs/Scene/TilingSchemeSpec.js +++ b/Specs/Scene/TilingSchemeSpec.js @@ -79,10 +79,10 @@ defineSuite([ var southwest = tiles[2]; var southeast = tiles[3]; - expect(northeast.extent.west).toBeGreaterThan(northwest.extent.west); - expect(southeast.extent.west).toBeGreaterThan(southwest.extent.west); - expect(northeast.extent.south).toBeGreaterThan(southeast.extent.south); - expect(northwest.extent.south).toBeGreaterThan(southwest.extent.south); + expect(northeast.rectangle.west).toBeGreaterThan(northwest.rectangle.west); + expect(southeast.rectangle.west).toBeGreaterThan(southwest.rectangle.west); + expect(northeast.rectangle.south).toBeGreaterThan(southeast.rectangle.south); + expect(northwest.rectangle.south).toBeGreaterThan(southwest.rectangle.south); }); }); }); \ No newline at end of file diff --git a/Specs/Scene/WebMapServiceImageryProviderSpec.js b/Specs/Scene/WebMapServiceImageryProviderSpec.js index b19c2fbab0ee..b2b45eeaf919 100644 --- a/Specs/Scene/WebMapServiceImageryProviderSpec.js +++ b/Specs/Scene/WebMapServiceImageryProviderSpec.js @@ -5,7 +5,7 @@ defineSuite([ 'Core/jsonp', 'Core/loadImage', 'Core/DefaultProxy', - 'Core/Extent', + 'Core/Rectangle', 'Core/Math', 'Scene/GeographicTilingScheme', 'Scene/Imagery', @@ -19,7 +19,7 @@ defineSuite([ jsonp, loadImage, DefaultProxy, - Extent, + Rectangle, CesiumMath, GeographicTilingScheme, Imagery, @@ -199,7 +199,7 @@ defineSuite([ expect(provider.tileHeight).toEqual(256); expect(provider.maximumLevel).toBeUndefined(); expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme); - expect(provider.extent).toEqual(new GeographicTilingScheme().extent); + expect(provider.rectangle).toEqual(new GeographicTilingScheme().rectangle); loadImage.createImage = function(url, crossOrigin, deferred) { // Just return any old image. @@ -300,12 +300,12 @@ defineSuite([ }); }); - it('uses extent passed to constructor', function() { - var extent = new Extent(0.1, 0.2, 0.3, 0.4); + it('uses rectangle passed to constructor', function() { + var rectangle = new Rectangle(0.1, 0.2, 0.3, 0.4); var provider = new WebMapServiceImageryProvider({ url : 'made/up/wms/server', layers : 'someLayer', - extent : extent + rectangle : rectangle }); waitsFor(function() { @@ -317,16 +317,16 @@ defineSuite([ expect(provider.tileHeight).toEqual(256); expect(provider.maximumLevel).toBeUndefined(); expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme); - expect(provider.extent).toEqual(extent); + expect(provider.rectangle).toEqual(rectangle); expect(provider.tileDiscardPolicy).toBeUndefined(); var calledLoadImage = false; loadImage.createImage = function(url, crossOrigin, deferred) { var bbox = 'bbox=' + - CesiumMath.toDegrees(extent.west) + ',' + - CesiumMath.toDegrees(extent.south) + ',' + - CesiumMath.toDegrees((extent.west + extent.east) / 2.0) + ',' + - CesiumMath.toDegrees(extent.north); + CesiumMath.toDegrees(rectangle.west) + ',' + + CesiumMath.toDegrees(rectangle.south) + ',' + + CesiumMath.toDegrees((rectangle.west + rectangle.east) / 2.0) + ',' + + CesiumMath.toDegrees(rectangle.north); expect(url.indexOf(bbox)).not.toBeLessThan(0); calledLoadImage = true; deferred.resolve(); diff --git a/Specs/Scene/WebMercatorTilingSchemeSpec.js b/Specs/Scene/WebMercatorTilingSchemeSpec.js index 38224083f111..00a353b52f47 100644 --- a/Specs/Scene/WebMercatorTilingSchemeSpec.js +++ b/Specs/Scene/WebMercatorTilingSchemeSpec.js @@ -3,7 +3,7 @@ defineSuite([ 'Scene/WebMercatorTilingScheme', 'Core/Cartesian2', 'Core/Ellipsoid', - 'Core/Extent', + 'Core/Rectangle', 'Core/Math', 'Core/Cartographic', 'Core/WebMercatorProjection', @@ -13,7 +13,7 @@ defineSuite([ WebMercatorTilingScheme, Cartesian2, Ellipsoid, - Extent, + Rectangle, CesiumMath, Cartographic, WebMercatorProjection, @@ -43,32 +43,32 @@ defineSuite([ expect(tilingScheme.ellipsoid).toEqual(Ellipsoid.UNIT_SPHERE); }); - describe('Conversions from tile indices to cartographic extents', function() { - it('tileXYToExtent returns full extent for single root tile.', function() { - var extent = tilingScheme.tileXYToExtent(0, 0, 0); - var tilingSchemeExtent = tilingScheme.extent; - expect(extent.west).toEqualEpsilon(tilingSchemeExtent.west, CesiumMath.EPSILON10); - expect(extent.south).toEqualEpsilon(tilingSchemeExtent.south, CesiumMath.EPSILON10); - expect(extent.east).toEqualEpsilon(tilingSchemeExtent.east, CesiumMath.EPSILON10); - expect(extent.north).toEqualEpsilon(tilingSchemeExtent.north, CesiumMath.EPSILON10); + describe('Conversions from tile indices to cartographic rectangles', function() { + it('tileXYToRectangle returns full rectangle for single root tile.', function() { + var rectangle = tilingScheme.tileXYToRectangle(0, 0, 0); + var tilingSchemeRectangle = tilingScheme.rectangle; + expect(rectangle.west).toEqualEpsilon(tilingSchemeRectangle.west, CesiumMath.EPSILON10); + expect(rectangle.south).toEqualEpsilon(tilingSchemeRectangle.south, CesiumMath.EPSILON10); + expect(rectangle.east).toEqualEpsilon(tilingSchemeRectangle.east, CesiumMath.EPSILON10); + expect(rectangle.north).toEqualEpsilon(tilingSchemeRectangle.north, CesiumMath.EPSILON10); }); - it('tileXYToExtent uses result parameter if provided', function() { - var tilingSchemeExtent = tilingScheme.extent; - var result = new Extent(0.0, 0.0, 0.0); - var extent = tilingScheme.tileXYToExtent(0, 0, 0, result); - expect(result).toEqual(extent); - expect(extent.west).toEqualEpsilon(tilingSchemeExtent.west, CesiumMath.EPSILON10); - expect(extent.south).toEqualEpsilon(tilingSchemeExtent.south, CesiumMath.EPSILON10); - expect(extent.east).toEqualEpsilon(tilingSchemeExtent.east, CesiumMath.EPSILON10); - expect(extent.north).toEqualEpsilon(tilingSchemeExtent.north, CesiumMath.EPSILON10); + it('tileXYToRectangle uses result parameter if provided', function() { + var tilingSchemeRectangle = tilingScheme.rectangle; + var result = new Rectangle(0.0, 0.0, 0.0); + var rectangle = tilingScheme.tileXYToRectangle(0, 0, 0, result); + expect(result).toEqual(rectangle); + expect(rectangle.west).toEqualEpsilon(tilingSchemeRectangle.west, CesiumMath.EPSILON10); + expect(rectangle.south).toEqualEpsilon(tilingSchemeRectangle.south, CesiumMath.EPSILON10); + expect(rectangle.east).toEqualEpsilon(tilingSchemeRectangle.east, CesiumMath.EPSILON10); + expect(rectangle.north).toEqualEpsilon(tilingSchemeRectangle.north, CesiumMath.EPSILON10); }); it('tiles are numbered from the northwest corner.', function() { - var northwest = tilingScheme.tileXYToExtent(0, 0, 1); - var northeast = tilingScheme.tileXYToExtent(1, 0, 1); - var southeast = tilingScheme.tileXYToExtent(1, 1, 1); - var southwest = tilingScheme.tileXYToExtent(0, 1, 1); + var northwest = tilingScheme.tileXYToRectangle(0, 0, 1); + var northeast = tilingScheme.tileXYToRectangle(1, 0, 1); + var southeast = tilingScheme.tileXYToRectangle(1, 1, 1); + var southwest = tilingScheme.tileXYToRectangle(0, 1, 1); expect(northeast.north).toEqual(northwest.north); expect(northeast.south).toEqual(northwest.south); @@ -92,10 +92,10 @@ defineSuite([ }); it('adjacent tiles have overlapping coordinates', function() { - var northwest = tilingScheme.tileXYToExtent(0, 0, 1); - var northeast = tilingScheme.tileXYToExtent(1, 0, 1); - var southeast = tilingScheme.tileXYToExtent(1, 1, 1); - var southwest = tilingScheme.tileXYToExtent(0, 1, 1); + var northwest = tilingScheme.tileXYToRectangle(0, 0, 1); + var northeast = tilingScheme.tileXYToRectangle(1, 0, 1); + var southeast = tilingScheme.tileXYToRectangle(1, 1, 1); + var southwest = tilingScheme.tileXYToRectangle(0, 1, 1); expect(northeast.south).toEqualEpsilon(southeast.north, CesiumMath.EPSILON15); expect(northwest.south).toEqualEpsilon(southwest.north, CesiumMath.EPSILON15); @@ -108,42 +108,42 @@ defineSuite([ describe('Conversions from cartographic positions to tile indices', function() { it('calculates correct tile indices for 4 corners at level 0', function() { var coordinates; - var tilingSchemeExtent = tilingScheme.extent; + var tilingSchemeRectangle = tilingScheme.rectangle; - coordinates = tilingScheme.positionToTileXY(Extent.getSouthwest(tilingSchemeExtent), 0); + coordinates = tilingScheme.positionToTileXY(Rectangle.getSouthwest(tilingSchemeRectangle), 0); expect(coordinates.x).toEqual(0); expect(coordinates.y).toEqual(0); - coordinates = tilingScheme.positionToTileXY(Extent.getNorthwest(tilingSchemeExtent), 0); + coordinates = tilingScheme.positionToTileXY(Rectangle.getNorthwest(tilingSchemeRectangle), 0); expect(coordinates.x).toEqual(0); expect(coordinates.y).toEqual(0); - coordinates = tilingScheme.positionToTileXY(Extent.getNortheast(tilingSchemeExtent), 0); + coordinates = tilingScheme.positionToTileXY(Rectangle.getNortheast(tilingSchemeRectangle), 0); expect(coordinates.x).toEqual(0); expect(coordinates.y).toEqual(0); - coordinates = tilingScheme.positionToTileXY(Extent.getSoutheast(tilingSchemeExtent), 0); + coordinates = tilingScheme.positionToTileXY(Rectangle.getSoutheast(tilingSchemeRectangle), 0); expect(coordinates.x).toEqual(0); expect(coordinates.y).toEqual(0); }); it('calculates correct tile indices for 4 corners at level 1', function() { var coordinates; - var tilingSchemeExtent = tilingScheme.extent; + var tilingSchemeRectangle = tilingScheme.rectangle; - coordinates = tilingScheme.positionToTileXY(Extent.getSouthwest(tilingSchemeExtent), 1); + coordinates = tilingScheme.positionToTileXY(Rectangle.getSouthwest(tilingSchemeRectangle), 1); expect(coordinates.x).toEqual(0); expect(coordinates.y).toEqual(1); - coordinates = tilingScheme.positionToTileXY(Extent.getNorthwest(tilingSchemeExtent), 1); + coordinates = tilingScheme.positionToTileXY(Rectangle.getNorthwest(tilingSchemeRectangle), 1); expect(coordinates.x).toEqual(0); expect(coordinates.y).toEqual(0); - coordinates = tilingScheme.positionToTileXY(Extent.getNortheast(tilingSchemeExtent), 1); + coordinates = tilingScheme.positionToTileXY(Rectangle.getNortheast(tilingSchemeRectangle), 1); expect(coordinates.x).toEqual(1); expect(coordinates.y).toEqual(0); - coordinates = tilingScheme.positionToTileXY(Extent.getSoutheast(tilingSchemeExtent), 1); + coordinates = tilingScheme.positionToTileXY(Rectangle.getSoutheast(tilingSchemeRectangle), 1); expect(coordinates.x).toEqual(1); expect(coordinates.y).toEqual(1); }); @@ -190,48 +190,48 @@ defineSuite([ expect(tilingScheme.projection).toBeInstanceOf(WebMercatorProjection); }); - describe('extentToNativeExtent', function() { + describe('rectangleToNativeRectangle', function() { it('converts radians to web mercator meters', function() { var tilingScheme = new WebMercatorTilingScheme(); - var extentInRadians = new Extent(0.1, 0.2, 0.3, 0.4); - var nativeExtent = tilingScheme.extentToNativeExtent(extentInRadians); + var rectangleInRadians = new Rectangle(0.1, 0.2, 0.3, 0.4); + var nativeRectangle = tilingScheme.rectangleToNativeRectangle(rectangleInRadians); var projection = new WebMercatorProjection(); - var expectedSouthwest = projection.project(Extent.getSouthwest(extentInRadians)); - var expectedNortheast = projection.project(Extent.getNortheast(extentInRadians)); + var expectedSouthwest = projection.project(Rectangle.getSouthwest(rectangleInRadians)); + var expectedNortheast = projection.project(Rectangle.getNortheast(rectangleInRadians)); - expect(nativeExtent.west).toEqualEpsilon(expectedSouthwest.x, CesiumMath.EPSILON13); - expect(nativeExtent.south).toEqualEpsilon(expectedSouthwest.y, CesiumMath.EPSILON13); - expect(nativeExtent.east).toEqualEpsilon(expectedNortheast.x, CesiumMath.EPSILON13); - expect(nativeExtent.north).toEqualEpsilon(expectedNortheast.y, CesiumMath.EPSILON13); + expect(nativeRectangle.west).toEqualEpsilon(expectedSouthwest.x, CesiumMath.EPSILON13); + expect(nativeRectangle.south).toEqualEpsilon(expectedSouthwest.y, CesiumMath.EPSILON13); + expect(nativeRectangle.east).toEqualEpsilon(expectedNortheast.x, CesiumMath.EPSILON13); + expect(nativeRectangle.north).toEqualEpsilon(expectedNortheast.y, CesiumMath.EPSILON13); }); it('uses result parameter if provided', function() { var tilingScheme = new WebMercatorTilingScheme(); - var extentInRadians = new Extent(0.1, 0.2, 0.3, 0.4); + var rectangleInRadians = new Rectangle(0.1, 0.2, 0.3, 0.4); var projection = new WebMercatorProjection(); - var expectedSouthwest = projection.project(Extent.getSouthwest(extentInRadians)); - var expectedNortheast = projection.project(Extent.getNortheast(extentInRadians)); + var expectedSouthwest = projection.project(Rectangle.getSouthwest(rectangleInRadians)); + var expectedNortheast = projection.project(Rectangle.getNortheast(rectangleInRadians)); - var resultExtent = new Extent(0.0, 0.0, 0.0, 0.0); - var outputExtent = tilingScheme.extentToNativeExtent(extentInRadians, resultExtent); - expect(outputExtent).toEqual(resultExtent); + var resultRectangle = new Rectangle(0.0, 0.0, 0.0, 0.0); + var outputRectangle = tilingScheme.rectangleToNativeRectangle(rectangleInRadians, resultRectangle); + expect(outputRectangle).toEqual(resultRectangle); - expect(resultExtent.west).toEqualEpsilon(expectedSouthwest.x, CesiumMath.EPSILON13); - expect(resultExtent.south).toEqualEpsilon(expectedSouthwest.y, CesiumMath.EPSILON13); - expect(resultExtent.east).toEqualEpsilon(expectedNortheast.x, CesiumMath.EPSILON13); - expect(resultExtent.north).toEqualEpsilon(expectedNortheast.y, CesiumMath.EPSILON13); + expect(resultRectangle.west).toEqualEpsilon(expectedSouthwest.x, CesiumMath.EPSILON13); + expect(resultRectangle.south).toEqualEpsilon(expectedSouthwest.y, CesiumMath.EPSILON13); + expect(resultRectangle.east).toEqualEpsilon(expectedNortheast.x, CesiumMath.EPSILON13); + expect(resultRectangle.north).toEqualEpsilon(expectedNortheast.y, CesiumMath.EPSILON13); }); }); describe('positionToTileXY', function() { - it('returns undefined when outside extent', function() { + it('returns undefined when outside rectangle', function() { var projection = new WebMercatorProjection(); - var extentInRadians = new Extent(0.1, 0.2, 0.3, 0.4); + var rectangleInRadians = new Rectangle(0.1, 0.2, 0.3, 0.4); var tilingScheme = new WebMercatorTilingScheme({ - extentSouthwestInMeters : projection.project(Extent.getSouthwest(extentInRadians)), - extentNortheastInMeters : projection.project(Extent.getNortheast(extentInRadians)) + rectangleSouthwestInMeters : projection.project(Rectangle.getSouthwest(rectangleInRadians)), + rectangleNortheastInMeters : projection.project(Rectangle.getNortheast(rectangleInRadians)) }); var tooFarWest = new Cartographic(0.05, 0.3); @@ -264,7 +264,7 @@ defineSuite([ it('does not return tile outside valid range', function() { var tilingScheme = new WebMercatorTilingScheme(); - var southeastCorner = Extent.getSoutheast(tilingScheme.extent); + var southeastCorner = Rectangle.getSoutheast(tilingScheme.rectangle); expect(tilingScheme.positionToTileXY(southeastCorner, 1)).toEqual(new Cartesian2(1, 1)); }); diff --git a/Specs/Widgets/CesiumInspector/CesiumInspectorViewModelSpec.js b/Specs/Widgets/CesiumInspector/CesiumInspectorViewModelSpec.js index 38d69d0b78bd..4bf3e10a26f8 100644 --- a/Specs/Widgets/CesiumInspector/CesiumInspectorViewModelSpec.js +++ b/Specs/Widgets/CesiumInspector/CesiumInspectorViewModelSpec.js @@ -3,9 +3,9 @@ defineSuite([ 'Widgets/CesiumInspector/CesiumInspectorViewModel', 'Specs/createScene', 'Specs/destroyScene', - 'Core/Extent', + 'Core/Rectangle', 'Core/defined', - 'Scene/ExtentPrimitive', + 'Scene/RectanglePrimitive', 'Scene/Tile', 'Scene/WebMercatorTilingScheme', 'Scene/Material', @@ -15,9 +15,9 @@ defineSuite([ CesiumInspectorViewModel, createScene, destroyScene, - Extent, + Rectangle, defined, - ExtentPrimitive, + RectanglePrimitive, Tile, WebMercatorTilingScheme, Material, @@ -82,8 +82,8 @@ defineSuite([ }); it ('primitive bounding sphere', function() { - var p = scene.primitives.add(new ExtentPrimitive({ - extent : new Extent( + var p = scene.primitives.add(new RectanglePrimitive({ + rectangle : new Rectangle( CesiumMath.toRadians(-110.0), CesiumMath.toRadians(0.0), CesiumMath.toRadians(-90.0), @@ -106,8 +106,8 @@ defineSuite([ }); it ('primitive filter', function() { - var p = scene.primitives.add(new ExtentPrimitive({ - extent : new Extent( + var p = scene.primitives.add(new RectanglePrimitive({ + rectangle : new Rectangle( CesiumMath.toRadians(-110.0), CesiumMath.toRadians(0.0), CesiumMath.toRadians(-90.0), @@ -117,8 +117,8 @@ defineSuite([ }) ); - var q = scene.primitives.add(new ExtentPrimitive({ - extent : new Extent( + var q = scene.primitives.add(new RectanglePrimitive({ + rectangle : new Rectangle( CesiumMath.toRadians(-10.0), CesiumMath.toRadians(0.0), CesiumMath.toRadians(-9.0), @@ -142,8 +142,8 @@ defineSuite([ }); it ('primitive reference frame', function() { - var p = scene.primitives.add(new ExtentPrimitive({ - extent : new Extent( + var p = scene.primitives.add(new RectanglePrimitive({ + rectangle : new Rectangle( CesiumMath.toRadians(-110.0), CesiumMath.toRadians(0.0), CesiumMath.toRadians(-90.0),