@cesium/engine 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/ThirdParty/Workers/basis_transcoder.js +2233 -0
- package/Build/ThirdParty/Workers/draco_decoder_nodejs.js +1872 -0
- package/Build/ThirdParty/Workers/package.json +1 -0
- package/Build/ThirdParty/Workers/pako_deflate.min.js +589 -0
- package/Build/ThirdParty/Workers/pako_inflate.min.js +798 -0
- package/Build/ThirdParty/Workers/z-worker-pako.js +503 -0
- package/Build/ThirdParty/basis_transcoder.wasm +0 -0
- package/Build/ThirdParty/draco_decoder.wasm +0 -0
- package/Build/ThirdParty/google-earth-dbroot-parser.js +8019 -0
- package/Build/Widget/CesiumWidget.css +120 -0
- package/Build/Widget/lighter.css +13 -0
- package/Build/Workers/ArcType-ce2e50ab.js +37 -0
- package/Build/Workers/AttributeCompression-4589338a.js +716 -0
- package/Build/Workers/AxisAlignedBoundingBox-bfb1234f.js +258 -0
- package/Build/Workers/BoundingRectangle-7ffc2153.js +369 -0
- package/Build/Workers/BoxGeometry-93f344a3.js +884 -0
- package/Build/Workers/Check-666ab1a0.js +290 -0
- package/Build/Workers/Color-0c5aaf47.js +2262 -0
- package/Build/Workers/ComponentDatatype-f7b11d02.js +341 -0
- package/Build/Workers/CoplanarPolygonGeometryLibrary-6597982a.js +132 -0
- package/Build/Workers/CorridorGeometryLibrary-2119580e.js +498 -0
- package/Build/Workers/CylinderGeometry-f9503c6d.js +467 -0
- package/Build/Workers/CylinderGeometryLibrary-372c07d8.js +63 -0
- package/Build/Workers/EllipseGeometry-fedf72d5.js +1304 -0
- package/Build/Workers/EllipseGeometryLibrary-4ea68687.js +366 -0
- package/Build/Workers/EllipseOutlineGeometry-e2ae6a35.js +443 -0
- package/Build/Workers/EllipsoidGeodesic-16de63ea.js +520 -0
- package/Build/Workers/EllipsoidGeometry-95c0330e.js +637 -0
- package/Build/Workers/EllipsoidOutlineGeometry-d6d2ceec.js +454 -0
- package/Build/Workers/EllipsoidRhumbLine-ae5e65e0.js +741 -0
- package/Build/Workers/EllipsoidTangentPlane-bfc674bf.js +373 -0
- package/Build/Workers/EncodedCartesian3-f473ea18.js +171 -0
- package/Build/Workers/FrustumGeometry-3bf2e4eb.js +2512 -0
- package/Build/Workers/GeometryAttribute-df5f473e.js +619 -0
- package/Build/Workers/GeometryAttributes-f06a2792.js +91 -0
- package/Build/Workers/GeometryInstance-aa75b4cf.js +121 -0
- package/Build/Workers/GeometryOffsetAttribute-04332ce7.js +16 -0
- package/Build/Workers/GeometryPipeline-f0e46c42.js +3690 -0
- package/Build/Workers/IndexDatatype-a55ceaa1.js +200 -0
- package/Build/Workers/IntersectionTests-9de29d51.js +1836 -0
- package/Build/Workers/Math-2dbd6b93.js +1330 -0
- package/Build/Workers/Matrix2-ce637455.js +7084 -0
- package/Build/Workers/Matrix3-4f4df527.js +4282 -0
- package/Build/Workers/OrientedBoundingBox-d3ff3d4d.js +1257 -0
- package/Build/Workers/Plane-b81241c2.js +309 -0
- package/Build/Workers/PolygonGeometryLibrary-6f4937bb.js +1074 -0
- package/Build/Workers/PolygonPipeline-774a8aaf.js +1341 -0
- package/Build/Workers/PolylinePipeline-2e2b015c.js +573 -0
- package/Build/Workers/PolylineVolumeGeometryLibrary-7ee1d449.js +781 -0
- package/Build/Workers/PrimitivePipeline-a9b7aae0.js +966 -0
- package/Build/Workers/RectangleGeometryLibrary-9aa6c8f6.js +280 -0
- package/Build/Workers/RuntimeError-06c93819.js +68 -0
- package/Build/Workers/TerrainEncoding-b52dcfc5.js +1227 -0
- package/Build/Workers/Transforms-2f755df8.js +14683 -0
- package/Build/Workers/VertexFormat-6b480673.js +312 -0
- package/Build/Workers/WallGeometryLibrary-ab19a93d.js +211 -0
- package/Build/Workers/WebGLConstants-a8cc3e8c.js +620 -0
- package/Build/Workers/WebMercatorProjection-9f25de49.js +151 -0
- package/Build/Workers/arrayRemoveDuplicates-c2038105.js +129 -0
- package/Build/Workers/cesiumWorkerBootstrapper.js +1273 -0
- package/Build/Workers/combine-ca22a614.js +82 -0
- package/Build/Workers/combineGeometry.js +17 -0
- package/Build/Workers/createBoxGeometry.js +12 -0
- package/Build/Workers/createBoxOutlineGeometry.js +313 -0
- package/Build/Workers/createCircleGeometry.js +213 -0
- package/Build/Workers/createCircleOutlineGeometry.js +160 -0
- package/Build/Workers/createCoplanarPolygonGeometry.js +586 -0
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +236 -0
- package/Build/Workers/createCorridorGeometry.js +1407 -0
- package/Build/Workers/createCorridorOutlineGeometry.js +603 -0
- package/Build/Workers/createCylinderGeometry.js +12 -0
- package/Build/Workers/createCylinderOutlineGeometry.js +265 -0
- package/Build/Workers/createEllipseGeometry.js +14 -0
- package/Build/Workers/createEllipseOutlineGeometry.js +14 -0
- package/Build/Workers/createEllipsoidGeometry.js +12 -0
- package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -0
- package/Build/Workers/createFrustumGeometry.js +12 -0
- package/Build/Workers/createFrustumOutlineGeometry.js +251 -0
- package/Build/Workers/createGeometry.js +55 -0
- package/Build/Workers/createGroundPolylineGeometry.js +2134 -0
- package/Build/Workers/createPlaneGeometry.js +250 -0
- package/Build/Workers/createPlaneOutlineGeometry.js +115 -0
- package/Build/Workers/createPolygonGeometry.js +1420 -0
- package/Build/Workers/createPolygonOutlineGeometry.js +683 -0
- package/Build/Workers/createPolylineGeometry.js +571 -0
- package/Build/Workers/createPolylineVolumeGeometry.js +411 -0
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +301 -0
- package/Build/Workers/createRectangleGeometry.js +1476 -0
- package/Build/Workers/createRectangleOutlineGeometry.js +535 -0
- package/Build/Workers/createSimplePolylineGeometry.js +458 -0
- package/Build/Workers/createSphereGeometry.js +123 -0
- package/Build/Workers/createSphereOutlineGeometry.js +126 -0
- package/Build/Workers/createTaskProcessorWorker.js +127 -0
- package/Build/Workers/createVectorTileClampedPolylines.js +535 -0
- package/Build/Workers/createVectorTileGeometries.js +445 -0
- package/Build/Workers/createVectorTilePoints.js +79 -0
- package/Build/Workers/createVectorTilePolygons.js +406 -0
- package/Build/Workers/createVectorTilePolylines.js +254 -0
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +640 -0
- package/Build/Workers/createVerticesFromHeightmap.js +2707 -0
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +994 -0
- package/Build/Workers/createWallGeometry.js +623 -0
- package/Build/Workers/createWallOutlineGeometry.js +432 -0
- package/Build/Workers/decodeDraco.js +381 -0
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +3668 -0
- package/Build/Workers/decodeI3S.js +1040 -0
- package/Build/Workers/defaultValue-0a909f67.js +51 -0
- package/Build/Workers/package.js +2 -0
- package/Build/Workers/transcodeKTX2.js +1516 -0
- package/Build/Workers/transferTypedArrayTest.js +18 -0
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +1023 -0
- package/LICENSE.md +933 -0
- package/README.md +58 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_0.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_1.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_10.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_11.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_12.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_13.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_14.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_15.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_16.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_17.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_18.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_19.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_2.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_20.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_21.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_22.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_23.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_24.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_25.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_26.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_27.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_3.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_4.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_5.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_6.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_7.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_8.json +1 -0
- package/Source/Assets/IAU2006_XYS/IAU2006_XYS_9.json +1 -0
- package/Source/Assets/Images/bing_maps_credit.png +0 -0
- package/Source/Assets/Images/cesium_credit.png +0 -0
- package/Source/Assets/Images/google_earth_credit.png +0 -0
- package/Source/Assets/Images/ion-credit.png +0 -0
- package/Source/Assets/Textures/LensFlare/DirtMask.jpg +0 -0
- package/Source/Assets/Textures/LensFlare/StarBurst.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/0/0/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/0/1/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/1/0/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/1/0/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/1/1/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/1/1/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/1/2/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/1/2/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/1/3/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/1/3/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/0/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/0/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/0/2.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/0/3.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/1/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/1/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/1/2.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/1/3.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/2/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/2/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/2/2.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/2/3.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/3/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/3/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/3/2.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/3/3.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/4/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/4/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/4/2.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/4/3.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/5/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/5/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/5/2.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/5/3.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/6/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/6/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/6/2.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/6/3.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/7/0.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/7/1.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/7/2.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/2/7/3.jpg +0 -0
- package/Source/Assets/Textures/NaturalEarthII/tilemapresource.xml +14 -0
- package/Source/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
- package/Source/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
- package/Source/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
- package/Source/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
- package/Source/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
- package/Source/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
- package/Source/Assets/Textures/maki/airfield.png +0 -0
- package/Source/Assets/Textures/maki/airport.png +0 -0
- package/Source/Assets/Textures/maki/alcohol-shop.png +0 -0
- package/Source/Assets/Textures/maki/america-football.png +0 -0
- package/Source/Assets/Textures/maki/art-gallery.png +0 -0
- package/Source/Assets/Textures/maki/bakery.png +0 -0
- package/Source/Assets/Textures/maki/bank.png +0 -0
- package/Source/Assets/Textures/maki/bar.png +0 -0
- package/Source/Assets/Textures/maki/baseball.png +0 -0
- package/Source/Assets/Textures/maki/basketball.png +0 -0
- package/Source/Assets/Textures/maki/beer.png +0 -0
- package/Source/Assets/Textures/maki/bicycle.png +0 -0
- package/Source/Assets/Textures/maki/building.png +0 -0
- package/Source/Assets/Textures/maki/bus.png +0 -0
- package/Source/Assets/Textures/maki/cafe.png +0 -0
- package/Source/Assets/Textures/maki/camera.png +0 -0
- package/Source/Assets/Textures/maki/campsite.png +0 -0
- package/Source/Assets/Textures/maki/car.png +0 -0
- package/Source/Assets/Textures/maki/cemetery.png +0 -0
- package/Source/Assets/Textures/maki/cesium.png +0 -0
- package/Source/Assets/Textures/maki/chemist.png +0 -0
- package/Source/Assets/Textures/maki/cinema.png +0 -0
- package/Source/Assets/Textures/maki/circle-stroked.png +0 -0
- package/Source/Assets/Textures/maki/circle.png +0 -0
- package/Source/Assets/Textures/maki/city.png +0 -0
- package/Source/Assets/Textures/maki/clothing-store.png +0 -0
- package/Source/Assets/Textures/maki/college.png +0 -0
- package/Source/Assets/Textures/maki/commercial.png +0 -0
- package/Source/Assets/Textures/maki/cricket.png +0 -0
- package/Source/Assets/Textures/maki/cross.png +0 -0
- package/Source/Assets/Textures/maki/dam.png +0 -0
- package/Source/Assets/Textures/maki/danger.png +0 -0
- package/Source/Assets/Textures/maki/disability.png +0 -0
- package/Source/Assets/Textures/maki/dog-park.png +0 -0
- package/Source/Assets/Textures/maki/embassy.png +0 -0
- package/Source/Assets/Textures/maki/emergency-telephone.png +0 -0
- package/Source/Assets/Textures/maki/entrance.png +0 -0
- package/Source/Assets/Textures/maki/farm.png +0 -0
- package/Source/Assets/Textures/maki/fast-food.png +0 -0
- package/Source/Assets/Textures/maki/ferry.png +0 -0
- package/Source/Assets/Textures/maki/fire-station.png +0 -0
- package/Source/Assets/Textures/maki/fuel.png +0 -0
- package/Source/Assets/Textures/maki/garden.png +0 -0
- package/Source/Assets/Textures/maki/gift.png +0 -0
- package/Source/Assets/Textures/maki/golf.png +0 -0
- package/Source/Assets/Textures/maki/grocery.png +0 -0
- package/Source/Assets/Textures/maki/hairdresser.png +0 -0
- package/Source/Assets/Textures/maki/harbor.png +0 -0
- package/Source/Assets/Textures/maki/heart.png +0 -0
- package/Source/Assets/Textures/maki/heliport.png +0 -0
- package/Source/Assets/Textures/maki/hospital.png +0 -0
- package/Source/Assets/Textures/maki/ice-cream.png +0 -0
- package/Source/Assets/Textures/maki/industrial.png +0 -0
- package/Source/Assets/Textures/maki/land-use.png +0 -0
- package/Source/Assets/Textures/maki/laundry.png +0 -0
- package/Source/Assets/Textures/maki/library.png +0 -0
- package/Source/Assets/Textures/maki/lighthouse.png +0 -0
- package/Source/Assets/Textures/maki/lodging.png +0 -0
- package/Source/Assets/Textures/maki/logging.png +0 -0
- package/Source/Assets/Textures/maki/london-underground.png +0 -0
- package/Source/Assets/Textures/maki/marker-stroked.png +0 -0
- package/Source/Assets/Textures/maki/marker.png +0 -0
- package/Source/Assets/Textures/maki/minefield.png +0 -0
- package/Source/Assets/Textures/maki/mobilephone.png +0 -0
- package/Source/Assets/Textures/maki/monument.png +0 -0
- package/Source/Assets/Textures/maki/museum.png +0 -0
- package/Source/Assets/Textures/maki/music.png +0 -0
- package/Source/Assets/Textures/maki/oil-well.png +0 -0
- package/Source/Assets/Textures/maki/park.png +0 -0
- package/Source/Assets/Textures/maki/park2.png +0 -0
- package/Source/Assets/Textures/maki/parking-garage.png +0 -0
- package/Source/Assets/Textures/maki/parking.png +0 -0
- package/Source/Assets/Textures/maki/pharmacy.png +0 -0
- package/Source/Assets/Textures/maki/pitch.png +0 -0
- package/Source/Assets/Textures/maki/place-of-worship.png +0 -0
- package/Source/Assets/Textures/maki/playground.png +0 -0
- package/Source/Assets/Textures/maki/police.png +0 -0
- package/Source/Assets/Textures/maki/polling-place.png +0 -0
- package/Source/Assets/Textures/maki/post.png +0 -0
- package/Source/Assets/Textures/maki/prison.png +0 -0
- package/Source/Assets/Textures/maki/rail-above.png +0 -0
- package/Source/Assets/Textures/maki/rail-light.png +0 -0
- package/Source/Assets/Textures/maki/rail-metro.png +0 -0
- package/Source/Assets/Textures/maki/rail-underground.png +0 -0
- package/Source/Assets/Textures/maki/rail.png +0 -0
- package/Source/Assets/Textures/maki/religious-christian.png +0 -0
- package/Source/Assets/Textures/maki/religious-jewish.png +0 -0
- package/Source/Assets/Textures/maki/religious-muslim.png +0 -0
- package/Source/Assets/Textures/maki/restaurant.png +0 -0
- package/Source/Assets/Textures/maki/roadblock.png +0 -0
- package/Source/Assets/Textures/maki/rocket.png +0 -0
- package/Source/Assets/Textures/maki/school.png +0 -0
- package/Source/Assets/Textures/maki/scooter.png +0 -0
- package/Source/Assets/Textures/maki/shop.png +0 -0
- package/Source/Assets/Textures/maki/skiing.png +0 -0
- package/Source/Assets/Textures/maki/slaughterhouse.png +0 -0
- package/Source/Assets/Textures/maki/soccer.png +0 -0
- package/Source/Assets/Textures/maki/square-stroked.png +0 -0
- package/Source/Assets/Textures/maki/square.png +0 -0
- package/Source/Assets/Textures/maki/star-stroked.png +0 -0
- package/Source/Assets/Textures/maki/star.png +0 -0
- package/Source/Assets/Textures/maki/suitcase.png +0 -0
- package/Source/Assets/Textures/maki/swimming.png +0 -0
- package/Source/Assets/Textures/maki/telephone.png +0 -0
- package/Source/Assets/Textures/maki/tennis.png +0 -0
- package/Source/Assets/Textures/maki/theatre.png +0 -0
- package/Source/Assets/Textures/maki/toilets.png +0 -0
- package/Source/Assets/Textures/maki/town-hall.png +0 -0
- package/Source/Assets/Textures/maki/town.png +0 -0
- package/Source/Assets/Textures/maki/triangle-stroked.png +0 -0
- package/Source/Assets/Textures/maki/triangle.png +0 -0
- package/Source/Assets/Textures/maki/village.png +0 -0
- package/Source/Assets/Textures/maki/warehouse.png +0 -0
- package/Source/Assets/Textures/maki/waste-basket.png +0 -0
- package/Source/Assets/Textures/maki/water.png +0 -0
- package/Source/Assets/Textures/maki/wetland.png +0 -0
- package/Source/Assets/Textures/maki/zoo.png +0 -0
- package/Source/Assets/Textures/moonSmall.jpg +0 -0
- package/Source/Assets/Textures/pin.svg +1 -0
- package/Source/Assets/Textures/waterNormals.jpg +0 -0
- package/Source/Assets/Textures/waterNormalsSmall.jpg +0 -0
- package/Source/Assets/approximateTerrainHeights.json +1 -0
- package/Source/Core/ApproximateTerrainHeights.js +256 -0
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +728 -0
- package/Source/Core/ArcType.js +31 -0
- package/Source/Core/ArticulationStageType.js +23 -0
- package/Source/Core/AssociativeArray.js +127 -0
- package/Source/Core/AttributeCompression.js +527 -0
- package/Source/Core/AxisAlignedBoundingBox.js +259 -0
- package/Source/Core/BingMapsGeocoderService.js +107 -0
- package/Source/Core/BoundingRectangle.js +373 -0
- package/Source/Core/BoundingSphere.js +1505 -0
- package/Source/Core/BoxGeometry.js +893 -0
- package/Source/Core/BoxOutlineGeometry.js +314 -0
- package/Source/Core/Cartesian2.js +824 -0
- package/Source/Core/Cartesian3.js +1218 -0
- package/Source/Core/Cartesian4.js +980 -0
- package/Source/Core/Cartographic.js +302 -0
- package/Source/Core/CartographicGeocoderService.js +58 -0
- package/Source/Core/CatmullRomSpline.js +324 -0
- package/Source/Core/CesiumTerrainProvider.js +1318 -0
- package/Source/Core/Check.js +213 -0
- package/Source/Core/CircleGeometry.js +203 -0
- package/Source/Core/CircleOutlineGeometry.js +149 -0
- package/Source/Core/Clock.js +319 -0
- package/Source/Core/ClockRange.js +39 -0
- package/Source/Core/ClockStep.js +38 -0
- package/Source/Core/Color.js +2263 -0
- package/Source/Core/ColorGeometryInstanceAttribute.js +182 -0
- package/Source/Core/ComponentDatatype.js +340 -0
- package/Source/Core/CompressedTextureBuffer.js +114 -0
- package/Source/Core/ConstantSpline.js +119 -0
- package/Source/Core/CoplanarPolygonGeometry.js +599 -0
- package/Source/Core/CoplanarPolygonGeometryLibrary.js +132 -0
- package/Source/Core/CoplanarPolygonOutlineGeometry.js +237 -0
- package/Source/Core/CornerType.js +37 -0
- package/Source/Core/CorridorGeometry.js +1416 -0
- package/Source/Core/CorridorGeometryLibrary.js +501 -0
- package/Source/Core/CorridorOutlineGeometry.js +604 -0
- package/Source/Core/Credit.js +166 -0
- package/Source/Core/CubicRealPolynomial.js +238 -0
- package/Source/Core/CullingVolume.js +217 -0
- package/Source/Core/CustomHeightmapTerrainProvider.js +299 -0
- package/Source/Core/CylinderGeometry.js +479 -0
- package/Source/Core/CylinderGeometryLibrary.js +59 -0
- package/Source/Core/CylinderOutlineGeometry.js +269 -0
- package/Source/Core/DefaultProxy.js +26 -0
- package/Source/Core/DeveloperError.js +75 -0
- package/Source/Core/DistanceDisplayCondition.js +172 -0
- package/Source/Core/DistanceDisplayConditionGeometryInstanceAttribute.js +181 -0
- package/Source/Core/DoubleEndedPriorityQueue.js +405 -0
- package/Source/Core/DoublyLinkedList.js +112 -0
- package/Source/Core/EarthOrientationParameters.js +431 -0
- package/Source/Core/EarthOrientationParametersSample.js +52 -0
- package/Source/Core/EasingFunction.js +257 -0
- package/Source/Core/EllipseGeometry.js +1325 -0
- package/Source/Core/EllipseGeometryLibrary.js +365 -0
- package/Source/Core/EllipseOutlineGeometry.js +454 -0
- package/Source/Core/Ellipsoid.js +804 -0
- package/Source/Core/EllipsoidGeodesic.js +523 -0
- package/Source/Core/EllipsoidGeometry.js +649 -0
- package/Source/Core/EllipsoidOutlineGeometry.js +464 -0
- package/Source/Core/EllipsoidRhumbLine.js +745 -0
- package/Source/Core/EllipsoidTangentPlane.js +383 -0
- package/Source/Core/EllipsoidTerrainProvider.js +230 -0
- package/Source/Core/EllipsoidalOccluder.js +559 -0
- package/Source/Core/EncodedCartesian3.js +170 -0
- package/Source/Core/Event.js +164 -0
- package/Source/Core/EventHelper.js +74 -0
- package/Source/Core/ExtrapolationType.js +34 -0
- package/Source/Core/FeatureDetection.js +411 -0
- package/Source/Core/FrustumGeometry.js +583 -0
- package/Source/Core/FrustumOutlineGeometry.js +254 -0
- package/Source/Core/Fullscreen.js +249 -0
- package/Source/Core/GeocodeType.js +24 -0
- package/Source/Core/GeocoderService.js +29 -0
- package/Source/Core/GeographicProjection.js +105 -0
- package/Source/Core/GeographicTilingScheme.js +251 -0
- package/Source/Core/Geometry.js +376 -0
- package/Source/Core/GeometryAttribute.js +138 -0
- package/Source/Core/GeometryAttributes.js +88 -0
- package/Source/Core/GeometryFactory.js +25 -0
- package/Source/Core/GeometryInstance.js +121 -0
- package/Source/Core/GeometryInstanceAttribute.js +138 -0
- package/Source/Core/GeometryOffsetAttribute.js +10 -0
- package/Source/Core/GeometryPipeline.js +3296 -0
- package/Source/Core/GeometryType.js +10 -0
- package/Source/Core/GoogleEarthEnterpriseMetadata.js +597 -0
- package/Source/Core/GoogleEarthEnterpriseTerrainData.js +607 -0
- package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +641 -0
- package/Source/Core/GoogleEarthEnterpriseTileInformation.js +136 -0
- package/Source/Core/GregorianDate.js +69 -0
- package/Source/Core/GroundPolylineGeometry.js +1658 -0
- package/Source/Core/HeadingPitchRange.js +60 -0
- package/Source/Core/HeadingPitchRoll.js +236 -0
- package/Source/Core/Heap.js +234 -0
- package/Source/Core/HeightmapEncoding.js +25 -0
- package/Source/Core/HeightmapTerrainData.js +925 -0
- package/Source/Core/HeightmapTessellator.js +535 -0
- package/Source/Core/HermitePolynomialApproximation.js +342 -0
- package/Source/Core/HermiteSpline.js +620 -0
- package/Source/Core/HilbertOrder.js +118 -0
- package/Source/Core/Iau2000Orientation.js +167 -0
- package/Source/Core/Iau2006XysData.js +277 -0
- package/Source/Core/Iau2006XysSample.js +32 -0
- package/Source/Core/IauOrientationAxes.js +105 -0
- package/Source/Core/IauOrientationParameters.js +54 -0
- package/Source/Core/IndexDatatype.js +199 -0
- package/Source/Core/InterpolationAlgorithm.js +65 -0
- package/Source/Core/InterpolationType.js +14 -0
- package/Source/Core/Intersect.js +34 -0
- package/Source/Core/IntersectionTests.js +1047 -0
- package/Source/Core/Intersections2D.js +358 -0
- package/Source/Core/Interval.js +25 -0
- package/Source/Core/Ion.js +57 -0
- package/Source/Core/IonGeocoderService.js +64 -0
- package/Source/Core/IonResource.js +270 -0
- package/Source/Core/Iso8601.js +54 -0
- package/Source/Core/JulianDate.js +1233 -0
- package/Source/Core/KTX2Transcoder.js +95 -0
- package/Source/Core/KeyboardEventModifier.js +32 -0
- package/Source/Core/LagrangePolynomialApproximation.js +71 -0
- package/Source/Core/LeapSecond.js +24 -0
- package/Source/Core/LinearApproximation.js +83 -0
- package/Source/Core/LinearSpline.js +166 -0
- package/Source/Core/ManagedArray.js +163 -0
- package/Source/Core/MapProjection.js +62 -0
- package/Source/Core/Math.js +1119 -0
- package/Source/Core/Matrix2.js +1092 -0
- package/Source/Core/Matrix3.js +1838 -0
- package/Source/Core/Matrix4.js +3232 -0
- package/Source/Core/MorphWeightSpline.js +161 -0
- package/Source/Core/MortonOrder.js +214 -0
- package/Source/Core/NearFarScalar.js +174 -0
- package/Source/Core/Occluder.js +732 -0
- package/Source/Core/OffsetGeometryInstanceAttribute.js +126 -0
- package/Source/Core/OpenCageGeocoderService.js +118 -0
- package/Source/Core/OrientedBoundingBox.js +1270 -0
- package/Source/Core/OrthographicFrustum.js +338 -0
- package/Source/Core/OrthographicOffCenterFrustum.js +463 -0
- package/Source/Core/Packable.js +40 -0
- package/Source/Core/PackableForInterpolation.js +43 -0
- package/Source/Core/PeliasGeocoderService.js +93 -0
- package/Source/Core/PerspectiveFrustum.js +439 -0
- package/Source/Core/PerspectiveOffCenterFrustum.js +523 -0
- package/Source/Core/PinBuilder.js +234 -0
- package/Source/Core/PixelFormat.js +493 -0
- package/Source/Core/Plane.js +312 -0
- package/Source/Core/PlaneGeometry.js +250 -0
- package/Source/Core/PlaneOutlineGeometry.js +113 -0
- package/Source/Core/PolygonGeometry.js +1436 -0
- package/Source/Core/PolygonGeometryLibrary.js +981 -0
- package/Source/Core/PolygonHierarchy.js +25 -0
- package/Source/Core/PolygonOutlineGeometry.js +692 -0
- package/Source/Core/PolygonPipeline.js +633 -0
- package/Source/Core/PolylineGeometry.js +578 -0
- package/Source/Core/PolylinePipeline.js +580 -0
- package/Source/Core/PolylineVolumeGeometry.js +417 -0
- package/Source/Core/PolylineVolumeGeometryLibrary.js +701 -0
- package/Source/Core/PolylineVolumeOutlineGeometry.js +299 -0
- package/Source/Core/PrimitiveType.js +107 -0
- package/Source/Core/Proxy.js +24 -0
- package/Source/Core/QuadraticRealPolynomial.js +147 -0
- package/Source/Core/QuantizedMeshTerrainData.js +772 -0
- package/Source/Core/QuarticRealPolynomial.js +342 -0
- package/Source/Core/Quaternion.js +1142 -0
- package/Source/Core/QuaternionSpline.js +155 -0
- package/Source/Core/Queue.js +126 -0
- package/Source/Core/Ray.js +80 -0
- package/Source/Core/Rectangle.js +982 -0
- package/Source/Core/RectangleCollisionChecker.js +95 -0
- package/Source/Core/RectangleGeometry.js +1489 -0
- package/Source/Core/RectangleGeometryLibrary.js +283 -0
- package/Source/Core/RectangleOutlineGeometry.js +537 -0
- package/Source/Core/ReferenceFrame.js +23 -0
- package/Source/Core/Request.js +192 -0
- package/Source/Core/RequestErrorEvent.js +58 -0
- package/Source/Core/RequestScheduler.js +520 -0
- package/Source/Core/RequestState.js +55 -0
- package/Source/Core/RequestType.js +39 -0
- package/Source/Core/Resource.js +2307 -0
- package/Source/Core/RuntimeError.js +65 -0
- package/Source/Core/S2Cell.js +811 -0
- package/Source/Core/ScreenSpaceEventHandler.js +1140 -0
- package/Source/Core/ScreenSpaceEventType.js +127 -0
- package/Source/Core/ShowGeometryInstanceAttribute.js +123 -0
- package/Source/Core/Simon1994PlanetaryPositions.js +682 -0
- package/Source/Core/SimplePolylineGeometry.js +457 -0
- package/Source/Core/SphereGeometry.js +118 -0
- package/Source/Core/SphereOutlineGeometry.js +120 -0
- package/Source/Core/Spherical.js +184 -0
- package/Source/Core/Spline.js +189 -0
- package/Source/Core/SteppedSpline.js +160 -0
- package/Source/Core/TaskProcessor.js +377 -0
- package/Source/Core/TerrainData.js +125 -0
- package/Source/Core/TerrainEncoding.js +607 -0
- package/Source/Core/TerrainExaggeration.js +49 -0
- package/Source/Core/TerrainMesh.js +156 -0
- package/Source/Core/TerrainProvider.js +461 -0
- package/Source/Core/TerrainQuantization.js +25 -0
- package/Source/Core/TileAvailability.js +564 -0
- package/Source/Core/TileEdge.js +14 -0
- package/Source/Core/TileProviderError.js +171 -0
- package/Source/Core/TilingScheme.js +132 -0
- package/Source/Core/TimeConstants.js +83 -0
- package/Source/Core/TimeInterval.js +438 -0
- package/Source/Core/TimeIntervalCollection.js +1136 -0
- package/Source/Core/TimeStandard.js +30 -0
- package/Source/Core/Tipsify.js +314 -0
- package/Source/Core/Transforms.js +1132 -0
- package/Source/Core/TranslationRotationScale.js +60 -0
- package/Source/Core/TridiagonalSystemSolver.js +113 -0
- package/Source/Core/TrustedServers.js +146 -0
- package/Source/Core/VRTheWorldTerrainProvider.js +450 -0
- package/Source/Core/VertexFormat.js +311 -0
- package/Source/Core/VideoSynchronizer.js +222 -0
- package/Source/Core/Visibility.js +34 -0
- package/Source/Core/VulkanConstants.js +286 -0
- package/Source/Core/WallGeometry.js +626 -0
- package/Source/Core/WallGeometryLibrary.js +212 -0
- package/Source/Core/WallOutlineGeometry.js +434 -0
- package/Source/Core/WebGLConstants.js +614 -0
- package/Source/Core/WebMercatorProjection.js +154 -0
- package/Source/Core/WebMercatorTilingScheme.js +297 -0
- package/Source/Core/WindingOrder.js +36 -0
- package/Source/Core/WireframeIndexGenerator.js +238 -0
- package/Source/Core/appendForwardSlash.js +10 -0
- package/Source/Core/arrayRemoveDuplicates.js +130 -0
- package/Source/Core/barycentricCoordinates.js +109 -0
- package/Source/Core/binarySearch.js +67 -0
- package/Source/Core/buildModuleUrl.js +151 -0
- package/Source/Core/cancelAnimationFrame.js +53 -0
- package/Source/Core/clone.js +32 -0
- package/Source/Core/combine.js +80 -0
- package/Source/Core/createGuid.js +22 -0
- package/Source/Core/createWorldTerrain.js +42 -0
- package/Source/Core/decodeGoogleEarthEnterpriseData.js +93 -0
- package/Source/Core/decodeVectorPolylinePositions.js +51 -0
- package/Source/Core/defaultValue.js +29 -0
- package/Source/Core/defer.js +44 -0
- package/Source/Core/defined.js +17 -0
- package/Source/Core/deprecationWarning.js +53 -0
- package/Source/Core/destroyObject.js +57 -0
- package/Source/Core/formatError.js +30 -0
- package/Source/Core/getAbsoluteUri.js +47 -0
- package/Source/Core/getBaseUri.js +47 -0
- package/Source/Core/getExtensionFromUri.js +38 -0
- package/Source/Core/getFilenameFromUri.js +32 -0
- package/Source/Core/getImageFromTypedArray.js +24 -0
- package/Source/Core/getImagePixels.js +43 -0
- package/Source/Core/getJsonFromTypedArray.js +21 -0
- package/Source/Core/getMagic.js +15 -0
- package/Source/Core/getStringFromTypedArray.js +166 -0
- package/Source/Core/getTimestamp.js +26 -0
- package/Source/Core/isBitSet.js +7 -0
- package/Source/Core/isBlobUri.js +22 -0
- package/Source/Core/isCrossOriginUrl.js +30 -0
- package/Source/Core/isDataUri.js +22 -0
- package/Source/Core/isLeapYear.js +23 -0
- package/Source/Core/loadAndExecuteScript.js +27 -0
- package/Source/Core/loadImageFromTypedArray.js +64 -0
- package/Source/Core/loadKTX2.js +104 -0
- package/Source/Core/mergeSort.js +111 -0
- package/Source/Core/objectToQuery.js +57 -0
- package/Source/Core/oneTimeWarning.js +52 -0
- package/Source/Core/parseResponseHeaders.js +37 -0
- package/Source/Core/pointInsideTriangle.js +39 -0
- package/Source/Core/queryToObject.js +60 -0
- package/Source/Core/requestAnimationFrame.js +83 -0
- package/Source/Core/resizeImageToNextPowerOfTwo.js +31 -0
- package/Source/Core/sampleTerrain.js +257 -0
- package/Source/Core/sampleTerrainMostDetailed.js +117 -0
- package/Source/Core/scaleToGeodeticSurface.js +147 -0
- package/Source/Core/subdivideArray.js +35 -0
- package/Source/Core/webGLConstantToGlslType.js +25 -0
- package/Source/Core/wrapFunction.js +26 -0
- package/Source/Core/writeTextToCanvas.js +222 -0
- package/Source/DataSources/BillboardGraphics.js +429 -0
- package/Source/DataSources/BillboardVisualizer.js +341 -0
- package/Source/DataSources/BoundingSphereState.js +26 -0
- package/Source/DataSources/BoxGeometryUpdater.js +325 -0
- package/Source/DataSources/BoxGraphics.js +213 -0
- package/Source/DataSources/CallbackProperty.js +111 -0
- package/Source/DataSources/Cesium3DTilesetGraphics.js +113 -0
- package/Source/DataSources/Cesium3DTilesetVisualizer.js +249 -0
- package/Source/DataSources/CheckerboardMaterialProperty.js +151 -0
- package/Source/DataSources/ColorMaterialProperty.js +106 -0
- package/Source/DataSources/CompositeEntityCollection.js +592 -0
- package/Source/DataSources/CompositeMaterialProperty.js +129 -0
- package/Source/DataSources/CompositePositionProperty.js +149 -0
- package/Source/DataSources/CompositeProperty.js +154 -0
- package/Source/DataSources/ConstantPositionProperty.js +146 -0
- package/Source/DataSources/ConstantProperty.js +116 -0
- package/Source/DataSources/CorridorGeometryUpdater.js +404 -0
- package/Source/DataSources/CorridorGraphics.js +328 -0
- package/Source/DataSources/CustomDataSource.js +173 -0
- package/Source/DataSources/CylinderGeometryUpdater.js +373 -0
- package/Source/DataSources/CylinderGraphics.js +265 -0
- package/Source/DataSources/CzmlDataSource.js +5141 -0
- package/Source/DataSources/DataSource.js +121 -0
- package/Source/DataSources/DataSourceClock.js +165 -0
- package/Source/DataSources/DataSourceCollection.js +336 -0
- package/Source/DataSources/DataSourceDisplay.js +510 -0
- package/Source/DataSources/DynamicGeometryBatch.js +56 -0
- package/Source/DataSources/DynamicGeometryUpdater.js +274 -0
- package/Source/DataSources/EllipseGeometryUpdater.js +430 -0
- package/Source/DataSources/EllipseGraphics.js +357 -0
- package/Source/DataSources/EllipsoidGeometryUpdater.js +710 -0
- package/Source/DataSources/EllipsoidGraphics.js +323 -0
- package/Source/DataSources/Entity.js +752 -0
- package/Source/DataSources/EntityCluster.js +997 -0
- package/Source/DataSources/EntityCollection.js +440 -0
- package/Source/DataSources/EntityView.js +426 -0
- package/Source/DataSources/GeoJsonDataSource.js +1064 -0
- package/Source/DataSources/GeometryUpdater.js +545 -0
- package/Source/DataSources/GeometryVisualizer.js +620 -0
- package/Source/DataSources/GpxDataSource.js +1023 -0
- package/Source/DataSources/GridMaterialProperty.js +198 -0
- package/Source/DataSources/GroundGeometryUpdater.js +232 -0
- package/Source/DataSources/ImageMaterialProperty.js +166 -0
- package/Source/DataSources/KmlCamera.js +13 -0
- package/Source/DataSources/KmlDataSource.js +4326 -0
- package/Source/DataSources/KmlLookAt.js +12 -0
- package/Source/DataSources/KmlTour.js +176 -0
- package/Source/DataSources/KmlTourFlyTo.js +109 -0
- package/Source/DataSources/KmlTourWait.js +52 -0
- package/Source/DataSources/LabelGraphics.js +430 -0
- package/Source/DataSources/LabelVisualizer.js +360 -0
- package/Source/DataSources/MaterialProperty.js +105 -0
- package/Source/DataSources/ModelGraphics.js +447 -0
- package/Source/DataSources/ModelVisualizer.js +548 -0
- package/Source/DataSources/NodeTransformationProperty.js +144 -0
- package/Source/DataSources/PathGraphics.js +163 -0
- package/Source/DataSources/PathVisualizer.js +759 -0
- package/Source/DataSources/PlaneGeometryUpdater.js +384 -0
- package/Source/DataSources/PlaneGraphics.js +210 -0
- package/Source/DataSources/PointGraphics.js +221 -0
- package/Source/DataSources/PointVisualizer.js +426 -0
- package/Source/DataSources/PolygonGeometryUpdater.js +575 -0
- package/Source/DataSources/PolygonGraphics.js +400 -0
- package/Source/DataSources/PolylineArrowMaterialProperty.js +104 -0
- package/Source/DataSources/PolylineDashMaterialProperty.js +168 -0
- package/Source/DataSources/PolylineGeometryUpdater.js +886 -0
- package/Source/DataSources/PolylineGlowMaterialProperty.js +146 -0
- package/Source/DataSources/PolylineGraphics.js +248 -0
- package/Source/DataSources/PolylineOutlineMaterialProperty.js +152 -0
- package/Source/DataSources/PolylineVisualizer.js +414 -0
- package/Source/DataSources/PolylineVolumeGeometryUpdater.js +304 -0
- package/Source/DataSources/PolylineVolumeGraphics.js +237 -0
- package/Source/DataSources/PositionProperty.js +133 -0
- package/Source/DataSources/PositionPropertyArray.js +187 -0
- package/Source/DataSources/Property.js +138 -0
- package/Source/DataSources/PropertyArray.js +147 -0
- package/Source/DataSources/PropertyBag.js +275 -0
- package/Source/DataSources/RectangleGeometryUpdater.js +422 -0
- package/Source/DataSources/RectangleGraphics.js +329 -0
- package/Source/DataSources/ReferenceProperty.js +365 -0
- package/Source/DataSources/Rotation.js +156 -0
- package/Source/DataSources/SampledPositionProperty.js +325 -0
- package/Source/DataSources/SampledProperty.js +834 -0
- package/Source/DataSources/ScaledPositionProperty.js +97 -0
- package/Source/DataSources/StaticGeometryColorBatch.js +570 -0
- package/Source/DataSources/StaticGeometryPerMaterialBatch.js +488 -0
- package/Source/DataSources/StaticGroundGeometryColorBatch.js +395 -0
- package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +426 -0
- package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +434 -0
- package/Source/DataSources/StaticOutlineGeometryBatch.js +466 -0
- package/Source/DataSources/StripeMaterialProperty.js +187 -0
- package/Source/DataSources/StripeOrientation.js +19 -0
- package/Source/DataSources/TerrainOffsetProperty.js +246 -0
- package/Source/DataSources/TimeIntervalCollectionPositionProperty.js +152 -0
- package/Source/DataSources/TimeIntervalCollectionProperty.js +136 -0
- package/Source/DataSources/VelocityOrientationProperty.js +154 -0
- package/Source/DataSources/VelocityVectorProperty.js +216 -0
- package/Source/DataSources/Visualizer.js +61 -0
- package/Source/DataSources/WallGeometryUpdater.js +275 -0
- package/Source/DataSources/WallGraphics.js +244 -0
- package/Source/DataSources/createMaterialPropertyDescriptor.js +35 -0
- package/Source/DataSources/createPropertyDescriptor.js +72 -0
- package/Source/DataSources/createRawPropertyDescriptor.js +13 -0
- package/Source/DataSources/exportKml.js +1519 -0
- package/Source/DataSources/getElement.js +26 -0
- package/Source/DataSources/heightReferenceOnEntityPropertyChanged.js +47 -0
- package/Source/Renderer/AutomaticUniforms.js +1625 -0
- package/Source/Renderer/Buffer.js +420 -0
- package/Source/Renderer/BufferUsage.js +19 -0
- package/Source/Renderer/ClearCommand.js +102 -0
- package/Source/Renderer/ComputeCommand.js +119 -0
- package/Source/Renderer/ComputeEngine.js +135 -0
- package/Source/Renderer/Context.js +1601 -0
- package/Source/Renderer/ContextLimits.js +297 -0
- package/Source/Renderer/CubeMap.js +631 -0
- package/Source/Renderer/CubeMapFace.js +361 -0
- package/Source/Renderer/DrawCommand.js +610 -0
- package/Source/Renderer/Framebuffer.js +448 -0
- package/Source/Renderer/FramebufferManager.js +497 -0
- package/Source/Renderer/MipmapHint.js +19 -0
- package/Source/Renderer/MultisampleFramebuffer.js +115 -0
- package/Source/Renderer/Pass.js +26 -0
- package/Source/Renderer/PassState.js +57 -0
- package/Source/Renderer/PixelDatatype.js +98 -0
- package/Source/Renderer/RenderState.js +996 -0
- package/Source/Renderer/Renderbuffer.js +103 -0
- package/Source/Renderer/RenderbufferFormat.js +42 -0
- package/Source/Renderer/Sampler.js +109 -0
- package/Source/Renderer/ShaderBuilder.js +593 -0
- package/Source/Renderer/ShaderCache.js +291 -0
- package/Source/Renderer/ShaderDestination.js +51 -0
- package/Source/Renderer/ShaderFunction.js +66 -0
- package/Source/Renderer/ShaderProgram.js +612 -0
- package/Source/Renderer/ShaderSource.js +519 -0
- package/Source/Renderer/ShaderStruct.js +55 -0
- package/Source/Renderer/Texture.js +1035 -0
- package/Source/Renderer/TextureCache.js +81 -0
- package/Source/Renderer/TextureMagnificationFilter.js +41 -0
- package/Source/Renderer/TextureMinificationFilter.js +94 -0
- package/Source/Renderer/TextureWrap.js +19 -0
- package/Source/Renderer/UniformState.js +1710 -0
- package/Source/Renderer/VertexArray.js +853 -0
- package/Source/Renderer/VertexArrayFacade.js +514 -0
- package/Source/Renderer/createUniform.js +419 -0
- package/Source/Renderer/createUniformArray.js +637 -0
- package/Source/Renderer/freezeRenderState.js +30 -0
- package/Source/Renderer/loadCubeMap.js +93 -0
- package/Source/Renderer/modernizeShader.js +242 -0
- package/Source/Scene/AlphaMode.js +33 -0
- package/Source/Scene/Appearance.js +204 -0
- package/Source/Scene/ArcGisMapServerImageryProvider.js +905 -0
- package/Source/Scene/AttributeType.js +200 -0
- package/Source/Scene/AutoExposure.js +387 -0
- package/Source/Scene/Axis.js +111 -0
- package/Source/Scene/B3dmParser.js +174 -0
- package/Source/Scene/BatchTable.js +636 -0
- package/Source/Scene/BatchTableHierarchy.js +556 -0
- package/Source/Scene/BatchTexture.js +574 -0
- package/Source/Scene/Billboard.js +1552 -0
- package/Source/Scene/BillboardCollection.js +2417 -0
- package/Source/Scene/BingMapsImageryProvider.js +855 -0
- package/Source/Scene/BingMapsStyle.js +93 -0
- package/Source/Scene/BlendEquation.js +53 -0
- package/Source/Scene/BlendFunction.js +129 -0
- package/Source/Scene/BlendOption.js +28 -0
- package/Source/Scene/BlendingState.js +73 -0
- package/Source/Scene/BoxEmitter.js +75 -0
- package/Source/Scene/BrdfLutGenerator.js +75 -0
- package/Source/Scene/BufferLoader.js +146 -0
- package/Source/Scene/Camera.js +3951 -0
- package/Source/Scene/CameraEventAggregator.js +565 -0
- package/Source/Scene/CameraEventType.js +47 -0
- package/Source/Scene/CameraFlightPath.js +576 -0
- package/Source/Scene/Cesium3DContentGroup.js +44 -0
- package/Source/Scene/Cesium3DTile.js +2115 -0
- package/Source/Scene/Cesium3DTileBatchTable.js +1176 -0
- package/Source/Scene/Cesium3DTileColorBlendMode.js +52 -0
- package/Source/Scene/Cesium3DTileContent.js +397 -0
- package/Source/Scene/Cesium3DTileContentFactory.js +104 -0
- package/Source/Scene/Cesium3DTileContentState.js +12 -0
- package/Source/Scene/Cesium3DTileContentType.js +160 -0
- package/Source/Scene/Cesium3DTileFeature.js +444 -0
- package/Source/Scene/Cesium3DTileFeatureTable.js +132 -0
- package/Source/Scene/Cesium3DTileOptimizationHint.js +13 -0
- package/Source/Scene/Cesium3DTileOptimizations.js +115 -0
- package/Source/Scene/Cesium3DTilePass.js +82 -0
- package/Source/Scene/Cesium3DTilePassState.js +52 -0
- package/Source/Scene/Cesium3DTilePointFeature.js +864 -0
- package/Source/Scene/Cesium3DTileRefine.js +29 -0
- package/Source/Scene/Cesium3DTileStyle.js +1475 -0
- package/Source/Scene/Cesium3DTileStyleEngine.js +78 -0
- package/Source/Scene/Cesium3DTileset.js +3158 -0
- package/Source/Scene/Cesium3DTilesetCache.js +82 -0
- package/Source/Scene/Cesium3DTilesetHeatmap.js +165 -0
- package/Source/Scene/Cesium3DTilesetMetadata.js +199 -0
- package/Source/Scene/Cesium3DTilesetMostDetailedTraversal.js +144 -0
- package/Source/Scene/Cesium3DTilesetStatistics.js +129 -0
- package/Source/Scene/Cesium3DTilesetTraversal.js +773 -0
- package/Source/Scene/CircleEmitter.js +62 -0
- package/Source/Scene/ClassificationPrimitive.js +1433 -0
- package/Source/Scene/ClassificationType.js +35 -0
- package/Source/Scene/ClippingPlane.js +184 -0
- package/Source/Scene/ClippingPlaneCollection.js +771 -0
- package/Source/Scene/CloudCollection.js +1050 -0
- package/Source/Scene/CloudType.js +33 -0
- package/Source/Scene/ColorBlendMode.js +33 -0
- package/Source/Scene/Composite3DTileContent.js +346 -0
- package/Source/Scene/ConditionsExpression.js +218 -0
- package/Source/Scene/ConeEmitter.js +62 -0
- package/Source/Scene/ContentMetadata.js +184 -0
- package/Source/Scene/CreditDisplay.js +610 -0
- package/Source/Scene/CullFace.js +33 -0
- package/Source/Scene/CumulusCloud.js +353 -0
- package/Source/Scene/DebugAppearance.js +268 -0
- package/Source/Scene/DebugCameraPrimitive.js +257 -0
- package/Source/Scene/DebugInspector.js +151 -0
- package/Source/Scene/DebugModelMatrixPrimitive.js +222 -0
- package/Source/Scene/DepthFunction.js +73 -0
- package/Source/Scene/DepthPlane.js +245 -0
- package/Source/Scene/DerivedCommand.js +433 -0
- package/Source/Scene/DeviceOrientationCameraController.js +120 -0
- package/Source/Scene/DirectionalLight.js +50 -0
- package/Source/Scene/DiscardEmptyTileImagePolicy.js +54 -0
- package/Source/Scene/DiscardMissingTileImagePolicy.js +148 -0
- package/Source/Scene/DracoLoader.js +76 -0
- package/Source/Scene/EllipsoidPrimitive.js +511 -0
- package/Source/Scene/EllipsoidSurfaceAppearance.js +282 -0
- package/Source/Scene/Empty3DTileContent.js +151 -0
- package/Source/Scene/Expression.js +2232 -0
- package/Source/Scene/ExpressionNodeType.js +25 -0
- package/Source/Scene/Fog.js +205 -0
- package/Source/Scene/FrameRateMonitor.js +384 -0
- package/Source/Scene/FrameState.js +419 -0
- package/Source/Scene/FrustumCommands.js +30 -0
- package/Source/Scene/Geometry3DTileContent.js +526 -0
- package/Source/Scene/GetFeatureInfoFormat.js +395 -0
- package/Source/Scene/Globe.js +1121 -0
- package/Source/Scene/GlobeDepth.js +378 -0
- package/Source/Scene/GlobeSurfaceShaderSet.js +413 -0
- package/Source/Scene/GlobeSurfaceTile.js +997 -0
- package/Source/Scene/GlobeSurfaceTileProvider.js +2818 -0
- package/Source/Scene/GlobeTranslucency.js +239 -0
- package/Source/Scene/GlobeTranslucencyFramebuffer.js +201 -0
- package/Source/Scene/GlobeTranslucencyState.js +1117 -0
- package/Source/Scene/GltfBufferViewLoader.js +268 -0
- package/Source/Scene/GltfDracoLoader.js +250 -0
- package/Source/Scene/GltfImageLoader.js +327 -0
- package/Source/Scene/GltfIndexBufferLoader.js +429 -0
- package/Source/Scene/GltfJsonLoader.js +301 -0
- package/Source/Scene/GltfLoader.js +2663 -0
- package/Source/Scene/GltfLoaderUtil.js +201 -0
- package/Source/Scene/GltfPipeline/ForEach.js +424 -0
- package/Source/Scene/GltfPipeline/addBuffer.js +30 -0
- package/Source/Scene/GltfPipeline/addDefaults.js +236 -0
- package/Source/Scene/GltfPipeline/addExtensionsRequired.js +24 -0
- package/Source/Scene/GltfPipeline/addExtensionsUsed.js +22 -0
- package/Source/Scene/GltfPipeline/addPipelineExtras.js +36 -0
- package/Source/Scene/GltfPipeline/addToArray.js +25 -0
- package/Source/Scene/GltfPipeline/findAccessorMinMax.js +71 -0
- package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +139 -0
- package/Source/Scene/GltfPipeline/getAccessorByteStride.js +29 -0
- package/Source/Scene/GltfPipeline/getComponentReader.js +147 -0
- package/Source/Scene/GltfPipeline/moveTechniqueRenderStates.js +138 -0
- package/Source/Scene/GltfPipeline/moveTechniquesToExtension.js +145 -0
- package/Source/Scene/GltfPipeline/numberOfComponentsForType.js +29 -0
- package/Source/Scene/GltfPipeline/parseGlb.js +122 -0
- package/Source/Scene/GltfPipeline/readAccessorPacked.js +54 -0
- package/Source/Scene/GltfPipeline/removeExtension.js +64 -0
- package/Source/Scene/GltfPipeline/removeExtensionsRequired.js +24 -0
- package/Source/Scene/GltfPipeline/removeExtensionsUsed.js +26 -0
- package/Source/Scene/GltfPipeline/removePipelineExtras.js +42 -0
- package/Source/Scene/GltfPipeline/removeUnusedElements.js +881 -0
- package/Source/Scene/GltfPipeline/updateAccessorComponentTypes.js +53 -0
- package/Source/Scene/GltfPipeline/updateVersion.js +1151 -0
- package/Source/Scene/GltfPipeline/usesExtension.js +18 -0
- package/Source/Scene/GltfStructuralMetadataLoader.js +504 -0
- package/Source/Scene/GltfTextureLoader.js +383 -0
- package/Source/Scene/GltfVertexBufferLoader.js +470 -0
- package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +758 -0
- package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +756 -0
- package/Source/Scene/GridImageryProvider.js +436 -0
- package/Source/Scene/GroundPolylinePrimitive.js +926 -0
- package/Source/Scene/GroundPrimitive.js +1040 -0
- package/Source/Scene/GroupMetadata.js +203 -0
- package/Source/Scene/HeightReference.js +28 -0
- package/Source/Scene/HorizontalOrigin.js +41 -0
- package/Source/Scene/I3SDataProvider.js +668 -0
- package/Source/Scene/I3SFeature.js +63 -0
- package/Source/Scene/I3SField.js +255 -0
- package/Source/Scene/I3SGeometry.js +409 -0
- package/Source/Scene/I3SLayer.js +365 -0
- package/Source/Scene/I3SNode.js +816 -0
- package/Source/Scene/I3dmParser.js +141 -0
- package/Source/Scene/ImageBasedLighting.js +510 -0
- package/Source/Scene/Imagery.js +120 -0
- package/Source/Scene/ImageryLayer.js +1541 -0
- package/Source/Scene/ImageryLayerCollection.js +621 -0
- package/Source/Scene/ImageryLayerFeatureInfo.js +112 -0
- package/Source/Scene/ImageryProvider.js +387 -0
- package/Source/Scene/ImageryState.js +14 -0
- package/Source/Scene/Implicit3DTileContent.js +1154 -0
- package/Source/Scene/ImplicitAvailabilityBitstream.js +137 -0
- package/Source/Scene/ImplicitMetadataView.js +178 -0
- package/Source/Scene/ImplicitSubdivisionScheme.js +48 -0
- package/Source/Scene/ImplicitSubtree.js +1146 -0
- package/Source/Scene/ImplicitSubtreeMetadata.js +191 -0
- package/Source/Scene/ImplicitTileCoordinates.js +647 -0
- package/Source/Scene/ImplicitTileset.js +263 -0
- package/Source/Scene/InstanceAttributeSemantic.js +79 -0
- package/Source/Scene/InvertClassification.js +382 -0
- package/Source/Scene/IonImageryProvider.js +555 -0
- package/Source/Scene/IonWorldImageryStyle.js +33 -0
- package/Source/Scene/JobScheduler.js +199 -0
- package/Source/Scene/JobType.js +10 -0
- package/Source/Scene/JsonMetadataTable.js +114 -0
- package/Source/Scene/Label.js +1588 -0
- package/Source/Scene/LabelCollection.js +994 -0
- package/Source/Scene/LabelStyle.js +33 -0
- package/Source/Scene/Light.js +34 -0
- package/Source/Scene/MapMode2D.js +23 -0
- package/Source/Scene/MapboxImageryProvider.js +448 -0
- package/Source/Scene/MapboxStyleImageryProvider.js +457 -0
- package/Source/Scene/Material.js +1742 -0
- package/Source/Scene/MaterialAppearance.js +334 -0
- package/Source/Scene/MetadataClass.js +167 -0
- package/Source/Scene/MetadataClassProperty.js +1104 -0
- package/Source/Scene/MetadataComponentType.js +448 -0
- package/Source/Scene/MetadataEntity.js +425 -0
- package/Source/Scene/MetadataEnum.js +186 -0
- package/Source/Scene/MetadataEnumValue.js +97 -0
- package/Source/Scene/MetadataSchema.js +173 -0
- package/Source/Scene/MetadataSchemaLoader.js +145 -0
- package/Source/Scene/MetadataSemantic.js +145 -0
- package/Source/Scene/MetadataTable.js +357 -0
- package/Source/Scene/MetadataTableProperty.js +859 -0
- package/Source/Scene/MetadataType.js +208 -0
- package/Source/Scene/Model/AlphaPipelineStage.js +52 -0
- package/Source/Scene/Model/B3dmLoader.js +379 -0
- package/Source/Scene/Model/BatchTexturePipelineStage.js +72 -0
- package/Source/Scene/Model/CPUStylingPipelineStage.js +77 -0
- package/Source/Scene/Model/ClassificationModelDrawCommand.js +533 -0
- package/Source/Scene/Model/ClassificationPipelineStage.js +132 -0
- package/Source/Scene/Model/CustomShader.js +473 -0
- package/Source/Scene/Model/CustomShaderMode.js +40 -0
- package/Source/Scene/Model/CustomShaderPipelineStage.js +654 -0
- package/Source/Scene/Model/CustomShaderTranslucencyMode.js +35 -0
- package/Source/Scene/Model/DequantizationPipelineStage.js +178 -0
- package/Source/Scene/Model/FeatureIdPipelineStage.js +504 -0
- package/Source/Scene/Model/GeoJsonLoader.js +722 -0
- package/Source/Scene/Model/GeometryPipelineStage.js +558 -0
- package/Source/Scene/Model/I3dmLoader.js +909 -0
- package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +147 -0
- package/Source/Scene/Model/InstancingPipelineStage.js +1043 -0
- package/Source/Scene/Model/LightingModel.js +30 -0
- package/Source/Scene/Model/LightingPipelineStage.js +75 -0
- package/Source/Scene/Model/MaterialPipelineStage.js +510 -0
- package/Source/Scene/Model/MetadataPipelineStage.js +638 -0
- package/Source/Scene/Model/Model.js +2847 -0
- package/Source/Scene/Model/Model3DTileContent.js +451 -0
- package/Source/Scene/Model/ModelAlphaOptions.js +26 -0
- package/Source/Scene/Model/ModelAnimation.js +422 -0
- package/Source/Scene/Model/ModelAnimationChannel.js +293 -0
- package/Source/Scene/Model/ModelAnimationCollection.js +553 -0
- package/Source/Scene/Model/ModelArticulation.js +214 -0
- package/Source/Scene/Model/ModelArticulationStage.js +261 -0
- package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +126 -0
- package/Source/Scene/Model/ModelColorPipelineStage.js +99 -0
- package/Source/Scene/Model/ModelDrawCommand.js +864 -0
- package/Source/Scene/Model/ModelFeature.js +229 -0
- package/Source/Scene/Model/ModelFeatureTable.js +322 -0
- package/Source/Scene/Model/ModelLightingOptions.js +29 -0
- package/Source/Scene/Model/ModelMatrixUpdateStage.js +108 -0
- package/Source/Scene/Model/ModelNode.js +125 -0
- package/Source/Scene/Model/ModelRenderResources.js +106 -0
- package/Source/Scene/Model/ModelRuntimeNode.js +648 -0
- package/Source/Scene/Model/ModelRuntimePrimitive.js +340 -0
- package/Source/Scene/Model/ModelSceneGraph.js +968 -0
- package/Source/Scene/Model/ModelSilhouettePipelineStage.js +109 -0
- package/Source/Scene/Model/ModelSkin.js +180 -0
- package/Source/Scene/Model/ModelSplitterPipelineStage.js +66 -0
- package/Source/Scene/Model/ModelStatistics.js +197 -0
- package/Source/Scene/Model/ModelType.js +94 -0
- package/Source/Scene/Model/ModelUtility.js +386 -0
- package/Source/Scene/Model/MorphTargetsPipelineStage.js +249 -0
- package/Source/Scene/Model/NodeRenderResources.js +160 -0
- package/Source/Scene/Model/NodeStatisticsPipelineStage.js +75 -0
- package/Source/Scene/Model/PickingPipelineStage.js +219 -0
- package/Source/Scene/Model/PntsLoader.js +717 -0
- package/Source/Scene/Model/PointCloudStylingPipelineStage.js +396 -0
- package/Source/Scene/Model/PrimitiveOutlineGenerator.js +689 -0
- package/Source/Scene/Model/PrimitiveOutlinePipelineStage.js +99 -0
- package/Source/Scene/Model/PrimitiveRenderResources.js +297 -0
- package/Source/Scene/Model/PrimitiveStatisticsPipelineStage.js +253 -0
- package/Source/Scene/Model/SceneMode2DPipelineStage.js +301 -0
- package/Source/Scene/Model/SelectedFeatureIdPipelineStage.js +185 -0
- package/Source/Scene/Model/SkinningPipelineStage.js +118 -0
- package/Source/Scene/Model/StyleCommandsNeeded.js +29 -0
- package/Source/Scene/Model/TextureManager.js +244 -0
- package/Source/Scene/Model/TextureUniform.js +74 -0
- package/Source/Scene/Model/TilesetPipelineStage.js +73 -0
- package/Source/Scene/Model/UniformType.js +124 -0
- package/Source/Scene/Model/VaryingType.js +61 -0
- package/Source/Scene/Model/WireframePipelineStage.js +118 -0
- package/Source/Scene/Model/buildDrawCommand.js +153 -0
- package/Source/Scene/ModelAnimationLoop.js +33 -0
- package/Source/Scene/ModelAnimationState.js +9 -0
- package/Source/Scene/ModelComponents.js +1466 -0
- package/Source/Scene/Moon.js +174 -0
- package/Source/Scene/Multiple3DTileContent.js +674 -0
- package/Source/Scene/NeverTileDiscardPolicy.js +28 -0
- package/Source/Scene/OIT.js +893 -0
- package/Source/Scene/OctahedralProjectedCubeMap.js +456 -0
- package/Source/Scene/OpenStreetMapImageryProvider.js +124 -0
- package/Source/Scene/OrderedGroundPrimitiveCollection.js +219 -0
- package/Source/Scene/Particle.js +155 -0
- package/Source/Scene/ParticleBurst.js +51 -0
- package/Source/Scene/ParticleEmitter.js +36 -0
- package/Source/Scene/ParticleSystem.js +910 -0
- package/Source/Scene/PerInstanceColorAppearance.js +296 -0
- package/Source/Scene/PerformanceDisplay.js +120 -0
- package/Source/Scene/PickDepth.js +105 -0
- package/Source/Scene/PickDepthFramebuffer.js +79 -0
- package/Source/Scene/PickFramebuffer.js +125 -0
- package/Source/Scene/Picking.js +1316 -0
- package/Source/Scene/PntsParser.js +480 -0
- package/Source/Scene/PointCloud.js +1425 -0
- package/Source/Scene/PointCloudEyeDomeLighting.js +279 -0
- package/Source/Scene/PointCloudShading.js +113 -0
- package/Source/Scene/PointPrimitive.js +668 -0
- package/Source/Scene/PointPrimitiveCollection.js +1217 -0
- package/Source/Scene/Polyline.js +431 -0
- package/Source/Scene/PolylineCollection.js +1962 -0
- package/Source/Scene/PolylineColorAppearance.js +224 -0
- package/Source/Scene/PolylineMaterialAppearance.js +236 -0
- package/Source/Scene/PostProcessStage.js +1023 -0
- package/Source/Scene/PostProcessStageCollection.js +888 -0
- package/Source/Scene/PostProcessStageComposite.js +362 -0
- package/Source/Scene/PostProcessStageLibrary.js +838 -0
- package/Source/Scene/PostProcessStageSampleMode.js +22 -0
- package/Source/Scene/PostProcessStageTextureCache.js +454 -0
- package/Source/Scene/Primitive.js +2536 -0
- package/Source/Scene/PrimitiveCollection.js +467 -0
- package/Source/Scene/PrimitiveLoadPlan.js +280 -0
- package/Source/Scene/PrimitivePipeline.js +855 -0
- package/Source/Scene/PrimitiveState.js +13 -0
- package/Source/Scene/PropertyAttribute.js +160 -0
- package/Source/Scene/PropertyAttributeProperty.js +165 -0
- package/Source/Scene/PropertyTable.js +541 -0
- package/Source/Scene/PropertyTexture.js +162 -0
- package/Source/Scene/PropertyTextureProperty.js +263 -0
- package/Source/Scene/QuadtreeOccluders.js +30 -0
- package/Source/Scene/QuadtreePrimitive.js +1546 -0
- package/Source/Scene/QuadtreeTile.js +539 -0
- package/Source/Scene/QuadtreeTileLoadState.js +39 -0
- package/Source/Scene/QuadtreeTileProvider.js +226 -0
- package/Source/Scene/ResourceCache.js +810 -0
- package/Source/Scene/ResourceCacheKey.js +567 -0
- package/Source/Scene/ResourceCacheStatistics.js +183 -0
- package/Source/Scene/ResourceLoader.js +139 -0
- package/Source/Scene/ResourceLoaderState.js +48 -0
- package/Source/Scene/SDFSettings.js +39 -0
- package/Source/Scene/Scene.js +4498 -0
- package/Source/Scene/SceneFramebuffer.js +106 -0
- package/Source/Scene/SceneMode.js +56 -0
- package/Source/Scene/SceneTransforms.js +466 -0
- package/Source/Scene/SceneTransitioner.js +1111 -0
- package/Source/Scene/ScreenSpaceCameraController.js +2933 -0
- package/Source/Scene/ShadowMap.js +1958 -0
- package/Source/Scene/ShadowMapShader.js +395 -0
- package/Source/Scene/ShadowMode.js +78 -0
- package/Source/Scene/ShadowVolumeAppearance.js +937 -0
- package/Source/Scene/SingleTileImageryProvider.js +501 -0
- package/Source/Scene/SkyAtmosphere.js +402 -0
- package/Source/Scene/SkyBox.js +252 -0
- package/Source/Scene/SphereEmitter.js +66 -0
- package/Source/Scene/SplitDirection.js +34 -0
- package/Source/Scene/Splitter.js +49 -0
- package/Source/Scene/StencilConstants.js +37 -0
- package/Source/Scene/StencilFunction.js +73 -0
- package/Source/Scene/StencilOperation.js +73 -0
- package/Source/Scene/StructuralMetadata.js +243 -0
- package/Source/Scene/StyleExpression.js +86 -0
- package/Source/Scene/Sun.js +359 -0
- package/Source/Scene/SunLight.js +31 -0
- package/Source/Scene/SunPostProcess.js +288 -0
- package/Source/Scene/SupportedImageFormats.js +18 -0
- package/Source/Scene/TerrainFillMesh.js +2220 -0
- package/Source/Scene/TerrainState.js +13 -0
- package/Source/Scene/TextureAtlas.js +556 -0
- package/Source/Scene/TileBoundingRegion.js +490 -0
- package/Source/Scene/TileBoundingS2Cell.js +703 -0
- package/Source/Scene/TileBoundingSphere.js +167 -0
- package/Source/Scene/TileBoundingVolume.js +68 -0
- package/Source/Scene/TileCoordinatesImageryProvider.js +379 -0
- package/Source/Scene/TileDiscardPolicy.js +34 -0
- package/Source/Scene/TileImagery.js +130 -0
- package/Source/Scene/TileMapServiceImageryProvider.js +403 -0
- package/Source/Scene/TileMetadata.js +184 -0
- package/Source/Scene/TileOrientedBoundingBox.js +219 -0
- package/Source/Scene/TileReplacementQueue.js +119 -0
- package/Source/Scene/TileSelectionResult.js +80 -0
- package/Source/Scene/TileState.js +10 -0
- package/Source/Scene/Tileset3DTileContent.js +158 -0
- package/Source/Scene/TilesetMetadata.js +186 -0
- package/Source/Scene/TimeDynamicImagery.js +308 -0
- package/Source/Scene/TimeDynamicPointCloud.js +819 -0
- package/Source/Scene/Tonemapper.js +52 -0
- package/Source/Scene/TranslucentTileClassification.js +524 -0
- package/Source/Scene/TweenCollection.js +588 -0
- package/Source/Scene/UrlTemplateImageryProvider.js +1240 -0
- package/Source/Scene/Vector3DTileBatch.js +37 -0
- package/Source/Scene/Vector3DTileClampedPolylines.js +772 -0
- package/Source/Scene/Vector3DTileContent.js +774 -0
- package/Source/Scene/Vector3DTileGeometry.js +490 -0
- package/Source/Scene/Vector3DTilePoints.js +529 -0
- package/Source/Scene/Vector3DTilePolygons.js +479 -0
- package/Source/Scene/Vector3DTilePolylines.js +676 -0
- package/Source/Scene/Vector3DTilePrimitive.js +1282 -0
- package/Source/Scene/VertexAttributeSemantic.js +273 -0
- package/Source/Scene/VerticalOrigin.js +49 -0
- package/Source/Scene/View.js +431 -0
- package/Source/Scene/ViewportQuad.js +182 -0
- package/Source/Scene/WebMapServiceImageryProvider.js +768 -0
- package/Source/Scene/WebMapTileServiceImageryProvider.js +711 -0
- package/Source/Scene/computeFlyToLocationForRectangle.js +69 -0
- package/Source/Scene/createBillboardPointCallback.js +70 -0
- package/Source/Scene/createElevationBandMaterial.js +585 -0
- package/Source/Scene/createOsmBuildings.js +75 -0
- package/Source/Scene/createTangentSpaceDebugPrimitive.js +116 -0
- package/Source/Scene/createWorldImagery.js +38 -0
- package/Source/Scene/findContentMetadata.js +54 -0
- package/Source/Scene/findGroupMetadata.js +39 -0
- package/Source/Scene/findTileMetadata.js +56 -0
- package/Source/Scene/getBinaryAccessor.js +56 -0
- package/Source/Scene/getClipAndStyleCode.js +34 -0
- package/Source/Scene/getClippingFunction.js +163 -0
- package/Source/Scene/hasExtension.js +19 -0
- package/Source/Scene/parseBatchTable.js +439 -0
- package/Source/Scene/parseBoundingVolumeSemantics.js +121 -0
- package/Source/Scene/parseFeatureMetadataLegacy.js +139 -0
- package/Source/Scene/parseStructuralMetadata.js +102 -0
- package/Source/Scene/preprocess3DTileContent.js +94 -0
- package/Source/Shaders/AdjustTranslucentFS.glsl +24 -0
- package/Source/Shaders/AdjustTranslucentFS.js +26 -0
- package/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl +29 -0
- package/Source/Shaders/Appearances/AllMaterialAppearanceFS.js +31 -0
- package/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl +26 -0
- package/Source/Shaders/Appearances/AllMaterialAppearanceVS.js +28 -0
- package/Source/Shaders/Appearances/BasicMaterialAppearanceFS.glsl +23 -0
- package/Source/Shaders/Appearances/BasicMaterialAppearanceFS.js +25 -0
- package/Source/Shaders/Appearances/BasicMaterialAppearanceVS.glsl +17 -0
- package/Source/Shaders/Appearances/BasicMaterialAppearanceVS.js +19 -0
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.glsl +33 -0
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js +35 -0
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.glsl +19 -0
- package/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js +21 -0
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl +24 -0
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js +26 -0
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl +20 -0
- package/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js +22 -0
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl +6 -0
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js +8 -0
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl +15 -0
- package/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js +17 -0
- package/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl +28 -0
- package/Source/Shaders/Appearances/PolylineColorAppearanceVS.js +30 -0
- package/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl +33 -0
- package/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js +35 -0
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl +25 -0
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js +27 -0
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl +20 -0
- package/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js +22 -0
- package/Source/Shaders/AtmosphereCommon.glsl +152 -0
- package/Source/Shaders/AtmosphereCommon.js +154 -0
- package/Source/Shaders/BillboardCollectionFS.glsl +208 -0
- package/Source/Shaders/BillboardCollectionFS.js +210 -0
- package/Source/Shaders/BillboardCollectionVS.glsl +434 -0
- package/Source/Shaders/BillboardCollectionVS.js +436 -0
- package/Source/Shaders/BrdfLutGeneratorFS.glsl +83 -0
- package/Source/Shaders/BrdfLutGeneratorFS.js +85 -0
- package/Source/Shaders/Builtin/Constants/degreesPerRadian.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/degreesPerRadian.js +18 -0
- package/Source/Shaders/Builtin/Constants/depthRange.glsl +14 -0
- package/Source/Shaders/Builtin/Constants/depthRange.js +16 -0
- package/Source/Shaders/Builtin/Constants/epsilon1.glsl +7 -0
- package/Source/Shaders/Builtin/Constants/epsilon1.js +9 -0
- package/Source/Shaders/Builtin/Constants/epsilon2.glsl +7 -0
- package/Source/Shaders/Builtin/Constants/epsilon2.js +9 -0
- package/Source/Shaders/Builtin/Constants/epsilon3.glsl +7 -0
- package/Source/Shaders/Builtin/Constants/epsilon3.js +9 -0
- package/Source/Shaders/Builtin/Constants/epsilon4.glsl +7 -0
- package/Source/Shaders/Builtin/Constants/epsilon4.js +9 -0
- package/Source/Shaders/Builtin/Constants/epsilon5.glsl +7 -0
- package/Source/Shaders/Builtin/Constants/epsilon5.js +9 -0
- package/Source/Shaders/Builtin/Constants/epsilon6.glsl +7 -0
- package/Source/Shaders/Builtin/Constants/epsilon6.js +9 -0
- package/Source/Shaders/Builtin/Constants/epsilon7.glsl +7 -0
- package/Source/Shaders/Builtin/Constants/epsilon7.js +9 -0
- package/Source/Shaders/Builtin/Constants/infinity.glsl +7 -0
- package/Source/Shaders/Builtin/Constants/infinity.js +9 -0
- package/Source/Shaders/Builtin/Constants/oneOverPi.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/oneOverPi.js +18 -0
- package/Source/Shaders/Builtin/Constants/oneOverTwoPi.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/oneOverTwoPi.js +18 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +11 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +11 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +11 -0
- package/Source/Shaders/Builtin/Constants/passClassification.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passClassification.js +11 -0
- package/Source/Shaders/Builtin/Constants/passCompute.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCompute.js +11 -0
- package/Source/Shaders/Builtin/Constants/passEnvironment.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passEnvironment.js +11 -0
- package/Source/Shaders/Builtin/Constants/passGlobe.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passGlobe.js +11 -0
- package/Source/Shaders/Builtin/Constants/passOpaque.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passOpaque.js +11 -0
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passOverlay.js +11 -0
- package/Source/Shaders/Builtin/Constants/passTerrainClassification.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passTerrainClassification.js +11 -0
- package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passTranslucent.js +11 -0
- package/Source/Shaders/Builtin/Constants/pi.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/pi.js +18 -0
- package/Source/Shaders/Builtin/Constants/piOverFour.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/piOverFour.js +18 -0
- package/Source/Shaders/Builtin/Constants/piOverSix.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/piOverSix.js +18 -0
- package/Source/Shaders/Builtin/Constants/piOverThree.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/piOverThree.js +18 -0
- package/Source/Shaders/Builtin/Constants/piOverTwo.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/piOverTwo.js +18 -0
- package/Source/Shaders/Builtin/Constants/radiansPerDegree.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/radiansPerDegree.js +18 -0
- package/Source/Shaders/Builtin/Constants/sceneMode2D.glsl +11 -0
- package/Source/Shaders/Builtin/Constants/sceneMode2D.js +13 -0
- package/Source/Shaders/Builtin/Constants/sceneMode3D.glsl +11 -0
- package/Source/Shaders/Builtin/Constants/sceneMode3D.js +13 -0
- package/Source/Shaders/Builtin/Constants/sceneModeColumbusView.glsl +11 -0
- package/Source/Shaders/Builtin/Constants/sceneModeColumbusView.js +13 -0
- package/Source/Shaders/Builtin/Constants/sceneModeMorphing.glsl +11 -0
- package/Source/Shaders/Builtin/Constants/sceneModeMorphing.js +13 -0
- package/Source/Shaders/Builtin/Constants/solarRadius.glsl +13 -0
- package/Source/Shaders/Builtin/Constants/solarRadius.js +15 -0
- package/Source/Shaders/Builtin/Constants/threePiOver2.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/threePiOver2.js +18 -0
- package/Source/Shaders/Builtin/Constants/twoPi.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/twoPi.js +18 -0
- package/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.glsl +16 -0
- package/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.js +18 -0
- package/Source/Shaders/Builtin/CzmBuiltins.js +262 -0
- package/Source/Shaders/Builtin/Functions/HSBToRGB.glsl +24 -0
- package/Source/Shaders/Builtin/Functions/HSBToRGB.js +26 -0
- package/Source/Shaders/Builtin/Functions/HSLToRGB.glsl +31 -0
- package/Source/Shaders/Builtin/Functions/HSLToRGB.js +33 -0
- package/Source/Shaders/Builtin/Functions/RGBToHSB.glsl +27 -0
- package/Source/Shaders/Builtin/Functions/RGBToHSB.js +29 -0
- package/Source/Shaders/Builtin/Functions/RGBToHSL.glsl +34 -0
- package/Source/Shaders/Builtin/Functions/RGBToHSL.js +36 -0
- package/Source/Shaders/Builtin/Functions/RGBToXYZ.glsl +30 -0
- package/Source/Shaders/Builtin/Functions/RGBToXYZ.js +32 -0
- package/Source/Shaders/Builtin/Functions/XYZToRGB.glsl +30 -0
- package/Source/Shaders/Builtin/Functions/XYZToRGB.js +32 -0
- package/Source/Shaders/Builtin/Functions/acesTonemapping.glsl +16 -0
- package/Source/Shaders/Builtin/Functions/acesTonemapping.js +18 -0
- package/Source/Shaders/Builtin/Functions/alphaWeight.glsl +11 -0
- package/Source/Shaders/Builtin/Functions/alphaWeight.js +13 -0
- package/Source/Shaders/Builtin/Functions/antialias.glsl +39 -0
- package/Source/Shaders/Builtin/Functions/antialias.js +41 -0
- package/Source/Shaders/Builtin/Functions/approximateSphericalCoordinates.glsl +18 -0
- package/Source/Shaders/Builtin/Functions/approximateSphericalCoordinates.js +20 -0
- package/Source/Shaders/Builtin/Functions/backFacing.glsl +13 -0
- package/Source/Shaders/Builtin/Functions/backFacing.js +15 -0
- package/Source/Shaders/Builtin/Functions/branchFreeTernary.glsl +71 -0
- package/Source/Shaders/Builtin/Functions/branchFreeTernary.js +73 -0
- package/Source/Shaders/Builtin/Functions/cascadeColor.glsl +8 -0
- package/Source/Shaders/Builtin/Functions/cascadeColor.js +10 -0
- package/Source/Shaders/Builtin/Functions/cascadeDistance.glsl +7 -0
- package/Source/Shaders/Builtin/Functions/cascadeDistance.js +9 -0
- package/Source/Shaders/Builtin/Functions/cascadeMatrix.glsl +10 -0
- package/Source/Shaders/Builtin/Functions/cascadeMatrix.js +12 -0
- package/Source/Shaders/Builtin/Functions/cascadeWeights.glsl +10 -0
- package/Source/Shaders/Builtin/Functions/cascadeWeights.js +12 -0
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.glsl +12 -0
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.js +14 -0
- package/Source/Shaders/Builtin/Functions/computePosition.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/computePosition.js +24 -0
- package/Source/Shaders/Builtin/Functions/cosineAndSine.glsl +211 -0
- package/Source/Shaders/Builtin/Functions/cosineAndSine.js +213 -0
- package/Source/Shaders/Builtin/Functions/decompressTextureCoordinates.glsl +17 -0
- package/Source/Shaders/Builtin/Functions/decompressTextureCoordinates.js +19 -0
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.glsl +16 -0
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.js +18 -0
- package/Source/Shaders/Builtin/Functions/depthClamp.glsl +47 -0
- package/Source/Shaders/Builtin/Functions/depthClamp.js +49 -0
- package/Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl +33 -0
- package/Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.js +35 -0
- package/Source/Shaders/Builtin/Functions/ellipsoidContainsPoint.glsl +12 -0
- package/Source/Shaders/Builtin/Functions/ellipsoidContainsPoint.js +14 -0
- package/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.glsl +10 -0
- package/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.js +12 -0
- package/Source/Shaders/Builtin/Functions/equalsEpsilon.glsl +36 -0
- package/Source/Shaders/Builtin/Functions/equalsEpsilon.js +38 -0
- package/Source/Shaders/Builtin/Functions/eyeOffset.glsl +20 -0
- package/Source/Shaders/Builtin/Functions/eyeOffset.js +22 -0
- package/Source/Shaders/Builtin/Functions/eyeToWindowCoordinates.glsl +32 -0
- package/Source/Shaders/Builtin/Functions/eyeToWindowCoordinates.js +34 -0
- package/Source/Shaders/Builtin/Functions/fastApproximateAtan.glsl +55 -0
- package/Source/Shaders/Builtin/Functions/fastApproximateAtan.js +57 -0
- package/Source/Shaders/Builtin/Functions/fog.glsl +38 -0
- package/Source/Shaders/Builtin/Functions/fog.js +40 -0
- package/Source/Shaders/Builtin/Functions/gammaCorrect.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/gammaCorrect.js +24 -0
- package/Source/Shaders/Builtin/Functions/geodeticSurfaceNormal.glsl +16 -0
- package/Source/Shaders/Builtin/Functions/geodeticSurfaceNormal.js +18 -0
- package/Source/Shaders/Builtin/Functions/getDefaultMaterial.glsl +27 -0
- package/Source/Shaders/Builtin/Functions/getDefaultMaterial.js +29 -0
- package/Source/Shaders/Builtin/Functions/getLambertDiffuse.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/getLambertDiffuse.js +24 -0
- package/Source/Shaders/Builtin/Functions/getSpecular.glsl +29 -0
- package/Source/Shaders/Builtin/Functions/getSpecular.js +31 -0
- package/Source/Shaders/Builtin/Functions/getWaterNoise.glsl +37 -0
- package/Source/Shaders/Builtin/Functions/getWaterNoise.js +39 -0
- package/Source/Shaders/Builtin/Functions/hue.glsl +30 -0
- package/Source/Shaders/Builtin/Functions/hue.js +32 -0
- package/Source/Shaders/Builtin/Functions/inverseGamma.glsl +12 -0
- package/Source/Shaders/Builtin/Functions/inverseGamma.js +14 -0
- package/Source/Shaders/Builtin/Functions/isEmpty.glsl +19 -0
- package/Source/Shaders/Builtin/Functions/isEmpty.js +21 -0
- package/Source/Shaders/Builtin/Functions/isFull.glsl +19 -0
- package/Source/Shaders/Builtin/Functions/isFull.js +21 -0
- package/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.glsl +21 -0
- package/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.js +23 -0
- package/Source/Shaders/Builtin/Functions/lineDistance.glsl +14 -0
- package/Source/Shaders/Builtin/Functions/lineDistance.js +16 -0
- package/Source/Shaders/Builtin/Functions/linearToSrgb.glsl +16 -0
- package/Source/Shaders/Builtin/Functions/linearToSrgb.js +18 -0
- package/Source/Shaders/Builtin/Functions/luminance.glsl +20 -0
- package/Source/Shaders/Builtin/Functions/luminance.js +22 -0
- package/Source/Shaders/Builtin/Functions/metersPerPixel.glsl +61 -0
- package/Source/Shaders/Builtin/Functions/metersPerPixel.js +63 -0
- package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.glsl +37 -0
- package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js +39 -0
- package/Source/Shaders/Builtin/Functions/multiplyWithColorBalance.glsl +18 -0
- package/Source/Shaders/Builtin/Functions/multiplyWithColorBalance.js +20 -0
- package/Source/Shaders/Builtin/Functions/nearFarScalar.glsl +26 -0
- package/Source/Shaders/Builtin/Functions/nearFarScalar.js +28 -0
- package/Source/Shaders/Builtin/Functions/octDecode.glsl +83 -0
- package/Source/Shaders/Builtin/Functions/octDecode.js +85 -0
- package/Source/Shaders/Builtin/Functions/packDepth.glsl +18 -0
- package/Source/Shaders/Builtin/Functions/packDepth.js +20 -0
- package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +99 -0
- package/Source/Shaders/Builtin/Functions/pbrLighting.js +101 -0
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.glsl +37 -0
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.js +39 -0
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.glsl +30 -0
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.js +32 -0
- package/Source/Shaders/Builtin/Functions/phong.glsl +63 -0
- package/Source/Shaders/Builtin/Functions/phong.js +65 -0
- package/Source/Shaders/Builtin/Functions/planeDistance.glsl +28 -0
- package/Source/Shaders/Builtin/Functions/planeDistance.js +30 -0
- package/Source/Shaders/Builtin/Functions/pointAlongRay.glsl +19 -0
- package/Source/Shaders/Builtin/Functions/pointAlongRay.js +21 -0
- package/Source/Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval.glsl +83 -0
- package/Source/Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval.js +85 -0
- package/Source/Shaders/Builtin/Functions/raySphereIntersectionInterval.glsl +36 -0
- package/Source/Shaders/Builtin/Functions/raySphereIntersectionInterval.js +38 -0
- package/Source/Shaders/Builtin/Functions/readDepth.glsl +4 -0
- package/Source/Shaders/Builtin/Functions/readDepth.js +6 -0
- package/Source/Shaders/Builtin/Functions/readNonPerspective.glsl +31 -0
- package/Source/Shaders/Builtin/Functions/readNonPerspective.js +33 -0
- package/Source/Shaders/Builtin/Functions/reverseLogDepth.glsl +11 -0
- package/Source/Shaders/Builtin/Functions/reverseLogDepth.js +13 -0
- package/Source/Shaders/Builtin/Functions/round.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/round.js +24 -0
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.glsl +78 -0
- package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.js +80 -0
- package/Source/Shaders/Builtin/Functions/saturation.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/saturation.js +24 -0
- package/Source/Shaders/Builtin/Functions/shadowDepthCompare.glsl +24 -0
- package/Source/Shaders/Builtin/Functions/shadowDepthCompare.js +26 -0
- package/Source/Shaders/Builtin/Functions/shadowVisibility.glsl +66 -0
- package/Source/Shaders/Builtin/Functions/shadowVisibility.js +68 -0
- package/Source/Shaders/Builtin/Functions/signNotZero.glsl +29 -0
- package/Source/Shaders/Builtin/Functions/signNotZero.js +31 -0
- package/Source/Shaders/Builtin/Functions/sphericalHarmonics.glsl +42 -0
- package/Source/Shaders/Builtin/Functions/sphericalHarmonics.js +44 -0
- package/Source/Shaders/Builtin/Functions/srgbToLinear.glsl +16 -0
- package/Source/Shaders/Builtin/Functions/srgbToLinear.js +18 -0
- package/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.glsl +25 -0
- package/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js +27 -0
- package/Source/Shaders/Builtin/Functions/transformPlane.glsl +15 -0
- package/Source/Shaders/Builtin/Functions/transformPlane.js +17 -0
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +40 -0
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +42 -0
- package/Source/Shaders/Builtin/Functions/translucentPhong.glsl +27 -0
- package/Source/Shaders/Builtin/Functions/translucentPhong.js +29 -0
- package/Source/Shaders/Builtin/Functions/transpose.glsl +45 -0
- package/Source/Shaders/Builtin/Functions/transpose.js +47 -0
- package/Source/Shaders/Builtin/Functions/unpackDepth.glsl +16 -0
- package/Source/Shaders/Builtin/Functions/unpackDepth.js +18 -0
- package/Source/Shaders/Builtin/Functions/unpackFloat.glsl +24 -0
- package/Source/Shaders/Builtin/Functions/unpackFloat.js +26 -0
- package/Source/Shaders/Builtin/Functions/unpackUint.glsl +31 -0
- package/Source/Shaders/Builtin/Functions/unpackUint.js +33 -0
- package/Source/Shaders/Builtin/Functions/valueTransform.glsl +38 -0
- package/Source/Shaders/Builtin/Functions/valueTransform.js +40 -0
- package/Source/Shaders/Builtin/Functions/vertexLogDepth.glsl +64 -0
- package/Source/Shaders/Builtin/Functions/vertexLogDepth.js +66 -0
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +99 -0
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +101 -0
- package/Source/Shaders/Builtin/Functions/writeDepthClamp.glsl +27 -0
- package/Source/Shaders/Builtin/Functions/writeDepthClamp.js +29 -0
- package/Source/Shaders/Builtin/Functions/writeLogDepth.glsl +82 -0
- package/Source/Shaders/Builtin/Functions/writeLogDepth.js +84 -0
- package/Source/Shaders/Builtin/Functions/writeNonPerspective.glsl +32 -0
- package/Source/Shaders/Builtin/Functions/writeNonPerspective.js +34 -0
- package/Source/Shaders/Builtin/Structs/depthRangeStruct.glsl +9 -0
- package/Source/Shaders/Builtin/Structs/depthRangeStruct.js +11 -0
- package/Source/Shaders/Builtin/Structs/material.glsl +22 -0
- package/Source/Shaders/Builtin/Structs/material.js +24 -0
- package/Source/Shaders/Builtin/Structs/materialInput.glsl +28 -0
- package/Source/Shaders/Builtin/Structs/materialInput.js +30 -0
- package/Source/Shaders/Builtin/Structs/modelMaterial.glsl +29 -0
- package/Source/Shaders/Builtin/Structs/modelMaterial.js +31 -0
- package/Source/Shaders/Builtin/Structs/modelVertexOutput.glsl +16 -0
- package/Source/Shaders/Builtin/Structs/modelVertexOutput.js +18 -0
- package/Source/Shaders/Builtin/Structs/pbrParameters.glsl +16 -0
- package/Source/Shaders/Builtin/Structs/pbrParameters.js +18 -0
- package/Source/Shaders/Builtin/Structs/ray.glsl +11 -0
- package/Source/Shaders/Builtin/Structs/ray.js +13 -0
- package/Source/Shaders/Builtin/Structs/raySegment.glsl +27 -0
- package/Source/Shaders/Builtin/Structs/raySegment.js +29 -0
- package/Source/Shaders/Builtin/Structs/shadowParameters.glsl +15 -0
- package/Source/Shaders/Builtin/Structs/shadowParameters.js +17 -0
- package/Source/Shaders/CloudCollectionFS.glsl +263 -0
- package/Source/Shaders/CloudCollectionFS.js +265 -0
- package/Source/Shaders/CloudCollectionVS.glsl +48 -0
- package/Source/Shaders/CloudCollectionVS.js +50 -0
- package/Source/Shaders/CloudNoiseFS.glsl +92 -0
- package/Source/Shaders/CloudNoiseFS.js +94 -0
- package/Source/Shaders/CloudNoiseVS.glsl +18 -0
- package/Source/Shaders/CloudNoiseVS.js +20 -0
- package/Source/Shaders/CompareAndPackTranslucentDepth.glsl +12 -0
- package/Source/Shaders/CompareAndPackTranslucentDepth.js +14 -0
- package/Source/Shaders/CompositeOITFS.glsl +31 -0
- package/Source/Shaders/CompositeOITFS.js +33 -0
- package/Source/Shaders/DepthPlaneFS.glsl +36 -0
- package/Source/Shaders/DepthPlaneFS.js +38 -0
- package/Source/Shaders/DepthPlaneVS.glsl +11 -0
- package/Source/Shaders/DepthPlaneVS.js +13 -0
- package/Source/Shaders/EllipsoidFS.glsl +112 -0
- package/Source/Shaders/EllipsoidFS.js +114 -0
- package/Source/Shaders/EllipsoidVS.glsl +28 -0
- package/Source/Shaders/EllipsoidVS.js +30 -0
- package/Source/Shaders/FXAA3_11.glsl +648 -0
- package/Source/Shaders/FXAA3_11.js +678 -0
- package/Source/Shaders/GlobeFS.glsl +652 -0
- package/Source/Shaders/GlobeFS.js +654 -0
- package/Source/Shaders/GlobeVS.glsl +253 -0
- package/Source/Shaders/GlobeVS.js +255 -0
- package/Source/Shaders/GroundAtmosphere.glsl +18 -0
- package/Source/Shaders/GroundAtmosphere.js +20 -0
- package/Source/Shaders/Materials/AspectRampMaterial.glsl +11 -0
- package/Source/Shaders/Materials/AspectRampMaterial.js +13 -0
- package/Source/Shaders/Materials/BumpMapMaterial.glsl +29 -0
- package/Source/Shaders/Materials/BumpMapMaterial.js +31 -0
- package/Source/Shaders/Materials/CheckerboardMaterial.glsl +29 -0
- package/Source/Shaders/Materials/CheckerboardMaterial.js +31 -0
- package/Source/Shaders/Materials/DotMaterial.glsl +18 -0
- package/Source/Shaders/Materials/DotMaterial.js +20 -0
- package/Source/Shaders/Materials/ElevationBandMaterial.glsl +74 -0
- package/Source/Shaders/Materials/ElevationBandMaterial.js +76 -0
- package/Source/Shaders/Materials/ElevationContourMaterial.glsl +29 -0
- package/Source/Shaders/Materials/ElevationContourMaterial.js +31 -0
- package/Source/Shaders/Materials/ElevationRampMaterial.glsl +14 -0
- package/Source/Shaders/Materials/ElevationRampMaterial.js +16 -0
- package/Source/Shaders/Materials/FadeMaterial.glsl +37 -0
- package/Source/Shaders/Materials/FadeMaterial.js +39 -0
- package/Source/Shaders/Materials/GridMaterial.glsl +60 -0
- package/Source/Shaders/Materials/GridMaterial.js +62 -0
- package/Source/Shaders/Materials/NormalMapMaterial.glsl +19 -0
- package/Source/Shaders/Materials/NormalMapMaterial.js +21 -0
- package/Source/Shaders/Materials/PolylineArrowMaterial.glsl +66 -0
- package/Source/Shaders/Materials/PolylineArrowMaterial.js +68 -0
- package/Source/Shaders/Materials/PolylineDashMaterial.glsl +39 -0
- package/Source/Shaders/Materials/PolylineDashMaterial.js +41 -0
- package/Source/Shaders/Materials/PolylineGlowMaterial.glsl +25 -0
- package/Source/Shaders/Materials/PolylineGlowMaterial.js +27 -0
- package/Source/Shaders/Materials/PolylineOutlineMaterial.glsl +29 -0
- package/Source/Shaders/Materials/PolylineOutlineMaterial.js +31 -0
- package/Source/Shaders/Materials/RimLightingMaterial.glsl +21 -0
- package/Source/Shaders/Materials/RimLightingMaterial.js +23 -0
- package/Source/Shaders/Materials/SlopeRampMaterial.glsl +11 -0
- package/Source/Shaders/Materials/SlopeRampMaterial.js +13 -0
- package/Source/Shaders/Materials/StripeMaterial.glsl +24 -0
- package/Source/Shaders/Materials/StripeMaterial.js +26 -0
- package/Source/Shaders/Materials/Water.glsl +58 -0
- package/Source/Shaders/Materials/Water.js +60 -0
- package/Source/Shaders/Model/CPUStylingStageFS.glsl +49 -0
- package/Source/Shaders/Model/CPUStylingStageFS.js +51 -0
- package/Source/Shaders/Model/CPUStylingStageVS.glsl +30 -0
- package/Source/Shaders/Model/CPUStylingStageVS.js +32 -0
- package/Source/Shaders/Model/CustomShaderStageFS.glsl +18 -0
- package/Source/Shaders/Model/CustomShaderStageFS.js +20 -0
- package/Source/Shaders/Model/CustomShaderStageVS.glsl +19 -0
- package/Source/Shaders/Model/CustomShaderStageVS.js +21 -0
- package/Source/Shaders/Model/FeatureIdStageFS.glsl +4 -0
- package/Source/Shaders/Model/FeatureIdStageFS.js +6 -0
- package/Source/Shaders/Model/FeatureIdStageVS.glsl +6 -0
- package/Source/Shaders/Model/FeatureIdStageVS.js +8 -0
- package/Source/Shaders/Model/GeometryStageFS.glsl +25 -0
- package/Source/Shaders/Model/GeometryStageFS.js +27 -0
- package/Source/Shaders/Model/GeometryStageVS.glsl +42 -0
- package/Source/Shaders/Model/GeometryStageVS.js +44 -0
- package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +165 -0
- package/Source/Shaders/Model/ImageBasedLightingStageFS.js +166 -0
- package/Source/Shaders/Model/InstancingStageCommon.glsl +67 -0
- package/Source/Shaders/Model/InstancingStageCommon.js +69 -0
- package/Source/Shaders/Model/InstancingStageVS.glsl +18 -0
- package/Source/Shaders/Model/InstancingStageVS.js +20 -0
- package/Source/Shaders/Model/LegacyInstancingStageVS.glsl +20 -0
- package/Source/Shaders/Model/LegacyInstancingStageVS.js +22 -0
- package/Source/Shaders/Model/LightingStageFS.glsl +73 -0
- package/Source/Shaders/Model/LightingStageFS.js +75 -0
- package/Source/Shaders/Model/MaterialStageFS.glsl +226 -0
- package/Source/Shaders/Model/MaterialStageFS.js +228 -0
- package/Source/Shaders/Model/MetadataStageFS.glsl +9 -0
- package/Source/Shaders/Model/MetadataStageFS.js +11 -0
- package/Source/Shaders/Model/MetadataStageVS.glsl +10 -0
- package/Source/Shaders/Model/MetadataStageVS.js +12 -0
- package/Source/Shaders/Model/ModelClippingPlanesStageFS.glsl +88 -0
- package/Source/Shaders/Model/ModelClippingPlanesStageFS.js +90 -0
- package/Source/Shaders/Model/ModelColorStageFS.glsl +7 -0
- package/Source/Shaders/Model/ModelColorStageFS.js +8 -0
- package/Source/Shaders/Model/ModelFS.glsl +89 -0
- package/Source/Shaders/Model/ModelFS.js +91 -0
- package/Source/Shaders/Model/ModelSilhouetteStageFS.glsl +5 -0
- package/Source/Shaders/Model/ModelSilhouetteStageFS.js +6 -0
- package/Source/Shaders/Model/ModelSilhouetteStageVS.glsl +10 -0
- package/Source/Shaders/Model/ModelSilhouetteStageVS.js +12 -0
- package/Source/Shaders/Model/ModelSplitterStageFS.glsl +9 -0
- package/Source/Shaders/Model/ModelSplitterStageFS.js +11 -0
- package/Source/Shaders/Model/ModelVS.glsl +136 -0
- package/Source/Shaders/Model/ModelVS.js +138 -0
- package/Source/Shaders/Model/MorphTargetsStageVS.glsl +15 -0
- package/Source/Shaders/Model/MorphTargetsStageVS.js +16 -0
- package/Source/Shaders/Model/PointCloudStylingStageVS.glsl +45 -0
- package/Source/Shaders/Model/PointCloudStylingStageVS.js +46 -0
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.glsl +16 -0
- package/Source/Shaders/Model/PrimitiveOutlineStageFS.js +18 -0
- package/Source/Shaders/Model/PrimitiveOutlineStageVS.glsl +3 -0
- package/Source/Shaders/Model/PrimitiveOutlineStageVS.js +5 -0
- package/Source/Shaders/Model/SelectedFeatureIdStageCommon.glsl +51 -0
- package/Source/Shaders/Model/SelectedFeatureIdStageCommon.js +53 -0
- package/Source/Shaders/Model/SkinningStageVS.glsl +18 -0
- package/Source/Shaders/Model/SkinningStageVS.js +19 -0
- package/Source/Shaders/OctahedralProjectionAtlasFS.glsl +89 -0
- package/Source/Shaders/OctahedralProjectionAtlasFS.js +91 -0
- package/Source/Shaders/OctahedralProjectionFS.glsl +14 -0
- package/Source/Shaders/OctahedralProjectionFS.js +16 -0
- package/Source/Shaders/OctahedralProjectionVS.glsl +10 -0
- package/Source/Shaders/OctahedralProjectionVS.js +12 -0
- package/Source/Shaders/PointPrimitiveCollectionFS.glsl +43 -0
- package/Source/Shaders/PointPrimitiveCollectionFS.js +45 -0
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +180 -0
- package/Source/Shaders/PointPrimitiveCollectionVS.js +182 -0
- package/Source/Shaders/PolylineCommon.glsl +176 -0
- package/Source/Shaders/PolylineCommon.js +178 -0
- package/Source/Shaders/PolylineFS.glsl +25 -0
- package/Source/Shaders/PolylineFS.js +27 -0
- package/Source/Shaders/PolylineShadowVolumeFS.glsl +90 -0
- package/Source/Shaders/PolylineShadowVolumeFS.js +92 -0
- package/Source/Shaders/PolylineShadowVolumeMorphFS.glsl +45 -0
- package/Source/Shaders/PolylineShadowVolumeMorphFS.js +47 -0
- package/Source/Shaders/PolylineShadowVolumeMorphVS.glsl +177 -0
- package/Source/Shaders/PolylineShadowVolumeMorphVS.js +179 -0
- package/Source/Shaders/PolylineShadowVolumeVS.glsl +168 -0
- package/Source/Shaders/PolylineShadowVolumeVS.js +170 -0
- package/Source/Shaders/PolylineVS.glsl +103 -0
- package/Source/Shaders/PolylineVS.js +105 -0
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.glsl +21 -0
- package/Source/Shaders/PostProcessStages/AcesTonemappingStage.js +23 -0
- package/Source/Shaders/PostProcessStages/AdditiveBlend.glsl +17 -0
- package/Source/Shaders/PostProcessStages/AdditiveBlend.js +19 -0
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +115 -0
- package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +117 -0
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.glsl +11 -0
- package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.js +13 -0
- package/Source/Shaders/PostProcessStages/BlackAndWhite.glsl +19 -0
- package/Source/Shaders/PostProcessStages/BlackAndWhite.js +21 -0
- package/Source/Shaders/PostProcessStages/BloomComposite.glsl +20 -0
- package/Source/Shaders/PostProcessStages/BloomComposite.js +22 -0
- package/Source/Shaders/PostProcessStages/BrightPass.glsl +30 -0
- package/Source/Shaders/PostProcessStages/BrightPass.js +32 -0
- package/Source/Shaders/PostProcessStages/Brightness.glsl +11 -0
- package/Source/Shaders/PostProcessStages/Brightness.js +13 -0
- package/Source/Shaders/PostProcessStages/CompositeTranslucentClassification.glsl +31 -0
- package/Source/Shaders/PostProcessStages/CompositeTranslucentClassification.js +33 -0
- package/Source/Shaders/PostProcessStages/ContrastBias.glsl +17 -0
- package/Source/Shaders/PostProcessStages/ContrastBias.js +19 -0
- package/Source/Shaders/PostProcessStages/DepthOfField.glsl +39 -0
- package/Source/Shaders/PostProcessStages/DepthOfField.js +41 -0
- package/Source/Shaders/PostProcessStages/DepthView.glsl +9 -0
- package/Source/Shaders/PostProcessStages/DepthView.js +11 -0
- package/Source/Shaders/PostProcessStages/DepthViewPacked.glsl +14 -0
- package/Source/Shaders/PostProcessStages/DepthViewPacked.js +16 -0
- package/Source/Shaders/PostProcessStages/EdgeDetection.glsl +60 -0
- package/Source/Shaders/PostProcessStages/EdgeDetection.js +62 -0
- package/Source/Shaders/PostProcessStages/FXAA.glsl +21 -0
- package/Source/Shaders/PostProcessStages/FXAA.js +23 -0
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.glsl +36 -0
- package/Source/Shaders/PostProcessStages/FilmicTonemapping.js +38 -0
- package/Source/Shaders/PostProcessStages/GaussianBlur1D.glsl +47 -0
- package/Source/Shaders/PostProcessStages/GaussianBlur1D.js +49 -0
- package/Source/Shaders/PostProcessStages/LensFlare.glsl +153 -0
- package/Source/Shaders/PostProcessStages/LensFlare.js +155 -0
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.glsl +24 -0
- package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.js +26 -0
- package/Source/Shaders/PostProcessStages/NightVision.glsl +16 -0
- package/Source/Shaders/PostProcessStages/NightVision.js +18 -0
- package/Source/Shaders/PostProcessStages/PassThrough.glsl +8 -0
- package/Source/Shaders/PostProcessStages/PassThrough.js +10 -0
- package/Source/Shaders/PostProcessStages/PassThroughDepth.glsl +8 -0
- package/Source/Shaders/PostProcessStages/PassThroughDepth.js +10 -0
- package/Source/Shaders/PostProcessStages/PointCloudEyeDomeLighting.glsl +63 -0
- package/Source/Shaders/PostProcessStages/PointCloudEyeDomeLighting.js +65 -0
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.glsl +23 -0
- package/Source/Shaders/PostProcessStages/ReinhardTonemapping.js +25 -0
- package/Source/Shaders/PostProcessStages/Silhouette.glsl +11 -0
- package/Source/Shaders/PostProcessStages/Silhouette.js +13 -0
- package/Source/Shaders/ReprojectWebMercatorFS.glsl +8 -0
- package/Source/Shaders/ReprojectWebMercatorFS.js +10 -0
- package/Source/Shaders/ReprojectWebMercatorVS.glsl +12 -0
- package/Source/Shaders/ReprojectWebMercatorVS.js +14 -0
- package/Source/Shaders/ShadowVolumeAppearanceFS.glsl +165 -0
- package/Source/Shaders/ShadowVolumeAppearanceFS.js +167 -0
- package/Source/Shaders/ShadowVolumeAppearanceVS.glsl +101 -0
- package/Source/Shaders/ShadowVolumeAppearanceVS.js +103 -0
- package/Source/Shaders/ShadowVolumeFS.glsl +17 -0
- package/Source/Shaders/ShadowVolumeFS.js +19 -0
- package/Source/Shaders/SkyAtmosphereCommon.glsl +91 -0
- package/Source/Shaders/SkyAtmosphereCommon.js +93 -0
- package/Source/Shaders/SkyAtmosphereFS.glsl +64 -0
- package/Source/Shaders/SkyAtmosphereFS.js +66 -0
- package/Source/Shaders/SkyAtmosphereVS.glsl +30 -0
- package/Source/Shaders/SkyAtmosphereVS.js +32 -0
- package/Source/Shaders/SkyBoxFS.glsl +9 -0
- package/Source/Shaders/SkyBoxFS.js +11 -0
- package/Source/Shaders/SkyBoxVS.glsl +10 -0
- package/Source/Shaders/SkyBoxVS.js +12 -0
- package/Source/Shaders/SunFS.glsl +9 -0
- package/Source/Shaders/SunFS.js +11 -0
- package/Source/Shaders/SunTextureFS.glsl +55 -0
- package/Source/Shaders/SunTextureFS.js +57 -0
- package/Source/Shaders/SunVS.glsl +28 -0
- package/Source/Shaders/SunVS.js +30 -0
- package/Source/Shaders/Vector3DTileClampedPolylinesFS.glsl +52 -0
- package/Source/Shaders/Vector3DTileClampedPolylinesFS.js +54 -0
- package/Source/Shaders/Vector3DTileClampedPolylinesVS.glsl +85 -0
- package/Source/Shaders/Vector3DTileClampedPolylinesVS.js +87 -0
- package/Source/Shaders/Vector3DTilePolylinesVS.glsl +22 -0
- package/Source/Shaders/Vector3DTilePolylinesVS.js +24 -0
- package/Source/Shaders/VectorTileVS.glsl +9 -0
- package/Source/Shaders/VectorTileVS.js +11 -0
- package/Source/Shaders/ViewportQuadFS.glsl +16 -0
- package/Source/Shaders/ViewportQuadFS.js +18 -0
- package/Source/Shaders/ViewportQuadVS.glsl +10 -0
- package/Source/Shaders/ViewportQuadVS.js +12 -0
- package/Source/ThirdParty/Workers/basis_transcoder.js +21 -0
- package/Source/ThirdParty/Workers/draco_decoder_nodejs.js +118 -0
- package/Source/ThirdParty/Workers/package.json +1 -0
- package/Source/ThirdParty/Workers/pako_deflate.min.js +2 -0
- package/Source/ThirdParty/Workers/pako_inflate.min.js +2 -0
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -0
- package/Source/ThirdParty/basis_transcoder.wasm +0 -0
- package/Source/ThirdParty/draco_decoder.wasm +0 -0
- package/Source/ThirdParty/google-earth-dbroot-parser.js +8337 -0
- package/Source/Widget/CesiumWidget.css +124 -0
- package/Source/Widget/CesiumWidget.js +807 -0
- package/Source/Widget/lighter.css +14 -0
- package/Source/Workers/cesiumWorkerBootstrapper.js +2290 -0
- package/Source/Workers/package.json +1 -0
- package/Source/Workers/transferTypedArrayTest.js +22 -0
- package/Source/WorkersES6/combineGeometry.js +14 -0
- package/Source/WorkersES6/createBoxGeometry.js +10 -0
- package/Source/WorkersES6/createBoxOutlineGeometry.js +10 -0
- package/Source/WorkersES6/createCircleGeometry.js +18 -0
- package/Source/WorkersES6/createCircleOutlineGeometry.js +18 -0
- package/Source/WorkersES6/createCoplanarPolygonGeometry.js +10 -0
- package/Source/WorkersES6/createCoplanarPolygonOutlineGeometry.js +15 -0
- package/Source/WorkersES6/createCorridorGeometry.js +12 -0
- package/Source/WorkersES6/createCorridorOutlineGeometry.js +17 -0
- package/Source/WorkersES6/createCylinderGeometry.js +10 -0
- package/Source/WorkersES6/createCylinderOutlineGeometry.js +10 -0
- package/Source/WorkersES6/createEllipseGeometry.js +14 -0
- package/Source/WorkersES6/createEllipseOutlineGeometry.js +14 -0
- package/Source/WorkersES6/createEllipsoidGeometry.js +10 -0
- package/Source/WorkersES6/createEllipsoidOutlineGeometry.js +13 -0
- package/Source/WorkersES6/createFrustumGeometry.js +10 -0
- package/Source/WorkersES6/createFrustumOutlineGeometry.js +10 -0
- package/Source/WorkersES6/createGeometry.js +52 -0
- package/Source/WorkersES6/createGroundPolylineGeometry.js +16 -0
- package/Source/WorkersES6/createPlaneGeometry.js +10 -0
- package/Source/WorkersES6/createPlaneOutlineGeometry.js +10 -0
- package/Source/WorkersES6/createPolygonGeometry.js +12 -0
- package/Source/WorkersES6/createPolygonOutlineGeometry.js +12 -0
- package/Source/WorkersES6/createPolylineGeometry.js +12 -0
- package/Source/WorkersES6/createPolylineVolumeGeometry.js +17 -0
- package/Source/WorkersES6/createPolylineVolumeOutlineGeometry.js +22 -0
- package/Source/WorkersES6/createRectangleGeometry.js +14 -0
- package/Source/WorkersES6/createRectangleOutlineGeometry.js +17 -0
- package/Source/WorkersES6/createSimplePolylineGeometry.js +17 -0
- package/Source/WorkersES6/createSphereGeometry.js +10 -0
- package/Source/WorkersES6/createSphereOutlineGeometry.js +10 -0
- package/Source/WorkersES6/createTaskProcessorWorker.js +129 -0
- package/Source/WorkersES6/createVectorTileClampedPolylines.js +541 -0
- package/Source/WorkersES6/createVectorTileGeometries.js +414 -0
- package/Source/WorkersES6/createVectorTilePoints.js +81 -0
- package/Source/WorkersES6/createVectorTilePolygons.js +412 -0
- package/Source/WorkersES6/createVectorTilePolylines.js +210 -0
- package/Source/WorkersES6/createVerticesFromGoogleEarthEnterpriseBuffer.js +653 -0
- package/Source/WorkersES6/createVerticesFromHeightmap.js +53 -0
- package/Source/WorkersES6/createVerticesFromQuantizedTerrainMesh.js +549 -0
- package/Source/WorkersES6/createWallGeometry.js +12 -0
- package/Source/WorkersES6/createWallOutlineGeometry.js +12 -0
- package/Source/WorkersES6/decodeDraco.js +381 -0
- package/Source/WorkersES6/decodeGoogleEarthEnterprisePacket.js +268 -0
- package/Source/WorkersES6/decodeI3S.js +1044 -0
- package/Source/WorkersES6/transcodeKTX2.js +316 -0
- package/Source/WorkersES6/upsampleQuantizedTerrainMesh.js +680 -0
- package/index.d.ts +41767 -0
- package/index.js +1085 -0
- package/package.json +73 -0
|
@@ -0,0 +1,4326 @@
|
|
|
1
|
+
import ArcType from "../Core/ArcType.js";
|
|
2
|
+
import AssociativeArray from "../Core/AssociativeArray.js";
|
|
3
|
+
import BoundingRectangle from "../Core/BoundingRectangle.js";
|
|
4
|
+
import buildModuleUrl from "../Core/buildModuleUrl.js";
|
|
5
|
+
import Cartesian2 from "../Core/Cartesian2.js";
|
|
6
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
7
|
+
import Cartographic from "../Core/Cartographic.js";
|
|
8
|
+
import ClockRange from "../Core/ClockRange.js";
|
|
9
|
+
import ClockStep from "../Core/ClockStep.js";
|
|
10
|
+
import clone from "../Core/clone.js";
|
|
11
|
+
import Color from "../Core/Color.js";
|
|
12
|
+
import createGuid from "../Core/createGuid.js";
|
|
13
|
+
import Credit from "../Core/Credit.js";
|
|
14
|
+
import defaultValue from "../Core/defaultValue.js";
|
|
15
|
+
import defer from "../Core/defer.js";
|
|
16
|
+
import defined from "../Core/defined.js";
|
|
17
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
18
|
+
import Ellipsoid from "../Core/Ellipsoid.js";
|
|
19
|
+
import Event from "../Core/Event.js";
|
|
20
|
+
import getExtensionFromUri from "../Core/getExtensionFromUri.js";
|
|
21
|
+
import getFilenameFromUri from "../Core/getFilenameFromUri.js";
|
|
22
|
+
import getTimestamp from "../Core/getTimestamp.js";
|
|
23
|
+
import HeadingPitchRange from "../Core/HeadingPitchRange.js";
|
|
24
|
+
import HeadingPitchRoll from "../Core/HeadingPitchRoll.js";
|
|
25
|
+
import Iso8601 from "../Core/Iso8601.js";
|
|
26
|
+
import JulianDate from "../Core/JulianDate.js";
|
|
27
|
+
import CesiumMath from "../Core/Math.js";
|
|
28
|
+
import NearFarScalar from "../Core/NearFarScalar.js";
|
|
29
|
+
import objectToQuery from "../Core/objectToQuery.js";
|
|
30
|
+
import oneTimeWarning from "../Core/oneTimeWarning.js";
|
|
31
|
+
import PinBuilder from "../Core/PinBuilder.js";
|
|
32
|
+
import PolygonHierarchy from "../Core/PolygonHierarchy.js";
|
|
33
|
+
import queryToObject from "../Core/queryToObject.js";
|
|
34
|
+
import Rectangle from "../Core/Rectangle.js";
|
|
35
|
+
import Resource from "../Core/Resource.js";
|
|
36
|
+
import RuntimeError from "../Core/RuntimeError.js";
|
|
37
|
+
import TimeInterval from "../Core/TimeInterval.js";
|
|
38
|
+
import TimeIntervalCollection from "../Core/TimeIntervalCollection.js";
|
|
39
|
+
import HeightReference from "../Scene/HeightReference.js";
|
|
40
|
+
import HorizontalOrigin from "../Scene/HorizontalOrigin.js";
|
|
41
|
+
import LabelStyle from "../Scene/LabelStyle.js";
|
|
42
|
+
import SceneMode from "../Scene/SceneMode.js";
|
|
43
|
+
import Autolinker from "autolinker";
|
|
44
|
+
import Uri from "urijs";
|
|
45
|
+
import * as zip from "@zip.js/zip.js/lib/zip-no-worker.js";
|
|
46
|
+
import getElement from "./getElement.js";
|
|
47
|
+
import BillboardGraphics from "./BillboardGraphics.js";
|
|
48
|
+
import CompositePositionProperty from "./CompositePositionProperty.js";
|
|
49
|
+
import DataSource from "./DataSource.js";
|
|
50
|
+
import DataSourceClock from "./DataSourceClock.js";
|
|
51
|
+
import Entity from "./Entity.js";
|
|
52
|
+
import EntityCluster from "./EntityCluster.js";
|
|
53
|
+
import EntityCollection from "./EntityCollection.js";
|
|
54
|
+
import KmlCamera from "./KmlCamera.js";
|
|
55
|
+
import KmlLookAt from "./KmlLookAt.js";
|
|
56
|
+
import KmlTour from "./KmlTour.js";
|
|
57
|
+
import KmlTourFlyTo from "./KmlTourFlyTo.js";
|
|
58
|
+
import KmlTourWait from "./KmlTourWait.js";
|
|
59
|
+
import LabelGraphics from "./LabelGraphics.js";
|
|
60
|
+
import PathGraphics from "./PathGraphics.js";
|
|
61
|
+
import PolygonGraphics from "./PolygonGraphics.js";
|
|
62
|
+
import PolylineGraphics from "./PolylineGraphics.js";
|
|
63
|
+
import PositionPropertyArray from "./PositionPropertyArray.js";
|
|
64
|
+
import RectangleGraphics from "./RectangleGraphics.js";
|
|
65
|
+
import ReferenceProperty from "./ReferenceProperty.js";
|
|
66
|
+
import SampledPositionProperty from "./SampledPositionProperty.js";
|
|
67
|
+
import ScaledPositionProperty from "./ScaledPositionProperty.js";
|
|
68
|
+
import TimeIntervalCollectionProperty from "./TimeIntervalCollectionProperty.js";
|
|
69
|
+
import WallGraphics from "./WallGraphics.js";
|
|
70
|
+
|
|
71
|
+
//This is by no means an exhaustive list of MIME types.
|
|
72
|
+
//The purpose of this list is to be able to accurately identify content embedded
|
|
73
|
+
//in KMZ files. Eventually, we can make this configurable by the end user so they can add
|
|
74
|
+
//there own content types if they have KMZ files that require it.
|
|
75
|
+
const MimeTypes = {
|
|
76
|
+
avi: "video/x-msvideo",
|
|
77
|
+
bmp: "image/bmp",
|
|
78
|
+
bz2: "application/x-bzip2",
|
|
79
|
+
chm: "application/vnd.ms-htmlhelp",
|
|
80
|
+
css: "text/css",
|
|
81
|
+
csv: "text/csv",
|
|
82
|
+
doc: "application/msword",
|
|
83
|
+
dvi: "application/x-dvi",
|
|
84
|
+
eps: "application/postscript",
|
|
85
|
+
flv: "video/x-flv",
|
|
86
|
+
gif: "image/gif",
|
|
87
|
+
gz: "application/x-gzip",
|
|
88
|
+
htm: "text/html",
|
|
89
|
+
html: "text/html",
|
|
90
|
+
ico: "image/vnd.microsoft.icon",
|
|
91
|
+
jnlp: "application/x-java-jnlp-file",
|
|
92
|
+
jpeg: "image/jpeg",
|
|
93
|
+
jpg: "image/jpeg",
|
|
94
|
+
m3u: "audio/x-mpegurl",
|
|
95
|
+
m4v: "video/mp4",
|
|
96
|
+
mathml: "application/mathml+xml",
|
|
97
|
+
mid: "audio/midi",
|
|
98
|
+
midi: "audio/midi",
|
|
99
|
+
mov: "video/quicktime",
|
|
100
|
+
mp3: "audio/mpeg",
|
|
101
|
+
mp4: "video/mp4",
|
|
102
|
+
mp4v: "video/mp4",
|
|
103
|
+
mpeg: "video/mpeg",
|
|
104
|
+
mpg: "video/mpeg",
|
|
105
|
+
odp: "application/vnd.oasis.opendocument.presentation",
|
|
106
|
+
ods: "application/vnd.oasis.opendocument.spreadsheet",
|
|
107
|
+
odt: "application/vnd.oasis.opendocument.text",
|
|
108
|
+
ogg: "application/ogg",
|
|
109
|
+
pdf: "application/pdf",
|
|
110
|
+
png: "image/png",
|
|
111
|
+
pps: "application/vnd.ms-powerpoint",
|
|
112
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
113
|
+
ps: "application/postscript",
|
|
114
|
+
qt: "video/quicktime",
|
|
115
|
+
rdf: "application/rdf+xml",
|
|
116
|
+
rss: "application/rss+xml",
|
|
117
|
+
rtf: "application/rtf",
|
|
118
|
+
svg: "image/svg+xml",
|
|
119
|
+
swf: "application/x-shockwave-flash",
|
|
120
|
+
text: "text/plain",
|
|
121
|
+
tif: "image/tiff",
|
|
122
|
+
tiff: "image/tiff",
|
|
123
|
+
txt: "text/plain",
|
|
124
|
+
wav: "audio/x-wav",
|
|
125
|
+
wma: "audio/x-ms-wma",
|
|
126
|
+
wmv: "video/x-ms-wmv",
|
|
127
|
+
xml: "application/xml",
|
|
128
|
+
zip: "application/zip",
|
|
129
|
+
|
|
130
|
+
detectFromFilename: function (filename) {
|
|
131
|
+
let ext = filename.toLowerCase();
|
|
132
|
+
ext = getExtensionFromUri(ext);
|
|
133
|
+
return MimeTypes[ext];
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
let parser;
|
|
138
|
+
if (typeof DOMParser !== "undefined") {
|
|
139
|
+
parser = new DOMParser();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const autolinker = new Autolinker({
|
|
143
|
+
stripPrefix: false,
|
|
144
|
+
email: false,
|
|
145
|
+
replaceFn: function (match) {
|
|
146
|
+
if (!match.protocolUrlMatch) {
|
|
147
|
+
//Prevent matching of non-explicit urls.
|
|
148
|
+
//i.e. foo.id won't match but http://foo.id will
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const BILLBOARD_SIZE = 32;
|
|
155
|
+
|
|
156
|
+
const BILLBOARD_NEAR_DISTANCE = 2414016;
|
|
157
|
+
const BILLBOARD_NEAR_RATIO = 1.0;
|
|
158
|
+
const BILLBOARD_FAR_DISTANCE = 1.6093e7;
|
|
159
|
+
const BILLBOARD_FAR_RATIO = 0.1;
|
|
160
|
+
|
|
161
|
+
const kmlNamespaces = [
|
|
162
|
+
null,
|
|
163
|
+
undefined,
|
|
164
|
+
"http://www.opengis.net/kml/2.2",
|
|
165
|
+
"http://earth.google.com/kml/2.2",
|
|
166
|
+
"http://earth.google.com/kml/2.1",
|
|
167
|
+
"http://earth.google.com/kml/2.0",
|
|
168
|
+
];
|
|
169
|
+
const gxNamespaces = ["http://www.google.com/kml/ext/2.2"];
|
|
170
|
+
const atomNamespaces = ["http://www.w3.org/2005/Atom"];
|
|
171
|
+
const namespaces = {
|
|
172
|
+
kml: kmlNamespaces,
|
|
173
|
+
gx: gxNamespaces,
|
|
174
|
+
atom: atomNamespaces,
|
|
175
|
+
kmlgx: kmlNamespaces.concat(gxNamespaces),
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// Ensure Specs/Data/KML/unsupported.kml is kept up to date with these supported types
|
|
179
|
+
const featureTypes = {
|
|
180
|
+
Document: processDocument,
|
|
181
|
+
Folder: processFolder,
|
|
182
|
+
Placemark: processPlacemark,
|
|
183
|
+
NetworkLink: processNetworkLink,
|
|
184
|
+
GroundOverlay: processGroundOverlay,
|
|
185
|
+
PhotoOverlay: processUnsupportedFeature,
|
|
186
|
+
ScreenOverlay: processScreenOverlay,
|
|
187
|
+
Tour: processTour,
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
function DeferredLoading(dataSource) {
|
|
191
|
+
this._dataSource = dataSource;
|
|
192
|
+
this._deferred = defer();
|
|
193
|
+
this._stack = [];
|
|
194
|
+
this._promises = [];
|
|
195
|
+
this._timeoutSet = false;
|
|
196
|
+
this._used = false;
|
|
197
|
+
|
|
198
|
+
this._started = 0;
|
|
199
|
+
this._timeThreshold = 1000; // Initial load is 1 second
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
Object.defineProperties(DeferredLoading.prototype, {
|
|
203
|
+
dataSource: {
|
|
204
|
+
get: function () {
|
|
205
|
+
return this._dataSource;
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
DeferredLoading.prototype.addNodes = function (nodes, processingData) {
|
|
211
|
+
this._stack.push({
|
|
212
|
+
nodes: nodes,
|
|
213
|
+
index: 0,
|
|
214
|
+
processingData: processingData,
|
|
215
|
+
});
|
|
216
|
+
this._used = true;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
DeferredLoading.prototype.addPromise = function (promise) {
|
|
220
|
+
this._promises.push(promise);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
DeferredLoading.prototype.wait = function () {
|
|
224
|
+
// Case where we had a non-document/folder as the root
|
|
225
|
+
const deferred = this._deferred;
|
|
226
|
+
if (!this._used) {
|
|
227
|
+
deferred.resolve();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return Promise.all([deferred.promise, Promise.all(this._promises)]);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
DeferredLoading.prototype.process = function () {
|
|
234
|
+
const isFirstCall = this._stack.length === 1;
|
|
235
|
+
if (isFirstCall) {
|
|
236
|
+
this._started = KmlDataSource._getTimestamp();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return this._process(isFirstCall);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
DeferredLoading.prototype._giveUpTime = function () {
|
|
243
|
+
if (this._timeoutSet) {
|
|
244
|
+
// Timeout was already set so just return
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
this._timeoutSet = true;
|
|
249
|
+
this._timeThreshold = 50; // After the first load lower threshold to 0.5 seconds
|
|
250
|
+
const that = this;
|
|
251
|
+
setTimeout(function () {
|
|
252
|
+
that._timeoutSet = false;
|
|
253
|
+
that._started = KmlDataSource._getTimestamp();
|
|
254
|
+
that._process(true);
|
|
255
|
+
}, 0);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
DeferredLoading.prototype._nextNode = function () {
|
|
259
|
+
const stack = this._stack;
|
|
260
|
+
const top = stack[stack.length - 1];
|
|
261
|
+
const index = top.index;
|
|
262
|
+
const nodes = top.nodes;
|
|
263
|
+
if (index === nodes.length) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
++top.index;
|
|
267
|
+
|
|
268
|
+
return nodes[index];
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
DeferredLoading.prototype._pop = function () {
|
|
272
|
+
const stack = this._stack;
|
|
273
|
+
stack.pop();
|
|
274
|
+
|
|
275
|
+
// Return false if we are done
|
|
276
|
+
if (stack.length === 0) {
|
|
277
|
+
this._deferred.resolve();
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return true;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
DeferredLoading.prototype._process = function (isFirstCall) {
|
|
285
|
+
const dataSource = this.dataSource;
|
|
286
|
+
const processingData = this._stack[this._stack.length - 1].processingData;
|
|
287
|
+
|
|
288
|
+
let child = this._nextNode();
|
|
289
|
+
while (defined(child)) {
|
|
290
|
+
const featureProcessor = featureTypes[child.localName];
|
|
291
|
+
if (
|
|
292
|
+
defined(featureProcessor) &&
|
|
293
|
+
(namespaces.kml.indexOf(child.namespaceURI) !== -1 ||
|
|
294
|
+
namespaces.gx.indexOf(child.namespaceURI) !== -1)
|
|
295
|
+
) {
|
|
296
|
+
featureProcessor(dataSource, child, processingData, this);
|
|
297
|
+
|
|
298
|
+
// Give up time and continue loading later
|
|
299
|
+
if (
|
|
300
|
+
this._timeoutSet ||
|
|
301
|
+
KmlDataSource._getTimestamp() > this._started + this._timeThreshold
|
|
302
|
+
) {
|
|
303
|
+
this._giveUpTime();
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
child = this._nextNode();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// If we are a recursive call from a subfolder, just return so the parent folder can continue processing
|
|
312
|
+
// If we aren't then make another call to processNodes because there is stuff still left in the queue
|
|
313
|
+
if (this._pop() && isFirstCall) {
|
|
314
|
+
this._process(true);
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
function isZipFile(blob) {
|
|
319
|
+
const magicBlob = blob.slice(0, Math.min(4, blob.size));
|
|
320
|
+
const deferred = defer();
|
|
321
|
+
const reader = new FileReader();
|
|
322
|
+
reader.addEventListener("load", function () {
|
|
323
|
+
deferred.resolve(
|
|
324
|
+
new DataView(reader.result).getUint32(0, false) === 0x504b0304
|
|
325
|
+
);
|
|
326
|
+
});
|
|
327
|
+
reader.addEventListener("error", function () {
|
|
328
|
+
deferred.reject(reader.error);
|
|
329
|
+
});
|
|
330
|
+
reader.readAsArrayBuffer(magicBlob);
|
|
331
|
+
return deferred.promise;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function readBlobAsText(blob) {
|
|
335
|
+
const deferred = defer();
|
|
336
|
+
const reader = new FileReader();
|
|
337
|
+
reader.addEventListener("load", function () {
|
|
338
|
+
deferred.resolve(reader.result);
|
|
339
|
+
});
|
|
340
|
+
reader.addEventListener("error", function () {
|
|
341
|
+
deferred.reject(reader.error);
|
|
342
|
+
});
|
|
343
|
+
reader.readAsText(blob);
|
|
344
|
+
return deferred.promise;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function insertNamespaces(text) {
|
|
348
|
+
const namespaceMap = {
|
|
349
|
+
xsi: "http://www.w3.org/2001/XMLSchema-instance",
|
|
350
|
+
};
|
|
351
|
+
let firstPart, lastPart, reg, declaration;
|
|
352
|
+
|
|
353
|
+
for (const key in namespaceMap) {
|
|
354
|
+
if (namespaceMap.hasOwnProperty(key)) {
|
|
355
|
+
reg = RegExp(`[< ]${key}:`);
|
|
356
|
+
declaration = `xmlns:${key}=`;
|
|
357
|
+
if (reg.test(text) && text.indexOf(declaration) === -1) {
|
|
358
|
+
if (!defined(firstPart)) {
|
|
359
|
+
firstPart = text.substr(0, text.indexOf("<kml") + 4);
|
|
360
|
+
lastPart = text.substr(firstPart.length);
|
|
361
|
+
}
|
|
362
|
+
firstPart += ` ${declaration}"${namespaceMap[key]}"`;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (defined(firstPart)) {
|
|
368
|
+
text = firstPart + lastPart;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
return text;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function removeDuplicateNamespaces(text) {
|
|
375
|
+
let index = text.indexOf("xmlns:");
|
|
376
|
+
const endDeclaration = text.indexOf(">", index);
|
|
377
|
+
let namespace, startIndex, endIndex;
|
|
378
|
+
|
|
379
|
+
while (index !== -1 && index < endDeclaration) {
|
|
380
|
+
namespace = text.slice(index, text.indexOf('"', index));
|
|
381
|
+
startIndex = index;
|
|
382
|
+
index = text.indexOf(namespace, index + 1);
|
|
383
|
+
if (index !== -1) {
|
|
384
|
+
endIndex = text.indexOf('"', text.indexOf('"', index) + 1);
|
|
385
|
+
text = text.slice(0, index - 1) + text.slice(endIndex + 1, text.length);
|
|
386
|
+
index = text.indexOf("xmlns:", startIndex - 1);
|
|
387
|
+
} else {
|
|
388
|
+
index = text.indexOf("xmlns:", startIndex + 1);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return text;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function loadXmlFromZip(entry, uriResolver) {
|
|
396
|
+
return Promise.resolve(entry.getData(new zip.TextWriter())).then(function (
|
|
397
|
+
text
|
|
398
|
+
) {
|
|
399
|
+
text = insertNamespaces(text);
|
|
400
|
+
text = removeDuplicateNamespaces(text);
|
|
401
|
+
uriResolver.kml = parser.parseFromString(text, "application/xml");
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function loadDataUriFromZip(entry, uriResolver) {
|
|
406
|
+
const mimeType = defaultValue(
|
|
407
|
+
MimeTypes.detectFromFilename(entry.filename),
|
|
408
|
+
"application/octet-stream"
|
|
409
|
+
);
|
|
410
|
+
return Promise.resolve(entry.getData(new zip.Data64URIWriter(mimeType))).then(
|
|
411
|
+
function (dataUri) {
|
|
412
|
+
uriResolver[entry.filename] = dataUri;
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function embedDataUris(div, elementType, attributeName, uriResolver) {
|
|
418
|
+
const keys = uriResolver.keys;
|
|
419
|
+
const baseUri = new Uri(".");
|
|
420
|
+
const elements = div.querySelectorAll(elementType);
|
|
421
|
+
for (let i = 0; i < elements.length; i++) {
|
|
422
|
+
const element = elements[i];
|
|
423
|
+
const value = element.getAttribute(attributeName);
|
|
424
|
+
if (defined(value)) {
|
|
425
|
+
const relativeUri = new Uri(value);
|
|
426
|
+
const uri = relativeUri.absoluteTo(baseUri).toString();
|
|
427
|
+
const index = keys.indexOf(uri);
|
|
428
|
+
if (index !== -1) {
|
|
429
|
+
const key = keys[index];
|
|
430
|
+
element.setAttribute(attributeName, uriResolver[key]);
|
|
431
|
+
if (elementType === "a" && element.getAttribute("download") === null) {
|
|
432
|
+
element.setAttribute("download", key);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function applyBasePath(div, elementType, attributeName, sourceResource) {
|
|
440
|
+
const elements = div.querySelectorAll(elementType);
|
|
441
|
+
for (let i = 0; i < elements.length; i++) {
|
|
442
|
+
const element = elements[i];
|
|
443
|
+
const value = element.getAttribute(attributeName);
|
|
444
|
+
const resource = resolveHref(value, sourceResource);
|
|
445
|
+
if (defined(resource)) {
|
|
446
|
+
element.setAttribute(attributeName, resource.url);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// an optional context is passed to allow for some malformed kmls (those with multiple geometries with same ids) to still parse
|
|
452
|
+
// correctly, as they do in Google Earth.
|
|
453
|
+
function createEntity(node, entityCollection, context) {
|
|
454
|
+
let id = queryStringAttribute(node, "id");
|
|
455
|
+
id = defined(id) && id.length !== 0 ? id : createGuid();
|
|
456
|
+
if (defined(context)) {
|
|
457
|
+
id = context + id;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// If we have a duplicate ID just generate one.
|
|
461
|
+
// This isn't valid KML but Google Earth handles this case.
|
|
462
|
+
let entity = entityCollection.getById(id);
|
|
463
|
+
if (defined(entity)) {
|
|
464
|
+
id = createGuid();
|
|
465
|
+
if (defined(context)) {
|
|
466
|
+
id = context + id;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
entity = entityCollection.add(new Entity({ id: id }));
|
|
471
|
+
if (!defined(entity.kml)) {
|
|
472
|
+
entity.addProperty("kml");
|
|
473
|
+
entity.kml = new KmlFeatureData();
|
|
474
|
+
}
|
|
475
|
+
return entity;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function isExtrudable(altitudeMode, gxAltitudeMode) {
|
|
479
|
+
return (
|
|
480
|
+
altitudeMode === "absolute" ||
|
|
481
|
+
altitudeMode === "relativeToGround" ||
|
|
482
|
+
gxAltitudeMode === "relativeToSeaFloor"
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function readCoordinate(value, ellipsoid) {
|
|
487
|
+
//Google Earth treats empty or missing coordinates as 0.
|
|
488
|
+
if (!defined(value)) {
|
|
489
|
+
return Cartesian3.fromDegrees(0, 0, 0, ellipsoid);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
const digits = value.match(/[^\s,\n]+/g);
|
|
493
|
+
if (!defined(digits)) {
|
|
494
|
+
return Cartesian3.fromDegrees(0, 0, 0, ellipsoid);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
let longitude = parseFloat(digits[0]);
|
|
498
|
+
let latitude = parseFloat(digits[1]);
|
|
499
|
+
let height = parseFloat(digits[2]);
|
|
500
|
+
|
|
501
|
+
longitude = isNaN(longitude) ? 0.0 : longitude;
|
|
502
|
+
latitude = isNaN(latitude) ? 0.0 : latitude;
|
|
503
|
+
height = isNaN(height) ? 0.0 : height;
|
|
504
|
+
|
|
505
|
+
return Cartesian3.fromDegrees(longitude, latitude, height, ellipsoid);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function readCoordinates(element, ellipsoid) {
|
|
509
|
+
if (!defined(element)) {
|
|
510
|
+
return undefined;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
const tuples = element.textContent.match(/[^\s\n]+/g);
|
|
514
|
+
if (!defined(tuples)) {
|
|
515
|
+
return undefined;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
const length = tuples.length;
|
|
519
|
+
const result = new Array(length);
|
|
520
|
+
let resultIndex = 0;
|
|
521
|
+
for (let i = 0; i < length; i++) {
|
|
522
|
+
result[resultIndex++] = readCoordinate(tuples[i], ellipsoid);
|
|
523
|
+
}
|
|
524
|
+
return result;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function queryNumericAttribute(node, attributeName) {
|
|
528
|
+
if (!defined(node)) {
|
|
529
|
+
return undefined;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
const value = node.getAttribute(attributeName);
|
|
533
|
+
if (value !== null) {
|
|
534
|
+
const result = parseFloat(value);
|
|
535
|
+
return !isNaN(result) ? result : undefined;
|
|
536
|
+
}
|
|
537
|
+
return undefined;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function queryStringAttribute(node, attributeName) {
|
|
541
|
+
if (!defined(node)) {
|
|
542
|
+
return undefined;
|
|
543
|
+
}
|
|
544
|
+
const value = node.getAttribute(attributeName);
|
|
545
|
+
return value !== null ? value : undefined;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function queryFirstNode(node, tagName, namespace) {
|
|
549
|
+
if (!defined(node)) {
|
|
550
|
+
return undefined;
|
|
551
|
+
}
|
|
552
|
+
const childNodes = node.childNodes;
|
|
553
|
+
const length = childNodes.length;
|
|
554
|
+
for (let q = 0; q < length; q++) {
|
|
555
|
+
const child = childNodes[q];
|
|
556
|
+
if (
|
|
557
|
+
child.localName === tagName &&
|
|
558
|
+
namespace.indexOf(child.namespaceURI) !== -1
|
|
559
|
+
) {
|
|
560
|
+
return child;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return undefined;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function queryNodes(node, tagName, namespace) {
|
|
567
|
+
if (!defined(node)) {
|
|
568
|
+
return undefined;
|
|
569
|
+
}
|
|
570
|
+
const result = [];
|
|
571
|
+
const childNodes = node.getElementsByTagNameNS("*", tagName);
|
|
572
|
+
const length = childNodes.length;
|
|
573
|
+
for (let q = 0; q < length; q++) {
|
|
574
|
+
const child = childNodes[q];
|
|
575
|
+
if (
|
|
576
|
+
child.localName === tagName &&
|
|
577
|
+
namespace.indexOf(child.namespaceURI) !== -1
|
|
578
|
+
) {
|
|
579
|
+
result.push(child);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return result;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function queryChildNodes(node, tagName, namespace) {
|
|
586
|
+
if (!defined(node)) {
|
|
587
|
+
return [];
|
|
588
|
+
}
|
|
589
|
+
const result = [];
|
|
590
|
+
const childNodes = node.childNodes;
|
|
591
|
+
const length = childNodes.length;
|
|
592
|
+
for (let q = 0; q < length; q++) {
|
|
593
|
+
const child = childNodes[q];
|
|
594
|
+
if (
|
|
595
|
+
child.localName === tagName &&
|
|
596
|
+
namespace.indexOf(child.namespaceURI) !== -1
|
|
597
|
+
) {
|
|
598
|
+
result.push(child);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
return result;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function queryNumericValue(node, tagName, namespace) {
|
|
605
|
+
const resultNode = queryFirstNode(node, tagName, namespace);
|
|
606
|
+
if (defined(resultNode)) {
|
|
607
|
+
const result = parseFloat(resultNode.textContent);
|
|
608
|
+
return !isNaN(result) ? result : undefined;
|
|
609
|
+
}
|
|
610
|
+
return undefined;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
function queryStringValue(node, tagName, namespace) {
|
|
614
|
+
const result = queryFirstNode(node, tagName, namespace);
|
|
615
|
+
if (defined(result)) {
|
|
616
|
+
return result.textContent.trim();
|
|
617
|
+
}
|
|
618
|
+
return undefined;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
function queryBooleanValue(node, tagName, namespace) {
|
|
622
|
+
const result = queryFirstNode(node, tagName, namespace);
|
|
623
|
+
if (defined(result)) {
|
|
624
|
+
const value = result.textContent.trim();
|
|
625
|
+
return value === "1" || /^true$/i.test(value);
|
|
626
|
+
}
|
|
627
|
+
return undefined;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
function resolveHref(href, sourceResource, uriResolver) {
|
|
631
|
+
if (!defined(href)) {
|
|
632
|
+
return undefined;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
let resource;
|
|
636
|
+
if (defined(uriResolver)) {
|
|
637
|
+
// To resolve issues with KML sources defined in Windows style paths.
|
|
638
|
+
href = href.replace(/\\/g, "/");
|
|
639
|
+
let blob = uriResolver[href];
|
|
640
|
+
if (defined(blob)) {
|
|
641
|
+
resource = new Resource({
|
|
642
|
+
url: blob,
|
|
643
|
+
});
|
|
644
|
+
} else {
|
|
645
|
+
// Needed for multiple levels of KML files in a KMZ
|
|
646
|
+
const baseUri = new Uri(sourceResource.getUrlComponent());
|
|
647
|
+
const uri = new Uri(href);
|
|
648
|
+
blob = uriResolver[uri.absoluteTo(baseUri)];
|
|
649
|
+
if (defined(blob)) {
|
|
650
|
+
resource = new Resource({
|
|
651
|
+
url: blob,
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
if (!defined(resource)) {
|
|
658
|
+
resource = sourceResource.getDerivedResource({
|
|
659
|
+
url: href,
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
return resource;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
const colorOptions = {
|
|
667
|
+
maximumRed: undefined,
|
|
668
|
+
red: undefined,
|
|
669
|
+
maximumGreen: undefined,
|
|
670
|
+
green: undefined,
|
|
671
|
+
maximumBlue: undefined,
|
|
672
|
+
blue: undefined,
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
function parseColorString(value, isRandom) {
|
|
676
|
+
if (!defined(value) || /^\s*$/gm.test(value)) {
|
|
677
|
+
return undefined;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
if (value[0] === "#") {
|
|
681
|
+
value = value.substring(1);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
const alpha = parseInt(value.substring(0, 2), 16) / 255.0;
|
|
685
|
+
const blue = parseInt(value.substring(2, 4), 16) / 255.0;
|
|
686
|
+
const green = parseInt(value.substring(4, 6), 16) / 255.0;
|
|
687
|
+
const red = parseInt(value.substring(6, 8), 16) / 255.0;
|
|
688
|
+
|
|
689
|
+
if (!isRandom) {
|
|
690
|
+
return new Color(red, green, blue, alpha);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
if (red > 0) {
|
|
694
|
+
colorOptions.maximumRed = red;
|
|
695
|
+
colorOptions.red = undefined;
|
|
696
|
+
} else {
|
|
697
|
+
colorOptions.maximumRed = undefined;
|
|
698
|
+
colorOptions.red = 0;
|
|
699
|
+
}
|
|
700
|
+
if (green > 0) {
|
|
701
|
+
colorOptions.maximumGreen = green;
|
|
702
|
+
colorOptions.green = undefined;
|
|
703
|
+
} else {
|
|
704
|
+
colorOptions.maximumGreen = undefined;
|
|
705
|
+
colorOptions.green = 0;
|
|
706
|
+
}
|
|
707
|
+
if (blue > 0) {
|
|
708
|
+
colorOptions.maximumBlue = blue;
|
|
709
|
+
colorOptions.blue = undefined;
|
|
710
|
+
} else {
|
|
711
|
+
colorOptions.maximumBlue = undefined;
|
|
712
|
+
colorOptions.blue = 0;
|
|
713
|
+
}
|
|
714
|
+
colorOptions.alpha = alpha;
|
|
715
|
+
return Color.fromRandom(colorOptions);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
function queryColorValue(node, tagName, namespace) {
|
|
719
|
+
const value = queryStringValue(node, tagName, namespace);
|
|
720
|
+
if (!defined(value)) {
|
|
721
|
+
return undefined;
|
|
722
|
+
}
|
|
723
|
+
return parseColorString(
|
|
724
|
+
value,
|
|
725
|
+
queryStringValue(node, "colorMode", namespace) === "random"
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
function processTimeStamp(featureNode) {
|
|
730
|
+
const node = queryFirstNode(featureNode, "TimeStamp", namespaces.kmlgx);
|
|
731
|
+
const whenString = queryStringValue(node, "when", namespaces.kmlgx);
|
|
732
|
+
|
|
733
|
+
if (!defined(node) || !defined(whenString) || whenString.length === 0) {
|
|
734
|
+
return undefined;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
//According to the KML spec, a TimeStamp represents a "single moment in time"
|
|
738
|
+
//However, since Cesium animates much differently than Google Earth, that doesn't
|
|
739
|
+
//Make much sense here. Instead, we use the TimeStamp as the moment the feature
|
|
740
|
+
//comes into existence. This works much better and gives a similar feel to
|
|
741
|
+
//GE's experience.
|
|
742
|
+
const when = JulianDate.fromIso8601(whenString);
|
|
743
|
+
const result = new TimeIntervalCollection();
|
|
744
|
+
result.addInterval(
|
|
745
|
+
new TimeInterval({
|
|
746
|
+
start: when,
|
|
747
|
+
stop: Iso8601.MAXIMUM_VALUE,
|
|
748
|
+
})
|
|
749
|
+
);
|
|
750
|
+
return result;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
function processTimeSpan(featureNode) {
|
|
754
|
+
const node = queryFirstNode(featureNode, "TimeSpan", namespaces.kmlgx);
|
|
755
|
+
if (!defined(node)) {
|
|
756
|
+
return undefined;
|
|
757
|
+
}
|
|
758
|
+
let result;
|
|
759
|
+
|
|
760
|
+
const beginNode = queryFirstNode(node, "begin", namespaces.kmlgx);
|
|
761
|
+
let beginDate = defined(beginNode)
|
|
762
|
+
? JulianDate.fromIso8601(beginNode.textContent)
|
|
763
|
+
: undefined;
|
|
764
|
+
|
|
765
|
+
const endNode = queryFirstNode(node, "end", namespaces.kmlgx);
|
|
766
|
+
let endDate = defined(endNode)
|
|
767
|
+
? JulianDate.fromIso8601(endNode.textContent)
|
|
768
|
+
: undefined;
|
|
769
|
+
|
|
770
|
+
if (defined(beginDate) && defined(endDate)) {
|
|
771
|
+
if (JulianDate.lessThan(endDate, beginDate)) {
|
|
772
|
+
const tmp = beginDate;
|
|
773
|
+
beginDate = endDate;
|
|
774
|
+
endDate = tmp;
|
|
775
|
+
}
|
|
776
|
+
result = new TimeIntervalCollection();
|
|
777
|
+
result.addInterval(
|
|
778
|
+
new TimeInterval({
|
|
779
|
+
start: beginDate,
|
|
780
|
+
stop: endDate,
|
|
781
|
+
})
|
|
782
|
+
);
|
|
783
|
+
} else if (defined(beginDate)) {
|
|
784
|
+
result = new TimeIntervalCollection();
|
|
785
|
+
result.addInterval(
|
|
786
|
+
new TimeInterval({
|
|
787
|
+
start: beginDate,
|
|
788
|
+
stop: Iso8601.MAXIMUM_VALUE,
|
|
789
|
+
})
|
|
790
|
+
);
|
|
791
|
+
} else if (defined(endDate)) {
|
|
792
|
+
result = new TimeIntervalCollection();
|
|
793
|
+
result.addInterval(
|
|
794
|
+
new TimeInterval({
|
|
795
|
+
start: Iso8601.MINIMUM_VALUE,
|
|
796
|
+
stop: endDate,
|
|
797
|
+
})
|
|
798
|
+
);
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
return result;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
function createDefaultBillboard() {
|
|
805
|
+
const billboard = new BillboardGraphics();
|
|
806
|
+
billboard.width = BILLBOARD_SIZE;
|
|
807
|
+
billboard.height = BILLBOARD_SIZE;
|
|
808
|
+
billboard.scaleByDistance = new NearFarScalar(
|
|
809
|
+
BILLBOARD_NEAR_DISTANCE,
|
|
810
|
+
BILLBOARD_NEAR_RATIO,
|
|
811
|
+
BILLBOARD_FAR_DISTANCE,
|
|
812
|
+
BILLBOARD_FAR_RATIO
|
|
813
|
+
);
|
|
814
|
+
billboard.pixelOffsetScaleByDistance = new NearFarScalar(
|
|
815
|
+
BILLBOARD_NEAR_DISTANCE,
|
|
816
|
+
BILLBOARD_NEAR_RATIO,
|
|
817
|
+
BILLBOARD_FAR_DISTANCE,
|
|
818
|
+
BILLBOARD_FAR_RATIO
|
|
819
|
+
);
|
|
820
|
+
return billboard;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
function createDefaultPolygon() {
|
|
824
|
+
const polygon = new PolygonGraphics();
|
|
825
|
+
polygon.outline = true;
|
|
826
|
+
polygon.outlineColor = Color.WHITE;
|
|
827
|
+
return polygon;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
function createDefaultLabel() {
|
|
831
|
+
const label = new LabelGraphics();
|
|
832
|
+
label.translucencyByDistance = new NearFarScalar(3000000, 1.0, 5000000, 0.0);
|
|
833
|
+
label.pixelOffset = new Cartesian2(17, 0);
|
|
834
|
+
label.horizontalOrigin = HorizontalOrigin.LEFT;
|
|
835
|
+
label.font = "16px sans-serif";
|
|
836
|
+
label.style = LabelStyle.FILL_AND_OUTLINE;
|
|
837
|
+
return label;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
function getIconHref(
|
|
841
|
+
iconNode,
|
|
842
|
+
dataSource,
|
|
843
|
+
sourceResource,
|
|
844
|
+
uriResolver,
|
|
845
|
+
canRefresh
|
|
846
|
+
) {
|
|
847
|
+
let href = queryStringValue(iconNode, "href", namespaces.kml);
|
|
848
|
+
if (!defined(href) || href.length === 0) {
|
|
849
|
+
return undefined;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
if (href.indexOf("root://icons/palette-") === 0) {
|
|
853
|
+
const palette = href.charAt(21);
|
|
854
|
+
|
|
855
|
+
// Get the icon number
|
|
856
|
+
let x = defaultValue(queryNumericValue(iconNode, "x", namespaces.gx), 0);
|
|
857
|
+
let y = defaultValue(queryNumericValue(iconNode, "y", namespaces.gx), 0);
|
|
858
|
+
x = Math.min(x / 32, 7);
|
|
859
|
+
y = 7 - Math.min(y / 32, 7);
|
|
860
|
+
const iconNum = 8 * y + x;
|
|
861
|
+
|
|
862
|
+
href = `https://maps.google.com/mapfiles/kml/pal${palette}/icon${iconNum}.png`;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
const hrefResource = resolveHref(href, sourceResource, uriResolver);
|
|
866
|
+
|
|
867
|
+
if (canRefresh) {
|
|
868
|
+
const refreshMode = queryStringValue(
|
|
869
|
+
iconNode,
|
|
870
|
+
"refreshMode",
|
|
871
|
+
namespaces.kml
|
|
872
|
+
);
|
|
873
|
+
const viewRefreshMode = queryStringValue(
|
|
874
|
+
iconNode,
|
|
875
|
+
"viewRefreshMode",
|
|
876
|
+
namespaces.kml
|
|
877
|
+
);
|
|
878
|
+
if (refreshMode === "onInterval" || refreshMode === "onExpire") {
|
|
879
|
+
oneTimeWarning(
|
|
880
|
+
`kml-refreshMode-${refreshMode}`,
|
|
881
|
+
`KML - Unsupported Icon refreshMode: ${refreshMode}`
|
|
882
|
+
);
|
|
883
|
+
} else if (viewRefreshMode === "onStop" || viewRefreshMode === "onRegion") {
|
|
884
|
+
oneTimeWarning(
|
|
885
|
+
`kml-refreshMode-${viewRefreshMode}`,
|
|
886
|
+
`KML - Unsupported Icon viewRefreshMode: ${viewRefreshMode}`
|
|
887
|
+
);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
const viewBoundScale = defaultValue(
|
|
891
|
+
queryStringValue(iconNode, "viewBoundScale", namespaces.kml),
|
|
892
|
+
1.0
|
|
893
|
+
);
|
|
894
|
+
const defaultViewFormat =
|
|
895
|
+
viewRefreshMode === "onStop"
|
|
896
|
+
? "BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]"
|
|
897
|
+
: "";
|
|
898
|
+
const viewFormat = defaultValue(
|
|
899
|
+
queryStringValue(iconNode, "viewFormat", namespaces.kml),
|
|
900
|
+
defaultViewFormat
|
|
901
|
+
);
|
|
902
|
+
const httpQuery = queryStringValue(iconNode, "httpQuery", namespaces.kml);
|
|
903
|
+
if (defined(viewFormat)) {
|
|
904
|
+
hrefResource.setQueryParameters(queryToObject(cleanupString(viewFormat)));
|
|
905
|
+
}
|
|
906
|
+
if (defined(httpQuery)) {
|
|
907
|
+
hrefResource.setQueryParameters(queryToObject(cleanupString(httpQuery)));
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
const ellipsoid = dataSource._ellipsoid;
|
|
911
|
+
processNetworkLinkQueryString(
|
|
912
|
+
hrefResource,
|
|
913
|
+
dataSource.camera,
|
|
914
|
+
dataSource.canvas,
|
|
915
|
+
viewBoundScale,
|
|
916
|
+
dataSource._lastCameraView.bbox,
|
|
917
|
+
ellipsoid
|
|
918
|
+
);
|
|
919
|
+
|
|
920
|
+
return hrefResource;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
return hrefResource;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
function processBillboardIcon(
|
|
927
|
+
dataSource,
|
|
928
|
+
node,
|
|
929
|
+
targetEntity,
|
|
930
|
+
sourceResource,
|
|
931
|
+
uriResolver
|
|
932
|
+
) {
|
|
933
|
+
let scale = queryNumericValue(node, "scale", namespaces.kml);
|
|
934
|
+
const heading = queryNumericValue(node, "heading", namespaces.kml);
|
|
935
|
+
const color = queryColorValue(node, "color", namespaces.kml);
|
|
936
|
+
|
|
937
|
+
const iconNode = queryFirstNode(node, "Icon", namespaces.kml);
|
|
938
|
+
let icon = getIconHref(
|
|
939
|
+
iconNode,
|
|
940
|
+
dataSource,
|
|
941
|
+
sourceResource,
|
|
942
|
+
uriResolver,
|
|
943
|
+
false
|
|
944
|
+
);
|
|
945
|
+
|
|
946
|
+
// If icon tags are present but blank, we do not want to show an icon
|
|
947
|
+
if (defined(iconNode) && !defined(icon)) {
|
|
948
|
+
icon = false;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
const x = queryNumericValue(iconNode, "x", namespaces.gx);
|
|
952
|
+
const y = queryNumericValue(iconNode, "y", namespaces.gx);
|
|
953
|
+
const w = queryNumericValue(iconNode, "w", namespaces.gx);
|
|
954
|
+
const h = queryNumericValue(iconNode, "h", namespaces.gx);
|
|
955
|
+
|
|
956
|
+
const hotSpotNode = queryFirstNode(node, "hotSpot", namespaces.kml);
|
|
957
|
+
const hotSpotX = queryNumericAttribute(hotSpotNode, "x");
|
|
958
|
+
const hotSpotY = queryNumericAttribute(hotSpotNode, "y");
|
|
959
|
+
const hotSpotXUnit = queryStringAttribute(hotSpotNode, "xunits");
|
|
960
|
+
const hotSpotYUnit = queryStringAttribute(hotSpotNode, "yunits");
|
|
961
|
+
|
|
962
|
+
let billboard = targetEntity.billboard;
|
|
963
|
+
if (!defined(billboard)) {
|
|
964
|
+
billboard = createDefaultBillboard();
|
|
965
|
+
targetEntity.billboard = billboard;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
billboard.image = icon;
|
|
969
|
+
billboard.scale = scale;
|
|
970
|
+
billboard.color = color;
|
|
971
|
+
|
|
972
|
+
if (defined(x) || defined(y) || defined(w) || defined(h)) {
|
|
973
|
+
billboard.imageSubRegion = new BoundingRectangle(x, y, w, h);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
//GE treats a heading of zero as no heading
|
|
977
|
+
//You can still point north using a 360 degree angle (or any multiple of 360)
|
|
978
|
+
if (defined(heading) && heading !== 0) {
|
|
979
|
+
billboard.rotation = CesiumMath.toRadians(-heading);
|
|
980
|
+
billboard.alignedAxis = Cartesian3.UNIT_Z;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
//Hotpot is the KML equivalent of pixel offset
|
|
984
|
+
//The hotspot origin is the lower left, but we leave
|
|
985
|
+
//our billboard origin at the center and simply
|
|
986
|
+
//modify the pixel offset to take this into account
|
|
987
|
+
scale = defaultValue(scale, 1.0);
|
|
988
|
+
|
|
989
|
+
let xOffset;
|
|
990
|
+
let yOffset;
|
|
991
|
+
if (defined(hotSpotX)) {
|
|
992
|
+
if (hotSpotXUnit === "pixels") {
|
|
993
|
+
xOffset = -hotSpotX * scale;
|
|
994
|
+
} else if (hotSpotXUnit === "insetPixels") {
|
|
995
|
+
xOffset = (hotSpotX - BILLBOARD_SIZE) * scale;
|
|
996
|
+
} else if (hotSpotXUnit === "fraction") {
|
|
997
|
+
xOffset = -hotSpotX * BILLBOARD_SIZE * scale;
|
|
998
|
+
}
|
|
999
|
+
xOffset += BILLBOARD_SIZE * 0.5 * scale;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
if (defined(hotSpotY)) {
|
|
1003
|
+
if (hotSpotYUnit === "pixels") {
|
|
1004
|
+
yOffset = hotSpotY * scale;
|
|
1005
|
+
} else if (hotSpotYUnit === "insetPixels") {
|
|
1006
|
+
yOffset = (-hotSpotY + BILLBOARD_SIZE) * scale;
|
|
1007
|
+
} else if (hotSpotYUnit === "fraction") {
|
|
1008
|
+
yOffset = hotSpotY * BILLBOARD_SIZE * scale;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
yOffset -= BILLBOARD_SIZE * 0.5 * scale;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
if (defined(xOffset) || defined(yOffset)) {
|
|
1015
|
+
billboard.pixelOffset = new Cartesian2(xOffset, yOffset);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
function applyStyle(
|
|
1020
|
+
dataSource,
|
|
1021
|
+
styleNode,
|
|
1022
|
+
targetEntity,
|
|
1023
|
+
sourceResource,
|
|
1024
|
+
uriResolver
|
|
1025
|
+
) {
|
|
1026
|
+
for (let i = 0, len = styleNode.childNodes.length; i < len; i++) {
|
|
1027
|
+
const node = styleNode.childNodes.item(i);
|
|
1028
|
+
if (node.localName === "IconStyle") {
|
|
1029
|
+
processBillboardIcon(
|
|
1030
|
+
dataSource,
|
|
1031
|
+
node,
|
|
1032
|
+
targetEntity,
|
|
1033
|
+
sourceResource,
|
|
1034
|
+
uriResolver
|
|
1035
|
+
);
|
|
1036
|
+
} else if (node.localName === "LabelStyle") {
|
|
1037
|
+
let label = targetEntity.label;
|
|
1038
|
+
if (!defined(label)) {
|
|
1039
|
+
label = createDefaultLabel();
|
|
1040
|
+
targetEntity.label = label;
|
|
1041
|
+
}
|
|
1042
|
+
label.scale = defaultValue(
|
|
1043
|
+
queryNumericValue(node, "scale", namespaces.kml),
|
|
1044
|
+
label.scale
|
|
1045
|
+
);
|
|
1046
|
+
label.fillColor = defaultValue(
|
|
1047
|
+
queryColorValue(node, "color", namespaces.kml),
|
|
1048
|
+
label.fillColor
|
|
1049
|
+
);
|
|
1050
|
+
label.text = targetEntity.name;
|
|
1051
|
+
} else if (node.localName === "LineStyle") {
|
|
1052
|
+
let polyline = targetEntity.polyline;
|
|
1053
|
+
if (!defined(polyline)) {
|
|
1054
|
+
polyline = new PolylineGraphics();
|
|
1055
|
+
targetEntity.polyline = polyline;
|
|
1056
|
+
}
|
|
1057
|
+
polyline.width = queryNumericValue(node, "width", namespaces.kml);
|
|
1058
|
+
polyline.material = queryColorValue(node, "color", namespaces.kml);
|
|
1059
|
+
if (defined(queryColorValue(node, "outerColor", namespaces.gx))) {
|
|
1060
|
+
oneTimeWarning(
|
|
1061
|
+
"kml-gx:outerColor",
|
|
1062
|
+
"KML - gx:outerColor is not supported in a LineStyle"
|
|
1063
|
+
);
|
|
1064
|
+
}
|
|
1065
|
+
if (defined(queryNumericValue(node, "outerWidth", namespaces.gx))) {
|
|
1066
|
+
oneTimeWarning(
|
|
1067
|
+
"kml-gx:outerWidth",
|
|
1068
|
+
"KML - gx:outerWidth is not supported in a LineStyle"
|
|
1069
|
+
);
|
|
1070
|
+
}
|
|
1071
|
+
if (defined(queryNumericValue(node, "physicalWidth", namespaces.gx))) {
|
|
1072
|
+
oneTimeWarning(
|
|
1073
|
+
"kml-gx:physicalWidth",
|
|
1074
|
+
"KML - gx:physicalWidth is not supported in a LineStyle"
|
|
1075
|
+
);
|
|
1076
|
+
}
|
|
1077
|
+
if (defined(queryBooleanValue(node, "labelVisibility", namespaces.gx))) {
|
|
1078
|
+
oneTimeWarning(
|
|
1079
|
+
"kml-gx:labelVisibility",
|
|
1080
|
+
"KML - gx:labelVisibility is not supported in a LineStyle"
|
|
1081
|
+
);
|
|
1082
|
+
}
|
|
1083
|
+
} else if (node.localName === "PolyStyle") {
|
|
1084
|
+
let polygon = targetEntity.polygon;
|
|
1085
|
+
if (!defined(polygon)) {
|
|
1086
|
+
polygon = createDefaultPolygon();
|
|
1087
|
+
targetEntity.polygon = polygon;
|
|
1088
|
+
}
|
|
1089
|
+
polygon.material = defaultValue(
|
|
1090
|
+
queryColorValue(node, "color", namespaces.kml),
|
|
1091
|
+
polygon.material
|
|
1092
|
+
);
|
|
1093
|
+
polygon.fill = defaultValue(
|
|
1094
|
+
queryBooleanValue(node, "fill", namespaces.kml),
|
|
1095
|
+
polygon.fill
|
|
1096
|
+
);
|
|
1097
|
+
polygon.outline = defaultValue(
|
|
1098
|
+
queryBooleanValue(node, "outline", namespaces.kml),
|
|
1099
|
+
polygon.outline
|
|
1100
|
+
);
|
|
1101
|
+
} else if (node.localName === "BalloonStyle") {
|
|
1102
|
+
const bgColor = defaultValue(
|
|
1103
|
+
parseColorString(queryStringValue(node, "bgColor", namespaces.kml)),
|
|
1104
|
+
Color.WHITE
|
|
1105
|
+
);
|
|
1106
|
+
const textColor = defaultValue(
|
|
1107
|
+
parseColorString(queryStringValue(node, "textColor", namespaces.kml)),
|
|
1108
|
+
Color.BLACK
|
|
1109
|
+
);
|
|
1110
|
+
const text = queryStringValue(node, "text", namespaces.kml);
|
|
1111
|
+
|
|
1112
|
+
//This is purely an internal property used in style processing,
|
|
1113
|
+
//it never ends up on the final entity.
|
|
1114
|
+
targetEntity.addProperty("balloonStyle");
|
|
1115
|
+
targetEntity.balloonStyle = {
|
|
1116
|
+
bgColor: bgColor,
|
|
1117
|
+
textColor: textColor,
|
|
1118
|
+
text: text,
|
|
1119
|
+
};
|
|
1120
|
+
} else if (node.localName === "ListStyle") {
|
|
1121
|
+
const listItemType = queryStringValue(
|
|
1122
|
+
node,
|
|
1123
|
+
"listItemType",
|
|
1124
|
+
namespaces.kml
|
|
1125
|
+
);
|
|
1126
|
+
if (listItemType === "radioFolder" || listItemType === "checkOffOnly") {
|
|
1127
|
+
oneTimeWarning(
|
|
1128
|
+
`kml-listStyle-${listItemType}`,
|
|
1129
|
+
`KML - Unsupported ListStyle with listItemType: ${listItemType}`
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
//Processes and merges any inline styles for the provided node into the provided entity.
|
|
1137
|
+
function computeFinalStyle(
|
|
1138
|
+
dataSource,
|
|
1139
|
+
placeMark,
|
|
1140
|
+
styleCollection,
|
|
1141
|
+
sourceResource,
|
|
1142
|
+
uriResolver
|
|
1143
|
+
) {
|
|
1144
|
+
const result = new Entity();
|
|
1145
|
+
let styleEntity;
|
|
1146
|
+
|
|
1147
|
+
//Google earth seems to always use the last inline Style/StyleMap only
|
|
1148
|
+
let styleIndex = -1;
|
|
1149
|
+
const childNodes = placeMark.childNodes;
|
|
1150
|
+
const length = childNodes.length;
|
|
1151
|
+
for (let q = 0; q < length; q++) {
|
|
1152
|
+
const child = childNodes[q];
|
|
1153
|
+
if (child.localName === "Style" || child.localName === "StyleMap") {
|
|
1154
|
+
styleIndex = q;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
if (styleIndex !== -1) {
|
|
1159
|
+
const inlineStyleNode = childNodes[styleIndex];
|
|
1160
|
+
if (inlineStyleNode.localName === "Style") {
|
|
1161
|
+
applyStyle(
|
|
1162
|
+
dataSource,
|
|
1163
|
+
inlineStyleNode,
|
|
1164
|
+
result,
|
|
1165
|
+
sourceResource,
|
|
1166
|
+
uriResolver
|
|
1167
|
+
);
|
|
1168
|
+
} else {
|
|
1169
|
+
// StyleMap
|
|
1170
|
+
const pairs = queryChildNodes(inlineStyleNode, "Pair", namespaces.kml);
|
|
1171
|
+
for (let p = 0; p < pairs.length; p++) {
|
|
1172
|
+
const pair = pairs[p];
|
|
1173
|
+
const key = queryStringValue(pair, "key", namespaces.kml);
|
|
1174
|
+
if (key === "normal") {
|
|
1175
|
+
const styleUrl = queryStringValue(pair, "styleUrl", namespaces.kml);
|
|
1176
|
+
if (defined(styleUrl)) {
|
|
1177
|
+
styleEntity = styleCollection.getById(styleUrl);
|
|
1178
|
+
if (!defined(styleEntity)) {
|
|
1179
|
+
styleEntity = styleCollection.getById(`#${styleUrl}`);
|
|
1180
|
+
}
|
|
1181
|
+
if (defined(styleEntity)) {
|
|
1182
|
+
result.merge(styleEntity);
|
|
1183
|
+
}
|
|
1184
|
+
} else {
|
|
1185
|
+
const node = queryFirstNode(pair, "Style", namespaces.kml);
|
|
1186
|
+
applyStyle(dataSource, node, result, sourceResource, uriResolver);
|
|
1187
|
+
}
|
|
1188
|
+
} else {
|
|
1189
|
+
oneTimeWarning(
|
|
1190
|
+
`kml-styleMap-${key}`,
|
|
1191
|
+
`KML - Unsupported StyleMap key: ${key}`
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
//Google earth seems to always use the first external style only.
|
|
1199
|
+
const externalStyle = queryStringValue(placeMark, "styleUrl", namespaces.kml);
|
|
1200
|
+
if (defined(externalStyle)) {
|
|
1201
|
+
let id = externalStyle;
|
|
1202
|
+
if (externalStyle[0] !== "#" && externalStyle.indexOf("#") !== -1) {
|
|
1203
|
+
const tokens = externalStyle.split("#");
|
|
1204
|
+
const uri = tokens[0];
|
|
1205
|
+
const resource = sourceResource.getDerivedResource({
|
|
1206
|
+
url: uri,
|
|
1207
|
+
});
|
|
1208
|
+
|
|
1209
|
+
id = `${resource.getUrlComponent()}#${tokens[1]}`;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
styleEntity = styleCollection.getById(id);
|
|
1213
|
+
if (!defined(styleEntity)) {
|
|
1214
|
+
styleEntity = styleCollection.getById(`#${id}`);
|
|
1215
|
+
}
|
|
1216
|
+
if (defined(styleEntity)) {
|
|
1217
|
+
result.merge(styleEntity);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
return result;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
//Asynchronously processes an external style file.
|
|
1225
|
+
function processExternalStyles(dataSource, resource, styleCollection) {
|
|
1226
|
+
return resource.fetchXML().then(function (styleKml) {
|
|
1227
|
+
return processStyles(dataSource, styleKml, styleCollection, resource, true);
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
//Processes all shared and external styles and stores
|
|
1232
|
+
//their id into the provided styleCollection.
|
|
1233
|
+
//Returns an array of promises that will resolve when
|
|
1234
|
+
//each style is loaded.
|
|
1235
|
+
function processStyles(
|
|
1236
|
+
dataSource,
|
|
1237
|
+
kml,
|
|
1238
|
+
styleCollection,
|
|
1239
|
+
sourceResource,
|
|
1240
|
+
isExternal,
|
|
1241
|
+
uriResolver
|
|
1242
|
+
) {
|
|
1243
|
+
let i;
|
|
1244
|
+
let id;
|
|
1245
|
+
let styleEntity;
|
|
1246
|
+
|
|
1247
|
+
let node;
|
|
1248
|
+
const styleNodes = queryNodes(kml, "Style", namespaces.kml);
|
|
1249
|
+
if (defined(styleNodes)) {
|
|
1250
|
+
const styleNodesLength = styleNodes.length;
|
|
1251
|
+
for (i = 0; i < styleNodesLength; i++) {
|
|
1252
|
+
node = styleNodes[i];
|
|
1253
|
+
id = queryStringAttribute(node, "id");
|
|
1254
|
+
if (defined(id)) {
|
|
1255
|
+
id = `#${id}`;
|
|
1256
|
+
if (isExternal && defined(sourceResource)) {
|
|
1257
|
+
id = sourceResource.getUrlComponent() + id;
|
|
1258
|
+
}
|
|
1259
|
+
if (!defined(styleCollection.getById(id))) {
|
|
1260
|
+
styleEntity = new Entity({
|
|
1261
|
+
id: id,
|
|
1262
|
+
});
|
|
1263
|
+
styleCollection.add(styleEntity);
|
|
1264
|
+
applyStyle(
|
|
1265
|
+
dataSource,
|
|
1266
|
+
node,
|
|
1267
|
+
styleEntity,
|
|
1268
|
+
sourceResource,
|
|
1269
|
+
uriResolver
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
const styleMaps = queryNodes(kml, "StyleMap", namespaces.kml);
|
|
1277
|
+
if (defined(styleMaps)) {
|
|
1278
|
+
const styleMapsLength = styleMaps.length;
|
|
1279
|
+
for (i = 0; i < styleMapsLength; i++) {
|
|
1280
|
+
const styleMap = styleMaps[i];
|
|
1281
|
+
id = queryStringAttribute(styleMap, "id");
|
|
1282
|
+
if (defined(id)) {
|
|
1283
|
+
const pairs = queryChildNodes(styleMap, "Pair", namespaces.kml);
|
|
1284
|
+
for (let p = 0; p < pairs.length; p++) {
|
|
1285
|
+
const pair = pairs[p];
|
|
1286
|
+
const key = queryStringValue(pair, "key", namespaces.kml);
|
|
1287
|
+
if (key === "normal") {
|
|
1288
|
+
id = `#${id}`;
|
|
1289
|
+
if (isExternal && defined(sourceResource)) {
|
|
1290
|
+
id = sourceResource.getUrlComponent() + id;
|
|
1291
|
+
}
|
|
1292
|
+
if (!defined(styleCollection.getById(id))) {
|
|
1293
|
+
styleEntity = styleCollection.getOrCreateEntity(id);
|
|
1294
|
+
|
|
1295
|
+
let styleUrl = queryStringValue(pair, "styleUrl", namespaces.kml);
|
|
1296
|
+
if (defined(styleUrl)) {
|
|
1297
|
+
if (styleUrl[0] !== "#") {
|
|
1298
|
+
styleUrl = `#${styleUrl}`;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
if (isExternal && defined(sourceResource)) {
|
|
1302
|
+
styleUrl = sourceResource.getUrlComponent() + styleUrl;
|
|
1303
|
+
}
|
|
1304
|
+
const base = styleCollection.getById(styleUrl);
|
|
1305
|
+
|
|
1306
|
+
if (defined(base)) {
|
|
1307
|
+
styleEntity.merge(base);
|
|
1308
|
+
}
|
|
1309
|
+
} else {
|
|
1310
|
+
node = queryFirstNode(pair, "Style", namespaces.kml);
|
|
1311
|
+
applyStyle(
|
|
1312
|
+
dataSource,
|
|
1313
|
+
node,
|
|
1314
|
+
styleEntity,
|
|
1315
|
+
sourceResource,
|
|
1316
|
+
uriResolver
|
|
1317
|
+
);
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
} else {
|
|
1321
|
+
oneTimeWarning(
|
|
1322
|
+
`kml-styleMap-${key}`,
|
|
1323
|
+
`KML - Unsupported StyleMap key: ${key}`
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
const promises = [];
|
|
1332
|
+
const styleUrlNodes = kml.getElementsByTagName("styleUrl");
|
|
1333
|
+
const styleUrlNodesLength = styleUrlNodes.length;
|
|
1334
|
+
for (i = 0; i < styleUrlNodesLength; i++) {
|
|
1335
|
+
const styleReference = styleUrlNodes[i].textContent;
|
|
1336
|
+
if (styleReference[0] !== "#") {
|
|
1337
|
+
//According to the spec, all local styles should start with a #
|
|
1338
|
+
//and everything else is an external style that has a # seperating
|
|
1339
|
+
//the URL of the document and the style. However, Google Earth
|
|
1340
|
+
//also accepts styleUrls without a # as meaning a local style.
|
|
1341
|
+
const tokens = styleReference.split("#");
|
|
1342
|
+
if (tokens.length === 2) {
|
|
1343
|
+
const uri = tokens[0];
|
|
1344
|
+
const resource = sourceResource.getDerivedResource({
|
|
1345
|
+
url: uri,
|
|
1346
|
+
});
|
|
1347
|
+
|
|
1348
|
+
promises.push(
|
|
1349
|
+
processExternalStyles(dataSource, resource, styleCollection)
|
|
1350
|
+
);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
return promises;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
function createDropLine(entityCollection, entity, styleEntity) {
|
|
1359
|
+
const entityPosition = new ReferenceProperty(entityCollection, entity.id, [
|
|
1360
|
+
"position",
|
|
1361
|
+
]);
|
|
1362
|
+
const surfacePosition = new ScaledPositionProperty(entity.position);
|
|
1363
|
+
entity.polyline = defined(styleEntity.polyline)
|
|
1364
|
+
? styleEntity.polyline.clone()
|
|
1365
|
+
: new PolylineGraphics();
|
|
1366
|
+
entity.polyline.positions = new PositionPropertyArray([
|
|
1367
|
+
entityPosition,
|
|
1368
|
+
surfacePosition,
|
|
1369
|
+
]);
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
function heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) {
|
|
1373
|
+
if (
|
|
1374
|
+
(!defined(altitudeMode) && !defined(gxAltitudeMode)) ||
|
|
1375
|
+
altitudeMode === "clampToGround"
|
|
1376
|
+
) {
|
|
1377
|
+
return HeightReference.CLAMP_TO_GROUND;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
if (altitudeMode === "relativeToGround") {
|
|
1381
|
+
return HeightReference.RELATIVE_TO_GROUND;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
if (altitudeMode === "absolute") {
|
|
1385
|
+
return HeightReference.NONE;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
if (gxAltitudeMode === "clampToSeaFloor") {
|
|
1389
|
+
oneTimeWarning(
|
|
1390
|
+
"kml-gx:altitudeMode-clampToSeaFloor",
|
|
1391
|
+
"KML - <gx:altitudeMode>:clampToSeaFloor is currently not supported, using <kml:altitudeMode>:clampToGround."
|
|
1392
|
+
);
|
|
1393
|
+
return HeightReference.CLAMP_TO_GROUND;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
if (gxAltitudeMode === "relativeToSeaFloor") {
|
|
1397
|
+
oneTimeWarning(
|
|
1398
|
+
"kml-gx:altitudeMode-relativeToSeaFloor",
|
|
1399
|
+
"KML - <gx:altitudeMode>:relativeToSeaFloor is currently not supported, using <kml:altitudeMode>:relativeToGround."
|
|
1400
|
+
);
|
|
1401
|
+
return HeightReference.RELATIVE_TO_GROUND;
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
if (defined(altitudeMode)) {
|
|
1405
|
+
oneTimeWarning(
|
|
1406
|
+
"kml-altitudeMode-unknown",
|
|
1407
|
+
`KML - Unknown <kml:altitudeMode>:${altitudeMode}, using <kml:altitudeMode>:CLAMP_TO_GROUND.`
|
|
1408
|
+
);
|
|
1409
|
+
} else {
|
|
1410
|
+
oneTimeWarning(
|
|
1411
|
+
"kml-gx:altitudeMode-unknown",
|
|
1412
|
+
`KML - Unknown <gx:altitudeMode>:${gxAltitudeMode}, using <kml:altitudeMode>:CLAMP_TO_GROUND.`
|
|
1413
|
+
);
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
// Clamp to ground is the default
|
|
1417
|
+
return HeightReference.CLAMP_TO_GROUND;
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
function createPositionPropertyFromAltitudeMode(
|
|
1421
|
+
property,
|
|
1422
|
+
altitudeMode,
|
|
1423
|
+
gxAltitudeMode
|
|
1424
|
+
) {
|
|
1425
|
+
if (
|
|
1426
|
+
gxAltitudeMode === "relativeToSeaFloor" ||
|
|
1427
|
+
altitudeMode === "absolute" ||
|
|
1428
|
+
altitudeMode === "relativeToGround"
|
|
1429
|
+
) {
|
|
1430
|
+
//Just return the ellipsoid referenced property until we support MSL
|
|
1431
|
+
return property;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
if (
|
|
1435
|
+
(defined(altitudeMode) && altitudeMode !== "clampToGround") || //
|
|
1436
|
+
(defined(gxAltitudeMode) && gxAltitudeMode !== "clampToSeaFloor")
|
|
1437
|
+
) {
|
|
1438
|
+
oneTimeWarning(
|
|
1439
|
+
"kml-altitudeMode-unknown",
|
|
1440
|
+
`KML - Unknown altitudeMode: ${defaultValue(
|
|
1441
|
+
altitudeMode,
|
|
1442
|
+
gxAltitudeMode
|
|
1443
|
+
)}`
|
|
1444
|
+
);
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
// Clamp to ground is the default
|
|
1448
|
+
return new ScaledPositionProperty(property);
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
function createPositionPropertyArrayFromAltitudeMode(
|
|
1452
|
+
properties,
|
|
1453
|
+
altitudeMode,
|
|
1454
|
+
gxAltitudeMode,
|
|
1455
|
+
ellipsoid
|
|
1456
|
+
) {
|
|
1457
|
+
if (!defined(properties)) {
|
|
1458
|
+
return undefined;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
if (
|
|
1462
|
+
gxAltitudeMode === "relativeToSeaFloor" ||
|
|
1463
|
+
altitudeMode === "absolute" ||
|
|
1464
|
+
altitudeMode === "relativeToGround"
|
|
1465
|
+
) {
|
|
1466
|
+
//Just return the ellipsoid referenced property until we support MSL
|
|
1467
|
+
return properties;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
if (
|
|
1471
|
+
(defined(altitudeMode) && altitudeMode !== "clampToGround") || //
|
|
1472
|
+
(defined(gxAltitudeMode) && gxAltitudeMode !== "clampToSeaFloor")
|
|
1473
|
+
) {
|
|
1474
|
+
oneTimeWarning(
|
|
1475
|
+
"kml-altitudeMode-unknown",
|
|
1476
|
+
`KML - Unknown altitudeMode: ${defaultValue(
|
|
1477
|
+
altitudeMode,
|
|
1478
|
+
gxAltitudeMode
|
|
1479
|
+
)}`
|
|
1480
|
+
);
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
// Clamp to ground is the default
|
|
1484
|
+
const propertiesLength = properties.length;
|
|
1485
|
+
for (let i = 0; i < propertiesLength; i++) {
|
|
1486
|
+
const property = properties[i];
|
|
1487
|
+
ellipsoid.scaleToGeodeticSurface(property, property);
|
|
1488
|
+
}
|
|
1489
|
+
return properties;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
function processPositionGraphics(
|
|
1493
|
+
dataSource,
|
|
1494
|
+
entity,
|
|
1495
|
+
styleEntity,
|
|
1496
|
+
heightReference
|
|
1497
|
+
) {
|
|
1498
|
+
let label = entity.label;
|
|
1499
|
+
if (!defined(label)) {
|
|
1500
|
+
label = defined(styleEntity.label)
|
|
1501
|
+
? styleEntity.label.clone()
|
|
1502
|
+
: createDefaultLabel();
|
|
1503
|
+
entity.label = label;
|
|
1504
|
+
}
|
|
1505
|
+
label.text = entity.name;
|
|
1506
|
+
|
|
1507
|
+
let billboard = entity.billboard;
|
|
1508
|
+
if (!defined(billboard)) {
|
|
1509
|
+
billboard = defined(styleEntity.billboard)
|
|
1510
|
+
? styleEntity.billboard.clone()
|
|
1511
|
+
: createDefaultBillboard();
|
|
1512
|
+
entity.billboard = billboard;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
if (!defined(billboard.image)) {
|
|
1516
|
+
billboard.image = dataSource._pinBuilder.fromColor(Color.YELLOW, 64);
|
|
1517
|
+
|
|
1518
|
+
// If there were empty <Icon> tags in the KML, then billboard.image was set to false above
|
|
1519
|
+
// However, in this case, the false value would have been converted to a property afterwards
|
|
1520
|
+
// Thus, we check if billboard.image is defined with value of false
|
|
1521
|
+
} else if (!billboard.image.getValue()) {
|
|
1522
|
+
billboard.image = undefined;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
let scale = 1.0;
|
|
1526
|
+
if (defined(billboard.scale)) {
|
|
1527
|
+
scale = billboard.scale.getValue();
|
|
1528
|
+
if (scale !== 0) {
|
|
1529
|
+
label.pixelOffset = new Cartesian2(scale * 16 + 1, 0);
|
|
1530
|
+
} else {
|
|
1531
|
+
//Minor tweaks to better match Google Earth.
|
|
1532
|
+
label.pixelOffset = undefined;
|
|
1533
|
+
label.horizontalOrigin = undefined;
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
if (defined(heightReference) && dataSource._clampToGround) {
|
|
1538
|
+
billboard.heightReference = heightReference;
|
|
1539
|
+
label.heightReference = heightReference;
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
function processPathGraphics(entity, styleEntity) {
|
|
1544
|
+
let path = entity.path;
|
|
1545
|
+
if (!defined(path)) {
|
|
1546
|
+
path = new PathGraphics();
|
|
1547
|
+
path.leadTime = 0;
|
|
1548
|
+
entity.path = path;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
const polyline = styleEntity.polyline;
|
|
1552
|
+
if (defined(polyline)) {
|
|
1553
|
+
path.material = polyline.material;
|
|
1554
|
+
path.width = polyline.width;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
function processPoint(
|
|
1559
|
+
dataSource,
|
|
1560
|
+
entityCollection,
|
|
1561
|
+
geometryNode,
|
|
1562
|
+
entity,
|
|
1563
|
+
styleEntity
|
|
1564
|
+
) {
|
|
1565
|
+
const coordinatesString = queryStringValue(
|
|
1566
|
+
geometryNode,
|
|
1567
|
+
"coordinates",
|
|
1568
|
+
namespaces.kml
|
|
1569
|
+
);
|
|
1570
|
+
const altitudeMode = queryStringValue(
|
|
1571
|
+
geometryNode,
|
|
1572
|
+
"altitudeMode",
|
|
1573
|
+
namespaces.kml
|
|
1574
|
+
);
|
|
1575
|
+
const gxAltitudeMode = queryStringValue(
|
|
1576
|
+
geometryNode,
|
|
1577
|
+
"altitudeMode",
|
|
1578
|
+
namespaces.gx
|
|
1579
|
+
);
|
|
1580
|
+
const extrude = queryBooleanValue(geometryNode, "extrude", namespaces.kml);
|
|
1581
|
+
const ellipsoid = dataSource._ellipsoid;
|
|
1582
|
+
const position = readCoordinate(coordinatesString, ellipsoid);
|
|
1583
|
+
|
|
1584
|
+
entity.position = position;
|
|
1585
|
+
processPositionGraphics(
|
|
1586
|
+
dataSource,
|
|
1587
|
+
entity,
|
|
1588
|
+
styleEntity,
|
|
1589
|
+
heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode)
|
|
1590
|
+
);
|
|
1591
|
+
|
|
1592
|
+
if (extrude && isExtrudable(altitudeMode, gxAltitudeMode)) {
|
|
1593
|
+
createDropLine(entityCollection, entity, styleEntity);
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
return true;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
function processLineStringOrLinearRing(
|
|
1600
|
+
dataSource,
|
|
1601
|
+
entityCollection,
|
|
1602
|
+
geometryNode,
|
|
1603
|
+
entity,
|
|
1604
|
+
styleEntity
|
|
1605
|
+
) {
|
|
1606
|
+
const coordinatesNode = queryFirstNode(
|
|
1607
|
+
geometryNode,
|
|
1608
|
+
"coordinates",
|
|
1609
|
+
namespaces.kml
|
|
1610
|
+
);
|
|
1611
|
+
const altitudeMode = queryStringValue(
|
|
1612
|
+
geometryNode,
|
|
1613
|
+
"altitudeMode",
|
|
1614
|
+
namespaces.kml
|
|
1615
|
+
);
|
|
1616
|
+
const gxAltitudeMode = queryStringValue(
|
|
1617
|
+
geometryNode,
|
|
1618
|
+
"altitudeMode",
|
|
1619
|
+
namespaces.gx
|
|
1620
|
+
);
|
|
1621
|
+
const extrude = queryBooleanValue(geometryNode, "extrude", namespaces.kml);
|
|
1622
|
+
const tessellate = queryBooleanValue(
|
|
1623
|
+
geometryNode,
|
|
1624
|
+
"tessellate",
|
|
1625
|
+
namespaces.kml
|
|
1626
|
+
);
|
|
1627
|
+
const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode);
|
|
1628
|
+
const zIndex = queryNumericValue(geometryNode, "drawOrder", namespaces.gx);
|
|
1629
|
+
|
|
1630
|
+
const ellipsoid = dataSource._ellipsoid;
|
|
1631
|
+
const coordinates = readCoordinates(coordinatesNode, ellipsoid);
|
|
1632
|
+
let polyline = styleEntity.polyline;
|
|
1633
|
+
if (canExtrude && extrude) {
|
|
1634
|
+
const wall = new WallGraphics();
|
|
1635
|
+
entity.wall = wall;
|
|
1636
|
+
wall.positions = coordinates;
|
|
1637
|
+
const polygon = styleEntity.polygon;
|
|
1638
|
+
|
|
1639
|
+
if (defined(polygon)) {
|
|
1640
|
+
wall.fill = polygon.fill;
|
|
1641
|
+
wall.material = polygon.material;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
//Always outline walls so they show up in 2D.
|
|
1645
|
+
wall.outline = true;
|
|
1646
|
+
if (defined(polyline)) {
|
|
1647
|
+
wall.outlineColor = defined(polyline.material)
|
|
1648
|
+
? polyline.material.color
|
|
1649
|
+
: Color.WHITE;
|
|
1650
|
+
wall.outlineWidth = polyline.width;
|
|
1651
|
+
} else if (defined(polygon)) {
|
|
1652
|
+
wall.outlineColor = defined(polygon.material)
|
|
1653
|
+
? polygon.material.color
|
|
1654
|
+
: Color.WHITE;
|
|
1655
|
+
}
|
|
1656
|
+
} else if (dataSource._clampToGround && !canExtrude && tessellate) {
|
|
1657
|
+
const polylineGraphics = new PolylineGraphics();
|
|
1658
|
+
polylineGraphics.clampToGround = true;
|
|
1659
|
+
entity.polyline = polylineGraphics;
|
|
1660
|
+
polylineGraphics.positions = coordinates;
|
|
1661
|
+
if (defined(polyline)) {
|
|
1662
|
+
polylineGraphics.material = defined(polyline.material)
|
|
1663
|
+
? polyline.material.color.getValue(Iso8601.MINIMUM_VALUE)
|
|
1664
|
+
: Color.WHITE;
|
|
1665
|
+
polylineGraphics.width = defaultValue(polyline.width, 1.0);
|
|
1666
|
+
} else {
|
|
1667
|
+
polylineGraphics.material = Color.WHITE;
|
|
1668
|
+
polylineGraphics.width = 1.0;
|
|
1669
|
+
}
|
|
1670
|
+
polylineGraphics.zIndex = zIndex;
|
|
1671
|
+
} else {
|
|
1672
|
+
if (defined(zIndex)) {
|
|
1673
|
+
oneTimeWarning(
|
|
1674
|
+
"kml-gx:drawOrder",
|
|
1675
|
+
"KML - gx:drawOrder is not supported in LineStrings when clampToGround is false"
|
|
1676
|
+
);
|
|
1677
|
+
}
|
|
1678
|
+
if (dataSource._clampToGround && !tessellate) {
|
|
1679
|
+
oneTimeWarning(
|
|
1680
|
+
"kml-line-tesselate",
|
|
1681
|
+
"Ignoring clampToGround for KML lines without the tessellate flag."
|
|
1682
|
+
);
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
polyline = defined(polyline) ? polyline.clone() : new PolylineGraphics();
|
|
1686
|
+
entity.polyline = polyline;
|
|
1687
|
+
polyline.positions = createPositionPropertyArrayFromAltitudeMode(
|
|
1688
|
+
coordinates,
|
|
1689
|
+
altitudeMode,
|
|
1690
|
+
gxAltitudeMode,
|
|
1691
|
+
ellipsoid
|
|
1692
|
+
);
|
|
1693
|
+
if (!tessellate || canExtrude) {
|
|
1694
|
+
polyline.arcType = ArcType.NONE;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
return true;
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
function processPolygon(
|
|
1702
|
+
dataSource,
|
|
1703
|
+
entityCollection,
|
|
1704
|
+
geometryNode,
|
|
1705
|
+
entity,
|
|
1706
|
+
styleEntity
|
|
1707
|
+
) {
|
|
1708
|
+
const outerBoundaryIsNode = queryFirstNode(
|
|
1709
|
+
geometryNode,
|
|
1710
|
+
"outerBoundaryIs",
|
|
1711
|
+
namespaces.kml
|
|
1712
|
+
);
|
|
1713
|
+
let linearRingNode = queryFirstNode(
|
|
1714
|
+
outerBoundaryIsNode,
|
|
1715
|
+
"LinearRing",
|
|
1716
|
+
namespaces.kml
|
|
1717
|
+
);
|
|
1718
|
+
let coordinatesNode = queryFirstNode(
|
|
1719
|
+
linearRingNode,
|
|
1720
|
+
"coordinates",
|
|
1721
|
+
namespaces.kml
|
|
1722
|
+
);
|
|
1723
|
+
const ellipsoid = dataSource._ellipsoid;
|
|
1724
|
+
let coordinates = readCoordinates(coordinatesNode, ellipsoid);
|
|
1725
|
+
const extrude = queryBooleanValue(geometryNode, "extrude", namespaces.kml);
|
|
1726
|
+
const altitudeMode = queryStringValue(
|
|
1727
|
+
geometryNode,
|
|
1728
|
+
"altitudeMode",
|
|
1729
|
+
namespaces.kml
|
|
1730
|
+
);
|
|
1731
|
+
const gxAltitudeMode = queryStringValue(
|
|
1732
|
+
geometryNode,
|
|
1733
|
+
"altitudeMode",
|
|
1734
|
+
namespaces.gx
|
|
1735
|
+
);
|
|
1736
|
+
const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode);
|
|
1737
|
+
|
|
1738
|
+
const polygon = defined(styleEntity.polygon)
|
|
1739
|
+
? styleEntity.polygon.clone()
|
|
1740
|
+
: createDefaultPolygon();
|
|
1741
|
+
|
|
1742
|
+
const polyline = styleEntity.polyline;
|
|
1743
|
+
if (defined(polyline)) {
|
|
1744
|
+
polygon.outlineColor = defined(polyline.material)
|
|
1745
|
+
? polyline.material.color
|
|
1746
|
+
: Color.WHITE;
|
|
1747
|
+
polygon.outlineWidth = polyline.width;
|
|
1748
|
+
}
|
|
1749
|
+
entity.polygon = polygon;
|
|
1750
|
+
|
|
1751
|
+
if (canExtrude) {
|
|
1752
|
+
polygon.perPositionHeight = true;
|
|
1753
|
+
polygon.extrudedHeight = extrude ? 0 : undefined;
|
|
1754
|
+
} else if (!dataSource._clampToGround) {
|
|
1755
|
+
polygon.height = 0;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
if (defined(coordinates)) {
|
|
1759
|
+
const hierarchy = new PolygonHierarchy(coordinates);
|
|
1760
|
+
const innerBoundaryIsNodes = queryChildNodes(
|
|
1761
|
+
geometryNode,
|
|
1762
|
+
"innerBoundaryIs",
|
|
1763
|
+
namespaces.kml
|
|
1764
|
+
);
|
|
1765
|
+
for (let j = 0; j < innerBoundaryIsNodes.length; j++) {
|
|
1766
|
+
linearRingNode = queryChildNodes(
|
|
1767
|
+
innerBoundaryIsNodes[j],
|
|
1768
|
+
"LinearRing",
|
|
1769
|
+
namespaces.kml
|
|
1770
|
+
);
|
|
1771
|
+
for (let k = 0; k < linearRingNode.length; k++) {
|
|
1772
|
+
coordinatesNode = queryFirstNode(
|
|
1773
|
+
linearRingNode[k],
|
|
1774
|
+
"coordinates",
|
|
1775
|
+
namespaces.kml
|
|
1776
|
+
);
|
|
1777
|
+
coordinates = readCoordinates(coordinatesNode, ellipsoid);
|
|
1778
|
+
if (defined(coordinates)) {
|
|
1779
|
+
hierarchy.holes.push(new PolygonHierarchy(coordinates));
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
polygon.hierarchy = hierarchy;
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
return true;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
function processTrack(
|
|
1790
|
+
dataSource,
|
|
1791
|
+
entityCollection,
|
|
1792
|
+
geometryNode,
|
|
1793
|
+
entity,
|
|
1794
|
+
styleEntity
|
|
1795
|
+
) {
|
|
1796
|
+
const altitudeMode = queryStringValue(
|
|
1797
|
+
geometryNode,
|
|
1798
|
+
"altitudeMode",
|
|
1799
|
+
namespaces.kml
|
|
1800
|
+
);
|
|
1801
|
+
const gxAltitudeMode = queryStringValue(
|
|
1802
|
+
geometryNode,
|
|
1803
|
+
"altitudeMode",
|
|
1804
|
+
namespaces.gx
|
|
1805
|
+
);
|
|
1806
|
+
const coordNodes = queryChildNodes(geometryNode, "coord", namespaces.gx);
|
|
1807
|
+
const angleNodes = queryChildNodes(geometryNode, "angles", namespaces.gx);
|
|
1808
|
+
const timeNodes = queryChildNodes(geometryNode, "when", namespaces.kml);
|
|
1809
|
+
const extrude = queryBooleanValue(geometryNode, "extrude", namespaces.kml);
|
|
1810
|
+
const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode);
|
|
1811
|
+
const ellipsoid = dataSource._ellipsoid;
|
|
1812
|
+
|
|
1813
|
+
if (angleNodes.length > 0) {
|
|
1814
|
+
oneTimeWarning(
|
|
1815
|
+
"kml-gx:angles",
|
|
1816
|
+
"KML - gx:angles are not supported in gx:Tracks"
|
|
1817
|
+
);
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
const length = Math.min(coordNodes.length, timeNodes.length);
|
|
1821
|
+
const coordinates = [];
|
|
1822
|
+
const times = [];
|
|
1823
|
+
for (let i = 0; i < length; i++) {
|
|
1824
|
+
const position = readCoordinate(coordNodes[i].textContent, ellipsoid);
|
|
1825
|
+
coordinates.push(position);
|
|
1826
|
+
times.push(JulianDate.fromIso8601(timeNodes[i].textContent));
|
|
1827
|
+
}
|
|
1828
|
+
const property = new SampledPositionProperty();
|
|
1829
|
+
property.addSamples(times, coordinates);
|
|
1830
|
+
entity.position = property;
|
|
1831
|
+
processPositionGraphics(
|
|
1832
|
+
dataSource,
|
|
1833
|
+
entity,
|
|
1834
|
+
styleEntity,
|
|
1835
|
+
heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode)
|
|
1836
|
+
);
|
|
1837
|
+
processPathGraphics(entity, styleEntity);
|
|
1838
|
+
|
|
1839
|
+
entity.availability = new TimeIntervalCollection();
|
|
1840
|
+
|
|
1841
|
+
if (timeNodes.length > 0) {
|
|
1842
|
+
entity.availability.addInterval(
|
|
1843
|
+
new TimeInterval({
|
|
1844
|
+
start: times[0],
|
|
1845
|
+
stop: times[times.length - 1],
|
|
1846
|
+
})
|
|
1847
|
+
);
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
if (canExtrude && extrude) {
|
|
1851
|
+
createDropLine(entityCollection, entity, styleEntity);
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
return true;
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
function addToMultiTrack(
|
|
1858
|
+
times,
|
|
1859
|
+
positions,
|
|
1860
|
+
composite,
|
|
1861
|
+
availability,
|
|
1862
|
+
dropShowProperty,
|
|
1863
|
+
extrude,
|
|
1864
|
+
altitudeMode,
|
|
1865
|
+
gxAltitudeMode,
|
|
1866
|
+
includeEndPoints
|
|
1867
|
+
) {
|
|
1868
|
+
const start = times[0];
|
|
1869
|
+
const stop = times[times.length - 1];
|
|
1870
|
+
|
|
1871
|
+
const data = new SampledPositionProperty();
|
|
1872
|
+
data.addSamples(times, positions);
|
|
1873
|
+
|
|
1874
|
+
composite.intervals.addInterval(
|
|
1875
|
+
new TimeInterval({
|
|
1876
|
+
start: start,
|
|
1877
|
+
stop: stop,
|
|
1878
|
+
isStartIncluded: includeEndPoints,
|
|
1879
|
+
isStopIncluded: includeEndPoints,
|
|
1880
|
+
data: createPositionPropertyFromAltitudeMode(
|
|
1881
|
+
data,
|
|
1882
|
+
altitudeMode,
|
|
1883
|
+
gxAltitudeMode
|
|
1884
|
+
),
|
|
1885
|
+
})
|
|
1886
|
+
);
|
|
1887
|
+
availability.addInterval(
|
|
1888
|
+
new TimeInterval({
|
|
1889
|
+
start: start,
|
|
1890
|
+
stop: stop,
|
|
1891
|
+
isStartIncluded: includeEndPoints,
|
|
1892
|
+
isStopIncluded: includeEndPoints,
|
|
1893
|
+
})
|
|
1894
|
+
);
|
|
1895
|
+
dropShowProperty.intervals.addInterval(
|
|
1896
|
+
new TimeInterval({
|
|
1897
|
+
start: start,
|
|
1898
|
+
stop: stop,
|
|
1899
|
+
isStartIncluded: includeEndPoints,
|
|
1900
|
+
isStopIncluded: includeEndPoints,
|
|
1901
|
+
data: extrude,
|
|
1902
|
+
})
|
|
1903
|
+
);
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
function processMultiTrack(
|
|
1907
|
+
dataSource,
|
|
1908
|
+
entityCollection,
|
|
1909
|
+
geometryNode,
|
|
1910
|
+
entity,
|
|
1911
|
+
styleEntity
|
|
1912
|
+
) {
|
|
1913
|
+
// Multitrack options do not work in GE as detailed in the spec,
|
|
1914
|
+
// rather than altitudeMode being at the MultiTrack level,
|
|
1915
|
+
// GE just defers all settings to the underlying track.
|
|
1916
|
+
|
|
1917
|
+
const interpolate = queryBooleanValue(
|
|
1918
|
+
geometryNode,
|
|
1919
|
+
"interpolate",
|
|
1920
|
+
namespaces.gx
|
|
1921
|
+
);
|
|
1922
|
+
const trackNodes = queryChildNodes(geometryNode, "Track", namespaces.gx);
|
|
1923
|
+
|
|
1924
|
+
let times;
|
|
1925
|
+
let lastStop;
|
|
1926
|
+
let lastStopPosition;
|
|
1927
|
+
let needDropLine = false;
|
|
1928
|
+
const dropShowProperty = new TimeIntervalCollectionProperty();
|
|
1929
|
+
const availability = new TimeIntervalCollection();
|
|
1930
|
+
const composite = new CompositePositionProperty();
|
|
1931
|
+
const ellipsoid = dataSource._ellipsoid;
|
|
1932
|
+
for (let i = 0, len = trackNodes.length; i < len; i++) {
|
|
1933
|
+
const trackNode = trackNodes[i];
|
|
1934
|
+
const timeNodes = queryChildNodes(trackNode, "when", namespaces.kml);
|
|
1935
|
+
const coordNodes = queryChildNodes(trackNode, "coord", namespaces.gx);
|
|
1936
|
+
const altitudeMode = queryStringValue(
|
|
1937
|
+
trackNode,
|
|
1938
|
+
"altitudeMode",
|
|
1939
|
+
namespaces.kml
|
|
1940
|
+
);
|
|
1941
|
+
const gxAltitudeMode = queryStringValue(
|
|
1942
|
+
trackNode,
|
|
1943
|
+
"altitudeMode",
|
|
1944
|
+
namespaces.gx
|
|
1945
|
+
);
|
|
1946
|
+
const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode);
|
|
1947
|
+
const extrude = queryBooleanValue(trackNode, "extrude", namespaces.kml);
|
|
1948
|
+
|
|
1949
|
+
const length = Math.min(coordNodes.length, timeNodes.length);
|
|
1950
|
+
|
|
1951
|
+
const positions = [];
|
|
1952
|
+
times = [];
|
|
1953
|
+
for (let x = 0; x < length; x++) {
|
|
1954
|
+
const position = readCoordinate(coordNodes[x].textContent, ellipsoid);
|
|
1955
|
+
positions.push(position);
|
|
1956
|
+
times.push(JulianDate.fromIso8601(timeNodes[x].textContent));
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
if (interpolate) {
|
|
1960
|
+
//If we are interpolating, then we need to fill in the end of
|
|
1961
|
+
//the last track and the beginning of this one with a sampled
|
|
1962
|
+
//property. From testing in Google Earth, this property
|
|
1963
|
+
//is never extruded and always absolute.
|
|
1964
|
+
if (defined(lastStop)) {
|
|
1965
|
+
addToMultiTrack(
|
|
1966
|
+
[lastStop, times[0]],
|
|
1967
|
+
[lastStopPosition, positions[0]],
|
|
1968
|
+
composite,
|
|
1969
|
+
availability,
|
|
1970
|
+
dropShowProperty,
|
|
1971
|
+
false,
|
|
1972
|
+
"absolute",
|
|
1973
|
+
undefined,
|
|
1974
|
+
false
|
|
1975
|
+
);
|
|
1976
|
+
}
|
|
1977
|
+
lastStop = times[length - 1];
|
|
1978
|
+
lastStopPosition = positions[positions.length - 1];
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
addToMultiTrack(
|
|
1982
|
+
times,
|
|
1983
|
+
positions,
|
|
1984
|
+
composite,
|
|
1985
|
+
availability,
|
|
1986
|
+
dropShowProperty,
|
|
1987
|
+
canExtrude && extrude,
|
|
1988
|
+
altitudeMode,
|
|
1989
|
+
gxAltitudeMode,
|
|
1990
|
+
true
|
|
1991
|
+
);
|
|
1992
|
+
needDropLine = needDropLine || (canExtrude && extrude);
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
entity.availability = availability;
|
|
1996
|
+
entity.position = composite;
|
|
1997
|
+
processPositionGraphics(dataSource, entity, styleEntity);
|
|
1998
|
+
processPathGraphics(entity, styleEntity);
|
|
1999
|
+
if (needDropLine) {
|
|
2000
|
+
createDropLine(entityCollection, entity, styleEntity);
|
|
2001
|
+
entity.polyline.show = dropShowProperty;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
return true;
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
const geometryTypes = {
|
|
2008
|
+
Point: processPoint,
|
|
2009
|
+
LineString: processLineStringOrLinearRing,
|
|
2010
|
+
LinearRing: processLineStringOrLinearRing,
|
|
2011
|
+
Polygon: processPolygon,
|
|
2012
|
+
Track: processTrack,
|
|
2013
|
+
MultiTrack: processMultiTrack,
|
|
2014
|
+
MultiGeometry: processMultiGeometry,
|
|
2015
|
+
Model: processUnsupportedGeometry,
|
|
2016
|
+
};
|
|
2017
|
+
|
|
2018
|
+
function processMultiGeometry(
|
|
2019
|
+
dataSource,
|
|
2020
|
+
entityCollection,
|
|
2021
|
+
geometryNode,
|
|
2022
|
+
entity,
|
|
2023
|
+
styleEntity,
|
|
2024
|
+
context
|
|
2025
|
+
) {
|
|
2026
|
+
const childNodes = geometryNode.childNodes;
|
|
2027
|
+
let hasGeometry = false;
|
|
2028
|
+
for (let i = 0, len = childNodes.length; i < len; i++) {
|
|
2029
|
+
const childNode = childNodes.item(i);
|
|
2030
|
+
const geometryProcessor = geometryTypes[childNode.localName];
|
|
2031
|
+
if (defined(geometryProcessor)) {
|
|
2032
|
+
const childEntity = createEntity(childNode, entityCollection, context);
|
|
2033
|
+
childEntity.parent = entity;
|
|
2034
|
+
childEntity.name = entity.name;
|
|
2035
|
+
childEntity.availability = entity.availability;
|
|
2036
|
+
childEntity.description = entity.description;
|
|
2037
|
+
childEntity.kml = entity.kml;
|
|
2038
|
+
if (
|
|
2039
|
+
geometryProcessor(
|
|
2040
|
+
dataSource,
|
|
2041
|
+
entityCollection,
|
|
2042
|
+
childNode,
|
|
2043
|
+
childEntity,
|
|
2044
|
+
styleEntity
|
|
2045
|
+
)
|
|
2046
|
+
) {
|
|
2047
|
+
hasGeometry = true;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
return hasGeometry;
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
function processUnsupportedGeometry(
|
|
2056
|
+
dataSource,
|
|
2057
|
+
entityCollection,
|
|
2058
|
+
geometryNode,
|
|
2059
|
+
entity,
|
|
2060
|
+
styleEntity
|
|
2061
|
+
) {
|
|
2062
|
+
oneTimeWarning(
|
|
2063
|
+
"kml-unsupportedGeometry",
|
|
2064
|
+
`KML - Unsupported geometry: ${geometryNode.localName}`
|
|
2065
|
+
);
|
|
2066
|
+
return false;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
function processExtendedData(node, entity) {
|
|
2070
|
+
const extendedDataNode = queryFirstNode(node, "ExtendedData", namespaces.kml);
|
|
2071
|
+
|
|
2072
|
+
if (!defined(extendedDataNode)) {
|
|
2073
|
+
return undefined;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
if (defined(queryFirstNode(extendedDataNode, "SchemaData", namespaces.kml))) {
|
|
2077
|
+
oneTimeWarning("kml-schemaData", "KML - SchemaData is unsupported");
|
|
2078
|
+
}
|
|
2079
|
+
if (defined(queryStringAttribute(extendedDataNode, "xmlns:prefix"))) {
|
|
2080
|
+
oneTimeWarning(
|
|
2081
|
+
"kml-extendedData",
|
|
2082
|
+
"KML - ExtendedData with xmlns:prefix is unsupported"
|
|
2083
|
+
);
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
const result = {};
|
|
2087
|
+
const dataNodes = queryChildNodes(extendedDataNode, "Data", namespaces.kml);
|
|
2088
|
+
if (defined(dataNodes)) {
|
|
2089
|
+
const length = dataNodes.length;
|
|
2090
|
+
for (let i = 0; i < length; i++) {
|
|
2091
|
+
const dataNode = dataNodes[i];
|
|
2092
|
+
const name = queryStringAttribute(dataNode, "name");
|
|
2093
|
+
if (defined(name)) {
|
|
2094
|
+
result[name] = {
|
|
2095
|
+
displayName: queryStringValue(
|
|
2096
|
+
dataNode,
|
|
2097
|
+
"displayName",
|
|
2098
|
+
namespaces.kml
|
|
2099
|
+
),
|
|
2100
|
+
value: queryStringValue(dataNode, "value", namespaces.kml),
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
entity.kml.extendedData = result;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
let scratchDiv;
|
|
2109
|
+
if (typeof document !== "undefined") {
|
|
2110
|
+
scratchDiv = document.createElement("div");
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
function processDescription(
|
|
2114
|
+
node,
|
|
2115
|
+
entity,
|
|
2116
|
+
styleEntity,
|
|
2117
|
+
uriResolver,
|
|
2118
|
+
sourceResource
|
|
2119
|
+
) {
|
|
2120
|
+
let i;
|
|
2121
|
+
let key;
|
|
2122
|
+
let keys;
|
|
2123
|
+
|
|
2124
|
+
const kmlData = entity.kml;
|
|
2125
|
+
const extendedData = kmlData.extendedData;
|
|
2126
|
+
const description = queryStringValue(node, "description", namespaces.kml);
|
|
2127
|
+
|
|
2128
|
+
const balloonStyle = defaultValue(
|
|
2129
|
+
entity.balloonStyle,
|
|
2130
|
+
styleEntity.balloonStyle
|
|
2131
|
+
);
|
|
2132
|
+
|
|
2133
|
+
let background = Color.WHITE;
|
|
2134
|
+
let foreground = Color.BLACK;
|
|
2135
|
+
let text = description;
|
|
2136
|
+
|
|
2137
|
+
if (defined(balloonStyle)) {
|
|
2138
|
+
background = defaultValue(balloonStyle.bgColor, Color.WHITE);
|
|
2139
|
+
foreground = defaultValue(balloonStyle.textColor, Color.BLACK);
|
|
2140
|
+
text = defaultValue(balloonStyle.text, description);
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
let value;
|
|
2144
|
+
if (defined(text)) {
|
|
2145
|
+
text = text.replace("$[name]", defaultValue(entity.name, ""));
|
|
2146
|
+
text = text.replace("$[description]", defaultValue(description, ""));
|
|
2147
|
+
text = text.replace("$[address]", defaultValue(kmlData.address, ""));
|
|
2148
|
+
text = text.replace("$[Snippet]", defaultValue(kmlData.snippet, ""));
|
|
2149
|
+
text = text.replace("$[id]", entity.id);
|
|
2150
|
+
|
|
2151
|
+
//While not explicitly defined by the OGC spec, in Google Earth
|
|
2152
|
+
//The appearance of geDirections adds the directions to/from links
|
|
2153
|
+
//We simply replace this string with nothing.
|
|
2154
|
+
text = text.replace("$[geDirections]", "");
|
|
2155
|
+
|
|
2156
|
+
if (defined(extendedData)) {
|
|
2157
|
+
const matches = text.match(/\$\[.+?\]/g);
|
|
2158
|
+
if (matches !== null) {
|
|
2159
|
+
for (i = 0; i < matches.length; i++) {
|
|
2160
|
+
const token = matches[i];
|
|
2161
|
+
let propertyName = token.substr(2, token.length - 3);
|
|
2162
|
+
const isDisplayName = /\/displayName$/.test(propertyName);
|
|
2163
|
+
propertyName = propertyName.replace(/\/displayName$/, "");
|
|
2164
|
+
|
|
2165
|
+
value = extendedData[propertyName];
|
|
2166
|
+
if (defined(value)) {
|
|
2167
|
+
value = isDisplayName ? value.displayName : value.value;
|
|
2168
|
+
}
|
|
2169
|
+
if (defined(value)) {
|
|
2170
|
+
text = text.replace(token, defaultValue(value, ""));
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
} else if (defined(extendedData)) {
|
|
2176
|
+
//If no description exists, build a table out of the extended data
|
|
2177
|
+
keys = Object.keys(extendedData);
|
|
2178
|
+
if (keys.length > 0) {
|
|
2179
|
+
text =
|
|
2180
|
+
'<table class="cesium-infoBox-defaultTable cesium-infoBox-defaultTable-lighter"><tbody>';
|
|
2181
|
+
for (i = 0; i < keys.length; i++) {
|
|
2182
|
+
key = keys[i];
|
|
2183
|
+
value = extendedData[key];
|
|
2184
|
+
text += `<tr><th>${defaultValue(
|
|
2185
|
+
value.displayName,
|
|
2186
|
+
key
|
|
2187
|
+
)}</th><td>${defaultValue(value.value, "")}</td></tr>`;
|
|
2188
|
+
}
|
|
2189
|
+
text += "</tbody></table>";
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
if (!defined(text)) {
|
|
2194
|
+
//No description
|
|
2195
|
+
return;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
//Turns non-explicit links into clickable links.
|
|
2199
|
+
text = autolinker.link(text);
|
|
2200
|
+
|
|
2201
|
+
//Use a temporary div to manipulate the links
|
|
2202
|
+
//so that they open in a new window.
|
|
2203
|
+
scratchDiv.innerHTML = text;
|
|
2204
|
+
const links = scratchDiv.querySelectorAll("a");
|
|
2205
|
+
for (i = 0; i < links.length; i++) {
|
|
2206
|
+
links[i].setAttribute("target", "_blank");
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
//Rewrite any KMZ embedded urls
|
|
2210
|
+
if (defined(uriResolver) && uriResolver.keys.length > 1) {
|
|
2211
|
+
embedDataUris(scratchDiv, "a", "href", uriResolver);
|
|
2212
|
+
embedDataUris(scratchDiv, "link", "href", uriResolver);
|
|
2213
|
+
embedDataUris(scratchDiv, "area", "href", uriResolver);
|
|
2214
|
+
embedDataUris(scratchDiv, "img", "src", uriResolver);
|
|
2215
|
+
embedDataUris(scratchDiv, "iframe", "src", uriResolver);
|
|
2216
|
+
embedDataUris(scratchDiv, "video", "src", uriResolver);
|
|
2217
|
+
embedDataUris(scratchDiv, "audio", "src", uriResolver);
|
|
2218
|
+
embedDataUris(scratchDiv, "source", "src", uriResolver);
|
|
2219
|
+
embedDataUris(scratchDiv, "track", "src", uriResolver);
|
|
2220
|
+
embedDataUris(scratchDiv, "input", "src", uriResolver);
|
|
2221
|
+
embedDataUris(scratchDiv, "embed", "src", uriResolver);
|
|
2222
|
+
embedDataUris(scratchDiv, "script", "src", uriResolver);
|
|
2223
|
+
embedDataUris(scratchDiv, "video", "poster", uriResolver);
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
//Make relative urls absolute using the sourceResource
|
|
2227
|
+
applyBasePath(scratchDiv, "a", "href", sourceResource);
|
|
2228
|
+
applyBasePath(scratchDiv, "link", "href", sourceResource);
|
|
2229
|
+
applyBasePath(scratchDiv, "area", "href", sourceResource);
|
|
2230
|
+
applyBasePath(scratchDiv, "img", "src", sourceResource);
|
|
2231
|
+
applyBasePath(scratchDiv, "iframe", "src", sourceResource);
|
|
2232
|
+
applyBasePath(scratchDiv, "video", "src", sourceResource);
|
|
2233
|
+
applyBasePath(scratchDiv, "audio", "src", sourceResource);
|
|
2234
|
+
applyBasePath(scratchDiv, "source", "src", sourceResource);
|
|
2235
|
+
applyBasePath(scratchDiv, "track", "src", sourceResource);
|
|
2236
|
+
applyBasePath(scratchDiv, "input", "src", sourceResource);
|
|
2237
|
+
applyBasePath(scratchDiv, "embed", "src", sourceResource);
|
|
2238
|
+
applyBasePath(scratchDiv, "script", "src", sourceResource);
|
|
2239
|
+
applyBasePath(scratchDiv, "video", "poster", sourceResource);
|
|
2240
|
+
|
|
2241
|
+
let tmp = '<div class="cesium-infoBox-description-lighter" style="';
|
|
2242
|
+
tmp += "overflow:auto;";
|
|
2243
|
+
tmp += "word-wrap:break-word;";
|
|
2244
|
+
tmp += `background-color:${background.toCssColorString()};`;
|
|
2245
|
+
tmp += `color:${foreground.toCssColorString()};`;
|
|
2246
|
+
tmp += '">';
|
|
2247
|
+
tmp += `${scratchDiv.innerHTML}</div>`;
|
|
2248
|
+
scratchDiv.innerHTML = "";
|
|
2249
|
+
|
|
2250
|
+
//Set the final HTML as the description.
|
|
2251
|
+
entity.description = tmp;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
function processFeature(dataSource, featureNode, processingData) {
|
|
2255
|
+
const entityCollection = processingData.entityCollection;
|
|
2256
|
+
const parent = processingData.parentEntity;
|
|
2257
|
+
const sourceResource = processingData.sourceResource;
|
|
2258
|
+
const uriResolver = processingData.uriResolver;
|
|
2259
|
+
|
|
2260
|
+
const entity = createEntity(
|
|
2261
|
+
featureNode,
|
|
2262
|
+
entityCollection,
|
|
2263
|
+
processingData.context
|
|
2264
|
+
);
|
|
2265
|
+
const kmlData = entity.kml;
|
|
2266
|
+
const styleEntity = computeFinalStyle(
|
|
2267
|
+
dataSource,
|
|
2268
|
+
featureNode,
|
|
2269
|
+
processingData.styleCollection,
|
|
2270
|
+
sourceResource,
|
|
2271
|
+
uriResolver
|
|
2272
|
+
);
|
|
2273
|
+
|
|
2274
|
+
const name = queryStringValue(featureNode, "name", namespaces.kml);
|
|
2275
|
+
entity.name = name;
|
|
2276
|
+
entity.parent = parent;
|
|
2277
|
+
|
|
2278
|
+
let availability = processTimeSpan(featureNode);
|
|
2279
|
+
if (!defined(availability)) {
|
|
2280
|
+
availability = processTimeStamp(featureNode);
|
|
2281
|
+
}
|
|
2282
|
+
entity.availability = availability;
|
|
2283
|
+
|
|
2284
|
+
mergeAvailabilityWithParent(entity);
|
|
2285
|
+
|
|
2286
|
+
// Per KML spec "A Feature is visible only if it and all its ancestors are visible."
|
|
2287
|
+
function ancestryIsVisible(parentEntity) {
|
|
2288
|
+
if (!parentEntity) {
|
|
2289
|
+
return true;
|
|
2290
|
+
}
|
|
2291
|
+
return parentEntity.show && ancestryIsVisible(parentEntity.parent);
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
const visibility = queryBooleanValue(
|
|
2295
|
+
featureNode,
|
|
2296
|
+
"visibility",
|
|
2297
|
+
namespaces.kml
|
|
2298
|
+
);
|
|
2299
|
+
entity.show = ancestryIsVisible(parent) && defaultValue(visibility, true);
|
|
2300
|
+
//const open = queryBooleanValue(featureNode, 'open', namespaces.kml);
|
|
2301
|
+
|
|
2302
|
+
const authorNode = queryFirstNode(featureNode, "author", namespaces.atom);
|
|
2303
|
+
const author = kmlData.author;
|
|
2304
|
+
author.name = queryStringValue(authorNode, "name", namespaces.atom);
|
|
2305
|
+
author.uri = queryStringValue(authorNode, "uri", namespaces.atom);
|
|
2306
|
+
author.email = queryStringValue(authorNode, "email", namespaces.atom);
|
|
2307
|
+
|
|
2308
|
+
const linkNode = queryFirstNode(featureNode, "link", namespaces.atom);
|
|
2309
|
+
const link = kmlData.link;
|
|
2310
|
+
link.href = queryStringAttribute(linkNode, "href");
|
|
2311
|
+
link.hreflang = queryStringAttribute(linkNode, "hreflang");
|
|
2312
|
+
link.rel = queryStringAttribute(linkNode, "rel");
|
|
2313
|
+
link.type = queryStringAttribute(linkNode, "type");
|
|
2314
|
+
link.title = queryStringAttribute(linkNode, "title");
|
|
2315
|
+
link.length = queryStringAttribute(linkNode, "length");
|
|
2316
|
+
|
|
2317
|
+
kmlData.address = queryStringValue(featureNode, "address", namespaces.kml);
|
|
2318
|
+
kmlData.phoneNumber = queryStringValue(
|
|
2319
|
+
featureNode,
|
|
2320
|
+
"phoneNumber",
|
|
2321
|
+
namespaces.kml
|
|
2322
|
+
);
|
|
2323
|
+
kmlData.snippet = queryStringValue(featureNode, "Snippet", namespaces.kml);
|
|
2324
|
+
|
|
2325
|
+
processExtendedData(featureNode, entity);
|
|
2326
|
+
processDescription(
|
|
2327
|
+
featureNode,
|
|
2328
|
+
entity,
|
|
2329
|
+
styleEntity,
|
|
2330
|
+
uriResolver,
|
|
2331
|
+
sourceResource
|
|
2332
|
+
);
|
|
2333
|
+
|
|
2334
|
+
const ellipsoid = dataSource._ellipsoid;
|
|
2335
|
+
processLookAt(featureNode, entity, ellipsoid);
|
|
2336
|
+
processCamera(featureNode, entity, ellipsoid);
|
|
2337
|
+
|
|
2338
|
+
if (defined(queryFirstNode(featureNode, "Region", namespaces.kml))) {
|
|
2339
|
+
oneTimeWarning("kml-region", "KML - Placemark Regions are unsupported");
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
return {
|
|
2343
|
+
entity: entity,
|
|
2344
|
+
styleEntity: styleEntity,
|
|
2345
|
+
};
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
function processDocument(dataSource, node, processingData, deferredLoading) {
|
|
2349
|
+
deferredLoading.addNodes(node.childNodes, processingData);
|
|
2350
|
+
deferredLoading.process();
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
function processFolder(dataSource, node, processingData, deferredLoading) {
|
|
2354
|
+
const r = processFeature(dataSource, node, processingData);
|
|
2355
|
+
const newProcessingData = clone(processingData);
|
|
2356
|
+
newProcessingData.parentEntity = r.entity;
|
|
2357
|
+
processDocument(dataSource, node, newProcessingData, deferredLoading);
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
function processPlacemark(
|
|
2361
|
+
dataSource,
|
|
2362
|
+
placemark,
|
|
2363
|
+
processingData,
|
|
2364
|
+
deferredLoading
|
|
2365
|
+
) {
|
|
2366
|
+
const r = processFeature(dataSource, placemark, processingData);
|
|
2367
|
+
const entity = r.entity;
|
|
2368
|
+
const styleEntity = r.styleEntity;
|
|
2369
|
+
|
|
2370
|
+
let hasGeometry = false;
|
|
2371
|
+
const childNodes = placemark.childNodes;
|
|
2372
|
+
for (let i = 0, len = childNodes.length; i < len && !hasGeometry; i++) {
|
|
2373
|
+
const childNode = childNodes.item(i);
|
|
2374
|
+
const geometryProcessor = geometryTypes[childNode.localName];
|
|
2375
|
+
if (defined(geometryProcessor)) {
|
|
2376
|
+
// pass the placemark entity id as a context for case of defining multiple child entities together to handle case
|
|
2377
|
+
// where some malformed kmls reuse the same id across placemarks, which works in GE, but is not technically to spec.
|
|
2378
|
+
geometryProcessor(
|
|
2379
|
+
dataSource,
|
|
2380
|
+
processingData.entityCollection,
|
|
2381
|
+
childNode,
|
|
2382
|
+
entity,
|
|
2383
|
+
styleEntity,
|
|
2384
|
+
entity.id
|
|
2385
|
+
);
|
|
2386
|
+
hasGeometry = true;
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
if (!hasGeometry) {
|
|
2391
|
+
entity.merge(styleEntity);
|
|
2392
|
+
processPositionGraphics(dataSource, entity, styleEntity);
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
const playlistNodeProcessors = {
|
|
2397
|
+
FlyTo: processTourFlyTo,
|
|
2398
|
+
Wait: processTourWait,
|
|
2399
|
+
SoundCue: processTourUnsupportedNode,
|
|
2400
|
+
AnimatedUpdate: processTourUnsupportedNode,
|
|
2401
|
+
TourControl: processTourUnsupportedNode,
|
|
2402
|
+
};
|
|
2403
|
+
|
|
2404
|
+
function processTour(dataSource, node, processingData, deferredLoading) {
|
|
2405
|
+
const name = queryStringValue(node, "name", namespaces.kml);
|
|
2406
|
+
const id = queryStringAttribute(node, "id");
|
|
2407
|
+
const tour = new KmlTour(name, id);
|
|
2408
|
+
|
|
2409
|
+
const playlistNode = queryFirstNode(node, "Playlist", namespaces.gx);
|
|
2410
|
+
if (playlistNode) {
|
|
2411
|
+
const ellipsoid = dataSource._ellipsoid;
|
|
2412
|
+
const childNodes = playlistNode.childNodes;
|
|
2413
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
2414
|
+
const entryNode = childNodes[i];
|
|
2415
|
+
if (entryNode.localName) {
|
|
2416
|
+
const playlistNodeProcessor =
|
|
2417
|
+
playlistNodeProcessors[entryNode.localName];
|
|
2418
|
+
if (playlistNodeProcessor) {
|
|
2419
|
+
playlistNodeProcessor(tour, entryNode, ellipsoid);
|
|
2420
|
+
} else {
|
|
2421
|
+
console.log(
|
|
2422
|
+
`Unknown KML Tour playlist entry type ${entryNode.localName}`
|
|
2423
|
+
);
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
dataSource._kmlTours.push(tour);
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
function processTourUnsupportedNode(tour, entryNode) {
|
|
2433
|
+
oneTimeWarning(`KML Tour unsupported node ${entryNode.localName}`);
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
function processTourWait(tour, entryNode) {
|
|
2437
|
+
const duration = queryNumericValue(entryNode, "duration", namespaces.gx);
|
|
2438
|
+
tour.addPlaylistEntry(new KmlTourWait(duration));
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
function processTourFlyTo(tour, entryNode, ellipsoid) {
|
|
2442
|
+
const duration = queryNumericValue(entryNode, "duration", namespaces.gx);
|
|
2443
|
+
const flyToMode = queryStringValue(entryNode, "flyToMode", namespaces.gx);
|
|
2444
|
+
|
|
2445
|
+
const t = { kml: {} };
|
|
2446
|
+
|
|
2447
|
+
processLookAt(entryNode, t, ellipsoid);
|
|
2448
|
+
processCamera(entryNode, t, ellipsoid);
|
|
2449
|
+
|
|
2450
|
+
const view = t.kml.lookAt || t.kml.camera;
|
|
2451
|
+
|
|
2452
|
+
const flyto = new KmlTourFlyTo(duration, flyToMode, view);
|
|
2453
|
+
tour.addPlaylistEntry(flyto);
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
function processCamera(featureNode, entity, ellipsoid) {
|
|
2457
|
+
const camera = queryFirstNode(featureNode, "Camera", namespaces.kml);
|
|
2458
|
+
if (defined(camera)) {
|
|
2459
|
+
const lon = defaultValue(
|
|
2460
|
+
queryNumericValue(camera, "longitude", namespaces.kml),
|
|
2461
|
+
0.0
|
|
2462
|
+
);
|
|
2463
|
+
const lat = defaultValue(
|
|
2464
|
+
queryNumericValue(camera, "latitude", namespaces.kml),
|
|
2465
|
+
0.0
|
|
2466
|
+
);
|
|
2467
|
+
const altitude = defaultValue(
|
|
2468
|
+
queryNumericValue(camera, "altitude", namespaces.kml),
|
|
2469
|
+
0.0
|
|
2470
|
+
);
|
|
2471
|
+
|
|
2472
|
+
const heading = defaultValue(
|
|
2473
|
+
queryNumericValue(camera, "heading", namespaces.kml),
|
|
2474
|
+
0.0
|
|
2475
|
+
);
|
|
2476
|
+
const tilt = defaultValue(
|
|
2477
|
+
queryNumericValue(camera, "tilt", namespaces.kml),
|
|
2478
|
+
0.0
|
|
2479
|
+
);
|
|
2480
|
+
const roll = defaultValue(
|
|
2481
|
+
queryNumericValue(camera, "roll", namespaces.kml),
|
|
2482
|
+
0.0
|
|
2483
|
+
);
|
|
2484
|
+
|
|
2485
|
+
const position = Cartesian3.fromDegrees(lon, lat, altitude, ellipsoid);
|
|
2486
|
+
const hpr = HeadingPitchRoll.fromDegrees(heading, tilt - 90.0, roll);
|
|
2487
|
+
|
|
2488
|
+
entity.kml.camera = new KmlCamera(position, hpr);
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
function processLookAt(featureNode, entity, ellipsoid) {
|
|
2493
|
+
const lookAt = queryFirstNode(featureNode, "LookAt", namespaces.kml);
|
|
2494
|
+
if (defined(lookAt)) {
|
|
2495
|
+
const lon = defaultValue(
|
|
2496
|
+
queryNumericValue(lookAt, "longitude", namespaces.kml),
|
|
2497
|
+
0.0
|
|
2498
|
+
);
|
|
2499
|
+
const lat = defaultValue(
|
|
2500
|
+
queryNumericValue(lookAt, "latitude", namespaces.kml),
|
|
2501
|
+
0.0
|
|
2502
|
+
);
|
|
2503
|
+
const altitude = defaultValue(
|
|
2504
|
+
queryNumericValue(lookAt, "altitude", namespaces.kml),
|
|
2505
|
+
0.0
|
|
2506
|
+
);
|
|
2507
|
+
let heading = queryNumericValue(lookAt, "heading", namespaces.kml);
|
|
2508
|
+
let tilt = queryNumericValue(lookAt, "tilt", namespaces.kml);
|
|
2509
|
+
const range = defaultValue(
|
|
2510
|
+
queryNumericValue(lookAt, "range", namespaces.kml),
|
|
2511
|
+
0.0
|
|
2512
|
+
);
|
|
2513
|
+
|
|
2514
|
+
tilt = CesiumMath.toRadians(defaultValue(tilt, 0.0));
|
|
2515
|
+
heading = CesiumMath.toRadians(defaultValue(heading, 0.0));
|
|
2516
|
+
|
|
2517
|
+
const hpr = new HeadingPitchRange(
|
|
2518
|
+
heading,
|
|
2519
|
+
tilt - CesiumMath.PI_OVER_TWO,
|
|
2520
|
+
range
|
|
2521
|
+
);
|
|
2522
|
+
const viewPoint = Cartesian3.fromDegrees(lon, lat, altitude, ellipsoid);
|
|
2523
|
+
|
|
2524
|
+
entity.kml.lookAt = new KmlLookAt(viewPoint, hpr);
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
function processScreenOverlay(
|
|
2529
|
+
dataSource,
|
|
2530
|
+
screenOverlayNode,
|
|
2531
|
+
processingData,
|
|
2532
|
+
deferredLoading
|
|
2533
|
+
) {
|
|
2534
|
+
const screenOverlay = processingData.screenOverlayContainer;
|
|
2535
|
+
if (!defined(screenOverlay)) {
|
|
2536
|
+
return undefined;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
const sourceResource = processingData.sourceResource;
|
|
2540
|
+
const uriResolver = processingData.uriResolver;
|
|
2541
|
+
|
|
2542
|
+
const iconNode = queryFirstNode(screenOverlayNode, "Icon", namespaces.kml);
|
|
2543
|
+
const icon = getIconHref(
|
|
2544
|
+
iconNode,
|
|
2545
|
+
dataSource,
|
|
2546
|
+
sourceResource,
|
|
2547
|
+
uriResolver,
|
|
2548
|
+
false
|
|
2549
|
+
);
|
|
2550
|
+
|
|
2551
|
+
if (!defined(icon)) {
|
|
2552
|
+
return undefined;
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
const img = document.createElement("img");
|
|
2556
|
+
dataSource._screenOverlays.push(img);
|
|
2557
|
+
|
|
2558
|
+
img.src = icon.url;
|
|
2559
|
+
img.onload = function () {
|
|
2560
|
+
const styles = ["position: absolute"];
|
|
2561
|
+
|
|
2562
|
+
const screenXY = queryFirstNode(
|
|
2563
|
+
screenOverlayNode,
|
|
2564
|
+
"screenXY",
|
|
2565
|
+
namespaces.kml
|
|
2566
|
+
);
|
|
2567
|
+
const overlayXY = queryFirstNode(
|
|
2568
|
+
screenOverlayNode,
|
|
2569
|
+
"overlayXY",
|
|
2570
|
+
namespaces.kml
|
|
2571
|
+
);
|
|
2572
|
+
const size = queryFirstNode(screenOverlayNode, "size", namespaces.kml);
|
|
2573
|
+
|
|
2574
|
+
let x, y;
|
|
2575
|
+
let xUnit, yUnit;
|
|
2576
|
+
let xStyle, yStyle;
|
|
2577
|
+
|
|
2578
|
+
if (defined(size)) {
|
|
2579
|
+
x = queryNumericAttribute(size, "x");
|
|
2580
|
+
y = queryNumericAttribute(size, "y");
|
|
2581
|
+
xUnit = queryStringAttribute(size, "xunits");
|
|
2582
|
+
yUnit = queryStringAttribute(size, "yunits");
|
|
2583
|
+
|
|
2584
|
+
if (defined(x) && x !== -1 && x !== 0) {
|
|
2585
|
+
if (xUnit === "fraction") {
|
|
2586
|
+
xStyle = `width: ${Math.floor(x * 100)}%`;
|
|
2587
|
+
} else if (xUnit === "pixels") {
|
|
2588
|
+
xStyle = `width: ${x}px`;
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
styles.push(xStyle);
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
if (defined(y) && y !== -1 && y !== 0) {
|
|
2595
|
+
if (yUnit === "fraction") {
|
|
2596
|
+
yStyle = `height: ${Math.floor(y * 100)}%`;
|
|
2597
|
+
} else if (yUnit === "pixels") {
|
|
2598
|
+
yStyle = `height: ${y}px`;
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
styles.push(yStyle);
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
// set the interim style so the width/height properties get calculated
|
|
2606
|
+
img.style = styles.join(";");
|
|
2607
|
+
|
|
2608
|
+
let xOrigin = 0;
|
|
2609
|
+
let yOrigin = img.height;
|
|
2610
|
+
|
|
2611
|
+
if (defined(overlayXY)) {
|
|
2612
|
+
x = queryNumericAttribute(overlayXY, "x");
|
|
2613
|
+
y = queryNumericAttribute(overlayXY, "y");
|
|
2614
|
+
xUnit = queryStringAttribute(overlayXY, "xunits");
|
|
2615
|
+
yUnit = queryStringAttribute(overlayXY, "yunits");
|
|
2616
|
+
|
|
2617
|
+
if (defined(x)) {
|
|
2618
|
+
if (xUnit === "fraction") {
|
|
2619
|
+
xOrigin = x * img.width;
|
|
2620
|
+
} else if (xUnit === "pixels") {
|
|
2621
|
+
xOrigin = x;
|
|
2622
|
+
} else if (xUnit === "insetPixels") {
|
|
2623
|
+
xOrigin = x;
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
if (defined(y)) {
|
|
2628
|
+
if (yUnit === "fraction") {
|
|
2629
|
+
yOrigin = y * img.height;
|
|
2630
|
+
} else if (yUnit === "pixels") {
|
|
2631
|
+
yOrigin = y;
|
|
2632
|
+
} else if (yUnit === "insetPixels") {
|
|
2633
|
+
yOrigin = y;
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
if (defined(screenXY)) {
|
|
2639
|
+
x = queryNumericAttribute(screenXY, "x");
|
|
2640
|
+
y = queryNumericAttribute(screenXY, "y");
|
|
2641
|
+
xUnit = queryStringAttribute(screenXY, "xunits");
|
|
2642
|
+
yUnit = queryStringAttribute(screenXY, "yunits");
|
|
2643
|
+
|
|
2644
|
+
if (defined(x)) {
|
|
2645
|
+
if (xUnit === "fraction") {
|
|
2646
|
+
xStyle = `${"left: " + "calc("}${Math.floor(
|
|
2647
|
+
x * 100
|
|
2648
|
+
)}% - ${xOrigin}px)`;
|
|
2649
|
+
} else if (xUnit === "pixels") {
|
|
2650
|
+
xStyle = `left: ${x - xOrigin}px`;
|
|
2651
|
+
} else if (xUnit === "insetPixels") {
|
|
2652
|
+
xStyle = `right: ${x - xOrigin}px`;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
styles.push(xStyle);
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
if (defined(y)) {
|
|
2659
|
+
if (yUnit === "fraction") {
|
|
2660
|
+
yStyle = `${"bottom: " + "calc("}${Math.floor(
|
|
2661
|
+
y * 100
|
|
2662
|
+
)}% - ${yOrigin}px)`;
|
|
2663
|
+
} else if (yUnit === "pixels") {
|
|
2664
|
+
yStyle = `bottom: ${y - yOrigin}px`;
|
|
2665
|
+
} else if (yUnit === "insetPixels") {
|
|
2666
|
+
yStyle = `top: ${y - yOrigin}px`;
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2669
|
+
styles.push(yStyle);
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
img.style = styles.join(";");
|
|
2674
|
+
};
|
|
2675
|
+
|
|
2676
|
+
screenOverlay.appendChild(img);
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
function processGroundOverlay(
|
|
2680
|
+
dataSource,
|
|
2681
|
+
groundOverlay,
|
|
2682
|
+
processingData,
|
|
2683
|
+
deferredLoading
|
|
2684
|
+
) {
|
|
2685
|
+
const r = processFeature(dataSource, groundOverlay, processingData);
|
|
2686
|
+
const entity = r.entity;
|
|
2687
|
+
|
|
2688
|
+
let geometry;
|
|
2689
|
+
let isLatLonQuad = false;
|
|
2690
|
+
|
|
2691
|
+
const ellipsoid = dataSource._ellipsoid;
|
|
2692
|
+
const positions = readCoordinates(
|
|
2693
|
+
queryFirstNode(groundOverlay, "LatLonQuad", namespaces.gx),
|
|
2694
|
+
ellipsoid
|
|
2695
|
+
);
|
|
2696
|
+
const zIndex = queryNumericValue(groundOverlay, "drawOrder", namespaces.kml);
|
|
2697
|
+
if (defined(positions)) {
|
|
2698
|
+
geometry = createDefaultPolygon();
|
|
2699
|
+
geometry.hierarchy = new PolygonHierarchy(positions);
|
|
2700
|
+
geometry.zIndex = zIndex;
|
|
2701
|
+
entity.polygon = geometry;
|
|
2702
|
+
isLatLonQuad = true;
|
|
2703
|
+
} else {
|
|
2704
|
+
geometry = new RectangleGraphics();
|
|
2705
|
+
geometry.zIndex = zIndex;
|
|
2706
|
+
entity.rectangle = geometry;
|
|
2707
|
+
|
|
2708
|
+
const latLonBox = queryFirstNode(
|
|
2709
|
+
groundOverlay,
|
|
2710
|
+
"LatLonBox",
|
|
2711
|
+
namespaces.kml
|
|
2712
|
+
);
|
|
2713
|
+
if (defined(latLonBox)) {
|
|
2714
|
+
let west = queryNumericValue(latLonBox, "west", namespaces.kml);
|
|
2715
|
+
let south = queryNumericValue(latLonBox, "south", namespaces.kml);
|
|
2716
|
+
let east = queryNumericValue(latLonBox, "east", namespaces.kml);
|
|
2717
|
+
let north = queryNumericValue(latLonBox, "north", namespaces.kml);
|
|
2718
|
+
|
|
2719
|
+
if (defined(west)) {
|
|
2720
|
+
west = CesiumMath.negativePiToPi(CesiumMath.toRadians(west));
|
|
2721
|
+
}
|
|
2722
|
+
if (defined(south)) {
|
|
2723
|
+
south = CesiumMath.clampToLatitudeRange(CesiumMath.toRadians(south));
|
|
2724
|
+
}
|
|
2725
|
+
if (defined(east)) {
|
|
2726
|
+
east = CesiumMath.negativePiToPi(CesiumMath.toRadians(east));
|
|
2727
|
+
}
|
|
2728
|
+
if (defined(north)) {
|
|
2729
|
+
north = CesiumMath.clampToLatitudeRange(CesiumMath.toRadians(north));
|
|
2730
|
+
}
|
|
2731
|
+
geometry.coordinates = new Rectangle(west, south, east, north);
|
|
2732
|
+
|
|
2733
|
+
const rotation = queryNumericValue(latLonBox, "rotation", namespaces.kml);
|
|
2734
|
+
if (defined(rotation)) {
|
|
2735
|
+
const rotationRadians = CesiumMath.toRadians(rotation);
|
|
2736
|
+
geometry.rotation = rotationRadians;
|
|
2737
|
+
geometry.stRotation = rotationRadians;
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
const iconNode = queryFirstNode(groundOverlay, "Icon", namespaces.kml);
|
|
2743
|
+
const href = getIconHref(
|
|
2744
|
+
iconNode,
|
|
2745
|
+
dataSource,
|
|
2746
|
+
processingData.sourceResource,
|
|
2747
|
+
processingData.uriResolver,
|
|
2748
|
+
true
|
|
2749
|
+
);
|
|
2750
|
+
if (defined(href)) {
|
|
2751
|
+
if (isLatLonQuad) {
|
|
2752
|
+
oneTimeWarning(
|
|
2753
|
+
"kml-gx:LatLonQuad",
|
|
2754
|
+
"KML - gx:LatLonQuad Icon does not support texture projection."
|
|
2755
|
+
);
|
|
2756
|
+
}
|
|
2757
|
+
const x = queryNumericValue(iconNode, "x", namespaces.gx);
|
|
2758
|
+
const y = queryNumericValue(iconNode, "y", namespaces.gx);
|
|
2759
|
+
const w = queryNumericValue(iconNode, "w", namespaces.gx);
|
|
2760
|
+
const h = queryNumericValue(iconNode, "h", namespaces.gx);
|
|
2761
|
+
|
|
2762
|
+
if (defined(x) || defined(y) || defined(w) || defined(h)) {
|
|
2763
|
+
oneTimeWarning(
|
|
2764
|
+
"kml-groundOverlay-xywh",
|
|
2765
|
+
"KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays"
|
|
2766
|
+
);
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
geometry.material = href;
|
|
2770
|
+
geometry.material.color = queryColorValue(
|
|
2771
|
+
groundOverlay,
|
|
2772
|
+
"color",
|
|
2773
|
+
namespaces.kml
|
|
2774
|
+
);
|
|
2775
|
+
geometry.material.transparent = true;
|
|
2776
|
+
} else {
|
|
2777
|
+
geometry.material = queryColorValue(groundOverlay, "color", namespaces.kml);
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2780
|
+
let altitudeMode = queryStringValue(
|
|
2781
|
+
groundOverlay,
|
|
2782
|
+
"altitudeMode",
|
|
2783
|
+
namespaces.kml
|
|
2784
|
+
);
|
|
2785
|
+
|
|
2786
|
+
if (defined(altitudeMode)) {
|
|
2787
|
+
if (altitudeMode === "absolute") {
|
|
2788
|
+
//Use height above ellipsoid until we support MSL.
|
|
2789
|
+
geometry.height = queryNumericValue(
|
|
2790
|
+
groundOverlay,
|
|
2791
|
+
"altitude",
|
|
2792
|
+
namespaces.kml
|
|
2793
|
+
);
|
|
2794
|
+
geometry.zIndex = undefined;
|
|
2795
|
+
} else if (altitudeMode !== "clampToGround") {
|
|
2796
|
+
oneTimeWarning(
|
|
2797
|
+
"kml-altitudeMode-unknown",
|
|
2798
|
+
`KML - Unknown altitudeMode: ${altitudeMode}`
|
|
2799
|
+
);
|
|
2800
|
+
}
|
|
2801
|
+
// else just use the default of 0 until we support 'clampToGround'
|
|
2802
|
+
} else {
|
|
2803
|
+
altitudeMode = queryStringValue(
|
|
2804
|
+
groundOverlay,
|
|
2805
|
+
"altitudeMode",
|
|
2806
|
+
namespaces.gx
|
|
2807
|
+
);
|
|
2808
|
+
if (altitudeMode === "relativeToSeaFloor") {
|
|
2809
|
+
oneTimeWarning(
|
|
2810
|
+
"kml-altitudeMode-relativeToSeaFloor",
|
|
2811
|
+
"KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute."
|
|
2812
|
+
);
|
|
2813
|
+
geometry.height = queryNumericValue(
|
|
2814
|
+
groundOverlay,
|
|
2815
|
+
"altitude",
|
|
2816
|
+
namespaces.kml
|
|
2817
|
+
);
|
|
2818
|
+
geometry.zIndex = undefined;
|
|
2819
|
+
} else if (altitudeMode === "clampToSeaFloor") {
|
|
2820
|
+
oneTimeWarning(
|
|
2821
|
+
"kml-altitudeMode-clampToSeaFloor",
|
|
2822
|
+
"KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround."
|
|
2823
|
+
);
|
|
2824
|
+
} else if (defined(altitudeMode)) {
|
|
2825
|
+
oneTimeWarning(
|
|
2826
|
+
"kml-altitudeMode-unknown",
|
|
2827
|
+
`KML - Unknown altitudeMode: ${altitudeMode}`
|
|
2828
|
+
);
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
|
|
2833
|
+
function processUnsupportedFeature(
|
|
2834
|
+
dataSource,
|
|
2835
|
+
node,
|
|
2836
|
+
processingData,
|
|
2837
|
+
deferredLoading
|
|
2838
|
+
) {
|
|
2839
|
+
dataSource._unsupportedNode.raiseEvent(
|
|
2840
|
+
dataSource,
|
|
2841
|
+
processingData.parentEntity,
|
|
2842
|
+
node,
|
|
2843
|
+
processingData.entityCollection,
|
|
2844
|
+
processingData.styleCollection,
|
|
2845
|
+
processingData.sourceResource,
|
|
2846
|
+
processingData.uriResolver
|
|
2847
|
+
);
|
|
2848
|
+
oneTimeWarning(
|
|
2849
|
+
`kml-unsupportedFeature-${node.nodeName}`,
|
|
2850
|
+
`KML - Unsupported feature: ${node.nodeName}`
|
|
2851
|
+
);
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
const RefreshMode = {
|
|
2855
|
+
INTERVAL: 0,
|
|
2856
|
+
EXPIRE: 1,
|
|
2857
|
+
STOP: 2,
|
|
2858
|
+
};
|
|
2859
|
+
|
|
2860
|
+
function cleanupString(s) {
|
|
2861
|
+
if (!defined(s) || s.length === 0) {
|
|
2862
|
+
return "";
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
const sFirst = s[0];
|
|
2866
|
+
if (sFirst === "&" || sFirst === "?") {
|
|
2867
|
+
s = s.substring(1);
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
return s;
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
const zeroRectangle = new Rectangle();
|
|
2874
|
+
const scratchCartographic = new Cartographic();
|
|
2875
|
+
const scratchCartesian2 = new Cartesian2();
|
|
2876
|
+
const scratchCartesian3 = new Cartesian3();
|
|
2877
|
+
|
|
2878
|
+
function processNetworkLinkQueryString(
|
|
2879
|
+
resource,
|
|
2880
|
+
camera,
|
|
2881
|
+
canvas,
|
|
2882
|
+
viewBoundScale,
|
|
2883
|
+
bbox,
|
|
2884
|
+
ellipsoid
|
|
2885
|
+
) {
|
|
2886
|
+
function fixLatitude(value) {
|
|
2887
|
+
if (value < -CesiumMath.PI_OVER_TWO) {
|
|
2888
|
+
return -CesiumMath.PI_OVER_TWO;
|
|
2889
|
+
} else if (value > CesiumMath.PI_OVER_TWO) {
|
|
2890
|
+
return CesiumMath.PI_OVER_TWO;
|
|
2891
|
+
}
|
|
2892
|
+
return value;
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
function fixLongitude(value) {
|
|
2896
|
+
if (value > CesiumMath.PI) {
|
|
2897
|
+
return value - CesiumMath.TWO_PI;
|
|
2898
|
+
} else if (value < -CesiumMath.PI) {
|
|
2899
|
+
return value + CesiumMath.TWO_PI;
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2902
|
+
return value;
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
let queryString = objectToQuery(resource.queryParameters);
|
|
2906
|
+
|
|
2907
|
+
// objectToQuery escapes [ and ], so fix that
|
|
2908
|
+
queryString = queryString.replace(/%5B/g, "[").replace(/%5D/g, "]");
|
|
2909
|
+
|
|
2910
|
+
if (defined(camera) && camera._mode !== SceneMode.MORPHING) {
|
|
2911
|
+
let centerCartesian;
|
|
2912
|
+
let centerCartographic;
|
|
2913
|
+
|
|
2914
|
+
bbox = defaultValue(bbox, zeroRectangle);
|
|
2915
|
+
if (defined(canvas)) {
|
|
2916
|
+
scratchCartesian2.x = canvas.clientWidth * 0.5;
|
|
2917
|
+
scratchCartesian2.y = canvas.clientHeight * 0.5;
|
|
2918
|
+
centerCartesian = camera.pickEllipsoid(
|
|
2919
|
+
scratchCartesian2,
|
|
2920
|
+
ellipsoid,
|
|
2921
|
+
scratchCartesian3
|
|
2922
|
+
);
|
|
2923
|
+
}
|
|
2924
|
+
|
|
2925
|
+
if (defined(centerCartesian)) {
|
|
2926
|
+
centerCartographic = ellipsoid.cartesianToCartographic(
|
|
2927
|
+
centerCartesian,
|
|
2928
|
+
scratchCartographic
|
|
2929
|
+
);
|
|
2930
|
+
} else {
|
|
2931
|
+
centerCartographic = Rectangle.center(bbox, scratchCartographic);
|
|
2932
|
+
centerCartesian = ellipsoid.cartographicToCartesian(centerCartographic);
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
if (
|
|
2936
|
+
defined(viewBoundScale) &&
|
|
2937
|
+
!CesiumMath.equalsEpsilon(viewBoundScale, 1.0, CesiumMath.EPSILON9)
|
|
2938
|
+
) {
|
|
2939
|
+
const newHalfWidth = bbox.width * viewBoundScale * 0.5;
|
|
2940
|
+
const newHalfHeight = bbox.height * viewBoundScale * 0.5;
|
|
2941
|
+
bbox = new Rectangle(
|
|
2942
|
+
fixLongitude(centerCartographic.longitude - newHalfWidth),
|
|
2943
|
+
fixLatitude(centerCartographic.latitude - newHalfHeight),
|
|
2944
|
+
fixLongitude(centerCartographic.longitude + newHalfWidth),
|
|
2945
|
+
fixLatitude(centerCartographic.latitude + newHalfHeight)
|
|
2946
|
+
);
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
queryString = queryString.replace(
|
|
2950
|
+
"[bboxWest]",
|
|
2951
|
+
CesiumMath.toDegrees(bbox.west).toString()
|
|
2952
|
+
);
|
|
2953
|
+
queryString = queryString.replace(
|
|
2954
|
+
"[bboxSouth]",
|
|
2955
|
+
CesiumMath.toDegrees(bbox.south).toString()
|
|
2956
|
+
);
|
|
2957
|
+
queryString = queryString.replace(
|
|
2958
|
+
"[bboxEast]",
|
|
2959
|
+
CesiumMath.toDegrees(bbox.east).toString()
|
|
2960
|
+
);
|
|
2961
|
+
queryString = queryString.replace(
|
|
2962
|
+
"[bboxNorth]",
|
|
2963
|
+
CesiumMath.toDegrees(bbox.north).toString()
|
|
2964
|
+
);
|
|
2965
|
+
|
|
2966
|
+
const lon = CesiumMath.toDegrees(centerCartographic.longitude).toString();
|
|
2967
|
+
const lat = CesiumMath.toDegrees(centerCartographic.latitude).toString();
|
|
2968
|
+
queryString = queryString.replace("[lookatLon]", lon);
|
|
2969
|
+
queryString = queryString.replace("[lookatLat]", lat);
|
|
2970
|
+
queryString = queryString.replace(
|
|
2971
|
+
"[lookatTilt]",
|
|
2972
|
+
CesiumMath.toDegrees(camera.pitch).toString()
|
|
2973
|
+
);
|
|
2974
|
+
queryString = queryString.replace(
|
|
2975
|
+
"[lookatHeading]",
|
|
2976
|
+
CesiumMath.toDegrees(camera.heading).toString()
|
|
2977
|
+
);
|
|
2978
|
+
queryString = queryString.replace(
|
|
2979
|
+
"[lookatRange]",
|
|
2980
|
+
Cartesian3.distance(camera.positionWC, centerCartesian)
|
|
2981
|
+
);
|
|
2982
|
+
queryString = queryString.replace("[lookatTerrainLon]", lon);
|
|
2983
|
+
queryString = queryString.replace("[lookatTerrainLat]", lat);
|
|
2984
|
+
queryString = queryString.replace(
|
|
2985
|
+
"[lookatTerrainAlt]",
|
|
2986
|
+
centerCartographic.height.toString()
|
|
2987
|
+
);
|
|
2988
|
+
|
|
2989
|
+
ellipsoid.cartesianToCartographic(camera.positionWC, scratchCartographic);
|
|
2990
|
+
queryString = queryString.replace(
|
|
2991
|
+
"[cameraLon]",
|
|
2992
|
+
CesiumMath.toDegrees(scratchCartographic.longitude).toString()
|
|
2993
|
+
);
|
|
2994
|
+
queryString = queryString.replace(
|
|
2995
|
+
"[cameraLat]",
|
|
2996
|
+
CesiumMath.toDegrees(scratchCartographic.latitude).toString()
|
|
2997
|
+
);
|
|
2998
|
+
queryString = queryString.replace(
|
|
2999
|
+
"[cameraAlt]",
|
|
3000
|
+
CesiumMath.toDegrees(scratchCartographic.height).toString()
|
|
3001
|
+
);
|
|
3002
|
+
|
|
3003
|
+
const frustum = camera.frustum;
|
|
3004
|
+
const aspectRatio = frustum.aspectRatio;
|
|
3005
|
+
let horizFov = "";
|
|
3006
|
+
let vertFov = "";
|
|
3007
|
+
if (defined(aspectRatio)) {
|
|
3008
|
+
const fov = CesiumMath.toDegrees(frustum.fov);
|
|
3009
|
+
if (aspectRatio > 1.0) {
|
|
3010
|
+
horizFov = fov;
|
|
3011
|
+
vertFov = fov / aspectRatio;
|
|
3012
|
+
} else {
|
|
3013
|
+
vertFov = fov;
|
|
3014
|
+
horizFov = fov * aspectRatio;
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
queryString = queryString.replace("[horizFov]", horizFov.toString());
|
|
3018
|
+
queryString = queryString.replace("[vertFov]", vertFov.toString());
|
|
3019
|
+
} else {
|
|
3020
|
+
queryString = queryString.replace("[bboxWest]", "-180");
|
|
3021
|
+
queryString = queryString.replace("[bboxSouth]", "-90");
|
|
3022
|
+
queryString = queryString.replace("[bboxEast]", "180");
|
|
3023
|
+
queryString = queryString.replace("[bboxNorth]", "90");
|
|
3024
|
+
|
|
3025
|
+
queryString = queryString.replace("[lookatLon]", "");
|
|
3026
|
+
queryString = queryString.replace("[lookatLat]", "");
|
|
3027
|
+
queryString = queryString.replace("[lookatRange]", "");
|
|
3028
|
+
queryString = queryString.replace("[lookatTilt]", "");
|
|
3029
|
+
queryString = queryString.replace("[lookatHeading]", "");
|
|
3030
|
+
queryString = queryString.replace("[lookatTerrainLon]", "");
|
|
3031
|
+
queryString = queryString.replace("[lookatTerrainLat]", "");
|
|
3032
|
+
queryString = queryString.replace("[lookatTerrainAlt]", "");
|
|
3033
|
+
|
|
3034
|
+
queryString = queryString.replace("[cameraLon]", "");
|
|
3035
|
+
queryString = queryString.replace("[cameraLat]", "");
|
|
3036
|
+
queryString = queryString.replace("[cameraAlt]", "");
|
|
3037
|
+
queryString = queryString.replace("[horizFov]", "");
|
|
3038
|
+
queryString = queryString.replace("[vertFov]", "");
|
|
3039
|
+
}
|
|
3040
|
+
|
|
3041
|
+
if (defined(canvas)) {
|
|
3042
|
+
queryString = queryString.replace("[horizPixels]", canvas.clientWidth);
|
|
3043
|
+
queryString = queryString.replace("[vertPixels]", canvas.clientHeight);
|
|
3044
|
+
} else {
|
|
3045
|
+
queryString = queryString.replace("[horizPixels]", "");
|
|
3046
|
+
queryString = queryString.replace("[vertPixels]", "");
|
|
3047
|
+
}
|
|
3048
|
+
|
|
3049
|
+
queryString = queryString.replace("[terrainEnabled]", "1");
|
|
3050
|
+
queryString = queryString.replace("[clientVersion]", "1");
|
|
3051
|
+
queryString = queryString.replace("[kmlVersion]", "2.2");
|
|
3052
|
+
queryString = queryString.replace("[clientName]", "Cesium");
|
|
3053
|
+
queryString = queryString.replace("[language]", "English");
|
|
3054
|
+
|
|
3055
|
+
resource.setQueryParameters(queryToObject(queryString));
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
function processNetworkLink(dataSource, node, processingData, deferredLoading) {
|
|
3059
|
+
const r = processFeature(dataSource, node, processingData);
|
|
3060
|
+
const networkEntity = r.entity;
|
|
3061
|
+
|
|
3062
|
+
const sourceResource = processingData.sourceResource;
|
|
3063
|
+
const uriResolver = processingData.uriResolver;
|
|
3064
|
+
|
|
3065
|
+
let link = queryFirstNode(node, "Link", namespaces.kml);
|
|
3066
|
+
|
|
3067
|
+
if (!defined(link)) {
|
|
3068
|
+
link = queryFirstNode(node, "Url", namespaces.kml);
|
|
3069
|
+
}
|
|
3070
|
+
if (defined(link)) {
|
|
3071
|
+
let href = queryStringValue(link, "href", namespaces.kml);
|
|
3072
|
+
let viewRefreshMode;
|
|
3073
|
+
let viewBoundScale;
|
|
3074
|
+
if (defined(href)) {
|
|
3075
|
+
let newSourceUri = href;
|
|
3076
|
+
href = resolveHref(href, sourceResource, processingData.uriResolver);
|
|
3077
|
+
|
|
3078
|
+
// We need to pass in the original path if resolveHref returns a data uri because the network link
|
|
3079
|
+
// references a document in a KMZ archive
|
|
3080
|
+
if (/^data:/.test(href.getUrlComponent())) {
|
|
3081
|
+
// So if sourceUri isn't the kmz file, then its another kml in the archive, so resolve it
|
|
3082
|
+
if (!/\.kmz/i.test(sourceResource.getUrlComponent())) {
|
|
3083
|
+
newSourceUri = sourceResource.getDerivedResource({
|
|
3084
|
+
url: newSourceUri,
|
|
3085
|
+
});
|
|
3086
|
+
}
|
|
3087
|
+
} else {
|
|
3088
|
+
newSourceUri = href.clone(); // Not a data uri so use the fully qualified uri
|
|
3089
|
+
viewRefreshMode = queryStringValue(
|
|
3090
|
+
link,
|
|
3091
|
+
"viewRefreshMode",
|
|
3092
|
+
namespaces.kml
|
|
3093
|
+
);
|
|
3094
|
+
if (viewRefreshMode === "onRegion") {
|
|
3095
|
+
oneTimeWarning(
|
|
3096
|
+
"kml-refrehMode-onRegion",
|
|
3097
|
+
"KML - Unsupported viewRefreshMode: onRegion"
|
|
3098
|
+
);
|
|
3099
|
+
return;
|
|
3100
|
+
}
|
|
3101
|
+
viewBoundScale = defaultValue(
|
|
3102
|
+
queryStringValue(link, "viewBoundScale", namespaces.kml),
|
|
3103
|
+
1.0
|
|
3104
|
+
);
|
|
3105
|
+
const defaultViewFormat =
|
|
3106
|
+
viewRefreshMode === "onStop"
|
|
3107
|
+
? "BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]"
|
|
3108
|
+
: "";
|
|
3109
|
+
const viewFormat = defaultValue(
|
|
3110
|
+
queryStringValue(link, "viewFormat", namespaces.kml),
|
|
3111
|
+
defaultViewFormat
|
|
3112
|
+
);
|
|
3113
|
+
const httpQuery = queryStringValue(link, "httpQuery", namespaces.kml);
|
|
3114
|
+
if (defined(viewFormat)) {
|
|
3115
|
+
href.setQueryParameters(queryToObject(cleanupString(viewFormat)));
|
|
3116
|
+
}
|
|
3117
|
+
if (defined(httpQuery)) {
|
|
3118
|
+
href.setQueryParameters(queryToObject(cleanupString(httpQuery)));
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3121
|
+
const ellipsoid = dataSource._ellipsoid;
|
|
3122
|
+
processNetworkLinkQueryString(
|
|
3123
|
+
href,
|
|
3124
|
+
dataSource.camera,
|
|
3125
|
+
dataSource.canvas,
|
|
3126
|
+
viewBoundScale,
|
|
3127
|
+
dataSource._lastCameraView.bbox,
|
|
3128
|
+
ellipsoid
|
|
3129
|
+
);
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
const options = {
|
|
3133
|
+
sourceUri: newSourceUri,
|
|
3134
|
+
uriResolver: uriResolver,
|
|
3135
|
+
context: networkEntity.id,
|
|
3136
|
+
screenOverlayContainer: processingData.screenOverlayContainer,
|
|
3137
|
+
};
|
|
3138
|
+
const networkLinkCollection = new EntityCollection();
|
|
3139
|
+
const promise = load(dataSource, networkLinkCollection, href, options)
|
|
3140
|
+
.then(function (rootElement) {
|
|
3141
|
+
const entities = dataSource._entityCollection;
|
|
3142
|
+
const newEntities = networkLinkCollection.values;
|
|
3143
|
+
entities.suspendEvents();
|
|
3144
|
+
for (let i = 0; i < newEntities.length; i++) {
|
|
3145
|
+
const newEntity = newEntities[i];
|
|
3146
|
+
if (!defined(newEntity.parent)) {
|
|
3147
|
+
newEntity.parent = networkEntity;
|
|
3148
|
+
mergeAvailabilityWithParent(newEntity);
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
entities.add(newEntity);
|
|
3152
|
+
}
|
|
3153
|
+
entities.resumeEvents();
|
|
3154
|
+
|
|
3155
|
+
// Add network links to a list if we need they will need to be updated
|
|
3156
|
+
const refreshMode = queryStringValue(
|
|
3157
|
+
link,
|
|
3158
|
+
"refreshMode",
|
|
3159
|
+
namespaces.kml
|
|
3160
|
+
);
|
|
3161
|
+
let refreshInterval = defaultValue(
|
|
3162
|
+
queryNumericValue(link, "refreshInterval", namespaces.kml),
|
|
3163
|
+
0
|
|
3164
|
+
);
|
|
3165
|
+
if (
|
|
3166
|
+
(refreshMode === "onInterval" && refreshInterval > 0) ||
|
|
3167
|
+
refreshMode === "onExpire" ||
|
|
3168
|
+
viewRefreshMode === "onStop"
|
|
3169
|
+
) {
|
|
3170
|
+
const networkLinkControl = queryFirstNode(
|
|
3171
|
+
rootElement,
|
|
3172
|
+
"NetworkLinkControl",
|
|
3173
|
+
namespaces.kml
|
|
3174
|
+
);
|
|
3175
|
+
const hasNetworkLinkControl = defined(networkLinkControl);
|
|
3176
|
+
|
|
3177
|
+
const now = JulianDate.now();
|
|
3178
|
+
const networkLinkInfo = {
|
|
3179
|
+
id: createGuid(),
|
|
3180
|
+
href: href,
|
|
3181
|
+
cookie: {},
|
|
3182
|
+
lastUpdated: now,
|
|
3183
|
+
updating: false,
|
|
3184
|
+
entity: networkEntity,
|
|
3185
|
+
viewBoundScale: viewBoundScale,
|
|
3186
|
+
needsUpdate: false,
|
|
3187
|
+
cameraUpdateTime: now,
|
|
3188
|
+
};
|
|
3189
|
+
|
|
3190
|
+
let minRefreshPeriod = 0;
|
|
3191
|
+
if (hasNetworkLinkControl) {
|
|
3192
|
+
networkLinkInfo.cookie = queryToObject(
|
|
3193
|
+
defaultValue(
|
|
3194
|
+
queryStringValue(
|
|
3195
|
+
networkLinkControl,
|
|
3196
|
+
"cookie",
|
|
3197
|
+
namespaces.kml
|
|
3198
|
+
),
|
|
3199
|
+
""
|
|
3200
|
+
)
|
|
3201
|
+
);
|
|
3202
|
+
minRefreshPeriod = defaultValue(
|
|
3203
|
+
queryNumericValue(
|
|
3204
|
+
networkLinkControl,
|
|
3205
|
+
"minRefreshPeriod",
|
|
3206
|
+
namespaces.kml
|
|
3207
|
+
),
|
|
3208
|
+
0
|
|
3209
|
+
);
|
|
3210
|
+
}
|
|
3211
|
+
|
|
3212
|
+
if (refreshMode === "onInterval") {
|
|
3213
|
+
if (hasNetworkLinkControl) {
|
|
3214
|
+
refreshInterval = Math.max(minRefreshPeriod, refreshInterval);
|
|
3215
|
+
}
|
|
3216
|
+
networkLinkInfo.refreshMode = RefreshMode.INTERVAL;
|
|
3217
|
+
networkLinkInfo.time = refreshInterval;
|
|
3218
|
+
} else if (refreshMode === "onExpire") {
|
|
3219
|
+
let expires;
|
|
3220
|
+
if (hasNetworkLinkControl) {
|
|
3221
|
+
expires = queryStringValue(
|
|
3222
|
+
networkLinkControl,
|
|
3223
|
+
"expires",
|
|
3224
|
+
namespaces.kml
|
|
3225
|
+
);
|
|
3226
|
+
}
|
|
3227
|
+
if (defined(expires)) {
|
|
3228
|
+
try {
|
|
3229
|
+
const date = JulianDate.fromIso8601(expires);
|
|
3230
|
+
const diff = JulianDate.secondsDifference(date, now);
|
|
3231
|
+
if (diff > 0 && diff < minRefreshPeriod) {
|
|
3232
|
+
JulianDate.addSeconds(now, minRefreshPeriod, date);
|
|
3233
|
+
}
|
|
3234
|
+
networkLinkInfo.refreshMode = RefreshMode.EXPIRE;
|
|
3235
|
+
networkLinkInfo.time = date;
|
|
3236
|
+
} catch (e) {
|
|
3237
|
+
oneTimeWarning(
|
|
3238
|
+
"kml-refreshMode-onInterval-onExpire",
|
|
3239
|
+
"KML - NetworkLinkControl expires is not a valid date"
|
|
3240
|
+
);
|
|
3241
|
+
}
|
|
3242
|
+
} else {
|
|
3243
|
+
oneTimeWarning(
|
|
3244
|
+
"kml-refreshMode-onExpire",
|
|
3245
|
+
"KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element"
|
|
3246
|
+
);
|
|
3247
|
+
}
|
|
3248
|
+
} else if (defined(dataSource.camera)) {
|
|
3249
|
+
// Only allow onStop refreshes if we have a camera
|
|
3250
|
+
networkLinkInfo.refreshMode = RefreshMode.STOP;
|
|
3251
|
+
networkLinkInfo.time = defaultValue(
|
|
3252
|
+
queryNumericValue(link, "viewRefreshTime", namespaces.kml),
|
|
3253
|
+
0
|
|
3254
|
+
);
|
|
3255
|
+
} else {
|
|
3256
|
+
oneTimeWarning(
|
|
3257
|
+
"kml-refrehMode-onStop-noCamera",
|
|
3258
|
+
"A NetworkLink with viewRefreshMode=onStop requires the `camera` property to be defined."
|
|
3259
|
+
);
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
if (defined(networkLinkInfo.refreshMode)) {
|
|
3263
|
+
dataSource._networkLinks.set(networkLinkInfo.id, networkLinkInfo);
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
})
|
|
3267
|
+
.catch(function (error) {
|
|
3268
|
+
oneTimeWarning(`An error occured during loading ${href.url}`);
|
|
3269
|
+
dataSource._error.raiseEvent(dataSource, error);
|
|
3270
|
+
});
|
|
3271
|
+
|
|
3272
|
+
deferredLoading.addPromise(promise);
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
|
|
3277
|
+
function processFeatureNode(dataSource, node, processingData, deferredLoading) {
|
|
3278
|
+
const featureProcessor = featureTypes[node.localName];
|
|
3279
|
+
if (defined(featureProcessor)) {
|
|
3280
|
+
return featureProcessor(dataSource, node, processingData, deferredLoading);
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
return processUnsupportedFeature(
|
|
3284
|
+
dataSource,
|
|
3285
|
+
node,
|
|
3286
|
+
processingData,
|
|
3287
|
+
deferredLoading
|
|
3288
|
+
);
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3291
|
+
function loadKml(
|
|
3292
|
+
dataSource,
|
|
3293
|
+
entityCollection,
|
|
3294
|
+
kml,
|
|
3295
|
+
sourceResource,
|
|
3296
|
+
uriResolver,
|
|
3297
|
+
screenOverlayContainer,
|
|
3298
|
+
context
|
|
3299
|
+
) {
|
|
3300
|
+
entityCollection.removeAll();
|
|
3301
|
+
|
|
3302
|
+
const documentElement = kml.documentElement;
|
|
3303
|
+
const document =
|
|
3304
|
+
documentElement.localName === "Document"
|
|
3305
|
+
? documentElement
|
|
3306
|
+
: queryFirstNode(documentElement, "Document", namespaces.kml);
|
|
3307
|
+
let name = queryStringValue(document, "name", namespaces.kml);
|
|
3308
|
+
if (!defined(name)) {
|
|
3309
|
+
name = getFilenameFromUri(sourceResource.getUrlComponent());
|
|
3310
|
+
}
|
|
3311
|
+
|
|
3312
|
+
// Only set the name from the root document
|
|
3313
|
+
if (!defined(dataSource._name)) {
|
|
3314
|
+
dataSource._name = name;
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
const deferredLoading = new KmlDataSource._DeferredLoading(dataSource);
|
|
3318
|
+
const styleCollection = new EntityCollection(dataSource);
|
|
3319
|
+
return Promise.all(
|
|
3320
|
+
processStyles(
|
|
3321
|
+
dataSource,
|
|
3322
|
+
kml,
|
|
3323
|
+
styleCollection,
|
|
3324
|
+
sourceResource,
|
|
3325
|
+
false,
|
|
3326
|
+
uriResolver
|
|
3327
|
+
)
|
|
3328
|
+
).then(function () {
|
|
3329
|
+
let element = kml.documentElement;
|
|
3330
|
+
if (element.localName === "kml") {
|
|
3331
|
+
const childNodes = element.childNodes;
|
|
3332
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
3333
|
+
const tmp = childNodes[i];
|
|
3334
|
+
if (defined(featureTypes[tmp.localName])) {
|
|
3335
|
+
element = tmp;
|
|
3336
|
+
break;
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
|
|
3341
|
+
const processingData = {
|
|
3342
|
+
parentEntity: undefined,
|
|
3343
|
+
entityCollection: entityCollection,
|
|
3344
|
+
styleCollection: styleCollection,
|
|
3345
|
+
sourceResource: sourceResource,
|
|
3346
|
+
uriResolver: uriResolver,
|
|
3347
|
+
context: context,
|
|
3348
|
+
screenOverlayContainer: screenOverlayContainer,
|
|
3349
|
+
};
|
|
3350
|
+
|
|
3351
|
+
entityCollection.suspendEvents();
|
|
3352
|
+
processFeatureNode(dataSource, element, processingData, deferredLoading);
|
|
3353
|
+
entityCollection.resumeEvents();
|
|
3354
|
+
|
|
3355
|
+
return deferredLoading.wait().then(function () {
|
|
3356
|
+
return kml.documentElement;
|
|
3357
|
+
});
|
|
3358
|
+
});
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3361
|
+
function loadKmz(
|
|
3362
|
+
dataSource,
|
|
3363
|
+
entityCollection,
|
|
3364
|
+
blob,
|
|
3365
|
+
sourceResource,
|
|
3366
|
+
screenOverlayContainer
|
|
3367
|
+
) {
|
|
3368
|
+
const zWorkerUrl = buildModuleUrl("ThirdParty/Workers/z-worker-pako.js");
|
|
3369
|
+
zip.configure({
|
|
3370
|
+
workerScripts: {
|
|
3371
|
+
deflate: [zWorkerUrl, "./pako_deflate.min.js"],
|
|
3372
|
+
inflate: [zWorkerUrl, "./pako_inflate.min.js"],
|
|
3373
|
+
},
|
|
3374
|
+
});
|
|
3375
|
+
|
|
3376
|
+
const reader = new zip.ZipReader(new zip.BlobReader(blob));
|
|
3377
|
+
return Promise.resolve(reader.getEntries()).then(function (entries) {
|
|
3378
|
+
const promises = [];
|
|
3379
|
+
const uriResolver = {};
|
|
3380
|
+
let docEntry;
|
|
3381
|
+
for (let i = 0; i < entries.length; i++) {
|
|
3382
|
+
const entry = entries[i];
|
|
3383
|
+
if (!entry.directory) {
|
|
3384
|
+
if (/\.kml$/i.test(entry.filename)) {
|
|
3385
|
+
// We use the first KML document we come across
|
|
3386
|
+
// https://developers.google.com/kml/documentation/kmzarchives
|
|
3387
|
+
// Unless we come across a .kml file at the root of the archive because GE does this
|
|
3388
|
+
if (!defined(docEntry) || !/\//i.test(entry.filename)) {
|
|
3389
|
+
if (defined(docEntry)) {
|
|
3390
|
+
// We found one at the root so load the initial kml as a data uri
|
|
3391
|
+
promises.push(loadDataUriFromZip(docEntry, uriResolver));
|
|
3392
|
+
}
|
|
3393
|
+
docEntry = entry;
|
|
3394
|
+
} else {
|
|
3395
|
+
// Wasn't the first kml and wasn't at the root
|
|
3396
|
+
promises.push(loadDataUriFromZip(entry, uriResolver));
|
|
3397
|
+
}
|
|
3398
|
+
} else {
|
|
3399
|
+
promises.push(loadDataUriFromZip(entry, uriResolver));
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
|
|
3404
|
+
// Now load the root KML document
|
|
3405
|
+
if (defined(docEntry)) {
|
|
3406
|
+
promises.push(loadXmlFromZip(docEntry, uriResolver));
|
|
3407
|
+
}
|
|
3408
|
+
return Promise.all(promises).then(function () {
|
|
3409
|
+
reader.close();
|
|
3410
|
+
if (!defined(uriResolver.kml)) {
|
|
3411
|
+
throw new RuntimeError("KMZ file does not contain a KML document.");
|
|
3412
|
+
}
|
|
3413
|
+
uriResolver.keys = Object.keys(uriResolver);
|
|
3414
|
+
return loadKml(
|
|
3415
|
+
dataSource,
|
|
3416
|
+
entityCollection,
|
|
3417
|
+
uriResolver.kml,
|
|
3418
|
+
sourceResource,
|
|
3419
|
+
uriResolver,
|
|
3420
|
+
screenOverlayContainer
|
|
3421
|
+
);
|
|
3422
|
+
});
|
|
3423
|
+
});
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
function load(dataSource, entityCollection, data, options) {
|
|
3427
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
3428
|
+
let sourceUri = options.sourceUri;
|
|
3429
|
+
const uriResolver = options.uriResolver;
|
|
3430
|
+
const context = options.context;
|
|
3431
|
+
let screenOverlayContainer = options.screenOverlayContainer;
|
|
3432
|
+
|
|
3433
|
+
let promise = data;
|
|
3434
|
+
if (typeof data === "string" || data instanceof Resource) {
|
|
3435
|
+
data = Resource.createIfNeeded(data);
|
|
3436
|
+
promise = data.fetchBlob();
|
|
3437
|
+
sourceUri = defaultValue(sourceUri, data.clone());
|
|
3438
|
+
|
|
3439
|
+
// Add resource credits to our list of credits to display
|
|
3440
|
+
const resourceCredits = dataSource._resourceCredits;
|
|
3441
|
+
const credits = data.credits;
|
|
3442
|
+
if (defined(credits)) {
|
|
3443
|
+
const length = credits.length;
|
|
3444
|
+
for (let i = 0; i < length; i++) {
|
|
3445
|
+
resourceCredits.push(credits[i]);
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
} else {
|
|
3449
|
+
sourceUri = defaultValue(sourceUri, Resource.DEFAULT.clone());
|
|
3450
|
+
}
|
|
3451
|
+
|
|
3452
|
+
sourceUri = Resource.createIfNeeded(sourceUri);
|
|
3453
|
+
|
|
3454
|
+
if (defined(screenOverlayContainer)) {
|
|
3455
|
+
screenOverlayContainer = getElement(screenOverlayContainer);
|
|
3456
|
+
}
|
|
3457
|
+
|
|
3458
|
+
return Promise.resolve(promise)
|
|
3459
|
+
.then(function (dataToLoad) {
|
|
3460
|
+
if (dataToLoad instanceof Blob) {
|
|
3461
|
+
return isZipFile(dataToLoad).then(function (isZip) {
|
|
3462
|
+
if (isZip) {
|
|
3463
|
+
return loadKmz(
|
|
3464
|
+
dataSource,
|
|
3465
|
+
entityCollection,
|
|
3466
|
+
dataToLoad,
|
|
3467
|
+
sourceUri,
|
|
3468
|
+
screenOverlayContainer
|
|
3469
|
+
);
|
|
3470
|
+
}
|
|
3471
|
+
return readBlobAsText(dataToLoad).then(function (text) {
|
|
3472
|
+
//There's no official way to validate if a parse was successful.
|
|
3473
|
+
//The following check detects the error on various browsers.
|
|
3474
|
+
|
|
3475
|
+
//Insert missing namespaces
|
|
3476
|
+
text = insertNamespaces(text);
|
|
3477
|
+
|
|
3478
|
+
//Remove Duplicate Namespaces
|
|
3479
|
+
text = removeDuplicateNamespaces(text);
|
|
3480
|
+
|
|
3481
|
+
//IE raises an exception
|
|
3482
|
+
let kml;
|
|
3483
|
+
let error;
|
|
3484
|
+
try {
|
|
3485
|
+
kml = parser.parseFromString(text, "application/xml");
|
|
3486
|
+
} catch (e) {
|
|
3487
|
+
error = e.toString();
|
|
3488
|
+
}
|
|
3489
|
+
|
|
3490
|
+
//The parse succeeds on Chrome and Firefox, but the error
|
|
3491
|
+
//handling is different in each.
|
|
3492
|
+
if (
|
|
3493
|
+
defined(error) ||
|
|
3494
|
+
kml.body ||
|
|
3495
|
+
kml.documentElement.tagName === "parsererror"
|
|
3496
|
+
) {
|
|
3497
|
+
//Firefox has error information as the firstChild nodeValue.
|
|
3498
|
+
let msg = defined(error)
|
|
3499
|
+
? error
|
|
3500
|
+
: kml.documentElement.firstChild.nodeValue;
|
|
3501
|
+
|
|
3502
|
+
//Chrome has it in the body text.
|
|
3503
|
+
if (!msg) {
|
|
3504
|
+
msg = kml.body.innerText;
|
|
3505
|
+
}
|
|
3506
|
+
|
|
3507
|
+
//Return the error
|
|
3508
|
+
throw new RuntimeError(msg);
|
|
3509
|
+
}
|
|
3510
|
+
return loadKml(
|
|
3511
|
+
dataSource,
|
|
3512
|
+
entityCollection,
|
|
3513
|
+
kml,
|
|
3514
|
+
sourceUri,
|
|
3515
|
+
uriResolver,
|
|
3516
|
+
screenOverlayContainer,
|
|
3517
|
+
context
|
|
3518
|
+
);
|
|
3519
|
+
});
|
|
3520
|
+
});
|
|
3521
|
+
}
|
|
3522
|
+
return loadKml(
|
|
3523
|
+
dataSource,
|
|
3524
|
+
entityCollection,
|
|
3525
|
+
dataToLoad,
|
|
3526
|
+
sourceUri,
|
|
3527
|
+
uriResolver,
|
|
3528
|
+
screenOverlayContainer,
|
|
3529
|
+
context
|
|
3530
|
+
);
|
|
3531
|
+
})
|
|
3532
|
+
.catch(function (error) {
|
|
3533
|
+
dataSource._error.raiseEvent(dataSource, error);
|
|
3534
|
+
console.log(error);
|
|
3535
|
+
return Promise.reject(error);
|
|
3536
|
+
});
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
// NOTE: LoadOptions properties are repeated in ConstructorOptions because some
|
|
3540
|
+
// tooling does not support "base types" for @typedef. Remove if/when
|
|
3541
|
+
// https://github.com/microsoft/TypeScript/issues/20077 and/or
|
|
3542
|
+
// https://github.com/jsdoc/jsdoc/issues/1199 actually get resolved
|
|
3543
|
+
/**
|
|
3544
|
+
* @typedef {Object} KmlDataSource.LoadOptions
|
|
3545
|
+
*
|
|
3546
|
+
* Initialization options for the `load` method.
|
|
3547
|
+
*
|
|
3548
|
+
* @property {String} [sourceUri] Overrides the url to use for resolving relative links and other KML network features.
|
|
3549
|
+
* @property {Boolean} [clampToGround=false] true if we want the geometry features (Polygons, LineStrings and LinearRings) clamped to the ground.
|
|
3550
|
+
* @property {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The global ellipsoid used for geographical calculations.
|
|
3551
|
+
* @property {Element|String} [screenOverlayContainer] A container for ScreenOverlay images.
|
|
3552
|
+
*/
|
|
3553
|
+
|
|
3554
|
+
/**
|
|
3555
|
+
* @typedef {Object} KmlDataSource.ConstructorOptions
|
|
3556
|
+
*
|
|
3557
|
+
* Options for constructing a new KmlDataSource, or calling the static `load` method.
|
|
3558
|
+
*
|
|
3559
|
+
* @property {Camera} [camera] The camera that is used for viewRefreshModes and sending camera properties to network links.
|
|
3560
|
+
* @property {HTMLCanvasElement} [canvas] The canvas that is used for sending viewer properties to network links.
|
|
3561
|
+
* @property {Credit|String} [credit] A credit for the data source, which is displayed on the canvas.
|
|
3562
|
+
*
|
|
3563
|
+
* @property {String} [sourceUri] Overrides the url to use for resolving relative links and other KML network features.
|
|
3564
|
+
* @property {Boolean} [clampToGround=false] true if we want the geometry features (Polygons, LineStrings and LinearRings) clamped to the ground.
|
|
3565
|
+
* @property {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The global ellipsoid used for geographical calculations.
|
|
3566
|
+
* @property {Element|String} [screenOverlayContainer] A container for ScreenOverlay images.
|
|
3567
|
+
|
|
3568
|
+
*/
|
|
3569
|
+
|
|
3570
|
+
/**
|
|
3571
|
+
* A {@link DataSource} which processes Keyhole Markup Language 2.2 (KML).
|
|
3572
|
+
* <p>
|
|
3573
|
+
* KML support in Cesium is incomplete, but a large amount of the standard,
|
|
3574
|
+
* as well as Google's <code>gx</code> extension namespace, is supported. See Github issue
|
|
3575
|
+
* {@link https://github.com/CesiumGS/cesium/issues/873|#873} for a
|
|
3576
|
+
* detailed list of what is and isn't supported. Cesium will also write information to the
|
|
3577
|
+
* console when it encounters most unsupported features.
|
|
3578
|
+
* </p>
|
|
3579
|
+
* <p>
|
|
3580
|
+
* Non visual feature data, such as <code>atom:author</code> and <code>ExtendedData</code>
|
|
3581
|
+
* is exposed via an instance of {@link KmlFeatureData}, which is added to each {@link Entity}
|
|
3582
|
+
* under the <code>kml</code> property.
|
|
3583
|
+
* </p>
|
|
3584
|
+
*
|
|
3585
|
+
* @alias KmlDataSource
|
|
3586
|
+
* @constructor
|
|
3587
|
+
*
|
|
3588
|
+
* @param {KmlDataSource.ConstructorOptions} [options] Object describing initialization options
|
|
3589
|
+
*
|
|
3590
|
+
* @see {@link http://www.opengeospatial.org/standards/kml/|Open Geospatial Consortium KML Standard}
|
|
3591
|
+
* @see {@link https://developers.google.com/kml/|Google KML Documentation}
|
|
3592
|
+
*
|
|
3593
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?src=KML.html|Cesium Sandcastle KML Demo}
|
|
3594
|
+
*
|
|
3595
|
+
* @example
|
|
3596
|
+
* const viewer = new Cesium.Viewer('cesiumContainer');
|
|
3597
|
+
* viewer.dataSources.add(Cesium.KmlDataSource.load('../../SampleData/facilities.kmz',
|
|
3598
|
+
* {
|
|
3599
|
+
* camera: viewer.scene.camera,
|
|
3600
|
+
* canvas: viewer.scene.canvas
|
|
3601
|
+
* })
|
|
3602
|
+
* );
|
|
3603
|
+
*/
|
|
3604
|
+
function KmlDataSource(options) {
|
|
3605
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
3606
|
+
const camera = options.camera;
|
|
3607
|
+
const canvas = options.canvas;
|
|
3608
|
+
|
|
3609
|
+
this._changed = new Event();
|
|
3610
|
+
this._error = new Event();
|
|
3611
|
+
this._loading = new Event();
|
|
3612
|
+
this._refresh = new Event();
|
|
3613
|
+
this._unsupportedNode = new Event();
|
|
3614
|
+
|
|
3615
|
+
this._clock = undefined;
|
|
3616
|
+
this._entityCollection = new EntityCollection(this);
|
|
3617
|
+
this._name = undefined;
|
|
3618
|
+
this._isLoading = false;
|
|
3619
|
+
this._pinBuilder = new PinBuilder();
|
|
3620
|
+
this._networkLinks = new AssociativeArray();
|
|
3621
|
+
this._entityCluster = new EntityCluster();
|
|
3622
|
+
|
|
3623
|
+
/**
|
|
3624
|
+
* The current size of this Canvas will be used to populate the Link parameters
|
|
3625
|
+
* for client height and width.
|
|
3626
|
+
*
|
|
3627
|
+
* @type {HTMLCanvasElement | undefined}
|
|
3628
|
+
*/
|
|
3629
|
+
this.canvas = canvas;
|
|
3630
|
+
|
|
3631
|
+
/**
|
|
3632
|
+
* The position and orientation of this {@link Camera} will be used to
|
|
3633
|
+
* populate various camera parameters when making network requests.
|
|
3634
|
+
* Camera movement will determine when to trigger NetworkLink refresh if
|
|
3635
|
+
* <code>viewRefreshMode</code> is <code>onStop</code>.
|
|
3636
|
+
*
|
|
3637
|
+
* @type {Camera | undefined}
|
|
3638
|
+
*/
|
|
3639
|
+
this.camera = camera;
|
|
3640
|
+
|
|
3641
|
+
this._lastCameraView = {
|
|
3642
|
+
position: defined(camera) ? Cartesian3.clone(camera.positionWC) : undefined,
|
|
3643
|
+
direction: defined(camera)
|
|
3644
|
+
? Cartesian3.clone(camera.directionWC)
|
|
3645
|
+
: undefined,
|
|
3646
|
+
up: defined(camera) ? Cartesian3.clone(camera.upWC) : undefined,
|
|
3647
|
+
bbox: defined(camera)
|
|
3648
|
+
? camera.computeViewRectangle()
|
|
3649
|
+
: Rectangle.clone(Rectangle.MAX_VALUE),
|
|
3650
|
+
};
|
|
3651
|
+
|
|
3652
|
+
this._ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
|
|
3653
|
+
|
|
3654
|
+
// User specified credit
|
|
3655
|
+
let credit = options.credit;
|
|
3656
|
+
if (typeof credit === "string") {
|
|
3657
|
+
credit = new Credit(credit);
|
|
3658
|
+
}
|
|
3659
|
+
this._credit = credit;
|
|
3660
|
+
|
|
3661
|
+
// Create a list of Credit's from the resource that the user can't remove
|
|
3662
|
+
this._resourceCredits = [];
|
|
3663
|
+
|
|
3664
|
+
this._kmlTours = [];
|
|
3665
|
+
|
|
3666
|
+
this._screenOverlays = [];
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3669
|
+
/**
|
|
3670
|
+
* Creates a Promise to a new instance loaded with the provided KML data.
|
|
3671
|
+
*
|
|
3672
|
+
* @param {Resource|String|Document|Blob} data A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document.
|
|
3673
|
+
* @param {KmlDataSource.ConstructorOptions} [options] An object specifying configuration options
|
|
3674
|
+
*
|
|
3675
|
+
* @returns {Promise.<KmlDataSource>} A promise that will resolve to a new KmlDataSource instance once the KML is loaded.
|
|
3676
|
+
*/
|
|
3677
|
+
KmlDataSource.load = function (data, options) {
|
|
3678
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
3679
|
+
const dataSource = new KmlDataSource(options);
|
|
3680
|
+
return dataSource.load(data, options);
|
|
3681
|
+
};
|
|
3682
|
+
|
|
3683
|
+
Object.defineProperties(KmlDataSource.prototype, {
|
|
3684
|
+
/**
|
|
3685
|
+
* Gets or sets a human-readable name for this instance.
|
|
3686
|
+
* This will be automatically be set to the KML document name on load.
|
|
3687
|
+
* @memberof KmlDataSource.prototype
|
|
3688
|
+
* @type {String}
|
|
3689
|
+
*/
|
|
3690
|
+
name: {
|
|
3691
|
+
get: function () {
|
|
3692
|
+
return this._name;
|
|
3693
|
+
},
|
|
3694
|
+
set: function (value) {
|
|
3695
|
+
if (this._name !== value) {
|
|
3696
|
+
this._name = value;
|
|
3697
|
+
this._changed.raiseEvent(this);
|
|
3698
|
+
}
|
|
3699
|
+
},
|
|
3700
|
+
},
|
|
3701
|
+
/**
|
|
3702
|
+
* Gets the clock settings defined by the loaded KML. This represents the total
|
|
3703
|
+
* availability interval for all time-dynamic data. If the KML does not contain
|
|
3704
|
+
* time-dynamic data, this value is undefined.
|
|
3705
|
+
* @memberof KmlDataSource.prototype
|
|
3706
|
+
* @type {DataSourceClock}
|
|
3707
|
+
*/
|
|
3708
|
+
clock: {
|
|
3709
|
+
get: function () {
|
|
3710
|
+
return this._clock;
|
|
3711
|
+
},
|
|
3712
|
+
},
|
|
3713
|
+
/**
|
|
3714
|
+
* Gets the collection of {@link Entity} instances.
|
|
3715
|
+
* @memberof KmlDataSource.prototype
|
|
3716
|
+
* @type {EntityCollection}
|
|
3717
|
+
*/
|
|
3718
|
+
entities: {
|
|
3719
|
+
get: function () {
|
|
3720
|
+
return this._entityCollection;
|
|
3721
|
+
},
|
|
3722
|
+
},
|
|
3723
|
+
/**
|
|
3724
|
+
* Gets a value indicating if the data source is currently loading data.
|
|
3725
|
+
* @memberof KmlDataSource.prototype
|
|
3726
|
+
* @type {Boolean}
|
|
3727
|
+
*/
|
|
3728
|
+
isLoading: {
|
|
3729
|
+
get: function () {
|
|
3730
|
+
return this._isLoading;
|
|
3731
|
+
},
|
|
3732
|
+
},
|
|
3733
|
+
/**
|
|
3734
|
+
* Gets an event that will be raised when the underlying data changes.
|
|
3735
|
+
* @memberof KmlDataSource.prototype
|
|
3736
|
+
* @type {Event}
|
|
3737
|
+
*/
|
|
3738
|
+
changedEvent: {
|
|
3739
|
+
get: function () {
|
|
3740
|
+
return this._changed;
|
|
3741
|
+
},
|
|
3742
|
+
},
|
|
3743
|
+
/**
|
|
3744
|
+
* Gets an event that will be raised if an error is encountered during processing.
|
|
3745
|
+
* @memberof KmlDataSource.prototype
|
|
3746
|
+
* @type {Event}
|
|
3747
|
+
*/
|
|
3748
|
+
errorEvent: {
|
|
3749
|
+
get: function () {
|
|
3750
|
+
return this._error;
|
|
3751
|
+
},
|
|
3752
|
+
},
|
|
3753
|
+
/**
|
|
3754
|
+
* Gets an event that will be raised when the data source either starts or stops loading.
|
|
3755
|
+
* @memberof KmlDataSource.prototype
|
|
3756
|
+
* @type {Event}
|
|
3757
|
+
*/
|
|
3758
|
+
loadingEvent: {
|
|
3759
|
+
get: function () {
|
|
3760
|
+
return this._loading;
|
|
3761
|
+
},
|
|
3762
|
+
},
|
|
3763
|
+
/**
|
|
3764
|
+
* Gets an event that will be raised when the data source refreshes a network link.
|
|
3765
|
+
* @memberof KmlDataSource.prototype
|
|
3766
|
+
* @type {Event}
|
|
3767
|
+
*/
|
|
3768
|
+
refreshEvent: {
|
|
3769
|
+
get: function () {
|
|
3770
|
+
return this._refresh;
|
|
3771
|
+
},
|
|
3772
|
+
},
|
|
3773
|
+
/**
|
|
3774
|
+
* Gets an event that will be raised when the data source finds an unsupported node type.
|
|
3775
|
+
* @memberof KmlDataSource.prototype
|
|
3776
|
+
* @type {Event}
|
|
3777
|
+
*/
|
|
3778
|
+
unsupportedNodeEvent: {
|
|
3779
|
+
get: function () {
|
|
3780
|
+
return this._unsupportedNode;
|
|
3781
|
+
},
|
|
3782
|
+
},
|
|
3783
|
+
/**
|
|
3784
|
+
* Gets whether or not this data source should be displayed.
|
|
3785
|
+
* @memberof KmlDataSource.prototype
|
|
3786
|
+
* @type {Boolean}
|
|
3787
|
+
*/
|
|
3788
|
+
show: {
|
|
3789
|
+
get: function () {
|
|
3790
|
+
return this._entityCollection.show;
|
|
3791
|
+
},
|
|
3792
|
+
set: function (value) {
|
|
3793
|
+
this._entityCollection.show = value;
|
|
3794
|
+
},
|
|
3795
|
+
},
|
|
3796
|
+
|
|
3797
|
+
/**
|
|
3798
|
+
* Gets or sets the clustering options for this data source. This object can be shared between multiple data sources.
|
|
3799
|
+
*
|
|
3800
|
+
* @memberof KmlDataSource.prototype
|
|
3801
|
+
* @type {EntityCluster}
|
|
3802
|
+
*/
|
|
3803
|
+
clustering: {
|
|
3804
|
+
get: function () {
|
|
3805
|
+
return this._entityCluster;
|
|
3806
|
+
},
|
|
3807
|
+
set: function (value) {
|
|
3808
|
+
//>>includeStart('debug', pragmas.debug);
|
|
3809
|
+
if (!defined(value)) {
|
|
3810
|
+
throw new DeveloperError("value must be defined.");
|
|
3811
|
+
}
|
|
3812
|
+
//>>includeEnd('debug');
|
|
3813
|
+
this._entityCluster = value;
|
|
3814
|
+
},
|
|
3815
|
+
},
|
|
3816
|
+
/**
|
|
3817
|
+
* Gets the credit that will be displayed for the data source
|
|
3818
|
+
* @memberof KmlDataSource.prototype
|
|
3819
|
+
* @type {Credit}
|
|
3820
|
+
*/
|
|
3821
|
+
credit: {
|
|
3822
|
+
get: function () {
|
|
3823
|
+
return this._credit;
|
|
3824
|
+
},
|
|
3825
|
+
},
|
|
3826
|
+
/**
|
|
3827
|
+
* Gets the KML Tours that are used to guide the camera to specified destinations on given time intervals.
|
|
3828
|
+
* @memberof KmlDataSource.prototype
|
|
3829
|
+
* @type {KmlTour[]}
|
|
3830
|
+
*/
|
|
3831
|
+
kmlTours: {
|
|
3832
|
+
get: function () {
|
|
3833
|
+
return this._kmlTours;
|
|
3834
|
+
},
|
|
3835
|
+
},
|
|
3836
|
+
});
|
|
3837
|
+
|
|
3838
|
+
/**
|
|
3839
|
+
* Asynchronously loads the provided KML data, replacing any existing data.
|
|
3840
|
+
*
|
|
3841
|
+
* @param {Resource|String|Document|Blob} data A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document.
|
|
3842
|
+
* @param {KmlDataSource.LoadOptions} [options] An object specifying configuration options
|
|
3843
|
+
*
|
|
3844
|
+
* @returns {Promise.<KmlDataSource>} A promise that will resolve to this instances once the KML is loaded.
|
|
3845
|
+
*/
|
|
3846
|
+
KmlDataSource.prototype.load = function (data, options) {
|
|
3847
|
+
//>>includeStart('debug', pragmas.debug);
|
|
3848
|
+
if (!defined(data)) {
|
|
3849
|
+
throw new DeveloperError("data is required.");
|
|
3850
|
+
}
|
|
3851
|
+
//>>includeEnd('debug');
|
|
3852
|
+
|
|
3853
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
3854
|
+
DataSource.setLoading(this, true);
|
|
3855
|
+
|
|
3856
|
+
const oldName = this._name;
|
|
3857
|
+
this._name = undefined;
|
|
3858
|
+
this._clampToGround = defaultValue(options.clampToGround, false);
|
|
3859
|
+
|
|
3860
|
+
const that = this;
|
|
3861
|
+
return load(this, this._entityCollection, data, options)
|
|
3862
|
+
.then(function () {
|
|
3863
|
+
let clock;
|
|
3864
|
+
|
|
3865
|
+
const availability = that._entityCollection.computeAvailability();
|
|
3866
|
+
|
|
3867
|
+
let start = availability.start;
|
|
3868
|
+
let stop = availability.stop;
|
|
3869
|
+
const isMinStart = JulianDate.equals(start, Iso8601.MINIMUM_VALUE);
|
|
3870
|
+
const isMaxStop = JulianDate.equals(stop, Iso8601.MAXIMUM_VALUE);
|
|
3871
|
+
if (!isMinStart || !isMaxStop) {
|
|
3872
|
+
let date;
|
|
3873
|
+
|
|
3874
|
+
//If start is min time just start at midnight this morning, local time
|
|
3875
|
+
if (isMinStart) {
|
|
3876
|
+
date = new Date();
|
|
3877
|
+
date.setHours(0, 0, 0, 0);
|
|
3878
|
+
start = JulianDate.fromDate(date);
|
|
3879
|
+
}
|
|
3880
|
+
|
|
3881
|
+
//If stop is max value just stop at midnight tonight, local time
|
|
3882
|
+
if (isMaxStop) {
|
|
3883
|
+
date = new Date();
|
|
3884
|
+
date.setHours(24, 0, 0, 0);
|
|
3885
|
+
stop = JulianDate.fromDate(date);
|
|
3886
|
+
}
|
|
3887
|
+
|
|
3888
|
+
clock = new DataSourceClock();
|
|
3889
|
+
clock.startTime = start;
|
|
3890
|
+
clock.stopTime = stop;
|
|
3891
|
+
clock.currentTime = JulianDate.clone(start);
|
|
3892
|
+
clock.clockRange = ClockRange.LOOP_STOP;
|
|
3893
|
+
clock.clockStep = ClockStep.SYSTEM_CLOCK_MULTIPLIER;
|
|
3894
|
+
clock.multiplier = Math.round(
|
|
3895
|
+
Math.min(
|
|
3896
|
+
Math.max(JulianDate.secondsDifference(stop, start) / 60, 1),
|
|
3897
|
+
3.15569e7
|
|
3898
|
+
)
|
|
3899
|
+
);
|
|
3900
|
+
}
|
|
3901
|
+
|
|
3902
|
+
let changed = false;
|
|
3903
|
+
if (clock !== that._clock) {
|
|
3904
|
+
that._clock = clock;
|
|
3905
|
+
changed = true;
|
|
3906
|
+
}
|
|
3907
|
+
|
|
3908
|
+
if (oldName !== that._name) {
|
|
3909
|
+
changed = true;
|
|
3910
|
+
}
|
|
3911
|
+
|
|
3912
|
+
if (changed) {
|
|
3913
|
+
that._changed.raiseEvent(that);
|
|
3914
|
+
}
|
|
3915
|
+
|
|
3916
|
+
DataSource.setLoading(that, false);
|
|
3917
|
+
|
|
3918
|
+
return that;
|
|
3919
|
+
})
|
|
3920
|
+
.catch(function (error) {
|
|
3921
|
+
DataSource.setLoading(that, false);
|
|
3922
|
+
that._error.raiseEvent(that, error);
|
|
3923
|
+
console.log(error);
|
|
3924
|
+
return Promise.reject(error);
|
|
3925
|
+
});
|
|
3926
|
+
};
|
|
3927
|
+
|
|
3928
|
+
/**
|
|
3929
|
+
* Cleans up any non-entity elements created by the data source. Currently this only affects ScreenOverlay elements.
|
|
3930
|
+
*/
|
|
3931
|
+
KmlDataSource.prototype.destroy = function () {
|
|
3932
|
+
while (this._screenOverlays.length > 0) {
|
|
3933
|
+
const elem = this._screenOverlays.pop();
|
|
3934
|
+
elem.remove();
|
|
3935
|
+
}
|
|
3936
|
+
};
|
|
3937
|
+
|
|
3938
|
+
function mergeAvailabilityWithParent(child) {
|
|
3939
|
+
const parent = child.parent;
|
|
3940
|
+
if (defined(parent)) {
|
|
3941
|
+
const parentAvailability = parent.availability;
|
|
3942
|
+
if (defined(parentAvailability)) {
|
|
3943
|
+
const childAvailability = child.availability;
|
|
3944
|
+
if (defined(childAvailability)) {
|
|
3945
|
+
childAvailability.intersect(parentAvailability);
|
|
3946
|
+
} else {
|
|
3947
|
+
child.availability = parentAvailability;
|
|
3948
|
+
}
|
|
3949
|
+
}
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
|
|
3953
|
+
function getNetworkLinkUpdateCallback(
|
|
3954
|
+
dataSource,
|
|
3955
|
+
networkLink,
|
|
3956
|
+
newEntityCollection,
|
|
3957
|
+
networkLinks,
|
|
3958
|
+
processedHref
|
|
3959
|
+
) {
|
|
3960
|
+
return function (rootElement) {
|
|
3961
|
+
if (!networkLinks.contains(networkLink.id)) {
|
|
3962
|
+
// Got into the odd case where a parent network link was updated while a child
|
|
3963
|
+
// network link update was in flight, so just throw it away.
|
|
3964
|
+
return;
|
|
3965
|
+
}
|
|
3966
|
+
let remove = false;
|
|
3967
|
+
const networkLinkControl = queryFirstNode(
|
|
3968
|
+
rootElement,
|
|
3969
|
+
"NetworkLinkControl",
|
|
3970
|
+
namespaces.kml
|
|
3971
|
+
);
|
|
3972
|
+
const hasNetworkLinkControl = defined(networkLinkControl);
|
|
3973
|
+
|
|
3974
|
+
let minRefreshPeriod = 0;
|
|
3975
|
+
if (hasNetworkLinkControl) {
|
|
3976
|
+
if (
|
|
3977
|
+
defined(queryFirstNode(networkLinkControl, "Update", namespaces.kml))
|
|
3978
|
+
) {
|
|
3979
|
+
oneTimeWarning(
|
|
3980
|
+
"kml-networkLinkControl-update",
|
|
3981
|
+
"KML - NetworkLinkControl updates aren't supported."
|
|
3982
|
+
);
|
|
3983
|
+
networkLink.updating = false;
|
|
3984
|
+
networkLinks.remove(networkLink.id);
|
|
3985
|
+
return;
|
|
3986
|
+
}
|
|
3987
|
+
networkLink.cookie = queryToObject(
|
|
3988
|
+
defaultValue(
|
|
3989
|
+
queryStringValue(networkLinkControl, "cookie", namespaces.kml),
|
|
3990
|
+
""
|
|
3991
|
+
)
|
|
3992
|
+
);
|
|
3993
|
+
minRefreshPeriod = defaultValue(
|
|
3994
|
+
queryNumericValue(
|
|
3995
|
+
networkLinkControl,
|
|
3996
|
+
"minRefreshPeriod",
|
|
3997
|
+
namespaces.kml
|
|
3998
|
+
),
|
|
3999
|
+
0
|
|
4000
|
+
);
|
|
4001
|
+
}
|
|
4002
|
+
|
|
4003
|
+
const now = JulianDate.now();
|
|
4004
|
+
const refreshMode = networkLink.refreshMode;
|
|
4005
|
+
if (refreshMode === RefreshMode.INTERVAL) {
|
|
4006
|
+
if (defined(networkLinkControl)) {
|
|
4007
|
+
networkLink.time = Math.max(minRefreshPeriod, networkLink.time);
|
|
4008
|
+
}
|
|
4009
|
+
} else if (refreshMode === RefreshMode.EXPIRE) {
|
|
4010
|
+
let expires;
|
|
4011
|
+
if (defined(networkLinkControl)) {
|
|
4012
|
+
expires = queryStringValue(
|
|
4013
|
+
networkLinkControl,
|
|
4014
|
+
"expires",
|
|
4015
|
+
namespaces.kml
|
|
4016
|
+
);
|
|
4017
|
+
}
|
|
4018
|
+
if (defined(expires)) {
|
|
4019
|
+
try {
|
|
4020
|
+
const date = JulianDate.fromIso8601(expires);
|
|
4021
|
+
const diff = JulianDate.secondsDifference(date, now);
|
|
4022
|
+
if (diff > 0 && diff < minRefreshPeriod) {
|
|
4023
|
+
JulianDate.addSeconds(now, minRefreshPeriod, date);
|
|
4024
|
+
}
|
|
4025
|
+
networkLink.time = date;
|
|
4026
|
+
} catch (e) {
|
|
4027
|
+
oneTimeWarning(
|
|
4028
|
+
"kml-networkLinkControl-expires",
|
|
4029
|
+
"KML - NetworkLinkControl expires is not a valid date"
|
|
4030
|
+
);
|
|
4031
|
+
remove = true;
|
|
4032
|
+
}
|
|
4033
|
+
} else {
|
|
4034
|
+
oneTimeWarning(
|
|
4035
|
+
"kml-refreshMode-onExpire",
|
|
4036
|
+
"KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element"
|
|
4037
|
+
);
|
|
4038
|
+
remove = true;
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
|
|
4042
|
+
const networkLinkEntity = networkLink.entity;
|
|
4043
|
+
const entityCollection = dataSource._entityCollection;
|
|
4044
|
+
const newEntities = newEntityCollection.values;
|
|
4045
|
+
|
|
4046
|
+
function removeChildren(entity) {
|
|
4047
|
+
entityCollection.remove(entity);
|
|
4048
|
+
const children = entity._children;
|
|
4049
|
+
const count = children.length;
|
|
4050
|
+
for (let i = 0; i < count; ++i) {
|
|
4051
|
+
removeChildren(children[i]);
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
|
|
4055
|
+
// Remove old entities
|
|
4056
|
+
entityCollection.suspendEvents();
|
|
4057
|
+
const entitiesCopy = entityCollection.values.slice();
|
|
4058
|
+
let i;
|
|
4059
|
+
for (i = 0; i < entitiesCopy.length; ++i) {
|
|
4060
|
+
const entityToRemove = entitiesCopy[i];
|
|
4061
|
+
if (entityToRemove.parent === networkLinkEntity) {
|
|
4062
|
+
entityToRemove.parent = undefined;
|
|
4063
|
+
removeChildren(entityToRemove);
|
|
4064
|
+
}
|
|
4065
|
+
}
|
|
4066
|
+
entityCollection.resumeEvents();
|
|
4067
|
+
|
|
4068
|
+
// Add new entities
|
|
4069
|
+
entityCollection.suspendEvents();
|
|
4070
|
+
for (i = 0; i < newEntities.length; i++) {
|
|
4071
|
+
const newEntity = newEntities[i];
|
|
4072
|
+
if (!defined(newEntity.parent)) {
|
|
4073
|
+
newEntity.parent = networkLinkEntity;
|
|
4074
|
+
mergeAvailabilityWithParent(newEntity);
|
|
4075
|
+
}
|
|
4076
|
+
entityCollection.add(newEntity);
|
|
4077
|
+
}
|
|
4078
|
+
entityCollection.resumeEvents();
|
|
4079
|
+
|
|
4080
|
+
// No refresh information remove it, otherwise update lastUpdate time
|
|
4081
|
+
if (remove) {
|
|
4082
|
+
networkLinks.remove(networkLink.id);
|
|
4083
|
+
} else {
|
|
4084
|
+
networkLink.lastUpdated = now;
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
const availability = entityCollection.computeAvailability();
|
|
4088
|
+
|
|
4089
|
+
const start = availability.start;
|
|
4090
|
+
const stop = availability.stop;
|
|
4091
|
+
const isMinStart = JulianDate.equals(start, Iso8601.MINIMUM_VALUE);
|
|
4092
|
+
const isMaxStop = JulianDate.equals(stop, Iso8601.MAXIMUM_VALUE);
|
|
4093
|
+
if (!isMinStart || !isMaxStop) {
|
|
4094
|
+
const clock = dataSource._clock;
|
|
4095
|
+
|
|
4096
|
+
if (clock.startTime !== start || clock.stopTime !== stop) {
|
|
4097
|
+
clock.startTime = start;
|
|
4098
|
+
clock.stopTime = stop;
|
|
4099
|
+
dataSource._changed.raiseEvent(dataSource);
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
4102
|
+
|
|
4103
|
+
networkLink.updating = false;
|
|
4104
|
+
networkLink.needsUpdate = false;
|
|
4105
|
+
dataSource._refresh.raiseEvent(
|
|
4106
|
+
dataSource,
|
|
4107
|
+
processedHref.getUrlComponent(true)
|
|
4108
|
+
);
|
|
4109
|
+
};
|
|
4110
|
+
}
|
|
4111
|
+
|
|
4112
|
+
const entitiesToIgnore = new AssociativeArray();
|
|
4113
|
+
|
|
4114
|
+
/**
|
|
4115
|
+
* Updates any NetworkLink that require updating.
|
|
4116
|
+
*
|
|
4117
|
+
* @param {JulianDate} time The simulation time.
|
|
4118
|
+
* @returns {Boolean} True if this data source is ready to be displayed at the provided time, false otherwise.
|
|
4119
|
+
*/
|
|
4120
|
+
KmlDataSource.prototype.update = function (time) {
|
|
4121
|
+
const networkLinks = this._networkLinks;
|
|
4122
|
+
if (networkLinks.length === 0) {
|
|
4123
|
+
return true;
|
|
4124
|
+
}
|
|
4125
|
+
|
|
4126
|
+
const now = JulianDate.now();
|
|
4127
|
+
const that = this;
|
|
4128
|
+
|
|
4129
|
+
entitiesToIgnore.removeAll();
|
|
4130
|
+
|
|
4131
|
+
function recurseIgnoreEntities(entity) {
|
|
4132
|
+
const children = entity._children;
|
|
4133
|
+
const count = children.length;
|
|
4134
|
+
for (let i = 0; i < count; ++i) {
|
|
4135
|
+
const child = children[i];
|
|
4136
|
+
entitiesToIgnore.set(child.id, child);
|
|
4137
|
+
recurseIgnoreEntities(child);
|
|
4138
|
+
}
|
|
4139
|
+
}
|
|
4140
|
+
|
|
4141
|
+
let cameraViewUpdate = false;
|
|
4142
|
+
const lastCameraView = this._lastCameraView;
|
|
4143
|
+
const camera = this.camera;
|
|
4144
|
+
if (
|
|
4145
|
+
defined(camera) &&
|
|
4146
|
+
!(
|
|
4147
|
+
camera.positionWC.equalsEpsilon(
|
|
4148
|
+
lastCameraView.position,
|
|
4149
|
+
CesiumMath.EPSILON7
|
|
4150
|
+
) &&
|
|
4151
|
+
camera.directionWC.equalsEpsilon(
|
|
4152
|
+
lastCameraView.direction,
|
|
4153
|
+
CesiumMath.EPSILON7
|
|
4154
|
+
) &&
|
|
4155
|
+
camera.upWC.equalsEpsilon(lastCameraView.up, CesiumMath.EPSILON7)
|
|
4156
|
+
)
|
|
4157
|
+
) {
|
|
4158
|
+
// Camera has changed so update the last view
|
|
4159
|
+
lastCameraView.position = Cartesian3.clone(camera.positionWC);
|
|
4160
|
+
lastCameraView.direction = Cartesian3.clone(camera.directionWC);
|
|
4161
|
+
lastCameraView.up = Cartesian3.clone(camera.upWC);
|
|
4162
|
+
lastCameraView.bbox = camera.computeViewRectangle();
|
|
4163
|
+
cameraViewUpdate = true;
|
|
4164
|
+
}
|
|
4165
|
+
|
|
4166
|
+
const newNetworkLinks = new AssociativeArray();
|
|
4167
|
+
let changed = false;
|
|
4168
|
+
networkLinks.values.forEach(function (networkLink) {
|
|
4169
|
+
const entity = networkLink.entity;
|
|
4170
|
+
if (entitiesToIgnore.contains(entity.id)) {
|
|
4171
|
+
return;
|
|
4172
|
+
}
|
|
4173
|
+
|
|
4174
|
+
if (!networkLink.updating) {
|
|
4175
|
+
let doUpdate = false;
|
|
4176
|
+
if (networkLink.refreshMode === RefreshMode.INTERVAL) {
|
|
4177
|
+
if (
|
|
4178
|
+
JulianDate.secondsDifference(now, networkLink.lastUpdated) >
|
|
4179
|
+
networkLink.time
|
|
4180
|
+
) {
|
|
4181
|
+
doUpdate = true;
|
|
4182
|
+
}
|
|
4183
|
+
} else if (networkLink.refreshMode === RefreshMode.EXPIRE) {
|
|
4184
|
+
if (JulianDate.greaterThan(now, networkLink.time)) {
|
|
4185
|
+
doUpdate = true;
|
|
4186
|
+
}
|
|
4187
|
+
} else if (networkLink.refreshMode === RefreshMode.STOP) {
|
|
4188
|
+
if (cameraViewUpdate) {
|
|
4189
|
+
networkLink.needsUpdate = true;
|
|
4190
|
+
networkLink.cameraUpdateTime = now;
|
|
4191
|
+
}
|
|
4192
|
+
|
|
4193
|
+
if (
|
|
4194
|
+
networkLink.needsUpdate &&
|
|
4195
|
+
JulianDate.secondsDifference(now, networkLink.cameraUpdateTime) >=
|
|
4196
|
+
networkLink.time
|
|
4197
|
+
) {
|
|
4198
|
+
doUpdate = true;
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4201
|
+
|
|
4202
|
+
if (doUpdate) {
|
|
4203
|
+
recurseIgnoreEntities(entity);
|
|
4204
|
+
networkLink.updating = true;
|
|
4205
|
+
const newEntityCollection = new EntityCollection();
|
|
4206
|
+
const href = networkLink.href.clone();
|
|
4207
|
+
|
|
4208
|
+
href.setQueryParameters(networkLink.cookie);
|
|
4209
|
+
const ellipsoid = defaultValue(that._ellipsoid, Ellipsoid.WGS84);
|
|
4210
|
+
processNetworkLinkQueryString(
|
|
4211
|
+
href,
|
|
4212
|
+
that.camera,
|
|
4213
|
+
that.canvas,
|
|
4214
|
+
networkLink.viewBoundScale,
|
|
4215
|
+
lastCameraView.bbox,
|
|
4216
|
+
ellipsoid
|
|
4217
|
+
);
|
|
4218
|
+
|
|
4219
|
+
load(that, newEntityCollection, href, {
|
|
4220
|
+
context: entity.id,
|
|
4221
|
+
})
|
|
4222
|
+
.then(
|
|
4223
|
+
getNetworkLinkUpdateCallback(
|
|
4224
|
+
that,
|
|
4225
|
+
networkLink,
|
|
4226
|
+
newEntityCollection,
|
|
4227
|
+
newNetworkLinks,
|
|
4228
|
+
href
|
|
4229
|
+
)
|
|
4230
|
+
)
|
|
4231
|
+
.catch(function (error) {
|
|
4232
|
+
const msg = `NetworkLink ${networkLink.href} refresh failed: ${error}`;
|
|
4233
|
+
console.log(msg);
|
|
4234
|
+
that._error.raiseEvent(that, msg);
|
|
4235
|
+
});
|
|
4236
|
+
changed = true;
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
newNetworkLinks.set(networkLink.id, networkLink);
|
|
4240
|
+
});
|
|
4241
|
+
|
|
4242
|
+
if (changed) {
|
|
4243
|
+
this._networkLinks = newNetworkLinks;
|
|
4244
|
+
this._changed.raiseEvent(this);
|
|
4245
|
+
}
|
|
4246
|
+
|
|
4247
|
+
return true;
|
|
4248
|
+
};
|
|
4249
|
+
|
|
4250
|
+
/**
|
|
4251
|
+
* Contains KML Feature data loaded into the <code>Entity.kml</code> property by {@link KmlDataSource}.
|
|
4252
|
+
* @alias KmlFeatureData
|
|
4253
|
+
* @constructor
|
|
4254
|
+
*/
|
|
4255
|
+
function KmlFeatureData() {
|
|
4256
|
+
/**
|
|
4257
|
+
* @typedef KmlFeatureData.Author
|
|
4258
|
+
* @type {Object}
|
|
4259
|
+
* @property {String} name Gets the name.
|
|
4260
|
+
* @property {String} uri Gets the URI.
|
|
4261
|
+
* @property {Number} age Gets the email.
|
|
4262
|
+
*/
|
|
4263
|
+
|
|
4264
|
+
/**
|
|
4265
|
+
* Gets the atom syndication format author field.
|
|
4266
|
+
* @type {KmlFeatureData.Author}
|
|
4267
|
+
*/
|
|
4268
|
+
this.author = {
|
|
4269
|
+
name: undefined,
|
|
4270
|
+
uri: undefined,
|
|
4271
|
+
email: undefined,
|
|
4272
|
+
};
|
|
4273
|
+
|
|
4274
|
+
/**
|
|
4275
|
+
* @typedef KmlFeatureData.Link
|
|
4276
|
+
* @type {Object}
|
|
4277
|
+
* @property {String} href Gets the href.
|
|
4278
|
+
* @property {String} hreflang Gets the language of the linked resource.
|
|
4279
|
+
* @property {String} rel Gets the link relation.
|
|
4280
|
+
* @property {String} type Gets the link type.
|
|
4281
|
+
* @property {String} title Gets the link title.
|
|
4282
|
+
* @property {String} length Gets the link length.
|
|
4283
|
+
*/
|
|
4284
|
+
|
|
4285
|
+
/**
|
|
4286
|
+
* Gets the link.
|
|
4287
|
+
* @type {KmlFeatureData.Link}
|
|
4288
|
+
*/
|
|
4289
|
+
this.link = {
|
|
4290
|
+
href: undefined,
|
|
4291
|
+
hreflang: undefined,
|
|
4292
|
+
rel: undefined,
|
|
4293
|
+
type: undefined,
|
|
4294
|
+
title: undefined,
|
|
4295
|
+
length: undefined,
|
|
4296
|
+
};
|
|
4297
|
+
|
|
4298
|
+
/**
|
|
4299
|
+
* Gets the unstructured address field.
|
|
4300
|
+
* @type {String}
|
|
4301
|
+
*/
|
|
4302
|
+
this.address = undefined;
|
|
4303
|
+
/**
|
|
4304
|
+
* Gets the phone number.
|
|
4305
|
+
* @type {String}
|
|
4306
|
+
*/
|
|
4307
|
+
this.phoneNumber = undefined;
|
|
4308
|
+
/**
|
|
4309
|
+
* Gets the snippet.
|
|
4310
|
+
* @type {String}
|
|
4311
|
+
*/
|
|
4312
|
+
this.snippet = undefined;
|
|
4313
|
+
/**
|
|
4314
|
+
* Gets the extended data, parsed into a JSON object.
|
|
4315
|
+
* Currently only the <code>Data</code> property is supported.
|
|
4316
|
+
* <code>SchemaData</code> and custom data are ignored.
|
|
4317
|
+
* @type {String}
|
|
4318
|
+
*/
|
|
4319
|
+
this.extendedData = undefined;
|
|
4320
|
+
}
|
|
4321
|
+
|
|
4322
|
+
// For testing
|
|
4323
|
+
KmlDataSource._DeferredLoading = DeferredLoading;
|
|
4324
|
+
KmlDataSource._getTimestamp = getTimestamp;
|
|
4325
|
+
|
|
4326
|
+
export default KmlDataSource;
|