From 2fd0e8f7e4212bd1e7084299187f70597a6bbfd8 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Thu, 16 Apr 2020 20:31:36 -0400 Subject: [PATCH] Format all code with prettier --- .github/ISSUE_TEMPLATE/question.md | 4 +- Apps/CesiumViewer/CesiumViewer.css | 54 +- Apps/CesiumViewer/CesiumViewer.js | 381 +- Apps/CesiumViewer/index.html | 19 +- Apps/HelloWorld.html | 49 +- Apps/Sandcastle/CesiumSandcastle.css | 287 +- Apps/Sandcastle/CesiumSandcastle.js | 2614 +- Apps/Sandcastle/LinkButton.js | 63 +- Apps/Sandcastle/Sandcastle-client.js | 343 +- Apps/Sandcastle/Sandcastle-header.js | 197 +- Apps/Sandcastle/Sandcastle-helpers.js | 79 +- .../gallery/3D Models Coloring.html | 542 +- Apps/Sandcastle/gallery/3D Models.html | 212 +- .../gallery/3D Tiles Adjust Height.html | 177 +- Apps/Sandcastle/gallery/3D Tiles BIM.html | 375 +- .../3D Tiles Batch Table Hierarchy.html | 417 +- .../gallery/3D Tiles Clipping Planes.html | 520 +- .../gallery/3D Tiles Feature Picking.html | 526 +- .../gallery/3D Tiles Feature Styling.html | 308 +- Apps/Sandcastle/gallery/3D Tiles Formats.html | 355 +- .../gallery/3D Tiles Inspector.html | 103 +- .../gallery/3D Tiles Interactivity.html | 445 +- .../Sandcastle/gallery/3D Tiles Interior.html | 104 +- ...D Tiles Photogrammetry Classification.html | 139 +- .../gallery/3D Tiles Photogrammetry.html | 86 +- .../3D Tiles Point Cloud Classification.html | 194 +- .../gallery/3D Tiles Point Cloud Shading.html | 569 +- .../gallery/3D Tiles Point Cloud Styling.html | 446 +- .../gallery/3D Tiles Point Cloud.html | 100 +- .../3D Tiles Terrain Classification.html | 149 +- .../Sandcastle/gallery/Ambient Occlusion.html | 300 +- Apps/Sandcastle/gallery/ArcGIS MapServer.html | 92 +- .../ArcGIS Tiled Elevation Terrain.html | 75 +- Apps/Sandcastle/gallery/ArcticDEM.html | 207 +- Apps/Sandcastle/gallery/Billboards.html | 601 +- Apps/Sandcastle/gallery/Bloom.html | 271 +- Apps/Sandcastle/gallery/Blue Marble.html | 77 +- Apps/Sandcastle/gallery/Box.html | 126 +- Apps/Sandcastle/gallery/CZML 3D Tiles.html | 112 +- .../gallery/CZML Billboard and Label.html | 145 +- Apps/Sandcastle/gallery/CZML Box.html | 201 +- .../gallery/CZML Circles and Ellipses.html | 210 +- Apps/Sandcastle/gallery/CZML Colors.html | 166 +- .../gallery/CZML Cones and Cylinders.html | 168 +- Apps/Sandcastle/gallery/CZML Corridor.html | 253 +- .../gallery/CZML Custom Properties.html | 294 +- .../CZML Model - Node Transformations.html | 184 +- .../gallery/CZML Model Articulations.html | 179 +- .../gallery/CZML Model Data URL.html | 319 +- Apps/Sandcastle/gallery/CZML Model.html | 125 +- Apps/Sandcastle/gallery/CZML Path.html | 9125 ++++-- .../gallery/CZML Point - Time Dynamic.html | 143 +- Apps/Sandcastle/gallery/CZML Point.html | 119 +- ...ML Polygon - Interpolating References.html | 373 +- ...ZML Polygon - Intervals, Availability.html | 375 +- Apps/Sandcastle/gallery/CZML Polygon.html | 381 +- Apps/Sandcastle/gallery/CZML Polyline.html | 277 +- .../gallery/CZML Position Definitions.html | 191 +- Apps/Sandcastle/gallery/CZML Rectangle.html | 240 +- .../gallery/CZML Reference Properties.html | 238 +- .../gallery/CZML Spheres and Ellipsoids.html | 209 +- Apps/Sandcastle/gallery/CZML Wall.html | 161 +- Apps/Sandcastle/gallery/CZML ZIndex.html | 264 +- Apps/Sandcastle/gallery/CZML.html | 111 +- .../Sandcastle/gallery/Callback Property.html | 198 +- Apps/Sandcastle/gallery/Camera Tutorial.html | 342 +- Apps/Sandcastle/gallery/Camera.html | 834 +- Apps/Sandcastle/gallery/Cardboard.html | 333 +- .../gallery/Cartographic Limit Rectangle.html | 146 +- Apps/Sandcastle/gallery/Cesium Inspector.html | 180 +- Apps/Sandcastle/gallery/Cesium Widget.html | 81 +- .../gallery/Cesium World Terrain.html | 77 +- .../gallery/Circles and Ellipses.html | 137 +- .../Sandcastle/gallery/Clamp to 3D Model.html | 191 +- .../Sandcastle/gallery/Clamp to 3D Tiles.html | 149 +- Apps/Sandcastle/gallery/Clamp to Terrain.html | 577 +- .../gallery/Classification Types.html | 259 +- Apps/Sandcastle/gallery/Classification.html | 593 +- Apps/Sandcastle/gallery/Clock.html | 114 +- Apps/Sandcastle/gallery/Clustering.html | 322 +- Apps/Sandcastle/gallery/Corridor.html | 167 +- .../Sandcastle/gallery/Custom DataSource.html | 718 +- Apps/Sandcastle/gallery/Custom Geocoder.html | 153 +- .../Custom Per-Feature Post Process.html | 164 +- .../gallery/Custom Post Process.html | 139 +- .../gallery/Cylinders and Cones.html | 114 +- .../gallery/DataSource Ordering.html | 240 +- Apps/Sandcastle/gallery/Depth of Field.html | 265 +- .../gallery/Distance Display Conditions.html | 199 +- .../gallery/Drawing on Terrain.html | 304 +- Apps/Sandcastle/gallery/Earth at Night.html | 77 +- Apps/Sandcastle/gallery/Export KML.html | 256 +- Apps/Sandcastle/gallery/FXAA.html | 106 +- .../gallery/GeoJSON and TopoJSON.html | 203 +- .../gallery/GeoJSON simplestyle.html | 95 +- .../gallery/Geometry Height Reference.html | 296 +- .../gallery/Geometry and Appearances.html | 1108 +- Apps/Sandcastle/gallery/Globe Materials.html | 632 +- .../gallery/Google Earth Enterprise.html | 103 +- .../Sandcastle/gallery/Ground Atmosphere.html | 353 +- Apps/Sandcastle/gallery/HTML Overlays.html | 106 +- Apps/Sandcastle/gallery/HeadingPitchRoll.html | 402 +- Apps/Sandcastle/gallery/Hello World.html | 71 +- .../gallery/High Dynamic Range.html | 148 +- .../gallery/Image-Based Lighting.html | 303 +- .../gallery/Imagery Adjustment.html | 271 +- .../gallery/Imagery Color To Alpha.html | 143 +- Apps/Sandcastle/gallery/Imagery Cutout.html | 295 +- .../gallery/Imagery Layers Manipulation.html | 522 +- .../gallery/Imagery Layers Split.html | 198 +- .../Imagery Layers Texture Filters.html | 202 +- Apps/Sandcastle/gallery/Imagery Layers.html | 102 +- Apps/Sandcastle/gallery/Interpolation.html | 358 +- Apps/Sandcastle/gallery/KML Tours.html | 141 +- Apps/Sandcastle/gallery/KML.html | 164 +- Apps/Sandcastle/gallery/Labels SDF.html | 269 +- Apps/Sandcastle/gallery/Labels.html | 371 +- Apps/Sandcastle/gallery/LensFlare.html | 256 +- Apps/Sandcastle/gallery/Lighting.html | 399 +- .../Sandcastle/gallery/LocalToFixedFrame.html | 433 +- Apps/Sandcastle/gallery/Map Pins.html | 166 +- Apps/Sandcastle/gallery/Materials.html | 1068 +- .../gallery/Montreal Point Cloud.html | 655 +- Apps/Sandcastle/gallery/Multi-part CZML.html | 315 +- .../gallery/Multiple Synced Views.html | 216 +- Apps/Sandcastle/gallery/Natural Earth II.html | 77 +- Apps/Sandcastle/gallery/Offline.html | 91 +- Apps/Sandcastle/gallery/PAMAP Terrain.html | 236 +- .../gallery/Parallels and Meridians.html | 535 +- .../gallery/Partial Ellipsoids.html | 389 +- .../gallery/Particle System Fireworks.html | 377 +- .../gallery/Particle System Tails.html | 509 +- .../gallery/Particle System Weather.html | 374 +- Apps/Sandcastle/gallery/Particle System.html | 710 +- .../gallery/Per-Feature Post Processing.html | 184 +- .../gallery/Physically-Based Materials.html | 320 +- Apps/Sandcastle/gallery/Picking.html | 477 +- Apps/Sandcastle/gallery/Plane.html | 130 +- Apps/Sandcastle/gallery/Points.html | 316 +- Apps/Sandcastle/gallery/Polygon.html | 335 +- Apps/Sandcastle/gallery/Polyline Dash.html | 218 +- Apps/Sandcastle/gallery/Polyline Volume.html | 214 +- Apps/Sandcastle/gallery/Polyline.html | 225 +- .../gallery/Polylines on 3D Tiles.html | 250 +- Apps/Sandcastle/gallery/Post Processing.html | 243 +- Apps/Sandcastle/gallery/Projection.html | 118 +- Apps/Sandcastle/gallery/Rectangle.html | 152 +- .../gallery/Resolution Scaling.html | 177 +- Apps/Sandcastle/gallery/Rotatable 2D Map.html | 89 +- .../gallery/Sample Height from 3D Tiles.html | 204 +- .../gallery/Scene Rendering Performance.html | 581 +- Apps/Sandcastle/gallery/Sentinel-2.html | 77 +- Apps/Sandcastle/gallery/Shadows.html | 517 +- .../gallery/Show or Hide Entities.html | 156 +- Apps/Sandcastle/gallery/Sky Atmosphere.html | 235 +- .../gallery/Spheres and Ellipsoids.html | 130 +- Apps/Sandcastle/gallery/Star Burst.html | 696 +- .../gallery/Terrain Clipping Planes.html | 627 +- .../gallery/Terrain Exaggeration.html | 181 +- Apps/Sandcastle/gallery/Terrain.html | 488 +- .../gallery/Time Dynamic Point Cloud.html | 162 +- .../gallery/Time Dynamic Wheels.html | 256 +- Apps/Sandcastle/gallery/Video.html | 232 +- Apps/Sandcastle/gallery/Wall.html | 209 +- .../gallery/Washington DC 2017.html | 79 +- .../gallery/Web Map Service (WMS).html | 105 +- .../Web Map Tile Service with Time.html | 172 +- .../gallery/Z-Indexing Geometry.html | 236 +- .../development/3D Models Articulations.html | 266 +- .../development/3D Models Instancing.html | 550 +- .../development/3D Models Node Explorer.html | 559 +- .../gallery/development/3D Models.html | 493 +- .../3D Tiles Performance Testing.html | 452 +- .../development/BillboardClampToGround.html | 267 +- .../development/Billboards Instancing.html | 388 +- .../gallery/development/Billboards.html | 785 +- .../gallery/development/Box Outline.html | 142 +- Apps/Sandcastle/gallery/development/Box.html | 138 +- .../gallery/development/Circle Outline.html | 186 +- .../gallery/development/Circle.html | 232 +- .../development/Coplanar Polygon Outline.html | 219 +- .../gallery/development/Coplanar Polygon.html | 267 +- .../gallery/development/Corridor Outline.html | 178 +- .../gallery/development/Corridor.html | 275 +- .../gallery/development/Cylinder Outline.html | 149 +- .../gallery/development/Cylinder.html | 200 +- .../development/Display Conditions.html | 210 +- .../gallery/development/Ellipse Outline.html | 173 +- .../gallery/development/Ellipse.html | 214 +- .../development/Ellipsoid Outline.html | 143 +- .../development/Ellipsoid Surface.html | 203 +- .../gallery/development/Ellipsoid.html | 141 +- Apps/Sandcastle/gallery/development/Fog.html | 240 +- .../gallery/development/Frustum.html | 193 +- ...fset Attribute box cylinder ellipsoid.html | 456 +- .../Geometry Offset Attribute.html | 425 +- .../development/Geometry and Appearances.html | 2241 +- .../development/Ground Polyline Material.html | 200 +- .../Ground Primitive Materials.html | 974 +- .../gallery/development/Ground Primitive.html | 847 +- .../gallery/development/Labels.html | 384 +- .../development/Many Clipping Planes.html | 528 +- .../gallery/development/Material.html | 152 +- .../gallery/development/Multiple Shadows.html | 188 +- .../development/Per Instance Color.html | 111 +- .../gallery/development/Pick From Ray.html | 349 +- .../gallery/development/Picking.html | 1148 +- .../gallery/development/PointPrimitives.html | 505 +- .../gallery/development/Polygon Outline.html | 253 +- .../gallery/development/Polygon.html | 358 +- .../gallery/development/Polyline Color.html | 165 +- .../development/Polyline Material.html | 187 +- .../development/Polyline Volume Outline.html | 207 +- .../gallery/development/Polyline Volume.html | 284 +- .../gallery/development/Polyline.html | 162 +- .../development/Polylines On Terrain.html | 595 +- .../gallery/development/Polylines.html | 317 +- .../development/Rectangle Outline.html | 116 +- .../gallery/development/Rectangle.html | 146 +- .../gallery/development/Shadows.html | 1719 +- .../gallery/development/Simple Polyline.html | 205 +- .../gallery/development/Sphere Outline.html | 141 +- .../gallery/development/Sphere.html | 141 +- .../development/Terrain Entity Batching.html | 288 +- .../development/Terrain Performance.html | 476 +- .../gallery/development/Terrain Tweaks.html | 236 +- .../gallery/development/Volumes.html | 118 +- .../gallery/development/Wall Outline.html | 124 +- Apps/Sandcastle/gallery/development/Wall.html | 272 +- Apps/Sandcastle/index.html | 414 +- Apps/Sandcastle/load-cesium-es6.js | 4 +- Apps/Sandcastle/standalone.html | 88 +- Apps/Sandcastle/templates/LinkButton.html | 19 +- .../templates/bucket-requirejs.html | 28 +- Apps/Sandcastle/templates/bucket.html | 19 +- Apps/Sandcastle/templates/bucketRaw.css | 76 +- Apps/TimelineDemo/TimelineDemo.js | 439 +- Apps/TimelineDemo/boot.js | 61 +- Apps/TimelineDemo/index.html | 442 +- CHANGES.md | 6230 ++-- CODE_OF_CONDUCT.md | 2 +- CONTRIBUTING.md | 89 +- CONTRIBUTORS.md | 499 +- .../Contributors/BuildGuide/README.md | 151 +- .../Contributors/CodeReviewGuide/README.md | 100 +- .../Contributors/CodingGuide/README.md | 860 +- .../Contributors/CommittersGuide/README.md | 12 +- .../Contributors/DocumentationGuide/README.md | 175 +- .../DracoModuleManagement/README.md | 9 +- .../Contributors/PresentersGuide/README.md | 98 +- Documentation/Contributors/README.md | 22 +- .../Contributors/TestingGuide/README.md | 679 +- .../Contributors/VSCodeGuide/README.md | 52 +- LICENSE.md | 842 +- README.md | 11 +- Source/Core/ApproximateTerrainHeights.js | 451 +- .../ArcGISTiledElevationTerrainProvider.js | 1236 +- Source/Core/ArcType.js | 57 +- Source/Core/AssociativeArray.js | 234 +- Source/Core/AttributeCompression.js | 775 +- Source/Core/AxisAlignedBoundingBox.js | 441 +- Source/Core/BingMapsApi.js | 48 +- Source/Core/BingMapsGeocoderService.js | 164 +- Source/Core/BoundingRectangle.js | 729 +- Source/Core/BoundingSphere.js | 2760 +- Source/Core/BoxGeometry.js | 1747 +- Source/Core/BoxOutlineGeometry.js | 615 +- Source/Core/Cartesian2.js | 1499 +- Source/Core/Cartesian3.js | 2259 +- Source/Core/Cartesian4.js | 1850 +- Source/Core/Cartographic.js | 511 +- Source/Core/CartographicGeocoderService.js | 103 +- Source/Core/CatmullRomSpline.js | 547 +- Source/Core/CesiumTerrainProvider.js | 2314 +- Source/Core/Check.js | 377 +- Source/Core/CircleGeometry.js | 359 +- Source/Core/CircleOutlineGeometry.js | 262 +- Source/Core/Clock.js | 557 +- Source/Core/ClockRange.js | 73 +- Source/Core/ClockStep.js | 71 +- Source/Core/Color.js | 4432 +-- Source/Core/ColorGeometryInstanceAttribute.js | 335 +- Source/Core/ComponentDatatype.js | 616 +- Source/Core/CompressedTextureBuffer.js | 171 +- Source/Core/CoplanarPolygonGeometry.js | 944 +- Source/Core/CoplanarPolygonGeometryLibrary.js | 233 +- Source/Core/CoplanarPolygonOutlineGeometry.js | 443 +- Source/Core/CornerType.js | 69 +- Source/Core/CorridorGeometry.js | 2456 +- Source/Core/CorridorGeometryLibrary.js | 727 +- Source/Core/CorridorOutlineGeometry.js | 1123 +- Source/Core/Credit.js | 315 +- Source/Core/CubicRealPolynomial.js | 464 +- Source/Core/CullingVolume.js | 415 +- Source/Core/CylinderGeometry.js | 891 +- Source/Core/CylinderGeometryLibrary.js | 96 +- Source/Core/CylinderOutlineGeometry.js | 509 +- Source/Core/DefaultProxy.js | 45 +- Source/Core/DeveloperError.js | 128 +- Source/Core/DistanceDisplayCondition.js | 340 +- ...splayConditionGeometryInstanceAttribute.js | 306 +- Source/Core/DoublyLinkedList.js | 222 +- Source/Core/EarthOrientationParameters.js | 777 +- .../Core/EarthOrientationParametersSample.js | 89 +- Source/Core/EasingFunction.js | 486 +- Source/Core/EllipseGeometry.js | 2314 +- Source/Core/EllipseGeometryLibrary.js | 615 +- Source/Core/EllipseOutlineGeometry.js | 823 +- Source/Core/Ellipsoid.js | 1324 +- Source/Core/EllipsoidGeodesic.js | 900 +- Source/Core/EllipsoidGeometry.js | 1219 +- Source/Core/EllipsoidOutlineGeometry.js | 895 +- Source/Core/EllipsoidRhumbLine.js | 1212 +- Source/Core/EllipsoidTangentPlane.js | 710 +- Source/Core/EllipsoidTerrainProvider.js | 369 +- Source/Core/EllipsoidalOccluder.js | 956 +- Source/Core/EncodedCartesian3.js | 336 +- Source/Core/Event.js | 316 +- Source/Core/EventHelper.js | 134 +- Source/Core/ExtrapolationType.js | 63 +- Source/Core/FeatureDetection.js | 672 +- Source/Core/FrustumGeometry.js | 1052 +- Source/Core/FrustumOutlineGeometry.js | 486 +- Source/Core/Fullscreen.js | 498 +- Source/Core/GeocodeType.js | 45 +- Source/Core/GeocoderService.js | 51 +- Source/Core/GeographicProjection.js | 190 +- Source/Core/GeographicTilingScheme.js | 476 +- Source/Core/Geometry.js | 698 +- Source/Core/GeometryAttribute.js | 257 +- Source/Core/GeometryAttributes.js | 160 +- Source/Core/GeometryInstance.js | 222 +- Source/Core/GeometryInstanceAttribute.js | 257 +- Source/Core/GeometryOffsetAttribute.js | 19 +- Source/Core/GeometryPipeline.js | 5711 ++-- Source/Core/GeometryType.js | 19 +- Source/Core/GoogleEarthEnterpriseMetadata.js | 1137 +- .../Core/GoogleEarthEnterpriseTerrainData.js | 1059 +- .../GoogleEarthEnterpriseTerrainProvider.js | 1188 +- .../GoogleEarthEnterpriseTileInformation.js | 235 +- Source/Core/GregorianDate.js | 110 +- Source/Core/GroundPolylineGeometry.js | 2761 +- Source/Core/HeadingPitchRange.js | 102 +- Source/Core/HeadingPitchRoll.js | 379 +- Source/Core/Heap.js | 440 +- Source/Core/HeightmapEncoding.js | 47 +- Source/Core/HeightmapTerrainData.js | 1540 +- Source/Core/HeightmapTessellator.js | 941 +- Source/Core/HermitePolynomialApproximation.js | 596 +- Source/Core/HermiteSpline.js | 1113 +- Source/Core/Iau2000Orientation.js | 266 +- Source/Core/Iau2006XysData.js | 526 +- Source/Core/Iau2006XysSample.js | 59 +- Source/Core/IauOrientationAxes.js | 199 +- Source/Core/IauOrientationParameters.js | 96 +- Source/Core/IndexDatatype.js | 306 +- Source/Core/InterpolationAlgorithm.js | 116 +- Source/Core/Intersect.js | 63 +- Source/Core/IntersectionTests.js | 1893 +- Source/Core/Intersections2D.js | 687 +- Source/Core/Interval.js | 46 +- Source/Core/Ion.js | 88 +- Source/Core/IonGeocoderService.js | 124 +- Source/Core/IonResource.js | 497 +- Source/Core/Iso8601.js | 92 +- Source/Core/JulianDate.js | 2265 +- Source/Core/KeyboardEventModifier.js | 59 +- .../Core/LagrangePolynomialApproximation.js | 116 +- Source/Core/LeapSecond.js | 45 +- Source/Core/LinearApproximation.js | 136 +- Source/Core/LinearSpline.js | 279 +- Source/Core/ManagedArray.js | 264 +- Source/Core/MapProjection.js | 112 +- Source/Core/MapboxApi.js | 105 +- Source/Core/Math.js | 2119 +- Source/Core/Matrix2.js | 1746 +- Source/Core/Matrix3.js | 3092 +- Source/Core/Matrix4.js | 5560 ++-- Source/Core/NearFarScalar.js | 309 +- Source/Core/Occluder.js | 1228 +- .../Core/OffsetGeometryInstanceAttribute.js | 230 +- Source/Core/OpenCageGeocoderService.js | 216 +- Source/Core/OrientedBoundingBox.js | 1844 +- Source/Core/OrthographicFrustum.js | 621 +- Source/Core/OrthographicOffCenterFrustum.js | 848 +- Source/Core/Packable.js | 72 +- Source/Core/PackableForInterpolation.js | 78 +- Source/Core/PeliasGeocoderService.js | 164 +- Source/Core/PerspectiveFrustum.js | 813 +- Source/Core/PerspectiveOffCenterFrustum.js | 961 +- Source/Core/PinBuilder.js | 460 +- Source/Core/PixelFormat.js | 680 +- Source/Core/Plane.js | 481 +- Source/Core/PlaneGeometry.js | 490 +- Source/Core/PlaneOutlineGeometry.js | 198 +- Source/Core/PolygonGeometry.js | 2356 +- Source/Core/PolygonGeometryLibrary.js | 1288 +- Source/Core/PolygonHierarchy.js | 44 +- Source/Core/PolygonOutlineGeometry.js | 1222 +- Source/Core/PolygonPipeline.js | 892 +- Source/Core/PolylineGeometry.js | 1023 +- Source/Core/PolylinePipeline.js | 1016 +- Source/Core/PolylineVolumeGeometry.js | 786 +- Source/Core/PolylineVolumeGeometryLibrary.js | 1061 +- Source/Core/PolylineVolumeOutlineGeometry.js | 573 +- Source/Core/PrimitiveType.js | 148 +- Source/Core/QuadraticRealPolynomial.js | 272 +- Source/Core/QuantizedMeshTerrainData.js | 1369 +- Source/Core/QuarticRealPolynomial.js | 641 +- Source/Core/Quaternion.js | 2149 +- Source/Core/QuaternionSpline.js | 267 +- Source/Core/Queue.js | 223 +- Source/Core/Ray.js | 144 +- Source/Core/Rectangle.js | 1780 +- Source/Core/RectangleCollisionChecker.js | 156 +- Source/Core/RectangleGeometry.js | 2644 +- Source/Core/RectangleGeometryLibrary.js | 502 +- Source/Core/RectangleOutlineGeometry.js | 962 +- Source/Core/ReferenceFrame.js | 43 +- Source/Core/Request.js | 384 +- Source/Core/RequestErrorEvent.js | 104 +- Source/Core/RequestScheduler.js | 893 +- Source/Core/RequestState.js | 99 +- Source/Core/RequestType.js | 71 +- Source/Core/Resource.js | 4215 +-- Source/Core/RuntimeError.js | 112 +- Source/Core/ScreenSpaceEventHandler.js | 1815 +- Source/Core/ScreenSpaceEventType.js | 225 +- Source/Core/ShowGeometryInstanceAttribute.js | 230 +- Source/Core/Simon1994PlanetaryPositions.js | 1210 +- Source/Core/SimplePolylineGeometry.js | 847 +- Source/Core/SphereGeometry.js | 207 +- Source/Core/SphereOutlineGeometry.js | 208 +- Source/Core/Spherical.js | 362 +- Source/Core/Spline.js | 314 +- Source/Core/TaskProcessor.js | 671 +- Source/Core/TerrainData.js | 206 +- Source/Core/TerrainEncoding.js | 837 +- Source/Core/TerrainMesh.js | 313 +- Source/Core/TerrainProvider.js | 824 +- Source/Core/TerrainQuantization.js | 47 +- Source/Core/TileAvailability.js | 967 +- Source/Core/TileEdge.js | 27 +- Source/Core/TileProviderError.js | 299 +- Source/Core/TilingScheme.js | 234 +- Source/Core/TimeConstants.js | 147 +- Source/Core/TimeInterval.js | 830 +- Source/Core/TimeIntervalCollection.js | 2115 +- Source/Core/TimeStandard.js | 57 +- Source/Core/Tipsify.js | 549 +- Source/Core/Transforms.js | 2011 +- Source/Core/TranslationRotationScale.js | 104 +- Source/Core/TridiagonalSystemSolver.js | 192 +- Source/Core/TrustedServers.js | 262 +- Source/Core/VRTheWorldTerrainProvider.js | 762 +- Source/Core/VertexFormat.js | 558 +- Source/Core/VideoSynchronizer.js | 431 +- Source/Core/Visibility.js | 63 +- Source/Core/WallGeometry.js | 1159 +- Source/Core/WallGeometryLibrary.js | 404 +- Source/Core/WallOutlineGeometry.js | 826 +- Source/Core/WebGLConstants.js | 1201 +- Source/Core/WebMercatorProjection.js | 273 +- Source/Core/WebMercatorTilingScheme.js | 537 +- Source/Core/WeightSpline.js | 279 +- Source/Core/WindingOrder.js | 60 +- Source/Core/appendForwardSlash.js | 19 +- Source/Core/arrayFill.js | 90 +- Source/Core/arrayRemoveDuplicates.js | 169 +- Source/Core/arraySlice.js | 74 +- Source/Core/barycentricCoordinates.js | 194 +- Source/Core/binarySearch.js | 122 +- Source/Core/buildModuleUrl.js | 257 +- Source/Core/cancelAnimationFrame.js | 78 +- Source/Core/clone.js | 54 +- Source/Core/combine.js | 140 +- Source/Core/createGuid.js | 43 +- Source/Core/createWorldTerrain.js | 78 +- .../Core/decodeGoogleEarthEnterpriseData.js | 146 +- Source/Core/defaultValue.js | 51 +- Source/Core/defined.js | 33 +- Source/Core/deprecationWarning.js | 100 +- Source/Core/destroyObject.js | 97 +- Source/Core/formatError.js | 50 +- Source/Core/getAbsoluteUri.js | 78 +- Source/Core/getBaseUri.js | 82 +- Source/Core/getExtensionFromUri.js | 70 +- Source/Core/getFilenameFromUri.js | 58 +- Source/Core/getImagePixels.js | 74 +- Source/Core/getMagic.js | 22 +- Source/Core/getStringFromTypedArray.js | 286 +- Source/Core/getTimestamp.js | 45 +- Source/Core/isArray.js | 45 +- Source/Core/isBitSet.js | 13 +- Source/Core/isBlobUri.js | 36 +- Source/Core/isCrossOriginUrl.js | 46 +- Source/Core/isDataUri.js | 36 +- Source/Core/isLeapYear.js | 40 +- Source/Core/loadAndExecuteScript.js | 42 +- Source/Core/loadCRN.js | 155 +- Source/Core/loadImageFromTypedArray.js | 104 +- Source/Core/loadKTX.js | 495 +- Source/Core/mergeSort.js | 184 +- Source/Core/objectToQuery.js | 98 +- Source/Core/oneTimeWarning.js | 86 +- Source/Core/parseResponseHeaders.js | 65 +- Source/Core/pointInsideTriangle.js | 52 +- Source/Core/queryToObject.js | 108 +- Source/Core/requestAnimationFrame.js | 132 +- Source/Core/sampleTerrain.js | 218 +- Source/Core/sampleTerrainMostDetailed.js | 204 +- Source/Core/scaleToGeodeticSurface.js | 271 +- Source/Core/subdivideArray.js | 62 +- Source/Core/webGLConstantToGlslType.js | 46 +- Source/Core/wrapFunction.js | 44 +- Source/Core/writeTextToCanvas.js | 263 +- Source/DataSources/BillboardGraphics.js | 757 +- Source/DataSources/BillboardVisualizer.js | 577 +- Source/DataSources/BoundingSphereState.js | 51 +- Source/DataSources/BoxGeometryUpdater.js | 528 +- Source/DataSources/BoxGraphics.js | 394 +- Source/DataSources/CallbackProperty.js | 195 +- Source/DataSources/Cesium3DTilesetGraphics.js | 121 +- .../DataSources/Cesium3DTilesetVisualizer.js | 343 +- .../CheckerboardMaterialProperty.js | 262 +- Source/DataSources/ColorMaterialProperty.js | 187 +- .../DataSources/CompositeEntityCollection.js | 1124 +- .../DataSources/CompositeMaterialProperty.js | 231 +- .../DataSources/CompositePositionProperty.js | 271 +- Source/DataSources/CompositeProperty.js | 280 +- .../DataSources/ConstantPositionProperty.js | 262 +- Source/DataSources/ConstantProperty.js | 212 +- Source/DataSources/CorridorGeometryUpdater.js | 647 +- Source/DataSources/CorridorGraphics.js | 569 +- Source/DataSources/CustomDataSource.js | 310 +- Source/DataSources/CylinderGeometryUpdater.js | 596 +- Source/DataSources/CylinderGraphics.js | 497 +- Source/DataSources/CzmlDataSource.js | 7182 ++-- Source/DataSources/DataSource.js | 228 +- Source/DataSources/DataSourceClock.js | 300 +- Source/DataSources/DataSourceCollection.js | 654 +- Source/DataSources/DataSourceDisplay.js | 948 +- Source/DataSources/DynamicGeometryBatch.js | 92 +- Source/DataSources/DynamicGeometryUpdater.js | 495 +- Source/DataSources/EllipseGeometryUpdater.js | 684 +- Source/DataSources/EllipseGraphics.js | 620 +- .../DataSources/EllipsoidGeometryUpdater.js | 1119 +- Source/DataSources/EllipsoidGraphics.js | 562 +- Source/DataSources/Entity.js | 1380 +- Source/DataSources/EntityCluster.js | 1690 +- Source/DataSources/EntityCollection.js | 845 +- Source/DataSources/EntityView.js | 721 +- Source/DataSources/GeoJsonDataSource.js | 1901 +- Source/DataSources/GeometryUpdater.js | 974 +- Source/DataSources/GeometryVisualizer.js | 1068 +- Source/DataSources/GridMaterialProperty.js | 338 +- Source/DataSources/GroundGeometryUpdater.js | 417 +- Source/DataSources/ImageMaterialProperty.js | 286 +- Source/DataSources/KmlCamera.js | 24 +- Source/DataSources/KmlDataSource.js | 7141 ++-- Source/DataSources/KmlLookAt.js | 22 +- Source/DataSources/KmlTour.js | 287 +- Source/DataSources/KmlTourFlyTo.js | 186 +- Source/DataSources/KmlTourWait.js | 84 +- Source/DataSources/LabelGraphics.js | 751 +- Source/DataSources/LabelVisualizer.js | 560 +- Source/DataSources/MaterialProperty.js | 190 +- Source/DataSources/ModelGraphics.js | 802 +- Source/DataSources/ModelVisualizer.js | 753 +- .../DataSources/NodeTransformationProperty.js | 243 +- Source/DataSources/PathGraphics.js | 279 +- Source/DataSources/PathVisualizer.js | 1226 +- Source/DataSources/PlaneGeometryUpdater.js | 662 +- Source/DataSources/PlaneGraphics.js | 393 +- Source/DataSources/PointGraphics.js | 407 +- Source/DataSources/PointVisualizer.js | 662 +- Source/DataSources/PolygonGeometryUpdater.js | 918 +- Source/DataSources/PolygonGraphics.js | 668 +- .../PolylineArrowMaterialProperty.js | 187 +- .../PolylineDashMaterialProperty.js | 288 +- Source/DataSources/PolylineGeometryUpdater.js | 1605 +- .../PolylineGlowMaterialProperty.js | 251 +- Source/DataSources/PolylineGraphics.js | 469 +- .../PolylineOutlineMaterialProperty.js | 262 +- Source/DataSources/PolylineVisualizer.js | 734 +- .../PolylineVolumeGeometryUpdater.js | 469 +- Source/DataSources/PolylineVolumeGraphics.js | 447 +- Source/DataSources/PositionProperty.js | 232 +- Source/DataSources/PositionPropertyArray.js | 334 +- Source/DataSources/Property.js | 247 +- Source/DataSources/PropertyArray.js | 266 +- Source/DataSources/PropertyBag.js | 492 +- .../DataSources/RectangleGeometryUpdater.js | 670 +- Source/DataSources/RectangleGraphics.js | 571 +- Source/DataSources/ReferenceProperty.js | 644 +- Source/DataSources/Rotation.js | 267 +- Source/DataSources/SampledPositionProperty.js | 586 +- Source/DataSources/SampledProperty.js | 1522 +- Source/DataSources/ScaledPositionProperty.js | 156 +- .../DataSources/StaticGeometryColorBatch.js | 977 +- .../StaticGeometryPerMaterialBatch.js | 832 +- .../StaticGroundGeometryColorBatch.js | 712 +- .../StaticGroundGeometryPerMaterialBatch.js | 750 +- .../StaticGroundPolylinePerMaterialBatch.js | 762 +- .../DataSources/StaticOutlineGeometryBatch.js | 833 +- Source/DataSources/StripeMaterialProperty.js | 330 +- Source/DataSources/StripeOrientation.js | 35 +- Source/DataSources/TerrainOffsetProperty.js | 432 +- .../TimeIntervalCollectionPositionProperty.js | 266 +- .../TimeIntervalCollectionProperty.js | 251 +- .../VelocityOrientationProperty.js | 274 +- Source/DataSources/VelocityVectorProperty.js | 401 +- Source/DataSources/Visualizer.js | 110 +- Source/DataSources/WallGeometryUpdater.js | 442 +- Source/DataSources/WallGraphics.js | 455 +- .../createMaterialPropertyDescriptor.js | 55 +- .../DataSources/createPropertyDescriptor.js | 111 +- .../createRawPropertyDescriptor.js | 20 +- Source/DataSources/exportKml.js | 2751 +- .../heightReferenceOnEntityPropertyChanged.js | 64 +- Source/Renderer/AutomaticUniforms.js | 3795 +-- Source/Renderer/Buffer.js | 760 +- Source/Renderer/BufferUsage.js | 30 +- Source/Renderer/ClearCommand.js | 178 +- Source/Renderer/ComputeCommand.js | 194 +- Source/Renderer/ComputeEngine.js | 248 +- Source/Renderer/Context.js | 2691 +- Source/Renderer/ContextLimits.js | 529 +- Source/Renderer/CubeMap.js | 946 +- Source/Renderer/CubeMapFace.js | 531 +- Source/Renderer/DrawCommand.js | 1065 +- Source/Renderer/Framebuffer.js | 791 +- Source/Renderer/MipmapHint.js | 30 +- Source/Renderer/Pass.js | 51 +- Source/Renderer/PassState.js | 103 +- Source/Renderer/PixelDatatype.js | 100 +- Source/Renderer/RenderState.js | 1801 +- Source/Renderer/Renderbuffer.js | 150 +- Source/Renderer/RenderbufferFormat.js | 42 +- Source/Renderer/Sampler.js | 178 +- Source/Renderer/ShaderCache.js | 462 +- Source/Renderer/ShaderProgram.js | 1151 +- Source/Renderer/ShaderSource.js | 842 +- Source/Renderer/Texture.js | 1646 +- Source/Renderer/TextureCache.js | 132 +- Source/Renderer/TextureMagnificationFilter.js | 74 +- Source/Renderer/TextureMinificationFilter.js | 176 +- Source/Renderer/TextureWrap.js | 30 +- Source/Renderer/UniformState.js | 3195 +- Source/Renderer/VertexArray.js | 1577 +- Source/Renderer/VertexArrayFacade.js | 925 +- Source/Renderer/checkFloatTexturePrecision.js | 152 +- Source/Renderer/createUniform.js | 808 +- Source/Renderer/createUniformArray.js | 1204 +- Source/Renderer/freezeRenderState.js | 52 +- Source/Renderer/loadCubeMap.js | 170 +- Source/Renderer/modernizeShader.js | 433 +- Source/Scene/Appearance.js | 397 +- .../Scene/ArcGisMapServerImageryProvider.js | 1449 +- Source/Scene/AttributeType.js | 117 +- Source/Scene/AutoExposure.js | 803 +- Source/Scene/Axis.js | 186 +- Source/Scene/BatchTable.js | 1195 +- Source/Scene/Batched3DModel3DTileContent.js | 1050 +- Source/Scene/Billboard.js | 2912 +- Source/Scene/BillboardCollection.js | 4227 +-- Source/Scene/BingMapsImageryProvider.js | 1443 +- Source/Scene/BingMapsStyle.js | 167 +- Source/Scene/BlendEquation.js | 94 +- Source/Scene/BlendFunction.js | 226 +- Source/Scene/BlendOption.js | 51 +- Source/Scene/BlendingState.js | 136 +- Source/Scene/BoxEmitter.js | 128 +- Source/Scene/BrdfLutGenerator.js | 140 +- Source/Scene/Camera.js | 6968 ++-- Source/Scene/CameraEventAggregator.js | 1032 +- Source/Scene/CameraEventType.js | 85 +- Source/Scene/CameraFlightPath.js | 979 +- Source/Scene/Cesium3DTile.js | 3194 +- Source/Scene/Cesium3DTileBatchTable.js | 3153 +- Source/Scene/Cesium3DTileColorBlendMode.js | 99 +- Source/Scene/Cesium3DTileContent.js | 636 +- Source/Scene/Cesium3DTileContentFactory.js | 115 +- Source/Scene/Cesium3DTileContentState.js | 23 +- Source/Scene/Cesium3DTileFeature.js | 506 +- Source/Scene/Cesium3DTileFeatureTable.js | 182 +- Source/Scene/Cesium3DTileOptimizationHint.js | 25 +- Source/Scene/Cesium3DTileOptimizations.js | 184 +- Source/Scene/Cesium3DTilePass.js | 140 +- Source/Scene/Cesium3DTilePassState.js | 88 +- Source/Scene/Cesium3DTilePointFeature.js | 1629 +- Source/Scene/Cesium3DTileRefine.js | 55 +- Source/Scene/Cesium3DTileStyle.js | 3284 +- Source/Scene/Cesium3DTileStyleEngine.js | 126 +- Source/Scene/Cesium3DTileset.js | 4880 +-- Source/Scene/Cesium3DTilesetCache.js | 130 +- Source/Scene/Cesium3DTilesetHeatmap.js | 267 +- .../Cesium3DTilesetMostDetailedTraversal.js | 242 +- Source/Scene/Cesium3DTilesetStatistics.js | 218 +- Source/Scene/Cesium3DTilesetTraversal.js | 1371 +- Source/Scene/CircleEmitter.js | 108 +- Source/Scene/ClassificationModel.js | 2209 +- Source/Scene/ClassificationPrimitive.js | 2673 +- Source/Scene/ClassificationType.js | 65 +- Source/Scene/ClippingPlane.js | 338 +- Source/Scene/ClippingPlaneCollection.js | 1456 +- Source/Scene/ColorBlendMode.js | 60 +- Source/Scene/Composite3DTileContent.js | 539 +- Source/Scene/ConditionsExpression.js | 347 +- Source/Scene/ConeEmitter.js | 108 +- Source/Scene/CreditDisplay.js | 1043 +- Source/Scene/CullFace.js | 58 +- Source/Scene/DebugAppearance.js | 530 +- Source/Scene/DebugCameraPrimitive.js | 489 +- Source/Scene/DebugModelMatrixPrimitive.js | 437 +- Source/Scene/DepthFunction.js | 128 +- Source/Scene/DepthPlane.js | 418 +- Source/Scene/DerivedCommand.js | 759 +- .../DeviceOrientationCameraController.js | 234 +- Source/Scene/DirectionalLight.js | 88 +- Source/Scene/DiscardEmptyTileImagePolicy.js | 96 +- Source/Scene/DiscardMissingTileImagePolicy.js | 269 +- Source/Scene/DracoLoader.js | 578 +- Source/Scene/EllipsoidPrimitive.js | 974 +- Source/Scene/EllipsoidSurfaceAppearance.js | 509 +- Source/Scene/Empty3DTileContent.js | 253 +- Source/Scene/Expression.js | 3928 ++- Source/Scene/ExpressionNodeType.js | 49 +- Source/Scene/Fog.js | 329 +- Source/Scene/FrameRateMonitor.js | 693 +- Source/Scene/FrameState.js | 814 +- Source/Scene/FrustumCommands.js | 50 +- Source/Scene/Geometry3DTileContent.js | 894 +- Source/Scene/GetFeatureInfoFormat.js | 678 +- Source/Scene/Globe.js | 1772 +- Source/Scene/GlobeDepth.js | 1070 +- Source/Scene/GlobeSurfaceShaderSet.js | 697 +- Source/Scene/GlobeSurfaceTile.js | 1483 +- Source/Scene/GlobeSurfaceTileProvider.js | 4295 +-- .../GoogleEarthEnterpriseImageryProvider.js | 1234 +- .../GoogleEarthEnterpriseMapsProvider.js | 1288 +- Source/Scene/GridImageryProvider.js | 625 +- Source/Scene/GroundPolylinePrimitive.js | 1636 +- Source/Scene/GroundPrimitive.js | 1807 +- Source/Scene/HeightReference.js | 51 +- Source/Scene/HorizontalOrigin.js | 77 +- Source/Scene/Imagery.js | 218 +- Source/Scene/ImageryLayer.js | 2653 +- Source/Scene/ImageryLayerCollection.js | 1084 +- Source/Scene/ImageryLayerFeatureInfo.js | 195 +- Source/Scene/ImageryProvider.js | 640 +- Source/Scene/ImagerySplitDirection.js | 61 +- Source/Scene/ImageryState.js | 27 +- Source/Scene/Instanced3DModel3DTileContent.js | 1122 +- Source/Scene/InvertClassification.js | 715 +- Source/Scene/IonImageryProvider.js | 983 +- Source/Scene/IonWorldImageryStyle.js | 59 +- Source/Scene/JobScheduler.js | 367 +- Source/Scene/JobType.js | 19 +- Source/Scene/Label.js | 2984 +- Source/Scene/LabelCollection.js | 1858 +- Source/Scene/LabelStyle.js | 61 +- Source/Scene/Light.js | 59 +- Source/Scene/MapMode2D.js | 43 +- Source/Scene/MapboxImageryProvider.js | 648 +- Source/Scene/MapboxStyleImageryProvider.js | 466 +- Source/Scene/Material.js | 3188 +- Source/Scene/MaterialAppearance.js | 519 +- Source/Scene/Model.js | 10498 +++--- Source/Scene/ModelAnimation.js | 436 +- Source/Scene/ModelAnimationCache.js | 375 +- Source/Scene/ModelAnimationCollection.js | 933 +- Source/Scene/ModelAnimationLoop.js | 61 +- Source/Scene/ModelAnimationState.js | 13 +- Source/Scene/ModelInstance.js | 62 +- Source/Scene/ModelInstanceCollection.js | 2000 +- Source/Scene/ModelLoadResources.js | 205 +- Source/Scene/ModelMaterial.js | 208 +- Source/Scene/ModelMesh.js | 133 +- Source/Scene/ModelNode.js | 246 +- Source/Scene/ModelUtility.js | 2460 +- Source/Scene/Moon.js | 338 +- Source/Scene/NeverTileDiscardPolicy.js | 52 +- Source/Scene/OIT.js | 1513 +- Source/Scene/OctahedralProjectedCubeMap.js | 809 +- Source/Scene/OpenStreetMapImageryProvider.js | 197 +- .../Scene/OrderedGroundPrimitiveCollection.js | 426 +- Source/Scene/Particle.js | 278 +- Source/Scene/ParticleBurst.js | 92 +- Source/Scene/ParticleEmitter.js | 64 +- Source/Scene/ParticleSystem.js | 1695 +- Source/Scene/PerInstanceColorAppearance.js | 539 +- Source/Scene/PerformanceDisplay.js | 208 +- Source/Scene/PickDepth.js | 360 +- Source/Scene/PickDepthFramebuffer.js | 148 +- Source/Scene/PickFramebuffer.js | 276 +- Source/Scene/Picking.js | 2124 +- Source/Scene/PointCloud.js | 2923 +- Source/Scene/PointCloud3DTileContent.js | 670 +- Source/Scene/PointCloudEyeDomeLighting.js | 587 +- Source/Scene/PointCloudShading.js | 193 +- Source/Scene/PointPrimitive.js | 1239 +- Source/Scene/PointPrimitiveCollection.js | 2158 +- Source/Scene/Polyline.js | 800 +- Source/Scene/PolylineCollection.js | 3434 +- Source/Scene/PolylineColorAppearance.js | 435 +- Source/Scene/PolylineMaterialAppearance.js | 453 +- Source/Scene/PostProcessStage.js | 1925 +- Source/Scene/PostProcessStageCollection.js | 1684 +- Source/Scene/PostProcessStageComposite.js | 662 +- Source/Scene/PostProcessStageLibrary.js | 1683 +- Source/Scene/PostProcessStageSampleMode.js | 43 +- Source/Scene/PostProcessStageTextureCache.js | 812 +- Source/Scene/Primitive.js | 4622 +-- Source/Scene/PrimitiveCollection.js | 926 +- Source/Scene/PrimitivePipeline.js | 1480 +- Source/Scene/PrimitiveState.js | 25 +- Source/Scene/QuadtreeOccluders.js | 54 +- Source/Scene/QuadtreePrimitive.js | 2664 +- Source/Scene/QuadtreeTile.js | 1041 +- Source/Scene/QuadtreeTileLoadState.js | 71 +- Source/Scene/QuadtreeTileProvider.js | 437 +- Source/Scene/SDFSettings.js | 71 +- Source/Scene/Scene.js | 8334 ++--- Source/Scene/SceneFramebuffer.js | 340 +- Source/Scene/SceneMode.js | 105 +- Source/Scene/SceneTransforms.js | 789 +- Source/Scene/SceneTransitioner.js | 1958 +- Source/Scene/ScreenSpaceCameraController.js | 4664 +-- Source/Scene/ShadowMap.js | 3437 +- Source/Scene/ShadowMapShader.js | 778 +- Source/Scene/ShadowMode.js | 135 +- Source/Scene/ShadowVolumeAppearance.js | 2020 +- Source/Scene/SingleTileImageryProvider.js | 791 +- Source/Scene/SkyAtmosphere.js | 625 +- Source/Scene/SkyBox.js | 477 +- Source/Scene/SphereEmitter.js | 113 +- Source/Scene/StencilConstants.js | 68 +- Source/Scene/StencilFunction.js | 128 +- Source/Scene/StencilOperation.js | 128 +- Source/Scene/StyleExpression.js | 134 +- Source/Scene/Sun.js | 668 +- Source/Scene/SunLight.js | 58 +- Source/Scene/SunPostProcess.js | 538 +- Source/Scene/TerrainFillMesh.js | 3273 +- Source/Scene/TerrainState.js | 25 +- Source/Scene/TextureAtlas.js | 929 +- Source/Scene/TileBoundingRegion.js | 807 +- Source/Scene/TileBoundingSphere.js | 307 +- Source/Scene/TileBoundingVolume.js | 125 +- .../Scene/TileCoordinatesImageryProvider.js | 523 +- Source/Scene/TileDiscardPolicy.js | 59 +- Source/Scene/TileImagery.js | 205 +- Source/Scene/TileMapServiceImageryProvider.js | 699 +- Source/Scene/TileOrientedBoundingBox.js | 412 +- Source/Scene/TileReplacementQueue.js | 228 +- Source/Scene/TileSelectionResult.js | 141 +- Source/Scene/TileState.js | 19 +- Source/Scene/Tileset3DTileContent.js | 312 +- Source/Scene/TimeDynamicImagery.js | 590 +- Source/Scene/TimeDynamicPointCloud.js | 1546 +- Source/Scene/Tonemapper.js | 93 +- Source/Scene/TweenCollection.js | 1127 +- Source/Scene/UrlTemplateImageryProvider.js | 2087 +- Source/Scene/Vector3DTileBatch.js | 73 +- Source/Scene/Vector3DTileContent.js | 1213 +- Source/Scene/Vector3DTileGeometry.js | 901 +- Source/Scene/Vector3DTilePoints.js | 958 +- Source/Scene/Vector3DTilePolygons.js | 859 +- Source/Scene/Vector3DTilePolylines.js | 1106 +- Source/Scene/Vector3DTilePrimitive.js | 2549 +- Source/Scene/VerticalOrigin.js | 91 +- Source/Scene/View.js | 770 +- Source/Scene/ViewportQuad.js | 354 +- Source/Scene/WebMapServiceImageryProvider.js | 1167 +- .../Scene/WebMapTileServiceImageryProvider.js | 1173 +- .../Scene/computeFlyToLocationForRectangle.js | 111 +- Source/Scene/createBillboardPointCallback.js | 114 +- .../Scene/createTangentSpaceDebugPrimitive.js | 192 +- Source/Scene/createWorldImagery.js | 72 +- Source/Scene/getBinaryAccessor.js | 97 +- Source/Scene/getClipAndStyleCode.js | 66 +- Source/Scene/getClippingFunction.js | 336 +- Source/Scene/processModelMaterialsCommon.js | 1691 +- Source/Scene/processPbrMaterials.js | 2070 +- Source/Widgets/Animation/Animation.css | 136 +- Source/Widgets/Animation/Animation.js | 2181 +- .../Widgets/Animation/AnimationViewModel.js | 1217 +- Source/Widgets/Animation/lighter.css | 68 +- .../BaseLayerPicker/BaseLayerPicker.css | 153 +- .../BaseLayerPicker/BaseLayerPicker.js | 515 +- .../BaseLayerPickerViewModel.js | 518 +- .../BaseLayerPicker/ProviderViewModel.js | 188 +- .../createDefaultImageryProviderViewModels.js | 495 +- .../createDefaultTerrainProviderViewModels.js | 71 +- Source/Widgets/BaseLayerPicker/lighter.css | 26 +- .../Cesium3DTilesInspector.css | 128 +- .../Cesium3DTilesInspector.js | 634 +- .../Cesium3DTilesInspectorViewModel.js | 2994 +- .../CesiumInspector/CesiumInspector.css | 148 +- .../CesiumInspector/CesiumInspector.js | 598 +- .../CesiumInspectorViewModel.js | 1904 +- Source/Widgets/CesiumWidget/CesiumWidget.css | 89 +- Source/Widgets/CesiumWidget/CesiumWidget.js | 1428 +- Source/Widgets/CesiumWidget/lighter.css | 12 +- Source/Widgets/ClockViewModel.js | 376 +- Source/Widgets/Command.js | 74 +- .../FullscreenButton/FullscreenButton.css | 10 +- .../FullscreenButton/FullscreenButton.js | 169 +- .../FullscreenButtonViewModel.js | 251 +- Source/Widgets/Geocoder/Geocoder.css | 90 +- Source/Widgets/Geocoder/Geocoder.js | 429 +- Source/Widgets/Geocoder/GeocoderViewModel.js | 1046 +- Source/Widgets/Geocoder/lighter.css | 16 +- Source/Widgets/HomeButton/HomeButton.js | 154 +- .../Widgets/HomeButton/HomeButtonViewModel.js | 154 +- Source/Widgets/InfoBox/InfoBox.css | 132 +- Source/Widgets/InfoBox/InfoBox.js | 383 +- Source/Widgets/InfoBox/InfoBoxDescription.css | 66 +- Source/Widgets/InfoBox/InfoBoxViewModel.js | 194 +- Source/Widgets/InspectorShared.js | 144 +- .../NavigationHelpButton.css | 100 +- .../NavigationHelpButton.js | 389 +- .../NavigationHelpButtonViewModel.js | 136 +- .../Widgets/NavigationHelpButton/lighter.css | 34 +- .../PerformanceWatchdog.css | 16 +- .../PerformanceWatchdog.js | 182 +- .../PerformanceWatchdogViewModel.js | 181 +- .../ProjectionPicker/ProjectionPicker.css | 44 +- .../ProjectionPicker/ProjectionPicker.js | 298 +- .../ProjectionPickerViewModel.js | 382 +- .../SceneModePicker/SceneModePicker.css | 74 +- .../SceneModePicker/SceneModePicker.js | 333 +- .../SceneModePickerViewModel.js | 418 +- .../SelectionIndicator/SelectionIndicator.css | 26 +- .../SelectionIndicator/SelectionIndicator.js | 186 +- .../SelectionIndicatorViewModel.js | 401 +- Source/Widgets/SvgPathBindingHandler.js | 126 +- Source/Widgets/Timeline/Timeline.css | 143 +- Source/Widgets/Timeline/Timeline.js | 1781 +- .../Timeline/TimelineHighlightRange.js | 116 +- Source/Widgets/Timeline/TimelineTrack.js | 113 +- Source/Widgets/Timeline/lighter.css | 18 +- Source/Widgets/ToggleButtonViewModel.js | 96 +- Source/Widgets/VRButton/VRButton.css | 10 +- Source/Widgets/VRButton/VRButton.js | 173 +- Source/Widgets/VRButton/VRButtonViewModel.js | 436 +- Source/Widgets/Viewer/Viewer.css | 146 +- Source/Widgets/Viewer/Viewer.js | 4302 +-- .../viewerCesium3DTilesInspectorMixin.js | 63 +- .../Viewer/viewerCesiumInspectorMixin.js | 77 +- Source/Widgets/Viewer/viewerDragDropMixin.js | 537 +- .../Viewer/viewerPerformanceWatchdogMixin.js | 88 +- Source/Widgets/createCommand.js | 114 +- Source/Widgets/getElement.js | 42 +- Source/Widgets/lighterShared.css | 50 +- Source/Widgets/shared.css | 133 +- Source/Widgets/subscribeAndEvaluate.js | 48 +- Source/Workers/cesiumWorkerBootstrapper.js | 3999 +-- Source/Workers/transferTypedArrayTest.js | 33 +- Source/WorkersES6/combineGeometry.js | 19 +- Source/WorkersES6/createBoxGeometry.js | 16 +- Source/WorkersES6/createBoxOutlineGeometry.js | 16 +- Source/WorkersES6/createCircleGeometry.js | 28 +- .../WorkersES6/createCircleOutlineGeometry.js | 28 +- .../createCoplanarPolygonGeometry.js | 16 +- .../createCoplanarPolygonOutlineGeometry.js | 23 +- Source/WorkersES6/createCorridorGeometry.js | 20 +- .../createCorridorOutlineGeometry.js | 25 +- Source/WorkersES6/createCylinderGeometry.js | 16 +- .../createCylinderOutlineGeometry.js | 16 +- Source/WorkersES6/createEllipseGeometry.js | 24 +- .../createEllipseOutlineGeometry.js | 24 +- Source/WorkersES6/createEllipsoidGeometry.js | 16 +- .../createEllipsoidOutlineGeometry.js | 19 +- Source/WorkersES6/createFrustumGeometry.js | 16 +- .../createFrustumOutlineGeometry.js | 16 +- Source/WorkersES6/createGeometry.js | 85 +- .../createGroundPolylineGeometry.js | 24 +- Source/WorkersES6/createPlaneGeometry.js | 16 +- .../WorkersES6/createPlaneOutlineGeometry.js | 16 +- Source/WorkersES6/createPolygonGeometry.js | 20 +- .../createPolygonOutlineGeometry.js | 20 +- Source/WorkersES6/createPolylineGeometry.js | 20 +- .../createPolylineVolumeGeometry.js | 25 +- .../createPolylineVolumeOutlineGeometry.js | 30 +- Source/WorkersES6/createRectangleGeometry.js | 24 +- .../createRectangleOutlineGeometry.js | 27 +- .../createSimplePolylineGeometry.js | 25 +- Source/WorkersES6/createSphereGeometry.js | 16 +- .../WorkersES6/createSphereOutlineGeometry.js | 16 +- .../WorkersES6/createTaskProcessorWorker.js | 238 +- .../WorkersES6/createVectorTileGeometries.js | 713 +- Source/WorkersES6/createVectorTilePoints.js | 119 +- Source/WorkersES6/createVectorTilePolygons.js | 733 +- .../WorkersES6/createVectorTilePolylines.js | 408 +- ...VerticesFromGoogleEarthEnterpriseBuffer.js | 1048 +- .../WorkersES6/createVerticesFromHeightmap.js | 92 +- .../createVerticesFromQuantizedTerrainMesh.js | 929 +- Source/WorkersES6/createWallGeometry.js | 20 +- .../WorkersES6/createWallOutlineGeometry.js | 20 +- Source/WorkersES6/decodeDraco.js | 630 +- .../decodeGoogleEarthEnterprisePacket.js | 485 +- Source/WorkersES6/transcodeCRNToDXT.js | 272 +- .../upsampleQuantizedTerrainMesh.js | 1168 +- Specs/BadGeometry.js | 46 +- Specs/Cesium3DTilesTester.js | 939 +- Specs/CesiumJasmineHtml.css | 12 +- Specs/Core/ApproximateTerrainHeightsSpec.js | 126 +- ...ArcGISTiledElevationTerrainProviderSpec.js | 645 +- Specs/Core/AssociativeArraySpec.js | 121 +- Specs/Core/AttributeCompressionSpec.js | 1852 +- Specs/Core/AxisAlignedBoundingBoxSpec.js | 352 +- Specs/Core/BingMapsApiSpec.js | 23 +- Specs/Core/BingMapsGeocoderServiceSpec.js | 130 +- Specs/Core/BoundingRectangleSpec.js | 546 +- Specs/Core/BoundingSphereSpec.js | 1976 +- Specs/Core/BoxGeometrySpec.js | 273 +- Specs/Core/BoxOutlineGeometrySpec.js | 211 +- Specs/Core/Cartesian2Spec.js | 1812 +- Specs/Core/Cartesian3Spec.js | 2746 +- Specs/Core/Cartesian4Spec.js | 2074 +- Specs/Core/CartographicGeocoderServiceSpec.js | 124 +- Specs/Core/CartographicSpec.js | 415 +- Specs/Core/CatmullRomSplineSpec.js | 326 +- Specs/Core/CesiumTerrainProviderSpec.js | 1790 +- Specs/Core/CheckSpec.js | 439 +- Specs/Core/CircleGeometrySpec.js | 412 +- Specs/Core/CircleOutlineGeometrySpec.js | 245 +- Specs/Core/ClockSpec.js | 1135 +- .../ColorGeometryInstanceAttributeSpec.js | 146 +- Specs/Core/ColorSpec.js | 1610 +- Specs/Core/ComponentDatatypeSpec.js | 463 +- Specs/Core/CoplanarPolygonGeometrySpec.js | 389 +- .../CoplanarPolygonOutlineGeometrySpec.js | 255 +- Specs/Core/CorridorGeometrySpec.js | 941 +- Specs/Core/CorridorOutlineGeometrySpec.js | 533 +- Specs/Core/CubicRealPolynomialSpec.js | 266 +- Specs/Core/CullingVolumeSpec.js | 981 +- Specs/Core/CylinderGeometrySpec.js | 358 +- Specs/Core/CylinderOutlineGeometrySpec.js | 268 +- Specs/Core/DeveloperErrorSpec.js | 77 +- ...yConditionGeometryInstanceAttributeSpec.js | 121 +- Specs/Core/DistanceDisplayConditionSpec.js | 170 +- Specs/Core/DoublyLinkedListSpec.js | 715 +- Specs/Core/EarthOrientationParametersSpec.js | 521 +- Specs/Core/EllipseGeometrySpec.js | 876 +- Specs/Core/EllipseOutlineGeometrySpec.js | 473 +- Specs/Core/EllipsoidGeodesicSpec.js | 527 +- Specs/Core/EllipsoidGeometrySpec.js | 675 +- Specs/Core/EllipsoidOutlineGeometrySpec.js | 459 +- Specs/Core/EllipsoidRhumbLineSpec.js | 1670 +- Specs/Core/EllipsoidSpec.js | 1254 +- Specs/Core/EllipsoidTangentPlaneSpec.js | 665 +- Specs/Core/EllipsoidTerrainProviderSpec.js | 61 +- Specs/Core/EllipsoidalOccluderSpec.js | 815 +- Specs/Core/EncodedCartesian3Spec.js | 197 +- Specs/Core/EventSpec.js | 331 +- Specs/Core/FeatureDetectionSpec.js | 238 +- Specs/Core/FrustumGeometrySpec.js | 173 +- Specs/Core/FrustumOutlineGeometrySpec.js | 141 +- Specs/Core/FullscreenSpec.js | 123 +- Specs/Core/GeographicProjectionSpec.js | 151 +- Specs/Core/GeographicTilingSchemeSpec.js | 409 +- Specs/Core/GeometryAttributeSpec.js | 168 +- Specs/Core/GeometryInstanceAttributeSpec.js | 106 +- Specs/Core/GeometryInstanceSpec.js | 114 +- Specs/Core/GeometryPipelineSpec.js | 7158 ++-- Specs/Core/GeometrySpec.js | 269 +- .../Core/GoogleEarthEnterpriseMetadataSpec.js | 496 +- .../GoogleEarthEnterpriseTerrainDataSpec.js | 937 +- ...oogleEarthEnterpriseTerrainProviderSpec.js | 662 +- Specs/Core/GroundPolylineGeometrySpec.js | 1406 +- Specs/Core/HeadingPitchRangeSpec.js | 56 +- Specs/Core/HeadingPitchRollSpec.js | 474 +- Specs/Core/HeapSpec.js | 317 +- Specs/Core/HeightmapTerrainDataSpec.js | 1059 +- .../HermitePolynomialApproximationSpec.js | 168 +- Specs/Core/HermiteSplineSpec.js | 750 +- Specs/Core/Iau2000OrientationSpec.js | 37 +- Specs/Core/Iau2006XysDataSpec.js | 99 +- Specs/Core/IauOrientationAxesSpec.js | 54 +- Specs/Core/IndexDatatypeSpec.js | 194 +- Specs/Core/IntersectionTestsSpec.js | 2078 +- Specs/Core/Intersections2DSpec.js | 955 +- Specs/Core/IntervalSpec.js | 29 +- Specs/Core/IonGeocoderServiceSpec.js | 90 +- Specs/Core/IonResourceSpec.js | 610 +- Specs/Core/JulianDateSpec.js | 2268 +- .../LagrangePolynomialApproximationSpec.js | 96 +- Specs/Core/LeapSecondSpec.js | 31 +- Specs/Core/LinearApproximationSpec.js | 162 +- Specs/Core/LinearSplineSpec.js | 139 +- Specs/Core/ManagedArraySpec.js | 265 +- Specs/Core/MapboxApiSpec.js | 35 +- Specs/Core/MathSpec.js | 1342 +- Specs/Core/Matrix2Spec.js | 1641 +- Specs/Core/Matrix3Spec.js | 2698 +- Specs/Core/Matrix4Spec.js | 6390 +++- Specs/Core/NearFarScalarSpec.js | 80 +- Specs/Core/OccluderSpec.js | 688 +- Specs/Core/OpenCageGeocoderServiceSpec.js | 109 +- Specs/Core/OrientedBoundingBoxSpec.js | 2550 +- Specs/Core/OrthographicFrustumSpec.js | 569 +- .../Core/OrthographicOffCenterFrustumSpec.js | 545 +- Specs/Core/PeliasGeocoderServiceSpec.js | 143 +- Specs/Core/PerspectiveFrustumSpec.js | 614 +- Specs/Core/PerspectiveOffCenterFrustumSpec.js | 566 +- Specs/Core/PinBuilderSpec.js | 278 +- Specs/Core/PlaneGeometrySpec.js | 83 +- Specs/Core/PlaneOutlineGeometrySpec.js | 19 +- Specs/Core/PlaneSpec.js | 501 +- Specs/Core/PolygonGeometrySpec.js | 3141 +- Specs/Core/PolygonOutlineGeometrySpec.js | 1471 +- Specs/Core/PolygonPipelineSpec.js | 652 +- Specs/Core/PolylineGeometrySpec.js | 556 +- Specs/Core/PolylinePipelineSpec.js | 298 +- Specs/Core/PolylineVolumeGeometrySpec.js | 586 +- .../Core/PolylineVolumeOutlineGeometrySpec.js | 369 +- Specs/Core/QuadraticRealPolynomialSpec.js | 237 +- Specs/Core/QuantizedMeshTerrainDataSpec.js | 1753 +- Specs/Core/QuarticRealPolynomialSpec.js | 429 +- Specs/Core/QuaternionSpec.js | 2342 +- Specs/Core/QuaternionSplineSpec.js | 207 +- Specs/Core/QueueSpec.js | 181 +- Specs/Core/RaySpec.js | 187 +- Specs/Core/RectangleCollisionCheckerSpec.js | 43 +- Specs/Core/RectangleGeometrySpec.js | 1189 +- Specs/Core/RectangleOutlineGeometrySpec.js | 628 +- Specs/Core/RectangleSpec.js | 1944 +- Specs/Core/RequestErrorEventSpec.js | 39 +- Specs/Core/RequestSchedulerSpec.js | 1552 +- Specs/Core/ResourceSpec.js | 4552 +-- Specs/Core/RuntimeErrorSpec.js | 77 +- Specs/Core/ScreenSpaceEventHandlerSpec.js | 2965 +- .../Core/ShowGeometryInstanceAttributeSpec.js | 56 +- Specs/Core/Simon1994PlanetaryPositionsSpec.js | 196 +- Specs/Core/SimplePolylineGeometrySpec.js | 523 +- Specs/Core/SphereGeometrySpec.js | 214 +- Specs/Core/SphereOutlineGeometrySpec.js | 120 +- Specs/Core/SphericalSpec.js | 228 +- Specs/Core/SplineSpec.js | 154 +- Specs/Core/TaskProcessorSpec.js | 378 +- Specs/Core/TerrainEncodingSpec.js | 790 +- Specs/Core/TileAvailabilitySpec.js | 323 +- Specs/Core/TimeIntervalCollectionSpec.js | 4034 +-- Specs/Core/TimeIntervalSpec.js | 1137 +- Specs/Core/TipsifySpec.js | 424 +- Specs/Core/TransformsSpec.js | 3135 +- Specs/Core/TranslationRotationScaleSpec.js | 101 +- Specs/Core/TridiagonalSystemSolverSpec.js | 199 +- Specs/Core/TrustedServersSpec.js | 155 +- Specs/Core/VRTheWorldTerrainProviderSpec.js | 545 +- Specs/Core/VertexFormatSpec.js | 50 +- Specs/Core/VideoSynchronizerSpec.js | 358 +- Specs/Core/WallGeometrySpec.js | 760 +- Specs/Core/WallOutlineGeometrySpec.js | 460 +- Specs/Core/WebMercatorProjectionSpec.js | 354 +- Specs/Core/WebMercatorTilingSchemeSpec.js | 619 +- Specs/Core/appendForwardSlashSpec.js | 27 +- Specs/Core/arrayFillSpec.js | 105 +- Specs/Core/arrayRemoveDuplicatesSpec.js | 388 +- Specs/Core/arraySliceSpec.js | 95 +- Specs/Core/barycentricCoordinatesSpec.js | 194 +- Specs/Core/binarySearchSpec.js | 111 +- Specs/Core/buildModuleUrlSpec.js | 111 +- Specs/Core/cloneSpec.js | 81 +- Specs/Core/combineSpec.js | 139 +- Specs/Core/createGuidSpec.js | 41 +- Specs/Core/defaultValueSpec.js | 24 +- Specs/Core/definedSpec.js | 23 +- Specs/Core/deprecationWarningSpec.js | 43 +- Specs/Core/getAbsoluteUriSpec.js | 55 +- Specs/Core/getBaseUriSpec.js | 47 +- Specs/Core/getExtensionFromUriSpec.js | 35 +- Specs/Core/getFilenameFromUriSpec.js | 31 +- Specs/Core/getStringFromTypedArraySpec.js | 191 +- Specs/Core/isBlobUriSpec.js | 35 +- Specs/Core/isCrossOriginUrlSpec.js | 74 +- Specs/Core/isDataUriSpec.js | 29 +- Specs/Core/isLeapYearSpec.js | 53 +- Specs/Core/loadCRNSpec.js | 746 +- Specs/Core/loadImageFromTypedArraySpec.js | 206 +- Specs/Core/loadKTXSpec.js | 1500 +- Specs/Core/mergeSortSpec.js | 94 +- Specs/Core/objectToQuerySpec.js | 93 +- Specs/Core/oneTimeWarningSpec.js | 33 +- Specs/Core/parseResponseHeadersSpec.js | 47 +- Specs/Core/pointInsideTriangleSpec.js | 145 +- Specs/Core/queryToObjectSpec.js | 84 +- Specs/Core/requestAnimationFrameSpec.js | 95 +- Specs/Core/sampleTerrainMostDetailedSpec.js | 142 +- Specs/Core/sampleTerrainSpec.js | 169 +- Specs/Core/subdivideArraySpec.js | 69 +- Specs/Core/writeTextToCanvasSpec.js | 223 +- Specs/Data/Fonts/OpenSans-Main.css | 4 +- .../Models/WEB3DQuantizedAttributes/README.md | 16 +- Specs/Data/WMS/GetFeatureInfo.html | 12 +- Specs/DataSources/BillboardGraphicsSpec.js | 551 +- Specs/DataSources/BillboardVisualizerSpec.js | 743 +- Specs/DataSources/BoxGeometryUpdaterSpec.js | 306 +- Specs/DataSources/BoxGraphicsSpec.js | 328 +- Specs/DataSources/CallbackPropertySpec.js | 115 +- .../Cesium3DTilesetGraphicsSpec.js | 181 +- .../Cesium3DTilesetVisualizerSpec.js | 421 +- .../CheckerboardMaterialPropertySpec.js | 286 +- .../DataSources/ColorMaterialPropertySpec.js | 201 +- .../CompositeEntityCollectionSpec.js | 1839 +- .../CompositeMaterialPropertySpec.js | 331 +- .../CompositePositionPropertySpec.js | 600 +- Specs/DataSources/CompositePropertySpec.js | 309 +- .../ConstantPositionPropertySpec.js | 299 +- Specs/DataSources/ConstantPropertySpec.js | 215 +- .../CorridorGeometryUpdaterSpec.js | 468 +- Specs/DataSources/CorridorGraphicsSpec.js | 463 +- Specs/DataSources/CustomDataSourceSpec.js | 154 +- .../CylinderGeometryUpdaterSpec.js | 490 +- Specs/DataSources/CylinderGraphicsSpec.js | 393 +- Specs/DataSources/CzmlDataSourceSpec.js | 27008 +++++++++++----- Specs/DataSources/DataSourceClockSpec.js | 229 +- Specs/DataSources/DataSourceCollectionSpec.js | 385 +- Specs/DataSources/DataSourceDisplaySpec.js | 897 +- .../DataSources/DynamicGeometryUpdaterSpec.js | 121 +- .../DataSources/EllipseGeometryUpdaterSpec.js | 530 +- Specs/DataSources/EllipseGraphicsSpec.js | 502 +- .../EllipsoidGeometryUpdaterSpec.js | 835 +- Specs/DataSources/EllipsoidGraphicsSpec.js | 476 +- Specs/DataSources/EntityClusterSpec.js | 1229 +- Specs/DataSources/EntityCollectionSpec.js | 973 +- Specs/DataSources/EntitySpec.js | 958 +- Specs/DataSources/EntityViewSpec.js | 179 +- Specs/DataSources/GeoJsonDataSourceSpec.js | 2657 +- Specs/DataSources/GeometryUpdaterSpec.js | 208 +- Specs/DataSources/GeometryVisualizerSpec.js | 1658 +- Specs/DataSources/GridMaterialPropertySpec.js | 609 +- .../DataSources/GroundGeometryUpdaterSpec.js | 336 +- .../DataSources/ImageMaterialPropertySpec.js | 359 +- Specs/DataSources/KmlDataSourceSpec.js | 6342 ++-- Specs/DataSources/KmlTourFlyToSpec.js | 259 +- Specs/DataSources/KmlTourSpec.js | 284 +- Specs/DataSources/LabelGraphicsSpec.js | 483 +- Specs/DataSources/LabelVisualizerSpec.js | 633 +- Specs/DataSources/ModelGraphicsSpec.js | 685 +- Specs/DataSources/ModelVisualizerSpec.js | 698 +- .../NodeTransformationPropertySpec.js | 304 +- Specs/DataSources/PathGraphicsSpec.js | 231 +- Specs/DataSources/PathVisualizerSpec.js | 1426 +- Specs/DataSources/PlaneGeometryUpdaterSpec.js | 180 +- Specs/DataSources/PlaneGraphicsSpec.js | 359 +- Specs/DataSources/PointGraphicsSpec.js | 287 +- Specs/DataSources/PointVisualizerSpec.js | 675 +- .../DataSources/PolygonGeometryUpdaterSpec.js | 714 +- Specs/DataSources/PolygonGraphicsSpec.js | 570 +- .../PolylineArrowMaterialPropertySpec.js | 201 +- .../PolylineDashMaterialPropertySpec.js | 538 +- .../PolylineGeometryUpdaterSpec.js | 1594 +- .../PolylineGlowMaterialPropertySpec.js | 319 +- Specs/DataSources/PolylineGraphicsSpec.js | 400 +- .../PolylineOutlineMaterialPropertySpec.js | 419 +- Specs/DataSources/PolylineVisualizerSpec.js | 1407 +- .../PolylineVolumeGeometryUpdaterSpec.js | 333 +- .../DataSources/PolylineVolumeGraphicsSpec.js | 400 +- .../DataSources/PositionPropertyArraySpec.js | 231 +- Specs/DataSources/PropertyArraySpec.js | 187 +- Specs/DataSources/PropertyBagSpec.js | 456 +- .../RectangleGeometryUpdaterSpec.js | 395 +- Specs/DataSources/RectangleGraphicsSpec.js | 459 +- Specs/DataSources/ReferencePropertySpec.js | 679 +- Specs/DataSources/RotationSpec.js | 41 +- .../SampledPositionPropertySpec.js | 917 +- Specs/DataSources/SampledPropertySpec.js | 1941 +- .../StaticGeometryColorBatchSpec.js | 904 +- .../StaticGeometryPerMaterialBatchSpec.js | 989 +- .../StaticGroundGeometryColorBatchSpec.js | 740 +- ...taticGroundGeometryPerMaterialBatchSpec.js | 883 +- ...taticGroundPolylinePerMaterialBatchSpec.js | 1028 +- .../StaticOutlineGeometryBatchSpec.js | 718 +- .../DataSources/StripeMaterialPropertySpec.js | 381 +- .../DataSources/TerrainOffsetPropertySpec.js | 100 +- ...eIntervalCollectionPositionPropertySpec.js | 446 +- .../TimeIntervalCollectionPropertySpec.js | 307 +- .../VelocityOrientationPropertySpec.js | 405 +- .../DataSources/VelocityVectorPropertySpec.js | 455 +- Specs/DataSources/WallGeometryUpdaterSpec.js | 357 +- Specs/DataSources/WallGraphicsSpec.js | 389 +- .../createMaterialPropertyDescriptorSpec.js | 91 +- Specs/DataSources/exportKmlSpec.js | 2433 +- Specs/DomEventSimulator.js | 605 +- Specs/MockDataSource.js | 44 +- Specs/MockImageryProvider.js | 135 +- Specs/MockTerrainProvider.js | 488 +- Specs/Renderer/AutomaticUniformSpec.js | 3550 +- Specs/Renderer/BufferSpec.js | 1452 +- Specs/Renderer/BuiltinFunctionsSpec.js | 929 +- Specs/Renderer/ClearCommandSpec.js | 67 +- Specs/Renderer/ClearSpec.js | 219 +- Specs/Renderer/ComputeCommandSpec.js | 267 +- Specs/Renderer/ContextSpec.js | 451 +- Specs/Renderer/CubeMapSpec.js | 2499 +- Specs/Renderer/DrawCommandSpec.js | 389 +- Specs/Renderer/DrawSpec.js | 2716 +- Specs/Renderer/FramebufferSpec.js | 1760 +- Specs/Renderer/PassStateSpec.js | 21 +- Specs/Renderer/RenderStateSpec.js | 1740 +- Specs/Renderer/RenderbufferSpec.js | 175 +- Specs/Renderer/SamplerSpec.js | 104 +- Specs/Renderer/ShaderCacheSpec.js | 518 +- Specs/Renderer/ShaderProgramSpec.js | 958 +- Specs/Renderer/ShaderSourceSpec.js | 155 +- Specs/Renderer/TextureCacheSpec.js | 167 +- Specs/Renderer/TextureSpec.js | 2636 +- Specs/Renderer/UniformSpec.js | 1677 +- Specs/Renderer/VertexArrayFacadeSpec.js | 693 +- Specs/Renderer/VertexArrayFactorySpec.js | 1322 +- Specs/Renderer/VertexArraySpec.js | 1568 +- .../checkFloatTexturePrecisionSpec.js | 57 +- Specs/Renderer/freezeRenderStateSpec.js | 35 +- Specs/Renderer/loadCubeMapSpec.js | 480 +- Specs/Renderer/modernizeShaderSpec.js | 578 +- Specs/Scene/AppearanceSpec.js | 203 +- .../ArcGisMapServerImageryProviderSpec.js | 2155 +- Specs/Scene/AxisSpec.js | 75 +- Specs/Scene/BatchTableSpec.js | 474 +- ...d3DModel3DTileContentClassificationSpec.js | 341 +- .../Scene/Batched3DModel3DTileContentSpec.js | 692 +- Specs/Scene/BillboardCollectionSpec.js | 3231 +- Specs/Scene/BingMapsImageryProviderSpec.js | 1097 +- Specs/Scene/BoxEmitterSpec.js | 117 +- Specs/Scene/CameraEventAggregatorSpec.js | 607 +- Specs/Scene/CameraFlightPathSpec.js | 1117 +- Specs/Scene/CameraSpec.js | 7368 +++-- Specs/Scene/Cesium3DTileBatchTableSpec.js | 2203 +- Specs/Scene/Cesium3DTileContentSpec.js | 125 +- Specs/Scene/Cesium3DTileFeatureTableSpec.js | 87 +- Specs/Scene/Cesium3DTilePassStateSpec.js | 73 +- Specs/Scene/Cesium3DTileSpec.js | 957 +- Specs/Scene/Cesium3DTileStyleSpec.js | 6568 ++-- Specs/Scene/Cesium3DTilesetHeatmapSpec.js | 236 +- Specs/Scene/Cesium3DTilesetSpec.js | 7097 ++-- Specs/Scene/CircleEmitterSpec.js | 115 +- Specs/Scene/ClassificationModelSpec.js | 496 +- Specs/Scene/ClassificationPrimitiveSpec.js | 1916 +- Specs/Scene/ClippingPlaneCollectionSpec.js | 1492 +- Specs/Scene/ClippingPlaneSpec.js | 191 +- Specs/Scene/Composite3DTileContentSpec.js | 208 +- Specs/Scene/ConditionsExpressionSpec.js | 218 +- Specs/Scene/ConeEmitterSpec.js | 90 +- Specs/Scene/CreditDisplaySpec.js | 750 +- Specs/Scene/DebugAppearanceSpec.js | 638 +- Specs/Scene/DebugCameraPrimitiveSpec.js | 200 +- Specs/Scene/DebugModelMatrixPrimitiveSpec.js | 133 +- .../DeviceOrientationCameraControllerSpec.js | 202 +- Specs/Scene/DirectionalLightSpec.js | 81 +- .../Scene/DiscardEmptyTileImagePolicySpec.js | 86 +- .../DiscardMissingTileImagePolicySpec.js | 313 +- Specs/Scene/EllipsoidPrimitiveSpec.js | 269 +- Specs/Scene/EllipsoidSurfaceAppearanceSpec.js | 114 +- Specs/Scene/Empty3DTileContentSpec.js | 51 +- Specs/Scene/ExpressionSpec.js | 7527 +++-- Specs/Scene/FrameRateMonitorSpec.js | 374 +- Specs/Scene/FrustumCommandsSpec.js | 47 +- Specs/Scene/Geometry3DTileContentSpec.js | 1294 +- Specs/Scene/GeometryRenderingSpec.js | 3534 +- Specs/Scene/GlobeSpec.js | 621 +- Specs/Scene/GlobeSurfaceTileProviderSpec.js | 1945 +- Specs/Scene/GlobeSurfaceTileSpec.js | 795 +- ...oogleEarthEnterpriseImageryProviderSpec.js | 585 +- .../GoogleEarthEnterpriseMapsProviderSpec.js | 1228 +- Specs/Scene/GridImageryProviderSpec.js | 143 +- Specs/Scene/GroundPolylinePrimitiveSpec.js | 1768 +- Specs/Scene/GroundPrimitiveSpec.js | 2390 +- Specs/Scene/HeightmapTessellatorSpec.js | 1185 +- Specs/Scene/ImageryLayerCollectionSpec.js | 1008 +- Specs/Scene/ImageryLayerSpec.js | 1416 +- .../Instanced3DModel3DTileContentSpec.js | 748 +- Specs/Scene/IonImageryProviderSpec.js | 644 +- Specs/Scene/JobSchedulerSpec.js | 361 +- Specs/Scene/LabelCollectionSpec.js | 4541 +-- Specs/Scene/LightSpec.js | 23 +- Specs/Scene/MapboxImageryProviderSpec.js | 622 +- Specs/Scene/MapboxStyleImageryProviderSpec.js | 688 +- Specs/Scene/MaterialAppearanceSpec.js | 195 +- Specs/Scene/MaterialSpec.js | 1630 +- Specs/Scene/ModelInstanceCollectionSpec.js | 1309 +- Specs/Scene/ModelSpec.js | 6570 ++-- Specs/Scene/MoonSpec.js | 114 +- Specs/Scene/MultifrustumSpec.js | 586 +- Specs/Scene/OctahedralProjectedCubeMapSpec.js | 380 +- .../Scene/OpenStreetMapImageryProviderSpec.js | 529 +- .../OrderedGroundPrimitiveCollectionSpec.js | 531 +- Specs/Scene/ParticleSpec.js | 179 +- Specs/Scene/ParticleSystemSpec.js | 731 +- Specs/Scene/PerInstanceColorAppearanceSpec.js | 124 +- Specs/Scene/PickingSpec.js | 4462 +-- Specs/Scene/PointCloud3DTileContentSpec.js | 1948 +- Specs/Scene/PointCloudEyeDomeLightingSpec.js | 118 +- Specs/Scene/PointCloudShadingSpec.js | 94 +- Specs/Scene/PointPrimitiveCollectionSpec.js | 1565 +- Specs/Scene/PolylineCollectionSpec.js | 3348 +- Specs/Scene/PolylineColorAppearanceSpec.js | 116 +- Specs/Scene/PolylineMaterialAppearanceSpec.js | 110 +- Specs/Scene/PostProcessStageCollectionSpec.js | 695 +- Specs/Scene/PostProcessStageCompositeSpec.js | 409 +- Specs/Scene/PostProcessStageLibrarySpec.js | 924 +- Specs/Scene/PostProcessStageSpec.js | 504 +- Specs/Scene/PrimitiveCollectionSpec.js | 792 +- Specs/Scene/PrimitiveCullingSpec.js | 342 +- Specs/Scene/PrimitivePipelineSpec.js | 120 +- Specs/Scene/PrimitiveSpec.js | 2320 +- Specs/Scene/QuadtreePrimitiveSpec.js | 2052 +- Specs/Scene/QuadtreeTileSpec.js | 694 +- Specs/Scene/SceneSpec.js | 3224 +- Specs/Scene/SceneTransformsSpec.js | 472 +- .../Scene/ScreenSpaceCameraControllerSpec.js | 2911 +- Specs/Scene/ShadowMapSpec.js | 2145 +- Specs/Scene/ShadowVolumeAppearanceSpec.js | 1544 +- Specs/Scene/SingleTileImageryProviderSpec.js | 440 +- Specs/Scene/SkyAtmosphereSpec.js | 241 +- Specs/Scene/SkyBoxSpec.js | 615 +- Specs/Scene/SphereEmitterSpec.js | 115 +- Specs/Scene/StyleExpressionSpec.js | 34 +- Specs/Scene/SunLightSpec.js | 31 +- Specs/Scene/SunSpec.js | 153 +- Specs/Scene/TerrainFillMeshSpec.js | 2117 +- Specs/Scene/TextureAtlasSpec.js | 1657 +- Specs/Scene/TileBoundingRegionSpec.js | 459 +- Specs/Scene/TileBoundingSphereSpec.js | 111 +- Specs/Scene/TileBoundingVolumeSpec.js | 29 +- .../TileCoordinatesImageryProviderSpec.js | 145 +- Specs/Scene/TileImagerySpec.js | 121 +- .../TileMapServiceImageryProviderSpec.js | 1686 +- Specs/Scene/TileOrientedBoundingBoxSpec.js | 212 +- Specs/Scene/TileReplacementQueueSpec.js | 289 +- Specs/Scene/Tileset3DTileContentSpec.js | 90 +- Specs/Scene/TimeDynamicImagerySpec.js | 442 +- Specs/Scene/TimeDynamicPointCloudSpec.js | 1480 +- Specs/Scene/TweenCollectionSpec.js | 698 +- Specs/Scene/UrlTemplateImageryProviderSpec.js | 1777 +- Specs/Scene/Vector3DTileContentSpec.js | 1474 +- Specs/Scene/Vector3DTileGeometrySpec.js | 1621 +- Specs/Scene/Vector3DTilePointsSpec.js | 845 +- Specs/Scene/Vector3DTilePolygonsSpec.js | 1185 +- Specs/Scene/Vector3DTilePolylinesSpec.js | 435 +- Specs/Scene/ViewportQuadSpec.js | 162 +- .../Scene/WebMapServiceImageryProviderSpec.js | 2938 +- .../WebMapTileServiceImageryProviderSpec.js | 1315 +- .../computeFlyToLocationForRectangleSpec.js | 295 +- .../createTangentSpaceDebugPrimitiveSpec.js | 98 +- Specs/SpecRunner.html | 61 +- Specs/TerrainTileProcessor.js | 229 +- Specs/TestWorkers/createBadGeometry.js | 10 +- Specs/TestWorkers/returnByteLength.js | 15 +- Specs/TestWorkers/returnNonCloneable.js | 19 +- Specs/TestWorkers/returnParameters.js | 15 +- Specs/TestWorkers/returnWasmConfig.js | 14 +- Specs/TestWorkers/throwError.js | 15 +- Specs/TestWorkers/transferArrayBuffer.js | 19 +- Specs/ThirdParty/knockoutSpec.js | 33 +- Specs/ThirdParty/whenSpec.js | 505 +- Specs/ViewportPrimitive.js | 53 +- Specs/Widgets/Animation/AnimationSpec.js | 81 +- .../Animation/AnimationViewModelSpec.js | 1286 +- .../BaseLayerPicker/BaseLayerPickerSpec.js | 140 +- .../BaseLayerPickerViewModelSpec.js | 506 +- .../BaseLayerPicker/ProviderViewModelSpec.js | 281 +- .../Cesium3DTilesInspectorSpec.js | 113 +- .../Cesium3DTilesInspectorViewModelSpec.js | 586 +- .../CesiumInspector/CesiumInspectorSpec.js | 79 +- .../CesiumInspectorViewModelSpec.js | 413 +- .../Widgets/CesiumWidget/CesiumWidgetSpec.js | 666 +- Specs/Widgets/ClockViewModelSpec.js | 145 +- .../FullscreenButton/FullscreenButtonSpec.js | 73 +- .../FullscreenButtonViewModelSpec.js | 91 +- Specs/Widgets/Geocoder/GeocoderSpec.js | 117 +- .../Widgets/Geocoder/GeocoderViewModelSpec.js | 412 +- Specs/Widgets/HomeButton/HomeButtonSpec.js | 77 +- .../HomeButton/HomeButtonViewModelSpec.js | 81 +- Specs/Widgets/InfoBox/InfoBoxSpec.js | 129 +- Specs/Widgets/InfoBox/InfoBoxViewModelSpec.js | 95 +- .../NavigationHelpButtonSpec.js | 178 +- .../NavigationHelpButtonViewModelSpec.js | 29 +- .../PerformanceWatchdogSpec.js | 105 +- .../PerformanceWatchdogViewModelSpec.js | 288 +- .../ProjectionPicker/ProjectionPickerSpec.js | 180 +- .../ProjectionPickerViewModelSpec.js | 127 +- .../SceneModePicker/SceneModePickerSpec.js | 116 +- .../SceneModePickerViewModelSpec.js | 143 +- .../SelectionIndicatorSpec.js | 67 +- .../SelectionIndicatorViewModelSpec.js | 168 +- Specs/Widgets/SvgPathBindingHandlerSpec.js | 178 +- Specs/Widgets/Timeline/TimelineSpec.js | 43 +- Specs/Widgets/VRButton/VRButtonSpec.js | 117 +- .../Widgets/VRButton/VRButtonViewModelSpec.js | 117 +- Specs/Widgets/Viewer/ViewerSpec.js | 2935 +- .../Widgets/Viewer/viewerDragDropMixinSpec.js | 783 +- .../viewerPerformanceWatchdogMixinSpec.js | 65 +- Specs/Widgets/createCommandSpec.js | 169 +- Specs/absolutize.js | 13 +- Specs/addDefaultMatchers.js | 1849 +- Specs/createCamera.js | 64 +- Specs/createCanvas.js | 31 +- Specs/createContext.js | 62 +- Specs/createDynamicGeometryUpdaterSpecs.js | 305 +- Specs/createDynamicProperty.js | 20 +- Specs/createFrameState.js | 72 +- ...reateGeometryUpdaterGroundGeometrySpecs.js | 624 +- Specs/createGeometryUpdaterSpecs.js | 890 +- Specs/createGlobe.js | 86 +- Specs/createPackableArraySpecs.js | 201 +- Specs/createPackableSpecs.js | 171 +- Specs/createScene.js | 124 +- Specs/createTileKey.js | 28 +- Specs/createViewer.js | 24 +- Specs/customizeJasmine.js | 236 +- Specs/equals.js | 34 +- Specs/equalsMethodEqualityTester.js | 58 +- Specs/getArguments.js | 35 +- Specs/getWebGLStub.js | 545 +- Specs/karma-main.js | 29 +- Specs/karma.conf.js | 198 +- Specs/pick.js | 109 +- Specs/pollToPromise.js | 73 +- Specs/render.js | 110 +- Specs/runLater.js | 26 +- Specs/spec-main.js | 628 +- Specs/testDefinitionChanged.js | 38 +- Specs/testMaterialDefinitionChanged.js | 38 +- Tools/eslint-config-cesium/CHANGES.md | 84 +- Tools/eslint-config-cesium/README.md | 2 +- Tools/eslint-config-cesium/browser.js | 24 +- Tools/eslint-config-cesium/index.js | 106 +- Tools/eslint-config-cesium/node.js | 32 +- Tools/jsdoc/cesiumTags.js | 75 +- Tools/jsdoc/cesium_template/publish.js | 642 +- .../static/javascript/cesiumDoc.js | 112 +- .../static/javascript/html5.js | 117 +- .../static/javascript/prism.js | 329 +- .../static/styles/jsdoc-default.css | 776 +- .../cesium_template/static/styles/prism.css | 95 +- Tools/rollup-plugin-strip-pragma/README.md | 16 +- Tools/rollup-plugin-strip-pragma/index.js | 101 +- index.html | 152 +- index.release.html | 213 +- 1543 files changed, 552614 insertions(+), 445242 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index b5a1d35e07ac..7f8d2800d44b 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -1,6 +1,6 @@ --- name: Ask a question -about: Please use the community forum (https://community.cesium.com/) for general questions about using Cesium. +about: Please use the community forum (https://community.cesium.com/) for general questions about using Cesium. --- -:exclamation: Please use the [community forum](https://community.cesium.com/) for asking questions about how to use Cesium and best practices. The core Cesium team actively monitors the forum and we love seeing what people are working on! :exclamation: \ No newline at end of file +:exclamation: Please use the [community forum](https://community.cesium.com/) for asking questions about how to use Cesium and best practices. The core Cesium team actively monitors the forum and we love seeing what people are working on! :exclamation: diff --git a/Apps/CesiumViewer/CesiumViewer.css b/Apps/CesiumViewer/CesiumViewer.css index 9345e863194e..9f8fde9875bb 100644 --- a/Apps/CesiumViewer/CesiumViewer.css +++ b/Apps/CesiumViewer/CesiumViewer.css @@ -2,40 +2,40 @@ @import url(../../Source/Widgets/lighter.css); html { - height: 100%; + height: 100%; } body { - height: 100%; - width: 100%; - margin: 0; - overflow: hidden; - padding: 0; - background: #000; + height: 100%; + width: 100%; + margin: 0; + overflow: hidden; + padding: 0; + background: #000; } .fullWindow { - position: absolute; - top: 0; - left: 0; - height: 100%; - width: 100%; - margin: 0; - overflow: hidden; - padding: 0; - font-family: sans-serif; + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + margin: 0; + overflow: hidden; + padding: 0; + font-family: sans-serif; } .loadingIndicator { - display: block; - position: absolute; - top: 50%; - left: 50%; - margin-top: -33px; - margin-left: -33px; - width: 66px; - height: 66px; - background-position: center; - background-repeat: no-repeat; - background-image: url(Images/ajax-loader.gif); + display: block; + position: absolute; + top: 50%; + left: 50%; + margin-top: -33px; + margin-left: -33px; + width: 66px; + height: 66px; + background-position: center; + background-repeat: no-repeat; + background-image: url(Images/ajax-loader.gif); } diff --git a/Apps/CesiumViewer/CesiumViewer.js b/Apps/CesiumViewer/CesiumViewer.js index f4584022cdf8..764424718f4d 100644 --- a/Apps/CesiumViewer/CesiumViewer.js +++ b/Apps/CesiumViewer/CesiumViewer.js @@ -1,24 +1,24 @@ -window.CESIUM_BASE_URL = '../../Source/'; +window.CESIUM_BASE_URL = "../../Source/"; import { - Cartesian3, - createWorldTerrain, - defined, - formatError, - Math as CesiumMath, - objectToQuery, - queryToObject, - CzmlDataSource, - GeoJsonDataSource, - KmlDataSource, - TileMapServiceImageryProvider, - Viewer, - viewerCesiumInspectorMixin, - viewerDragDropMixin -} from '../../Source/Cesium.js'; + Cartesian3, + createWorldTerrain, + defined, + formatError, + Math as CesiumMath, + objectToQuery, + queryToObject, + CzmlDataSource, + GeoJsonDataSource, + KmlDataSource, + TileMapServiceImageryProvider, + Viewer, + viewerCesiumInspectorMixin, + viewerDragDropMixin, +} from "../../Source/Cesium.js"; function main() { - /* + /* Options parsed from query string: source=url The URL of a CZML/GeoJSON/KML data source to load at startup. Automatic data type detection uses file extension. @@ -37,175 +37,210 @@ function main() { [height,heading,pitch,roll] default is looking straight down, [300,0,-90,0] saveCamera=false Don't automatically update the camera view in the URL when it changes. */ - var endUserOptions = queryToObject(window.location.search.substring(1)); + var endUserOptions = queryToObject(window.location.search.substring(1)); - var imageryProvider; - if (defined(endUserOptions.tmsImageryUrl)) { - imageryProvider = new TileMapServiceImageryProvider({ - url : endUserOptions.tmsImageryUrl - }); - } - - var loadingIndicator = document.getElementById('loadingIndicator'); - var viewer; - try { - var hasBaseLayerPicker = !defined(imageryProvider); - viewer = new Viewer('cesiumContainer', { - imageryProvider : imageryProvider, - baseLayerPicker : hasBaseLayerPicker, - scene3DOnly : endUserOptions.scene3DOnly, - requestRenderMode : true - }); - - if (hasBaseLayerPicker) { - var viewModel = viewer.baseLayerPicker.viewModel; - viewModel.selectedTerrain = viewModel.terrainProviderViewModels[1]; - } else { - viewer.terrainProvider = createWorldTerrain({ - requestWaterMask: true, - requestVertexNormals: true - }); - } - } catch (exception) { - loadingIndicator.style.display = 'none'; - var message = formatError(exception); - console.error(message); - if (!document.querySelector('.cesium-widget-errorPanel')) { - //eslint-disable-next-line no-alert - window.alert(message); - } - return; - } - - viewer.extend(viewerDragDropMixin); - if (endUserOptions.inspector) { - viewer.extend(viewerCesiumInspectorMixin); - } - - var showLoadError = function(name, error) { - var title = 'An error occurred while loading the file: ' + name; - var message = 'An error occurred while loading the file, which may indicate that it is invalid. A detailed error report is below:'; - viewer.cesiumWidget.showErrorPanel(title, message, error); - }; - - viewer.dropError.addEventListener(function(viewerArg, name, error) { - showLoadError(name, error); + var imageryProvider; + if (defined(endUserOptions.tmsImageryUrl)) { + imageryProvider = new TileMapServiceImageryProvider({ + url: endUserOptions.tmsImageryUrl, + }); + } + + var loadingIndicator = document.getElementById("loadingIndicator"); + var viewer; + try { + var hasBaseLayerPicker = !defined(imageryProvider); + viewer = new Viewer("cesiumContainer", { + imageryProvider: imageryProvider, + baseLayerPicker: hasBaseLayerPicker, + scene3DOnly: endUserOptions.scene3DOnly, + requestRenderMode: true, }); - var scene = viewer.scene; - var context = scene.context; - if (endUserOptions.debug) { - context.validateShaderProgram = true; - context.validateFramebuffer = true; - context.logShaderCompilation = true; - context.throwOnWebGLError = true; + if (hasBaseLayerPicker) { + var viewModel = viewer.baseLayerPicker.viewModel; + viewModel.selectedTerrain = viewModel.terrainProviderViewModels[1]; + } else { + viewer.terrainProvider = createWorldTerrain({ + requestWaterMask: true, + requestVertexNormals: true, + }); } - - var view = endUserOptions.view; - var source = endUserOptions.source; - if (defined(source)) { - var sourceType = endUserOptions.sourceType; - if (!defined(sourceType)) { - // autodetect using file extension if not specified - if (/\.czml$/i.test(source)) { - sourceType = 'czml'; - } else if (/\.geojson$/i.test(source) || /\.json$/i.test(source) || /\.topojson$/i.test(source)) { - sourceType = 'geojson'; - } else if (/\.kml$/i.test(source) || /\.kmz$/i.test(source)) { - sourceType = 'kml'; - } - } - - var loadPromise; - if (sourceType === 'czml') { - loadPromise = CzmlDataSource.load(source); - } else if (sourceType === 'geojson') { - loadPromise = GeoJsonDataSource.load(source); - } else if (sourceType === 'kml') { - loadPromise = KmlDataSource.load(source, { - camera: scene.camera, - canvas: scene.canvas - }); - } else { - showLoadError(source, 'Unknown format.'); - } - - if (defined(loadPromise)) { - viewer.dataSources.add(loadPromise).then(function(dataSource) { - var lookAt = endUserOptions.lookAt; - if (defined(lookAt)) { - var entity = dataSource.entities.getById(lookAt); - if (defined(entity)) { - viewer.trackedEntity = entity; - } else { - var error = 'No entity with id "' + lookAt + '" exists in the provided data source.'; - showLoadError(source, error); - } - } else if (!defined(view) && endUserOptions.flyTo !== 'false') { - viewer.flyTo(dataSource); - } - }).otherwise(function(error) { - showLoadError(source, error); - }); - } + } catch (exception) { + loadingIndicator.style.display = "none"; + var message = formatError(exception); + console.error(message); + if (!document.querySelector(".cesium-widget-errorPanel")) { + //eslint-disable-next-line no-alert + window.alert(message); } - - if (endUserOptions.stats) { - scene.debugShowFramesPerSecond = true; + return; + } + + viewer.extend(viewerDragDropMixin); + if (endUserOptions.inspector) { + viewer.extend(viewerCesiumInspectorMixin); + } + + var showLoadError = function (name, error) { + var title = "An error occurred while loading the file: " + name; + var message = + "An error occurred while loading the file, which may indicate that it is invalid. A detailed error report is below:"; + viewer.cesiumWidget.showErrorPanel(title, message, error); + }; + + viewer.dropError.addEventListener(function (viewerArg, name, error) { + showLoadError(name, error); + }); + + var scene = viewer.scene; + var context = scene.context; + if (endUserOptions.debug) { + context.validateShaderProgram = true; + context.validateFramebuffer = true; + context.logShaderCompilation = true; + context.throwOnWebGLError = true; + } + + var view = endUserOptions.view; + var source = endUserOptions.source; + if (defined(source)) { + var sourceType = endUserOptions.sourceType; + if (!defined(sourceType)) { + // autodetect using file extension if not specified + if (/\.czml$/i.test(source)) { + sourceType = "czml"; + } else if ( + /\.geojson$/i.test(source) || + /\.json$/i.test(source) || + /\.topojson$/i.test(source) + ) { + sourceType = "geojson"; + } else if (/\.kml$/i.test(source) || /\.kmz$/i.test(source)) { + sourceType = "kml"; + } } - var theme = endUserOptions.theme; - if (defined(theme)) { - if (endUserOptions.theme === 'lighter') { - document.body.classList.add('cesium-lighter'); - viewer.animation.applyThemeChanges(); - } else { - var error = 'Unknown theme: ' + theme; - viewer.cesiumWidget.showErrorPanel(error, ''); - } + var loadPromise; + if (sourceType === "czml") { + loadPromise = CzmlDataSource.load(source); + } else if (sourceType === "geojson") { + loadPromise = GeoJsonDataSource.load(source); + } else if (sourceType === "kml") { + loadPromise = KmlDataSource.load(source, { + camera: scene.camera, + canvas: scene.canvas, + }); + } else { + showLoadError(source, "Unknown format."); } - if (defined(view)) { - var splitQuery = view.split(/[ ,]+/); - if (splitQuery.length > 1) { - var longitude = !isNaN(+splitQuery[0]) ? +splitQuery[0] : 0.0; - var latitude = !isNaN(+splitQuery[1]) ? +splitQuery[1] : 0.0; - var height = ((splitQuery.length > 2) && (!isNaN(+splitQuery[2]))) ? +splitQuery[2] : 300.0; - var heading = ((splitQuery.length > 3) && (!isNaN(+splitQuery[3]))) ? CesiumMath.toRadians(+splitQuery[3]) : undefined; - var pitch = ((splitQuery.length > 4) && (!isNaN(+splitQuery[4]))) ? CesiumMath.toRadians(+splitQuery[4]) : undefined; - var roll = ((splitQuery.length > 5) && (!isNaN(+splitQuery[5]))) ? CesiumMath.toRadians(+splitQuery[5]) : undefined; - - viewer.camera.setView({ - destination: Cartesian3.fromDegrees(longitude, latitude, height), - orientation: { - heading: heading, - pitch: pitch, - roll: roll - } - }); - } + if (defined(loadPromise)) { + viewer.dataSources + .add(loadPromise) + .then(function (dataSource) { + var lookAt = endUserOptions.lookAt; + if (defined(lookAt)) { + var entity = dataSource.entities.getById(lookAt); + if (defined(entity)) { + viewer.trackedEntity = entity; + } else { + var error = + 'No entity with id "' + + lookAt + + '" exists in the provided data source.'; + showLoadError(source, error); + } + } else if (!defined(view) && endUserOptions.flyTo !== "false") { + viewer.flyTo(dataSource); + } + }) + .otherwise(function (error) { + showLoadError(source, error); + }); } - - var camera = viewer.camera; - function saveCamera() { - var position = camera.positionCartographic; - var hpr = ''; - if (defined(camera.heading)) { - hpr = ',' + CesiumMath.toDegrees(camera.heading) + ',' + CesiumMath.toDegrees(camera.pitch) + ',' + CesiumMath.toDegrees(camera.roll); - } - endUserOptions.view = CesiumMath.toDegrees(position.longitude) + ',' + CesiumMath.toDegrees(position.latitude) + ',' + position.height + hpr; - history.replaceState(undefined, '', '?' + objectToQuery(endUserOptions)); + } + + if (endUserOptions.stats) { + scene.debugShowFramesPerSecond = true; + } + + var theme = endUserOptions.theme; + if (defined(theme)) { + if (endUserOptions.theme === "lighter") { + document.body.classList.add("cesium-lighter"); + viewer.animation.applyThemeChanges(); + } else { + var error = "Unknown theme: " + theme; + viewer.cesiumWidget.showErrorPanel(error, ""); } - - var timeout; - if (endUserOptions.saveCamera !== 'false') { - camera.changed.addEventListener(function() { - window.clearTimeout(timeout); - timeout = window.setTimeout(saveCamera, 1000); - }); + } + + if (defined(view)) { + var splitQuery = view.split(/[ ,]+/); + if (splitQuery.length > 1) { + var longitude = !isNaN(+splitQuery[0]) ? +splitQuery[0] : 0.0; + var latitude = !isNaN(+splitQuery[1]) ? +splitQuery[1] : 0.0; + var height = + splitQuery.length > 2 && !isNaN(+splitQuery[2]) + ? +splitQuery[2] + : 300.0; + var heading = + splitQuery.length > 3 && !isNaN(+splitQuery[3]) + ? CesiumMath.toRadians(+splitQuery[3]) + : undefined; + var pitch = + splitQuery.length > 4 && !isNaN(+splitQuery[4]) + ? CesiumMath.toRadians(+splitQuery[4]) + : undefined; + var roll = + splitQuery.length > 5 && !isNaN(+splitQuery[5]) + ? CesiumMath.toRadians(+splitQuery[5]) + : undefined; + + viewer.camera.setView({ + destination: Cartesian3.fromDegrees(longitude, latitude, height), + orientation: { + heading: heading, + pitch: pitch, + roll: roll, + }, + }); } + } + + var camera = viewer.camera; + function saveCamera() { + var position = camera.positionCartographic; + var hpr = ""; + if (defined(camera.heading)) { + hpr = + "," + + CesiumMath.toDegrees(camera.heading) + + "," + + CesiumMath.toDegrees(camera.pitch) + + "," + + CesiumMath.toDegrees(camera.roll); + } + endUserOptions.view = + CesiumMath.toDegrees(position.longitude) + + "," + + CesiumMath.toDegrees(position.latitude) + + "," + + position.height + + hpr; + history.replaceState(undefined, "", "?" + objectToQuery(endUserOptions)); + } + + var timeout; + if (endUserOptions.saveCamera !== "false") { + camera.changed.addEventListener(function () { + window.clearTimeout(timeout); + timeout = window.setTimeout(saveCamera, 1000); + }); + } - loadingIndicator.style.display = 'none'; + loadingIndicator.style.display = "none"; } main(); diff --git a/Apps/CesiumViewer/index.html b/Apps/CesiumViewer/index.html index 35b67a8902ba..85944f4833af 100644 --- a/Apps/CesiumViewer/index.html +++ b/Apps/CesiumViewer/index.html @@ -1,19 +1,22 @@ - + - + - + - + Cesium Viewer - - - + + +
- + diff --git a/Apps/HelloWorld.html b/Apps/HelloWorld.html index f702337f984e..fc9a59af3282 100644 --- a/Apps/HelloWorld.html +++ b/Apps/HelloWorld.html @@ -1,25 +1,34 @@ - - - - - - - - Hello World! - - - - -
- - + + + +
+ + diff --git a/Apps/Sandcastle/CesiumSandcastle.css b/Apps/Sandcastle/CesiumSandcastle.css index 5013fc8d8d93..e702e130f4e5 100644 --- a/Apps/Sandcastle/CesiumSandcastle.css +++ b/Apps/Sandcastle/CesiumSandcastle.css @@ -1,267 +1,274 @@ -@import url('../../ThirdParty/dojo-release-1.10.4/dijit/themes/claro/claro.css'); +@import url("../../ThirdParty/dojo-release-1.10.4/dijit/themes/claro/claro.css"); -html, body { - height: 100%; - margin: 0; - overflow: hidden; - padding: 0; - font-family: sans-serif; +html, +body { + height: 100%; + margin: 0; + overflow: hidden; + padding: 0; + font-family: sans-serif; } #loading { - display: table; - position: fixed; - width: 100%; - height: 100%; - z-index: 5000; - background: #eee; - border: none; - text-align: center; - color: #777; + display: table; + position: fixed; + width: 100%; + height: 100%; + z-index: 5000; + background: #eee; + border: none; + text-align: center; + color: #777; } #loading span { - display: table-cell; - vertical-align: middle; + display: table-cell; + vertical-align: middle; } #appLayout { - width: 100%; - height: 100%; + width: 100%; + height: 100%; } -#toolbar, #galleryContainer { - -ms-user-select: none; - -moz-user-select: -moz-none; /* allows for re-enabling on sub-elements like the search box */ - -webkit-user-select: none; - user-select: none; +#toolbar, +#galleryContainer { + -ms-user-select: none; + -moz-user-select: -moz-none; /* allows for re-enabling on sub-elements like the search box */ + -webkit-user-select: none; + user-select: none; } #search { - -ms-user-select: text; - -moz-user-select: text; - -webkit-user-select: text; - user-select: text; - } + -ms-user-select: text; + -moz-user-select: text; + -webkit-user-select: text; + user-select: text; +} .cesiumTitle { - float: right; + float: right; } #codeContainer { - width: 40%; + width: 40%; } #bottomPanel { - height: 225px; + height: 225px; } .galleryContainer { - width: 100%; + width: 100%; } .demosContainer { - overflow: auto; - background: rgba(0, 0, 0, 0.8); + overflow: auto; + background: rgba(0, 0, 0, 0.8); } .demos { - padding: 0 5px 5px; - white-space: nowrap; + padding: 0 5px 5px; + white-space: nowrap; } .demoTileThumbnail { - max-height: 150px; - max-width: 225px; - height: 100px; - width: auto; + max-height: 150px; + max-width: 225px; + height: 100px; + width: auto; } .demoTileTitle { - margin: 0 auto 2px auto; - font-size: 0.9em; + margin: 0 auto 2px auto; + font-size: 0.9em; } .demoTooltipType { - text-align: center; - color: #888; - margin-bottom: 5px; - padding-right: 10px; + text-align: center; + color: #888; + margin-bottom: 5px; + padding-right: 10px; } .subInfo { - font-size: 11px; + font-size: 11px; } .galleryError { - color: #f88; + color: #f88; } #docPopup { - display: block; - position: absolute; - left: -999px; - top: 0; - font-family: sans-serif; - font-size: 10pt; + display: block; + position: absolute; + left: -999px; + top: 0; + font-family: sans-serif; + font-size: 10pt; } -#docPopup a, #docPopup a:visited { - display: block; - text-decoration: none; - line-height: 12pt; +#docPopup a, +#docPopup a:visited { + display: block; + text-decoration: none; + line-height: 12pt; } -#docPopup a:focus, #docPopup a:hover { - text-decoration: underline; +#docPopup a:focus, +#docPopup a:hover { + text-decoration: underline; } .logContainer { - display: block; - width: 100%; - height: 100%; - overflow-x: auto; - overflow-y: scroll; + display: block; + width: 100%; + height: 100%; + overflow-x: auto; + overflow-y: scroll; } #logOutput { - white-space: pre-wrap; - padding: 2px 4px; - font-size: 9pt; - font-family: monospace; + white-space: pre-wrap; + padding: 2px 4px; + font-size: 9pt; + font-family: monospace; } .consoleError { - color: #f00; + color: #f00; } .fullFrame { - border: none; - width: 100%; - height: 100%; - transition-property: transform; - transition-duration: 0.5s; - transform-origin: 200px 152px; /* These numbers should be divisible by 4 because of scaling in .makeThumbnail */ + border: none; + width: 100%; + height: 100%; + transition-property: transform; + transition-duration: 0.5s; + transform-origin: 200px 152px; /* These numbers should be divisible by 4 because of scaling in .makeThumbnail */ } .makeThumbnail { - width: 900px; - height: 600px; - transform: scale(0.25); + width: 900px; + height: 600px; + transform: scale(0.25); } .popDownDialog { - width: 360px; + width: 360px; } -a.linkButton, a.linkButton:visited { - display: inline-block; +a.linkButton, +a.linkButton:visited { + display: inline-block; } -a.linkButton:focus, a.linkButton:hover { - text-decoration: none; +a.linkButton:focus, +a.linkButton:hover { + text-decoration: none; } -.CodeMirror, .CodeMirror-scroll { - height: 100%; - font-size: 13px; +.CodeMirror, +.CodeMirror-scroll { + height: 100%; + font-size: 13px; } .highlightToolbarButton { - background: #FE2; - border-radius: 4px; + background: #fe2; + border-radius: 4px; } .claro .bottomPanel { - padding: 0; - overflow: hidden; + padding: 0; + overflow: hidden; } .bottomPanel #innerPanel_tablist { - max-height: 28px; - overflow: auto !important; + max-height: 28px; + overflow: auto !important; } .claro .dijitTabContainerTop-tabs .dijitTabChecked .dijitTabContent { - background-position: 0 -103px; + background-position: 0 -103px; } .claro .dijitTabContainerTop-dijitContentPane { - padding: 0; - overflow: hidden; + padding: 0; + overflow: hidden; } .mblScrollBarWrapper > div { - background-color: #9ED3FF !important; + background-color: #9ed3ff !important; } .errorMarker { - width: 100%; - height: 100%; - color: #222; - font-weight: bold; - background-color: #F42; - border-radius: 3px; - border: none; + width: 100%; + height: 100%; + color: #222; + font-weight: bold; + background-color: #f42; + border-radius: 3px; + border: none; } .CodeMirror pre.errorLine { - background: rgba(200, 50, 0, 0.2); + background: rgba(200, 50, 0, 0.2); } .hintMarker { - width: 100%; - height: 100%; - color: #222; - font-weight: bold; - background-color: #FE2; - border-radius: 3px; - border: none; + width: 100%; + height: 100%; + color: #222; + font-weight: bold; + background-color: #fe2; + border-radius: 3px; + border: none; } .CodeMirror pre.hintLine { - background: rgba(200, 200, 0, 0.2); + background: rgba(200, 200, 0, 0.2); } .highlightMarker { - width: 100%; - height: 100%; - color: #222; - font-weight: bold; - background-color: #2E2; - border-radius: 3px; - border: none; + width: 100%; + height: 100%; + color: #222; + font-weight: bold; + background-color: #2e2; + border-radius: 3px; + border: none; } .CodeMirror pre.highlightLine { - background: rgba(0, 200, 0, 0.2); + background: rgba(0, 200, 0, 0.2); } .searchMarker { - width: 100%; - height: 100%; - color: #222; - font-weight: bold; - background-color: #CEF; - border-radius: 3px; - border: none; + width: 100%; + height: 100%; + color: #222; + font-weight: bold; + background-color: #cef; + border-radius: 3px; + border: none; } .CodeMirror pre.searchLine { - background: rgba(180, 230, 240, 0.2); + background: rgba(180, 230, 240, 0.2); } .CodeMirror-gutter-text { - cursor: default; + cursor: default; } .gitHubIcon { - background-image: url('./images/gitHub16px.png'); - width: 16px; - height: 16px; - text-align: center; + background-image: url("./images/gitHub16px.png"); + width: 16px; + height: 16px; + text-align: center; } .shareIcon { - background-image: url('./images/share16px.png'); - width: 16px; - height: 16px; - text-align: center; + background-image: url("./images/share16px.png"); + width: 16px; + height: 16px; + text-align: center; } diff --git a/Apps/Sandcastle/CesiumSandcastle.js b/Apps/Sandcastle/CesiumSandcastle.js index cc61f27f8ed8..1ee3e048b355 100644 --- a/Apps/Sandcastle/CesiumSandcastle.js +++ b/Apps/Sandcastle/CesiumSandcastle.js @@ -1,1319 +1,1523 @@ /*global JSHINT */ /*global decodeBase64Data, embedInSandcastleTemplate */ -/*global gallery_demos, has_new_gallery_demos, hello_world_index, VERSION*/// defined in gallery/gallery-index.js, created by build -/*global sandcastleJsHintOptions*/// defined by jsHintOptions.js, created by build +/*global gallery_demos, has_new_gallery_demos, hello_world_index, VERSION*/ // defined in gallery/gallery-index.js, created by build +/*global sandcastleJsHintOptions*/ // defined by jsHintOptions.js, created by build require({ - baseUrl: '../../Source', - packages: [{ - name: 'dojo', - location: '../ThirdParty/dojo-release-1.10.4/dojo' - }, { - name: 'dijit', - location: '../ThirdParty/dojo-release-1.10.4/dijit' - }, { - name: 'Sandcastle', - location: '../Apps/Sandcastle' - }, { - name: 'CodeMirror', - location: '../ThirdParty/codemirror-5.52.0' - }, { - name: 'ThirdParty', - location: '../Apps/Sandcastle/ThirdParty' - }] + baseUrl: "../../Source", + packages: [ + { + name: "dojo", + location: "../ThirdParty/dojo-release-1.10.4/dojo", + }, + { + name: "dijit", + location: "../ThirdParty/dojo-release-1.10.4/dijit", + }, + { + name: "Sandcastle", + location: "../Apps/Sandcastle", + }, + { + name: "CodeMirror", + location: "../ThirdParty/codemirror-5.52.0", + }, + { + name: "ThirdParty", + location: "../Apps/Sandcastle/ThirdParty", + }, + ], }, [ - 'CodeMirror/lib/codemirror', - 'dijit/Dialog', - 'dijit/form/Button', - 'dijit/form/Form', - 'dijit/form/Textarea', - 'dijit/layout/ContentPane', - 'dijit/popup', - 'dijit/registry', - 'dijit/TooltipDialog', - 'dojo/_base/fx', - 'dojo/_base/xhr', - 'dojo/dom', - 'dojo/dom-class', - 'dojo/dom-construct', - 'dojo/io-query', - 'dojo/mouse', - 'dojo/on', - 'dojo/parser', - 'dojo/promise/all', - 'dojo/query', - 'dojo/when', - 'dojo/Deferred', - 'dojo/request/script', - 'Sandcastle/LinkButton', - 'ThirdParty/clipboard.min', - 'ThirdParty/pako.min', - 'CodeMirror/addon/hint/show-hint', - 'CodeMirror/addon/hint/javascript-hint', - 'CodeMirror/mode/javascript/javascript', - 'CodeMirror/mode/css/css', - 'CodeMirror/mode/xml/xml', - 'CodeMirror/mode/htmlmixed/htmlmixed', - 'dijit/form/DropDownButton', - 'dijit/form/ToggleButton', - 'dijit/form/DropDownButton', - 'dijit/form/TextBox', - 'dijit/Menu', - 'dijit/MenuBar', - 'dijit/PopupMenuBarItem', - 'dijit/MenuItem', - 'dijit/layout/BorderContainer', - 'dijit/layout/TabContainer', - 'dijit/Toolbar', - 'dijit/ToolbarSeparator', - 'dojo/domReady!' - ], function( - CodeMirror, - Dialog, - Button, - Form, - TextArea, - ContentPane, - popup, - registry, - TooltipDialog, - fx, - xhr, - dom, - domClass, - domConstruct, - ioQuery, - mouse, - on, - parser, - all, - query, - when, - Deferred, - dojoscript, - LinkButton, - ClipboardJS, - pako) { - 'use strict'; - // attach clipboard handling to our Copy button - var clipboardjs = new ClipboardJS('.copyButton'); - - function defined(value) { - return value !== undefined && value !== null; + "CodeMirror/lib/codemirror", + "dijit/Dialog", + "dijit/form/Button", + "dijit/form/Form", + "dijit/form/Textarea", + "dijit/layout/ContentPane", + "dijit/popup", + "dijit/registry", + "dijit/TooltipDialog", + "dojo/_base/fx", + "dojo/_base/xhr", + "dojo/dom", + "dojo/dom-class", + "dojo/dom-construct", + "dojo/io-query", + "dojo/mouse", + "dojo/on", + "dojo/parser", + "dojo/promise/all", + "dojo/query", + "dojo/when", + "dojo/Deferred", + "dojo/request/script", + "Sandcastle/LinkButton", + "ThirdParty/clipboard.min", + "ThirdParty/pako.min", + "CodeMirror/addon/hint/show-hint", + "CodeMirror/addon/hint/javascript-hint", + "CodeMirror/mode/javascript/javascript", + "CodeMirror/mode/css/css", + "CodeMirror/mode/xml/xml", + "CodeMirror/mode/htmlmixed/htmlmixed", + "dijit/form/DropDownButton", + "dijit/form/ToggleButton", + "dijit/form/DropDownButton", + "dijit/form/TextBox", + "dijit/Menu", + "dijit/MenuBar", + "dijit/PopupMenuBarItem", + "dijit/MenuItem", + "dijit/layout/BorderContainer", + "dijit/layout/TabContainer", + "dijit/Toolbar", + "dijit/ToolbarSeparator", + "dojo/domReady!", +], function ( + CodeMirror, + Dialog, + Button, + Form, + TextArea, + ContentPane, + popup, + registry, + TooltipDialog, + fx, + xhr, + dom, + domClass, + domConstruct, + ioQuery, + mouse, + on, + parser, + all, + query, + when, + Deferred, + dojoscript, + LinkButton, + ClipboardJS, + pako +) { + "use strict"; + // attach clipboard handling to our Copy button + var clipboardjs = new ClipboardJS(".copyButton"); + + function defined(value) { + return value !== undefined && value !== null; + } + + parser.parse(); + + fx.fadeOut({ + node: "loading", + onEnd: function () { + domConstruct.destroy("loading"); + }, + }).play(); + + var numberOfNewConsoleMessages = 0; + + var logOutput = document.getElementById("logOutput"); + function appendConsole(className, message, showConsole) { + var ele = document.createElement("span"); + ele.className = className; + ele.textContent = message + "\n"; + logOutput.appendChild(ele); + logOutput.parentNode.scrollTop = + logOutput.clientHeight + 8 - logOutput.parentNode.clientHeight; + if (showConsole) { + hideGallery(); + } else { + ++numberOfNewConsoleMessages; + registry + .byId("logContainer") + .set("title", "Console (" + numberOfNewConsoleMessages + ")"); } - - parser.parse(); - - fx.fadeOut({ - node : 'loading', - onEnd : function() { - domConstruct.destroy('loading'); - } - }).play(); - - var numberOfNewConsoleMessages = 0; - - var logOutput = document.getElementById('logOutput'); - function appendConsole(className, message, showConsole) { - var ele = document.createElement('span'); - ele.className = className; - ele.textContent = message + '\n'; - logOutput.appendChild(ele); - logOutput.parentNode.scrollTop = logOutput.clientHeight + 8 - logOutput.parentNode.clientHeight; - if (showConsole) { - hideGallery(); - } else { - ++numberOfNewConsoleMessages; - registry.byId('logContainer').set('title', 'Console (' + numberOfNewConsoleMessages + ')'); + } + + var URL = window.URL || window.webkitURL; + + function findCssStyle(selectorText) { + for ( + var iSheets = 0, lenSheets = document.styleSheets.length; + iSheets < lenSheets; + ++iSheets + ) { + var rules = document.styleSheets[iSheets].cssRules; + for ( + var iRules = 0, lenRules = rules.length; + iRules < lenRules; + ++iRules + ) { + if (rules[iRules].selectorText === selectorText) { + return rules[iRules]; } + } } + } + + var jsEditor; + var htmlEditor; + var suggestButton = registry.byId("buttonSuggest"); + var docTimer; + var docTabs = {}; + var subtabs = {}; + var docError = false; + var galleryError = false; + var deferredLoadError = false; + var galleryTooltipTimer; + var activeGalleryTooltipDemo; + var demoTileHeightRule = findCssStyle(".demoTileThumbnail"); + var cesiumContainer = registry.byId("cesiumContainer"); + var docNode = dom.byId("docPopup"); + var docMessage = dom.byId("docPopupMessage"); + var local = { + docTypes: [], + headers: "", + bucketName: "", + emptyBucket: "", + }; + var bucketTypes = {}; + var demoTooltips = {}; + var errorLines = []; + var highlightLines = []; + var searchTerm = ""; + var searchRegExp; + var hintTimer; + var defaultDemo = "Hello World"; + var defaultLabel = "Showcases"; + var currentTab = defaultLabel; + var newDemo; + var demoHtml = ""; + var demoCode = ""; + + var defaultHtml = + '\n
\n

Loading...

\n
'; + + var galleryErrorMsg = document.createElement("span"); + galleryErrorMsg.className = "galleryError"; + galleryErrorMsg.style.display = "none"; + galleryErrorMsg.textContent = "No demos match your search terms."; + + var bucketFrame = document.getElementById("bucketFrame"); + var bucketPane = registry.byId("bucketPane"); + var bucketWaiting = false; + + xhr + .get({ + url: "../../Build/Documentation/types.txt", + handleAs: "json", + error: function (error) { + docError = true; + }, + }) + .then(function (value) { + local.docTypes = value; + }); - var URL = window.URL || window.webkitURL; - - function findCssStyle(selectorText) { - for (var iSheets = 0, lenSheets = document.styleSheets.length; iSheets < lenSheets; ++iSheets) { - var rules = document.styleSheets[iSheets].cssRules; - for (var iRules = 0, lenRules = rules.length; iRules < lenRules; ++iRules) { - if (rules[iRules].selectorText === selectorText) { - return rules[iRules]; - } - } - } + var decoderSpan = document.createElement("span"); + function encodeHTML(text) { + decoderSpan.textContent = text; + text = decoderSpan.innerHTML; + decoderSpan.innerHTML = ""; + return text; + } + function decodeHTML(text) { + decoderSpan.innerHTML = text; + text = decoderSpan.textContent; + decoderSpan.innerHTML = ""; + return text; + } + + function highlightRun() { + domClass.add(registry.byId("buttonRun").domNode, "highlightToolbarButton"); + } + + function clearRun() { + domClass.remove( + registry.byId("buttonRun").domNode, + "highlightToolbarButton" + ); + } + + function openDocTab(title, link) { + if (!defined(docTabs[title])) { + docTabs[title] = new ContentPane({ + title: title, + focused: true, + content: '', + closable: true, + onClose: function () { + docTabs[this.title] = undefined; + // Return true to close the tab. + return true; + }, + }).placeAt(cesiumContainer); + // After the iframe loads, re-scroll to selected field. + docTabs[title].domNode.childNodes[0].onload = function () { + this.onload = function () {}; + this.src = link; + }; + cesiumContainer.selectChild(docTabs[title]); + } else { + // Tab already exists, but maybe not visible. Firefox needs the tab to + // be revealed before a re-scroll can happen. Chrome works either way. + cesiumContainer.selectChild(docTabs[title]); + docTabs[title].domNode.childNodes[0].src = link; } + } - var jsEditor; - var htmlEditor; - var suggestButton = registry.byId('buttonSuggest'); - var docTimer; - var docTabs = {}; - var subtabs = {}; - var docError = false; - var galleryError = false; - var deferredLoadError = false; - var galleryTooltipTimer; - var activeGalleryTooltipDemo; - var demoTileHeightRule = findCssStyle('.demoTileThumbnail'); - var cesiumContainer = registry.byId('cesiumContainer'); - var docNode = dom.byId('docPopup'); - var docMessage = dom.byId('docPopupMessage'); - var local = { - 'docTypes' : [], - 'headers' : '', - 'bucketName' : '', - 'emptyBucket' : '' + function showDocPopup() { + var selectedText = jsEditor.getSelection(); + var lowerText = selectedText.toLowerCase(); + + var onDocClick = function () { + openDocTab(this.textContent, this.href); + return false; }; - var bucketTypes = {}; - var demoTooltips = {}; - var errorLines = []; - var highlightLines = []; - var searchTerm = ''; - var searchRegExp; - var hintTimer; - var defaultDemo = 'Hello World'; - var defaultLabel = 'Showcases'; - var currentTab = defaultLabel; - var newDemo; - var demoHtml = ''; - var demoCode = ''; - - var defaultHtml = '\n
\n

Loading...

\n
'; - - var galleryErrorMsg = document.createElement('span'); - galleryErrorMsg.className = 'galleryError'; - galleryErrorMsg.style.display = 'none'; - galleryErrorMsg.textContent = 'No demos match your search terms.'; - - var bucketFrame = document.getElementById('bucketFrame'); - var bucketPane = registry.byId('bucketPane'); - var bucketWaiting = false; - - xhr.get({ - url : '../../Build/Documentation/types.txt', - handleAs : 'json', - error : function(error) { - docError = true; - } - }).then(function(value) { - local.docTypes = value; - }); - var decoderSpan = document.createElement('span'); - function encodeHTML(text) { - decoderSpan.textContent = text; - text = decoderSpan.innerHTML; - decoderSpan.innerHTML = ''; - return text; - } - function decodeHTML(text) { - decoderSpan.innerHTML = text; - text = decoderSpan.textContent; - decoderSpan.innerHTML = ''; - return text; + docTimer = undefined; + if (docError && selectedText && selectedText.length < 50) { + hideGallery(); + } else if ( + lowerText && + lowerText in local.docTypes && + typeof local.docTypes[lowerText].push === "function" + ) { + docMessage.innerHTML = ""; + for (var i = 0, len = local.docTypes[lowerText].length; i < len; ++i) { + var member = local.docTypes[lowerText][i]; + var ele = document.createElement("a"); + ele.target = "_blank"; + ele.textContent = member + .replace(".html", "") + .replace("module-", "") + .replace("#.", ".") + .replace("#", "."); + ele.href = "../../Build/Documentation/" + member; + ele.onclick = onDocClick; + docMessage.appendChild(ele); + } + jsEditor.addWidget(jsEditor.getCursor(true), docNode); + docNode.style.top = parseInt(docNode.style.top, 10) - 5 + "px"; } + } - function highlightRun() { - domClass.add(registry.byId('buttonRun').domNode, 'highlightToolbarButton'); + function onCursorActivity() { + docNode.style.left = "-999px"; + if (defined(docTimer)) { + window.clearTimeout(docTimer); } - - function clearRun() { - domClass.remove(registry.byId('buttonRun').domNode, 'highlightToolbarButton'); + docTimer = window.setTimeout(showDocPopup, 500); + } + + function makeLineLabel(msg, className) { + var element = document.createElement("abbr"); + element.className = className; + switch (className) { + case "hintMarker": + element.innerHTML = "▲"; + break; + case "errorMarker": + element.innerHTML = "×"; + break; + default: + element.innerHTML = "▶"; } - - function openDocTab(title, link) { - if (!defined(docTabs[title])) { - docTabs[title] = new ContentPane({ - title : title, - focused : true, - content : '', - closable : true, - onClose : function() { - docTabs[this.title] = undefined; - // Return true to close the tab. - return true; - } - }).placeAt(cesiumContainer); - // After the iframe loads, re-scroll to selected field. - docTabs[title].domNode.childNodes[0].onload = function() { - this.onload = function() { - }; - this.src = link; - }; - cesiumContainer.selectChild(docTabs[title]); - } else { - // Tab already exists, but maybe not visible. Firefox needs the tab to - // be revealed before a re-scroll can happen. Chrome works either way. - cesiumContainer.selectChild(docTabs[title]); - docTabs[title].domNode.childNodes[0].src = link; - } + element.title = msg; + return element; + } + + function closeGalleryTooltip() { + if (defined(activeGalleryTooltipDemo)) { + popup.close(demoTooltips[activeGalleryTooltipDemo.name]); + activeGalleryTooltipDemo = undefined; } + } - function showDocPopup() { - var selectedText = jsEditor.getSelection(); - var lowerText = selectedText.toLowerCase(); + function openGalleryTooltip() { + galleryTooltipTimer = undefined; - var onDocClick = function() { - openDocTab(this.textContent, this.href); - return false; - }; - - docTimer = undefined; - if (docError && selectedText && selectedText.length < 50) { - hideGallery(); - } else if (lowerText && lowerText in local.docTypes && typeof local.docTypes[lowerText].push === 'function') { - docMessage.innerHTML = ''; - for (var i = 0, len = local.docTypes[lowerText].length; i < len; ++i) { - var member = local.docTypes[lowerText][i]; - var ele = document.createElement('a'); - ele.target = '_blank'; - ele.textContent = member.replace('.html', '').replace('module-', '').replace('#.', '.').replace('#', '.'); - ele.href = '../../Build/Documentation/' + member; - ele.onclick = onDocClick; - docMessage.appendChild(ele); - } - jsEditor.addWidget(jsEditor.getCursor(true), docNode); - docNode.style.top = (parseInt(docNode.style.top, 10) - 5) + 'px'; - } + var selectedTabName = registry.byId("innerPanel").selectedChildWidget.title; + var suffix = selectedTabName + "Demos"; + if (selectedTabName === "All") { + suffix = "all"; + } else if (selectedTabName === "Search Results") { + suffix = "searchDemo"; } - function onCursorActivity() { - docNode.style.left = '-999px'; - if (defined(docTimer)) { - window.clearTimeout(docTimer); - } - docTimer = window.setTimeout(showDocPopup, 500); + if (defined(activeGalleryTooltipDemo)) { + popup.open({ + popup: demoTooltips[activeGalleryTooltipDemo.name], + around: dom.byId(activeGalleryTooltipDemo.name + suffix), + orient: ["above", "below"], + }); } - - function makeLineLabel(msg, className) { - var element = document.createElement('abbr'); - element.className = className; - switch (className) { - case 'hintMarker': - element.innerHTML = '▲'; - break; - case 'errorMarker': - element.innerHTML = '×'; - break; - default: - element.innerHTML = '▶'; - } - element.title = msg; - return element; + } + + function scheduleGalleryTooltip(demo) { + if (demo !== activeGalleryTooltipDemo) { + activeGalleryTooltipDemo = demo; + if (defined(galleryTooltipTimer)) { + window.clearTimeout(galleryTooltipTimer); + } + galleryTooltipTimer = window.setTimeout(openGalleryTooltip, 220); } - - function closeGalleryTooltip() { - if (defined(activeGalleryTooltipDemo)) { - popup.close(demoTooltips[activeGalleryTooltipDemo.name]); - activeGalleryTooltipDemo = undefined; - } + } + + function scriptLineToEditorLine(line) { + // editor lines are zero-indexed, plus 3 lines of boilerplate + return line - 4; + } + + function clearErrorsAddHints() { + var line; + var i; + var len; + hintTimer = undefined; + closeGalleryTooltip(); + jsEditor.clearGutter("hintGutter"); + jsEditor.clearGutter("highlightGutter"); + jsEditor.clearGutter("errorGutter"); + jsEditor.clearGutter("searchGutter"); + while (errorLines.length > 0) { + line = errorLines.pop(); + jsEditor.removeLineClass(line, "text"); } - - function openGalleryTooltip() { - galleryTooltipTimer = undefined; - - var selectedTabName = registry.byId('innerPanel').selectedChildWidget.title; - var suffix = selectedTabName + 'Demos'; - if (selectedTabName === 'All') { - suffix = 'all'; - } else if (selectedTabName === 'Search Results') { - suffix = 'searchDemo'; - } - - if (defined(activeGalleryTooltipDemo)) { - popup.open({ - popup : demoTooltips[activeGalleryTooltipDemo.name], - around : dom.byId(activeGalleryTooltipDemo.name + suffix), - orient : ['above', 'below'] - }); + while (highlightLines.length > 0) { + line = highlightLines.pop(); + jsEditor.removeLineClass(line, "text"); + } + var code = jsEditor.getValue(); + if (searchTerm !== "") { + var codeLines = code.split("\n"); + for (i = 0, len = codeLines.length; i < len; ++i) { + if (searchRegExp.test(codeLines[i])) { + line = jsEditor.setGutterMarker( + i, + "searchGutter", + makeLineLabel("Search: " + searchTerm, "searchMarker") + ); + jsEditor.addLineClass(line, "text", "searchLine"); + errorLines.push(line); } + } } - - function scheduleGalleryTooltip(demo) { - if (demo !== activeGalleryTooltipDemo) { - activeGalleryTooltipDemo = demo; - if (defined(galleryTooltipTimer)) { - window.clearTimeout(galleryTooltipTimer); - } - galleryTooltipTimer = window.setTimeout(openGalleryTooltip, 220); + // make a copy of the options, JSHint modifies the object it's given + var options = JSON.parse(JSON.stringify(sandcastleJsHintOptions)); + /*eslint-disable new-cap*/ + if ( + !JSHINT(embedInSandcastleTemplate(jsEditor.getValue(), false), options) + ) { + var hints = JSHINT.errors; + for (i = 0, len = hints.length; i < len; ++i) { + var hint = hints[i]; + if (hint !== null && defined(hint.reason) && hint.line > 0) { + line = jsEditor.setGutterMarker( + scriptLineToEditorLine(hint.line), + "hintGutter", + makeLineLabel(hint.reason, "hintMarker") + ); + jsEditor.addLineClass(line, "text", "hintLine"); + errorLines.push(line); } + } } + /*eslint-enable new-cap*/ + } - function scriptLineToEditorLine(line) { - // editor lines are zero-indexed, plus 3 lines of boilerplate - return line - 4; + function scheduleHint() { + if (defined(hintTimer)) { + window.clearTimeout(hintTimer); } + hintTimer = setTimeout(clearErrorsAddHints, 550); + highlightRun(); + } - function clearErrorsAddHints() { - var line; - var i; - var len; - hintTimer = undefined; - closeGalleryTooltip(); - jsEditor.clearGutter('hintGutter'); - jsEditor.clearGutter('highlightGutter'); - jsEditor.clearGutter('errorGutter'); - jsEditor.clearGutter('searchGutter'); - while (errorLines.length > 0) { - line = errorLines.pop(); - jsEditor.removeLineClass(line, 'text'); - } - while (highlightLines.length > 0) { - line = highlightLines.pop(); - jsEditor.removeLineClass(line, 'text'); - } - var code = jsEditor.getValue(); - if (searchTerm !== '') { - var codeLines = code.split('\n'); - for (i = 0, len = codeLines.length; i < len; ++i) { - if (searchRegExp.test(codeLines[i])) { - line = jsEditor.setGutterMarker(i, 'searchGutter', makeLineLabel('Search: ' + searchTerm, 'searchMarker')); - jsEditor.addLineClass(line, 'text', 'searchLine'); - errorLines.push(line); - } - } + function scheduleHintNoChange() { + if (defined(hintTimer)) { + window.clearTimeout(hintTimer); + } + hintTimer = setTimeout(clearErrorsAddHints, 550); + } + + function scrollToLine(lineNumber) { + if (defined(lineNumber)) { + jsEditor.setCursor(lineNumber); + // set selection twice in order to force the editor to scroll + // to this location if the cursor is already there + jsEditor.setSelection( + { + line: lineNumber - 1, + ch: 0, + }, + { + line: lineNumber - 1, + ch: 0, } - // make a copy of the options, JSHint modifies the object it's given - var options = JSON.parse(JSON.stringify(sandcastleJsHintOptions)); - /*eslint-disable new-cap*/ - if (!JSHINT(embedInSandcastleTemplate(jsEditor.getValue(), false), options)) { - var hints = JSHINT.errors; - for (i = 0, len = hints.length; i < len; ++i) { - var hint = hints[i]; - if (hint !== null && defined(hint.reason) && hint.line > 0) { - line = jsEditor.setGutterMarker(scriptLineToEditorLine(hint.line), 'hintGutter', makeLineLabel(hint.reason, 'hintMarker')); - jsEditor.addLineClass(line, 'text', 'hintLine'); - errorLines.push(line); - } - } + ); + jsEditor.focus(); + jsEditor.setSelection( + { + line: lineNumber, + ch: 0, + }, + { + line: lineNumber, + ch: 0, } - /*eslint-enable new-cap*/ + ); } - - function scheduleHint() { - if (defined(hintTimer)) { - window.clearTimeout(hintTimer); - } - hintTimer = setTimeout(clearErrorsAddHints, 550); - highlightRun(); + } + + function highlightLine(lineNum) { + var line; + jsEditor.clearGutter("highlightGutter"); + while (highlightLines.length > 0) { + line = highlightLines.pop(); + jsEditor.removeLineClass(line, "text"); } - - function scheduleHintNoChange() { - if (defined(hintTimer)) { - window.clearTimeout(hintTimer); - } - hintTimer = setTimeout(clearErrorsAddHints, 550); + if (lineNum > 0) { + lineNum = scriptLineToEditorLine(lineNum); + line = jsEditor.setGutterMarker( + lineNum, + "highlightGutter", + makeLineLabel("highlighted by demo", "highlightMarker") + ); + jsEditor.addLineClass(line, "text", "highlightLine"); + highlightLines.push(line); + scrollToLine(lineNum); } + } - function scrollToLine(lineNumber) { - if (defined(lineNumber)) { - jsEditor.setCursor(lineNumber); - // set selection twice in order to force the editor to scroll - // to this location if the cursor is already there - jsEditor.setSelection({ - line : lineNumber - 1, - ch : 0 - }, { - line : lineNumber - 1, - ch : 0 - }); - jsEditor.focus(); - jsEditor.setSelection({ - line : lineNumber, - ch : 0 - }, { - line : lineNumber, - ch : 0 - }); - } - } + var tabs = registry.byId("bottomPanel"); - function highlightLine(lineNum) { - var line; - jsEditor.clearGutter('highlightGutter'); - while (highlightLines.length > 0) { - line = highlightLines.pop(); - jsEditor.removeLineClass(line, 'text'); - } - if (lineNum > 0) { - lineNum = scriptLineToEditorLine(lineNum); - line = jsEditor.setGutterMarker(lineNum, 'highlightGutter', makeLineLabel('highlighted by demo', 'highlightMarker')); - jsEditor.addLineClass(line, 'text', 'highlightLine'); - highlightLines.push(line); - scrollToLine(lineNum); - } - } + function showGallery() { + tabs.selectChild(registry.byId("innerPanel")); + } - var tabs = registry.byId('bottomPanel'); + function hideGallery() { + closeGalleryTooltip(); + tabs.selectChild(registry.byId("logContainer")); + } - function showGallery() { - tabs.selectChild(registry.byId('innerPanel')); + tabs.watch("selectedChildWidget", function (name, oldValue, newValue) { + if (newValue === registry.byId("logContainer")) { + numberOfNewConsoleMessages = 0; + registry.byId("logContainer").set("title", "Console"); } - - function hideGallery() { - closeGalleryTooltip(); - tabs.selectChild(registry.byId('logContainer')); + }); + + function registerScroll(demoContainer) { + if (document.onmousewheel !== undefined) { + demoContainer.addEventListener( + "mousewheel", + function (e) { + if (defined(e.wheelDelta) && e.wheelDelta) { + demoContainer.scrollLeft -= (e.wheelDelta * 70) / 120; + } + }, + false + ); + } else { + demoContainer.addEventListener( + "DOMMouseScroll", + function (e) { + if (defined(e.detail) && e.detail) { + demoContainer.scrollLeft += (e.detail * 70) / 3; + } + }, + false + ); } - - tabs.watch('selectedChildWidget', function(name, oldValue, newValue) { - if (newValue === registry.byId('logContainer')) { - numberOfNewConsoleMessages = 0; - registry.byId('logContainer').set('title', 'Console'); - } + } + + CodeMirror.commands.runCesium = function (cm) { + clearErrorsAddHints(); + clearRun(); + cesiumContainer.selectChild(bucketPane); + // Check for a race condition in some browsers where the iframe hasn't loaded yet. + if (bucketFrame.contentWindow.location.href.indexOf("bucket.html") > 0) { + bucketFrame.contentWindow.location.reload(); + } + }; + + jsEditor = CodeMirror.fromTextArea(document.getElementById("code"), { + mode: "javascript", + gutters: ["hintGutter", "errorGutter", "searchGutter", "highlightGutter"], + lineNumbers: true, + matchBrackets: true, + indentUnit: 4, + extraKeys: { + "Ctrl-Space": "autocomplete", + F8: "runCesium", + Tab: "indentMore", + "Shift-Tab": "indentLess", + }, + }); + + jsEditor.on("cursorActivity", onCursorActivity); + jsEditor.on("change", scheduleHint); + + htmlEditor = CodeMirror.fromTextArea(document.getElementById("htmlBody"), { + mode: "text/html", + lineNumbers: true, + matchBrackets: true, + indentUnit: 4, + extraKeys: { + F8: "runCesium", + Tab: "indentMore", + "Shift-Tab": "indentLess", + }, + }); + + window.onbeforeunload = function (e) { + var htmlText = htmlEditor.getValue().replace(/\s/g, ""); + var jsText = jsEditor.getValue().replace(/\s/g, ""); + if (demoHtml !== htmlText || demoCode !== jsText) { + return "Be sure to save a copy of any important edits before leaving this page."; + } + }; + + registry + .byId("codeContainer") + .watch("selectedChildWidget", function (name, oldPane, newPane) { + if (newPane.id === "jsContainer") { + jsEditor.focus(); + } else if (newPane.id === "htmlContainer") { + htmlEditor.focus(); + } }); - function registerScroll(demoContainer) { - if (document.onmousewheel !== undefined) { - demoContainer.addEventListener('mousewheel', function(e) { - if (defined(e.wheelDelta) && e.wheelDelta) { - demoContainer.scrollLeft -= e.wheelDelta * 70 / 120; - } - }, false); - } else { - demoContainer.addEventListener('DOMMouseScroll', function(e) { - if (defined(e.detail) && e.detail) { - demoContainer.scrollLeft += e.detail * 70 / 3; - } - }, false); - } + var scriptCodeRegex = /\/\/Sandcastle_Begin\s*([\s\S]*)\/\/Sandcastle_End/; + + function activateBucketScripts(bucketDoc) { + var headNodes = bucketDoc.head.childNodes; + var node; + var nodes = []; + var i, len; + for (i = 0, len = headNodes.length; i < len; ++i) { + node = headNodes[i]; + // header is included in blank frame. + if ( + node.tagName === "SCRIPT" && + node.src.indexOf("Sandcastle-header.js") < 0 + ) { + nodes.push(node); + } } - CodeMirror.commands.runCesium = function(cm) { - clearErrorsAddHints(); - clearRun(); - cesiumContainer.selectChild(bucketPane); - // Check for a race condition in some browsers where the iframe hasn't loaded yet. - if (bucketFrame.contentWindow.location.href.indexOf('bucket.html') > 0) { - bucketFrame.contentWindow.location.reload(); - } - }; - - jsEditor = CodeMirror.fromTextArea(document.getElementById('code'), { - mode : 'javascript', - gutters : ['hintGutter', 'errorGutter', 'searchGutter', 'highlightGutter'], - lineNumbers : true, - matchBrackets : true, - indentUnit : 4, - extraKeys : { - 'Ctrl-Space' : 'autocomplete', - 'F8' : 'runCesium', - 'Tab' : 'indentMore', - 'Shift-Tab' : 'indentLess' - } - }); - - jsEditor.on('cursorActivity', onCursorActivity); - jsEditor.on('change', scheduleHint); - - htmlEditor = CodeMirror.fromTextArea(document.getElementById('htmlBody'), { - mode : 'text/html', - lineNumbers : true, - matchBrackets : true, - indentUnit : 4, - extraKeys : { - 'F8' : 'runCesium', - 'Tab' : 'indentMore', - 'Shift-Tab' : 'indentLess' - } - }); + for (i = 0, len = nodes.length; i < len; ++i) { + bucketDoc.head.removeChild(nodes[i]); + } - window.onbeforeunload = function (e) { - var htmlText = (htmlEditor.getValue()).replace(/\s/g, ''); - var jsText = (jsEditor.getValue()).replace(/\s/g, ''); - if (demoHtml !== htmlText || demoCode !== jsText) { - return 'Be sure to save a copy of any important edits before leaving this page.'; - } + // Apply user HTML to bucket. + var htmlElement = bucketDoc.createElement("div"); + htmlElement.innerHTML = htmlEditor.getValue(); + bucketDoc.body.appendChild(htmlElement); + + var onScriptTagError = function () { + if (bucketFrame.contentDocument === bucketDoc) { + appendConsole("consoleError", "Error loading " + this.src, true); + appendConsole( + "consoleError", + "Make sure Cesium is built, see the Contributor's Guide for details.", + true + ); + } }; - registry.byId('codeContainer').watch('selectedChildWidget', function(name, oldPane, newPane) { - if (newPane.id === 'jsContainer') { - jsEditor.focus(); - } else if (newPane.id === 'htmlContainer') { - htmlEditor.focus(); - } - }); - - var scriptCodeRegex = /\/\/Sandcastle_Begin\s*([\s\S]*)\/\/Sandcastle_End/; - - function activateBucketScripts(bucketDoc) { - var headNodes = bucketDoc.head.childNodes; - var node; - var nodes = []; - var i, len; - for (i = 0, len = headNodes.length; i < len; ++i) { - node = headNodes[i]; - // header is included in blank frame. - if (node.tagName === 'SCRIPT' && node.src.indexOf('Sandcastle-header.js') < 0) { - nodes.push(node); + // Load each script after the previous one has loaded. + var loadScript = function () { + if (bucketFrame.contentDocument !== bucketDoc) { + // A newer reload has happened, abort this. + return; + } + if (nodes.length > 0) { + while (nodes.length > 0) { + node = nodes.shift(); + var scriptElement = bucketDoc.createElement("script"); + var hasSrc = false; + for ( + var j = 0, numAttrs = node.attributes.length; + j < numAttrs; + ++j + ) { + var name = node.attributes[j].name; + var val = node.attributes[j].value; + scriptElement.setAttribute(name, val); + if (name === "src" && val) { + hasSrc = true; } + } + scriptElement.innerHTML = node.innerHTML; + if (hasSrc) { + scriptElement.onload = loadScript; + scriptElement.onerror = onScriptTagError; + bucketDoc.head.appendChild(scriptElement); + } else { + bucketDoc.head.appendChild(scriptElement); + loadScript(); + } } + } else { + // Apply user JS to bucket + var element = bucketDoc.createElement("script"); + + // Firefox line numbers are zero-based, not one-based. + var isFirefox = navigator.userAgent.indexOf("Firefox/") >= 0; + + element.textContent = embedInSandcastleTemplate( + jsEditor.getValue(), + isFirefox + ); + bucketDoc.body.appendChild(element); + } + }; - for (i = 0, len = nodes.length; i < len; ++i) { - bucketDoc.head.removeChild(nodes[i]); + loadScript(); + } + + function applyBucket() { + if ( + local.emptyBucket && + local.bucketName && + typeof bucketTypes[local.bucketName] === "string" + ) { + bucketWaiting = false; + var bucketDoc = bucketFrame.contentDocument; + if ( + local.headers.substring(0, local.emptyBucket.length) !== + local.emptyBucket + ) { + appendConsole( + "consoleError", + "Error, first part of " + + local.bucketName + + " must match first part of bucket.html exactly.", + true + ); + } else { + var bodyAttributes = local.headers.match(/]*?)>/)[1]; + var attributeRegex = /([-a-z_]+)\s*="([^"]*?)"/gi; + //group 1 attribute name, group 2 attribute value. Assumes double-quoted attributes. + var attributeMatch; + while ( + (attributeMatch = attributeRegex.exec(bodyAttributes)) !== null + ) { + var attributeName = attributeMatch[1]; + var attributeValue = attributeMatch[2]; + if (attributeName === "class") { + bucketDoc.body.className = attributeValue; + } else { + bucketDoc.body.setAttribute(attributeName, attributeValue); + } } - // Apply user HTML to bucket. - var htmlElement = bucketDoc.createElement('div'); - htmlElement.innerHTML = htmlEditor.getValue(); - bucketDoc.body.appendChild(htmlElement); - - var onScriptTagError = function() { - if (bucketFrame.contentDocument === bucketDoc) { - appendConsole('consoleError', 'Error loading ' + this.src, true); - appendConsole('consoleError', "Make sure Cesium is built, see the Contributor's Guide for details.", true); - } - }; - - // Load each script after the previous one has loaded. - var loadScript = function() { - if (bucketFrame.contentDocument !== bucketDoc) { - // A newer reload has happened, abort this. - return; - } - if (nodes.length > 0) { - while(nodes.length > 0){ - node = nodes.shift(); - var scriptElement = bucketDoc.createElement('script'); - var hasSrc = false; - for (var j = 0, numAttrs = node.attributes.length; j < numAttrs; ++j) { - var name = node.attributes[j].name; - var val = node.attributes[j].value; - scriptElement.setAttribute(name, val); - if (name === 'src' && val) { - hasSrc = true; - } - } - scriptElement.innerHTML = node.innerHTML; - if (hasSrc) { - scriptElement.onload = loadScript; - scriptElement.onerror = onScriptTagError; - bucketDoc.head.appendChild(scriptElement); - } else { - bucketDoc.head.appendChild(scriptElement); - loadScript(); - } - } - } else { - // Apply user JS to bucket - var element = bucketDoc.createElement('script'); - - // Firefox line numbers are zero-based, not one-based. - var isFirefox = navigator.userAgent.indexOf('Firefox/') >= 0; - - element.textContent = embedInSandcastleTemplate(jsEditor.getValue(), isFirefox); - bucketDoc.body.appendChild(element); - } - }; - - loadScript(); - } - - function applyBucket() { - if (local.emptyBucket && local.bucketName && typeof bucketTypes[local.bucketName] === 'string') { - bucketWaiting = false; - var bucketDoc = bucketFrame.contentDocument; - if (local.headers.substring(0, local.emptyBucket.length) !== local.emptyBucket) { - appendConsole('consoleError', 'Error, first part of ' + local.bucketName + ' must match first part of bucket.html exactly.', true); - } else { - var bodyAttributes = local.headers.match(/]*?)>/)[1]; - var attributeRegex = /([-a-z_]+)\s*="([^"]*?)"/ig; - //group 1 attribute name, group 2 attribute value. Assumes double-quoted attributes. - var attributeMatch; - while ((attributeMatch = attributeRegex.exec(bodyAttributes)) !== null) { - var attributeName = attributeMatch[1]; - var attributeValue = attributeMatch[2]; - if (attributeName === 'class') { - bucketDoc.body.className = attributeValue; - } else { - bucketDoc.body.setAttribute(attributeName, attributeValue); - } - } - - var pos = local.headers.indexOf(''); - var extraHeaders = local.headers.substring(local.emptyBucket.length, pos); - bucketDoc.head.innerHTML += extraHeaders; - activateBucketScripts(bucketDoc); - } - } else { - bucketWaiting = true; - } + var pos = local.headers.indexOf(""); + var extraHeaders = local.headers.substring( + local.emptyBucket.length, + pos + ); + bucketDoc.head.innerHTML += extraHeaders; + activateBucketScripts(bucketDoc); + } + } else { + bucketWaiting = true; } + } - function applyBucketIfWaiting() { - if (bucketWaiting) { - applyBucket(); - } + function applyBucketIfWaiting() { + if (bucketWaiting) { + applyBucket(); } - - xhr.get({ - url : 'templates/bucket.html', - handleAs : 'text' - }).then(function(value) { - var pos = value.indexOf(''); - local.emptyBucket = value.substring(0, pos); - applyBucketIfWaiting(); + } + + xhr + .get({ + url: "templates/bucket.html", + handleAs: "text", + }) + .then(function (value) { + var pos = value.indexOf(""); + local.emptyBucket = value.substring(0, pos); + applyBucketIfWaiting(); }); - function loadBucket(bucketName) { - if (local.bucketName !== bucketName) { - local.bucketName = bucketName; - if (defined(bucketTypes[bucketName])) { - local.headers = bucketTypes[bucketName]; - } else { - local.headers = ''; - xhr.get({ - url : 'templates/' + bucketName, - handleAs : 'text' - }).then(function(value) { - var pos = value.indexOf('', pos); - bucketTypes[bucketName] = value.substring(0, pos + 1); - if (local.bucketName === bucketName) { - local.headers = bucketTypes[bucketName]; - } - applyBucketIfWaiting(); - }); + function loadBucket(bucketName) { + if (local.bucketName !== bucketName) { + local.bucketName = bucketName; + if (defined(bucketTypes[bucketName])) { + local.headers = bucketTypes[bucketName]; + } else { + local.headers = + ''; + xhr + .get({ + url: "templates/" + bucketName, + handleAs: "text", + }) + .then(function (value) { + var pos = value.indexOf("", pos); + bucketTypes[bucketName] = value.substring(0, pos + 1); + if (local.bucketName === bucketName) { + local.headers = bucketTypes[bucketName]; } - } - } - - var queryObject = {}; - if (window.location.search) { - queryObject = ioQuery.queryToObject(window.location.search.substring(1)); - } - if (!defined(queryObject.src)) { - queryObject.src = defaultDemo + '.html'; + applyBucketIfWaiting(); + }); + } } - if (!defined(queryObject.label)) { - queryObject.label = defaultLabel; - } - - function loadFromGallery(demo) { - deferredLoadError = false; - document.getElementById('saveAsFile').download = demo.name + '.html'; - registry.byId('description').set('value', decodeHTML(demo.description).replace(/\\n/g, '\n')); - registry.byId('label').set('value', decodeHTML(demo.label).replace(/\\n/g, '\n')); - - return requestDemo(demo.name).then(function(value) { - demo.code = value; - - if (typeof demo.bucket === 'string') { - loadBucket(demo.bucket); - } - - function applyLoadedDemo(code, html) { - jsEditor.setValue(code); - jsEditor.clearHistory(); - htmlEditor.setValue(html); - htmlEditor.clearHistory(); - demoCode = code.replace(/\s/g, ''); - demoHtml = html.replace(/\s/g, ''); - CodeMirror.commands.runCesium(jsEditor); - clearRun(); - } - - var json, code, html; - if (defined(queryObject.gist)) { - dojoscript.get('https://api.github.com/gists/' + queryObject.gist, { - jsonp: 'callback' - }).then(function(data) { - var files = data.data.files; - var code = files['Cesium-Sandcastle.js'].content; - var htmlFile = files['Cesium-Sandcastle.html']; - var html = defined(htmlFile) ? htmlFile.content : defaultHtml; // Use the default html for old gists - applyLoadedDemo(code, html); - }).otherwise(function(error) { - appendConsole('consoleError', 'Unable to GET gist from GitHub API. This could be due to too many requests from your IP. Try again in an hour or copy and paste the code from the gist: https://gist.github.com/' + queryObject.gist, true); - console.log(error); - }); - } else if (defined(queryObject.code)) { - //The code query parameter is a Base64 encoded JSON string with `code` and `html` properties. - json = JSON.parse(window.atob(queryObject.code)); - code = json.code; - html = json.html; - - applyLoadedDemo(code, html); - } else if (window.location.hash.indexOf('#c=') === 0) { - var base64String = window.location.hash.substr(3); - var data = decodeBase64Data(base64String, pako); - code = data.code; - html = data.html; - - applyLoadedDemo(code, html); - } else { - var parser = new DOMParser(); - var doc = parser.parseFromString(demo.code, 'text/html'); - - return waitForDoc(doc, function(){ - return doc.querySelector('script[id="cesium_sandcastle_script"]'); - }).then(function(){ - - var script = doc.querySelector('script[id="cesium_sandcastle_script"]'); - if (!script) { - appendConsole('consoleError', 'Error reading source file: ' + demo.name, true); - return; - } - - var scriptMatch = scriptCodeRegex.exec(script.textContent); - if (!scriptMatch) { - appendConsole('consoleError', 'Error reading source file: ' + demo.name, true); - return; - } - - var scriptCode = scriptMatch[1]; - scriptCode = scriptCode.replace(/^ {8}/gm, ""); //Account for Prettier spacing - - var htmlText = ''; - var childIndex = 0; - var childNode = doc.body.childNodes[childIndex]; - while (childIndex < doc.body.childNodes.length && childNode !== script) { - htmlText += childNode.nodeType === 1 ? childNode.outerHTML : childNode.nodeValue; - childNode = doc.body.childNodes[++childIndex]; - } - htmlText = htmlText.replace(/^\s+/, ''); - - applyLoadedDemo(scriptCode, htmlText); - }); - } + } + + var queryObject = {}; + if (window.location.search) { + queryObject = ioQuery.queryToObject(window.location.search.substring(1)); + } + if (!defined(queryObject.src)) { + queryObject.src = defaultDemo + ".html"; + } + if (!defined(queryObject.label)) { + queryObject.label = defaultLabel; + } + + function loadFromGallery(demo) { + deferredLoadError = false; + document.getElementById("saveAsFile").download = demo.name + ".html"; + registry + .byId("description") + .set("value", decodeHTML(demo.description).replace(/\\n/g, "\n")); + registry + .byId("label") + .set("value", decodeHTML(demo.label).replace(/\\n/g, "\n")); + + return requestDemo(demo.name).then(function (value) { + demo.code = value; + + if (typeof demo.bucket === "string") { + loadBucket(demo.bucket); + } + + function applyLoadedDemo(code, html) { + jsEditor.setValue(code); + jsEditor.clearHistory(); + htmlEditor.setValue(html); + htmlEditor.clearHistory(); + demoCode = code.replace(/\s/g, ""); + demoHtml = html.replace(/\s/g, ""); + CodeMirror.commands.runCesium(jsEditor); + clearRun(); + } + + var json, code, html; + if (defined(queryObject.gist)) { + dojoscript + .get("https://api.github.com/gists/" + queryObject.gist, { + jsonp: "callback", + }) + .then(function (data) { + var files = data.data.files; + var code = files["Cesium-Sandcastle.js"].content; + var htmlFile = files["Cesium-Sandcastle.html"]; + var html = defined(htmlFile) ? htmlFile.content : defaultHtml; // Use the default html for old gists + applyLoadedDemo(code, html); + }) + .otherwise(function (error) { + appendConsole( + "consoleError", + "Unable to GET gist from GitHub API. This could be due to too many requests from your IP. Try again in an hour or copy and paste the code from the gist: https://gist.github.com/" + + queryObject.gist, + true + ); + console.log(error); + }); + } else if (defined(queryObject.code)) { + //The code query parameter is a Base64 encoded JSON string with `code` and `html` properties. + json = JSON.parse(window.atob(queryObject.code)); + code = json.code; + html = json.html; + + applyLoadedDemo(code, html); + } else if (window.location.hash.indexOf("#c=") === 0) { + var base64String = window.location.hash.substr(3); + var data = decodeBase64Data(base64String, pako); + code = data.code; + html = data.html; + + applyLoadedDemo(code, html); + } else { + var parser = new DOMParser(); + var doc = parser.parseFromString(demo.code, "text/html"); + + return waitForDoc(doc, function () { + return doc.querySelector('script[id="cesium_sandcastle_script"]'); + }).then(function () { + var script = doc.querySelector( + 'script[id="cesium_sandcastle_script"]' + ); + if (!script) { + appendConsole( + "consoleError", + "Error reading source file: " + demo.name, + true + ); + return; + } + + var scriptMatch = scriptCodeRegex.exec(script.textContent); + if (!scriptMatch) { + appendConsole( + "consoleError", + "Error reading source file: " + demo.name, + true + ); + return; + } + + var scriptCode = scriptMatch[1]; + scriptCode = scriptCode.replace(/^ {8}/gm, ""); //Account for Prettier spacing + + var htmlText = ""; + var childIndex = 0; + var childNode = doc.body.childNodes[childIndex]; + while ( + childIndex < doc.body.childNodes.length && + childNode !== script + ) { + htmlText += + childNode.nodeType === 1 + ? childNode.outerHTML + : childNode.nodeValue; + childNode = doc.body.childNodes[++childIndex]; + } + htmlText = htmlText.replace(/^\s+/, ""); + + applyLoadedDemo(scriptCode, htmlText); }); - } - - window.addEventListener('popstate', function(e) { - if (e.state && e.state.name && e.state.code) { - loadFromGallery(e.state); - document.title = e.state.name + ' - Cesium Sandcastle'; + } + }); + } + + window.addEventListener( + "popstate", + function (e) { + if (e.state && e.state.name && e.state.code) { + loadFromGallery(e.state); + document.title = e.state.name + " - Cesium Sandcastle"; + } + }, + false + ); + + window.addEventListener( + "message", + function (e) { + var line; + // The iframe (bucket.html) sends this message on load. + // This triggers the code to be injected into the iframe. + if (e.data === "reload") { + var bucketDoc = bucketFrame.contentDocument; + if (!local.bucketName) { + // Reload fired, bucket not specified yet. + return; } - }, false); - - window.addEventListener('message', function(e) { - var line; - // The iframe (bucket.html) sends this message on load. - // This triggers the code to be injected into the iframe. - if (e.data === 'reload') { - var bucketDoc = bucketFrame.contentDocument; - if (!local.bucketName) { - // Reload fired, bucket not specified yet. - return; - } - if (bucketDoc.body.getAttribute('data-sandcastle-loaded') !== 'yes') { - bucketDoc.body.setAttribute('data-sandcastle-loaded', 'yes'); - logOutput.innerHTML = ''; - numberOfNewConsoleMessages = 0; - registry.byId('logContainer').set('title', 'Console'); - // This happens after a Run (F8) reloads bucket.html, to inject the editor code - // into the iframe, causing the demo to run there. - applyBucket(); - if (docError) { - appendConsole('consoleError', 'Documentation not available. Please run the "generateDocumentation" build script to generate Cesium documentation.', true); - showGallery(); - } - if (galleryError) { - appendConsole('consoleError', 'Error loading gallery, please run the build script.', true); - } - if (deferredLoadError) { - appendConsole('consoleLog', 'Unable to load demo named ' + queryObject.src.replace('.html', '') + '. Redirecting to HelloWorld.\n', true); - } - } - } else if (defined(e.data.log)) { - // Console log messages from the iframe display in Sandcastle. - appendConsole('consoleLog', e.data.log, false); - } else if (defined(e.data.error)) { - // Console error messages from the iframe display in Sandcastle - var errorMsg = e.data.error; - var lineNumber = e.data.lineNumber; - if (defined(lineNumber)) { - errorMsg += ' (on line '; - - if (e.data.url) { - errorMsg += lineNumber + ' of ' + e.data.url + ')'; - } else { - lineNumber = scriptLineToEditorLine(lineNumber); - errorMsg += (lineNumber + 1) + ')'; - line = jsEditor.setGutterMarker(lineNumber, 'errorGutter', makeLineLabel(e.data.error, 'errorMarker')); - jsEditor.addLineClass(line, 'text', 'errorLine'); - errorLines.push(line); - scrollToLine(lineNumber); - } - } - appendConsole('consoleError', errorMsg, true); - } else if (defined(e.data.warn)) { - // Console warning messages from the iframe display in Sandcastle. - appendConsole('consoleWarn', e.data.warn, true); - } else if (defined(e.data.highlight)) { - // Hovering objects in the embedded Cesium window. - highlightLine(e.data.highlight); + if (bucketDoc.body.getAttribute("data-sandcastle-loaded") !== "yes") { + bucketDoc.body.setAttribute("data-sandcastle-loaded", "yes"); + logOutput.innerHTML = ""; + numberOfNewConsoleMessages = 0; + registry.byId("logContainer").set("title", "Console"); + // This happens after a Run (F8) reloads bucket.html, to inject the editor code + // into the iframe, causing the demo to run there. + applyBucket(); + if (docError) { + appendConsole( + "consoleError", + 'Documentation not available. Please run the "generateDocumentation" build script to generate Cesium documentation.', + true + ); + showGallery(); + } + if (galleryError) { + appendConsole( + "consoleError", + "Error loading gallery, please run the build script.", + true + ); + } + if (deferredLoadError) { + appendConsole( + "consoleLog", + "Unable to load demo named " + + queryObject.src.replace(".html", "") + + ". Redirecting to HelloWorld.\n", + true + ); + } } - }, true); - - registry.byId('jsContainer').on('show', function() { - suggestButton.set('disabled', false); - jsEditor.refresh(); - }); - - registry.byId('htmlContainer').on('show', function() { - suggestButton.set('disabled', true); - htmlEditor.refresh(); - }); - - registry.byId('search').on('change', function() { - searchTerm = this.get('value'); - searchRegExp = new RegExp(searchTerm, 'i'); - var numDemosShown = 0; - if (searchTerm !== '') { - showSearchContainer(); - var innerPanel = registry.byId('innerPanel'); - innerPanel.selectChild(registry.byId('searchContainer')); - for (var i = 0; i < gallery_demos.length; i++) { - var demo = gallery_demos[i]; - var demoName = demo.name; - if (searchRegExp.test(demoName) || searchRegExp.test(demo.code)) { - document.getElementById(demoName + 'searchDemo').style.display = 'inline-block'; - ++numDemosShown; - } else { - document.getElementById(demoName + 'searchDemo').style.display = 'none'; - } - } - } else { - hideSearchContainer(); + } else if (defined(e.data.log)) { + // Console log messages from the iframe display in Sandcastle. + appendConsole("consoleLog", e.data.log, false); + } else if (defined(e.data.error)) { + // Console error messages from the iframe display in Sandcastle + var errorMsg = e.data.error; + var lineNumber = e.data.lineNumber; + if (defined(lineNumber)) { + errorMsg += " (on line "; + + if (e.data.url) { + errorMsg += lineNumber + " of " + e.data.url + ")"; + } else { + lineNumber = scriptLineToEditorLine(lineNumber); + errorMsg += lineNumber + 1 + ")"; + line = jsEditor.setGutterMarker( + lineNumber, + "errorGutter", + makeLineLabel(e.data.error, "errorMarker") + ); + jsEditor.addLineClass(line, "text", "errorLine"); + errorLines.push(line); + scrollToLine(lineNumber); + } } - - if (numDemosShown) { - galleryErrorMsg.style.display = 'none'; + appendConsole("consoleError", errorMsg, true); + } else if (defined(e.data.warn)) { + // Console warning messages from the iframe display in Sandcastle. + appendConsole("consoleWarn", e.data.warn, true); + } else if (defined(e.data.highlight)) { + // Hovering objects in the embedded Cesium window. + highlightLine(e.data.highlight); + } + }, + true + ); + + registry.byId("jsContainer").on("show", function () { + suggestButton.set("disabled", false); + jsEditor.refresh(); + }); + + registry.byId("htmlContainer").on("show", function () { + suggestButton.set("disabled", true); + htmlEditor.refresh(); + }); + + registry.byId("search").on("change", function () { + searchTerm = this.get("value"); + searchRegExp = new RegExp(searchTerm, "i"); + var numDemosShown = 0; + if (searchTerm !== "") { + showSearchContainer(); + var innerPanel = registry.byId("innerPanel"); + innerPanel.selectChild(registry.byId("searchContainer")); + for (var i = 0; i < gallery_demos.length; i++) { + var demo = gallery_demos[i]; + var demoName = demo.name; + if (searchRegExp.test(demoName) || searchRegExp.test(demo.code)) { + document.getElementById(demoName + "searchDemo").style.display = + "inline-block"; + ++numDemosShown; } else { - galleryErrorMsg.style.display = 'inline-block'; - } - - showGallery(); - scheduleHintNoChange(); - }); - - var searchContainer; - - function hideSearchContainer() { - if (dom.byId('searchContainer')) { - var innerPanel = registry.byId('innerPanel'); - innerPanel.removeChild(searchContainer); + document.getElementById(demoName + "searchDemo").style.display = + "none"; } + } + } else { + hideSearchContainer(); } - function showSearchContainer() { - if (!dom.byId('searchContainer')) { - var innerPanel = registry.byId('innerPanel'); - innerPanel.addChild(searchContainer); - } + if (numDemosShown) { + galleryErrorMsg.style.display = "none"; + } else { + galleryErrorMsg.style.display = "inline-block"; } - function getBaseUrl() { - // omits query string and hash - return location.protocol + '//' + location.host + location.pathname; - } + showGallery(); + scheduleHintNoChange(); + }); - function makeCompressedBase64String(data) { - // data stored in the hash as: - // Base64 encoded, raw DEFLATE compressed JSON array where index 0 is code, index 1 is html - var jsonString = JSON.stringify(data); - // we save a few bytes by omitting the leading [" and trailing "] since they are always the same - jsonString = jsonString.substr(2, jsonString.length - 4); - var base64String = btoa(pako.deflate(jsonString, { raw: true, to: 'string', level: 9 })); - base64String = base64String.replace(/\=+$/, ''); // remove padding + var searchContainer; - return base64String; + function hideSearchContainer() { + if (dom.byId("searchContainer")) { + var innerPanel = registry.byId("innerPanel"); + innerPanel.removeChild(searchContainer); } + } - registry.byId('buttonShareDrop').on('click', function() { - var code = jsEditor.getValue(); - var html = htmlEditor.getValue(); - - var base64String = makeCompressedBase64String([code, html]); - - var shareUrlBox = document.getElementById('shareUrl'); - shareUrlBox.value = getBaseUrl() + '#c=' + base64String; - shareUrlBox.select(); - }); - - registry.byId('buttonImport').on('click', function() { - var gistId = document.getElementById('gistId').value; - var gistParameter = '&gist='; - var gistIndex = gistId.indexOf(gistParameter); - if (gistIndex !== -1) { - gistId = gistId.substring(gistIndex + gistParameter.length); - } - window.location.href = getBaseUrl() + '?gist=' + gistId; - }); - - function getPushStateUrl(demo) { - var obj = {}; - if (demo.name !== defaultDemo) { - obj.src = demo.name + '.html'; - } - if (currentTab !== defaultLabel) { - obj.label = currentTab; - } - var query = ioQuery.objectToQuery(obj); - return query === '' ? query : '?' + query; + function showSearchContainer() { + if (!dom.byId("searchContainer")) { + var innerPanel = registry.byId("innerPanel"); + innerPanel.addChild(searchContainer); } + } + + function getBaseUrl() { + // omits query string and hash + return location.protocol + "//" + location.host + location.pathname; + } + + function makeCompressedBase64String(data) { + // data stored in the hash as: + // Base64 encoded, raw DEFLATE compressed JSON array where index 0 is code, index 1 is html + var jsonString = JSON.stringify(data); + // we save a few bytes by omitting the leading [" and trailing "] since they are always the same + jsonString = jsonString.substr(2, jsonString.length - 4); + var base64String = btoa( + pako.deflate(jsonString, { raw: true, to: "string", level: 9 }) + ); + base64String = base64String.replace(/\=+$/, ""); // remove padding + + return base64String; + } + + registry.byId("buttonShareDrop").on("click", function () { + var code = jsEditor.getValue(); + var html = htmlEditor.getValue(); + + var base64String = makeCompressedBase64String([code, html]); + + var shareUrlBox = document.getElementById("shareUrl"); + shareUrlBox.value = getBaseUrl() + "#c=" + base64String; + shareUrlBox.select(); + }); + + registry.byId("buttonImport").on("click", function () { + var gistId = document.getElementById("gistId").value; + var gistParameter = "&gist="; + var gistIndex = gistId.indexOf(gistParameter); + if (gistIndex !== -1) { + gistId = gistId.substring(gistIndex + gistParameter.length); + } + window.location.href = getBaseUrl() + "?gist=" + gistId; + }); - registry.byId('buttonNew').on('click', function() { - var htmlText = (htmlEditor.getValue()).replace(/\s/g, ''); - var jsText = (jsEditor.getValue()).replace(/\s/g, ''); - var confirmChange = true; - if (demoHtml !== htmlText || demoCode !== jsText) { - confirmChange = window.confirm('You have unsaved changes. Are you sure you want to navigate away from this demo?'); - } - if (confirmChange) { - window.history.pushState(newDemo, newDemo.name, getPushStateUrl(newDemo)); - loadFromGallery(newDemo).then(function() { - document.title = newDemo.name + ' - Cesium Sandcastle'; - }); - } - }); - // Clicking the 'Run' button simply reloads the iframe. - registry.byId('buttonRun').on('click', function() { - CodeMirror.commands.runCesium(jsEditor); - }); - - registry.byId('buttonSuggest').on('click', function() { - CodeMirror.commands.autocomplete(jsEditor); + function getPushStateUrl(demo) { + var obj = {}; + if (demo.name !== defaultDemo) { + obj.src = demo.name + ".html"; + } + if (currentTab !== defaultLabel) { + obj.label = currentTab; + } + var query = ioQuery.objectToQuery(obj); + return query === "" ? query : "?" + query; + } + + registry.byId("buttonNew").on("click", function () { + var htmlText = htmlEditor.getValue().replace(/\s/g, ""); + var jsText = jsEditor.getValue().replace(/\s/g, ""); + var confirmChange = true; + if (demoHtml !== htmlText || demoCode !== jsText) { + confirmChange = window.confirm( + "You have unsaved changes. Are you sure you want to navigate away from this demo?" + ); + } + if (confirmChange) { + window.history.pushState(newDemo, newDemo.name, getPushStateUrl(newDemo)); + loadFromGallery(newDemo).then(function () { + document.title = newDemo.name + " - Cesium Sandcastle"; + }); + } + }); + // Clicking the 'Run' button simply reloads the iframe. + registry.byId("buttonRun").on("click", function () { + CodeMirror.commands.runCesium(jsEditor); + }); + + registry.byId("buttonSuggest").on("click", function () { + CodeMirror.commands.autocomplete(jsEditor); + }); + + function getDemoHtml() { + return ( + local.headers + + "\n" + + htmlEditor.getValue() + + '\n" + + "\n" + + "\n" + ); + } + + registry.byId("dropDownSaveAs").on("show", function () { + var currentDemoName = queryObject.src; + currentDemoName = currentDemoName.replace(".html", ""); + var description = encodeHTML( + registry.byId("description").get("value").replace(/\n/g, "\\n") + ).replace(/\"/g, """); + var label = encodeHTML( + registry.byId("label").get("value").replace(/\n/g, "\\n") + ).replace(/\"/g, """); + + var html = getDemoHtml(); + html = html.replace( + "", + '<meta name="description" content="' + description + '">\n <title>' + ); + html = html.replace( + "<title>", + '<meta name="cesium-sandcastle-labels" content="' + + label + + '">\n <title>' + ); + + var octetBlob = new Blob([html], { + type: "application/octet-stream", + endings: "native", }); - - function getDemoHtml() { - return local.headers + '\n' + - htmlEditor.getValue() + - '<script id="cesium_sandcastle_script">\n' + - embedInSandcastleTemplate(jsEditor.getValue(), false) + - '</script>\n' + - '</body>\n' + - '</html>\n'; + var octetBlobURL = URL.createObjectURL(octetBlob); + dom.byId("saveAsFile").href = octetBlobURL; + }); + + registry.byId("buttonNewWindow").on("click", function () { + //Handle case where demo is in a sub-directory by modifying + //the demo's HTML to add a base href. + var baseHref = getBaseUrl(); + var pos = baseHref.lastIndexOf("/"); + baseHref = baseHref.substring(0, pos) + "/gallery/"; + + var code = jsEditor.getValue(); + var html = htmlEditor.getValue(); + var data = makeCompressedBase64String([code, html, baseHref]); + + var url = getBaseUrl(); + url = url.replace("index.html", "") + "standalone.html" + "#c=" + data; + + window.open(url, "_blank"); + window.focus(); + }); + + registry.byId("buttonThumbnail").on("change", function (newValue) { + if (newValue) { + domClass.add("bucketFrame", "makeThumbnail"); + } else { + domClass.remove("bucketFrame", "makeThumbnail"); } - - registry.byId('dropDownSaveAs').on('show', function() { - var currentDemoName = queryObject.src; - currentDemoName = currentDemoName.replace('.html', ''); - var description = encodeHTML(registry.byId('description').get('value').replace(/\n/g, '\\n')).replace(/\"/g, '"'); - var label = encodeHTML(registry.byId('label').get('value').replace(/\n/g, '\\n')).replace(/\"/g, '"'); - - var html = getDemoHtml(); - html = html.replace('<title>', '<meta name="description" content="' + description + '">\n <title>'); - html = html.replace('<title>', '<meta name="cesium-sandcastle-labels" content="' + label + '">\n <title>'); - - var octetBlob = new Blob([html], { - 'type' : 'application/octet-stream', - 'endings' : 'native' + }); + + var demoContainers = query(".demosContainer"); + demoContainers.forEach(function (demoContainer) { + registerScroll(demoContainer); + }); + + var galleryContainer = registry.byId("innerPanel"); + galleryContainer.demoTileHeightRule = demoTileHeightRule; + galleryContainer.originalResize = galleryContainer.resize; + galleryContainer.resize = function (changeSize, resultSize) { + var newSize = changeSize.h - 88; + if (newSize < 20) { + demoTileHeightRule.style.display = "none"; + } else { + demoTileHeightRule.style.display = "inline"; + demoTileHeightRule.style.height = Math.min(newSize, 150) + "px"; + } + this.originalResize(changeSize, resultSize); + }; + + function requestDemo(name) { + return xhr.get({ + url: "gallery/" + name + ".html", + handleAs: "text", + error: function (error) { + loadFromGallery(gallery_demos[hello_world_index]).then(function () { + deferredLoadError = true; }); - var octetBlobURL = URL.createObjectURL(octetBlob); - dom.byId('saveAsFile').href = octetBlobURL; - }); - - registry.byId('buttonNewWindow').on('click', function() { - //Handle case where demo is in a sub-directory by modifying - //the demo's HTML to add a base href. - var baseHref = getBaseUrl(); - var pos = baseHref.lastIndexOf('/'); - baseHref = baseHref.substring(0, pos) + '/gallery/'; - - var code = jsEditor.getValue(); - var html = htmlEditor.getValue(); - var data = makeCompressedBase64String([code, html, baseHref]); - - var url = getBaseUrl(); - url = url.replace('index.html','') + 'standalone.html' + '#c=' + data; - - window.open(url, '_blank'); - window.focus(); - }); - - registry.byId('buttonThumbnail').on('change', function(newValue) { - if (newValue) { - domClass.add('bucketFrame', 'makeThumbnail'); - } else { - domClass.remove('bucketFrame', 'makeThumbnail'); - } + }, }); + } - var demoContainers = query('.demosContainer'); - demoContainers.forEach(function(demoContainer) { - registerScroll(demoContainer); - }); - - var galleryContainer = registry.byId('innerPanel'); - galleryContainer.demoTileHeightRule = demoTileHeightRule; - galleryContainer.originalResize = galleryContainer.resize; - galleryContainer.resize = function(changeSize, resultSize) { - var newSize = changeSize.h - 88; - if (newSize < 20) { - demoTileHeightRule.style.display = 'none'; - } else { - demoTileHeightRule.style.display = 'inline'; - demoTileHeightRule.style.height = Math.min(newSize, 150) + 'px'; + // Work around Chrome 79 bug: https://github.com/CesiumGS/cesium/issues/8460 + function waitForDoc(doc, test) { + var deferred = new Deferred(); + if (test()) { + deferred.resolve(doc); + } else { + var counter = 1; + setTimeout(function () { + if (test() || counter++ > 10) { + deferred.resolve(doc); } - this.originalResize(changeSize, resultSize); - }; - - function requestDemo(name) { - return xhr.get({ - url: 'gallery/' + name + '.html', - handleAs: 'text', - error: function(error) { - loadFromGallery(gallery_demos[hello_world_index]).then(function() { - deferredLoadError = true; - }); - } - }); + }, 100 * counter); } - - // Work around Chrome 79 bug: https://github.com/CesiumGS/cesium/issues/8460 - function waitForDoc(doc, test) { - var deferred = new Deferred(); - if (test()) { - deferred.resolve(doc); + return deferred.promise; + } + + var newInLabel = "New in " + VERSION; + function loadDemoFromFile(demo) { + return requestDemo(demo.name) + .then(function (value) { + // Store the file contents for later searching. + demo.code = value; + + var parser = new DOMParser(); + var doc = parser.parseFromString(value, "text/html"); + return waitForDoc(doc, function () { + return doc.body.getAttribute("data-sandcastle-bucket"); + }); + }) + .then(function (doc) { + var bucket = doc.body.getAttribute("data-sandcastle-bucket"); + demo.bucket = bucket ? bucket : "bucket-requirejs.html"; + + var descriptionMeta = doc.querySelector('meta[name="description"]'); + var description = + descriptionMeta && descriptionMeta.getAttribute("content"); + demo.description = description ? description : ""; + + var labelsMeta = doc.querySelector( + 'meta[name="cesium-sandcastle-labels"]' + ); + var labels = labelsMeta && labelsMeta.getAttribute("content"); + if (demo.isNew) { + demo.label = labels ? labels + "," + newInLabel : newInLabel; } else { - var counter = 1; - setTimeout(function() { - if (test() || counter++ > 10) { - deferred.resolve(doc); - } - }, 100 * counter); + demo.label = labels ? labels : ""; } - return deferred.promise; - } - - var newInLabel = 'New in ' + VERSION; - function loadDemoFromFile(demo) { - return requestDemo(demo.name).then(function(value) { - // Store the file contents for later searching. - demo.code = value; - var parser = new DOMParser(); - var doc = parser.parseFromString(value, 'text/html'); - return waitForDoc(doc, function(){ - return doc.body.getAttribute('data-sandcastle-bucket'); - }); - }).then(function(doc) { - - var bucket = doc.body.getAttribute('data-sandcastle-bucket'); - demo.bucket = bucket ? bucket : 'bucket-requirejs.html'; - - var descriptionMeta = doc.querySelector('meta[name="description"]'); - var description = descriptionMeta && descriptionMeta.getAttribute('content'); - demo.description = description ? description : ''; - - var labelsMeta = doc.querySelector('meta[name="cesium-sandcastle-labels"]'); - var labels = labelsMeta && labelsMeta.getAttribute('content'); - if (demo.isNew) { - demo.label = labels ? labels + ',' + newInLabel : newInLabel; - } else { - demo.label = labels ? labels : ''; - } - - // Select the demo to load upon opening based on the query parameter. - if (defined(queryObject.src)) { - if (demo.name === queryObject.src.replace('.html', '')) { - loadFromGallery(demo).then(function() { - window.history.replaceState(demo, demo.name, getPushStateUrl(demo)); - if (defined(queryObject.gist)) { - document.title = 'Gist Import - Cesium Sandcastle'; - } else { - document.title = demo.name + ' - Cesium Sandcastle'; - } - }); - } - } - - // Create a tooltip containing the demo's description. - demoTooltips[demo.name] = new TooltipDialog({ - id : demo.name + 'TooltipDialog', - style : 'width: 200px; font-size: 12px;', - content : demo.description.replace(/\\n/g, '<br/>') + // Select the demo to load upon opening based on the query parameter. + if (defined(queryObject.src)) { + if (demo.name === queryObject.src.replace(".html", "")) { + loadFromGallery(demo).then(function () { + window.history.replaceState( + demo, + demo.name, + getPushStateUrl(demo) + ); + if (defined(queryObject.gist)) { + document.title = "Gist Import - Cesium Sandcastle"; + } else { + document.title = demo.name + " - Cesium Sandcastle"; + } }); + } + } - addFileToTab(demo); - return demo; + // Create a tooltip containing the demo's description. + demoTooltips[demo.name] = new TooltipDialog({ + id: demo.name + "TooltipDialog", + style: "width: 200px; font-size: 12px;", + content: demo.description.replace(/\\n/g, "<br/>"), }); - } - var loading = true; - function setSubtab(tabName) { - currentTab = defined(tabName) && !loading ? tabName : queryObject.label; - queryObject.label = tabName; - loading = false; + addFileToTab(demo); + return demo; + }); + } + + var loading = true; + function setSubtab(tabName) { + currentTab = defined(tabName) && !loading ? tabName : queryObject.label; + queryObject.label = tabName; + loading = false; + } + + function insertSortedById(parentTab, galleryButton) { + var child; + for ( + child = parentTab.lastChild; + child !== null; + child = child.previousSibling + ) { + if (galleryButton.id >= child.id) { + parentTab.insertBefore(galleryButton, child.nextSibling); + return; + } } - - function insertSortedById(parentTab, galleryButton) { - var child; - for (child = parentTab.lastChild; child !== null; child = child.previousSibling) { - if (galleryButton.id >= child.id) { - parentTab.insertBefore(galleryButton, child.nextSibling); - return; - } + parentTab.appendChild(galleryButton); + } + + function addFileToGallery(demo) { + var searchDemos = dom.byId("searchDemos"); + insertSortedById(searchDemos, createGalleryButton(demo, "searchDemo")); + return loadDemoFromFile(demo); + } + + function onShowCallback() { + return function () { + setSubtab(this.title); + }; + } + + function addFileToTab(demo) { + if (demo.label !== "") { + var labels = demo.label.split(","); + for (var j = 0; j < labels.length; j++) { + var label = labels[j]; + label = label.trim(); + if (!dom.byId(label + "Demos")) { + var cp = new ContentPane({ + content: + '<div id="' + + label + + 'Container" class="demosContainer"><div class="demos" id="' + + label + + 'Demos"></div></div>', + title: label, + onShow: onShowCallback(), + }).placeAt("innerPanel"); + subtabs[label] = cp; + registerScroll(dom.byId(label + "Container")); } - parentTab.appendChild(galleryButton); + var tabName = label + "Demos"; + var tab = dom.byId(tabName); + insertSortedById(tab, createGalleryButton(demo, tabName)); + } } + } - function addFileToGallery(demo) { - var searchDemos = dom.byId('searchDemos'); - insertSortedById(searchDemos, createGalleryButton(demo, 'searchDemo')); - return loadDemoFromFile(demo); + function createGalleryButton(demo, tabName) { + var imgSrc = "templates/Gallery_tile.jpg"; + if (defined(demo.img)) { + imgSrc = "gallery/" + demo.img; } - function onShowCallback() { - return function() { - setSubtab(this.title); - }; - } + var demoLink = document.createElement("a"); + demoLink.id = demo.name + tabName; + demoLink.className = "linkButton"; + demoLink.href = "gallery/" + encodeURIComponent(demo.name) + ".html"; - function addFileToTab(demo) { - if (demo.label !== '') { - var labels = demo.label.split(','); - for (var j = 0; j < labels.length; j++) { - var label = labels[j]; - label = label.trim(); - if (!dom.byId(label + 'Demos')) { - var cp = new ContentPane({ - content : '<div id="' + label + 'Container" class="demosContainer"><div class="demos" id="' + label + 'Demos"></div></div>', - title : label, - onShow : onShowCallback() - }).placeAt('innerPanel'); - subtabs[label] = cp; - registerScroll(dom.byId(label + 'Container')); - } - var tabName = label + 'Demos'; - var tab = dom.byId(tabName); - insertSortedById(tab, createGalleryButton(demo, tabName)); - } - } + if (demo.name === "Hello World") { + newDemo = demo; } - - function createGalleryButton(demo, tabName) { - var imgSrc = 'templates/Gallery_tile.jpg'; - if (defined(demo.img)) { - imgSrc = 'gallery/' + demo.img; + demoLink.onclick = function (e) { + if (mouse.isMiddle(e)) { + window.open("gallery/" + demo.name + ".html"); + } else { + var htmlText = htmlEditor.getValue().replace(/\s/g, ""); + var jsText = jsEditor.getValue().replace(/\s/g, ""); + var confirmChange = true; + if (demoHtml !== htmlText || demoCode !== jsText) { + confirmChange = window.confirm( + "You have unsaved changes. Are you sure you want to navigate away from this demo?" + ); } + if (confirmChange) { + delete queryObject.gist; + delete queryObject.code; - var demoLink = document.createElement('a'); - demoLink.id = demo.name + tabName; - demoLink.className = 'linkButton'; - demoLink.href = 'gallery/' + encodeURIComponent(demo.name) + '.html'; - - if (demo.name === 'Hello World') { - newDemo = demo; + window.history.pushState(demo, demo.name, getPushStateUrl(demo)); + loadFromGallery(demo).then(function () { + document.title = demo.name + " - Cesium Sandcastle"; + }); } - demoLink.onclick = function(e) { - if (mouse.isMiddle(e)) { - window.open('gallery/' + demo.name + '.html'); - } else { - var htmlText = (htmlEditor.getValue()).replace(/\s/g, ''); - var jsText = (jsEditor.getValue()).replace(/\s/g, ''); - var confirmChange = true; - if (demoHtml !== htmlText || demoCode !== jsText) { - confirmChange = window.confirm('You have unsaved changes. Are you sure you want to navigate away from this demo?'); - } - if (confirmChange) { - delete queryObject.gist; - delete queryObject.code; - - window.history.pushState(demo, demo.name, getPushStateUrl(demo)); - loadFromGallery(demo).then(function() { - document.title = demo.name + ' - Cesium Sandcastle'; - }); - } - } - e.preventDefault(); - }; - - new LinkButton({ - 'label' : '<div class="demoTileTitle">' + demo.name + '</div>' + - '<img src="' + imgSrc + '" class="demoTileThumbnail" alt="" onDragStart="return false;" />' - }).placeAt(demoLink); + } + e.preventDefault(); + }; - on(demoLink, 'mouseover', function() { - scheduleGalleryTooltip(demo); - }); + new LinkButton({ + label: + '<div class="demoTileTitle">' + + demo.name + + "</div>" + + '<img src="' + + imgSrc + + '" class="demoTileThumbnail" alt="" onDragStart="return false;" />', + }).placeAt(demoLink); + + on(demoLink, "mouseover", function () { + scheduleGalleryTooltip(demo); + }); - on(demoLink, 'mouseout', function() { - closeGalleryTooltip(); - }); + on(demoLink, "mouseout", function () { + closeGalleryTooltip(); + }); - return demoLink; + return demoLink; + } + + var promise; + if (!defined(gallery_demos)) { + galleryErrorMsg.textContent = + "No demos found, please run the build script."; + galleryErrorMsg.style.display = "inline-block"; + } else { + var label = "Showcases"; + var cp = new ContentPane({ + content: + '<div id="showcasesContainer" class="demosContainer"><div class="demos" id="ShowcasesDemos"></div></div>', + title: "Showcases", + onShow: function () { + setSubtab(this.title); + }, + }).placeAt("innerPanel"); + subtabs[label] = cp; + registerScroll(dom.byId("showcasesContainer")); + + if (has_new_gallery_demos) { + var name = "New in " + VERSION; + subtabs[name] = new ContentPane({ + content: + '<div id="' + + name + + 'Container" class="demosContainer"><div class="demos" id="' + + name + + 'Demos"></div></div>', + title: name, + onShow: function () { + setSubtab(this.title); + }, + }).placeAt("innerPanel"); + registerScroll(dom.byId(name + "Container")); } - var promise; - if (!defined(gallery_demos)) { - galleryErrorMsg.textContent = 'No demos found, please run the build script.'; - galleryErrorMsg.style.display = 'inline-block'; - } else { - var label = 'Showcases'; - var cp = new ContentPane({ - content : '<div id="showcasesContainer" class="demosContainer"><div class="demos" id="ShowcasesDemos"></div></div>', - title : 'Showcases', - onShow : function() { - setSubtab(this.title); - } - }).placeAt('innerPanel'); - subtabs[label] = cp; - registerScroll(dom.byId('showcasesContainer')); - - if (has_new_gallery_demos) { - var name = 'New in ' + VERSION; - subtabs[name] = new ContentPane({ - content: '<div id="' + name + 'Container" class="demosContainer"><div class="demos" id="' + name + 'Demos"></div></div>', - title: name, - onShow: function() { - setSubtab(this.title); - } - }).placeAt('innerPanel'); - registerScroll(dom.byId(name + 'Container')); - } + var i; + var len = gallery_demos.length; - var i; - var len = gallery_demos.length; + var queryInGalleryIndex = false; + var queryName = queryObject.src.replace(".html", ""); + var promises = []; + for (i = 0; i < len; ++i) { + promises.push(addFileToGallery(gallery_demos[i])); + } - var queryInGalleryIndex = false; - var queryName = queryObject.src.replace('.html', ''); - var promises = []; - for (i = 0; i < len; ++i) { - promises.push(addFileToGallery(gallery_demos[i])); + promise = all(promises).then(function (results) { + var resultsLength = results.length; + for (i = 0; i < resultsLength; ++i) { + if (results[i].name === queryName) { + queryInGalleryIndex = true; } + } + + label = "All"; + cp = new ContentPane({ + content: + '<div id="allContainer" class="demosContainer"><div class="demos" id="allDemos"></div></div>', + title: label, + onShow: function () { + setSubtab(this.title); + }, + }).placeAt("innerPanel"); + subtabs[label] = cp; + registerScroll(dom.byId("allContainer")); + + var demos = dom.byId("allDemos"); + for (i = 0; i < len; ++i) { + var demo = gallery_demos[i]; + if (!/Development/i.test(demo.label)) { + insertSortedById(demos, createGalleryButton(demo, "all")); + } + } - promise = all(promises).then(function(results) { - var resultsLength = results.length; - for (i = 0; i < resultsLength; ++i) { - if (results[i].name === queryName) { - queryInGalleryIndex = true; - } - } - - label = 'All'; - cp = new ContentPane({ - content : '<div id="allContainer" class="demosContainer"><div class="demos" id="allDemos"></div></div>', - title : label, - onShow : function() { - setSubtab(this.title); - } - }).placeAt('innerPanel'); - subtabs[label] = cp; - registerScroll(dom.byId('allContainer')); - - var demos = dom.byId('allDemos'); - for (i = 0; i < len; ++i) { - var demo = gallery_demos[i]; - if (!/Development/i.test(demo.label)) { - insertSortedById(demos, createGalleryButton(demo, 'all')); - } - } - - if (!queryInGalleryIndex) { - var emptyDemo = { - name : queryName, - description : '' - }; - gallery_demos.push(emptyDemo); - return addFileToGallery(emptyDemo); - } - }); - } + if (!queryInGalleryIndex) { + var emptyDemo = { + name: queryName, + description: "", + }; + gallery_demos.push(emptyDemo); + return addFileToGallery(emptyDemo); + } + }); + } - when(promise).then(function() { - dom.byId('searchDemos').appendChild(galleryErrorMsg); - searchContainer = registry.byId('searchContainer'); + when(promise).then(function () { + dom.byId("searchDemos").appendChild(galleryErrorMsg); + searchContainer = registry.byId("searchContainer"); - hideSearchContainer(); - registry.byId('innerPanel').selectChild(subtabs[currentTab]); - }); + hideSearchContainer(); + registry.byId("innerPanel").selectChild(subtabs[currentTab]); + }); }); diff --git a/Apps/Sandcastle/LinkButton.js b/Apps/Sandcastle/LinkButton.js index 53d9d8a4591e..aa6a61ca5f73 100644 --- a/Apps/Sandcastle/LinkButton.js +++ b/Apps/Sandcastle/LinkButton.js @@ -1,34 +1,39 @@ define([ - 'dijit/_CssStateMixin', - 'dijit/_TemplatedMixin', - 'dijit/_WidgetBase', - 'dojo/_base/declare', - 'dojo/dom-class', - 'dojo/text!./templates/LinkButton.html' - ], function( - _CssStateMixin, - _TemplatedMixin, - _WidgetBase, - declare, - domClass, - template) { - 'use strict'; + "dijit/_CssStateMixin", + "dijit/_TemplatedMixin", + "dijit/_WidgetBase", + "dojo/_base/declare", + "dojo/dom-class", + "dojo/text!./templates/LinkButton.html", +], function ( + _CssStateMixin, + _TemplatedMixin, + _WidgetBase, + declare, + domClass, + template +) { + "use strict"; - return declare('Sandcastle.LinkButton', [_WidgetBase, _TemplatedMixin, _CssStateMixin], { - baseClass : 'dijitButton', - templateString : template, - showLabel : true, + return declare( + "Sandcastle.LinkButton", + [_WidgetBase, _TemplatedMixin, _CssStateMixin], + { + baseClass: "dijitButton", + templateString: template, + showLabel: true, - _setShowLabelAttr : function(val) { - if (this.containerNode) { - domClass.toggle(this.containerNode, 'dijitDisplayNone', !val); - } - this._set('showLabel', val); - }, - - _setLabelAttr : function(/*String*/content) { - this._set('label', content); - (this.containerNode || this.focusNode).innerHTML = content; + _setShowLabelAttr: function (val) { + if (this.containerNode) { + domClass.toggle(this.containerNode, "dijitDisplayNone", !val); } - }); + this._set("showLabel", val); + }, + + _setLabelAttr: function (/*String*/ content) { + this._set("label", content); + (this.containerNode || this.focusNode).innerHTML = content; + }, + } + ); }); diff --git a/Apps/Sandcastle/Sandcastle-client.js b/Apps/Sandcastle/Sandcastle-client.js index b36d0ed71854..ee761bae7691 100644 --- a/Apps/Sandcastle/Sandcastle-client.js +++ b/Apps/Sandcastle/Sandcastle-client.js @@ -1,170 +1,203 @@ -(function() { - 'use strict'; - window.parent.postMessage('reload', '*'); +(function () { + "use strict"; + window.parent.postMessage("reload", "*"); - function defined(value) { - return value !== undefined; - } + function defined(value) { + return value !== undefined; + } - function print(value) { - if (value === null) { - return 'null'; - } else if (defined(value)) { - return value.toString(); - } - return 'undefined'; + function print(value) { + if (value === null) { + return "null"; + } else if (defined(value)) { + return value.toString(); } + return "undefined"; + } - console.originalLog = console.log; - console.log = function(d1) { - console.originalLog.apply(console, arguments); - window.parent.postMessage({ - 'log' : print(d1) - }, '*'); - }; + console.originalLog = console.log; + console.log = function (d1) { + console.originalLog.apply(console, arguments); + window.parent.postMessage( + { + log: print(d1), + }, + "*" + ); + }; - console.originalWarn = console.warn; - console.warn = function(d1) { - console.originalWarn.apply(console, arguments); - window.parent.postMessage({ - 'warn' : defined(d1) ? d1.toString() : 'undefined' - }, '*'); - }; - - console.originalError = console.error; - console.error = function(d1) { - console.originalError.apply(console, arguments); - if (!defined(d1)) { - window.parent.postMessage({ - 'error' : 'undefined' - }, '*'); - return; - } + console.originalWarn = console.warn; + console.warn = function (d1) { + console.originalWarn.apply(console, arguments); + window.parent.postMessage( + { + warn: defined(d1) ? d1.toString() : "undefined", + }, + "*" + ); + }; - // Look for d1.stack, "bucket.html:line:char" - var lineNumber = -1; - var errorMsg = d1.toString(); - if (typeof d1.stack === 'string') { - var stack = d1.stack; - var pos = stack.indexOf(Sandcastle.bucket); - if (pos < 0) { - pos = stack.indexOf('<anonymous>'); - } - if (pos >= 0) { - var lineStart = stack.indexOf(':', pos); - if (lineStart > pos) { - var lineEnd1 = stack.indexOf(':', lineStart + 1); - var lineEnd2 = stack.indexOf('\n', lineStart + 1); - if (lineEnd2 > lineStart && (lineEnd2 < lineEnd1 || lineEnd1 < lineStart)) { - lineEnd1 = lineEnd2; - } - if (lineEnd1 > lineStart) { - /*eslint-disable no-empty*/ - try { - lineNumber = parseInt(stack.substring(lineStart + 1, lineEnd1), 10); - } catch (ex) { - } - /*eslint-enable no-empty*/ - } - } - } - } + console.originalError = console.error; + console.error = function (d1) { + console.originalError.apply(console, arguments); + if (!defined(d1)) { + window.parent.postMessage( + { + error: "undefined", + }, + "*" + ); + return; + } - if (lineNumber >= 0) { - window.parent.postMessage({ - 'error' : errorMsg, - 'lineNumber' : lineNumber - }, '*'); - } else { - window.parent.postMessage({ - 'error' : errorMsg - }, '*'); + // Look for d1.stack, "bucket.html:line:char" + var lineNumber = -1; + var errorMsg = d1.toString(); + if (typeof d1.stack === "string") { + var stack = d1.stack; + var pos = stack.indexOf(Sandcastle.bucket); + if (pos < 0) { + pos = stack.indexOf("<anonymous>"); + } + if (pos >= 0) { + var lineStart = stack.indexOf(":", pos); + if (lineStart > pos) { + var lineEnd1 = stack.indexOf(":", lineStart + 1); + var lineEnd2 = stack.indexOf("\n", lineStart + 1); + if ( + lineEnd2 > lineStart && + (lineEnd2 < lineEnd1 || lineEnd1 < lineStart) + ) { + lineEnd1 = lineEnd2; + } + if (lineEnd1 > lineStart) { + /*eslint-disable no-empty*/ + try { + lineNumber = parseInt( + stack.substring(lineStart + 1, lineEnd1), + 10 + ); + } catch (ex) {} + /*eslint-enable no-empty*/ + } } - }; + } + } - window.onerror = function(errorMsg, url, lineNumber) { - if (defined(lineNumber)) { - if (defined(url) && url.indexOf(Sandcastle.bucket) > -1) { - // if the URL is the bucket itself, ignore it - url = ''; - } - if (lineNumber < 1) { - // Change lineNumber to the local one for highlighting. - /*eslint-disable no-empty*/ - try { - var pos = errorMsg.indexOf(Sandcastle.bucket + ':'); - if (pos < 0) { - pos = errorMsg.indexOf('<anonymous>'); - } - if (pos >= 0) { - pos += 12; - lineNumber = parseInt(errorMsg.substring(pos), 10); - } - } catch (ex) { - } - /*eslint-enable no-empty*/ - } - window.parent.postMessage({ - 'error' : errorMsg, - 'url' : url, - 'lineNumber' : lineNumber - }, '*'); - } else { - window.parent.postMessage({ - 'error' : errorMsg, - 'url' : url - }, '*'); - } - console.originalError.apply(console, [errorMsg]); - return false; - }; + if (lineNumber >= 0) { + window.parent.postMessage( + { + error: errorMsg, + lineNumber: lineNumber, + }, + "*" + ); + } else { + window.parent.postMessage( + { + error: errorMsg, + }, + "*" + ); + } + }; - Sandcastle.declare = function(obj) { + window.onerror = function (errorMsg, url, lineNumber) { + if (defined(lineNumber)) { + if (defined(url) && url.indexOf(Sandcastle.bucket) > -1) { + // if the URL is the bucket itself, ignore it + url = ""; + } + if (lineNumber < 1) { + // Change lineNumber to the local one for highlighting. /*eslint-disable no-empty*/ try { - //Browsers such as IE don't have a stack property until you actually throw the error. - var stack = ''; - try { - throw new Error(); - } catch (ex) { - stack = ex.stack.toString(); - } - var needle = Sandcastle.bucket + ':'; // Firefox - var pos = stack.indexOf(needle); - if (pos < 0) { - needle = ' (<anonymous>:'; // Chrome - pos = stack.indexOf(needle); - } - if (pos < 0) { - needle = ' (Unknown script code:'; // IE 11 - pos = stack.indexOf(needle); - } - if (pos >= 0) { - pos += needle.length; - var lineNumber = parseInt(stack.substring(pos), 10); - Sandcastle.registered.push({ - 'obj' : obj, - 'lineNumber' : lineNumber - }); - } - } catch (ex) { - } + var pos = errorMsg.indexOf(Sandcastle.bucket + ":"); + if (pos < 0) { + pos = errorMsg.indexOf("<anonymous>"); + } + if (pos >= 0) { + pos += 12; + lineNumber = parseInt(errorMsg.substring(pos), 10); + } + } catch (ex) {} /*eslint-enable no-empty*/ - }; + } + window.parent.postMessage( + { + error: errorMsg, + url: url, + lineNumber: lineNumber, + }, + "*" + ); + } else { + window.parent.postMessage( + { + error: errorMsg, + url: url, + }, + "*" + ); + } + console.originalError.apply(console, [errorMsg]); + return false; + }; + + Sandcastle.declare = function (obj) { + /*eslint-disable no-empty*/ + try { + //Browsers such as IE don't have a stack property until you actually throw the error. + var stack = ""; + try { + throw new Error(); + } catch (ex) { + stack = ex.stack.toString(); + } + var needle = Sandcastle.bucket + ":"; // Firefox + var pos = stack.indexOf(needle); + if (pos < 0) { + needle = " (<anonymous>:"; // Chrome + pos = stack.indexOf(needle); + } + if (pos < 0) { + needle = " (Unknown script code:"; // IE 11 + pos = stack.indexOf(needle); + } + if (pos >= 0) { + pos += needle.length; + var lineNumber = parseInt(stack.substring(pos), 10); + Sandcastle.registered.push({ + obj: obj, + lineNumber: lineNumber, + }); + } + } catch (ex) {} + /*eslint-enable no-empty*/ + }; - Sandcastle.highlight = function(obj) { - if (typeof obj !== 'undefined') { - for (var i = 0, len = Sandcastle.registered.length; i < len; ++i) { - if (obj === Sandcastle.registered[i].obj || obj.primitive === Sandcastle.registered[i].obj) { - window.parent.postMessage({ - 'highlight' : Sandcastle.registered[i].lineNumber - }, '*'); - return; - } - } + Sandcastle.highlight = function (obj) { + if (typeof obj !== "undefined") { + for (var i = 0, len = Sandcastle.registered.length; i < len; ++i) { + if ( + obj === Sandcastle.registered[i].obj || + obj.primitive === Sandcastle.registered[i].obj + ) { + window.parent.postMessage( + { + highlight: Sandcastle.registered[i].lineNumber, + }, + "*" + ); + return; } - window.parent.postMessage({ - 'highlight' : 0 - }, '*'); - }; -}()); + } + } + window.parent.postMessage( + { + highlight: 0, + }, + "*" + ); + }; +})(); diff --git a/Apps/Sandcastle/Sandcastle-header.js b/Apps/Sandcastle/Sandcastle-header.js index ecdb0880d54f..9362b243478d 100644 --- a/Apps/Sandcastle/Sandcastle-header.js +++ b/Apps/Sandcastle/Sandcastle-header.js @@ -1,106 +1,111 @@ -(function() { - 'use strict'; +(function () { + "use strict"; - var defaultAction; - var bucket = window.location.href; - var pos = bucket.lastIndexOf('/'); - if (pos > 0 && pos < (bucket.length - 1)) { - bucket = bucket.substring(pos + 1); - } + var defaultAction; + var bucket = window.location.href; + var pos = bucket.lastIndexOf("/"); + if (pos > 0 && pos < bucket.length - 1) { + bucket = bucket.substring(pos + 1); + } - window.Sandcastle = { - bucket : bucket, - declare : function() { - }, - highlight : function() { - }, - registered : [], - finishedLoading : function() { - window.Sandcastle.reset(); + window.Sandcastle = { + bucket: bucket, + declare: function () {}, + highlight: function () {}, + registered: [], + finishedLoading: function () { + window.Sandcastle.reset(); - if(defaultAction) { - window.Sandcastle.highlight(defaultAction); - defaultAction(); - defaultAction = undefined; - } + if (defaultAction) { + window.Sandcastle.highlight(defaultAction); + defaultAction(); + defaultAction = undefined; + } - document.body.className = document.body.className.replace(/(?:\s|^)sandcastle-loading(?:\s|$)/, ' '); - }, - addToggleButton : function(text, checked, onchange, toolbarID) { - window.Sandcastle.declare(onchange); - var input = document.createElement('input'); - input.checked = checked; - input.type = 'checkbox'; - input.style.pointerEvents = 'none'; - var label = document.createElement('label'); - label.appendChild(input); - label.appendChild(document.createTextNode(text)); - label.style.pointerEvents = 'none'; - var button = document.createElement('button'); - button.type = 'button'; - button.className = 'cesium-button'; - button.appendChild(label); + document.body.className = document.body.className.replace( + /(?:\s|^)sandcastle-loading(?:\s|$)/, + " " + ); + }, + addToggleButton: function (text, checked, onchange, toolbarID) { + window.Sandcastle.declare(onchange); + var input = document.createElement("input"); + input.checked = checked; + input.type = "checkbox"; + input.style.pointerEvents = "none"; + var label = document.createElement("label"); + label.appendChild(input); + label.appendChild(document.createTextNode(text)); + label.style.pointerEvents = "none"; + var button = document.createElement("button"); + button.type = "button"; + button.className = "cesium-button"; + button.appendChild(label); - button.onclick = function() { - window.Sandcastle.reset(); - window.Sandcastle.highlight(onchange); - input.checked = !input.checked; - onchange(input.checked); - }; + button.onclick = function () { + window.Sandcastle.reset(); + window.Sandcastle.highlight(onchange); + input.checked = !input.checked; + onchange(input.checked); + }; - document.getElementById(toolbarID || 'toolbar').appendChild(button); - }, - addToolbarButton : function(text, onclick, toolbarID) { - window.Sandcastle.declare(onclick); - var button = document.createElement('button'); - button.type = 'button'; - button.className = 'cesium-button'; - button.onclick = function() { - window.Sandcastle.reset(); - window.Sandcastle.highlight(onclick); - onclick(); - }; - button.textContent = text; - document.getElementById(toolbarID || 'toolbar').appendChild(button); - }, - addDefaultToolbarButton : function(text, onclick, toolbarID) { - window.Sandcastle.addToolbarButton(text, onclick, toolbarID); - defaultAction = onclick; - }, - addDefaultToolbarMenu : function(options, toolbarID) { - window.Sandcastle.addToolbarMenu(options, toolbarID); - defaultAction = options[0].onselect; - }, - addToolbarMenu : function(options, toolbarID) { - var menu = document.createElement('select'); - menu.className = 'cesium-button'; - menu.onchange = function() { - window.Sandcastle.reset(); - var item = options[menu.selectedIndex]; - if (item && typeof item.onselect === 'function') { - item.onselect(); - } - }; - document.getElementById(toolbarID || 'toolbar').appendChild(menu); + document.getElementById(toolbarID || "toolbar").appendChild(button); + }, + addToolbarButton: function (text, onclick, toolbarID) { + window.Sandcastle.declare(onclick); + var button = document.createElement("button"); + button.type = "button"; + button.className = "cesium-button"; + button.onclick = function () { + window.Sandcastle.reset(); + window.Sandcastle.highlight(onclick); + onclick(); + }; + button.textContent = text; + document.getElementById(toolbarID || "toolbar").appendChild(button); + }, + addDefaultToolbarButton: function (text, onclick, toolbarID) { + window.Sandcastle.addToolbarButton(text, onclick, toolbarID); + defaultAction = onclick; + }, + addDefaultToolbarMenu: function (options, toolbarID) { + window.Sandcastle.addToolbarMenu(options, toolbarID); + defaultAction = options[0].onselect; + }, + addToolbarMenu: function (options, toolbarID) { + var menu = document.createElement("select"); + menu.className = "cesium-button"; + menu.onchange = function () { + window.Sandcastle.reset(); + var item = options[menu.selectedIndex]; + if (item && typeof item.onselect === "function") { + item.onselect(); + } + }; + document.getElementById(toolbarID || "toolbar").appendChild(menu); - if (!defaultAction && typeof options[0].onselect === 'function') { - defaultAction = options[0].onselect; - } + if (!defaultAction && typeof options[0].onselect === "function") { + defaultAction = options[0].onselect; + } - for (var i = 0, len = options.length; i < len; ++i) { - var option = document.createElement('option'); - option.textContent = options[i].text; - option.value = options[i].value; - menu.appendChild(option); - } - }, - reset : function() { - } - }; + for (var i = 0, len = options.length; i < len; ++i) { + var option = document.createElement("option"); + option.textContent = options[i].text; + option.value = options[i].value; + menu.appendChild(option); + } + }, + reset: function () {}, + }; - if (window.location.protocol === 'file:') { - if (window.confirm("You must host this app on a web server.\nSee contributor's guide for more info?")) { - window.location = 'https://github.com/CesiumGS/cesium/wiki/Contributor%27s-Guide'; - } + if (window.location.protocol === "file:") { + if ( + window.confirm( + "You must host this app on a web server.\nSee contributor's guide for more info?" + ) + ) { + window.location = + "https://github.com/CesiumGS/cesium/wiki/Contributor%27s-Guide"; } -}()); + } +})(); diff --git a/Apps/Sandcastle/Sandcastle-helpers.js b/Apps/Sandcastle/Sandcastle-helpers.js index 079610424c7b..dce85e56a9cb 100644 --- a/Apps/Sandcastle/Sandcastle-helpers.js +++ b/Apps/Sandcastle/Sandcastle-helpers.js @@ -1,39 +1,44 @@ -(function() { - 'use strict'; +(function () { + "use strict"; - window.embedInSandcastleTemplate = function(code, addExtraLine) { - return 'function startup(Cesium) {\n' + - ' \'use strict\';\n' + - '//Sandcastle_Begin\n' + - (addExtraLine ? '\n' : '') + - code + - '//Sandcastle_End\n' + - ' Sandcastle.finishedLoading();\n' + - '}\n' + - 'if (typeof Cesium !== \'undefined\') {\n' + - ' window.startupCalled = true;\n' + - ' startup(Cesium);\n' + - '}\n'; + window.embedInSandcastleTemplate = function (code, addExtraLine) { + return ( + "function startup(Cesium) {\n" + + " 'use strict';\n" + + "//Sandcastle_Begin\n" + + (addExtraLine ? "\n" : "") + + code + + "//Sandcastle_End\n" + + " Sandcastle.finishedLoading();\n" + + "}\n" + + "if (typeof Cesium !== 'undefined') {\n" + + " window.startupCalled = true;\n" + + " startup(Cesium);\n" + + "}\n" + ); + }; + window.decodeBase64Data = function (base64String, pako) { + // data stored in the hash as: + // Base64 encoded, raw DEFLATE compressed JSON array where index 0 is code, index 1 is html + // restore padding + while (base64String.length % 4 !== 0) { + base64String += "="; + } + var jsonString = pako.inflate(atob(base64String), { + raw: true, + to: "string", + }); + // we save a few bytes by omitting the leading [" and trailing "] since they are always the same + jsonString = '["' + jsonString + '"]'; + var json = JSON.parse(jsonString); + // index 0 is code, index 1 is html + var code = json[0]; + var html = json[1]; + var baseHref = json[2]; + return { + code: code, + html: html, + baseHref: baseHref, }; - window.decodeBase64Data = function(base64String, pako) { - // data stored in the hash as: - // Base64 encoded, raw DEFLATE compressed JSON array where index 0 is code, index 1 is html - // restore padding - while (base64String.length % 4 !== 0) { - base64String += '='; - } - var jsonString = pako.inflate(atob(base64String), { raw: true, to: 'string' }); - // we save a few bytes by omitting the leading [" and trailing "] since they are always the same - jsonString = '["' + jsonString + '"]'; - var json = JSON.parse(jsonString); - // index 0 is code, index 1 is html - var code = json[0]; - var html = json[1]; - var baseHref = json[2]; - return { - code : code, - html : html, - baseHref : baseHref - }; - }; -}()); + }; +})(); diff --git a/Apps/Sandcastle/gallery/3D Models Coloring.html b/Apps/Sandcastle/gallery/3D Models Coloring.html index 891a66a92947..d60fb691a684 100644 --- a/Apps/Sandcastle/gallery/3D Models Coloring.html +++ b/Apps/Sandcastle/gallery/3D Models Coloring.html @@ -1,237 +1,333 @@ <!DOCTYPE html> <html lang="en"> -<head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> - <meta name="description" content="Change color of 3D models."> - <meta name="cesium-sandcastle-labels" content="Showcases"> + <head> + <meta charset="utf-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <meta + name="viewport" + content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" + /> + <meta name="description" content="Change color of 3D models." /> + <meta name="cesium-sandcastle-labels" content="Showcases" /> <title>Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Model Color
Mode
Color
Alpha - - -
Mix - - -
Model Silhouette
Color
Alpha - - -
Size - - -
-
- - + + var options = [ + { + text: "Aircraft", + onselect: function () { + createModel( + "../../SampleData/models/CesiumAir/Cesium_Air.glb", + 5000.0 + ); + }, + }, + { + text: "Ground Vehicle", + onselect: function () { + createModel( + "../../SampleData/models/GroundVehicle/GroundVehicle.glb", + 0 + ); + }, + }, + { + text: "Hot Air Balloon", + onselect: function () { + createModel( + "../../SampleData/models/CesiumBalloon/CesiumBalloon.glb", + 1000.0 + ); + }, + }, + { + text: "Milk Truck", + onselect: function () { + createModel( + "../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.glb", + 0 + ); + }, + }, + { + text: "Skinned Character", + onselect: function () { + createModel( + "../../SampleData/models/CesiumMan/Cesium_Man.glb", + 0 + ); + }, + }, + ]; + + Sandcastle.addToolbarMenu(options); + + Sandcastle.addToggleButton("Shadows", viewer.shadows, function ( + checked + ) { + viewer.shadows = checked; + }); + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Models.html b/Apps/Sandcastle/gallery/3D Models.html index b14481b7d213..1db0cc2d8d10 100644 --- a/Apps/Sandcastle/gallery/3D Models.html +++ b/Apps/Sandcastle/gallery/3D Models.html @@ -1,97 +1,139 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Sandcastle.addToolbarMenu(options); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Adjust Height.html b/Apps/Sandcastle/gallery/3D Tiles Adjust Height.html index ef10da3bf01f..8008bf681bab 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Adjust Height.html +++ b/Apps/Sandcastle/gallery/3D Tiles Adjust Height.html @@ -1,87 +1,132 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
Height
- - -
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles BIM.html b/Apps/Sandcastle/gallery/3D Tiles BIM.html index 6dfbe1bb71f4..01f646dd11bf 100644 --- a/Apps/Sandcastle/gallery/3D Tiles BIM.html +++ b/Apps/Sandcastle/gallery/3D Tiles BIM.html @@ -1,165 +1,224 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + function unselectFeature(feature) { + if (!Cesium.defined(feature)) { + return; + } + var element = feature.getProperty("element"); + setElementColor(element, Cesium.Color.WHITE); + if (feature === selectedFeature) { + selectedFeature = undefined; + } + } + + var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); + handler.setInputAction(function (movement) { + if (!picking) { + return; + } + + var feature = scene.pick(movement.endPosition); + + unselectFeature(selectedFeature); + + if (feature instanceof Cesium.Cesium3DTileFeature) { + selectFeature(feature); + } + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); + + // In this tileset every feature has an "element" property which is a global ID. + // This property is used to associate features across different tiles and LODs. + // Workaround until 3D Tiles has the concept of global batch ids: https://github.com/CesiumGS/3d-tiles/issues/265 + var elementMap = {}; // Build a map of elements to features. + var hiddenElements = [ + 112001, + 113180, + 131136, + 113167, + 71309, + 109652, + 111178, + 113156, + 113170, + 124846, + 114076, + 131122, + 113179, + 114325, + 131134, + 113164, + 113153, + 113179, + 109656, + 114095, + 114093, + 39225, + 39267, + 113149, + 113071, + 112003, + 39229, + 113160, + 39227, + 39234, + 113985, + 39230, + 112004, + 39223, + ]; + + function getElement(feature) { + return parseInt(feature.getProperty("element"), 10); + } + + function setElementColor(element, color) { + var featuresToColor = elementMap[element]; + var length = featuresToColor.length; + for (var i = 0; i < length; ++i) { + var feature = featuresToColor[i]; + feature.color = Cesium.Color.clone(color, feature.color); + } + } + + function unloadFeature(feature) { + unselectFeature(feature); + var element = getElement(feature); + var features = elementMap[element]; + var index = features.indexOf(feature); + if (index > -1) { + features.splice(index, 1); + } + } + + function loadFeature(feature) { + var element = getElement(feature); + var features = elementMap[element]; + if (!Cesium.defined(features)) { + features = []; + elementMap[element] = features; + } + features.push(feature); + + if (hiddenElements.indexOf(element) > -1) { + feature.show = false; + } + } + + function processContentFeatures(content, callback) { + var featuresLength = content.featuresLength; + for (var i = 0; i < featuresLength; ++i) { + var feature = content.getFeature(i); + callback(feature); + } + } + + function processTileFeatures(tile, callback) { + var content = tile.content; + var innerContents = content.innerContents; + if (Cesium.defined(innerContents)) { + var length = innerContents.length; + for (var i = 0; i < length; ++i) { + processContentFeatures(innerContents[i], callback); + } + } else { + processContentFeatures(content, callback); + } + } + + tileset.tileLoad.addEventListener(function (tile) { + processTileFeatures(tile, loadFeature); + }); + + tileset.tileUnload.addEventListener(function (tile) { + processTileFeatures(tile, unloadFeature); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.html b/Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.html index 97360c275fea..3c45f7c74ea4 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.html +++ b/Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.html @@ -1,206 +1,223 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/3D Tiles Clipping Planes.html b/Apps/Sandcastle/gallery/3D Tiles Clipping Planes.html index bf17cefc40e2..b364c68412eb 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Clipping Planes.html +++ b/Apps/Sandcastle/gallery/3D Tiles Clipping Planes.html @@ -1,263 +1,349 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - Show bounding volume - Enable edge styling -
+ } + +
+

Loading...

+
+ + + Show bounding volume + + Enable edge styling +
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Feature Picking.html b/Apps/Sandcastle/gallery/3D Tiles Feature Picking.html index c976a556589b..b1a9f90fac7f 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Feature Picking.html +++ b/Apps/Sandcastle/gallery/3D Tiles Feature Picking.html @@ -1,240 +1,314 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Feature Styling.html b/Apps/Sandcastle/gallery/3D Tiles Feature Styling.html index bfb21515b4ca..7065ceb67727 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Feature Styling.html +++ b/Apps/Sandcastle/gallery/3D Tiles Feature Styling.html @@ -1,155 +1,193 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Formats.html b/Apps/Sandcastle/gallery/3D Tiles Formats.html index 59d64a3f913f..ad47cbab63a7 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Formats.html +++ b/Apps/Sandcastle/gallery/3D Tiles Formats.html @@ -1,167 +1,230 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- -
Shadows
-
- - + handler.setInputAction(function (movement) { + var feature = inspectorViewModel.feature; + if (Cesium.defined(feature)) { + feature.show = false; + } + }, Cesium.ScreenSpaceEventType.MIDDLE_CLICK); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Inspector.html b/Apps/Sandcastle/gallery/3D Tiles Inspector.html index 7391c278a8fe..a59ba913f64b 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Inspector.html +++ b/Apps/Sandcastle/gallery/3D Tiles Inspector.html @@ -1,50 +1,73 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + tileset.readyPromise.then(function () { + viewer.zoomTo( + tileset, + new Cesium.HeadingPitchRange( + 0.0, + -0.5, + tileset.boundingSphere.radius / 4.0 + ) + ); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Interactivity.html b/Apps/Sandcastle/gallery/3D Tiles Interactivity.html index bfaf4fb0aaac..e8b4b22739f6 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Interactivity.html +++ b/Apps/Sandcastle/gallery/3D Tiles Interactivity.html @@ -1,198 +1,273 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
Right click action:
-
Annotate
-
Print metadata
-
Zoom to feature
-
Middle click action:
-
Hide feature
-
- - + + function printProperties(movement, feature) { + console.log("Properties:"); + var propertyNames = feature.getPropertyNames(); + var length = propertyNames.length; + for (var i = 0; i < length; ++i) { + var propertyName = propertyNames[i]; + console.log( + " " + propertyName + ": " + feature.getProperty(propertyName) + ); + } + + // Evaluate feature description + console.log( + "Description : " + tileset.style.meta.description.evaluate(feature) + ); + } + + function zoom(movement, feature) { + var longitude = Cesium.Math.toRadians( + feature.getProperty("Longitude") + ); + var latitude = Cesium.Math.toRadians(feature.getProperty("Latitude")); + var height = feature.getProperty("Height"); + + var positionCartographic = new Cesium.Cartographic( + longitude, + latitude, + height * 0.5 + ); + var position = scene.globe.ellipsoid.cartographicToCartesian( + positionCartographic + ); + + var camera = scene.camera; + var heading = camera.heading; + var pitch = camera.pitch; + + var offset = offsetFromHeadingPitchRange( + heading, + pitch, + height * 2.0 + ); + + var transform = Cesium.Transforms.eastNorthUpToFixedFrame(position); + Cesium.Matrix4.multiplyByPoint(transform, offset, position); + + camera.flyTo({ + destination: position, + orientation: { + heading: heading, + pitch: pitch, + }, + easingFunction: Cesium.EasingFunction.QUADRATIC_OUT, + }); + } + + function offsetFromHeadingPitchRange(heading, pitch, range) { + pitch = Cesium.Math.clamp( + pitch, + -Cesium.Math.PI_OVER_TWO, + Cesium.Math.PI_OVER_TWO + ); + heading = Cesium.Math.zeroToTwoPi(heading) - Cesium.Math.PI_OVER_TWO; + + var pitchQuat = Cesium.Quaternion.fromAxisAngle( + Cesium.Cartesian3.UNIT_Y, + -pitch + ); + var headingQuat = Cesium.Quaternion.fromAxisAngle( + Cesium.Cartesian3.UNIT_Z, + -heading + ); + var rotQuat = Cesium.Quaternion.multiply( + headingQuat, + pitchQuat, + headingQuat + ); + var rotMatrix = Cesium.Matrix3.fromQuaternion(rotQuat); + + var offset = Cesium.Cartesian3.clone(Cesium.Cartesian3.UNIT_X); + Cesium.Matrix3.multiplyByVector(rotMatrix, offset, offset); + Cesium.Cartesian3.negate(offset, offset); + Cesium.Cartesian3.multiplyByScalar(offset, range, offset); + return offset; + } + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Interior.html b/Apps/Sandcastle/gallery/3D Tiles Interior.html index a38571428b78..ac01c0f465df 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Interior.html +++ b/Apps/Sandcastle/gallery/3D Tiles Interior.html @@ -1,49 +1,71 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var initialPosition = new Cesium.Cartesian3( + -1111583.3721328347, + -5855888.151574568, + 2262561.444696748 + ); + var initialOrientation = new Cesium.HeadingPitchRoll.fromDegrees( + 100.0, + -15.0, + 0.0 + ); + viewer.scene.camera.setView({ + destination: initialPosition, + orientation: initialOrientation, + endTransform: Cesium.Matrix4.IDENTITY, + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Photogrammetry Classification.html b/Apps/Sandcastle/gallery/3D Tiles Photogrammetry Classification.html index 3b5a47b58bf4..c1de5dd1c0b7 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Photogrammetry Classification.html +++ b/Apps/Sandcastle/gallery/3D Tiles Photogrammetry Classification.html @@ -1,71 +1,88 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Sandcastle.addToggleButton("Show classification", true, function ( + checked + ) { + classificationTileset.show = checked; + nonClassificationTileset.show = !checked; + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Photogrammetry.html b/Apps/Sandcastle/gallery/3D Tiles Photogrammetry.html index 1175bd825e28..d68ac252880c 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Photogrammetry.html +++ b/Apps/Sandcastle/gallery/3D Tiles Photogrammetry.html @@ -1,45 +1,59 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Point Cloud Classification.html b/Apps/Sandcastle/gallery/3D Tiles Point Cloud Classification.html index 53f68e227e49..1d8666c98a15 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Point Cloud Classification.html +++ b/Apps/Sandcastle/gallery/3D Tiles Point Cloud Classification.html @@ -1,98 +1,124 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Highlight the feature + highlighted.feature = pickedFeature; + Cesium.Color.clone(pickedFeature.color, highlighted.originalColor); + pickedFeature.color = Cesium.Color.YELLOW.withAlpha(0.5); + }, + Cesium.ScreenSpaceEventType.MOUSE_MOVE); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Point Cloud Shading.html b/Apps/Sandcastle/gallery/3D Tiles Point Cloud Shading.html index cddf526eb0ba..28c0bb480ba6 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Point Cloud Shading.html +++ b/Apps/Sandcastle/gallery/3D Tiles Point Cloud Shading.html @@ -1,266 +1,385 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Maximum Screen Space Error - - -
Attenuation
Geometric Error Scale - - -
Maximum Attenuation - - -
Base Resolution - - -
Eye Dome Lighting
Eye Dome Lighting Strength - - -
Eye Dome Lighting Radius - - -
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Point Cloud Styling.html b/Apps/Sandcastle/gallery/3D Tiles Point Cloud Styling.html index 712a35555be5..70d9e44b37fd 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Point Cloud Styling.html +++ b/Apps/Sandcastle/gallery/3D Tiles Point Cloud Styling.html @@ -1,212 +1,246 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/3D Tiles Point Cloud.html b/Apps/Sandcastle/gallery/3D Tiles Point Cloud.html index 8941a3214177..3277934b5b3f 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Point Cloud.html +++ b/Apps/Sandcastle/gallery/3D Tiles Point Cloud.html @@ -1,47 +1,71 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Terrain Classification.html b/Apps/Sandcastle/gallery/3D Tiles Terrain Classification.html index 31edd28f924e..22d39cd2da31 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Terrain Classification.html +++ b/Apps/Sandcastle/gallery/3D Tiles Terrain Classification.html @@ -1,78 +1,97 @@ - - - - - - + + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Highlight the feature + highlighted.feature = pickedFeature; + Cesium.Color.clone(pickedFeature.color, highlighted.originalColor); + pickedFeature.color = Cesium.Color.YELLOW; + }, + Cesium.ScreenSpaceEventType.MOUSE_MOVE); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Ambient Occlusion.html b/Apps/Sandcastle/gallery/Ambient Occlusion.html index 3846920a750e..c87a11adfe72 100644 --- a/Apps/Sandcastle/gallery/Ambient Occlusion.html +++ b/Apps/Sandcastle/gallery/Ambient Occlusion.html @@ -1,116 +1,210 @@  - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ambient Occlusion
Ambient Occlusion Only
Intensity
Length Cap
Step Size
Bias
Blur Step Size
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/ArcGIS MapServer.html b/Apps/Sandcastle/gallery/ArcGIS MapServer.html index ff256eaac74d..887363161c74 100644 --- a/Apps/Sandcastle/gallery/ArcGIS MapServer.html +++ b/Apps/Sandcastle/gallery/ArcGIS MapServer.html @@ -1,45 +1,63 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Start off looking at Australia. + viewer.camera.setView({ + destination: Cesium.Rectangle.fromDegrees( + 114.591, + -45.837, + 148.97, + -5.73 + ), + }); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/ArcGIS Tiled Elevation Terrain.html b/Apps/Sandcastle/gallery/ArcGIS Tiled Elevation Terrain.html index 4e1b80f1f07d..c05be2132a98 100644 --- a/Apps/Sandcastle/gallery/ArcGIS Tiled Elevation Terrain.html +++ b/Apps/Sandcastle/gallery/ArcGIS Tiled Elevation Terrain.html @@ -1,38 +1,49 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/ArcticDEM.html b/Apps/Sandcastle/gallery/ArcticDEM.html index 0d335bdffee6..cec3edb8d2a7 100644 --- a/Apps/Sandcastle/gallery/ArcticDEM.html +++ b/Apps/Sandcastle/gallery/ArcticDEM.html @@ -1,92 +1,129 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + // Add Alaskan locations + Sandcastle.addDefaultToolbarMenu( + [ + { + text: "Denali", + onselect: function () { + viewer.scene.camera.flyTo({ + destination: Cesium.Cartesian3.fromRadians( + -2.6399828792482234, + 1.0993550795541742, + 5795 + ), + orientation: { + heading: 3.8455, + pitch: -0.4535, + roll: 0.0, + }, + }); + }, + }, + { + text: "Anchorage Area", + onselect: function () { + viewer.scene.camera.flyTo({ + destination: Cesium.Cartesian3.fromRadians( + -2.610708034601548, + 1.0671172431736584, + 1900 + ), + orientation: { + heading: 4.6, + pitch: -0.341, + roll: 0.0, + }, + }); + }, + }, + { + text: "Peaks", + onselect: function () { + viewer.scene.camera.flyTo({ + destination: Cesium.Cartesian3.fromRadians( + -2.6928866820212813, + 1.072394255273859, + 3700 + ), + orientation: { + heading: 1.6308222948889464, + pitch: -0.6473480165020193, + roll: 0.0, + }, + }); + }, + }, + { + text: "Riverbed", + onselect: function () { + viewer.scene.camera.flyTo({ + destination: Cesium.Cartesian3.fromRadians( + -2.6395623497608596, + 1.0976443174490356, + 2070 + ), + orientation: { + heading: 6.068794108659519, + pitch: -0.08514161789475816, + roll: 0.0, + }, + }); + }, + }, + ], + "toolbar" + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Billboards.html b/Apps/Sandcastle/gallery/Billboards.html index 205d25db181a..0563f891acc0 100644 --- a/Apps/Sandcastle/gallery/Billboards.html +++ b/Apps/Sandcastle/gallery/Billboards.html @@ -1,319 +1,364 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + if (Cesium.defined(terrainProvider)) { + viewer.terrainProvider = terrainProvider; + terrainProvider = undefined; + viewer.scene.globe.depthTestAgainstTerrain = false; + } + }; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Bloom.html b/Apps/Sandcastle/gallery/Bloom.html index dd897e541438..c3c0f546dc63 100644 --- a/Apps/Sandcastle/gallery/Bloom.html +++ b/Apps/Sandcastle/gallery/Bloom.html @@ -1,125 +1,190 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+
+ + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - -
Bloom
Glow only
Contrast
+ +
Brightness
+ +
Delta
+ +
Sigma
+ +
Step Size
-
- - + var target = Cesium.Cartesian3.fromDegrees( + initialLon + lonIncrement, + lat, + height + 7.5 + ); + var offset = new Cesium.Cartesian3( + -37.048378684557974, + -24.852967044804245, + 4.352023653686047 + ); + viewer.scene.camera.lookAt(target, offset); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Blue Marble.html b/Apps/Sandcastle/gallery/Blue Marble.html index ecea963e13d8..4eec895061c0 100644 --- a/Apps/Sandcastle/gallery/Blue Marble.html +++ b/Apps/Sandcastle/gallery/Blue Marble.html @@ -1,38 +1,51 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/Box.html b/Apps/Sandcastle/gallery/Box.html index 8e675fac0256..709fb7e74f7e 100644 --- a/Apps/Sandcastle/gallery/Box.html +++ b/Apps/Sandcastle/gallery/Box.html @@ -1,68 +1,78 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML 3D Tiles.html b/Apps/Sandcastle/gallery/CZML 3D Tiles.html index c6f53f04af94..9725621bc963 100644 --- a/Apps/Sandcastle/gallery/CZML 3D Tiles.html +++ b/Apps/Sandcastle/gallery/CZML 3D Tiles.html @@ -1,57 +1,75 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + dataSourcePromise + .then(function (dataSource) { + viewer.flyTo(dataSource.entities.getById("BatchedColors")); + }) + .otherwise(function (error) { + window.alert(error); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Billboard and Label.html b/Apps/Sandcastle/gallery/CZML Billboard and Label.html index cf1d27b10248..f278d066b75f 100644 --- a/Apps/Sandcastle/gallery/CZML Billboard and Label.html +++ b/Apps/Sandcastle/gallery/CZML Billboard and Label.html @@ -1,72 +1,89 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + var viewer = new Cesium.Viewer("cesiumContainer"); + viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Box.html b/Apps/Sandcastle/gallery/CZML Box.html index bb12313cad34..43e11d80e3dc 100644 --- a/Apps/Sandcastle/gallery/CZML Box.html +++ b/Apps/Sandcastle/gallery/CZML Box.html @@ -1,101 +1,116 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + var viewer = new Cesium.Viewer("cesiumContainer"); + var dataSourcePromise = Cesium.CzmlDataSource.load(czml); + viewer.dataSources.add(dataSourcePromise); + viewer.zoomTo(dataSourcePromise); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Circles and Ellipses.html b/Apps/Sandcastle/gallery/CZML Circles and Ellipses.html index 7a5da229b627..73d1e4576730 100644 --- a/Apps/Sandcastle/gallery/CZML Circles and Ellipses.html +++ b/Apps/Sandcastle/gallery/CZML Circles and Ellipses.html @@ -1,106 +1,122 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Colors.html b/Apps/Sandcastle/gallery/CZML Colors.html index e500fc41219c..57219acb35fd 100644 --- a/Apps/Sandcastle/gallery/CZML Colors.html +++ b/Apps/Sandcastle/gallery/CZML Colors.html @@ -1,84 +1,98 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + var viewer = new Cesium.Viewer("cesiumContainer"); + var dataSourcePromise = Cesium.CzmlDataSource.load(czml); + viewer.dataSources.add(dataSourcePromise); + viewer.zoomTo(dataSourcePromise); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Cones and Cylinders.html b/Apps/Sandcastle/gallery/CZML Cones and Cylinders.html index 662ba358e0d7..91eec84e4044 100644 --- a/Apps/Sandcastle/gallery/CZML Cones and Cylinders.html +++ b/Apps/Sandcastle/gallery/CZML Cones and Cylinders.html @@ -1,86 +1,100 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Corridor.html b/Apps/Sandcastle/gallery/CZML Corridor.html index b194d918504a..089b13ecee14 100644 --- a/Apps/Sandcastle/gallery/CZML Corridor.html +++ b/Apps/Sandcastle/gallery/CZML Corridor.html @@ -1,119 +1,152 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Custom Properties.html b/Apps/Sandcastle/gallery/CZML Custom Properties.html index d840403039fd..154d0454e9fb 100644 --- a/Apps/Sandcastle/gallery/CZML Custom Properties.html +++ b/Apps/Sandcastle/gallery/CZML Custom Properties.html @@ -1,141 +1,181 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
-
+ + + +
+

Loading...

+
+
+
- - + dataSource.load(czml); + viewer.dataSources.add(dataSource); + viewer.zoomTo(dataSource); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Model - Node Transformations.html b/Apps/Sandcastle/gallery/CZML Model - Node Transformations.html index 94d9aa137a2c..5e5f97e292a8 100644 --- a/Apps/Sandcastle/gallery/CZML Model - Node Transformations.html +++ b/Apps/Sandcastle/gallery/CZML Model - Node Transformations.html @@ -1,87 +1,119 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + dataSourcePromise + .then(function (dataSource) { + viewer.trackedEntity = dataSource.entities.getById("model"); + }) + .otherwise(function (error) { + window.alert(error); + }); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Model Articulations.html b/Apps/Sandcastle/gallery/CZML Model Articulations.html index 8d89d58019df..29ea9a240e4c 100644 --- a/Apps/Sandcastle/gallery/CZML Model Articulations.html +++ b/Apps/Sandcastle/gallery/CZML Model Articulations.html @@ -1,99 +1,104 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + dataSourcePromise + .then(function (dataSource) { + viewer.trackedEntity = dataSource.entities.getById("test model"); + }) + .otherwise(function (error) { + console.error(error); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Model Data URL.html b/Apps/Sandcastle/gallery/CZML Model Data URL.html index 7e6a35788df6..2bbf397a67d1 100644 --- a/Apps/Sandcastle/gallery/CZML Model Data URL.html +++ b/Apps/Sandcastle/gallery/CZML Model Data URL.html @@ -1,172 +1,183 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + dataSourcePromise + .then(function (dataSource) { + viewer.trackedEntity = dataSource.entities.getById("cube"); + }) + .otherwise(function (error) { + window.alert(error); + }); + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Model.html b/Apps/Sandcastle/gallery/CZML Model.html index 99cc372f6805..8624b22445de 100644 --- a/Apps/Sandcastle/gallery/CZML Model.html +++ b/Apps/Sandcastle/gallery/CZML Model.html @@ -1,64 +1,83 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Path.html b/Apps/Sandcastle/gallery/CZML Path.html index 3a17b71ef884..0fa15c931f15 100644 --- a/Apps/Sandcastle/gallery/CZML Path.html +++ b/Apps/Sandcastle/gallery/CZML Path.html @@ -1,1880 +1,7267 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Point - Time Dynamic.html b/Apps/Sandcastle/gallery/CZML Point - Time Dynamic.html index 381aedc28f99..2ee1ad930fe9 100644 --- a/Apps/Sandcastle/gallery/CZML Point - Time Dynamic.html +++ b/Apps/Sandcastle/gallery/CZML Point - Time Dynamic.html @@ -1,69 +1,94 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Point.html b/Apps/Sandcastle/gallery/CZML Point.html index 18123c84b98e..7b716291e8e1 100644 --- a/Apps/Sandcastle/gallery/CZML Point.html +++ b/Apps/Sandcastle/gallery/CZML Point.html @@ -1,62 +1,75 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Polygon - Interpolating References.html b/Apps/Sandcastle/gallery/CZML Polygon - Interpolating References.html index 83f8c53313f5..087520069e33 100644 --- a/Apps/Sandcastle/gallery/CZML Polygon - Interpolating References.html +++ b/Apps/Sandcastle/gallery/CZML Polygon - Interpolating References.html @@ -1,174 +1,219 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Polygon - Intervals, Availability.html b/Apps/Sandcastle/gallery/CZML Polygon - Intervals, Availability.html index 8ea6176917e1..3fd53c0c8773 100644 --- a/Apps/Sandcastle/gallery/CZML Polygon - Intervals, Availability.html +++ b/Apps/Sandcastle/gallery/CZML Polygon - Intervals, Availability.html @@ -1,161 +1,234 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Polygon.html b/Apps/Sandcastle/gallery/CZML Polygon.html index 9d944a2afc3b..bac227297e85 100644 --- a/Apps/Sandcastle/gallery/CZML Polygon.html +++ b/Apps/Sandcastle/gallery/CZML Polygon.html @@ -1,172 +1,231 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Polyline.html b/Apps/Sandcastle/gallery/CZML Polyline.html index d97f1718003c..a12b243e6040 100644 --- a/Apps/Sandcastle/gallery/CZML Polyline.html +++ b/Apps/Sandcastle/gallery/CZML Polyline.html @@ -1,149 +1,152 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Position Definitions.html b/Apps/Sandcastle/gallery/CZML Position Definitions.html index eccbdfcf293e..993a6d532412 100644 --- a/Apps/Sandcastle/gallery/CZML Position Definitions.html +++ b/Apps/Sandcastle/gallery/CZML Position Definitions.html @@ -1,95 +1,114 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Rectangle.html b/Apps/Sandcastle/gallery/CZML Rectangle.html index 297f6729ef74..0b0335d3cd94 100644 --- a/Apps/Sandcastle/gallery/CZML Rectangle.html +++ b/Apps/Sandcastle/gallery/CZML Rectangle.html @@ -1,121 +1,137 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Reference Properties.html b/Apps/Sandcastle/gallery/CZML Reference Properties.html index 0c5d05957358..1b28b0b3cfa4 100644 --- a/Apps/Sandcastle/gallery/CZML Reference Properties.html +++ b/Apps/Sandcastle/gallery/CZML Reference Properties.html @@ -1,113 +1,141 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + var viewer = new Cesium.Viewer("cesiumContainer"); + viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Spheres and Ellipsoids.html b/Apps/Sandcastle/gallery/CZML Spheres and Ellipsoids.html index d127acaaa2c0..7d4036e71d0d 100644 --- a/Apps/Sandcastle/gallery/CZML Spheres and Ellipsoids.html +++ b/Apps/Sandcastle/gallery/CZML Spheres and Ellipsoids.html @@ -1,106 +1,121 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML Wall.html b/Apps/Sandcastle/gallery/CZML Wall.html index 09ea4d2e1d9d..bd3b02852985 100644 --- a/Apps/Sandcastle/gallery/CZML Wall.html +++ b/Apps/Sandcastle/gallery/CZML Wall.html @@ -1,72 +1,107 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML ZIndex.html b/Apps/Sandcastle/gallery/CZML ZIndex.html index 8ed294ba6cbb..e9b8e6ec0929 100644 --- a/Apps/Sandcastle/gallery/CZML ZIndex.html +++ b/Apps/Sandcastle/gallery/CZML ZIndex.html @@ -1,125 +1,157 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/CZML.html b/Apps/Sandcastle/gallery/CZML.html index 1c90c868811e..24159e6278bd 100644 --- a/Apps/Sandcastle/gallery/CZML.html +++ b/Apps/Sandcastle/gallery/CZML.html @@ -1,59 +1,76 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + Sandcastle.reset = function () { + viewer.dataSources.removeAll(); + }; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Callback Property.html b/Apps/Sandcastle/gallery/Callback Property.html index ee99d70f8e4f..dd713fa92180 100644 --- a/Apps/Sandcastle/gallery/Callback Property.html +++ b/Apps/Sandcastle/gallery/Callback Property.html @@ -1,101 +1,129 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Keep the view centered. + viewer.trackedEntity = label; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Camera Tutorial.html b/Apps/Sandcastle/gallery/Camera Tutorial.html index 3195c7a2d765..95cf05431443 100644 --- a/Apps/Sandcastle/gallery/Camera Tutorial.html +++ b/Apps/Sandcastle/gallery/Camera Tutorial.html @@ -1,170 +1,196 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- + + + +
+

Loading...

+
+
- + - - + + - - + + - - + + - - - - + + + + -
Click on the Cesium display to start.
w/s - move forward/backward
a/d - move left/right
q/e - move up/down
left mouse button down plus mouse move changes the look direction
+ left mouse button down plus mouse move changes the look direction +
-
- - + + + + diff --git a/Apps/Sandcastle/gallery/Camera.html b/Apps/Sandcastle/gallery/Camera.html index 0d0bffafe116..b6787c8cff8f 100644 --- a/Apps/Sandcastle/gallery/Camera.html +++ b/Apps/Sandcastle/gallery/Camera.html @@ -1,402 +1,472 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
View Changed
-
Camera Changed
-
- - + + Sandcastle.addToolbarMenu([ + { + text: "Camera Options", + }, + { + text: "Fly in a city", + onselect: function () { + flyInACity(); + Sandcastle.highlight(flyInACity); + }, + }, + { + text: "Fly to San Diego", + onselect: function () { + flyToSanDiego(); + Sandcastle.highlight(flyToSanDiego); + }, + }, + { + text: "Fly to Location with heading, pitch and roll", + onselect: function () { + flyToHeadingPitchRoll(); + Sandcastle.highlight(flyToHeadingPitchRoll); + }, + }, + { + text: "Fly to My Location", + onselect: function () { + flyToLocation(); + Sandcastle.highlight(flyToLocation); + }, + }, + { + text: "Fly to Rectangle", + onselect: function () { + flyToRectangle(); + Sandcastle.highlight(flyToRectangle); + }, + }, + { + text: "View a Rectangle", + onselect: function () { + viewRectangle(); + Sandcastle.highlight(viewRectangle); + }, + }, + { + text: "Set camera reference frame", + onselect: function () { + setReferenceFrame(); + Sandcastle.highlight(setReferenceFrame); + }, + }, + { + text: "Set camera with heading, pitch, and roll", + onselect: function () { + setHeadingPitchRoll(); + Sandcastle.highlight(setHeadingPitchRoll); + }, + }, + { + text: "View in ICRF", + onselect: function () { + viewInICRF(); + Sandcastle.highlight(viewInICRF); + }, + }, + { + text: "Move events", + onselect: function () { + cameraEvents(); + Sandcastle.highlight(cameraEvents); + }, + }, + { + text: "Camera changed event", + onselect: function () { + cameraChanges(); + Sandcastle.highlight(cameraChanges); + }, + }, + { + text: "Fly from Los Angeles to Tokyo via Europe", + onselect: function () { + flyOverLongitude(); + Sandcastle.highlight(flyOverLongitude); + }, + }, + { + text: "Look down during exaggerated flight", + onselect: function () { + flyOverLongitudeWithPitch(); + Sandcastle.highlight(flyOverLongitudeWithPitch); + }, + }, + ]); + + Sandcastle.reset = function () { + scene.completeMorph(); + viewer.entities.removeAll(); + scene.primitives.remove(referenceFramePrimitive); + scene.tweens.removeAll(); + + if (Cesium.defined(removeStart)) { + removeStart(); + removeEnd(); + + viewChanged.style.display = "none"; + + removeStart = undefined; + removeEnd = undefined; + } + + if (Cesium.defined(removeChanged)) { + removeChanged(); + removeChanged = undefined; + + cameraChanged.style.display = "none"; + } + + viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY); + + clock.multiplier = 1.0; + scene.postUpdate.removeEventListener(icrf); + scene.globe.enableLighting = false; + }; + + scene.morphComplete.addEventListener(function () { + Sandcastle.reset(); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Cardboard.html b/Apps/Sandcastle/gallery/Cardboard.html index 7af7cc641af6..224aa91211cb 100644 --- a/Apps/Sandcastle/gallery/Cardboard.html +++ b/Apps/Sandcastle/gallery/Cardboard.html @@ -1,156 +1,195 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html b/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html index 990d22d6e9a9..b3a9850907e8 100644 --- a/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html +++ b/Apps/Sandcastle/gallery/Cartographic Limit Rectangle.html @@ -1,76 +1,96 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Sandcastle.addToggleButton("Show Bounds", true, function (checked) { + var rectanglesLength = rectangles.length; + for (var i = 0; i < rectanglesLength; i++) { + var rectangleEntity = rectangles[i]; + rectangleEntity.show = checked; + } + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Cesium Inspector.html b/Apps/Sandcastle/gallery/Cesium Inspector.html index 9189ec6f3e59..0e582da42d8d 100644 --- a/Apps/Sandcastle/gallery/Cesium Inspector.html +++ b/Apps/Sandcastle/gallery/Cesium Inspector.html @@ -1,87 +1,117 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
-
-
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Cesium Widget.html b/Apps/Sandcastle/gallery/Cesium Widget.html index e26a43fcc8bc..28a5a113576c 100644 --- a/Apps/Sandcastle/gallery/Cesium Widget.html +++ b/Apps/Sandcastle/gallery/Cesium Widget.html @@ -1,40 +1,53 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/Cesium World Terrain.html b/Apps/Sandcastle/gallery/Cesium World Terrain.html index 06b7b902048c..9500ff95d2f6 100644 --- a/Apps/Sandcastle/gallery/Cesium World Terrain.html +++ b/Apps/Sandcastle/gallery/Cesium World Terrain.html @@ -1,38 +1,51 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/Circles and Ellipses.html b/Apps/Sandcastle/gallery/Circles and Ellipses.html index 40d021e29949..d5912195fd62 100644 --- a/Apps/Sandcastle/gallery/Circles and Ellipses.html +++ b/Apps/Sandcastle/gallery/Circles and Ellipses.html @@ -1,72 +1,85 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Clamp to 3D Model.html b/Apps/Sandcastle/gallery/Clamp to 3D Model.html index b7ae462f18f3..1ccd759c5515 100644 --- a/Apps/Sandcastle/gallery/Clamp to 3D Model.html +++ b/Apps/Sandcastle/gallery/Clamp to 3D Model.html @@ -1,102 +1,119 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + return Cesium.Cartographic.toCartesian( + cartographic, + Cesium.Ellipsoid.WGS84, + result + ); + } + viewer.trackedEntity = entity; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Clamp to 3D Tiles.html b/Apps/Sandcastle/gallery/Clamp to 3D Tiles.html index 5f96d0cfa510..148beb4a2f91 100644 --- a/Apps/Sandcastle/gallery/Clamp to 3D Tiles.html +++ b/Apps/Sandcastle/gallery/Clamp to 3D Tiles.html @@ -1,74 +1,97 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + function start() { + clock.shouldAnimate = true; + var objectsToExclude = [entity]; + scene.postRender.addEventListener(function () { + var position = positionProperty.getValue(clock.currentTime); + entity.position = scene.clampToHeight(position, objectsToExclude); + }); + } + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Clamp to Terrain.html b/Apps/Sandcastle/gallery/Clamp to Terrain.html index a5135a8feb09..2d8fb18b89ab 100644 --- a/Apps/Sandcastle/gallery/Clamp to Terrain.html +++ b/Apps/Sandcastle/gallery/Clamp to Terrain.html @@ -1,261 +1,368 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
-
-
-
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Classification Types.html b/Apps/Sandcastle/gallery/Classification Types.html index 97593d3f0769..b58ea77f67d4 100644 --- a/Apps/Sandcastle/gallery/Classification Types.html +++ b/Apps/Sandcastle/gallery/Classification Types.html @@ -1,114 +1,171 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Sandcastle.addToolbarMenu(classificationOptions); + Sandcastle.addToolbarMenu(materialOptions); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Classification.html b/Apps/Sandcastle/gallery/Classification.html index b5ce179f364e..a90ed229d73c 100644 --- a/Apps/Sandcastle/gallery/Classification.html +++ b/Apps/Sandcastle/gallery/Classification.html @@ -1,270 +1,401 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - -
invert classification
inverted color alpha - - -
-
- - + } + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Clock.html b/Apps/Sandcastle/gallery/Clock.html index bb2147b89bc8..2bd17d2ad5f4 100644 --- a/Apps/Sandcastle/gallery/Clock.html +++ b/Apps/Sandcastle/gallery/Clock.html @@ -1,63 +1,73 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Sandcastle.addToolbarButton("Speed Up Clock", function () { + viewer.clockViewModel.multiplier *= 2; + }); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Clustering.html b/Apps/Sandcastle/gallery/Clustering.html index 56358aaf8b31..3e673d779f8b 100644 --- a/Apps/Sandcastle/gallery/Clustering.html +++ b/Apps/Sandcastle/gallery/Clustering.html @@ -1,169 +1,219 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + } + +
+

Loading...

+
+
+ + - - + + - + -
Pixel Range - - + +
Minimum Cluster Size - - + +
-
- - + }, Cesium.ScreenSpaceEventType.LEFT_CLICK); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Corridor.html b/Apps/Sandcastle/gallery/Corridor.html index a44a86649d20..3421e2ae3f17 100644 --- a/Apps/Sandcastle/gallery/Corridor.html +++ b/Apps/Sandcastle/gallery/Corridor.html @@ -1,84 +1,103 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Custom DataSource.html b/Apps/Sandcastle/gallery/Custom DataSource.html index 424911041dc8..44c6efa1041d 100644 --- a/Apps/Sandcastle/gallery/Custom DataSource.html +++ b/Apps/Sandcastle/gallery/Custom DataSource.html @@ -1,381 +1,413 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Custom Geocoder.html b/Apps/Sandcastle/gallery/Custom Geocoder.html index e41b3f7520b3..eaec37884faf 100644 --- a/Apps/Sandcastle/gallery/Custom Geocoder.html +++ b/Apps/Sandcastle/gallery/Custom Geocoder.html @@ -1,90 +1,101 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Custom Per-Feature Post Process.html b/Apps/Sandcastle/gallery/Custom Per-Feature Post Process.html index c0ea844c4e74..e27157443e6f 100644 --- a/Apps/Sandcastle/gallery/Custom Per-Feature Post Process.html +++ b/Apps/Sandcastle/gallery/Custom Per-Feature Post Process.html @@ -1,83 +1,101 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); + handler.setInputAction(function (movement) { + var pickedObject = viewer.scene.pick(movement.endPosition); + if (Cesium.defined(pickedObject)) { + stage.selected = [pickedObject.primitive]; + } else { + stage.selected = []; + } + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Custom Post Process.html b/Apps/Sandcastle/gallery/Custom Post Process.html index f1e042707ed8..2bddad433fc9 100644 --- a/Apps/Sandcastle/gallery/Custom Post Process.html +++ b/Apps/Sandcastle/gallery/Custom Post Process.html @@ -1,70 +1,85 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var fragmentShaderSource = + "uniform sampler2D colorTexture; \n" + + "varying vec2 v_textureCoordinates; \n" + + "const int KERNEL_WIDTH = 16; \n" + + "void main(void) \n" + + "{ \n" + + " vec2 step = czm_pixelRatio / czm_viewport.zw; \n" + + " vec2 integralPos = v_textureCoordinates - mod(v_textureCoordinates, 8.0 * step); \n" + + " vec3 averageValue = vec3(0.0); \n" + + " for (int i = 0; i < KERNEL_WIDTH; i++) \n" + + " { \n" + + " for (int j = 0; j < KERNEL_WIDTH; j++) \n" + + " { \n" + + " averageValue += texture2D(colorTexture, integralPos + step * vec2(i, j)).rgb; \n" + + " } \n" + + " } \n" + + " averageValue /= float(KERNEL_WIDTH * KERNEL_WIDTH); \n" + + " gl_FragColor = vec4(averageValue, 1.0); \n" + + "} \n"; + viewer.scene.postProcessStages.add( + new Cesium.PostProcessStage({ + fragmentShader: fragmentShaderSource, + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Cylinders and Cones.html b/Apps/Sandcastle/gallery/Cylinders and Cones.html index b9cbec5a7788..50fc5a7f8d79 100644 --- a/Apps/Sandcastle/gallery/Cylinders and Cones.html +++ b/Apps/Sandcastle/gallery/Cylinders and Cones.html @@ -1,61 +1,71 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/DataSource Ordering.html b/Apps/Sandcastle/gallery/DataSource Ordering.html index d622ae22bca2..7d2970ae289a 100644 --- a/Apps/Sandcastle/gallery/DataSource Ordering.html +++ b/Apps/Sandcastle/gallery/DataSource Ordering.html @@ -1,119 +1,139 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Sandcastle.addToolbarButton("Swap", function () { + Cesium.when.all([promise1, promise2]).then(function (results) { + var ds1 = results[0]; + var ds2 = results[1]; + if (viewer.dataSources.indexOf(ds1) === 0) { + viewer.dataSources.raise(ds1); + } else { + viewer.dataSources.lower(ds1); + } + }); + }); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Depth of Field.html b/Apps/Sandcastle/gallery/Depth of Field.html index 3e6c3ef3abe8..6725840bd000 100644 --- a/Apps/Sandcastle/gallery/Depth of Field.html +++ b/Apps/Sandcastle/gallery/Depth of Field.html @@ -1,118 +1,181 @@  - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - - - - - - - -
Depth Of Field
Focal Distance
Delta
Sigma
Step Size
-
- - + var target = Cesium.Cartesian3.fromDegrees( + initialLon + lonIncrement, + lat, + height + 7.5 + ); + var offset = new Cesium.Cartesian3( + -37.048378684557974, + -24.852967044804245, + 4.352023653686047 + ); + viewer.scene.camera.lookAt(target, offset); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Distance Display Conditions.html b/Apps/Sandcastle/gallery/Distance Display Conditions.html index c684b093f8a8..39e68371163a 100644 --- a/Apps/Sandcastle/gallery/Distance Display Conditions.html +++ b/Apps/Sandcastle/gallery/Distance Display Conditions.html @@ -1,98 +1,133 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Drawing on Terrain.html b/Apps/Sandcastle/gallery/Drawing on Terrain.html index e7f33bd269f6..27a34fed03aa 100644 --- a/Apps/Sandcastle/gallery/Drawing on Terrain.html +++ b/Apps/Sandcastle/gallery/Drawing on Terrain.html @@ -1,161 +1,185 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- + + + +
+

Loading...

+
+
- + - - + + - + -
Left click to add a vertex.
Right click to start new shape.
-
- - + Sandcastle.addToolbarMenu(options); + // Zoom in to an area with mountains + viewer.camera.lookAt( + Cesium.Cartesian3.fromDegrees(-122.2058, 46.1955, 1000.0), + new Cesium.Cartesian3(5000.0, 5000.0, 5000.0) + ); + viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Earth at Night.html b/Apps/Sandcastle/gallery/Earth at Night.html index 800c4d49d370..50e92f081f8d 100644 --- a/Apps/Sandcastle/gallery/Earth at Night.html +++ b/Apps/Sandcastle/gallery/Earth at Night.html @@ -1,38 +1,51 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/Export KML.html b/Apps/Sandcastle/gallery/Export KML.html index 214c90012976..52bf40434f3a 100644 --- a/Apps/Sandcastle/gallery/Export KML.html +++ b/Apps/Sandcastle/gallery/Export KML.html @@ -1,138 +1,166 @@ - - - - - - + + + + + + Export KML - + - - - -
-

Loading...

-
-
-
+ + + +
+

Loading...

+
+
+
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/FXAA.html b/Apps/Sandcastle/gallery/FXAA.html index 05ce4820c061..6deaaddac036 100644 --- a/Apps/Sandcastle/gallery/FXAA.html +++ b/Apps/Sandcastle/gallery/FXAA.html @@ -1,53 +1,73 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Sandcastle.addToggleButton("FXAA", true, function (checked) { + viewer.scene.postProcessStages.fxaa.enabled = checked; + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/GeoJSON and TopoJSON.html b/Apps/Sandcastle/gallery/GeoJSON and TopoJSON.html index 3b87bd450928..72c93325afcc 100644 --- a/Apps/Sandcastle/gallery/GeoJSON and TopoJSON.html +++ b/Apps/Sandcastle/gallery/GeoJSON and TopoJSON.html @@ -1,101 +1,134 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Set the camera to a US centered tilted view and switch back to moving in world coordinates. + viewer.camera.lookAt( + Cesium.Cartesian3.fromDegrees(-98.0, 40.0), + new Cesium.Cartesian3(0.0, -4790000.0, 3930000.0) + ); + viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY); + }; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/GeoJSON simplestyle.html b/Apps/Sandcastle/gallery/GeoJSON simplestyle.html index e8a08e01b7ae..36fd02150afc 100644 --- a/Apps/Sandcastle/gallery/GeoJSON simplestyle.html +++ b/Apps/Sandcastle/gallery/GeoJSON simplestyle.html @@ -1,49 +1,64 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var dataSource = Cesium.GeoJsonDataSource.load( + "../../SampleData/simplestyles.geojson" + ); + viewer.dataSources.add(dataSource); + viewer.zoomTo(dataSource); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Geometry Height Reference.html b/Apps/Sandcastle/gallery/Geometry Height Reference.html index 9e24872dec30..3b4c4fe904f1 100644 --- a/Apps/Sandcastle/gallery/Geometry Height Reference.html +++ b/Apps/Sandcastle/gallery/Geometry Height Reference.html @@ -1,156 +1,182 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Geometry and Appearances.html b/Apps/Sandcastle/gallery/Geometry and Appearances.html index b5079380c3c0..8cf4b9ec1d2c 100644 --- a/Apps/Sandcastle/gallery/Geometry and Appearances.html +++ b/Apps/Sandcastle/gallery/Geometry and Appearances.html @@ -1,494 +1,646 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + entities.add({ + polylineVolume: { + positions: Cesium.Cartesian3.fromDegreesArray([ + -104.0, + 13.0, + -107.0, + 18.0, + -112.0, + 18.0, + ]), + shape: computeCircle(40000.0), + material: Cesium.Color.WHITE, + }, + }); + + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Globe Materials.html b/Apps/Sandcastle/gallery/Globe Materials.html index 3e3ca4119bae..2f773fbf9116 100644 --- a/Apps/Sandcastle/gallery/Globe Materials.html +++ b/Apps/Sandcastle/gallery/Globe Materials.html @@ -1,314 +1,430 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
-
- - - - -
-
+ } + +
+

Loading...

+
+
+
+ + + + +
+
- +
- Spacing m + Spacing + + m
- Line Width px + Line Width + + px
- +
+
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Google Earth Enterprise.html b/Apps/Sandcastle/gallery/Google Earth Enterprise.html index ad63f2d3db31..6c3d6f1b2015 100644 --- a/Apps/Sandcastle/gallery/Google Earth Enterprise.html +++ b/Apps/Sandcastle/gallery/Google Earth Enterprise.html @@ -1,53 +1,68 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Ground Atmosphere.html b/Apps/Sandcastle/gallery/Ground Atmosphere.html index fe4afa305dbf..ccbe10aab7c1 100644 --- a/Apps/Sandcastle/gallery/Ground Atmosphere.html +++ b/Apps/Sandcastle/gallery/Ground Atmosphere.html @@ -1,167 +1,234 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - - - -
Lighting Fade Out Distance - - -
Lighting Fade In Distance - - -
Night Fade Out Distance - - -
Night Fade In Distance - - -
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/HTML Overlays.html b/Apps/Sandcastle/gallery/HTML Overlays.html index 766304150ae3..00919e2b203f 100644 --- a/Apps/Sandcastle/gallery/HTML Overlays.html +++ b/Apps/Sandcastle/gallery/HTML Overlays.html @@ -1,51 +1,71 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - + var htmlOverlay = document.getElementById("htmlOverlay"); + var scratch = new Cesium.Cartesian2(); + viewer.scene.preRender.addEventListener(function () { + var position = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883); + var canvasPosition = viewer.scene.cartesianToCanvasCoordinates( + position, + scratch + ); + if (Cesium.defined(canvasPosition)) { + htmlOverlay.style.top = canvasPosition.y + "px"; + htmlOverlay.style.left = canvasPosition.x + "px"; + } + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/HeadingPitchRoll.html b/Apps/Sandcastle/gallery/HeadingPitchRoll.html index 34251b26432d..777f7a8024b4 100644 --- a/Apps/Sandcastle/gallery/HeadingPitchRoll.html +++ b/Apps/Sandcastle/gallery/HeadingPitchRoll.html @@ -1,231 +1,281 @@ - - - - - - + + + + + + Cesium Demo - + - - -
-

Loading...

+

Loading...

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Click on the 3D window then use the keyboard to change settings.
Heading: °
← to left/→ to right
Pitch: °
↑ to up/↓ to down
roll: °
← + ⇧ left/→ + ⇧ right
Speed: m/s
↑ + ⇧ to speed up/↓ + ⇧ to speed down
following aircraft - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Click on the 3D window then use the keyboard to change settings. +
Heading: °
← to left/→ to right
Pitch: °
↑ to up/↓ to down
roll: °
← + ⇧ left/→ + ⇧ right
Speed: m/s
↑ + ⇧ to speed up/↓ + ⇧ to speed down
+ following aircraft + +
- + viewer.scene.preRender.addEventListener(function (scene, time) { + headingSpan.innerHTML = Cesium.Math.toDegrees(hpRoll.heading).toFixed( + 1 + ); + pitchSpan.innerHTML = Cesium.Math.toDegrees(hpRoll.pitch).toFixed(1); + rollSpan.innerHTML = Cesium.Math.toDegrees(hpRoll.roll).toFixed(1); + speedSpan.innerHTML = speed.toFixed(1); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Hello World.html b/Apps/Sandcastle/gallery/Hello World.html index bdfad3efd354..e29a9ff504e8 100644 --- a/Apps/Sandcastle/gallery/Hello World.html +++ b/Apps/Sandcastle/gallery/Hello World.html @@ -1,35 +1,48 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/High Dynamic Range.html b/Apps/Sandcastle/gallery/High Dynamic Range.html index eebc51cf29f5..586737b47cf6 100644 --- a/Apps/Sandcastle/gallery/High Dynamic Range.html +++ b/Apps/Sandcastle/gallery/High Dynamic Range.html @@ -1,73 +1,99 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var entity = viewer.entities.add({ + name: url, + position: position, + orientation: orientation, + model: { + uri: url, + scale: scale, + }, + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Image-Based Lighting.html b/Apps/Sandcastle/gallery/Image-Based Lighting.html index 5bb9bea85832..9b827c3387a7 100644 --- a/Apps/Sandcastle/gallery/Image-Based Lighting.html +++ b/Apps/Sandcastle/gallery/Image-Based Lighting.html @@ -1,130 +1,217 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - -
Luminance at Zenith - - -
-
- - + Sandcastle.addToggleButton( + "Use procedural environment lighting", + false, + function (checked) { + if (!checked) { + model.sphericalHarmonicCoefficients = coefficients; + model.specularEnvironmentMaps = environmentMapURL; + } else { + model.sphericalHarmonicCoefficients = undefined; + model.specularEnvironmentMaps = undefined; + } + } + ); + }) + .otherwise(function (error) { + window.alert(error); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Imagery Adjustment.html b/Apps/Sandcastle/gallery/Imagery Adjustment.html index 6e8d1175078e..e74cf3874fac 100644 --- a/Apps/Sandcastle/gallery/Imagery Adjustment.html +++ b/Apps/Sandcastle/gallery/Imagery Adjustment.html @@ -1,132 +1,177 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - - - - - - - -
Brightness - - -
Contrast - - -
Hue - - -
Saturation - - -
Gamma - - -
-
- - + // Make the viewModel react to base layer changes. + function updateViewModel() { + if (imageryLayers.length > 0) { + var layer = imageryLayers.get(0); + viewModel.brightness = layer.brightness; + viewModel.contrast = layer.contrast; + viewModel.hue = layer.hue; + viewModel.saturation = layer.saturation; + viewModel.gamma = layer.gamma; + } + } + imageryLayers.layerAdded.addEventListener(updateViewModel); + imageryLayers.layerRemoved.addEventListener(updateViewModel); + imageryLayers.layerMoved.addEventListener(updateViewModel); + updateViewModel(); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Imagery Color To Alpha.html b/Apps/Sandcastle/gallery/Imagery Color To Alpha.html index 47083afe760b..0393c48601f7 100644 --- a/Apps/Sandcastle/gallery/Imagery Color To Alpha.html +++ b/Apps/Sandcastle/gallery/Imagery Color To Alpha.html @@ -1,79 +1,104 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + } + +
+

Loading...

+
+
+ + - -
Threshold - +
-
- - + Cesium.knockout + .getObservable(viewModel, "threshold") + .subscribe(function (newValue) { + singleTileLayer.colorToAlphaThreshold = parseFloat( + viewModel.threshold + ); + }); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Imagery Cutout.html b/Apps/Sandcastle/gallery/Imagery Cutout.html index 5313d768f315..517b2fbcfd5a 100644 --- a/Apps/Sandcastle/gallery/Imagery Cutout.html +++ b/Apps/Sandcastle/gallery/Imagery Cutout.html @@ -1,152 +1,193 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- + + + +
+

Loading...

+
+
- + - - + + - - + + - + -
Click on the Cesium display to start.
w/s - move cutout north/south
a/d - move cutout west/east
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html b/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html index 45036931636c..90df4ebff6e7 100644 --- a/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html +++ b/Apps/Sandcastle/gallery/Imagery Layers Manipulation.html @@ -1,275 +1,337 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- + } + +
+

Loading...

+
+
- - + + - + -
- - + + - + - + - +
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Imagery Layers Split.html b/Apps/Sandcastle/gallery/Imagery Layers Split.html index 1fef68da55fa..802cf0b74dea 100644 --- a/Apps/Sandcastle/gallery/Imagery Layers Split.html +++ b/Apps/Sandcastle/gallery/Imagery Layers Split.html @@ -1,104 +1,122 @@ - - - - - - + + + + + + Cesium Demo - + - - - - - -
-
-
-

Loading...

-
- - - - + } + + +
+
+
+

Loading...

+
+ + + diff --git a/Apps/Sandcastle/gallery/Imagery Layers Texture Filters.html b/Apps/Sandcastle/gallery/Imagery Layers Texture Filters.html index bc8f75b38163..ef9b69490288 100644 --- a/Apps/Sandcastle/gallery/Imagery Layers Texture Filters.html +++ b/Apps/Sandcastle/gallery/Imagery Layers Texture Filters.html @@ -1,103 +1,127 @@ - - - - - - + + + + + + Cesium Demo - + - - - - - -
-
-
-

Loading...

-
- - - - + } + + +
+
+
+

Loading...

+
+ + + diff --git a/Apps/Sandcastle/gallery/Imagery Layers.html b/Apps/Sandcastle/gallery/Imagery Layers.html index 97b90d3eb489..c2cd66dcfb26 100644 --- a/Apps/Sandcastle/gallery/Imagery Layers.html +++ b/Apps/Sandcastle/gallery/Imagery Layers.html @@ -1,51 +1,71 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + layers.addImageryProvider( + new Cesium.SingleTileImageryProvider({ + url: "../images/Cesium_Logo_overlay.png", + rectangle: Cesium.Rectangle.fromDegrees(-75.0, 28.0, -67.0, 29.75), + }) + ); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Interpolation.html b/Apps/Sandcastle/gallery/Interpolation.html index a0c6137f7e94..7ec4060c410e 100644 --- a/Apps/Sandcastle/gallery/Interpolation.html +++ b/Apps/Sandcastle/gallery/Interpolation.html @@ -1,167 +1,211 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
-
- - + + //Add a combo box for selecting each interpolation mode. + Sandcastle.addToolbarMenu( + [ + { + text: "Interpolation: Linear Approximation", + onselect: function () { + entity.position.setInterpolationOptions({ + interpolationDegree: 1, + interpolationAlgorithm: Cesium.LinearApproximation, + }); + }, + }, + { + text: "Interpolation: Lagrange Polynomial Approximation", + onselect: function () { + entity.position.setInterpolationOptions({ + interpolationDegree: 5, + interpolationAlgorithm: + Cesium.LagrangePolynomialApproximation, + }); + }, + }, + { + text: "Interpolation: Hermite Polynomial Approximation", + onselect: function () { + entity.position.setInterpolationOptions({ + interpolationDegree: 2, + interpolationAlgorithm: Cesium.HermitePolynomialApproximation, + }); + }, + }, + ], + "interpolationMenu" + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/KML Tours.html b/Apps/Sandcastle/gallery/KML Tours.html index 84a7f66f4936..07518f18529a 100644 --- a/Apps/Sandcastle/gallery/KML Tours.html +++ b/Apps/Sandcastle/gallery/KML Tours.html @@ -1,73 +1,90 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + Sandcastle.reset = function () { + viewer.dataSources.removeAll(); + viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED; + viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK; + }; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/KML.html b/Apps/Sandcastle/gallery/KML.html index 7d7401948494..a35f6d39abb2 100644 --- a/Apps/Sandcastle/gallery/KML.html +++ b/Apps/Sandcastle/gallery/KML.html @@ -1,74 +1,108 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
+ + + +
+

Loading...

+
- - + Sandcastle.reset = function () { + viewer.dataSources.removeAll(); + viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED; + viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK; + }; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Labels SDF.html b/Apps/Sandcastle/gallery/Labels SDF.html index d5baf3f00a59..1f450614fefa 100644 --- a/Apps/Sandcastle/gallery/Labels SDF.html +++ b/Apps/Sandcastle/gallery/Labels SDF.html @@ -1,142 +1,177 @@ - - - - - - + + + + + + Cesium Demo - + - - -
-

Loading...

+

Loading...

- - - - - - - - - - - - - - - - - - -
Outline - - -
Scale - - -
Outline Color
Color
+ + + + + + + + + + + + + + + + + + +
Outline + + +
Scale + + +
Outline Color
Color + +
- + fontSize += fontDelta; + if (fontSize >= maxFontSize || fontSize <= minFontSize) { + fontDelta *= -1.0; + } + morgantown.font = fontSize + "px Calibri"; + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Labels.html b/Apps/Sandcastle/gallery/Labels.html index 78597d5db081..0d7027829ffe 100644 --- a/Apps/Sandcastle/gallery/Labels.html +++ b/Apps/Sandcastle/gallery/Labels.html @@ -1,186 +1,231 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Sandcastle.reset = function () { + viewer.entities.removeAll(); + }; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/LensFlare.html b/Apps/Sandcastle/gallery/LensFlare.html index 2db44c81fffd..73d696410077 100644 --- a/Apps/Sandcastle/gallery/LensFlare.html +++ b/Apps/Sandcastle/gallery/LensFlare.html @@ -1,101 +1,179 @@  - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - - - - - - - - - - - -
Lens Flare
Intensity
Distortion
Dispersion
Halo Width
Dirt Amount
-
- - + viewer.clock.currentTime = new Cesium.JulianDate( + 2458047, + 27399.860215000022 + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Lighting.html b/Apps/Sandcastle/gallery/Lighting.html index 7ce10d3ede29..dba5f86d7c52 100644 --- a/Apps/Sandcastle/gallery/Lighting.html +++ b/Apps/Sandcastle/gallery/Lighting.html @@ -1,173 +1,238 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/LocalToFixedFrame.html b/Apps/Sandcastle/gallery/LocalToFixedFrame.html index 48ccab69bae4..6a1217bad89e 100644 --- a/Apps/Sandcastle/gallery/LocalToFixedFrame.html +++ b/Apps/Sandcastle/gallery/LocalToFixedFrame.html @@ -1,233 +1,290 @@ - - - - - - + + + + + + Cesium Demo - + - - -
-

Loading...

+

Loading...

- - - - - - - - - - - - - - - - - - - - - - - - -
Click on the 3D window then use the keyboard to change settings.
Heading: °
← to left/→ to right
Pitch: °
↑ to up/↓ to down
roll: °
← + ⇧ left/→ + ⇧ right
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Click on the 3D window then use the keyboard to change settings. +
Heading: °
← to left/→ to right
Pitch: °
↑ to up/↓ to down
roll: °
← + ⇧ left/→ + ⇧ right
- + viewer.scene.preRender.addEventListener(function (scene, time) { + headingSpan.innerHTML = Cesium.Math.toDegrees(hpRoll.heading).toFixed( + 1 + ); + pitchSpan.innerHTML = Cesium.Math.toDegrees(hpRoll.pitch).toFixed(1); + rollSpan.innerHTML = Cesium.Math.toDegrees(hpRoll.roll).toFixed(1); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Map Pins.html b/Apps/Sandcastle/gallery/Map Pins.html index 42fd840935ad..b7b9cd1704ef 100644 --- a/Apps/Sandcastle/gallery/Map Pins.html +++ b/Apps/Sandcastle/gallery/Map Pins.html @@ -1,85 +1,107 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Materials.html b/Apps/Sandcastle/gallery/Materials.html index 2bdc6e6fb2f3..ff2071f62b6f 100644 --- a/Apps/Sandcastle/gallery/Materials.html +++ b/Apps/Sandcastle/gallery/Materials.html @@ -1,533 +1,603 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + ); + + var polylines = scene.primitives.add(new Cesium.PolylineCollection()); + polyline = polylines.add({ + positions: Cesium.PolylinePipeline.generateCartesianArc({ + positions: Cesium.Cartesian3.fromDegreesArray([ + -110.0, + 42.0, + -85.0, + 36.0, + -100.0, + 25.0, + -77.0, + 12.0, + ]), + }), + width: 10.0, + show: false, + }); + } + + var viewer = new Cesium.Viewer("cesiumContainer"); + var scene = viewer.scene; + + createPrimitives(scene); + createButtons(scene); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Montreal Point Cloud.html b/Apps/Sandcastle/gallery/Montreal Point Cloud.html index d66855864d84..75f362977c8d 100644 --- a/Apps/Sandcastle/gallery/Montreal Point Cloud.html +++ b/Apps/Sandcastle/gallery/Montreal Point Cloud.html @@ -1,319 +1,434 @@ - - - - - - + + + + + + Montreal Point Cloud - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Classification Types
Ground
Low Vegetation
Medium Vegetation
High Vegetation
Buildings
Other/Unclassified
-
- - + applyStyle(tileset, pointStyles); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Multi-part CZML.html b/Apps/Sandcastle/gallery/Multi-part CZML.html index fa4b0d9c094a..5d0144306916 100644 --- a/Apps/Sandcastle/gallery/Multi-part CZML.html +++ b/Apps/Sandcastle/gallery/Multi-part CZML.html @@ -1,150 +1,181 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - + + // Load the first part up front. + processPart(partsToLoad[0]); + + // Load a new section before the clock naturally gets there. + // Note this can't predict when a user may fast-forward to it. + var preloadTimeInSeconds = 100; + + viewer.clock.onTick.addEventListener(function (clock) { + // This example uses time offsets from the start to identify which parts need loading. + var timeOffset = Cesium.JulianDate.secondsDifference( + clock.currentTime, + clock.startTime + ); + + // Filter the list of parts to just the ones that need loading right now. + // Then, process each part that needs loading. + partsToLoad + .filter(function (part) { + return ( + !part.requested && + timeOffset >= part.range[0] - preloadTimeInSeconds && + timeOffset <= part.range[1] + ); + }) + .forEach(function (part) { + processPart(part); + }); + + if (vehicleEntity) { + var fuel = vehicleEntity.properties.fuel_remaining.getValue( + clock.currentTime + ); + if (Cesium.defined(fuel)) { + fuelDisplay.textContent = "Fuel: " + fuel.toFixed(2) + " gal"; + } + } + }); + + // Add a reset button, for convenience. + Sandcastle.addToolbarButton("Reset demo", function () { + // Put things back to the starting position. + viewer.clock.currentTime = viewer.clock.startTime; + viewer.clock.shouldAnimate = true; + + partsToLoad.forEach(function (part) { + part.requested = false; + part.loaded = false; + }); + + dataSource.entities.removeAll(); + processPart(partsToLoad[0]); + }); + + // Show the status display below the reset button. + statusDisplay.style.background = "rgba(42, 42, 42, 0.7)"; + statusDisplay.style.padding = "5px 10px"; + document.getElementById("toolbar").appendChild(statusDisplay); + + // Show a multi-part custom property being read from CZML. + fuelDisplay.style.background = "rgba(42, 42, 42, 0.7)"; + fuelDisplay.style.padding = "5px 10px"; + fuelDisplay.style.marginTop = "5px"; + document.getElementById("toolbar").appendChild(fuelDisplay); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Multiple Synced Views.html b/Apps/Sandcastle/gallery/Multiple Synced Views.html index 6d19cda72eb6..8f7aace8cefe 100644 --- a/Apps/Sandcastle/gallery/Multiple Synced Views.html +++ b/Apps/Sandcastle/gallery/Multiple Synced Views.html @@ -1,107 +1,129 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-
-
-
-

Loading...

-
- - + // Since the 2D view follows the 3D view, we disable any + // camera movement on the 2D view + view2D.scene.screenSpaceCameraController.enableRotate = false; + view2D.scene.screenSpaceCameraController.enableTranslate = false; + view2D.scene.screenSpaceCameraController.enableZoom = false; + view2D.scene.screenSpaceCameraController.enableTilt = false; + view2D.scene.screenSpaceCameraController.enableLook = false; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Natural Earth II.html b/Apps/Sandcastle/gallery/Natural Earth II.html index 2ba868867226..61274cc5c264 100644 --- a/Apps/Sandcastle/gallery/Natural Earth II.html +++ b/Apps/Sandcastle/gallery/Natural Earth II.html @@ -1,38 +1,51 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/Offline.html b/Apps/Sandcastle/gallery/Offline.html index 353e32cb57ac..983b07bef1f4 100644 --- a/Apps/Sandcastle/gallery/Offline.html +++ b/Apps/Sandcastle/gallery/Offline.html @@ -1,46 +1,59 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var viewer = new Cesium.Viewer("cesiumContainer", { + imageryProvider: new Cesium.TileMapServiceImageryProvider({ + url: Cesium.buildModuleUrl("Assets/Textures/NaturalEarthII"), + }), + baseLayerPicker: false, + geocoder: false, + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/PAMAP Terrain.html b/Apps/Sandcastle/gallery/PAMAP Terrain.html index 6108e312747e..8bac5ebef9eb 100644 --- a/Apps/Sandcastle/gallery/PAMAP Terrain.html +++ b/Apps/Sandcastle/gallery/PAMAP Terrain.html @@ -1,104 +1,146 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + // Add PA locations + Sandcastle.addDefaultToolbarMenu( + [ + { + text: "Pinnacle", + onselect: function () { + viewer.scene.camera.flyTo({ + destination: Cesium.Cartesian3.fromRadians( + -1.3324415110874286, + 0.6954224325279967, + 236.6770689945084 + ), + orientation: { + heading: Cesium.Math.toRadians(310), + pitch: Cesium.Math.toRadians(-15), + roll: 0.0, + }, + }); + }, + }, + { + text: "Mount Nittany", + onselect: function () { + viewer.scene.camera.flyTo({ + destination: Cesium.Cartesian3.fromRadians( + -1.358985133937573, + 0.7123252393978314, + 451.05748252867375 + ), + orientation: { + heading: Cesium.Math.toRadians(85), + pitch: Cesium.Math.toRadians(0), + roll: 0.0, + }, + }); + }, + }, + { + text: "Horseshoe Curve", + onselect: function () { + viewer.scene.camera.flyTo({ + destination: Cesium.Cartesian3.fromRadians( + -1.3700147546199826, + 0.706808606166025, + 993.7916313325215 + ), + orientation: { + heading: Cesium.Math.toRadians(90), + pitch: Cesium.Math.toRadians(-15), + roll: 0.0, + }, + }); + }, + }, + { + text: "Jim Thorpe", + onselect: function () { + viewer.scene.camera.flyTo({ + destination: Cesium.Cartesian3.fromRadians( + -1.3218297501066052, + 0.713358272291525, + 240.87968743408845 + ), + orientation: { + heading: Cesium.Math.toRadians(200), + pitch: Cesium.Math.toRadians(-5), + roll: 0.0, + }, + }); + }, + }, + { + text: "Grand Canyon of PA", + onselect: function () { + viewer.scene.camera.flyTo({ + destination: Cesium.Cartesian3.fromRadians( + -1.349379633251472, + 0.720297672225785, + 656.268309953562 + ), + orientation: { + heading: Cesium.Math.toRadians(200), + pitch: Cesium.Math.toRadians(-5), + roll: 0.0, + }, + }); + }, + }, + ], + "toolbar" + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Parallels and Meridians.html b/Apps/Sandcastle/gallery/Parallels and Meridians.html index de80b090b084..d74f92672673 100644 --- a/Apps/Sandcastle/gallery/Parallels and Meridians.html +++ b/Apps/Sandcastle/gallery/Parallels and Meridians.html @@ -1,231 +1,322 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + function makeGrid(numberOfDivisions, color, show) { + var parallels = makeParallelsRecursive( + -90, + 90, + numberOfDivisions, + color + ); + var meridians = makeMeridiansRecursive( + -180, + 180, + numberOfDivisions, + color + ); + meridians.push(meridian(180, color)); + + var allLines = parallels.concat(meridians); + allLines.forEach(function (line) { + line.show = show; + }); + + return allLines; + } + + function makeParallelsRecursive( + minLatitude, + maxLatitude, + depth, + color + ) { + var result = []; + var midpoint = (minLatitude + maxLatitude) / 2; + result.push(parallel(midpoint, color)); + + if (depth > 0) { + var southernLines = makeParallelsRecursive( + minLatitude, + midpoint, + depth - 1, + color + ); + var northernLines = makeParallelsRecursive( + midpoint, + maxLatitude, + depth - 1, + color + ); + result = southernLines.concat(result, northernLines); + } + + return result; + } + + function makeMeridiansRecursive( + minLongitude, + maxLongitude, + depth, + color + ) { + var result = []; + var midpoint = (minLongitude + maxLongitude) / 2; + result.push(meridian(midpoint, color)); + + if (depth > 0) { + var westernLines = makeMeridiansRecursive( + minLongitude, + midpoint, + depth - 1, + color + ); + var easternLines = makeMeridiansRecursive( + midpoint, + maxLongitude, + depth - 1, + color + ); + result = westernLines.concat(result, easternLines); + } + + return result; + } + + var showAntipodalPoint = false; + var primitives = { + equator: parallel(0, Cesium.Color.BLUE), + primeMeridian: meridian(0, Cesium.Color.BLUE), + selectedPoint: { + meridian: undefined, + parallel: undefined, + label: undefined, + }, + antipodalPoint: { + meridian: undefined, + parallel: undefined, + label: undefined, + }, + lowResolutionGrid: makeGrid(2, Cesium.Color.PALEGREEN, false), + higherResolutionGrid: makeGrid(5, Cesium.Color.DARKORANGE, false), + }; + + function updateCrosshairs(cartographic) { + var selectedPoint = primitives.selectedPoint; + var antipodalPoint = primitives.antipodalPoint; + if (Cesium.defined(selectedPoint.parallel)) { + viewer.entities.remove(selectedPoint.parallel); + viewer.entities.remove(selectedPoint.meridian); + viewer.entities.remove(selectedPoint.label); + viewer.entities.remove(antipodalPoint.parallel); + viewer.entities.remove(antipodalPoint.meridian); + viewer.entities.remove(antipodalPoint.label); + } + + var pointLatitude = toDegrees(cartographic.latitude); + var antipodeLatitude = -pointLatitude; + + var pointLongitude = toDegrees(cartographic.longitude); + var antipodeLongitude = (pointLongitude + 180) % 360; + + // Increase the granularity to improve accuracy when zoomed in + var finerGranularity = 0.001; + var red = Cesium.Color.RED; + selectedPoint.parallel = parallel( + toDegrees(cartographic.latitude), + red, + finerGranularity + ); + selectedPoint.meridian = meridian( + toDegrees(cartographic.longitude), + red, + finerGranularity + ); + selectedPoint.label = labelCoordinates(cartographic); + + var cyan = Cesium.Color.CYAN; + var antipode = new Cesium.Cartographic.fromDegrees( + antipodeLongitude, + antipodeLatitude, + 0 + ); + antipodalPoint.parallel = parallel( + antipodeLatitude, + cyan, + finerGranularity + ); + antipodalPoint.meridian = meridian( + antipodeLongitude, + cyan, + finerGranularity + ); + antipodalPoint.label = labelCoordinates(antipode); + + antipodalPoint.parallel.show = showAntipodalPoint; + antipodalPoint.meridian.show = showAntipodalPoint; + antipodalPoint.label.show = showAntipodalPoint; + } + + // Click to shift the cross-hairs + viewer.screenSpaceEventHandler.setInputAction(function (mouse) { + viewer.scene.pick(mouse.position); + var ray = viewer.camera.getPickRay(mouse.position); + var globe = viewer.scene.globe; + var cartesian = globe.pick(ray, viewer.scene); + + if (!Cesium.defined(cartesian)) { + return; + } + + var cartographic = Cesium.Cartographic.fromCartesian(cartesian); + updateCrosshairs(cartographic); + }, Cesium.ScreenSpaceEventType.LEFT_CLICK); + + Sandcastle.addToggleButton("Show equator", true, function (checked) { + primitives.equator.show = checked; + }); + + Sandcastle.addToggleButton("Show prime meridian", true, function ( + checked + ) { + primitives.primeMeridian.show = checked; + }); + + Sandcastle.addToggleButton("Show low-resolution grid", false, function ( + checked + ) { + primitives.lowResolutionGrid.forEach(function (line) { + line.show = checked; + }); + }); + + Sandcastle.addToggleButton( + "Show higher-resolution grid", + false, + function (checked) { + primitives.higherResolutionGrid.forEach(function (line) { + line.show = checked; + }); + } + ); + + Sandcastle.addToggleButton("Show antipodal point", false, function ( + checked + ) { + showAntipodalPoint = checked; + var antipodalPoint = primitives.antipodalPoint; + + if (Cesium.defined(antipodalPoint.parallel)) { + antipodalPoint.parallel.show = showAntipodalPoint; + antipodalPoint.meridian.show = showAntipodalPoint; + antipodalPoint.label.show = showAntipodalPoint; + } + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Partial Ellipsoids.html b/Apps/Sandcastle/gallery/Partial Ellipsoids.html index cd6354a3a7f9..b825e9bde071 100644 --- a/Apps/Sandcastle/gallery/Partial Ellipsoids.html +++ b/Apps/Sandcastle/gallery/Partial Ellipsoids.html @@ -1,200 +1,225 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Particle System Fireworks.html b/Apps/Sandcastle/gallery/Particle System Fireworks.html index 56ae8da0ba4e..d1d017232705 100644 --- a/Apps/Sandcastle/gallery/Particle System Fireworks.html +++ b/Apps/Sandcastle/gallery/Particle System Fireworks.html @@ -1,168 +1,223 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - + + var minimumExplosionSize = 30.0; + var maximumExplosionSize = 100.0; + var particlePixelSize = new Cesium.Cartesian2(7.0, 7.0); + var burstSize = 400.0; + var lifetime = 10.0; + var numberOfFireworks = 20.0; + + var emitterModelMatrixScratch = new Cesium.Matrix4(); + + function createFirework(offset, color, bursts) { + var position = Cesium.Cartesian3.add( + emitterInitialLocation, + offset, + new Cesium.Cartesian3() + ); + var emitterModelMatrix = Cesium.Matrix4.fromTranslation( + position, + emitterModelMatrixScratch + ); + var particleToWorld = Cesium.Matrix4.multiply( + modelMatrix, + emitterModelMatrix, + new Cesium.Matrix4() + ); + var worldToParticle = Cesium.Matrix4.inverseTransformation( + particleToWorld, + particleToWorld + ); + + var size = Cesium.Math.randomBetween( + minimumExplosionSize, + maximumExplosionSize + ); + var particlePositionScratch = new Cesium.Cartesian3(); + var force = function (particle) { + var position = Cesium.Matrix4.multiplyByPoint( + worldToParticle, + particle.position, + particlePositionScratch + ); + if (Cesium.Cartesian3.magnitudeSquared(position) >= size * size) { + Cesium.Cartesian3.clone( + Cesium.Cartesian3.ZERO, + particle.velocity + ); + } + }; + + var normalSize = + (size - minimumExplosionSize) / + (maximumExplosionSize - minimumExplosionSize); + var minLife = 0.3; + var maxLife = 1.0; + var life = normalSize * (maxLife - minLife) + minLife; + + scene.primitives.add( + new Cesium.ParticleSystem({ + image: getImage(), + startColor: color, + endColor: color.withAlpha(0.0), + particleLife: life, + speed: 100.0, + imageSize: particlePixelSize, + emissionRate: 0, + emitter: new Cesium.SphereEmitter(0.1), + bursts: bursts, + lifetime: lifetime, + updateCallback: force, + modelMatrix: modelMatrix, + emitterModelMatrix: emitterModelMatrix, + }) + ); + } + + var xMin = -100.0; + var xMax = 100.0; + var yMin = -80.0; + var yMax = 100.0; + var zMin = -50.0; + var zMax = 50.0; + + var colorOptions = [ + { + minimumRed: 0.75, + green: 0.0, + minimumBlue: 0.8, + alpha: 1.0, + }, + { + red: 0.0, + minimumGreen: 0.75, + minimumBlue: 0.8, + alpha: 1.0, + }, + { + red: 0.0, + green: 0.0, + minimumBlue: 0.8, + alpha: 1.0, + }, + { + minimumRed: 0.75, + minimumGreen: 0.75, + blue: 0.0, + alpha: 1.0, + }, + ]; + + for (var i = 0; i < numberOfFireworks; ++i) { + var x = Cesium.Math.randomBetween(xMin, xMax); + var y = Cesium.Math.randomBetween(yMin, yMax); + var z = Cesium.Math.randomBetween(zMin, zMax); + var offset = new Cesium.Cartesian3(x, y, z); + var color = Cesium.Color.fromRandom( + colorOptions[i % colorOptions.length] + ); + + var bursts = []; + for (var j = 0; j < 3; ++j) { + bursts.push( + new Cesium.ParticleBurst({ + time: Cesium.Math.nextRandomNumber() * lifetime, + minimum: burstSize, + maximum: burstSize, + }) + ); + } + + createFirework(offset, color, bursts); + } + + var camera = viewer.scene.camera; + var cameraOffset = new Cesium.Cartesian3(-300.0, 0.0, 0.0); + camera.lookAtTransform(modelMatrix, cameraOffset); + camera.lookAtTransform(Cesium.Matrix4.IDENTITY); + + var toFireworks = Cesium.Cartesian3.subtract( + emitterInitialLocation, + cameraOffset, + new Cesium.Cartesian3() + ); + Cesium.Cartesian3.normalize(toFireworks, toFireworks); + var angle = + Cesium.Math.PI_OVER_TWO - + Math.acos( + Cesium.Cartesian3.dot(toFireworks, Cesium.Cartesian3.UNIT_Z) + ); + camera.lookUp(angle); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Particle System Tails.html b/Apps/Sandcastle/gallery/Particle System Tails.html index 53658e9142b9..fef93f5eac1e 100644 --- a/Apps/Sandcastle/gallery/Particle System Tails.html +++ b/Apps/Sandcastle/gallery/Particle System Tails.html @@ -1,221 +1,308 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- + scratchCartesian3 = Cesium.Cartesian3.add( + particle.position, + scratchCartesian3, + scratchCartesian3 + ); + + scratchCartographic = Cesium.Cartographic.fromCartesian( + scratchCartesian3, + Cesium.Ellipsoid.WGS84, + scratchCartographic + ); + + var angle = + (Cesium.Math.PI * 2.0 * iteration) / options.numberOfSystems; + iteration += options.iterationOffset; + scratchCartographic.longitude += + Math.cos(angle) * options.cartographicStep * 30.0 * dt; + scratchCartographic.latitude += + Math.sin(angle) * options.cartographicStep * 30.0 * dt; + + particle.position = Cesium.Cartographic.toCartesian( + scratchCartographic + ); + }; + }; + + var matrix4Scratch = new Cesium.Matrix4(); + var scratchAngleForOffset = 0.0; + var scratchOffset = new Cesium.Cartesian3(); + var imageSize = new Cesium.Cartesian2(15.0, 15.0); + function createParticleSystems(options, systemsArray) { + var length = options.numberOfSystems; + for (var i = 0; i < length; ++i) { + scratchAngleForOffset = + (Math.PI * 2.0 * i) / options.numberOfSystems; + scratchOffset.x += + options.baseRadius * Math.cos(scratchAngleForOffset); + scratchOffset.y += + options.baseRadius * Math.sin(scratchAngleForOffset); + + var emitterModelMatrix = Cesium.Matrix4.fromTranslation( + scratchOffset, + matrix4Scratch + ); + var color = Cesium.Color.fromRandom( + options.colorOptions[i % options.colorOptions.length] + ); + var force = forceFunction(options, i); + + var item = viewer.scene.primitives.add( + new Cesium.ParticleSystem({ + image: getImage(), + startColor: color, + endColor: color.withAlpha(0.0), + particleLife: 3.5, + speed: 0.00005, + imageSize: imageSize, + emissionRate: 30.0, + emitter: new Cesium.CircleEmitter(0.1), + lifetime: 0.1, + updateCallback: force, + modelMatrix: particlesModelMatrix, + emitterModelMatrix: emitterModelMatrix, + }) + ); + systemsArray.push(item); + } + } + + var rocketSystems = []; + var cometSystems = []; + createParticleSystems(rocketOptions, rocketSystems); + createParticleSystems(cometOptions, cometSystems); + + // toolbar elements + function showAll(systemsArray, show) { + var length = systemsArray.length; + for (var i = 0; i < length; ++i) { + systemsArray[i].show = show; + } + } + + var options = [ + { + text: "Comet Tail", + onselect: function () { + showAll(rocketSystems, false); + showAll(cometSystems, true); + resetCamera(); + }, + }, + { + text: "Rocket Thruster", + onselect: function () { + showAll(cometSystems, false); + showAll(rocketSystems, true); + resetCamera(); + }, + }, + ]; + Sandcastle.addToolbarMenu(options); + //Sandcastle_End + Sandcastle.finishedLoading(); + } - + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Particle System Weather.html b/Apps/Sandcastle/gallery/Particle System Weather.html index 22d9b5f8a900..e01473f95a86 100644 --- a/Apps/Sandcastle/gallery/Particle System Weather.html +++ b/Apps/Sandcastle/gallery/Particle System Weather.html @@ -1,164 +1,224 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
- - - + Sandcastle.finishedLoading(); + } + + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Particle System.html b/Apps/Sandcastle/gallery/Particle System.html index 5da1e635797e..6efe7dd61741 100644 --- a/Apps/Sandcastle/gallery/Particle System.html +++ b/Apps/Sandcastle/gallery/Particle System.html @@ -1,345 +1,471 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- + } + +
+

Loading...

+
+
- + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + -
Rate - - + +
Size - - + +
Min Life - - + +
Max Life - - + +
Min Speed - - + +
Max Speed - - + +
Start Scale - - + +
End Scale - - + +
Gravity - - + +
-
- - - + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Per-Feature Post Processing.html b/Apps/Sandcastle/gallery/Per-Feature Post Processing.html index df8a647769d7..dadb74b2d059 100644 --- a/Apps/Sandcastle/gallery/Per-Feature Post Processing.html +++ b/Apps/Sandcastle/gallery/Per-Feature Post Processing.html @@ -1,95 +1,119 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + removeMouseOver(blackAndWhite); + addMouseOver(silhouette); + }, + }, + ]); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Physically-Based Materials.html b/Apps/Sandcastle/gallery/Physically-Based Materials.html index 8538ce6fcc3c..83d5b9c81cf7 100644 --- a/Apps/Sandcastle/gallery/Physically-Based Materials.html +++ b/Apps/Sandcastle/gallery/Physically-Based Materials.html @@ -1,149 +1,203 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.scene.camera.flyTo({ + destination: frontView.destination, + orientation: frontView.orientation, + duration: 5.0, + pitchAdjustHeight: 20, + }); + Sandcastle.addToolbarMenu( + [ + { + text: "Front reflection", + onselect: function () { + viewer.scene.camera.flyTo(frontView); + viewer.clockViewModel.clock.currentTime = Cesium.JulianDate.fromIso8601( + "2017-07-11T20:00:00Z" + ); + }, + }, + { + text: "Three quarters sunrise", + onselect: function () { + viewer.scene.camera.flyTo(threeQuartersView); + viewer.clockViewModel.clock.currentTime = Cesium.JulianDate.fromIso8601( + "2017-07-11T11:00:00Z" + ); + }, + }, + { + text: "Top reflection", + onselect: function () { + viewer.scene.camera.flyTo(topView); + viewer.clockViewModel.clock.currentTime = Cesium.JulianDate.fromIso8601( + "2017-07-11T12:00:00Z" + ); + }, + }, + { + text: "Upward angle side reflection", + onselect: function () { + viewer.scene.camera.flyTo(upwardsView); + viewer.clockViewModel.clock.currentTime = Cesium.JulianDate.fromIso8601( + "2017-07-11T23:00:00Z" + ); + }, + }, + ], + "toolbar" + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Picking.html b/Apps/Sandcastle/gallery/Picking.html index 51d844e72123..3dfe44a0e3a9 100644 --- a/Apps/Sandcastle/gallery/Picking.html +++ b/Apps/Sandcastle/gallery/Picking.html @@ -1,227 +1,298 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + if (!foundPosition) { + labelEntity.label.show = false; + } + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); + }); + + Sandcastle.reset = function () { + viewer.entities.removeAll(); + handler = handler && handler.destroy(); + }; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Plane.html b/Apps/Sandcastle/gallery/Plane.html index ba0365e4bc82..c9635c22db5b 100644 --- a/Apps/Sandcastle/gallery/Plane.html +++ b/Apps/Sandcastle/gallery/Plane.html @@ -1,71 +1,81 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Points.html b/Apps/Sandcastle/gallery/Points.html index c2dd0d5024d0..41ddba9b856e 100644 --- a/Apps/Sandcastle/gallery/Points.html +++ b/Apps/Sandcastle/gallery/Points.html @@ -1,171 +1,197 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Sandcastle.reset = function () { + viewer.entities.removeAll(); + }; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Polygon.html b/Apps/Sandcastle/gallery/Polygon.html index 39ac9a09dec5..3f9ad07ab6f8 100644 --- a/Apps/Sandcastle/gallery/Polygon.html +++ b/Apps/Sandcastle/gallery/Polygon.html @@ -1,145 +1,216 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Polyline Dash.html b/Apps/Sandcastle/gallery/Polyline Dash.html index cdbde74b3541..57c16628124b 100644 --- a/Apps/Sandcastle/gallery/Polyline Dash.html +++ b/Apps/Sandcastle/gallery/Polyline Dash.html @@ -1,101 +1,141 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Polyline Volume.html b/Apps/Sandcastle/gallery/Polyline Volume.html index a45e53e4b890..e863c4aa6c16 100644 --- a/Apps/Sandcastle/gallery/Polyline Volume.html +++ b/Apps/Sandcastle/gallery/Polyline Volume.html @@ -1,97 +1,141 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Polyline.html b/Apps/Sandcastle/gallery/Polyline.html index a6a4405b7b80..ad7dd8870b5b 100644 --- a/Apps/Sandcastle/gallery/Polyline.html +++ b/Apps/Sandcastle/gallery/Polyline.html @@ -1,110 +1,141 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Polylines on 3D Tiles.html b/Apps/Sandcastle/gallery/Polylines on 3D Tiles.html index 187da1c1644a..cd4d63e39cc5 100644 --- a/Apps/Sandcastle/gallery/Polylines on 3D Tiles.html +++ b/Apps/Sandcastle/gallery/Polylines on 3D Tiles.html @@ -1,118 +1,150 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + Sandcastle.addToolbarMenu([ + { + text: "BIM", + onselect: function () { + building.show = false; + route.polyline.show = false; + powerplant.show = true; + pipes.polyline.show = true; + scene.camera.setView({ + destination: new Cesium.Cartesian3( + 1234151.4883992162, + -5086036.79436967, + 3633328.4278331124 + ), + orientation: { + heading: 5.593695742186853, + pitch: -1.0786797635545216, + roll: 6.27892466154778, + }, + }); + }, + }, + { + text: "Photogrammetry", + onselect: function () { + building.show = true; + route.polyline.show = true; + powerplant.show = false; + pipes.polyline.show = false; + scene.camera.setView({ + destination: new Cesium.Cartesian3( + 1216596.5376729995, + -4736445.416889214, + 4081406.990364228 + ), + orientation: { + heading: 5.153176564030707, + pitch: -0.9701972964526693, + roll: 6.277883257569513, + }, + }); + }, + }, + ]); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Post Processing.html b/Apps/Sandcastle/gallery/Post Processing.html index fd44469c931c..6497df6d9f1b 100644 --- a/Apps/Sandcastle/gallery/Post Processing.html +++ b/Apps/Sandcastle/gallery/Post Processing.html @@ -1,107 +1,160 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - - - - - -
Silhouette
Black and White
Brightness
Night Vision
-
- - + function updatePostProcess() { + silhouette.enabled = Boolean(viewModel.silhouette); + silhouette.uniforms.color = Cesium.Color.YELLOW; + blackAndWhite.enabled = Boolean(viewModel.blackAndWhiteShow); + blackAndWhite.uniforms.gradations = Number( + viewModel.blackAndWhiteGradations + ); + brightness.enabled = Boolean(viewModel.brightnessShow); + brightness.uniforms.brightness = Number(viewModel.brightnessValue); + nightVision.enabled = Boolean(viewModel.nightVisionShow); + } + updatePostProcess(); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Projection.html b/Apps/Sandcastle/gallery/Projection.html index 2aee7e3e8a80..922449ec234d 100644 --- a/Apps/Sandcastle/gallery/Projection.html +++ b/Apps/Sandcastle/gallery/Projection.html @@ -1,56 +1,80 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var entity = viewer.entities.add({ + position: position, + orientation: orientation, + model: { + uri: "../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.glb", + minimumPixelSize: 128, + maximumScale: 20000, + }, + }); + viewer.trackedEntity = entity; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Rectangle.html b/Apps/Sandcastle/gallery/Rectangle.html index 4ca475bc95c1..0dc456d10859 100644 --- a/Apps/Sandcastle/gallery/Rectangle.html +++ b/Apps/Sandcastle/gallery/Rectangle.html @@ -1,75 +1,99 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Resolution Scaling.html b/Apps/Sandcastle/gallery/Resolution Scaling.html index 0bd62cdd33bf..1ba1c931a4fa 100644 --- a/Apps/Sandcastle/gallery/Resolution Scaling.html +++ b/Apps/Sandcastle/gallery/Resolution Scaling.html @@ -1,86 +1,113 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - -
Use Browser Recommended Resolution
Resolution Scale - - -
-
- - + var resolutionScale = Number(viewModel.resolutionScale); + resolutionScale = !isNaN(resolutionScale) ? resolutionScale : 1.0; + resolutionScale = Cesium.Math.clamp(resolutionScale, 0.1, 2.0); + viewer.resolutionScale = resolutionScale; + } + update(); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Rotatable 2D Map.html b/Apps/Sandcastle/gallery/Rotatable 2D Map.html index 6c0e5d67356e..7eba3c551f25 100644 --- a/Apps/Sandcastle/gallery/Rotatable 2D Map.html +++ b/Apps/Sandcastle/gallery/Rotatable 2D Map.html @@ -1,45 +1,58 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.scene.camera.setView({ + destination: Cesium.Cartesian3.fromDegrees(-73.0, 42.0, 50000000.0), + orientation: { + heading: Cesium.Math.toRadians(-45.0), + }, + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Sample Height from 3D Tiles.html b/Apps/Sandcastle/gallery/Sample Height from 3D Tiles.html index 89cb98852a28..99f4631af72b 100644 --- a/Apps/Sandcastle/gallery/Sample Height from 3D Tiles.html +++ b/Apps/Sandcastle/gallery/Sample Height from 3D Tiles.html @@ -1,98 +1,138 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Scene Rendering Performance.html b/Apps/Sandcastle/gallery/Scene Rendering Performance.html index 4824e6b6be7b..53be95b454e1 100644 --- a/Apps/Sandcastle/gallery/Scene Rendering Performance.html +++ b/Apps/Sandcastle/gallery/Scene Rendering Performance.html @@ -1,289 +1,366 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + } + +
+

Loading...

+
+
+ + - - + + - - + + - - + + - -
-

- -

- Simulation time at last render frame - +

+ +

+ Simulation time at last render frame +
-

- - requestRenderMode enabled -

- When enabled, a new frame is only rendered when scene updates occur, or a new frame is explicitly rendered. +

+ + requestRenderMode enabled +

+ When enabled, a new frame is only rendered when scene updates + occur, or a new frame is explicitly rendered.
-

- - Render when simulation time changes -

- Automatically render when the simulation time changes by "Max delta time". Adjust the simulation time on the animation widget and "Max delta time" value to see their relationship. +

+ + Render when simulation time changes +

+ Automatically render when the simulation time changes by "Max + delta time". Adjust the simulation time on the animation widget + and "Max delta time" value to see their relationship.
-

Max delta time

- - +

Max delta time

+ +
-
- - + + // Changes to the scene with the API will require + // calling requestRender() on change. + function setScenePropertiesScenario() { + resetScene(); + + scene.skyBox.show = false; + scene.backgroundColor = Cesium.Color.CORNFLOWERBLUE; + scene.requestRender(); + } + + // BEGIN SANDCASTLE EXAMPLE UI SETUP + + var toolbar = document.getElementById("toolbar"); + Cesium.knockout.track(viewModel); + Cesium.knockout.applyBindings(viewModel, toolbar); + + Cesium.knockout + .getObservable(viewModel, "requestRenderMode") + .subscribe(function (value) { + scene.requestRenderMode = value; + }); + + Cesium.knockout + .getObservable(viewModel, "timeChangeEnabled") + .subscribe(function (value) { + scene.maximumRenderTimeChange = value + ? viewModel.maximumRenderTimeChange + : Infinity; + }); + + Cesium.knockout + .getObservable(viewModel, "maximumRenderTimeChange") + .subscribe(function (value) { + scene.maximumRenderTimeChange = value; + }); + + scene.postRender.addEventListener(function () { + var time = Cesium.JulianDate.toGregorianDate(scene.lastRenderTime); + var value = + time.hour + + ":" + + time.minute + + ":" + + time.second + + ":" + + time.millisecond.toFixed(0); + Cesium.knockout.getObservable(viewModel, "lastRenderTime")(value); + }); + + var scenarios = [ + { + text: "Default view", + onselect: resetScene, + }, + { + text: "Load a 3D tileset and set the view", + onselect: loadTilesetScenario, + }, + { + text: "Mouseover picking", + onselect: pickingScenario, + }, + { + text: "Load time-dynamic CZML", + onselect: loadCzmlScenario, + }, + { + text: "Animated model", + onselect: loadModelScenario, + }, + { + text: "Scene changes with API", + onselect: setScenePropertiesScenario, + }, + ]; + + Sandcastle.addToolbarMenu(scenarios); + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Sentinel-2.html b/Apps/Sandcastle/gallery/Sentinel-2.html index ec14a7ea8770..a2fed2807dfe 100644 --- a/Apps/Sandcastle/gallery/Sentinel-2.html +++ b/Apps/Sandcastle/gallery/Sentinel-2.html @@ -1,38 +1,51 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/Shadows.html b/Apps/Sandcastle/gallery/Shadows.html index 229484af5d96..54d99af68ee6 100644 --- a/Apps/Sandcastle/gallery/Shadows.html +++ b/Apps/Sandcastle/gallery/Shadows.html @@ -1,276 +1,311 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Show or Hide Entities.html b/Apps/Sandcastle/gallery/Show or Hide Entities.html index 8f9b327031ae..56b33d276f5c 100644 --- a/Apps/Sandcastle/gallery/Show or Hide Entities.html +++ b/Apps/Sandcastle/gallery/Show or Hide Entities.html @@ -1,89 +1,99 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Sandcastle.addToolbarButton("Toggle Spheres", function () { + spheres.show = !spheres.show; + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Sky Atmosphere.html b/Apps/Sandcastle/gallery/Sky Atmosphere.html index 5627d35e3d93..aa75908505cd 100644 --- a/Apps/Sandcastle/gallery/Sky Atmosphere.html +++ b/Apps/Sandcastle/gallery/Sky Atmosphere.html @@ -1,120 +1,157 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - -
hueShift - - -
saturationShift - - -
brightnessShift - - -
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Spheres and Ellipsoids.html b/Apps/Sandcastle/gallery/Spheres and Ellipsoids.html index c1f5c6276948..d33186d3e345 100644 --- a/Apps/Sandcastle/gallery/Spheres and Ellipsoids.html +++ b/Apps/Sandcastle/gallery/Spheres and Ellipsoids.html @@ -1,70 +1,80 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Star Burst.html b/Apps/Sandcastle/gallery/Star Burst.html index d34571c322d5..a8d9efdaae97 100644 --- a/Apps/Sandcastle/gallery/Star Burst.html +++ b/Apps/Sandcastle/gallery/Star Burst.html @@ -1,325 +1,419 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
-
- - + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Terrain Clipping Planes.html b/Apps/Sandcastle/gallery/Terrain Clipping Planes.html index 119daa0de923..8a49925d6954 100644 --- a/Apps/Sandcastle/gallery/Terrain Clipping Planes.html +++ b/Apps/Sandcastle/gallery/Terrain Clipping Planes.html @@ -1,245 +1,412 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - Globe clipping planes enabled - Edge styling enabled -
- - + + function reset() { + viewer.entities.removeAll(); + viewer.scene.primitives.remove(tileset); + } + + function loadCesiumMan() { + var position = Cesium.Cartesian3.fromRadians( + -2.0862979473351286, + 0.6586620013036164, + 1400.0 + ); + + var entity = viewer.entities.add({ + position: position, + box: { + dimensions: new Cesium.Cartesian3(1400.0, 1400.0, 2800.0), + material: Cesium.Color.WHITE.withAlpha(0.3), + outline: true, + outlineColor: Cesium.Color.WHITE, + }, + }); + + viewer.entities.add({ + position: position, + model: { + uri: "../../SampleData/models/CesiumMan/Cesium_Man.glb", + minimumPixelSize: 128, + maximumScale: 800, + }, + }); + + globe.depthTestAgainstTerrain = true; + globe.clippingPlanes = new Cesium.ClippingPlaneCollection({ + modelMatrix: entity.computeModelMatrix(Cesium.JulianDate.now()), + planes: [ + new Cesium.ClippingPlane( + new Cesium.Cartesian3(1.0, 0.0, 0.0), + -700.0 + ), + new Cesium.ClippingPlane( + new Cesium.Cartesian3(-1.0, 0.0, 0.0), + -700.0 + ), + new Cesium.ClippingPlane( + new Cesium.Cartesian3(0.0, 1.0, 0.0), + -700.0 + ), + new Cesium.ClippingPlane( + new Cesium.Cartesian3(0.0, -1.0, 0.0), + -700.0 + ), + ], + edgeWidth: edgeStylingEnabled ? 1.0 : 0.0, + edgeColor: Cesium.Color.WHITE, + enabled: clippingPlanesEnabled, + }); + globe.backFaceCulling = true; + globe.showSkirts = true; + + viewer.trackedEntity = entity; + } + + function loadStHelens() { + // Create clipping planes for polygon around area to be clipped. + var points = [ + new Cesium.Cartesian3( + -2358434.3501556474, + -3743554.5012105294, + 4581080.771684084 + ), + new Cesium.Cartesian3( + -2357886.4482675144, + -3744467.562778789, + 4581020.9199767085 + ), + new Cesium.Cartesian3( + -2357299.84353055, + -3744954.0879047974, + 4581080.992360969 + ), + new Cesium.Cartesian3( + -2356412.05169956, + -3745385.3013702347, + 4580893.4737207815 + ), + new Cesium.Cartesian3( + -2355472.889436636, + -3745256.5725702164, + 4581252.3128526565 + ), + new Cesium.Cartesian3( + -2354385.7458722834, + -3744319.3823686405, + 4582372.770031389 + ), + new Cesium.Cartesian3( + -2353758.788158616, + -3743051.0128084184, + 4583356.453176038 + ), + new Cesium.Cartesian3( + -2353663.8128999653, + -3741847.9126874236, + 4584079.428665509 + ), + new Cesium.Cartesian3( + -2354213.667592133, + -3740784.50946316, + 4584502.428203525 + ), + new Cesium.Cartesian3( + -2355596.239450013, + -3739901.0226732804, + 4584515.9652557485 + ), + new Cesium.Cartesian3( + -2356942.4170108805, + -3740342.454698685, + 4583686.690694482 + ), + new Cesium.Cartesian3( + -2357529.554838029, + -3740766.995076834, + 4583145.055348843 + ), + new Cesium.Cartesian3( + -2358106.017822064, + -3741439.438418052, + 4582452.293605261 + ), + new Cesium.Cartesian3( + -2358539.5426236596, + -3742680.720902901, + 4581692.0260975715 + ), + ]; + + var pointsLength = points.length; + + // Create center points for each clipping plane + var clippingPlanes = []; + for (var i = 0; i < pointsLength; ++i) { + var nextIndex = (i + 1) % pointsLength; + var midpoint = Cesium.Cartesian3.add( + points[i], + points[nextIndex], + new Cesium.Cartesian3() + ); + midpoint = Cesium.Cartesian3.multiplyByScalar( + midpoint, + 0.5, + midpoint + ); + + var up = Cesium.Cartesian3.normalize( + midpoint, + new Cesium.Cartesian3() + ); + var right = Cesium.Cartesian3.subtract( + points[nextIndex], + midpoint, + new Cesium.Cartesian3() + ); + right = Cesium.Cartesian3.normalize(right, right); + + var normal = Cesium.Cartesian3.cross( + right, + up, + new Cesium.Cartesian3() + ); + normal = Cesium.Cartesian3.normalize(normal, normal); + + // Compute distance by pretending the plane is at the origin + var originCenteredPlane = new Cesium.Plane(normal, 0.0); + var distance = Cesium.Plane.getPointDistance( + originCenteredPlane, + midpoint + ); + + clippingPlanes.push(new Cesium.ClippingPlane(normal, distance)); + } + globe.clippingPlanes = new Cesium.ClippingPlaneCollection({ + planes: clippingPlanes, + edgeWidth: edgeStylingEnabled ? 1.0 : 0.0, + edgeColor: Cesium.Color.WHITE, + enabled: clippingPlanesEnabled, + }); + globe.backFaceCulling = true; + globe.showSkirts = true; + + // Load tileset + tileset = new Cesium.Cesium3DTileset({ + url: Cesium.IonResource.fromAssetId(5713), + }); + return tileset.readyPromise + .then(function () { + tileset.pointCloudShading.attenuation = true; + + // Adjust height so tileset is in terrain + var cartographic = Cesium.Cartographic.fromCartesian( + tileset.boundingSphere.center + ); + var surface = Cesium.Cartesian3.fromRadians( + cartographic.longitude, + cartographic.latitude, + 0.0 + ); + var offset = Cesium.Cartesian3.fromRadians( + cartographic.longitude, + cartographic.latitude, + -20.0 + ); + var translation = Cesium.Cartesian3.subtract( + offset, + surface, + new Cesium.Cartesian3() + ); + tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation); + + tileset.style = new Cesium.Cesium3DTileStyle({ + color: "rgb(207, 255, 207)", + }); + + viewer.scene.primitives.add(tileset); + + var boundingSphere = tileset.boundingSphere; + + var radius = boundingSphere.radius; + viewer.camera.viewBoundingSphere( + boundingSphere, + new Cesium.HeadingPitchRange(0.5, -0.2, radius * 4.0) + ); + viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY); + }) + .otherwise(function (error) { + throw error; + }); + } + + function loadGrandCanyon() { + // Pick a position at the Grand Canyon + var position = Cesium.Cartographic.toCartesian( + new Cesium.Cartographic.fromDegrees(-113.2665534, 36.0939345, 100) + ); + var distance = 3000.0; + var boundingSphere = new Cesium.BoundingSphere(position, distance); + + globe.clippingPlanes = new Cesium.ClippingPlaneCollection({ + modelMatrix: Cesium.Transforms.eastNorthUpToFixedFrame(position), + planes: [ + new Cesium.ClippingPlane( + new Cesium.Cartesian3(1.0, 0.0, 0.0), + distance + ), + new Cesium.ClippingPlane( + new Cesium.Cartesian3(-1.0, 0.0, 0.0), + distance + ), + new Cesium.ClippingPlane( + new Cesium.Cartesian3(0.0, 1.0, 0.0), + distance + ), + new Cesium.ClippingPlane( + new Cesium.Cartesian3(0.0, -1.0, 0.0), + distance + ), + ], + unionClippingRegions: true, + }); + globe.backFaceCulling = false; + globe.showSkirts = false; + + viewer.camera.viewBoundingSphere( + boundingSphere, + new Cesium.HeadingPitchRange(0.5, -0.5, boundingSphere.radius * 5.0) + ); + viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY); + } + + Cesium.knockout + .getObservable(viewModel, "clippingPlanesEnabled") + .subscribe(function (value) { + globe.clippingPlanes.enabled = value; + clippingPlanesEnabled = value; + }); + + Cesium.knockout + .getObservable(viewModel, "edgeStylingEnabled") + .subscribe(function (value) { + edgeStylingEnabled = value; + globe.clippingPlanes.edgeWidth = edgeStylingEnabled ? 1.0 : 0.0; + }); + + Cesium.knockout + .getObservable(viewModel, "currentExampleType") + .subscribe(function (newValue) { + reset(); + if (newValue === exampleTypes[0]) { + loadCesiumMan(); + } else if (newValue === exampleTypes[1]) { + loadStHelens(); + } else if (newValue === exampleTypes[2]) { + loadGrandCanyon(); + } + }); + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Terrain Exaggeration.html b/Apps/Sandcastle/gallery/Terrain Exaggeration.html index 3382c0480902..5e39d0fe3919 100644 --- a/Apps/Sandcastle/gallery/Terrain Exaggeration.html +++ b/Apps/Sandcastle/gallery/Terrain Exaggeration.html @@ -1,79 +1,116 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
-
- - + + Sandcastle.addDefaultToolbarMenu( + [ + { + text: "Mount Everest", + onselect: function () { + viewer.camera.setView({ + destination: new Cesium.Cartesian3( + 277096.634865404, + 5647834.481964232, + 2985563.7039122293 + ), + orientation: { + heading: 4.731089976107251, + pitch: -0.32003481981370063, + }, + }); + }, + }, + { + text: "Half Dome", + onselect: function () { + viewer.camera.setView({ + destination: new Cesium.Cartesian3( + -2497565.707296549, + -4393815.215148996, + 3886033.5140598584 + ), + orientation: { + heading: 1.6690385899673323, + pitch: -0.32086751043096884, + }, + }); + }, + }, + { + text: "San Francisco Bay", + onselect: function () { + viewer.camera.setView({ + destination: new Cesium.Cartesian3( + -2696570.092794883, + -4276051.411224011, + 3887257.288168422 + ), + orientation: { + heading: 5.193128432412409, + pitch: -0.3996479673257727, + }, + }); + var target = new Cesium.Cartesian3( + -2708814.85583248, + -4254159.450845907, + 3891403.9457429945 + ); + var offset = new Cesium.Cartesian3( + 70642.66030209465, + -31661.517948317807, + 35505.179997143336 + ); + viewer.camera.lookAt(target, offset); + viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY); + }, + }, + ], + "zoomButtons" + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Terrain.html b/Apps/Sandcastle/gallery/Terrain.html index cf1e2f9445c7..e927a609aedd 100644 --- a/Apps/Sandcastle/gallery/Terrain.html +++ b/Apps/Sandcastle/gallery/Terrain.html @@ -1,207 +1,305 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
-
-
-
- - + + Sandcastle.addToggleButton( + "Enable Lighting", + viewer.scene.globe.enableLighting, + function (checked) { + viewer.scene.globe.enableLighting = checked; + } + ); + + Sandcastle.addToggleButton( + "Enable fog", + viewer.scene.fog.enabled, + function (checked) { + viewer.scene.fog.enabled = checked; + } + ); + + Sandcastle.addToolbarButton( + "Sample Everest Terrain at Level 9", + function () { + var terrainSamplePositions = createGrid(0.005); + Cesium.when( + Cesium.sampleTerrain( + viewer.terrainProvider, + 9, + terrainSamplePositions + ), + sampleTerrainSuccess + ); + lookAtMtEverest(); + }, + "sampleButtons" + ); + + Sandcastle.addToolbarButton( + "Sample Most Detailed Everest Terrain", + function () { + if (!Cesium.defined(viewer.terrainProvider.availability)) { + window.alert( + "sampleTerrainMostDetailed is not supported for the selected terrain provider" + ); + return; + } + var terrainSamplePositions = createGrid(0.0005); + Cesium.when( + Cesium.sampleTerrainMostDetailed( + viewer.terrainProvider, + terrainSamplePositions + ), + sampleTerrainSuccess + ); + lookAtMtEverest(); + }, + "sampleButtons" + ); + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Time Dynamic Point Cloud.html b/Apps/Sandcastle/gallery/Time Dynamic Point Cloud.html index 2f1d14a992df..76e56e6f1ee0 100644 --- a/Apps/Sandcastle/gallery/Time Dynamic Point Cloud.html +++ b/Apps/Sandcastle/gallery/Time Dynamic Point Cloud.html @@ -1,87 +1,105 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo( + pointCloud, + new Cesium.HeadingPitchRange(0.0, -0.5, 50.0) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Time Dynamic Wheels.html b/Apps/Sandcastle/gallery/Time Dynamic Wheels.html index 5f74294a9c5c..c20314469e34 100644 --- a/Apps/Sandcastle/gallery/Time Dynamic Wheels.html +++ b/Apps/Sandcastle/gallery/Time Dynamic Wheels.html @@ -1,121 +1,171 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.trackedEntity = vehicleEntity; + vehicleEntity.viewFrom = new Cesium.Cartesian3(-10.0, 7.0, 4.0); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Video.html b/Apps/Sandcastle/gallery/Video.html index 8deeef009a40..e0f1aa51385f 100644 --- a/Apps/Sandcastle/gallery/Video.html +++ b/Apps/Sandcastle/gallery/Video.html @@ -1,126 +1,156 @@ - - - - - - + + + + + + Cesium Demo - + - - - + } + -
-

Loading...

-
+
+

Loading...

+
- - - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Wall.html b/Apps/Sandcastle/gallery/Wall.html index 86d57f12b84b..579a7a455b3f 100644 --- a/Apps/Sandcastle/gallery/Wall.html +++ b/Apps/Sandcastle/gallery/Wall.html @@ -1,81 +1,146 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var blueWall = viewer.entities.add({ + name: "Blue wall with sawtooth heights and outline", + wall: { + positions: Cesium.Cartesian3.fromDegreesArray([ + -115.0, + 50.0, + -112.5, + 50.0, + -110.0, + 50.0, + -107.5, + 50.0, + -105.0, + 50.0, + -102.5, + 50.0, + -100.0, + 50.0, + -97.5, + 50.0, + -95.0, + 50.0, + -92.5, + 50.0, + -90.0, + 50.0, + ]), + maximumHeights: [ + 100000, + 200000, + 100000, + 200000, + 100000, + 200000, + 100000, + 200000, + 100000, + 200000, + 100000, + ], + minimumHeights: [ + 0, + 100000, + 0, + 100000, + 0, + 100000, + 0, + 100000, + 0, + 100000, + 0, + ], + material: Cesium.Color.BLUE.withAlpha(0.5), + outline: true, + outlineColor: Cesium.Color.BLACK, + }, + }); + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Washington DC 2017.html b/Apps/Sandcastle/gallery/Washington DC 2017.html index 811fb9b0e710..24be33e8d589 100644 --- a/Apps/Sandcastle/gallery/Washington DC 2017.html +++ b/Apps/Sandcastle/gallery/Washington DC 2017.html @@ -1,39 +1,54 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var imageryLayer = viewer.imageryLayers.addImageryProvider( + new Cesium.IonImageryProvider({ assetId: 3827 }) + ); + viewer.flyTo(imageryLayer); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Web Map Service (WMS).html b/Apps/Sandcastle/gallery/Web Map Service (WMS).html index 7d201688d485..f4a9a66e649f 100644 --- a/Apps/Sandcastle/gallery/Web Map Service (WMS).html +++ b/Apps/Sandcastle/gallery/Web Map Service (WMS).html @@ -1,50 +1,71 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Start off looking at Australia. + viewer.camera.setView({ + destination: Cesium.Rectangle.fromDegrees( + 114.591, + -45.837, + 148.97, + -5.73 + ), + }); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Web Map Tile Service with Time.html b/Apps/Sandcastle/gallery/Web Map Tile Service with Time.html index 719c0c036781..fb8c0730ac8b 100644 --- a/Apps/Sandcastle/gallery/Web Map Tile Service with Time.html +++ b/Apps/Sandcastle/gallery/Web Map Tile Service with Time.html @@ -1,91 +1,105 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var clock = viewer.clock; + clock.startTime = start; + clock.stopTime = stop; + clock.currentTime = start; + clock.clockRange = Cesium.ClockRange.LOOP_STOP; + clock.multiplier = 7200; + // Make the weather layer semi-transparent to see the underlying geography. + layer.alpha = 0.5; + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/Z-Indexing Geometry.html b/Apps/Sandcastle/gallery/Z-Indexing Geometry.html index a3fa0066ce6b..db7debae352a 100644 --- a/Apps/Sandcastle/gallery/Z-Indexing Geometry.html +++ b/Apps/Sandcastle/gallery/Z-Indexing Geometry.html @@ -1,116 +1,152 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/3D Models Articulations.html b/Apps/Sandcastle/gallery/development/3D Models Articulations.html index 448585533879..72b1faf201d9 100644 --- a/Apps/Sandcastle/gallery/development/3D Models Articulations.html +++ b/Apps/Sandcastle/gallery/development/3D Models Articulations.html @@ -1,144 +1,192 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
Articulation: - -
- + value: selectedArticulation" + > + +
- - - + - + }" + /> + + + -
- + - -
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/3D Models Instancing.html b/Apps/Sandcastle/gallery/development/3D Models Instancing.html index 99d63d95b6b9..3f6a9d01938e 100644 --- a/Apps/Sandcastle/gallery/development/3D Models Instancing.html +++ b/Apps/Sandcastle/gallery/development/3D Models Instancing.html @@ -1,254 +1,314 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + function createModels(instances) { + var points = []; + var model; + + var length = instances.length; + for (var i = 0; i < length; ++i) { + var instance = instances[i]; + var modelMatrix = instance.modelMatrix; + var translation = new Cesium.Cartesian3(); + Cesium.Matrix4.getTranslation(modelMatrix, translation); + points.push(translation); + + model = scene.primitives.add( + Cesium.Model.fromGltf({ + url: url, + modelMatrix: modelMatrix, + }) + ); + + model.readyPromise + .then(function (model) { + // Play and loop all animations at half-speed + model.activeAnimations.addAll({ + multiplier: 0.5, + loop: Cesium.ModelAnimationLoop.REPEAT, + }); + }) + .otherwise(function (error) { + window.alert(error); + }); + } + + model.readyPromise.then(function (model) { + var boundingSphere = new Cesium.BoundingSphere(); + Cesium.BoundingSphere.fromPoints(points, boundingSphere); + orientCamera( + boundingSphere.center, + boundingSphere.radius + model.boundingSphere.radius + ); + }); + } + + function reset() { + scene.primitives.removeAll(); + var instances = []; + var gridSize = Math.sqrt(count); + + for (var y = 0; y < gridSize; ++y) { + for (var x = 0; x < gridSize; ++x) { + var longitude = centerLongitude + spacing * (x - gridSize / 2); + var latitude = centerLatitude + spacing * (y - gridSize / 2); + var position = Cesium.Cartesian3.fromDegrees( + longitude, + latitude, + height + ); + + var heading = Math.random(); + var pitch = Math.random(); + var roll = Math.random(); + var scale = (Math.random() + 1.0) / 2.0; + + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame( + position, + new Cesium.HeadingPitchRoll(heading, pitch, roll) + ); + Cesium.Matrix4.multiplyByUniformScale( + modelMatrix, + scale, + modelMatrix + ); + + instances.push({ + modelMatrix: modelMatrix, + }); + } + } + + if (useCollection) { + createCollection(instances); + } else { + createModels(instances); + } + } + + // Scale picked instances + var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas); + handler.setInputAction(function (movement) { + var pickedInstance = scene.pick(movement.position); + if (Cesium.defined(pickedInstance)) { + console.log(pickedInstance); + var instance = useCollection + ? pickedInstance + : pickedInstance.primitive; + var scaleMatrix = Cesium.Matrix4.fromUniformScale(1.1); + var modelMatrix = Cesium.Matrix4.multiply( + instance.modelMatrix, + scaleMatrix, + new Cesium.Matrix4() + ); + instance.modelMatrix = modelMatrix; + } + }, Cesium.ScreenSpaceEventType.LEFT_CLICK); + + Sandcastle.addToolbarMenu([ + { + text: "1024 instances", + onselect: function () { + count = 1024; + reset(); + }, + }, + { + text: "100 instances", + onselect: function () { + count = 100; + reset(); + }, + }, + { + text: "25 instances", + onselect: function () { + count = 25; + reset(); + }, + }, + { + text: "4 instances", + onselect: function () { + count = 4; + reset(); + }, + }, + { + text: "10000 instances", + onselect: function () { + count = 10000; + reset(); + }, + }, + ]); + + Sandcastle.addToolbarMenu([ + { + text: "Aircraft", + onselect: function () { + url = "../../SampleData/models/CesiumAir/Cesium_Air.glb"; + spacing = 0.0002; + reset(); + }, + }, + { + text: "Ground Vehicle", + onselect: function () { + url = "../../SampleData/models/GroundVehicle/GroundVehicle.glb"; + spacing = 0.00008; + reset(); + }, + }, + { + text: "Milk Truck", + onselect: function () { + url = + "../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.glb"; + spacing = 0.00008; + reset(); + }, + }, + { + text: "Skinned Character", + onselect: function () { + url = "../../SampleData/models/CesiumMan/Cesium_Man.glb"; + spacing = 0.00001; + reset(); + }, + }, + ]); + + Sandcastle.addToolbarMenu([ + { + text: "Instancing Enabled", + onselect: function () { + context._instancedArrays = instancedArraysExtension; + useCollection = true; + reset(); + }, + }, + { + text: "Instancing Disabled", + onselect: function () { + context._instancedArrays = undefined; + useCollection = true; + reset(); + }, + }, + { + text: "Individual models", + onselect: function () { + useCollection = false; + reset(); + }, + }, + ]); + + Sandcastle.addToolbarButton("2D", function () { + scene.morphTo2D(0.0); + }); + + Sandcastle.addToolbarButton("CV", function () { + scene.morphToColumbusView(0.0); + }); + + Sandcastle.addToolbarButton("3D", function () { + scene.morphTo3D(0.0); + }); + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html b/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html index 1674268697cf..1ce5a051ecc8 100644 --- a/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html +++ b/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html @@ -1,236 +1,377 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ Translation
X - - -
Y - - -
Z - - -
+ Rotation
H - - -
P - - -
R - - -
+ Scale
X - - -
Y - - -
Z - - -
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/3D Models.html b/Apps/Sandcastle/gallery/development/3D Models.html index 39efe87c4354..78634120d338 100644 --- a/Apps/Sandcastle/gallery/development/3D Models.html +++ b/Apps/Sandcastle/gallery/development/3D Models.html @@ -1,215 +1,306 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - - - - - -
Mode
Color
Alpha - - -
Mix - - -
-
- - + var scene = viewer.scene; + var model; + + function getColorBlendMode(colorBlendMode) { + return Cesium.ColorBlendMode[colorBlendMode.toUpperCase()]; + } + + function getColor(color) { + return Cesium.Color[color.toUpperCase()]; + } + + // The viewModel tracks the state of our mini application. + var viewModel = { + color: "White", + colors: ["White", "Red", "Green", "Blue", "Yellow", "Gray"], + alpha: 1.0, + colorBlendMode: "Highlight", + colorBlendModes: ["Highlight", "Replace", "Mix"], + colorBlendAmount: 0.5, + colorBlendAmountEnabled: false, + }; + + // Convert the viewModel members into knockout observables. + Cesium.knockout.track(viewModel); + + // Bind the viewModel to the DOM elements of the UI that call for it. + var toolbar = document.getElementById("toolbar"); + Cesium.knockout.applyBindings(viewModel, toolbar); + + Cesium.knockout + .getObservable(viewModel, "color") + .subscribe(function (newValue) { + model.color = Cesium.Color.fromAlpha( + getColor(newValue), + Number(viewModel.alpha) + ); + }); + + Cesium.knockout + .getObservable(viewModel, "alpha") + .subscribe(function (newValue) { + model.color = Cesium.Color.fromAlpha( + getColor(viewModel.color), + Number(newValue) + ); + }); + + Cesium.knockout + .getObservable(viewModel, "colorBlendMode") + .subscribe(function (newValue) { + var colorBlendMode = getColorBlendMode(newValue); + model.colorBlendMode = colorBlendMode; + viewModel.colorBlendAmountEnabled = + colorBlendMode === Cesium.ColorBlendMode.MIX; + }); + + Cesium.knockout + .getObservable(viewModel, "colorBlendAmount") + .subscribe(function (newValue) { + model.colorBlendAmount = newValue; + }); + + function createModel(url, height, heading, pitch, roll) { + height = Cesium.defaultValue(height, 0.0); + heading = Cesium.defaultValue(heading, 0.0); + pitch = Cesium.defaultValue(pitch, 0.0); + roll = Cesium.defaultValue(roll, 0.0); + var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll); + + var origin = Cesium.Cartesian3.fromDegrees( + -123.0744619, + 44.0503706, + height + ); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame( + origin, + hpr + ); + + scene.primitives.removeAll(); // Remove previous model + model = scene.primitives.add( + Cesium.Model.fromGltf({ + url: url, + modelMatrix: modelMatrix, + minimumPixelSize: 128, + }) + ); + + model.readyPromise + .then(function (model) { + model.color = Cesium.Color.fromAlpha( + getColor(viewModel.color), + Number(viewModel.alpha) + ); + model.colorBlendMode = getColorBlendMode( + viewModel.colorBlendMode + ); + model.colorBlendAmount = viewModel.colorBlendAmount; + // Play and loop all animations at half-speed + model.activeAnimations.addAll({ + multiplier: 0.5, + loop: Cesium.ModelAnimationLoop.REPEAT, + }); + + var camera = viewer.camera; + + // Zoom to model + var controller = scene.screenSpaceCameraController; + var r = + 2.0 * + Math.max(model.boundingSphere.radius, camera.frustum.near); + controller.minimumZoomDistance = r * 0.5; + + var center = Cesium.Matrix4.multiplyByPoint( + model.modelMatrix, + model.boundingSphere.center, + new Cesium.Cartesian3() + ); + var heading = Cesium.Math.toRadians(230.0); + var pitch = Cesium.Math.toRadians(-20.0); + camera.lookAt( + center, + new Cesium.HeadingPitchRange(heading, pitch, r * 2.0) + ); + }) + .otherwise(function (error) { + window.alert(error); + }); + } + + var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); + handler.setInputAction(function (movement) { + var pick = scene.pick(movement.endPosition); + if ( + Cesium.defined(pick) && + Cesium.defined(pick.node) && + Cesium.defined(pick.mesh) + ) { + // Output glTF node and mesh under the mouse. + console.log( + "node: " + pick.node.name + ". mesh: " + pick.mesh.name + ); + } + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); + + /////////////////////////////////////////////////////////////////////////// + + var options = [ + { + text: "Aircraft", + onselect: function () { + var height = 5000.0; + var heading = 0.0; + var pitch = Cesium.Math.toRadians(10.0); + var roll = Cesium.Math.toRadians(-20.0); + createModel( + "../../SampleData/models/CesiumAir/Cesium_Air.glb", + height, + heading, + pitch, + roll + ); + }, + }, + { + text: "Ground Vehicle", + onselect: function () { + createModel( + "../../SampleData/models/GroundVehicle/GroundVehicle.glb" + ); + }, + }, + { + text: "Milk Truck", + onselect: function () { + createModel( + "../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.glb" + ); + }, + }, + { + text: "Skinned Character", + onselect: function () { + createModel("../../SampleData/models/CesiumMan/Cesium_Man.glb"); + }, + }, + ]; + + Sandcastle.addToolbarMenu(options); + + Sandcastle.addToggleButton("Shadows", viewer.shadows, function ( + checked + ) { + viewer.shadows = checked; + }); + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/3D Tiles Performance Testing.html b/Apps/Sandcastle/gallery/development/3D Tiles Performance Testing.html index 600a6f236cce..cf10f658629f 100644 --- a/Apps/Sandcastle/gallery/development/3D Tiles Performance Testing.html +++ b/Apps/Sandcastle/gallery/development/3D Tiles Performance Testing.html @@ -1,28 +1,41 @@ - - - - - - + + + + + + Streaming Performance Testing - + - - - -
-

Loading...

-
- - +});" + ); + }); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/BillboardClampToGround.html b/Apps/Sandcastle/gallery/development/BillboardClampToGround.html index 15ab130b6e80..f105e6f0b9cc 100644 --- a/Apps/Sandcastle/gallery/development/BillboardClampToGround.html +++ b/Apps/Sandcastle/gallery/development/BillboardClampToGround.html @@ -1,134 +1,175 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
-
-
-
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Billboards Instancing.html b/Apps/Sandcastle/gallery/development/Billboards Instancing.html index d8368bd91172..afe0418e7af7 100644 --- a/Apps/Sandcastle/gallery/development/Billboards Instancing.html +++ b/Apps/Sandcastle/gallery/development/Billboards Instancing.html @@ -1,193 +1,239 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
-
-
-
-
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Billboards.html b/Apps/Sandcastle/gallery/development/Billboards.html index c4009792f863..3f1c8e399955 100644 --- a/Apps/Sandcastle/gallery/development/Billboards.html +++ b/Apps/Sandcastle/gallery/development/Billboards.html @@ -1,360 +1,437 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/development/Box Outline.html b/Apps/Sandcastle/gallery/development/Box Outline.html index a27e5059de68..7a7eedf49b98 100644 --- a/Apps/Sandcastle/gallery/development/Box Outline.html +++ b/Apps/Sandcastle/gallery/development/Box Outline.html @@ -1,75 +1,91 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add the geometry instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: boxOutlineInstance, + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Box.html b/Apps/Sandcastle/gallery/development/Box.html index f35f6e80be70..0c011694012a 100644 --- a/Apps/Sandcastle/gallery/development/Box.html +++ b/Apps/Sandcastle/gallery/development/Box.html @@ -1,69 +1,85 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var dimensions = new Cesium.Cartesian3(400000.0, 300000.0, 500000.0); + // Box geometries are initially centered on the origin. + // We can use a model matrix to position the box on the + // globe surface. + var positionOnEllipsoid = Cesium.Cartesian3.fromDegrees(-105.0, 45.0); + var boxModelMatrix = Cesium.Matrix4.multiplyByTranslation( + Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid), + new Cesium.Cartesian3(0.0, 0.0, dimensions.z * 0.5), + new Cesium.Matrix4() + ); + // Create a box geometry. + var boxGeometry = Cesium.BoxGeometry.fromDimensions({ + vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, + dimensions: dimensions, + }); + // Create a geometry instance using the geometry + // and model matrix created above. + var boxGeometryInstance = new Cesium.GeometryInstance({ + geometry: boxGeometry, + modelMatrix: boxModelMatrix, + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + new Cesium.Color(1.0, 0.0, 0.0, 0.5) + ), + }, + }); + // Add the geometry instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: boxGeometryInstance, + appearance: new Cesium.PerInstanceColorAppearance({ + closed: true, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Circle Outline.html b/Apps/Sandcastle/gallery/development/Circle Outline.html index 1a86927228f6..3d2f3d249cb2 100644 --- a/Apps/Sandcastle/gallery/development/Circle Outline.html +++ b/Apps/Sandcastle/gallery/development/Circle Outline.html @@ -1,92 +1,110 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Example 2: Draw a green extruded circle. + // Create the circle outline geometry. To extrude, specify + // the height of the geometry with the extrudedHeight option. + // The numberOfVerticalLines option is used to determine + // how many lines connect the top and bottom of the circle. + circleOutlineGeometry = new Cesium.CircleOutlineGeometry({ + center: Cesium.Cartesian3.fromDegrees(-95.0, 40.0), + radius: 100000.0, + extrudedHeight: 200000.0, + numberOfVerticalLines: 16, + }); + // Create a geometry instance using the circle outline + // created above. + circleOutlineInstance = new Cesium.GeometryInstance({ + geometry: circleOutlineGeometry, + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + Cesium.Color.WHITE + ), + }, + }); + // Add the geometry instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: circleOutlineInstance, + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Circle.html b/Apps/Sandcastle/gallery/development/Circle.html index 8249668fcada..45b5306d7dd3 100644 --- a/Apps/Sandcastle/gallery/development/Circle.html +++ b/Apps/Sandcastle/gallery/development/Circle.html @@ -1,115 +1,141 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Create the circle geometry. Use the height option + // to set the circles distance from the ground. + circleGeometry = new Cesium.CircleGeometry({ + center: Cesium.Cartesian3.fromDegrees(-85.0, 40.0), + radius: 400000.0, + height: 150000.0, + vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, + }); + // Create a geometry instance using the circle geometry + // created above. Set the color attribute to a solid blue. + var blueCircleInstance = new Cesium.GeometryInstance({ + geometry: circleGeometry, + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + Cesium.Color.BLUE + ), + }, + }); + // Add the geometry instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: blueCircleInstance, + appearance: new Cesium.PerInstanceColorAppearance({ + closed: true, + translucent: false, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Coplanar Polygon Outline.html b/Apps/Sandcastle/gallery/development/Coplanar Polygon Outline.html index d31f903d6477..cbe7832836d1 100644 --- a/Apps/Sandcastle/gallery/development/Coplanar Polygon Outline.html +++ b/Apps/Sandcastle/gallery/development/Coplanar Polygon Outline.html @@ -1,90 +1,147 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: [polygonOutline1, polygonOutline2], + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Coplanar Polygon.html b/Apps/Sandcastle/gallery/development/Coplanar Polygon.html index d705ebd9ef12..b48f4e6beaaa 100644 --- a/Apps/Sandcastle/gallery/development/Coplanar Polygon.html +++ b/Apps/Sandcastle/gallery/development/Coplanar Polygon.html @@ -1,116 +1,181 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: polygonInstance, + appearance: new Cesium.MaterialAppearance({ + material: Cesium.Material.fromType("Checkerboard"), + materialSupport: + Cesium.MaterialAppearance.MaterialSupport.TEXTURED, + }), + }) + ); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Corridor Outline.html b/Apps/Sandcastle/gallery/development/Corridor Outline.html index 98350038c54f..d8fea4cb2085 100644 --- a/Apps/Sandcastle/gallery/development/Corridor Outline.html +++ b/Apps/Sandcastle/gallery/development/Corridor Outline.html @@ -1,87 +1,109 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add both corridor outline instances to primitives + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: [corridorOutline, extrudedCorridorOutline], + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Corridor.html b/Apps/Sandcastle/gallery/development/Corridor.html index 7866eb4b355a..04495b336074 100644 --- a/Apps/Sandcastle/gallery/development/Corridor.html +++ b/Apps/Sandcastle/gallery/development/Corridor.html @@ -1,134 +1,165 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Create the corridor geometry. To extrude, specify the + // height of the geometry with the extrudedHeight option. + // In this case, we are also using the corner type option + // to draw beveled corners. + corridorGeometry = new Cesium.CorridorGeometry({ + positions: Cesium.Cartesian3.fromDegreesArray([ + -80.0, + 40.0, + -85.0, + 40.0, + -85.0, + 35.0, + ]), + height: 200000.0, + extrudedHeight: 100000.0, + width: 200000.0, + vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, + cornerType: Cesium.CornerType.BEVELED, + }); + // Create a geometry instance using the corridor geometry + // created above. + var blueCorridorInstance = new Cesium.GeometryInstance({ + geometry: corridorGeometry, + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + new Cesium.Color(0.0, 0.0, 1.0, 0.5) + ), + }, + }); + // Add the geometry instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: blueCorridorInstance, + appearance: new Cesium.PerInstanceColorAppearance({ + closed: true, + }), + }) + ); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Cylinder Outline.html b/Apps/Sandcastle/gallery/development/Cylinder Outline.html index 98bb094eb184..41f4a58cec2e 100644 --- a/Apps/Sandcastle/gallery/development/Cylinder Outline.html +++ b/Apps/Sandcastle/gallery/development/Cylinder Outline.html @@ -1,75 +1,90 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Create the model matrix. + var length = 400000.0; + var positionOnEllipsoid = Cesium.Cartesian3.fromDegrees(-100.0, 40.0); + var modelMatrix = Cesium.Matrix4.multiplyByTranslation( + Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid), + new Cesium.Cartesian3(0.0, 0.0, length * 0.5), + new Cesium.Matrix4() + ); + // Create the cylinder outline geometry. The numberOfVerticalLines + // option can be used to specify the number of lines connecting + // the top and bottom of the cylinder. + var cylinderOutlineGeometry = new Cesium.CylinderOutlineGeometry({ + length: length, + topRadius: 150000.0, + bottomRadius: 150000.0, + numberOfVerticalLines: 16, + }); + // Create a geometry instance using the geometry. + var cylinderOutline = new Cesium.GeometryInstance({ + geometry: cylinderOutlineGeometry, + modelMatrix: modelMatrix, + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + Cesium.Color.WHITE + ), + }, + }); + // Add the instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: cylinderOutline, + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Cylinder.html b/Apps/Sandcastle/gallery/development/Cylinder.html index a39867788ef4..f2c6d8cd3f5f 100644 --- a/Apps/Sandcastle/gallery/development/Cylinder.html +++ b/Apps/Sandcastle/gallery/development/Cylinder.html @@ -1,101 +1,119 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add both instances to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: [greenCylinder, redCone], + appearance: new Cesium.PerInstanceColorAppearance({ + closed: true, + translucent: false, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Display Conditions.html b/Apps/Sandcastle/gallery/development/Display Conditions.html index 04f6b0c6e21d..e5248629410f 100644 --- a/Apps/Sandcastle/gallery/development/Display Conditions.html +++ b/Apps/Sandcastle/gallery/development/Display Conditions.html @@ -1,102 +1,140 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Ellipse Outline.html b/Apps/Sandcastle/gallery/development/Ellipse Outline.html index e28489515e65..be1280934038 100644 --- a/Apps/Sandcastle/gallery/development/Ellipse Outline.html +++ b/Apps/Sandcastle/gallery/development/Ellipse Outline.html @@ -1,88 +1,107 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add both ellipse outline instances to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: [ + ellipseOutlineInstance, + extrudedEllipseOutlineInstance, + ], + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Ellipse.html b/Apps/Sandcastle/gallery/development/Ellipse.html index 3c53e3f1ded1..34032027d1f5 100644 --- a/Apps/Sandcastle/gallery/development/Ellipse.html +++ b/Apps/Sandcastle/gallery/development/Ellipse.html @@ -1,109 +1,131 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add all ellipse instances to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: [ + redEllipseInstance, + greenEllipseInstance, + blueEllipseInstance, + ], + appearance: new Cesium.PerInstanceColorAppearance({ + translucent: false, + closed: true, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Ellipsoid Outline.html b/Apps/Sandcastle/gallery/development/Ellipsoid Outline.html index 29cc6e3aa979..3fdcf2ce1d48 100644 --- a/Apps/Sandcastle/gallery/development/Ellipsoid Outline.html +++ b/Apps/Sandcastle/gallery/development/Ellipsoid Outline.html @@ -1,72 +1,87 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var radii = new Cesium.Cartesian3(200000.0, 200000.0, 300000.0); + var positionOnEllipsoid = Cesium.Cartesian3.fromDegrees(-102.0, 45.0); + var modelMatrix = Cesium.Matrix4.multiplyByTranslation( + Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid), + new Cesium.Cartesian3(0.0, 0.0, radii.z), + new Cesium.Matrix4() + ); + // Create a ellipsoid geometry. + var ellipsoidOutlineGeometry = new Cesium.EllipsoidOutlineGeometry({ + radii: radii, + stackPartitions: 16, + slicePartitions: 8, + }); + // Create a geometry instance using the geometry + // and model matrix created above. + var ellipseOutlineInstance = new Cesium.GeometryInstance({ + geometry: ellipsoidOutlineGeometry, + modelMatrix: modelMatrix, + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + Cesium.Color.WHITE + ), + }, + }); + // Add the geometry instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: ellipseOutlineInstance, + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Ellipsoid Surface.html b/Apps/Sandcastle/gallery/development/Ellipsoid Surface.html index 1e4e93dbf96a..86a8372f497b 100644 --- a/Apps/Sandcastle/gallery/development/Ellipsoid Surface.html +++ b/Apps/Sandcastle/gallery/development/Ellipsoid Surface.html @@ -1,92 +1,133 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Grid Material + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: new Cesium.GeometryInstance({ + geometry: new Cesium.RectangleGeometry({ + rectangle: Cesium.Rectangle.fromDegrees( + -90.0, + 30.0, + -80.0, + 40.0 + ), + vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT, + }), + }), + appearance: new Cesium.EllipsoidSurfaceAppearance({ + material: Cesium.Material.fromType("Grid"), + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Ellipsoid.html b/Apps/Sandcastle/gallery/development/Ellipsoid.html index 6f092ddd04ab..05c5e2b19e37 100644 --- a/Apps/Sandcastle/gallery/development/Ellipsoid.html +++ b/Apps/Sandcastle/gallery/development/Ellipsoid.html @@ -1,71 +1,86 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var radii = new Cesium.Cartesian3(200000.0, 200000.0, 300000.0); + // Ellipsoid geometries are initially centered on the origin. + // We can use a model matrix to position the ellipsoid on the + // globe surface. + var positionOnEllipsoid = Cesium.Cartesian3.fromDegrees(-100.0, 40.0); + var modelMatrix = Cesium.Matrix4.multiplyByTranslation( + Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid), + new Cesium.Cartesian3(0.0, 0.0, radii.z), + new Cesium.Matrix4() + ); + // Create a ellipsoid geometry. + var ellipsoidGeometry = new Cesium.EllipsoidGeometry({ + vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, + radii: radii, + }); + // Create a geometry instance using the geometry + // and model matrix created above. + var ellipsoidInstance = new Cesium.GeometryInstance({ + geometry: ellipsoidGeometry, + modelMatrix: modelMatrix, + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + Cesium.Color.BLUE + ), + }, + }); + // Add the geometry instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: ellipsoidInstance, + appearance: new Cesium.PerInstanceColorAppearance({ + translucent: false, + closed: true, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Fog.html b/Apps/Sandcastle/gallery/development/Fog.html index 09243947a9e3..40606e50946f 100644 --- a/Apps/Sandcastle/gallery/development/Fog.html +++ b/Apps/Sandcastle/gallery/development/Fog.html @@ -1,130 +1,150 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - - - - - - - - - - - -
enabled
density
sse increase factor
-
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Frustum.html b/Apps/Sandcastle/gallery/development/Frustum.html index ae6fcaaffa8b..33c770658ad6 100644 --- a/Apps/Sandcastle/gallery/development/Frustum.html +++ b/Apps/Sandcastle/gallery/development/Frustum.html @@ -1,95 +1,124 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + frustumPrimitive.readyPromise.then(function (primitive) { + var bs = primitive.getGeometryInstanceAttributes("frustum") + .boundingSphere; + scene.camera.viewBoundingSphere(bs); + scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Geometry Offset Attribute box cylinder ellipsoid.html b/Apps/Sandcastle/gallery/development/Geometry Offset Attribute box cylinder ellipsoid.html index dfe0b03374bd..551e74edbad8 100644 --- a/Apps/Sandcastle/gallery/development/Geometry Offset Attribute box cylinder ellipsoid.html +++ b/Apps/Sandcastle/gallery/development/Geometry Offset Attribute box cylinder ellipsoid.html @@ -1,201 +1,297 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + attributes = o.getGeometryInstanceAttributes(id3); + offset = Cesium.Cartesian3.multiplyByScalar( + ellipsoid.geodeticSurfaceNormal(center3), + 150000, + new Cesium.Cartesian3() + ); + attributes.offset = Cesium.OffsetGeometryInstanceAttribute.toValue( + offset, + attributes.offset + ); + }); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Geometry Offset Attribute.html b/Apps/Sandcastle/gallery/development/Geometry Offset Attribute.html index 77746164c75e..9a34dc648bbb 100644 --- a/Apps/Sandcastle/gallery/development/Geometry Offset Attribute.html +++ b/Apps/Sandcastle/gallery/development/Geometry Offset Attribute.html @@ -1,187 +1,274 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Geometry and Appearances.html b/Apps/Sandcastle/gallery/development/Geometry and Appearances.html index ac460bf076a9..0568e583589c 100644 --- a/Apps/Sandcastle/gallery/development/Geometry and Appearances.html +++ b/Apps/Sandcastle/gallery/development/Geometry and Appearances.html @@ -1,990 +1,1289 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + var tubeGeometry = new Cesium.GeometryInstance({ + geometry: new Cesium.PolylineVolumeGeometry({ + polylinePositions: Cesium.Cartesian3.fromDegreesArray([ + -104.0, + 13.0, + -107.0, + 18.0, + -112.0, + 18.0, + ]), + vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, + shapePositions: computeCircle(40000.0), + }), + attributes: { + color: solidWhite, + }, + }); + + primitives.add( + new Cesium.Primitive({ + geometryInstances: [ + tubeGeometry, + polylineVolume, + polylineVolumeFill, + ], + appearance: new Cesium.PerInstanceColorAppearance({ + translucent: false, + closed: true, + }), + }) + ); + + primitives.add( + new Cesium.Primitive({ + geometryInstances: polylineVolumeOutline, + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + translucent: false, + renderState: { + lineWidth: 1.0, + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Ground Polyline Material.html b/Apps/Sandcastle/gallery/development/Ground Polyline Material.html index f19f73a79ef0..17fca2130d9f 100644 --- a/Apps/Sandcastle/gallery/development/Ground Polyline Material.html +++ b/Apps/Sandcastle/gallery/development/Ground Polyline Material.html @@ -1,94 +1,130 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Ground Primitive Materials.html b/Apps/Sandcastle/gallery/development/Ground Primitive Materials.html index 2ec02665338a..f5bfa1472301 100644 --- a/Apps/Sandcastle/gallery/development/Ground Primitive Materials.html +++ b/Apps/Sandcastle/gallery/development/Ground Primitive Materials.html @@ -1,481 +1,561 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + ); + + var initialPosition = Cesium.Cartesian3.fromRadians( + -2.1344873183780484, + 0.8071380277370774, + 5743.394497982162 + ); + var initialOrientation = new Cesium.HeadingPitchRoll.fromDegrees( + 112.99596671210358, + -21.34390550872461, + 0.0716951918898415 + ); + viewer.scene.camera.setView({ + destination: initialPosition, + orientation: initialOrientation, + endTransform: Cesium.Matrix4.IDENTITY, + }); + } + + var scene = viewer.scene; + scene.globe.enableLighting = true; + + createPrimitives(scene); + createButtons(scene); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Ground Primitive.html b/Apps/Sandcastle/gallery/development/Ground Primitive.html index e3cfcf3a5271..09cbd92c6a6d 100644 --- a/Apps/Sandcastle/gallery/development/Ground Primitive.html +++ b/Apps/Sandcastle/gallery/development/Ground Primitive.html @@ -1,364 +1,507 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + new Cesium.Color(1.0, 1.0, 0.0, 0.5) + ), + }, + id: "rhumbPolygon", + }), + classificationType: Cesium.ClassificationType.TERRAIN, + }) + ); + }); + + Sandcastle.reset = function () { + scene.groundPrimitives.removeAll(); + handler = handler && handler.destroy(); + + //Set the camera to a US centered tilted view and switch back to moving in world coordinates. + viewer.camera.lookAt( + Cesium.Cartesian3.fromDegrees(-98.0, 40.0), + new Cesium.Cartesian3(0.0, -4790000.0, 3930000.0) + ); + viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY); + }; + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Labels.html b/Apps/Sandcastle/gallery/development/Labels.html index 9a77a1bc48dc..7a29fdd6467a 100644 --- a/Apps/Sandcastle/gallery/development/Labels.html +++ b/Apps/Sandcastle/gallery/development/Labels.html @@ -1,187 +1,227 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Sandcastle.addToolbarMenu([ + { + text: "Add label", + onselect: function () { + addLabel(); + Sandcastle.highlight(addLabel); + }, + }, + { + text: "Set font", + onselect: function () { + setFont(); + Sandcastle.highlight(setFont); + }, + }, + { + text: "Set properties", + onselect: function () { + setProperties(); + Sandcastle.highlight(setProperties); + }, + }, + { + text: "Add labels in reference frame", + onselect: function () { + inReferenceFrame(); + Sandcastle.highlight(inReferenceFrame); + }, + }, + { + text: "Offset label by distance", + onselect: function () { + offsetByDistance(); + Sandcastle.highlight(offsetByDistance); + }, + }, + { + text: "Fade label by distance", + onselect: function () { + fadeByDistance(); + Sandcastle.highlight(fadeByDistance); + }, + }, + ]); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Many Clipping Planes.html b/Apps/Sandcastle/gallery/development/Many Clipping Planes.html index 5d5035d55e33..b1bd916979b6 100644 --- a/Apps/Sandcastle/gallery/development/Many Clipping Planes.html +++ b/Apps/Sandcastle/gallery/development/Many Clipping Planes.html @@ -1,269 +1,347 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+
+ + - -
Distance - - + + Plane Count - - + +
- -
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Material.html b/Apps/Sandcastle/gallery/development/Material.html index c4564861c653..9334c97dbcb0 100644 --- a/Apps/Sandcastle/gallery/development/Material.html +++ b/Apps/Sandcastle/gallery/development/Material.html @@ -1,70 +1,98 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Striped Wall + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: new Cesium.GeometryInstance({ + geometry: new Cesium.WallGeometry({ + positions: Cesium.Cartesian3.fromDegreesArrayHeights([ + -100.5, + 50.0, + 300000.0, + -95.5, + 50.0, + 300000.0, + ]), + vertexFormat: + Cesium.MaterialAppearance.MaterialSupport.TEXTURED + .vertexFormat, + }), + }), + appearance: new Cesium.MaterialAppearance({ + material: Cesium.Material.fromType("Stripe"), + materialSupport: + Cesium.MaterialAppearance.MaterialSupport.TEXTURED, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Multiple Shadows.html b/Apps/Sandcastle/gallery/development/Multiple Shadows.html index d2dcbf8b9a55..a9c02a0b1dce 100644 --- a/Apps/Sandcastle/gallery/development/Multiple Shadows.html +++ b/Apps/Sandcastle/gallery/development/Multiple Shadows.html @@ -1,43 +1,53 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Per Instance Color.html b/Apps/Sandcastle/gallery/development/Per Instance Color.html index aba29cfbdd32..c571765b3bb9 100644 --- a/Apps/Sandcastle/gallery/development/Per Instance Color.html +++ b/Apps/Sandcastle/gallery/development/Per Instance Color.html @@ -1,55 +1,76 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: instances, + appearance: new Cesium.PerInstanceColorAppearance(), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Pick From Ray.html b/Apps/Sandcastle/gallery/development/Pick From Ray.html index 4a0117571c81..48415d1ce320 100644 --- a/Apps/Sandcastle/gallery/development/Pick From Ray.html +++ b/Apps/Sandcastle/gallery/development/Pick From Ray.html @@ -1,166 +1,201 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + function pickFromRay() { + reset(); + var start = Cesium.Cartographic.toCartesian(blueCartographic); + var end = Cesium.Cartographic.toCartesian(redCartographic); + var direction = Cesium.Cartesian3.normalize( + Cesium.Cartesian3.subtract(end, start, new Cesium.Cartesian3()), + new Cesium.Cartesian3() + ); + var ray = new Cesium.Ray(start, direction); + + var results = []; + + if (drillPick) { + results = scene.drillPickFromRay(ray, 10, objectsToExclude); + } else { + var result = scene.pickFromRay(ray, objectsToExclude); + if (Cesium.defined(result)) { + results = [result]; + } + } + + redSphere.position = Cesium.Cartographic.toCartesian(redCartographic); + arrow.polyline.positions = [ + Cesium.Cartographic.toCartesian(blueCartographic), + Cesium.Cartographic.toCartesian(redCartographic), + ]; + showIntersections(results); + } + + var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas); + handler.setInputAction(function (movement) { + var redCartesian = scene.pickPosition(movement.position); + redCartographic = Cesium.Cartographic.fromCartesian(redCartesian); + redCartographic.height = 30.0; + pickFromRay(); + }, Cesium.ScreenSpaceEventType.LEFT_CLICK); + + window.setTimeout(function () { + pickFromRay(); + }, 2000.0); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Picking.html b/Apps/Sandcastle/gallery/development/Picking.html index 78fa1f4cba9c..ba2a341c86d8 100644 --- a/Apps/Sandcastle/gallery/development/Picking.html +++ b/Apps/Sandcastle/gallery/development/Picking.html @@ -1,491 +1,705 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + Cesium.Color.clone( + pickedFeature.model.color, + highlighted.originalColor + ); + pickedFeature.model.color = Cesium.Color.YELLOW; + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); + }, + }, + { + text: "Batched 3D Model", + onselect: function () { + tileset = viewer.scene.primitives.add( + new Cesium.Cesium3DTileset({ + url: + "../../SampleData/Cesium3DTiles/Tilesets/Tileset/tileset.json", + }) + ); + + tileset.readyPromise + .then(function () { + viewer.zoomTo( + tileset, + new Cesium.HeadingPitchRange( + 0, + -2.0, + Math.max(100.0 - tileset.boundingSphere.radius, 0.0) + ) + ); + + handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); + handler.setInputAction(function (movement) { + if (Cesium.defined(highlighted.feature)) { + highlighted.feature.color = highlighted.originalColor; + highlighted.feature = undefined; + } + var pickedFeature = viewer.scene.pick(movement.endPosition); + if (!Cesium.defined(pickedFeature)) { + return; + } + highlighted.feature = pickedFeature; + Cesium.Color.clone( + pickedFeature.color, + highlighted.originalColor + ); + pickedFeature.color = Cesium.Color.YELLOW; + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); + }) + .otherwise(function (error) { + throw error; + }); + }, + }, + { + text: "Instanced 3D Model", + onselect: function () { + tileset = viewer.scene.primitives.add( + new Cesium.Cesium3DTileset({ + url: + "../../SampleData/Cesium3DTiles/Instanced/InstancedWithBatchTable/tileset.json", + }) + ); + + tileset.readyPromise + .then(function () { + viewer.zoomTo( + tileset, + new Cesium.HeadingPitchRange( + 0, + -2.0, + Math.max(100.0 - tileset.boundingSphere.radius, 0.0) + ) + ); + + handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); + handler.setInputAction(function (movement) { + if (Cesium.defined(highlighted.feature)) { + highlighted.feature.color = highlighted.originalColor; + highlighted.feature = undefined; + } + var pickedFeature = viewer.scene.pick(movement.endPosition); + if (!Cesium.defined(pickedFeature)) { + return; + } + highlighted.feature = pickedFeature; + Cesium.Color.clone( + pickedFeature.color, + highlighted.originalColor + ); + pickedFeature.color = Cesium.Color.YELLOW; + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); + }) + .otherwise(function (error) { + throw error; + }); + }, + }, + { + text: "Point cloud", + onselect: function () { + tileset = viewer.scene.primitives.add( + new Cesium.Cesium3DTileset({ + url: + "../../SampleData/Cesium3DTiles/PointCloud/PointCloudRGB/tileset.json", + }) + ); + + tileset.readyPromise + .then(function () { + viewer.zoomTo( + tileset, + new Cesium.HeadingPitchRange( + 0, + -2.0, + Math.max(100.0 - tileset.boundingSphere.radius, 0.0) + ) + ); + + tileset.style = new Cesium.Cesium3DTileStyle({ + pointSize: 8.0, + }); + + handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); + handler.setInputAction(function (movement) { + if (Cesium.defined(highlighted.feature)) { + highlighted.feature.primitive.style = new Cesium.Cesium3DTileStyle( + { + pointSize: 10.0, + } + ); + highlighted.feature = undefined; + } + var pickedFeature = viewer.scene.pick(movement.endPosition); + if (!Cesium.defined(pickedFeature)) { + return; + } + highlighted.feature = pickedFeature; + pickedFeature.primitive.style = new Cesium.Cesium3DTileStyle( + { + pointSize: 10.0, + color: 'color("yellow")', + } + ); + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); + }) + .otherwise(function (error) { + throw error; + }); + }, + }, + { + text: "Vector tile polygons", + onselect: function () { + viewer.terrainProvider = Cesium.createWorldTerrain(); + + tileset = viewer.scene.primitives.add( + new Cesium.Cesium3DTileset({ + url: + "../../../Specs/Data/Cesium3DTiles/Vector/VectorTilePolygons/tileset.json", + }) + ); + + tileset.readyPromise + .then(function () { + camera.position = new Cesium.Cartesian3( + 6382696.762766026, + 20.61495686957654, + -83.83598213685399 + ); + camera.direction = new Cesium.Cartesian3( + -0.9999999739409788, + 0.00022792812935066512, + 0.000012915478344419502 + ); + camera.up = new Cesium.Cartesian3( + 0.00001291547800893194, + -2.9438010410026854e-9, + 0.9999999999165953 + ); + camera.right = new Cesium.Cartesian3.cross( + camera.direction, + camera.up, + camera.right + ); + + handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); + handler.setInputAction(function (movement) { + if (Cesium.defined(highlighted.feature)) { + highlighted.feature.color = highlighted.originalColor; + highlighted.feature = undefined; + } + var pickedFeature = viewer.scene.pick(movement.endPosition); + if (!Cesium.defined(pickedFeature)) { + return; + } + highlighted.feature = pickedFeature; + Cesium.Color.clone( + pickedFeature.color, + highlighted.originalColor + ); + pickedFeature.color = Cesium.Color.YELLOW; + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); + }) + .otherwise(function (error) { + throw error; + }); + }, + }, + { + text: "Vector tile polylines", + onselect: function () { + viewer.terrainProvider = Cesium.createWorldTerrain(); + + tileset = viewer.scene.primitives.add( + new Cesium.Cesium3DTileset({ + url: + "../../../Specs/Data/Cesium3DTiles/Vector/VectorTilePolylines/tileset.json", + }) + ); + + tileset.readyPromise + .then(function () { + camera.position = new Cesium.Cartesian3( + 6382696.762766026, + 20.61495686957654, + -83.83598213685399 + ); + camera.direction = new Cesium.Cartesian3( + -0.9999999739409788, + 0.00022792812935066512, + 0.000012915478344419502 + ); + camera.up = new Cesium.Cartesian3( + 0.00001291547800893194, + -2.9438010410026854e-9, + 0.9999999999165953 + ); + camera.right = new Cesium.Cartesian3.cross( + camera.direction, + camera.up, + camera.right + ); + + handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); + handler.setInputAction(function (movement) { + if (Cesium.defined(highlighted.feature)) { + highlighted.feature.color = highlighted.originalColor; + highlighted.feature = undefined; + } + var pickedFeature = viewer.scene.pick(movement.endPosition); + if (!Cesium.defined(pickedFeature)) { + return; + } + highlighted.feature = pickedFeature; + Cesium.Color.clone( + pickedFeature.color, + highlighted.originalColor + ); + pickedFeature.color = Cesium.Color.YELLOW; + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); + }) + .otherwise(function (error) { + throw error; + }); + }, + }, + ]); + + Sandcastle.reset = function () { + viewer.entities.removeAll(); + if (Cesium.defined(polylines)) { + scene.primitives.remove(polylines); + polylines = undefined; + } + if (Cesium.defined(primitive)) { + scene.primitives.remove(primitive); + primitive = undefined; + } + if (Cesium.defined(tileset)) { + scene.primitives.remove(tileset); + tileset = undefined; + } + handler = handler && handler.destroy(); + viewer.scene.camera.flyHome(0.0); + if ( + !(viewer.terrainProvider instanceof Cesium.EllipsoidTerrainProvider) + ) { + viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider(); + } + }; + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/PointPrimitives.html b/Apps/Sandcastle/gallery/development/PointPrimitives.html index 03c3d5edfea4..14e2ec04cc7b 100644 --- a/Apps/Sandcastle/gallery/development/PointPrimitives.html +++ b/Apps/Sandcastle/gallery/development/PointPrimitives.html @@ -1,235 +1,282 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+ + diff --git a/Apps/Sandcastle/gallery/development/Polygon Outline.html b/Apps/Sandcastle/gallery/development/Polygon Outline.html index 71e08a2be652..9751be37334b 100644 --- a/Apps/Sandcastle/gallery/development/Polygon Outline.html +++ b/Apps/Sandcastle/gallery/development/Polygon Outline.html @@ -1,116 +1,159 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add all polyline outlines instances to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: [ + polygonOutlineInstance, + extrudedPolygonOutlineInstance, + perPositionPolygonOutlineInstance, + ], + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Polygon.html b/Apps/Sandcastle/gallery/development/Polygon.html index 454e20a5deb2..2ac7902c68fd 100644 --- a/Apps/Sandcastle/gallery/development/Polygon.html +++ b/Apps/Sandcastle/gallery/development/Polygon.html @@ -1,161 +1,227 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add each polygon instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: [ + redPolygonInstance, + greenPolygonInstance, + bluePolygonInstance, + orangePolygonInstance, + ], + appearance: new Cesium.PerInstanceColorAppearance({ + closed: true, + translucent: false, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Polyline Color.html b/Apps/Sandcastle/gallery/development/Polyline Color.html index b60141905112..1a0201034556 100644 --- a/Apps/Sandcastle/gallery/development/Polyline Color.html +++ b/Apps/Sandcastle/gallery/development/Polyline Color.html @@ -1,82 +1,99 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Example 2: Draw a polyline with per vertex colors + positions = []; + colors = []; + for (i = 0; i < 12; ++i) { + positions.push(Cesium.Cartesian3.fromDegrees(-124.0 + 5 * i, 35.0)); + colors.push(Cesium.Color.fromRandom({ alpha: 1.0 })); + } + // For per segment coloring, supply the colors option with + // an array of colors for each vertex. Also set the + // colorsPerVertex option to true. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: new Cesium.GeometryInstance({ + geometry: new Cesium.PolylineGeometry({ + positions: positions, + width: 5.0, + vertexFormat: Cesium.PolylineColorAppearance.VERTEX_FORMAT, + colors: colors, + colorsPerVertex: true, + }), + }), + appearance: new Cesium.PolylineColorAppearance(), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Polyline Material.html b/Apps/Sandcastle/gallery/development/Polyline Material.html index eeb891a1bfe4..9f64da30be58 100644 --- a/Apps/Sandcastle/gallery/development/Polyline Material.html +++ b/Apps/Sandcastle/gallery/development/Polyline Material.html @@ -1,87 +1,118 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Polyline Outline + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: new Cesium.GeometryInstance({ + geometry: new Cesium.PolylineGeometry({ + positions: Cesium.Cartesian3.fromDegreesArray([ + -120.0, + 30.0, + -80.0, + 30.0, + ]), + width: 10.0, + vertexFormat: Cesium.PolylineMaterialAppearance.VERTEX_FORMAT, + }), + }), + appearance: new Cesium.PolylineMaterialAppearance({ + material: Cesium.Material.fromType( + Cesium.Material.PolylineOutlineType + ), + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Polyline Volume Outline.html b/Apps/Sandcastle/gallery/development/Polyline Volume Outline.html index bb37a6837031..60c11cbb7869 100644 --- a/Apps/Sandcastle/gallery/development/Polyline Volume Outline.html +++ b/Apps/Sandcastle/gallery/development/Polyline Volume Outline.html @@ -1,104 +1,129 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Create the polyline volume geometry instance. + var starOutline = new Cesium.GeometryInstance({ + geometry: new Cesium.PolylineVolumeOutlineGeometry({ + polylinePositions: Cesium.Cartesian3.fromDegreesArray([ + -95.0, + 32.0, + -95.0, + 36.0, + ]), + shapePositions: starPositions(5, 70000, 40000), + cornerType: Cesium.CornerType.ROUNDED, + }), + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + Cesium.Color.WHITE + ), + }, + }); + + // Add all instances to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: [boxOutline, starOutline], + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Polyline Volume.html b/Apps/Sandcastle/gallery/development/Polyline Volume.html index 79c86bc484c0..8ae6d3de192e 100644 --- a/Apps/Sandcastle/gallery/development/Polyline Volume.html +++ b/Apps/Sandcastle/gallery/development/Polyline Volume.html @@ -1,133 +1,177 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add all instances to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: [redTube, greenBox, blueStar], + appearance: new Cesium.PerInstanceColorAppearance({ + translucent: false, + closed: true, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Polyline.html b/Apps/Sandcastle/gallery/development/Polyline.html index c4b7c91a75cb..89048e28f8df 100644 --- a/Apps/Sandcastle/gallery/development/Polyline.html +++ b/Apps/Sandcastle/gallery/development/Polyline.html @@ -1,79 +1,103 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Setting the arcType option to ArcType.NONE will allow + // you to draw a straight polyline. Otherwise, it will + // curve to the globe surface. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: new Cesium.GeometryInstance({ + geometry: new Cesium.PolylineGeometry({ + positions: Cesium.Cartesian3.fromDegreesArrayHeights([ + -84.0, + 50.0, + 0.0, + -100.0, + 30.0, + 1000000.0, + ]), + width: 5.0, + vertexFormat: Cesium.PolylineColorAppearance.VERTEX_FORMAT, + arcType: Cesium.ArcType.NONE, + }), + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + Cesium.Color.BLUE + ), + }, + }), + appearance: new Cesium.PolylineColorAppearance(), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Polylines On Terrain.html b/Apps/Sandcastle/gallery/development/Polylines On Terrain.html index b903f92ed77a..84137fb2fe38 100644 --- a/Apps/Sandcastle/gallery/development/Polylines On Terrain.html +++ b/Apps/Sandcastle/gallery/development/Polylines On Terrain.html @@ -1,294 +1,375 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + + +
+

Loading...

+
+
+ + - -
Width - - + +
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Polylines.html b/Apps/Sandcastle/gallery/development/Polylines.html index b36a97874b84..4fadb0624120 100644 --- a/Apps/Sandcastle/gallery/development/Polylines.html +++ b/Apps/Sandcastle/gallery/development/Polylines.html @@ -1,150 +1,201 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + createPrimitives(viewer.scene); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Rectangle Outline.html b/Apps/Sandcastle/gallery/development/Rectangle Outline.html index 55ebc2945fa3..a32a73e77c4b 100644 --- a/Apps/Sandcastle/gallery/development/Rectangle Outline.html +++ b/Apps/Sandcastle/gallery/development/Rectangle Outline.html @@ -1,60 +1,74 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add the rectangle outline instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: instance, + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Rectangle.html b/Apps/Sandcastle/gallery/development/Rectangle.html index 9719a7fe17ba..4bd5f4725e6b 100644 --- a/Apps/Sandcastle/gallery/development/Rectangle.html +++ b/Apps/Sandcastle/gallery/development/Rectangle.html @@ -1,75 +1,91 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add both rectangle instances to primitives + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: [redRectangleInstance, greenRectangleInstance], + appearance: new Cesium.PerInstanceColorAppearance({ + closed: true, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Shadows.html b/Apps/Sandcastle/gallery/development/Shadows.html index a40f9ad7ae5c..66e7195d4cd1 100644 --- a/Apps/Sandcastle/gallery/development/Shadows.html +++ b/Apps/Sandcastle/gallery/development/Shadows.html @@ -1,746 +1,1091 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - - + } + +
+

Loading...

+
+
Light Horizon
+ + + + + + - - - + + + - - - + + + - - - - - + + + + + + - - - - - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - + + + - - - + + + - - + + - - - + + + - - + + - - + + - - + + - -
+ Light Horizon + - - + + +
+ Light Angle
Light Angle - - + + +
+ Distance Limit
Distance Limit - - + + +
+ Radius
Radius - - + +
Darkness - - + + +
+ Cascades + +
Cascades
Light Source
+
Texture Size
Shadows Enabled
Terrain Enabled
Show Globe
Terrain Cast
Terrain Receive
+ +
Show debug
Freeze frame
Cascade colors
Fit near/far
Soft shadows
+ Cascade colors + + +
+ Fit near/far + + +
+ Soft shadows + + +
Location
+
Model
Model Position - - Grid + + Grid
Bias Mode
+
Polygon Offset - - - + + +
Normal Offset - - + +
Normal Shading - - + +
Depth Bias - +
-
- - - + asynchronous: false, + rtcCenter: boxGeometry.boundingSphere.center, + shadows: Cesium.ShadowMode.ENABLED, + }); + + scene.primitives.add(box); + } + + function createBox(origin) { + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame( + origin, + new Cesium.HeadingPitchRoll() + ); + + var box = new Cesium.Primitive({ + geometryInstances: new Cesium.GeometryInstance({ + geometry: Cesium.BoxGeometry.fromDimensions({ + dimensions: new Cesium.Cartesian3(0.5, 0.5, 0.5), + vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, + }), + modelMatrix: modelMatrix, + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + Cesium.Color.BLUE + ), + }, + }), + appearance: new Cesium.PerInstanceColorAppearance({ + translucent: false, + closed: true, + }), + asynchronous: false, + shadows: Cesium.ShadowMode.ENABLED, + }); + + scene.primitives.add(box); + } + + function createSphere(origin) { + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame( + origin, + new Cesium.HeadingPitchRoll() + ); + + var sphere = new Cesium.Primitive({ + geometryInstances: new Cesium.GeometryInstance({ + geometry: new Cesium.SphereGeometry({ + radius: 2.0, + vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, + }), + modelMatrix: modelMatrix, + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + new Cesium.Color(1.0, 0.0, 0.0, 0.5) + ), + }, + }), + appearance: new Cesium.PerInstanceColorAppearance({ + translucent: true, + closed: true, + }), + asynchronous: false, + shadows: Cesium.ShadowMode.ENABLED, + }); + + scene.primitives.add(sphere); + } + + var canvas = viewer.canvas; + canvas.setAttribute("tabindex", "0"); // needed to put focus on the canvas + canvas.onclick = function () { + // To get key events + canvas.focus(); + }; + + var handler = new Cesium.ScreenSpaceEventHandler(canvas); + + // Click object to turn castShadows on/off + handler.setInputAction(function (movement) { + var picked = scene.pick(movement.position); + if (Cesium.defined(picked) && Cesium.defined(picked.primitive)) { + var castShadows = Cesium.ShadowMode.castShadows( + picked.primitive.shadows + ); + var receiveShadows = Cesium.ShadowMode.receiveShadows( + picked.primitive.shadows + ); + picked.primitive.shadows = Cesium.ShadowMode.fromCastReceive( + !castShadows, + receiveShadows + ); + } + }, Cesium.ScreenSpaceEventType.LEFT_CLICK); + + // Middle click object to turn receiveShadows on/off + handler.setInputAction(function (movement) { + var picked = scene.pick(movement.position); + if (Cesium.defined(picked)) { + var castShadows = Cesium.ShadowMode.castShadows( + picked.primitive.shadows + ); + var receiveShadows = Cesium.ShadowMode.receiveShadows( + picked.primitive.shadows + ); + picked.primitive.shadows = Cesium.ShadowMode.fromCastReceive( + castShadows, + !receiveShadows + ); + } + }, Cesium.ScreenSpaceEventType.MIDDLE_CLICK); + + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Simple Polyline.html b/Apps/Sandcastle/gallery/development/Simple Polyline.html index 7b2fee083848..4f2f536d07d4 100644 --- a/Apps/Sandcastle/gallery/development/Simple Polyline.html +++ b/Apps/Sandcastle/gallery/development/Simple Polyline.html @@ -1,108 +1,123 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Sphere Outline.html b/Apps/Sandcastle/gallery/development/Sphere Outline.html index 069880b61f30..f398f7078c1d 100644 --- a/Apps/Sandcastle/gallery/development/Sphere Outline.html +++ b/Apps/Sandcastle/gallery/development/Sphere Outline.html @@ -1,71 +1,86 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var radius = 300000; + var positionOnEllipsoid = Cesium.Cartesian3.fromDegrees(-98.0, 45.0); + var modelMatrix = Cesium.Matrix4.multiplyByTranslation( + Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid), + new Cesium.Cartesian3(0.0, 0.0, radius), + new Cesium.Matrix4() + ); + // Create the sphere outline geometry instance. Use the + // stackPartitions and slicePartitions options to determine + // the number of latitude and longitude lines to draw. + var sphereOutlineInstance = new Cesium.GeometryInstance({ + geometry: new Cesium.SphereOutlineGeometry({ + radius: radius, + stackPartitions: 8, + slicePartitions: 12, + }), + modelMatrix: modelMatrix, + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + Cesium.Color.WHITE + ), + }, + }); + // Add the instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: sphereOutlineInstance, + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Sphere.html b/Apps/Sandcastle/gallery/development/Sphere.html index c5410539954e..20b72181236f 100644 --- a/Apps/Sandcastle/gallery/development/Sphere.html +++ b/Apps/Sandcastle/gallery/development/Sphere.html @@ -1,71 +1,86 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + var radius = 300000.0; + // Sphere geometries are initially centered on the origin. + // We can use a model matrix to position the sphere on the + // globe surface. + var positionOnEllipsoid = Cesium.Cartesian3.fromDegrees(-100.0, 40.0); + var modelMatrix = Cesium.Matrix4.multiplyByTranslation( + Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid), + new Cesium.Cartesian3(0.0, 0.0, radius), + new Cesium.Matrix4() + ); + // Create a sphere geometry. + var sphereGeometry = new Cesium.SphereGeometry({ + vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, + radius: radius, + }); + // Create a geometry instance using the geometry + // and model matrix created above. + var sphereInstance = new Cesium.GeometryInstance({ + geometry: sphereGeometry, + modelMatrix: modelMatrix, + attributes: { + color: Cesium.ColorGeometryInstanceAttribute.fromColor( + Cesium.Color.RED + ), + }, + }); + // Add the sphere instance to primitives + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: sphereInstance, + appearance: new Cesium.PerInstanceColorAppearance({ + translucent: false, + closed: true, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Terrain Entity Batching.html b/Apps/Sandcastle/gallery/development/Terrain Entity Batching.html index e4abd86232c9..94799db8e875 100644 --- a/Apps/Sandcastle/gallery/development/Terrain Entity Batching.html +++ b/Apps/Sandcastle/gallery/development/Terrain Entity Batching.html @@ -1,123 +1,197 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + viewer.zoomTo(viewer.entities); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Terrain Performance.html b/Apps/Sandcastle/gallery/development/Terrain Performance.html index 9fcf5879d582..ef2fa510af7c 100644 --- a/Apps/Sandcastle/gallery/development/Terrain Performance.html +++ b/Apps/Sandcastle/gallery/development/Terrain Performance.html @@ -1,181 +1,311 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + + Sandcastle.addToolbarButton("Timer Static Horizontal", function () { + startTest(); + goToEverestHorizontal(); + }); + + Sandcastle.addToolbarButton("Timer Static Top Down", function () { + startTest(); + goToEverestTopDown(); + }); + + Sandcastle.addToolbarButton("Timer Static 45 degrees", function () { + startTest(); + goToEverest45Degrees(); + }); + + Sandcastle.addToolbarButton("Timer Zoom", function () { + startTest(); + zoomToEverest(); + }); + + Sandcastle.addToolbarButton("Timer Pan", function () { + startTest(); + panAroundEverest(); + }); + + Sandcastle.addToolbarButton("Save camera", function () { + var cameraString = + "camera.position = new Cesium.Cartesian3(" + + camera.positionWC.x + + ", " + + camera.positionWC.y + + ", " + + camera.positionWC.z + + ");\n" + + "camera.direction = new Cesium.Cartesian3(" + + camera.directionWC.x + + ", " + + camera.directionWC.y + + ", " + + camera.directionWC.z + + ");\n" + + "camera.right = new Cesium.Cartesian3(" + + camera.rightWC.x + + ", " + + camera.rightWC.y + + ", " + + camera.rightWC.z + + ");\n" + + "camera.up = new Cesium.Cartesian3(" + + camera.upWC.x + + ", " + + camera.upWC.y + + ", " + + camera.upWC.z + + ");\n"; + console.log(cameraString); + }); //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Terrain Tweaks.html b/Apps/Sandcastle/gallery/development/Terrain Tweaks.html index 8d258634e24a..2b9f5923743c 100644 --- a/Apps/Sandcastle/gallery/development/Terrain Tweaks.html +++ b/Apps/Sandcastle/gallery/development/Terrain Tweaks.html @@ -1,114 +1,164 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- + } + +
+

Loading...

+
+
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + -
Loading Descendant Limit - -
Preload Ancestors - -
Preload Siblings - -
Fill Tile Highlight - - -
Loading Descendant Limit + +
Preload Ancestors + +
Preload Siblings + +
Fill Tile Highlight + + +
-
- - + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Volumes.html b/Apps/Sandcastle/gallery/development/Volumes.html index 8dc427b64e64..15da83d7fabf 100644 --- a/Apps/Sandcastle/gallery/development/Volumes.html +++ b/Apps/Sandcastle/gallery/development/Volumes.html @@ -1,58 +1,78 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + createPrimitives(viewer.scene); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Wall Outline.html b/Apps/Sandcastle/gallery/development/Wall Outline.html index 4e42bbd980dc..a0bcba0f0654 100644 --- a/Apps/Sandcastle/gallery/development/Wall Outline.html +++ b/Apps/Sandcastle/gallery/development/Wall Outline.html @@ -1,62 +1,78 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add the instance to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: instance, + appearance: new Cesium.PerInstanceColorAppearance({ + flat: true, + renderState: { + lineWidth: Math.min(2.0, scene.maximumAliasedLineWidth), + }, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/gallery/development/Wall.html b/Apps/Sandcastle/gallery/development/Wall.html index b44f8ecd31a4..aad047840a7d 100644 --- a/Apps/Sandcastle/gallery/development/Wall.html +++ b/Apps/Sandcastle/gallery/development/Wall.html @@ -1,117 +1,181 @@ - - - - - - + + + + + + Cesium Demo - + - - - -
-

Loading...

-
- - + // Add all wall instances to primitives. + scene.primitives.add( + new Cesium.Primitive({ + geometryInstances: [ + blueWallInstance, + redWallInstance, + greenWallInstance, + ], + appearance: new Cesium.PerInstanceColorAppearance({ + translucent: false, + }), + }) + ); + //Sandcastle_End + Sandcastle.finishedLoading(); + } + if (typeof Cesium !== "undefined") { + window.startupCalled = true; + startup(Cesium); + } + + diff --git a/Apps/Sandcastle/index.html b/Apps/Sandcastle/index.html index 8d20cfc2a56b..9df13ce2ae89 100644 --- a/Apps/Sandcastle/index.html +++ b/Apps/Sandcastle/index.html @@ -1,160 +1,338 @@  - - - - + + + + Cesium Sandcastle - - + + - + - + - + - - + + - - + +
Loading...
-
-
-
-
- New -
- -
- Run (F8) +
+
+
+ +
+
+ New +
+ +
+ Run (F8) +
+ +
+ Suggest (Ctrl-Space) +
+ +
+ Info +