@vcmap/ui 5.0.0-rc.18 → 5.0.0-rc.20
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/README.md +6 -6
- package/build/build.js +2 -2
- package/build/buildCesium.js +3 -3
- package/build/buildHelpers.js +2 -1
- package/config/base.config.json +0 -4
- package/config/dev.config.json +35 -14
- package/config/www.config.json +4 -0
- package/dist/assets/cesium/Workers/ArcType-ce2e50ab.js +37 -0
- package/dist/assets/cesium/Workers/AttributeCompression-b646d393.js +716 -0
- package/dist/assets/cesium/Workers/AxisAlignedBoundingBox-ff186ccc.js +258 -0
- package/dist/assets/cesium/Workers/BoundingRectangle-be5924f4.js +369 -0
- package/dist/assets/cesium/Workers/BoxGeometry-12eeccaf.js +884 -0
- package/dist/assets/cesium/Workers/Check-666ab1a0.js +290 -0
- package/dist/assets/cesium/Workers/Color-a84038cb.js +2262 -0
- package/dist/assets/cesium/Workers/ComponentDatatype-f7b11d02.js +341 -0
- package/dist/assets/cesium/Workers/CoplanarPolygonGeometryLibrary-3272c1b3.js +132 -0
- package/dist/assets/cesium/Workers/CorridorGeometryLibrary-0170e093.js +498 -0
- package/dist/assets/cesium/Workers/CylinderGeometry-7c5da648.js +467 -0
- package/dist/assets/cesium/Workers/CylinderGeometryLibrary-372c07d8.js +63 -0
- package/dist/assets/cesium/Workers/EllipseGeometry-797d580e.js +1304 -0
- package/dist/assets/cesium/Workers/EllipseGeometryLibrary-2939e1dc.js +366 -0
- package/dist/assets/cesium/Workers/EllipseOutlineGeometry-8b50870f.js +443 -0
- package/dist/assets/cesium/Workers/EllipsoidGeodesic-98c62a56.js +520 -0
- package/dist/assets/cesium/Workers/EllipsoidGeometry-21c0e3a5.js +637 -0
- package/dist/assets/cesium/Workers/EllipsoidOutlineGeometry-eff247c8.js +454 -0
- package/dist/assets/cesium/Workers/EllipsoidRhumbLine-19756602.js +741 -0
- package/dist/assets/cesium/Workers/EllipsoidTangentPlane-214683dc.js +373 -0
- package/dist/assets/cesium/Workers/EncodedCartesian3-81f70735.js +171 -0
- package/dist/assets/cesium/Workers/FrustumGeometry-ac42a6d9.js +2512 -0
- package/dist/assets/cesium/Workers/GeometryAttribute-7d6f1732.js +619 -0
- package/dist/assets/cesium/Workers/GeometryAttributes-f06a2792.js +91 -0
- package/dist/assets/cesium/Workers/GeometryInstance-451dc1cd.js +121 -0
- package/dist/assets/cesium/Workers/GeometryOffsetAttribute-04332ce7.js +16 -0
- package/dist/assets/cesium/Workers/GeometryPipeline-ce4339ed.js +3690 -0
- package/dist/assets/cesium/Workers/IndexDatatype-a55ceaa1.js +200 -0
- package/dist/assets/cesium/Workers/IntersectionTests-f6e6bd8a.js +1836 -0
- package/dist/assets/cesium/Workers/Math-2dbd6b93.js +1330 -0
- package/dist/assets/cesium/Workers/Matrix2-13178034.js +7086 -0
- package/dist/assets/cesium/Workers/Matrix3-315394f6.js +4283 -0
- package/dist/assets/cesium/Workers/OrientedBoundingBox-04920dc7.js +1257 -0
- package/dist/assets/cesium/Workers/Plane-900aa728.js +309 -0
- package/dist/assets/cesium/Workers/PolygonGeometryLibrary-a8680d96.js +1074 -0
- package/dist/assets/cesium/Workers/PolygonPipeline-844aab0a.js +1345 -0
- package/dist/assets/cesium/Workers/PolylinePipeline-32f36d2a.js +573 -0
- package/dist/assets/cesium/Workers/PolylineVolumeGeometryLibrary-a510d657.js +781 -0
- package/dist/assets/cesium/Workers/PrimitivePipeline-ba38434a.js +966 -0
- package/dist/assets/cesium/Workers/RectangleGeometryLibrary-bdba697e.js +280 -0
- package/dist/assets/cesium/Workers/RuntimeError-06c93819.js +68 -0
- package/dist/assets/cesium/Workers/TerrainEncoding-833187da.js +1227 -0
- package/dist/assets/cesium/Workers/Transforms-40229881.js +14696 -0
- package/dist/assets/cesium/Workers/VertexFormat-6b480673.js +312 -0
- package/dist/assets/cesium/Workers/WallGeometryLibrary-919eed92.js +211 -0
- package/dist/assets/cesium/Workers/WebGLConstants-a8cc3e8c.js +620 -0
- package/dist/assets/cesium/Workers/WebMercatorProjection-13a90d41.js +151 -0
- package/dist/assets/cesium/Workers/arrayRemoveDuplicates-c2038105.js +129 -0
- package/dist/assets/cesium/Workers/cesiumWorkerBootstrapper.js +1336 -4
- package/dist/assets/cesium/Workers/combine-ca22a614.js +82 -0
- package/dist/assets/cesium/Workers/combineGeometry.js +17 -25
- package/dist/assets/cesium/Workers/createBoxGeometry.js +12 -25
- package/dist/assets/cesium/Workers/createBoxOutlineGeometry.js +313 -25
- package/dist/assets/cesium/Workers/createCircleGeometry.js +213 -25
- package/dist/assets/cesium/Workers/createCircleOutlineGeometry.js +160 -25
- package/dist/assets/cesium/Workers/createCoplanarPolygonGeometry.js +586 -25
- package/dist/assets/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +236 -25
- package/dist/assets/cesium/Workers/createCorridorGeometry.js +1407 -25
- package/dist/assets/cesium/Workers/createCorridorOutlineGeometry.js +603 -25
- package/dist/assets/cesium/Workers/createCylinderGeometry.js +12 -25
- package/dist/assets/cesium/Workers/createCylinderOutlineGeometry.js +265 -25
- package/dist/assets/cesium/Workers/createEllipseGeometry.js +14 -25
- package/dist/assets/cesium/Workers/createEllipseOutlineGeometry.js +14 -25
- package/dist/assets/cesium/Workers/createEllipsoidGeometry.js +12 -25
- package/dist/assets/cesium/Workers/createEllipsoidOutlineGeometry.js +15 -25
- package/dist/assets/cesium/Workers/createFrustumGeometry.js +12 -25
- package/dist/assets/cesium/Workers/createFrustumOutlineGeometry.js +251 -25
- package/dist/assets/cesium/Workers/createGeometry.js +55 -25
- package/dist/assets/cesium/Workers/createGroundPolylineGeometry.js +2134 -25
- package/dist/assets/cesium/Workers/createPlaneGeometry.js +250 -25
- package/dist/assets/cesium/Workers/createPlaneOutlineGeometry.js +115 -25
- package/dist/assets/cesium/Workers/createPolygonGeometry.js +1420 -25
- package/dist/assets/cesium/Workers/createPolygonOutlineGeometry.js +683 -25
- package/dist/assets/cesium/Workers/createPolylineGeometry.js +571 -25
- package/dist/assets/cesium/Workers/createPolylineVolumeGeometry.js +411 -25
- package/dist/assets/cesium/Workers/createPolylineVolumeOutlineGeometry.js +301 -25
- package/dist/assets/cesium/Workers/createRectangleGeometry.js +1476 -25
- package/dist/assets/cesium/Workers/createRectangleOutlineGeometry.js +535 -25
- package/dist/assets/cesium/Workers/createSimplePolylineGeometry.js +458 -25
- package/dist/assets/cesium/Workers/createSphereGeometry.js +123 -25
- package/dist/assets/cesium/Workers/createSphereOutlineGeometry.js +126 -25
- package/dist/assets/cesium/Workers/createTaskProcessorWorker.js +127 -25
- package/dist/assets/cesium/Workers/createVectorTileClampedPolylines.js +535 -25
- package/dist/assets/cesium/Workers/createVectorTileGeometries.js +445 -25
- package/dist/assets/cesium/Workers/createVectorTilePoints.js +79 -25
- package/dist/assets/cesium/Workers/createVectorTilePolygons.js +406 -25
- package/dist/assets/cesium/Workers/createVectorTilePolylines.js +254 -25
- package/dist/assets/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +640 -25
- package/dist/assets/cesium/Workers/createVerticesFromHeightmap.js +2711 -27
- package/dist/assets/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +994 -25
- package/dist/assets/cesium/Workers/createWallGeometry.js +623 -25
- package/dist/assets/cesium/Workers/createWallOutlineGeometry.js +432 -25
- package/dist/assets/cesium/Workers/decodeDraco.js +381 -25
- package/dist/assets/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +3687 -25
- package/dist/assets/cesium/Workers/decodeI3S.js +1040 -0
- package/dist/assets/cesium/Workers/defaultValue-0a909f67.js +51 -0
- package/dist/assets/cesium/Workers/package.js +2 -2
- package/dist/assets/cesium/Workers/transcodeKTX2.js +1516 -25
- package/dist/assets/cesium/Workers/transferTypedArrayTest.js +18 -2
- package/dist/assets/cesium/Workers/upsampleQuantizedTerrainMesh.js +1023 -25
- package/dist/assets/{cesium.2f992f.js → cesium.adbd45.js} +112161 -108735
- package/dist/assets/cesium.js +1 -1
- package/dist/assets/{core.cb0408.js → core.60e74d.js} +1616 -1629
- package/dist/assets/core.f198cf.js +15993 -0
- package/dist/assets/core.js +1 -1
- package/dist/assets/{index.bccdf969.js → index.884a53ef.js} +1 -1
- package/dist/assets/{ol.5e3fd0.js → ol.c6ff35.js} +6992 -6972
- package/dist/assets/ol.dbd604.js +44299 -0
- package/dist/assets/ol.js +1 -1
- package/dist/assets/ui.bf504d.css +1 -0
- package/dist/assets/{ui.08c48f.js → ui.bf504d.js} +6121 -6785
- package/dist/assets/ui.js +1 -1
- package/dist/assets/{vue.228ead.js → vue.75b819.js} +0 -0
- package/dist/assets/vue.a831f1.js +4675 -0
- package/dist/assets/vue.js +2 -2
- package/dist/assets/{vuetify.0b5039.css → vuetify.0d7360.css} +0 -0
- package/dist/assets/{vuetify.0b5039.js → vuetify.0d7360.js} +1 -1
- package/dist/assets/vuetify.js +2 -2
- package/dist/index.html +1 -1
- package/index.js +2 -1
- package/lib/cesium.js +1 -1
- package/package.json +3 -4
- package/plugins/{simple-graph → @vcmap/simple-graph}/README.md +1 -1
- package/plugins/{simple-graph → @vcmap/simple-graph}/SimpleGraphComponent.vue +0 -0
- package/plugins/{simple-graph → @vcmap/simple-graph}/index.js +0 -0
- package/plugins/{simple-graph → @vcmap/simple-graph}/package.json +0 -0
- package/plugins/{simple-graph → @vcmap/simple-graph}/simpleGraphView.js +0 -0
- package/plugins/@vcmap-show-case/README.md +20 -0
- package/plugins/{buttonExamples/ButtonExamples.vue → @vcmap-show-case/buttons-example/ButtonsExample.vue} +1 -1
- package/plugins/@vcmap-show-case/buttons-example/README.md +4 -0
- package/plugins/{buttonExamples → @vcmap-show-case/buttons-example}/index.js +16 -8
- package/plugins/@vcmap-show-case/buttons-example/package.json +5 -0
- package/plugins/{categoryTest → @vcmap-show-case/category-tester}/Categories.vue +7 -6
- package/plugins/{categoryTest → @vcmap-show-case/category-tester}/Category.vue +4 -3
- package/plugins/@vcmap-show-case/category-tester/README.md +3 -0
- package/plugins/{categoryTest → @vcmap-show-case/category-tester}/index.js +12 -4
- package/plugins/@vcmap-show-case/category-tester/package.json +5 -0
- package/plugins/@vcmap-show-case/config-editor/README.md +3 -0
- package/plugins/{test → @vcmap-show-case/config-editor}/editor.vue +0 -0
- package/plugins/@vcmap-show-case/config-editor/index.js +47 -0
- package/plugins/@vcmap-show-case/config-editor/package.json +5 -0
- package/plugins/@vcmap-show-case/context-menu-tester/README.md +3 -0
- package/plugins/@vcmap-show-case/context-menu-tester/index.js +33 -0
- package/plugins/@vcmap-show-case/context-menu-tester/package.json +5 -0
- package/plugins/{@vcmap/pluginExample/pluginExampleComponent.vue → @vcmap-show-case/form-inputs-example/FormInputsExample.vue} +14 -13
- package/plugins/@vcmap-show-case/form-inputs-example/README.md +4 -0
- package/plugins/@vcmap-show-case/form-inputs-example/config.json +5 -0
- package/plugins/{@vcmap/pluginExample → @vcmap-show-case/form-inputs-example}/exampleActions.js +1 -1
- package/plugins/{@vcmap/pluginExample → @vcmap-show-case/form-inputs-example}/index.js +23 -22
- package/plugins/@vcmap-show-case/form-inputs-example/package.json +5 -0
- package/plugins/{@vcmap/pluginExample → @vcmap-show-case/form-inputs-example}/validation.js +0 -0
- package/plugins/@vcmap-show-case/icons-example/README.md +5 -0
- package/plugins/@vcmap-show-case/icons-example/allIconsComponent.vue +51 -0
- package/plugins/@vcmap-show-case/icons-example/index.js +44 -0
- package/plugins/@vcmap-show-case/icons-example/package.json +5 -0
- package/plugins/{test/testList.vue → @vcmap-show-case/list-example/ListExample.vue} +1 -1
- package/plugins/@vcmap-show-case/list-example/README.md +3 -0
- package/plugins/@vcmap-show-case/list-example/index.js +44 -0
- package/plugins/@vcmap-show-case/list-example/package.json +5 -0
- package/plugins/@vcmap-show-case/notifier-tester/README.md +3 -0
- package/plugins/{notifier → @vcmap-show-case/notifier-tester}/index.js +11 -6
- package/plugins/{notifier → @vcmap-show-case/notifier-tester}/notifierTester.vue +0 -0
- package/plugins/@vcmap-show-case/notifier-tester/package.json +5 -0
- package/plugins/@vcmap-show-case/textfields-example/README.md +3 -0
- package/plugins/{example/mySuperComponent.vue → @vcmap-show-case/textfields-example/TextfieldsExample.vue} +1 -7
- package/plugins/{example → @vcmap-show-case/textfields-example}/index.js +58 -62
- package/plugins/@vcmap-show-case/textfields-example/package.json +5 -0
- package/plugins/@vcmap-show-case/window-tester/README.md +3 -0
- package/plugins/{test/windowManagerExample.vue → @vcmap-show-case/window-tester/WindowExample.vue} +36 -20
- package/plugins/{test → @vcmap-show-case/window-tester}/emptyComponent.vue +8 -3
- package/plugins/@vcmap-show-case/window-tester/index.js +62 -0
- package/plugins/{test → @vcmap-show-case/window-tester}/myCustomHeader.vue +0 -0
- package/plugins/@vcmap-show-case/window-tester/package.json +5 -0
- package/plugins/{test → @vcmap-show-case/window-tester}/toolbox-data.js +9 -9
- package/plugins/{test/vcsContent.vue → @vcmap-show-case/window-tester/windowExampleContent.vue} +1 -5
- package/plugins/@vcmap-show-case/wizard-example/README.md +3 -0
- package/plugins/{wizardExample → @vcmap-show-case/wizard-example}/index.js +12 -6
- package/plugins/@vcmap-show-case/wizard-example/package.json +5 -0
- package/plugins/@vcmap-show-case/wizard-example/wizardExample.vue +95 -0
- package/plugins/package.json +2 -1
- package/src/actions/actionHelper.js +1 -3
- package/src/actions/stateRefAction.js +0 -10
- package/src/application/VcsApp.vue +42 -23
- package/src/application/VcsMap.vue +9 -0
- package/src/components/buttons/VcsActionButtonList.vue +1 -0
- package/src/components/form-inputs-controls/VcsCheckbox.vue +3 -1
- package/src/components/form-inputs-controls/VcsWizard.vue +17 -20
- package/src/components/form-inputs-controls/VcsWizardStep.vue +160 -0
- package/src/{icons → components/icons}/+all.js +0 -0
- package/src/{icons → components/icons}/2DAreaIcon.vue +0 -0
- package/src/{icons → components/icons}/2DDistanceIcon.vue +0 -0
- package/src/{icons → components/icons}/3DAreaIcon.vue +0 -0
- package/src/{icons → components/icons}/3DDistanceIcon.vue +0 -0
- package/src/{icons → components/icons}/3DHeightIcon.vue +0 -0
- package/src/{icons → components/icons}/AngleIcon.vue +0 -0
- package/src/{icons → components/icons}/AssociationsIcon.vue +0 -0
- package/src/{icons → components/icons}/AxisIcon.vue +0 -0
- package/src/{icons → components/icons}/BoundingBoxIcon.vue +0 -0
- package/src/{icons → components/icons}/CheckboxCheckedIcon.vue +0 -0
- package/src/{icons → components/icons}/CheckboxIcon.vue +0 -0
- package/src/{icons → components/icons}/CheckboxIndeterminateIcon.vue +0 -0
- package/src/{icons → components/icons}/CircleIcon.vue +0 -0
- package/src/{icons → components/icons}/ClippingHorizontalIcon.vue +0 -0
- package/src/{icons → components/icons}/ClippingIcon.vue +0 -0
- package/src/{icons → components/icons}/ClippingVerticalIcon.vue +0 -0
- package/src/{icons → components/icons}/ColorPickerIcon.vue +0 -0
- package/src/{icons → components/icons}/ColorSwatchIcon.vue +0 -0
- package/src/{icons → components/icons}/CommentIcon.vue +0 -0
- package/src/{icons → components/icons}/CompassIcon.vue +0 -0
- package/src/{icons → components/icons}/ComponentsIcon.vue +0 -0
- package/src/{icons → components/icons}/ConeIcon.vue +0 -0
- package/src/{icons → components/icons}/DimensionsHouseIcon.vue +0 -0
- package/src/{icons → components/icons}/EditIcon.vue +0 -0
- package/src/{icons → components/icons}/ElevationProfileIcon.vue +0 -0
- package/src/{icons → components/icons}/ExportAreaIcon.vue +0 -0
- package/src/{icons → components/icons}/ExportFlightIcon.vue +0 -0
- package/src/{icons → components/icons}/ExportIcon.vue +0 -0
- package/src/{icons → components/icons}/ExternalLinkIcon.vue +0 -0
- package/src/{icons → components/icons}/EyeIcon.vue +0 -0
- package/src/{icons → components/icons}/FastForwardIcon.vue +0 -0
- package/src/{icons → components/icons}/FilterIcon.vue +0 -0
- package/src/{icons → components/icons}/GlobalTerrainIcon.vue +0 -0
- package/src/{icons → components/icons}/GlobeNatureIcon.vue +0 -0
- package/src/{icons → components/icons}/GroundIcon.vue +0 -0
- package/src/{icons → components/icons}/HealthCareIndustriesIcon.vue +0 -0
- package/src/{icons → components/icons}/HelpIcon.vue +0 -0
- package/src/{icons → components/icons}/HideIcon.vue +0 -0
- package/src/{icons → components/icons}/HomePointIcon.vue +0 -0
- package/src/{icons → components/icons}/HospitalsIcon.vue +0 -0
- package/src/{icons → components/icons}/HouseIcon.vue +0 -0
- package/src/{icons → components/icons}/ImportIcon.vue +0 -0
- package/src/{icons → components/icons}/InfoIcon.vue +0 -0
- package/src/{icons → components/icons}/KebabIcon.vue +0 -0
- package/src/{icons → components/icons}/LabelIcon.vue +0 -0
- package/src/{icons → components/icons}/LayersIcon.vue +0 -0
- package/src/{icons → components/icons}/LegendIcon.vue +0 -0
- package/src/{icons → components/icons}/LineIcon.vue +0 -0
- package/src/{icons → components/icons}/LinkIcon.vue +0 -0
- package/src/{icons → components/icons}/LogoutIcon.vue +0 -0
- package/src/{icons → components/icons}/MapIcon.vue +0 -0
- package/src/{icons → components/icons}/MenuIcon.vue +0 -0
- package/src/{icons → components/icons}/MinusIcon.vue +0 -0
- package/src/{icons → components/icons}/ObjectAttributeIcon.vue +0 -0
- package/src/{icons → components/icons}/ObjectSelectIcon.vue +0 -0
- package/src/{icons → components/icons}/ObliqueViewIcon.vue +0 -0
- package/src/{icons → components/icons}/PdfIcon.vue +0 -0
- package/src/{icons → components/icons}/PedestrianIcon.vue +0 -0
- package/src/{icons → components/icons}/PenIcon.vue +0 -0
- package/src/{icons → components/icons}/PlayCircleIcon.vue +0 -0
- package/src/{icons → components/icons}/PlusIcon.vue +0 -0
- package/src/{icons → components/icons}/PoiIcon.vue +0 -0
- package/src/{icons → components/icons}/PointSelectIcon.vue +0 -0
- package/src/{icons → components/icons}/PolygonIcon.vue +0 -0
- package/src/{icons → components/icons}/PresentationModeIcon.vue +0 -0
- package/src/{icons → components/icons}/ProgressIcon.vue +0 -0
- package/src/{icons → components/icons}/QueryIcon.vue +0 -0
- package/src/{icons → components/icons}/RectangleIcon.vue +0 -0
- package/src/{icons → components/icons}/ReturnIcon.vue +0 -0
- package/src/{icons → components/icons}/RewindIcon.vue +0 -0
- package/src/{icons → components/icons}/RotateLeftIcon.vue +0 -0
- package/src/{icons → components/icons}/RotateRightIcon.vue +0 -0
- package/src/{icons → components/icons}/ScreenshotIcon.vue +0 -0
- package/src/{icons → components/icons}/SearchIcon.vue +0 -0
- package/src/{icons → components/icons}/ShadowIcon.vue +0 -0
- package/src/{icons → components/icons}/ShapesIcon.vue +0 -0
- package/src/{icons → components/icons}/ShareIcon.vue +0 -0
- package/src/{icons → components/icons}/SimpleCircleFilledIcon.vue +0 -0
- package/src/{icons → components/icons}/SimpleCircleHalfFilledIcon.vue +0 -0
- package/src/{icons → components/icons}/SimpleCircleOutlinedIcon.vue +0 -0
- package/src/{icons → components/icons}/SkipNextIcon.vue +0 -0
- package/src/{icons → components/icons}/SkipPreviousIcon.vue +0 -0
- package/src/{icons → components/icons}/SplitViewIcon.vue +0 -0
- package/src/{icons → components/icons}/TerrainBoxIcon.vue +0 -0
- package/src/{icons → components/icons}/TextStyleIcon.vue +0 -0
- package/src/{icons → components/icons}/ThreeDimensionsIcon.vue +0 -0
- package/src/{icons → components/icons}/ToolsIcon.vue +0 -0
- package/src/{icons → components/icons}/TouchIcon.vue +0 -0
- package/src/{icons → components/icons}/TrashCanIcon.vue +0 -0
- package/src/{icons → components/icons}/TriangleIcon.vue +0 -0
- package/src/{icons → components/icons}/TwoDimensionsIcon.vue +0 -0
- package/src/{icons → components/icons}/UploadIcon.vue +0 -0
- package/src/{icons → components/icons}/UserProfileIcon.vue +0 -0
- package/src/{icons → components/icons}/UserShareIcon.vue +0 -0
- package/src/{icons → components/icons}/VideoRecorderIcon.vue +0 -0
- package/src/{icons → components/icons}/ViewpointFlightIcon.vue +0 -0
- package/src/{icons → components/icons}/ViewpointIcon.vue +0 -0
- package/src/{icons → components/icons}/Viewshed360Icon.vue +0 -0
- package/src/{icons → components/icons}/ViewshedConeIcon.vue +0 -0
- package/src/{icons → components/icons}/ViewshedIcon.vue +0 -0
- package/src/{icons → components/icons}/WalkingIcon.vue +0 -0
- package/src/{icons → components/icons}/WallIcon.vue +0 -0
- package/src/{icons → components/icons}/WandIcon.vue +0 -0
- package/src/components/lists/VcsList.vue +21 -12
- package/src/components/lists/VcsTreeviewLeaf.vue +14 -2
- package/src/components/notification/VcsTooltip.vue +1 -1
- package/src/featureInfo/abstractFeatureInfoView.js +1 -1
- package/src/featureInfo/addressBalloonFeatureInfoView.js +1 -1
- package/src/featureInfo/balloonFeatureInfoView.js +1 -1
- package/src/featureInfo/balloonHelper.js +6 -6
- package/src/featureInfo/featureInfo.js +2 -2
- package/src/i18n/de.js +2 -6
- package/src/i18n/en.js +2 -6
- package/src/legend/legendHelper.js +4 -3
- package/src/legend/vcsLegend.vue +21 -2
- package/src/manager/window/WindowComponent.vue +42 -4
- package/src/manager/window/WindowComponentHeader.vue +1 -1
- package/src/manager/window/windowHelper.js +7 -11
- package/src/manager/window/windowManager.js +15 -11
- package/src/navigation/mapNavCompass.vue +13 -7
- package/src/navigation/mapNavigation.vue +66 -4
- package/src/navigation/orientationToolsButton.vue +1 -1
- package/src/navigation/overviewMap.js +26 -10
- package/src/navigation/vcsCompass.vue +4 -73
- package/src/setup.js +1 -1
- package/src/vuePlugins/vuetify.js +1 -1
- package/dist/assets/cesium/Workers/ArcType-c9b2b290.js +0 -25
- package/dist/assets/cesium/Workers/AttributeCompression-7b0f288d.js +0 -25
- package/dist/assets/cesium/Workers/AxisAlignedBoundingBox-d0c22774.js +0 -25
- package/dist/assets/cesium/Workers/BoundingRectangle-201b1a81.js +0 -25
- package/dist/assets/cesium/Workers/BoxGeometry-4985457c.js +0 -25
- package/dist/assets/cesium/Workers/Color-cc8c18b3.js +0 -25
- package/dist/assets/cesium/Workers/ComponentDatatype-0200bf8c.js +0 -25
- package/dist/assets/cesium/Workers/CoplanarPolygonGeometryLibrary-4345acdf.js +0 -25
- package/dist/assets/cesium/Workers/CorridorGeometryLibrary-850a6c35.js +0 -25
- package/dist/assets/cesium/Workers/CylinderGeometry-57a1051a.js +0 -25
- package/dist/assets/cesium/Workers/CylinderGeometryLibrary-62ce5a1f.js +0 -25
- package/dist/assets/cesium/Workers/EllipseGeometry-8627398f.js +0 -25
- package/dist/assets/cesium/Workers/EllipseGeometryLibrary-e5919563.js +0 -25
- package/dist/assets/cesium/Workers/EllipseOutlineGeometry-96fd4ae1.js +0 -25
- package/dist/assets/cesium/Workers/EllipsoidGeodesic-8bfefbff.js +0 -25
- package/dist/assets/cesium/Workers/EllipsoidGeometry-377329b9.js +0 -25
- package/dist/assets/cesium/Workers/EllipsoidOutlineGeometry-e6e16e49.js +0 -25
- package/dist/assets/cesium/Workers/EllipsoidRhumbLine-03528f73.js +0 -25
- package/dist/assets/cesium/Workers/EllipsoidTangentPlane-c080fd1b.js +0 -25
- package/dist/assets/cesium/Workers/EncodedCartesian3-ea0e408f.js +0 -25
- package/dist/assets/cesium/Workers/FrustumGeometry-a8b5d817.js +0 -25
- package/dist/assets/cesium/Workers/GeometryAttribute-8458a8fd.js +0 -25
- package/dist/assets/cesium/Workers/GeometryAttributes-ac0f8485.js +0 -25
- package/dist/assets/cesium/Workers/GeometryInstance-ee3aa3ba.js +0 -25
- package/dist/assets/cesium/Workers/GeometryOffsetAttribute-08ae0c50.js +0 -25
- package/dist/assets/cesium/Workers/GeometryPipeline-33ca229c.js +0 -25
- package/dist/assets/cesium/Workers/IndexDatatype-e713bfd2.js +0 -25
- package/dist/assets/cesium/Workers/IntersectionTests-eb4db8e0.js +0 -25
- package/dist/assets/cesium/Workers/Matrix2-eefef8eb.js +0 -25
- package/dist/assets/cesium/Workers/OrientedBoundingBox-5193f9a2.js +0 -25
- package/dist/assets/cesium/Workers/Plane-b0299683.js +0 -25
- package/dist/assets/cesium/Workers/PolygonGeometryLibrary-b61295f3.js +0 -25
- package/dist/assets/cesium/Workers/PolygonPipeline-eb527514.js +0 -25
- package/dist/assets/cesium/Workers/PolylinePipeline-0f23dd84.js +0 -25
- package/dist/assets/cesium/Workers/PolylineVolumeGeometryLibrary-2d903430.js +0 -25
- package/dist/assets/cesium/Workers/PrimitivePipeline-e2640413.js +0 -25
- package/dist/assets/cesium/Workers/RectangleGeometryLibrary-ae8bf8a5.js +0 -25
- package/dist/assets/cesium/Workers/RuntimeError-5baf5c66.js +0 -25
- package/dist/assets/cesium/Workers/TerrainEncoding-bc10ab54.js +0 -25
- package/dist/assets/cesium/Workers/Transforms-d2e5867e.js +0 -63
- package/dist/assets/cesium/Workers/VertexFormat-5ec0d9ff.js +0 -25
- package/dist/assets/cesium/Workers/WallGeometryLibrary-1a33e416.js +0 -25
- package/dist/assets/cesium/Workers/WebGLConstants-5b50ced1.js +0 -25
- package/dist/assets/cesium/Workers/WebMercatorProjection-cd2f30c2.js +0 -25
- package/dist/assets/cesium/Workers/_commonjsHelpers-bc29abbc.js +0 -25
- package/dist/assets/cesium/Workers/arrayRemoveDuplicates-f13aceb1.js +0 -25
- package/dist/assets/cesium/Workers/combine-7533016d.js +0 -25
- package/dist/assets/cesium/Workers/defaultValue-0c475b81.js +0 -25
- package/dist/assets/cesium/Workers/package.json +0 -1
- package/dist/assets/ui.08c48f.css +0 -1
- package/plugins/@vcmap/pluginExample/config.json +0 -6
- package/plugins/@vcmap/pluginExample/package.json +0 -7
- package/plugins/categoryTest/ItemEditor.vue +0 -13
- package/plugins/test/allIconsComponent.vue +0 -50
- package/plugins/test/index.js +0 -209
- package/plugins/wizardExample/wizardExample.vue +0 -77
- package/src/components/form-inputs-controls/VcsColorPicker.vue +0 -85
@@ -1,25 +1,2134 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
define(["./Transforms-d2e5867e","./Matrix2-eefef8eb","./defaultValue-0c475b81","./ComponentDatatype-0200bf8c","./ArcType-c9b2b290","./arrayRemoveDuplicates-f13aceb1","./EllipsoidGeodesic-8bfefbff","./EllipsoidRhumbLine-03528f73","./EncodedCartesian3-ea0e408f","./GeometryAttribute-8458a8fd","./IntersectionTests-eb4db8e0","./Plane-b0299683","./WebMercatorProjection-cd2f30c2","./_commonjsHelpers-bc29abbc","./combine-7533016d","./RuntimeError-5baf5c66","./WebGLConstants-5b50ced1"],(function(e,t,a,n,i,r,s,o,l,c,u,C,p,d,h,g,f){"use strict";function m(n){n=a.defaultValue(n,a.defaultValue.EMPTY_OBJECT),this._ellipsoid=a.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84),this._rectangle=a.defaultValue(n.rectangle,t.Rectangle.MAX_VALUE),this._projection=new e.GeographicProjection(this._ellipsoid),this._numberOfLevelZeroTilesX=a.defaultValue(n.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=a.defaultValue(n.numberOfLevelZeroTilesY,1)}Object.defineProperties(m.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}}),m.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e},m.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e},m.prototype.rectangleToNativeRectangle=function(e,i){const r=n.CesiumMath.toDegrees(e.west),s=n.CesiumMath.toDegrees(e.south),o=n.CesiumMath.toDegrees(e.east),l=n.CesiumMath.toDegrees(e.north);return a.defined(i)?(i.west=r,i.south=s,i.east=o,i.north=l,i):new t.Rectangle(r,s,o,l)},m.prototype.tileXYToNativeRectangle=function(e,t,a,i){const r=this.tileXYToRectangle(e,t,a,i);return r.west=n.CesiumMath.toDegrees(r.west),r.south=n.CesiumMath.toDegrees(r.south),r.east=n.CesiumMath.toDegrees(r.east),r.north=n.CesiumMath.toDegrees(r.north),r},m.prototype.tileXYToRectangle=function(e,n,i,r){const s=this._rectangle,o=this.getNumberOfXTilesAtLevel(i),l=this.getNumberOfYTilesAtLevel(i),c=s.width/o,u=e*c+s.west,C=(e+1)*c+s.west,p=s.height/l,d=s.north-n*p,h=s.north-(n+1)*p;return a.defined(r)||(r=new t.Rectangle(u,h,C,d)),r.west=u,r.south=h,r.east=C,r.north=d,r},m.prototype.positionToTileXY=function(e,i,r){const s=this._rectangle;if(!t.Rectangle.contains(s,e))return;const o=this.getNumberOfXTilesAtLevel(i),l=this.getNumberOfYTilesAtLevel(i),c=s.width/o,u=s.height/l;let C=e.longitude;s.east<s.west&&(C+=n.CesiumMath.TWO_PI);let p=(C-s.west)/c|0;p>=o&&(p=o-1);let d=(s.north-e.latitude)/u|0;return d>=l&&(d=l-1),a.defined(r)?(r.x=p,r.y=d,r):new t.Cartesian2(p,d)};const w=new t.Cartesian3,y=new t.Cartesian3,M=new t.Cartographic,T=new t.Cartesian3,E=new t.Cartesian3,_=new e.BoundingSphere,b=new m,O=[new t.Cartographic,new t.Cartographic,new t.Cartographic,new t.Cartographic],P=new t.Cartesian2,A={};function k(e){t.Cartographic.fromRadians(e.east,e.north,0,O[0]),t.Cartographic.fromRadians(e.west,e.north,0,O[1]),t.Cartographic.fromRadians(e.east,e.south,0,O[2]),t.Cartographic.fromRadians(e.west,e.south,0,O[3]);let a=0,n=0,i=0,r=0;const s=A._terrainHeightsMaxLevel;let o;for(o=0;o<=s;++o){let e=!1;for(let t=0;t<4;++t){const a=O[t];if(b.positionToTileXY(a,o,P),0===t)i=P.x,r=P.y;else if(i!==P.x||r!==P.y){e=!0;break}}if(e)break;a=i,n=r}if(0!==o)return{x:a,y:n,level:o>s?s:o-1}}A.initialize=function(){let t=A._initPromise;return a.defined(t)||(t=e.Resource.fetchJson(e.buildModuleUrl("Assets/approximateTerrainHeights.json")).then((function(e){A._terrainHeights=e})),A._initPromise=t),t},A.getMinimumMaximumHeights=function(e,n){n=a.defaultValue(n,t.Ellipsoid.WGS84);const i=k(e);let r=A._defaultMinTerrainHeight,s=A._defaultMaxTerrainHeight;if(a.defined(i)){const o=`${i.level}-${i.x}-${i.y}`,l=A._terrainHeights[o];a.defined(l)&&(r=l[0],s=l[1]),n.cartographicToCartesian(t.Rectangle.northeast(e,M),w),n.cartographicToCartesian(t.Rectangle.southwest(e,M),y),t.Cartesian3.midpoint(y,w,T);const c=n.scaleToGeodeticSurface(T,E);if(a.defined(c)){const e=t.Cartesian3.distance(T,c);r=Math.min(r,-e)}else r=A._defaultMinTerrainHeight}return r=Math.max(A._defaultMinTerrainHeight,r),{minimumTerrainHeight:r,maximumTerrainHeight:s}},A.getBoundingSphere=function(n,i){i=a.defaultValue(i,t.Ellipsoid.WGS84);const r=k(n);let s=A._defaultMaxTerrainHeight;if(a.defined(r)){const e=`${r.level}-${r.x}-${r.y}`,t=A._terrainHeights[e];a.defined(t)&&(s=t[1])}const o=e.BoundingSphere.fromRectangle3D(n,i,0);return e.BoundingSphere.fromRectangle3D(n,i,s,_),e.BoundingSphere.union(o,_,o)},A._terrainHeightsMaxLevel=6,A._defaultMaxTerrainHeight=9e3,A._defaultMinTerrainHeight=-1e5,A._terrainHeights=void 0,A._initPromise=void 0,Object.defineProperties(A,{initialized:{get:function(){return a.defined(A._terrainHeights)}}});var L=A;const S=[e.GeographicProjection,p.WebMercatorProjection],x=S.length,I=Math.cos(n.CesiumMath.toRadians(30)),N=Math.cos(n.CesiumMath.toRadians(150));function R(e){const n=(e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT)).positions;this.width=a.defaultValue(e.width,1),this._positions=n,this.granularity=a.defaultValue(e.granularity,9999),this.loop=a.defaultValue(e.loop,!1),this.arcType=a.defaultValue(e.arcType,i.ArcType.GEODESIC),this._ellipsoid=t.Ellipsoid.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(R.prototype,{packedLength:{get:function(){return 1+3*this._positions.length+1+1+1+t.Ellipsoid.packedLength+1+1}}}),R.setProjectionAndEllipsoid=function(e,t){let a=0;for(let e=0;e<x;e++)if(t instanceof S[e]){a=e;break}e._projectionIndex=a,e._ellipsoid=t.ellipsoid};const D=new t.Cartesian3,v=new t.Cartesian3,z=new t.Cartesian3;function H(e,a,n,i,r){const s=q(i,e,0,D),o=q(i,e,n,v),l=q(i,a,0,z),c=X(o,s,v),u=X(l,s,z);return t.Cartesian3.cross(u,c,r),t.Cartesian3.normalize(r,r)}const j=new t.Cartographic,B=new t.Cartesian3,V=new t.Cartesian3,G=new t.Cartesian3;function Y(e,a,n,r,l,c,u,C,p,d,h){if(0===l)return;let g;c===i.ArcType.GEODESIC?g=new s.EllipsoidGeodesic(e,a,u):c===i.ArcType.RHUMB&&(g=new o.EllipsoidRhumbLine(e,a,u));const f=g.surfaceDistance;if(f<l)return;const m=H(e,a,r,u,G),w=Math.ceil(f/l),y=f/w;let M=y;const T=w-1;let E=C.length;for(let e=0;e<T;e++){const e=g.interpolateUsingSurfaceDistance(M,j),a=q(u,e,n,B),i=q(u,e,r,V);t.Cartesian3.pack(m,C,E),t.Cartesian3.pack(a,p,E),t.Cartesian3.pack(i,d,E),h.push(e.latitude),h.push(e.longitude),E+=3,M+=y}}const F=new t.Cartographic;function q(e,a,n,i){return t.Cartographic.clone(a,F),F.height=n,t.Cartographic.toCartesian(F,e,i)}function X(e,a,n){return t.Cartesian3.subtract(e,a,n),t.Cartesian3.normalize(n,n),n}function W(e,a,n,i){return i=X(e,a,i),i=t.Cartesian3.cross(i,n,i),i=t.Cartesian3.normalize(i,i),i=t.Cartesian3.cross(n,i,i)}R.pack=function(e,n,i){let r=a.defaultValue(i,0);const s=e._positions,o=s.length;n[r++]=o;for(let e=0;e<o;++e){const a=s[e];t.Cartesian3.pack(a,n,r),r+=3}return n[r++]=e.granularity,n[r++]=e.loop?1:0,n[r++]=e.arcType,t.Ellipsoid.pack(e._ellipsoid,n,r),r+=t.Ellipsoid.packedLength,n[r++]=e._projectionIndex,n[r++]=e._scene3DOnly?1:0,n},R.unpack=function(e,n,i){let r=a.defaultValue(n,0);const s=e[r++],o=new Array(s);for(let a=0;a<s;a++)o[a]=t.Cartesian3.unpack(e,r),r+=3;const l=e[r++],c=1===e[r++],u=e[r++],C=t.Ellipsoid.unpack(e,r);r+=t.Ellipsoid.packedLength;const p=e[r++],d=1===e[r++];return a.defined(i)||(i=new R({positions:o})),i._positions=o,i.granularity=l,i.loop=c,i.arcType=u,i._ellipsoid=C,i._projectionIndex=p,i._scene3DOnly=d,i};const U=new t.Cartesian3,Z=new t.Cartesian3,$=new t.Cartesian3,J=new t.Cartesian3;function Q(e,a,i,r,s){const o=X(i,a,J),l=W(e,a,o,U),c=W(r,a,o,Z);if(n.CesiumMath.equalsEpsilon(t.Cartesian3.dot(l,c),-1,n.CesiumMath.EPSILON5))return s=t.Cartesian3.cross(o,l,s),s=t.Cartesian3.normalize(s,s);s=t.Cartesian3.add(c,l,s),s=t.Cartesian3.normalize(s,s);const u=t.Cartesian3.cross(o,s,$);return t.Cartesian3.dot(c,u)<0&&(s=t.Cartesian3.negate(s,s)),s}const K=C.Plane.fromPointNormal(t.Cartesian3.ZERO,t.Cartesian3.UNIT_Y),ee=new t.Cartesian3,te=new t.Cartesian3,ae=new t.Cartesian3,ne=new t.Cartesian3,ie=new t.Cartesian3,re=new t.Cartesian3,se=new t.Cartographic,oe=new t.Cartographic,le=new t.Cartographic;R.createGeometry=function(s){const C=!s._scene3DOnly;let p=s.loop;const d=s._ellipsoid,h=s.granularity,g=s.arcType,f=new S[s._projectionIndex](d),m=1e3;let w,y;const M=s._positions,T=M.length;let E,_,b,O;2===T&&(p=!1);const P=new o.EllipsoidRhumbLine(void 0,void 0,d);let A,k,x;const N=[M[0]];for(y=0;y<T-1;y++)E=M[y],_=M[y+1],A=u.IntersectionTests.lineSegmentPlane(E,_,K,re),!a.defined(A)||t.Cartesian3.equalsEpsilon(A,E,n.CesiumMath.EPSILON7)||t.Cartesian3.equalsEpsilon(A,_,n.CesiumMath.EPSILON7)||(s.arcType===i.ArcType.GEODESIC?N.push(t.Cartesian3.clone(A)):s.arcType===i.ArcType.RHUMB&&(x=d.cartesianToCartographic(A,se).longitude,b=d.cartesianToCartographic(E,se),O=d.cartesianToCartographic(_,oe),P.setEndPoints(b,O),k=P.findIntersectionWithLongitude(x,le),A=d.cartographicToCartesian(k,re),!a.defined(A)||t.Cartesian3.equalsEpsilon(A,E,n.CesiumMath.EPSILON7)||t.Cartesian3.equalsEpsilon(A,_,n.CesiumMath.EPSILON7)||N.push(t.Cartesian3.clone(A)))),N.push(_);p&&(E=M[T-1],_=M[0],A=u.IntersectionTests.lineSegmentPlane(E,_,K,re),!a.defined(A)||t.Cartesian3.equalsEpsilon(A,E,n.CesiumMath.EPSILON7)||t.Cartesian3.equalsEpsilon(A,_,n.CesiumMath.EPSILON7)||(s.arcType===i.ArcType.GEODESIC?N.push(t.Cartesian3.clone(A)):s.arcType===i.ArcType.RHUMB&&(x=d.cartesianToCartographic(A,se).longitude,b=d.cartesianToCartographic(E,se),O=d.cartesianToCartographic(_,oe),P.setEndPoints(b,O),k=P.findIntersectionWithLongitude(x,le),A=d.cartographicToCartesian(k,re),!a.defined(A)||t.Cartesian3.equalsEpsilon(A,E,n.CesiumMath.EPSILON7)||t.Cartesian3.equalsEpsilon(A,_,n.CesiumMath.EPSILON7)||N.push(t.Cartesian3.clone(A)))));let R=N.length,D=new Array(R);for(y=0;y<R;y++){const e=t.Cartographic.fromCartesian(N[y],d);e.height=0,D[y]=e}if(D=r.arrayRemoveDuplicates(D,t.Cartographic.equalsEpsilon),R=D.length,R<2)return;const v=[],z=[],j=[],B=[];let V=ee,G=te,F=ae,W=ne,U=ie;const Z=D[0],$=D[1];for(V=q(d,D[R-1],0,V),W=q(d,$,0,W),G=q(d,Z,0,G),F=q(d,Z,m,F),U=p?Q(V,G,F,W,U):H(Z,$,m,d,U),t.Cartesian3.pack(U,z,0),t.Cartesian3.pack(G,j,0),t.Cartesian3.pack(F,B,0),v.push(Z.latitude),v.push(Z.longitude),Y(Z,$,0,m,h,g,d,z,j,B,v),y=1;y<R-1;++y){V=t.Cartesian3.clone(G,V),G=t.Cartesian3.clone(W,G);const e=D[y];q(d,e,m,F),q(d,D[y+1],0,W),Q(V,G,F,W,U),w=z.length,t.Cartesian3.pack(U,z,w),t.Cartesian3.pack(G,j,w),t.Cartesian3.pack(F,B,w),v.push(e.latitude),v.push(e.longitude),Y(D[y],D[y+1],0,m,h,g,d,z,j,B,v)}const J=D[R-1],ce=D[R-2];if(G=q(d,J,0,G),F=q(d,J,m,F),p){const e=D[0];V=q(d,ce,0,V),W=q(d,e,0,W),U=Q(V,G,F,W,U)}else U=H(ce,J,m,d,U);if(w=z.length,t.Cartesian3.pack(U,z,w),t.Cartesian3.pack(G,j,w),t.Cartesian3.pack(F,B,w),v.push(J.latitude),v.push(J.longitude),p){for(Y(J,Z,0,m,h,g,d,z,j,B,v),w=z.length,y=0;y<3;++y)z[w+y]=z[y],j[w+y]=j[y],B[w+y]=B[y];v.push(Z.latitude),v.push(Z.longitude)}return function(a,i,r,s,o,u,C){let p,d;const h=i._ellipsoid,g=r.length/3-1,f=8*g,m=4*f,w=36*g,y=f>65535?new Uint32Array(w):new Uint16Array(w),M=new Float64Array(3*f),T=new Float32Array(m),E=new Float32Array(m),_=new Float32Array(m),b=new Float32Array(m),O=new Float32Array(m);let P,A,k,S;C&&(P=new Float32Array(m),A=new Float32Array(m),k=new Float32Array(m),S=new Float32Array(2*f));const x=u.length/2;let N=0;const R=_e;R.height=0;const D=be;D.height=0;let v=Oe,z=Pe;if(C)for(d=0,p=1;p<x;p++)R.latitude=u[d],R.longitude=u[d+1],D.latitude=u[d+2],D.longitude=u[d+3],v=i.project(R,v),z=i.project(D,z),N+=t.Cartesian3.distance(v,z),d+=2;const H=s.length/3;z=t.Cartesian3.unpack(s,0,z);let j,B=0;for(d=3,p=1;p<H;p++)v=t.Cartesian3.clone(z,v),z=t.Cartesian3.unpack(s,d,z),B+=t.Cartesian3.distance(v,z),d+=3;d=3;let V=0,G=0,Y=0,F=0,q=!1,W=t.Cartesian3.unpack(r,0,ke),U=t.Cartesian3.unpack(s,0,Pe),Z=t.Cartesian3.unpack(o,0,Se);if(a){pe(Z,t.Cartesian3.unpack(r,r.length-6,Ae),W,U)&&(Z=t.Cartesian3.negate(Z,Z))}let $=0,J=0,Q=0;for(p=0;p<g;p++){const e=t.Cartesian3.clone(W,Ae),a=t.Cartesian3.clone(U,Oe);let c,p,g,f,m=t.Cartesian3.clone(Z,Le);if(q&&(m=t.Cartesian3.negate(m,m)),W=t.Cartesian3.unpack(r,d,ke),U=t.Cartesian3.unpack(s,d,Pe),Z=t.Cartesian3.unpack(o,d,Se),q=pe(Z,e,W,U),R.latitude=u[V],R.longitude=u[V+1],D.latitude=u[V+2],D.longitude=u[V+3],C){const e=Ee(R,D);c=i.project(R,ze),p=i.project(D,He);const a=X(p,c,Ze);a.y=Math.abs(a.y),g=je,f=Be,0===e||t.Cartesian3.dot(a,t.Cartesian3.UNIT_Y)>I?(g=fe(i,R,m,c,je),f=fe(i,D,Z,p,Be)):1===e?(f=fe(i,D,Z,p,Be),g.x=0,g.y=n.CesiumMath.sign(R.longitude-Math.abs(D.longitude)),g.z=0):(g=fe(i,R,m,c,je),f.x=0,f.y=n.CesiumMath.sign(R.longitude-D.longitude),f.z=0)}const w=t.Cartesian3.distance(a,U),y=l.EncodedCartesian3.fromCartesian(e,We),x=t.Cartesian3.subtract(W,e,Ve),v=t.Cartesian3.normalize(x,Fe);let z=t.Cartesian3.subtract(a,e,Ge);z=t.Cartesian3.normalize(z,z);let H=t.Cartesian3.cross(v,z,Fe);H=t.Cartesian3.normalize(H,H);let K=t.Cartesian3.cross(z,m,qe);K=t.Cartesian3.normalize(K,K);let ee=t.Cartesian3.subtract(U,W,Ye);ee=t.Cartesian3.normalize(ee,ee);let te=t.Cartesian3.cross(Z,ee,Xe);te=t.Cartesian3.normalize(te,te);const ae=w/B,ne=$/B;let ie,re,se,oe=0,le=0,ce=0;if(C){oe=t.Cartesian3.distance(c,p),ie=l.EncodedCartesian3.fromCartesian(c,Ue),re=t.Cartesian3.subtract(p,c,Ze),se=t.Cartesian3.normalize(re,$e);const e=se.x;se.x=se.y,se.y=-e,le=oe/N,ce=J/N}for(j=0;j<8;j++){const e=F+4*j,a=G+2*j,n=e+3,i=j<4?1:-1,r=2===j||3===j||6===j||7===j?1:-1;t.Cartesian3.pack(y.high,T,e),T[n]=x.x,t.Cartesian3.pack(y.low,E,e),E[n]=x.y,t.Cartesian3.pack(K,_,e),_[n]=x.z,t.Cartesian3.pack(te,b,e),b[n]=ae*i,t.Cartesian3.pack(H,O,e);let s=ne*r;0===s&&r<0&&(s=9),O[n]=s,C&&(P[e]=ie.high.x,P[e+1]=ie.high.y,P[e+2]=ie.low.x,P[e+3]=ie.low.y,k[e]=-g.y,k[e+1]=g.x,k[e+2]=f.y,k[e+3]=-f.x,A[e]=re.x,A[e+1]=re.y,A[e+2]=se.x,A[e+3]=se.y,S[a]=le*i,s=ce*r,0===s&&r<0&&(s=9),S[a+1]=s)}const ue=De,Ce=ve,de=Ne,he=Re,ge=t.Rectangle.fromCartographicArray(xe,Ie),me=L.getMinimumMaximumHeights(ge,h),we=me.minimumTerrainHeight,Me=me.maximumTerrainHeight;Q+=we,Q+=Me,ye(e,a,we,Me,ue,de),ye(W,U,we,Me,Ce,he);let _e=t.Cartesian3.multiplyByScalar(H,n.CesiumMath.EPSILON5,Je);t.Cartesian3.add(ue,_e,ue),t.Cartesian3.add(Ce,_e,Ce),t.Cartesian3.add(de,_e,de),t.Cartesian3.add(he,_e,he),Te(ue,Ce),Te(de,he),t.Cartesian3.pack(ue,M,Y),t.Cartesian3.pack(Ce,M,Y+3),t.Cartesian3.pack(he,M,Y+6),t.Cartesian3.pack(de,M,Y+9),_e=t.Cartesian3.multiplyByScalar(H,-2*n.CesiumMath.EPSILON5,Je),t.Cartesian3.add(ue,_e,ue),t.Cartesian3.add(Ce,_e,Ce),t.Cartesian3.add(de,_e,de),t.Cartesian3.add(he,_e,he),Te(ue,Ce),Te(de,he),t.Cartesian3.pack(ue,M,Y+12),t.Cartesian3.pack(Ce,M,Y+15),t.Cartesian3.pack(he,M,Y+18),t.Cartesian3.pack(de,M,Y+21),V+=2,d+=3,G+=16,Y+=24,F+=32,$+=w,J+=oe}d=0;let K=0;for(p=0;p<g;p++){for(j=0;j<et;j++)y[d+j]=Ke[j]+K;K+=8,d+=et}const ee=Qe;e.BoundingSphere.fromVertices(r,t.Cartesian3.ZERO,3,ee[0]),e.BoundingSphere.fromVertices(s,t.Cartesian3.ZERO,3,ee[1]);const te=e.BoundingSphere.fromBoundingSpheres(ee);te.radius+=Q/(2*g);const ae={position:new c.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:M}),startHiAndForwardOffsetX:tt(T),startLoAndForwardOffsetY:tt(E),startNormalAndForwardOffsetZ:tt(_),endNormalAndTextureCoordinateNormalizationX:tt(b),rightNormalAndTextureCoordinateNormalizationY:tt(O)};C&&(ae.startHiLo2D=tt(P),ae.offsetAndRight2D=tt(A),ae.startEndNormals2D=tt(k),ae.texcoordNormalization2D=new c.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:S}));return new c.Geometry({attributes:ae,indices:y,boundingSphere:te})}(p,f,j,B,z,v,C)};const ce=new t.Cartesian3,ue=new t.Matrix3,Ce=new e.Quaternion;function pe(a,i,r,s){const o=X(r,i,ce),l=t.Cartesian3.dot(o,a);if(l>I||l<N){const i=X(s,r,J),o=l<N?n.CesiumMath.PI_OVER_TWO:-n.CesiumMath.PI_OVER_TWO,c=e.Quaternion.fromAxisAngle(i,o,Ce),u=t.Matrix3.fromQuaternion(c,ue);return t.Matrix3.multiplyByVector(u,a,a),!0}return!1}const de=new t.Cartographic,he=new t.Cartesian3,ge=new t.Cartesian3;function fe(e,a,i,r,s){const o=t.Cartographic.toCartesian(a,e._ellipsoid,he);let l=t.Cartesian3.add(o,i,ge),c=!1;const u=e._ellipsoid;let C=u.cartesianToCartographic(l,de);Math.abs(a.longitude-C.longitude)>n.CesiumMath.PI_OVER_TWO&&(c=!0,l=t.Cartesian3.subtract(o,i,ge),C=u.cartesianToCartographic(l,de)),C.height=0;const p=e.project(C,s);return(s=t.Cartesian3.subtract(p,r,s)).z=0,s=t.Cartesian3.normalize(s,s),c&&t.Cartesian3.negate(s,s),s}const me=new t.Cartesian3,we=new t.Cartesian3;function ye(e,a,n,i,r,s){const o=t.Cartesian3.subtract(a,e,me);t.Cartesian3.normalize(o,o);const l=n-0;let c=t.Cartesian3.multiplyByScalar(o,l,we);t.Cartesian3.add(e,c,r);const u=i-1e3;c=t.Cartesian3.multiplyByScalar(o,u,we),t.Cartesian3.add(a,c,s)}const Me=new t.Cartesian3;function Te(e,a){const i=C.Plane.getPointDistance(K,e),r=C.Plane.getPointDistance(K,a);let s=Me;n.CesiumMath.equalsEpsilon(i,0,n.CesiumMath.EPSILON2)?(s=X(a,e,s),t.Cartesian3.multiplyByScalar(s,n.CesiumMath.EPSILON2,s),t.Cartesian3.add(e,s,e)):n.CesiumMath.equalsEpsilon(r,0,n.CesiumMath.EPSILON2)&&(s=X(e,a,s),t.Cartesian3.multiplyByScalar(s,n.CesiumMath.EPSILON2,s),t.Cartesian3.add(a,s,a))}function Ee(e,t){const a=Math.abs(e.longitude),i=Math.abs(t.longitude);if(n.CesiumMath.equalsEpsilon(a,n.CesiumMath.PI,n.CesiumMath.EPSILON11)){const i=n.CesiumMath.sign(t.longitude);return e.longitude=i*(a-n.CesiumMath.EPSILON11),1}if(n.CesiumMath.equalsEpsilon(i,n.CesiumMath.PI,n.CesiumMath.EPSILON11)){const a=n.CesiumMath.sign(e.longitude);return t.longitude=a*(i-n.CesiumMath.EPSILON11),2}return 0}const _e=new t.Cartographic,be=new t.Cartographic,Oe=new t.Cartesian3,Pe=new t.Cartesian3,Ae=new t.Cartesian3,ke=new t.Cartesian3,Le=new t.Cartesian3,Se=new t.Cartesian3,xe=[_e,be],Ie=new t.Rectangle,Ne=new t.Cartesian3,Re=new t.Cartesian3,De=new t.Cartesian3,ve=new t.Cartesian3,ze=new t.Cartesian3,He=new t.Cartesian3,je=new t.Cartesian3,Be=new t.Cartesian3,Ve=new t.Cartesian3,Ge=new t.Cartesian3,Ye=new t.Cartesian3,Fe=new t.Cartesian3,qe=new t.Cartesian3,Xe=new t.Cartesian3,We=new l.EncodedCartesian3,Ue=new l.EncodedCartesian3,Ze=new t.Cartesian3,$e=new t.Cartesian3,Je=new t.Cartesian3,Qe=[new e.BoundingSphere,new e.BoundingSphere],Ke=[0,2,1,0,3,2,0,7,3,0,4,7,0,5,4,0,1,5,5,7,4,5,6,7,5,2,6,5,1,2,3,6,2,3,7,6],et=Ke.length;function tt(e){return new c.GeometryAttribute({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}return R._projectNormal=fe,function(e,t){return L.initialize().then((function(){return a.defined(t)&&(e=R.unpack(e,t)),R.createGeometry(e)}))}}));
|
1
|
+
define(['./Transforms-40229881', './Matrix2-13178034', './Matrix3-315394f6', './Check-666ab1a0', './defaultValue-0a909f67', './Math-2dbd6b93', './ArcType-ce2e50ab', './arrayRemoveDuplicates-c2038105', './ComponentDatatype-f7b11d02', './EllipsoidGeodesic-98c62a56', './EllipsoidRhumbLine-19756602', './EncodedCartesian3-81f70735', './GeometryAttribute-7d6f1732', './IntersectionTests-f6e6bd8a', './Plane-900aa728', './WebMercatorProjection-13a90d41', './combine-ca22a614', './RuntimeError-06c93819', './WebGLConstants-a8cc3e8c'], (function (Transforms, Matrix2, Matrix3, Check, defaultValue, Math$1, ArcType, arrayRemoveDuplicates, ComponentDatatype, EllipsoidGeodesic, EllipsoidRhumbLine, EncodedCartesian3, GeometryAttribute, IntersectionTests, Plane, WebMercatorProjection, combine, RuntimeError, WebGLConstants) { 'use strict';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* A tiling scheme for geometry referenced to a simple {@link GeographicProjection} where
|
5
|
+
* longitude and latitude are directly mapped to X and Y. This projection is commonly
|
6
|
+
* known as geographic, equirectangular, equidistant cylindrical, or plate carrée.
|
7
|
+
*
|
8
|
+
* @alias GeographicTilingScheme
|
9
|
+
* @constructor
|
10
|
+
*
|
11
|
+
* @param {Object} [options] Object with the following properties:
|
12
|
+
* @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid whose surface is being tiled. Defaults to
|
13
|
+
* the WGS84 ellipsoid.
|
14
|
+
* @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the tiling scheme.
|
15
|
+
* @param {Number} [options.numberOfLevelZeroTilesX=2] The number of tiles in the X direction at level zero of
|
16
|
+
* the tile tree.
|
17
|
+
* @param {Number} [options.numberOfLevelZeroTilesY=1] The number of tiles in the Y direction at level zero of
|
18
|
+
* the tile tree.
|
19
|
+
*/
|
20
|
+
function GeographicTilingScheme(options) {
|
21
|
+
options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
|
22
|
+
|
23
|
+
this._ellipsoid = defaultValue.defaultValue(options.ellipsoid, Matrix3.Ellipsoid.WGS84);
|
24
|
+
this._rectangle = defaultValue.defaultValue(options.rectangle, Matrix2.Rectangle.MAX_VALUE);
|
25
|
+
this._projection = new Transforms.GeographicProjection(this._ellipsoid);
|
26
|
+
this._numberOfLevelZeroTilesX = defaultValue.defaultValue(
|
27
|
+
options.numberOfLevelZeroTilesX,
|
28
|
+
2
|
29
|
+
);
|
30
|
+
this._numberOfLevelZeroTilesY = defaultValue.defaultValue(
|
31
|
+
options.numberOfLevelZeroTilesY,
|
32
|
+
1
|
33
|
+
);
|
34
|
+
}
|
35
|
+
|
36
|
+
Object.defineProperties(GeographicTilingScheme.prototype, {
|
37
|
+
/**
|
38
|
+
* Gets the ellipsoid that is tiled by this tiling scheme.
|
39
|
+
* @memberof GeographicTilingScheme.prototype
|
40
|
+
* @type {Ellipsoid}
|
41
|
+
*/
|
42
|
+
ellipsoid: {
|
43
|
+
get: function () {
|
44
|
+
return this._ellipsoid;
|
45
|
+
},
|
46
|
+
},
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Gets the rectangle, in radians, covered by this tiling scheme.
|
50
|
+
* @memberof GeographicTilingScheme.prototype
|
51
|
+
* @type {Rectangle}
|
52
|
+
*/
|
53
|
+
rectangle: {
|
54
|
+
get: function () {
|
55
|
+
return this._rectangle;
|
56
|
+
},
|
57
|
+
},
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Gets the map projection used by this tiling scheme.
|
61
|
+
* @memberof GeographicTilingScheme.prototype
|
62
|
+
* @type {MapProjection}
|
63
|
+
*/
|
64
|
+
projection: {
|
65
|
+
get: function () {
|
66
|
+
return this._projection;
|
67
|
+
},
|
68
|
+
},
|
69
|
+
});
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Gets the total number of tiles in the X direction at a specified level-of-detail.
|
73
|
+
*
|
74
|
+
* @param {Number} level The level-of-detail.
|
75
|
+
* @returns {Number} The number of tiles in the X direction at the given level.
|
76
|
+
*/
|
77
|
+
GeographicTilingScheme.prototype.getNumberOfXTilesAtLevel = function (level) {
|
78
|
+
return this._numberOfLevelZeroTilesX << level;
|
79
|
+
};
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Gets the total number of tiles in the Y direction at a specified level-of-detail.
|
83
|
+
*
|
84
|
+
* @param {Number} level The level-of-detail.
|
85
|
+
* @returns {Number} The number of tiles in the Y direction at the given level.
|
86
|
+
*/
|
87
|
+
GeographicTilingScheme.prototype.getNumberOfYTilesAtLevel = function (level) {
|
88
|
+
return this._numberOfLevelZeroTilesY << level;
|
89
|
+
};
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Transforms a rectangle specified in geodetic radians to the native coordinate system
|
93
|
+
* of this tiling scheme.
|
94
|
+
*
|
95
|
+
* @param {Rectangle} rectangle The rectangle to transform.
|
96
|
+
* @param {Rectangle} [result] The instance to which to copy the result, or undefined if a new instance
|
97
|
+
* should be created.
|
98
|
+
* @returns {Rectangle} The specified 'result', or a new object containing the native rectangle if 'result'
|
99
|
+
* is undefined.
|
100
|
+
*/
|
101
|
+
GeographicTilingScheme.prototype.rectangleToNativeRectangle = function (
|
102
|
+
rectangle,
|
103
|
+
result
|
104
|
+
) {
|
105
|
+
//>>includeStart('debug', pragmas.debug);
|
106
|
+
Check.Check.defined("rectangle", rectangle);
|
107
|
+
//>>includeEnd('debug');
|
108
|
+
|
109
|
+
const west = Math$1.CesiumMath.toDegrees(rectangle.west);
|
110
|
+
const south = Math$1.CesiumMath.toDegrees(rectangle.south);
|
111
|
+
const east = Math$1.CesiumMath.toDegrees(rectangle.east);
|
112
|
+
const north = Math$1.CesiumMath.toDegrees(rectangle.north);
|
113
|
+
|
114
|
+
if (!defaultValue.defined(result)) {
|
115
|
+
return new Matrix2.Rectangle(west, south, east, north);
|
116
|
+
}
|
117
|
+
|
118
|
+
result.west = west;
|
119
|
+
result.south = south;
|
120
|
+
result.east = east;
|
121
|
+
result.north = north;
|
122
|
+
return result;
|
123
|
+
};
|
124
|
+
|
125
|
+
/**
|
126
|
+
* Converts tile x, y coordinates and level to a rectangle expressed in the native coordinates
|
127
|
+
* of the tiling scheme.
|
128
|
+
*
|
129
|
+
* @param {Number} x The integer x coordinate of the tile.
|
130
|
+
* @param {Number} y The integer y coordinate of the tile.
|
131
|
+
* @param {Number} level The tile level-of-detail. Zero is the least detailed.
|
132
|
+
* @param {Object} [result] The instance to which to copy the result, or undefined if a new instance
|
133
|
+
* should be created.
|
134
|
+
* @returns {Rectangle} The specified 'result', or a new object containing the rectangle
|
135
|
+
* if 'result' is undefined.
|
136
|
+
*/
|
137
|
+
GeographicTilingScheme.prototype.tileXYToNativeRectangle = function (
|
138
|
+
x,
|
139
|
+
y,
|
140
|
+
level,
|
141
|
+
result
|
142
|
+
) {
|
143
|
+
const rectangleRadians = this.tileXYToRectangle(x, y, level, result);
|
144
|
+
rectangleRadians.west = Math$1.CesiumMath.toDegrees(rectangleRadians.west);
|
145
|
+
rectangleRadians.south = Math$1.CesiumMath.toDegrees(rectangleRadians.south);
|
146
|
+
rectangleRadians.east = Math$1.CesiumMath.toDegrees(rectangleRadians.east);
|
147
|
+
rectangleRadians.north = Math$1.CesiumMath.toDegrees(rectangleRadians.north);
|
148
|
+
return rectangleRadians;
|
149
|
+
};
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Converts tile x, y coordinates and level to a cartographic rectangle in radians.
|
153
|
+
*
|
154
|
+
* @param {Number} x The integer x coordinate of the tile.
|
155
|
+
* @param {Number} y The integer y coordinate of the tile.
|
156
|
+
* @param {Number} level The tile level-of-detail. Zero is the least detailed.
|
157
|
+
* @param {Object} [result] The instance to which to copy the result, or undefined if a new instance
|
158
|
+
* should be created.
|
159
|
+
* @returns {Rectangle} The specified 'result', or a new object containing the rectangle
|
160
|
+
* if 'result' is undefined.
|
161
|
+
*/
|
162
|
+
GeographicTilingScheme.prototype.tileXYToRectangle = function (
|
163
|
+
x,
|
164
|
+
y,
|
165
|
+
level,
|
166
|
+
result
|
167
|
+
) {
|
168
|
+
const rectangle = this._rectangle;
|
169
|
+
|
170
|
+
const xTiles = this.getNumberOfXTilesAtLevel(level);
|
171
|
+
const yTiles = this.getNumberOfYTilesAtLevel(level);
|
172
|
+
|
173
|
+
const xTileWidth = rectangle.width / xTiles;
|
174
|
+
const west = x * xTileWidth + rectangle.west;
|
175
|
+
const east = (x + 1) * xTileWidth + rectangle.west;
|
176
|
+
|
177
|
+
const yTileHeight = rectangle.height / yTiles;
|
178
|
+
const north = rectangle.north - y * yTileHeight;
|
179
|
+
const south = rectangle.north - (y + 1) * yTileHeight;
|
180
|
+
|
181
|
+
if (!defaultValue.defined(result)) {
|
182
|
+
result = new Matrix2.Rectangle(west, south, east, north);
|
183
|
+
}
|
184
|
+
|
185
|
+
result.west = west;
|
186
|
+
result.south = south;
|
187
|
+
result.east = east;
|
188
|
+
result.north = north;
|
189
|
+
return result;
|
190
|
+
};
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Calculates the tile x, y coordinates of the tile containing
|
194
|
+
* a given cartographic position.
|
195
|
+
*
|
196
|
+
* @param {Cartographic} position The position.
|
197
|
+
* @param {Number} level The tile level-of-detail. Zero is the least detailed.
|
198
|
+
* @param {Cartesian2} [result] The instance to which to copy the result, or undefined if a new instance
|
199
|
+
* should be created.
|
200
|
+
* @returns {Cartesian2} The specified 'result', or a new object containing the tile x, y coordinates
|
201
|
+
* if 'result' is undefined.
|
202
|
+
*/
|
203
|
+
GeographicTilingScheme.prototype.positionToTileXY = function (
|
204
|
+
position,
|
205
|
+
level,
|
206
|
+
result
|
207
|
+
) {
|
208
|
+
const rectangle = this._rectangle;
|
209
|
+
if (!Matrix2.Rectangle.contains(rectangle, position)) {
|
210
|
+
// outside the bounds of the tiling scheme
|
211
|
+
return undefined;
|
212
|
+
}
|
213
|
+
|
214
|
+
const xTiles = this.getNumberOfXTilesAtLevel(level);
|
215
|
+
const yTiles = this.getNumberOfYTilesAtLevel(level);
|
216
|
+
|
217
|
+
const xTileWidth = rectangle.width / xTiles;
|
218
|
+
const yTileHeight = rectangle.height / yTiles;
|
219
|
+
|
220
|
+
let longitude = position.longitude;
|
221
|
+
if (rectangle.east < rectangle.west) {
|
222
|
+
longitude += Math$1.CesiumMath.TWO_PI;
|
223
|
+
}
|
224
|
+
|
225
|
+
let xTileCoordinate = ((longitude - rectangle.west) / xTileWidth) | 0;
|
226
|
+
if (xTileCoordinate >= xTiles) {
|
227
|
+
xTileCoordinate = xTiles - 1;
|
228
|
+
}
|
229
|
+
|
230
|
+
let yTileCoordinate =
|
231
|
+
((rectangle.north - position.latitude) / yTileHeight) | 0;
|
232
|
+
if (yTileCoordinate >= yTiles) {
|
233
|
+
yTileCoordinate = yTiles - 1;
|
234
|
+
}
|
235
|
+
|
236
|
+
if (!defaultValue.defined(result)) {
|
237
|
+
return new Matrix2.Cartesian2(xTileCoordinate, yTileCoordinate);
|
238
|
+
}
|
239
|
+
|
240
|
+
result.x = xTileCoordinate;
|
241
|
+
result.y = yTileCoordinate;
|
242
|
+
return result;
|
243
|
+
};
|
244
|
+
|
245
|
+
const scratchDiagonalCartesianNE = new Matrix3.Cartesian3();
|
246
|
+
const scratchDiagonalCartesianSW = new Matrix3.Cartesian3();
|
247
|
+
const scratchDiagonalCartographic = new Matrix3.Cartographic();
|
248
|
+
const scratchCenterCartesian = new Matrix3.Cartesian3();
|
249
|
+
const scratchSurfaceCartesian = new Matrix3.Cartesian3();
|
250
|
+
|
251
|
+
const scratchBoundingSphere = new Transforms.BoundingSphere();
|
252
|
+
const tilingScheme = new GeographicTilingScheme();
|
253
|
+
const scratchCorners = [
|
254
|
+
new Matrix3.Cartographic(),
|
255
|
+
new Matrix3.Cartographic(),
|
256
|
+
new Matrix3.Cartographic(),
|
257
|
+
new Matrix3.Cartographic(),
|
258
|
+
];
|
259
|
+
const scratchTileXY = new Matrix2.Cartesian2();
|
260
|
+
|
261
|
+
/**
|
262
|
+
* A collection of functions for approximating terrain height
|
263
|
+
* @private
|
264
|
+
*/
|
265
|
+
const ApproximateTerrainHeights = {};
|
266
|
+
|
267
|
+
/**
|
268
|
+
* Initializes the minimum and maximum terrain heights
|
269
|
+
* @return {Promise.<void>}
|
270
|
+
*/
|
271
|
+
ApproximateTerrainHeights.initialize = function () {
|
272
|
+
let initPromise = ApproximateTerrainHeights._initPromise;
|
273
|
+
if (defaultValue.defined(initPromise)) {
|
274
|
+
return initPromise;
|
275
|
+
}
|
276
|
+
initPromise = Transforms.Resource.fetchJson(
|
277
|
+
Transforms.buildModuleUrl("Assets/approximateTerrainHeights.json")
|
278
|
+
).then(function (json) {
|
279
|
+
ApproximateTerrainHeights._terrainHeights = json;
|
280
|
+
});
|
281
|
+
ApproximateTerrainHeights._initPromise = initPromise;
|
282
|
+
|
283
|
+
return initPromise;
|
284
|
+
};
|
285
|
+
|
286
|
+
/**
|
287
|
+
* Computes the minimum and maximum terrain heights for a given rectangle
|
288
|
+
* @param {Rectangle} rectangle The bounding rectangle
|
289
|
+
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid
|
290
|
+
* @return {{minimumTerrainHeight: Number, maximumTerrainHeight: Number}}
|
291
|
+
*/
|
292
|
+
ApproximateTerrainHeights.getMinimumMaximumHeights = function (
|
293
|
+
rectangle,
|
294
|
+
ellipsoid
|
295
|
+
) {
|
296
|
+
//>>includeStart('debug', pragmas.debug);
|
297
|
+
Check.Check.defined("rectangle", rectangle);
|
298
|
+
if (!defaultValue.defined(ApproximateTerrainHeights._terrainHeights)) {
|
299
|
+
throw new Check.DeveloperError(
|
300
|
+
"You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function"
|
301
|
+
);
|
302
|
+
}
|
303
|
+
//>>includeEnd('debug');
|
304
|
+
ellipsoid = defaultValue.defaultValue(ellipsoid, Matrix3.Ellipsoid.WGS84);
|
305
|
+
|
306
|
+
const xyLevel = getTileXYLevel(rectangle);
|
307
|
+
|
308
|
+
// Get the terrain min/max for that tile
|
309
|
+
let minTerrainHeight = ApproximateTerrainHeights._defaultMinTerrainHeight;
|
310
|
+
let maxTerrainHeight = ApproximateTerrainHeights._defaultMaxTerrainHeight;
|
311
|
+
if (defaultValue.defined(xyLevel)) {
|
312
|
+
const key = `${xyLevel.level}-${xyLevel.x}-${xyLevel.y}`;
|
313
|
+
const heights = ApproximateTerrainHeights._terrainHeights[key];
|
314
|
+
if (defaultValue.defined(heights)) {
|
315
|
+
minTerrainHeight = heights[0];
|
316
|
+
maxTerrainHeight = heights[1];
|
317
|
+
}
|
318
|
+
|
319
|
+
// Compute min by taking the center of the NE->SW diagonal and finding distance to the surface
|
320
|
+
ellipsoid.cartographicToCartesian(
|
321
|
+
Matrix2.Rectangle.northeast(rectangle, scratchDiagonalCartographic),
|
322
|
+
scratchDiagonalCartesianNE
|
323
|
+
);
|
324
|
+
ellipsoid.cartographicToCartesian(
|
325
|
+
Matrix2.Rectangle.southwest(rectangle, scratchDiagonalCartographic),
|
326
|
+
scratchDiagonalCartesianSW
|
327
|
+
);
|
328
|
+
|
329
|
+
Matrix3.Cartesian3.midpoint(
|
330
|
+
scratchDiagonalCartesianSW,
|
331
|
+
scratchDiagonalCartesianNE,
|
332
|
+
scratchCenterCartesian
|
333
|
+
);
|
334
|
+
const surfacePosition = ellipsoid.scaleToGeodeticSurface(
|
335
|
+
scratchCenterCartesian,
|
336
|
+
scratchSurfaceCartesian
|
337
|
+
);
|
338
|
+
if (defaultValue.defined(surfacePosition)) {
|
339
|
+
const distance = Matrix3.Cartesian3.distance(
|
340
|
+
scratchCenterCartesian,
|
341
|
+
surfacePosition
|
342
|
+
);
|
343
|
+
minTerrainHeight = Math.min(minTerrainHeight, -distance);
|
344
|
+
} else {
|
345
|
+
minTerrainHeight = ApproximateTerrainHeights._defaultMinTerrainHeight;
|
346
|
+
}
|
347
|
+
}
|
348
|
+
|
349
|
+
minTerrainHeight = Math.max(
|
350
|
+
ApproximateTerrainHeights._defaultMinTerrainHeight,
|
351
|
+
minTerrainHeight
|
352
|
+
);
|
353
|
+
|
354
|
+
return {
|
355
|
+
minimumTerrainHeight: minTerrainHeight,
|
356
|
+
maximumTerrainHeight: maxTerrainHeight,
|
357
|
+
};
|
358
|
+
};
|
359
|
+
|
360
|
+
/**
|
361
|
+
* Computes the bounding sphere based on the tile heights in the rectangle
|
362
|
+
* @param {Rectangle} rectangle The bounding rectangle
|
363
|
+
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid
|
364
|
+
* @return {BoundingSphere} The result bounding sphere
|
365
|
+
*/
|
366
|
+
ApproximateTerrainHeights.getBoundingSphere = function (rectangle, ellipsoid) {
|
367
|
+
//>>includeStart('debug', pragmas.debug);
|
368
|
+
Check.Check.defined("rectangle", rectangle);
|
369
|
+
if (!defaultValue.defined(ApproximateTerrainHeights._terrainHeights)) {
|
370
|
+
throw new Check.DeveloperError(
|
371
|
+
"You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function"
|
372
|
+
);
|
373
|
+
}
|
374
|
+
//>>includeEnd('debug');
|
375
|
+
ellipsoid = defaultValue.defaultValue(ellipsoid, Matrix3.Ellipsoid.WGS84);
|
376
|
+
|
377
|
+
const xyLevel = getTileXYLevel(rectangle);
|
378
|
+
|
379
|
+
// Get the terrain max for that tile
|
380
|
+
let maxTerrainHeight = ApproximateTerrainHeights._defaultMaxTerrainHeight;
|
381
|
+
if (defaultValue.defined(xyLevel)) {
|
382
|
+
const key = `${xyLevel.level}-${xyLevel.x}-${xyLevel.y}`;
|
383
|
+
const heights = ApproximateTerrainHeights._terrainHeights[key];
|
384
|
+
if (defaultValue.defined(heights)) {
|
385
|
+
maxTerrainHeight = heights[1];
|
386
|
+
}
|
387
|
+
}
|
388
|
+
|
389
|
+
const result = Transforms.BoundingSphere.fromRectangle3D(rectangle, ellipsoid, 0.0);
|
390
|
+
Transforms.BoundingSphere.fromRectangle3D(
|
391
|
+
rectangle,
|
392
|
+
ellipsoid,
|
393
|
+
maxTerrainHeight,
|
394
|
+
scratchBoundingSphere
|
395
|
+
);
|
396
|
+
|
397
|
+
return Transforms.BoundingSphere.union(result, scratchBoundingSphere, result);
|
398
|
+
};
|
399
|
+
|
400
|
+
function getTileXYLevel(rectangle) {
|
401
|
+
Matrix3.Cartographic.fromRadians(
|
402
|
+
rectangle.east,
|
403
|
+
rectangle.north,
|
404
|
+
0.0,
|
405
|
+
scratchCorners[0]
|
406
|
+
);
|
407
|
+
Matrix3.Cartographic.fromRadians(
|
408
|
+
rectangle.west,
|
409
|
+
rectangle.north,
|
410
|
+
0.0,
|
411
|
+
scratchCorners[1]
|
412
|
+
);
|
413
|
+
Matrix3.Cartographic.fromRadians(
|
414
|
+
rectangle.east,
|
415
|
+
rectangle.south,
|
416
|
+
0.0,
|
417
|
+
scratchCorners[2]
|
418
|
+
);
|
419
|
+
Matrix3.Cartographic.fromRadians(
|
420
|
+
rectangle.west,
|
421
|
+
rectangle.south,
|
422
|
+
0.0,
|
423
|
+
scratchCorners[3]
|
424
|
+
);
|
425
|
+
|
426
|
+
// Determine which tile the bounding rectangle is in
|
427
|
+
let lastLevelX = 0,
|
428
|
+
lastLevelY = 0;
|
429
|
+
let currentX = 0,
|
430
|
+
currentY = 0;
|
431
|
+
const maxLevel = ApproximateTerrainHeights._terrainHeightsMaxLevel;
|
432
|
+
let i;
|
433
|
+
for (i = 0; i <= maxLevel; ++i) {
|
434
|
+
let failed = false;
|
435
|
+
for (let j = 0; j < 4; ++j) {
|
436
|
+
const corner = scratchCorners[j];
|
437
|
+
tilingScheme.positionToTileXY(corner, i, scratchTileXY);
|
438
|
+
if (j === 0) {
|
439
|
+
currentX = scratchTileXY.x;
|
440
|
+
currentY = scratchTileXY.y;
|
441
|
+
} else if (currentX !== scratchTileXY.x || currentY !== scratchTileXY.y) {
|
442
|
+
failed = true;
|
443
|
+
break;
|
444
|
+
}
|
445
|
+
}
|
446
|
+
|
447
|
+
if (failed) {
|
448
|
+
break;
|
449
|
+
}
|
450
|
+
|
451
|
+
lastLevelX = currentX;
|
452
|
+
lastLevelY = currentY;
|
453
|
+
}
|
454
|
+
|
455
|
+
if (i === 0) {
|
456
|
+
return undefined;
|
457
|
+
}
|
458
|
+
|
459
|
+
return {
|
460
|
+
x: lastLevelX,
|
461
|
+
y: lastLevelY,
|
462
|
+
level: i > maxLevel ? maxLevel : i - 1,
|
463
|
+
};
|
464
|
+
}
|
465
|
+
|
466
|
+
ApproximateTerrainHeights._terrainHeightsMaxLevel = 6;
|
467
|
+
ApproximateTerrainHeights._defaultMaxTerrainHeight = 9000.0;
|
468
|
+
ApproximateTerrainHeights._defaultMinTerrainHeight = -100000.0;
|
469
|
+
ApproximateTerrainHeights._terrainHeights = undefined;
|
470
|
+
ApproximateTerrainHeights._initPromise = undefined;
|
471
|
+
|
472
|
+
Object.defineProperties(ApproximateTerrainHeights, {
|
473
|
+
/**
|
474
|
+
* Determines if the terrain heights are initialized and ready to use. To initialize the terrain heights,
|
475
|
+
* call {@link ApproximateTerrainHeights#initialize} and wait for the returned promise to resolve.
|
476
|
+
* @type {Boolean}
|
477
|
+
* @readonly
|
478
|
+
* @memberof ApproximateTerrainHeights
|
479
|
+
*/
|
480
|
+
initialized: {
|
481
|
+
get: function () {
|
482
|
+
return defaultValue.defined(ApproximateTerrainHeights._terrainHeights);
|
483
|
+
},
|
484
|
+
},
|
485
|
+
});
|
486
|
+
var ApproximateTerrainHeights$1 = ApproximateTerrainHeights;
|
487
|
+
|
488
|
+
const PROJECTIONS = [Transforms.GeographicProjection, WebMercatorProjection.WebMercatorProjection];
|
489
|
+
const PROJECTION_COUNT = PROJECTIONS.length;
|
490
|
+
|
491
|
+
const MITER_BREAK_SMALL = Math.cos(Math$1.CesiumMath.toRadians(30.0));
|
492
|
+
const MITER_BREAK_LARGE = Math.cos(Math$1.CesiumMath.toRadians(150.0));
|
493
|
+
|
494
|
+
// Initial heights for constructing the wall.
|
495
|
+
// Keeping WALL_INITIAL_MIN_HEIGHT near the ellipsoid surface helps
|
496
|
+
// prevent precision problems with planes in the shader.
|
497
|
+
// Putting the start point of a plane at ApproximateTerrainHeights._defaultMinTerrainHeight,
|
498
|
+
// which is a highly conservative bound, usually puts the plane origin several thousands
|
499
|
+
// of meters away from the actual terrain, causing floating point problems when checking
|
500
|
+
// fragments on terrain against the plane.
|
501
|
+
// Ellipsoid height is generally much closer.
|
502
|
+
// The initial max height is arbitrary.
|
503
|
+
// Both heights are corrected using ApproximateTerrainHeights for computing the actual volume geometry.
|
504
|
+
const WALL_INITIAL_MIN_HEIGHT = 0.0;
|
505
|
+
const WALL_INITIAL_MAX_HEIGHT = 1000.0;
|
506
|
+
|
507
|
+
/**
|
508
|
+
* A description of a polyline on terrain or 3D Tiles. Only to be used with {@link GroundPolylinePrimitive}.
|
509
|
+
*
|
510
|
+
* @alias GroundPolylineGeometry
|
511
|
+
* @constructor
|
512
|
+
*
|
513
|
+
* @param {Object} options Options with the following properties:
|
514
|
+
* @param {Cartesian3[]} options.positions An array of {@link Cartesian3} defining the polyline's points. Heights above the ellipsoid will be ignored.
|
515
|
+
* @param {Number} [options.width=1.0] The screen space width in pixels.
|
516
|
+
* @param {Number} [options.granularity=9999.0] The distance interval in meters used for interpolating options.points. Defaults to 9999.0 meters. Zero indicates no interpolation.
|
517
|
+
* @param {Boolean} [options.loop=false] Whether during geometry creation a line segment will be added between the last and first line positions to make this Polyline a loop.
|
518
|
+
* @param {ArcType} [options.arcType=ArcType.GEODESIC] The type of line the polyline segments must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
|
519
|
+
*
|
520
|
+
* @exception {DeveloperError} At least two positions are required.
|
521
|
+
*
|
522
|
+
* @see GroundPolylinePrimitive
|
523
|
+
*
|
524
|
+
* @example
|
525
|
+
* const positions = Cesium.Cartesian3.fromDegreesArray([
|
526
|
+
* -112.1340164450331, 36.05494287836128,
|
527
|
+
* -112.08821010582645, 36.097804071380715,
|
528
|
+
* -112.13296079730024, 36.168769146801104
|
529
|
+
* ]);
|
530
|
+
*
|
531
|
+
* const geometry = new Cesium.GroundPolylineGeometry({
|
532
|
+
* positions : positions
|
533
|
+
* });
|
534
|
+
*/
|
535
|
+
function GroundPolylineGeometry(options) {
|
536
|
+
options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
|
537
|
+
const positions = options.positions;
|
538
|
+
|
539
|
+
//>>includeStart('debug', pragmas.debug);
|
540
|
+
if (!defaultValue.defined(positions) || positions.length < 2) {
|
541
|
+
throw new Check.DeveloperError("At least two positions are required.");
|
542
|
+
}
|
543
|
+
if (
|
544
|
+
defaultValue.defined(options.arcType) &&
|
545
|
+
options.arcType !== ArcType.ArcType.GEODESIC &&
|
546
|
+
options.arcType !== ArcType.ArcType.RHUMB
|
547
|
+
) {
|
548
|
+
throw new Check.DeveloperError(
|
549
|
+
"Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB."
|
550
|
+
);
|
551
|
+
}
|
552
|
+
//>>includeEnd('debug');
|
553
|
+
|
554
|
+
/**
|
555
|
+
* The screen space width in pixels.
|
556
|
+
* @type {Number}
|
557
|
+
*/
|
558
|
+
this.width = defaultValue.defaultValue(options.width, 1.0); // Doesn't get packed, not necessary for computing geometry.
|
559
|
+
|
560
|
+
this._positions = positions;
|
561
|
+
|
562
|
+
/**
|
563
|
+
* The distance interval used for interpolating options.points. Zero indicates no interpolation.
|
564
|
+
* Default of 9999.0 allows centimeter accuracy with 32 bit floating point.
|
565
|
+
* @type {Boolean}
|
566
|
+
* @default 9999.0
|
567
|
+
*/
|
568
|
+
this.granularity = defaultValue.defaultValue(options.granularity, 9999.0);
|
569
|
+
|
570
|
+
/**
|
571
|
+
* Whether during geometry creation a line segment will be added between the last and first line positions to make this Polyline a loop.
|
572
|
+
* If the geometry has two positions this parameter will be ignored.
|
573
|
+
* @type {Boolean}
|
574
|
+
* @default false
|
575
|
+
*/
|
576
|
+
this.loop = defaultValue.defaultValue(options.loop, false);
|
577
|
+
|
578
|
+
/**
|
579
|
+
* The type of path the polyline must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
|
580
|
+
* @type {ArcType}
|
581
|
+
* @default ArcType.GEODESIC
|
582
|
+
*/
|
583
|
+
this.arcType = defaultValue.defaultValue(options.arcType, ArcType.ArcType.GEODESIC);
|
584
|
+
|
585
|
+
this._ellipsoid = Matrix3.Ellipsoid.WGS84;
|
586
|
+
|
587
|
+
// MapProjections can't be packed, so store the index to a known MapProjection.
|
588
|
+
this._projectionIndex = 0;
|
589
|
+
this._workerName = "createGroundPolylineGeometry";
|
590
|
+
|
591
|
+
// Used by GroundPolylinePrimitive to signal worker that scenemode is 3D only.
|
592
|
+
this._scene3DOnly = false;
|
593
|
+
}
|
594
|
+
|
595
|
+
Object.defineProperties(GroundPolylineGeometry.prototype, {
|
596
|
+
/**
|
597
|
+
* The number of elements used to pack the object into an array.
|
598
|
+
* @memberof GroundPolylineGeometry.prototype
|
599
|
+
* @type {Number}
|
600
|
+
* @readonly
|
601
|
+
* @private
|
602
|
+
*/
|
603
|
+
packedLength: {
|
604
|
+
get: function () {
|
605
|
+
return (
|
606
|
+
1.0 +
|
607
|
+
this._positions.length * 3 +
|
608
|
+
1.0 +
|
609
|
+
1.0 +
|
610
|
+
1.0 +
|
611
|
+
Matrix3.Ellipsoid.packedLength +
|
612
|
+
1.0 +
|
613
|
+
1.0
|
614
|
+
);
|
615
|
+
},
|
616
|
+
},
|
617
|
+
});
|
618
|
+
|
619
|
+
/**
|
620
|
+
* Set the GroundPolylineGeometry's projection and ellipsoid.
|
621
|
+
* Used by GroundPolylinePrimitive to signal scene information to the geometry for generating 2D attributes.
|
622
|
+
*
|
623
|
+
* @param {GroundPolylineGeometry} groundPolylineGeometry GroundPolylinGeometry describing a polyline on terrain or 3D Tiles.
|
624
|
+
* @param {Projection} mapProjection A MapProjection used for projecting cartographic coordinates to 2D.
|
625
|
+
* @private
|
626
|
+
*/
|
627
|
+
GroundPolylineGeometry.setProjectionAndEllipsoid = function (
|
628
|
+
groundPolylineGeometry,
|
629
|
+
mapProjection
|
630
|
+
) {
|
631
|
+
let projectionIndex = 0;
|
632
|
+
for (let i = 0; i < PROJECTION_COUNT; i++) {
|
633
|
+
if (mapProjection instanceof PROJECTIONS[i]) {
|
634
|
+
projectionIndex = i;
|
635
|
+
break;
|
636
|
+
}
|
637
|
+
}
|
638
|
+
|
639
|
+
groundPolylineGeometry._projectionIndex = projectionIndex;
|
640
|
+
groundPolylineGeometry._ellipsoid = mapProjection.ellipsoid;
|
641
|
+
};
|
642
|
+
|
643
|
+
const cart3Scratch1 = new Matrix3.Cartesian3();
|
644
|
+
const cart3Scratch2 = new Matrix3.Cartesian3();
|
645
|
+
const cart3Scratch3 = new Matrix3.Cartesian3();
|
646
|
+
function computeRightNormal(start, end, maxHeight, ellipsoid, result) {
|
647
|
+
const startBottom = getPosition(ellipsoid, start, 0.0, cart3Scratch1);
|
648
|
+
const startTop = getPosition(ellipsoid, start, maxHeight, cart3Scratch2);
|
649
|
+
const endBottom = getPosition(ellipsoid, end, 0.0, cart3Scratch3);
|
650
|
+
|
651
|
+
const up = direction(startTop, startBottom, cart3Scratch2);
|
652
|
+
const forward = direction(endBottom, startBottom, cart3Scratch3);
|
653
|
+
|
654
|
+
Matrix3.Cartesian3.cross(forward, up, result);
|
655
|
+
return Matrix3.Cartesian3.normalize(result, result);
|
656
|
+
}
|
657
|
+
|
658
|
+
const interpolatedCartographicScratch = new Matrix3.Cartographic();
|
659
|
+
const interpolatedBottomScratch = new Matrix3.Cartesian3();
|
660
|
+
const interpolatedTopScratch = new Matrix3.Cartesian3();
|
661
|
+
const interpolatedNormalScratch = new Matrix3.Cartesian3();
|
662
|
+
function interpolateSegment(
|
663
|
+
start,
|
664
|
+
end,
|
665
|
+
minHeight,
|
666
|
+
maxHeight,
|
667
|
+
granularity,
|
668
|
+
arcType,
|
669
|
+
ellipsoid,
|
670
|
+
normalsArray,
|
671
|
+
bottomPositionsArray,
|
672
|
+
topPositionsArray,
|
673
|
+
cartographicsArray
|
674
|
+
) {
|
675
|
+
if (granularity === 0.0) {
|
676
|
+
return;
|
677
|
+
}
|
678
|
+
|
679
|
+
let ellipsoidLine;
|
680
|
+
if (arcType === ArcType.ArcType.GEODESIC) {
|
681
|
+
ellipsoidLine = new EllipsoidGeodesic.EllipsoidGeodesic(start, end, ellipsoid);
|
682
|
+
} else if (arcType === ArcType.ArcType.RHUMB) {
|
683
|
+
ellipsoidLine = new EllipsoidRhumbLine.EllipsoidRhumbLine(start, end, ellipsoid);
|
684
|
+
}
|
685
|
+
|
686
|
+
const surfaceDistance = ellipsoidLine.surfaceDistance;
|
687
|
+
if (surfaceDistance < granularity) {
|
688
|
+
return;
|
689
|
+
}
|
690
|
+
|
691
|
+
// Compute rightwards normal applicable at all interpolated points
|
692
|
+
const interpolatedNormal = computeRightNormal(
|
693
|
+
start,
|
694
|
+
end,
|
695
|
+
maxHeight,
|
696
|
+
ellipsoid,
|
697
|
+
interpolatedNormalScratch
|
698
|
+
);
|
699
|
+
|
700
|
+
const segments = Math.ceil(surfaceDistance / granularity);
|
701
|
+
const interpointDistance = surfaceDistance / segments;
|
702
|
+
let distanceFromStart = interpointDistance;
|
703
|
+
const pointsToAdd = segments - 1;
|
704
|
+
let packIndex = normalsArray.length;
|
705
|
+
for (let i = 0; i < pointsToAdd; i++) {
|
706
|
+
const interpolatedCartographic = ellipsoidLine.interpolateUsingSurfaceDistance(
|
707
|
+
distanceFromStart,
|
708
|
+
interpolatedCartographicScratch
|
709
|
+
);
|
710
|
+
const interpolatedBottom = getPosition(
|
711
|
+
ellipsoid,
|
712
|
+
interpolatedCartographic,
|
713
|
+
minHeight,
|
714
|
+
interpolatedBottomScratch
|
715
|
+
);
|
716
|
+
const interpolatedTop = getPosition(
|
717
|
+
ellipsoid,
|
718
|
+
interpolatedCartographic,
|
719
|
+
maxHeight,
|
720
|
+
interpolatedTopScratch
|
721
|
+
);
|
722
|
+
|
723
|
+
Matrix3.Cartesian3.pack(interpolatedNormal, normalsArray, packIndex);
|
724
|
+
Matrix3.Cartesian3.pack(interpolatedBottom, bottomPositionsArray, packIndex);
|
725
|
+
Matrix3.Cartesian3.pack(interpolatedTop, topPositionsArray, packIndex);
|
726
|
+
cartographicsArray.push(interpolatedCartographic.latitude);
|
727
|
+
cartographicsArray.push(interpolatedCartographic.longitude);
|
728
|
+
|
729
|
+
packIndex += 3;
|
730
|
+
distanceFromStart += interpointDistance;
|
731
|
+
}
|
732
|
+
}
|
733
|
+
|
734
|
+
const heightlessCartographicScratch = new Matrix3.Cartographic();
|
735
|
+
function getPosition(ellipsoid, cartographic, height, result) {
|
736
|
+
Matrix3.Cartographic.clone(cartographic, heightlessCartographicScratch);
|
737
|
+
heightlessCartographicScratch.height = height;
|
738
|
+
return Matrix3.Cartographic.toCartesian(
|
739
|
+
heightlessCartographicScratch,
|
740
|
+
ellipsoid,
|
741
|
+
result
|
742
|
+
);
|
743
|
+
}
|
744
|
+
|
745
|
+
/**
|
746
|
+
* Stores the provided instance into the provided array.
|
747
|
+
*
|
748
|
+
* @param {PolygonGeometry} value The value to pack.
|
749
|
+
* @param {Number[]} array The array to pack into.
|
750
|
+
* @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
|
751
|
+
*
|
752
|
+
* @returns {Number[]} The array that was packed into
|
753
|
+
*/
|
754
|
+
GroundPolylineGeometry.pack = function (value, array, startingIndex) {
|
755
|
+
//>>includeStart('debug', pragmas.debug);
|
756
|
+
Check.Check.typeOf.object("value", value);
|
757
|
+
Check.Check.defined("array", array);
|
758
|
+
//>>includeEnd('debug');
|
759
|
+
|
760
|
+
let index = defaultValue.defaultValue(startingIndex, 0);
|
761
|
+
|
762
|
+
const positions = value._positions;
|
763
|
+
const positionsLength = positions.length;
|
764
|
+
|
765
|
+
array[index++] = positionsLength;
|
766
|
+
|
767
|
+
for (let i = 0; i < positionsLength; ++i) {
|
768
|
+
const cartesian = positions[i];
|
769
|
+
Matrix3.Cartesian3.pack(cartesian, array, index);
|
770
|
+
index += 3;
|
771
|
+
}
|
772
|
+
|
773
|
+
array[index++] = value.granularity;
|
774
|
+
array[index++] = value.loop ? 1.0 : 0.0;
|
775
|
+
array[index++] = value.arcType;
|
776
|
+
|
777
|
+
Matrix3.Ellipsoid.pack(value._ellipsoid, array, index);
|
778
|
+
index += Matrix3.Ellipsoid.packedLength;
|
779
|
+
|
780
|
+
array[index++] = value._projectionIndex;
|
781
|
+
array[index++] = value._scene3DOnly ? 1.0 : 0.0;
|
782
|
+
|
783
|
+
return array;
|
784
|
+
};
|
785
|
+
|
786
|
+
/**
|
787
|
+
* Retrieves an instance from a packed array.
|
788
|
+
*
|
789
|
+
* @param {Number[]} array The packed array.
|
790
|
+
* @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
|
791
|
+
* @param {PolygonGeometry} [result] The object into which to store the result.
|
792
|
+
*/
|
793
|
+
GroundPolylineGeometry.unpack = function (array, startingIndex, result) {
|
794
|
+
//>>includeStart('debug', pragmas.debug);
|
795
|
+
Check.Check.defined("array", array);
|
796
|
+
//>>includeEnd('debug');
|
797
|
+
|
798
|
+
let index = defaultValue.defaultValue(startingIndex, 0);
|
799
|
+
const positionsLength = array[index++];
|
800
|
+
const positions = new Array(positionsLength);
|
801
|
+
|
802
|
+
for (let i = 0; i < positionsLength; i++) {
|
803
|
+
positions[i] = Matrix3.Cartesian3.unpack(array, index);
|
804
|
+
index += 3;
|
805
|
+
}
|
806
|
+
|
807
|
+
const granularity = array[index++];
|
808
|
+
const loop = array[index++] === 1.0;
|
809
|
+
const arcType = array[index++];
|
810
|
+
|
811
|
+
const ellipsoid = Matrix3.Ellipsoid.unpack(array, index);
|
812
|
+
index += Matrix3.Ellipsoid.packedLength;
|
813
|
+
|
814
|
+
const projectionIndex = array[index++];
|
815
|
+
const scene3DOnly = array[index++] === 1.0;
|
816
|
+
|
817
|
+
if (!defaultValue.defined(result)) {
|
818
|
+
result = new GroundPolylineGeometry({
|
819
|
+
positions: positions,
|
820
|
+
});
|
821
|
+
}
|
822
|
+
|
823
|
+
result._positions = positions;
|
824
|
+
result.granularity = granularity;
|
825
|
+
result.loop = loop;
|
826
|
+
result.arcType = arcType;
|
827
|
+
result._ellipsoid = ellipsoid;
|
828
|
+
result._projectionIndex = projectionIndex;
|
829
|
+
result._scene3DOnly = scene3DOnly;
|
830
|
+
|
831
|
+
return result;
|
832
|
+
};
|
833
|
+
|
834
|
+
function direction(target, origin, result) {
|
835
|
+
Matrix3.Cartesian3.subtract(target, origin, result);
|
836
|
+
Matrix3.Cartesian3.normalize(result, result);
|
837
|
+
return result;
|
838
|
+
}
|
839
|
+
|
840
|
+
function tangentDirection(target, origin, up, result) {
|
841
|
+
result = direction(target, origin, result);
|
842
|
+
|
843
|
+
// orthogonalize
|
844
|
+
result = Matrix3.Cartesian3.cross(result, up, result);
|
845
|
+
result = Matrix3.Cartesian3.normalize(result, result);
|
846
|
+
result = Matrix3.Cartesian3.cross(up, result, result);
|
847
|
+
return result;
|
848
|
+
}
|
849
|
+
|
850
|
+
const toPreviousScratch = new Matrix3.Cartesian3();
|
851
|
+
const toNextScratch = new Matrix3.Cartesian3();
|
852
|
+
const forwardScratch = new Matrix3.Cartesian3();
|
853
|
+
const vertexUpScratch = new Matrix3.Cartesian3();
|
854
|
+
const cosine90 = 0.0;
|
855
|
+
const cosine180 = -1.0;
|
856
|
+
function computeVertexMiterNormal(
|
857
|
+
previousBottom,
|
858
|
+
vertexBottom,
|
859
|
+
vertexTop,
|
860
|
+
nextBottom,
|
861
|
+
result
|
862
|
+
) {
|
863
|
+
const up = direction(vertexTop, vertexBottom, vertexUpScratch);
|
864
|
+
|
865
|
+
// Compute vectors pointing towards neighboring points but tangent to this point on the ellipsoid
|
866
|
+
const toPrevious = tangentDirection(
|
867
|
+
previousBottom,
|
868
|
+
vertexBottom,
|
869
|
+
up,
|
870
|
+
toPreviousScratch
|
871
|
+
);
|
872
|
+
const toNext = tangentDirection(nextBottom, vertexBottom, up, toNextScratch);
|
873
|
+
|
874
|
+
// Check if tangents are almost opposite - if so, no need to miter.
|
875
|
+
if (
|
876
|
+
Math$1.CesiumMath.equalsEpsilon(
|
877
|
+
Matrix3.Cartesian3.dot(toPrevious, toNext),
|
878
|
+
cosine180,
|
879
|
+
Math$1.CesiumMath.EPSILON5
|
880
|
+
)
|
881
|
+
) {
|
882
|
+
result = Matrix3.Cartesian3.cross(up, toPrevious, result);
|
883
|
+
result = Matrix3.Cartesian3.normalize(result, result);
|
884
|
+
return result;
|
885
|
+
}
|
886
|
+
|
887
|
+
// Average directions to previous and to next in the plane of Up
|
888
|
+
result = Matrix3.Cartesian3.add(toNext, toPrevious, result);
|
889
|
+
result = Matrix3.Cartesian3.normalize(result, result);
|
890
|
+
|
891
|
+
// Flip the normal if it isn't pointing roughly bound right (aka if forward is pointing more "backwards")
|
892
|
+
const forward = Matrix3.Cartesian3.cross(up, result, forwardScratch);
|
893
|
+
if (Matrix3.Cartesian3.dot(toNext, forward) < cosine90) {
|
894
|
+
result = Matrix3.Cartesian3.negate(result, result);
|
895
|
+
}
|
896
|
+
|
897
|
+
return result;
|
898
|
+
}
|
899
|
+
|
900
|
+
const XZ_PLANE = Plane.Plane.fromPointNormal(Matrix3.Cartesian3.ZERO, Matrix3.Cartesian3.UNIT_Y);
|
901
|
+
|
902
|
+
const previousBottomScratch = new Matrix3.Cartesian3();
|
903
|
+
const vertexBottomScratch = new Matrix3.Cartesian3();
|
904
|
+
const vertexTopScratch = new Matrix3.Cartesian3();
|
905
|
+
const nextBottomScratch = new Matrix3.Cartesian3();
|
906
|
+
const vertexNormalScratch = new Matrix3.Cartesian3();
|
907
|
+
const intersectionScratch = new Matrix3.Cartesian3();
|
908
|
+
const cartographicScratch0 = new Matrix3.Cartographic();
|
909
|
+
const cartographicScratch1 = new Matrix3.Cartographic();
|
910
|
+
const cartographicIntersectionScratch = new Matrix3.Cartographic();
|
911
|
+
/**
|
912
|
+
* Computes shadow volumes for the ground polyline, consisting of its vertices, indices, and a bounding sphere.
|
913
|
+
* Vertices are "fat," packing all the data needed in each volume to describe a line on terrain or 3D Tiles.
|
914
|
+
* Should not be called independent of {@link GroundPolylinePrimitive}.
|
915
|
+
*
|
916
|
+
* @param {GroundPolylineGeometry} groundPolylineGeometry
|
917
|
+
* @private
|
918
|
+
*/
|
919
|
+
GroundPolylineGeometry.createGeometry = function (groundPolylineGeometry) {
|
920
|
+
const compute2dAttributes = !groundPolylineGeometry._scene3DOnly;
|
921
|
+
let loop = groundPolylineGeometry.loop;
|
922
|
+
const ellipsoid = groundPolylineGeometry._ellipsoid;
|
923
|
+
const granularity = groundPolylineGeometry.granularity;
|
924
|
+
const arcType = groundPolylineGeometry.arcType;
|
925
|
+
const projection = new PROJECTIONS[groundPolylineGeometry._projectionIndex](
|
926
|
+
ellipsoid
|
927
|
+
);
|
928
|
+
|
929
|
+
const minHeight = WALL_INITIAL_MIN_HEIGHT;
|
930
|
+
const maxHeight = WALL_INITIAL_MAX_HEIGHT;
|
931
|
+
|
932
|
+
let index;
|
933
|
+
let i;
|
934
|
+
|
935
|
+
const positions = groundPolylineGeometry._positions;
|
936
|
+
const positionsLength = positions.length;
|
937
|
+
|
938
|
+
if (positionsLength === 2) {
|
939
|
+
loop = false;
|
940
|
+
}
|
941
|
+
|
942
|
+
// Split positions across the IDL and the Prime Meridian as well.
|
943
|
+
// Split across prime meridian because very large geometries crossing the Prime Meridian but not the IDL
|
944
|
+
// may get split by the plane of IDL + Prime Meridian.
|
945
|
+
let p0;
|
946
|
+
let p1;
|
947
|
+
let c0;
|
948
|
+
let c1;
|
949
|
+
const rhumbLine = new EllipsoidRhumbLine.EllipsoidRhumbLine(undefined, undefined, ellipsoid);
|
950
|
+
let intersection;
|
951
|
+
let intersectionCartographic;
|
952
|
+
let intersectionLongitude;
|
953
|
+
const splitPositions = [positions[0]];
|
954
|
+
for (i = 0; i < positionsLength - 1; i++) {
|
955
|
+
p0 = positions[i];
|
956
|
+
p1 = positions[i + 1];
|
957
|
+
intersection = IntersectionTests.IntersectionTests.lineSegmentPlane(
|
958
|
+
p0,
|
959
|
+
p1,
|
960
|
+
XZ_PLANE,
|
961
|
+
intersectionScratch
|
962
|
+
);
|
963
|
+
if (
|
964
|
+
defaultValue.defined(intersection) &&
|
965
|
+
!Matrix3.Cartesian3.equalsEpsilon(intersection, p0, Math$1.CesiumMath.EPSILON7) &&
|
966
|
+
!Matrix3.Cartesian3.equalsEpsilon(intersection, p1, Math$1.CesiumMath.EPSILON7)
|
967
|
+
) {
|
968
|
+
if (groundPolylineGeometry.arcType === ArcType.ArcType.GEODESIC) {
|
969
|
+
splitPositions.push(Matrix3.Cartesian3.clone(intersection));
|
970
|
+
} else if (groundPolylineGeometry.arcType === ArcType.ArcType.RHUMB) {
|
971
|
+
intersectionLongitude = ellipsoid.cartesianToCartographic(
|
972
|
+
intersection,
|
973
|
+
cartographicScratch0
|
974
|
+
).longitude;
|
975
|
+
c0 = ellipsoid.cartesianToCartographic(p0, cartographicScratch0);
|
976
|
+
c1 = ellipsoid.cartesianToCartographic(p1, cartographicScratch1);
|
977
|
+
rhumbLine.setEndPoints(c0, c1);
|
978
|
+
intersectionCartographic = rhumbLine.findIntersectionWithLongitude(
|
979
|
+
intersectionLongitude,
|
980
|
+
cartographicIntersectionScratch
|
981
|
+
);
|
982
|
+
intersection = ellipsoid.cartographicToCartesian(
|
983
|
+
intersectionCartographic,
|
984
|
+
intersectionScratch
|
985
|
+
);
|
986
|
+
if (
|
987
|
+
defaultValue.defined(intersection) &&
|
988
|
+
!Matrix3.Cartesian3.equalsEpsilon(intersection, p0, Math$1.CesiumMath.EPSILON7) &&
|
989
|
+
!Matrix3.Cartesian3.equalsEpsilon(intersection, p1, Math$1.CesiumMath.EPSILON7)
|
990
|
+
) {
|
991
|
+
splitPositions.push(Matrix3.Cartesian3.clone(intersection));
|
992
|
+
}
|
993
|
+
}
|
994
|
+
}
|
995
|
+
splitPositions.push(p1);
|
996
|
+
}
|
997
|
+
|
998
|
+
if (loop) {
|
999
|
+
p0 = positions[positionsLength - 1];
|
1000
|
+
p1 = positions[0];
|
1001
|
+
intersection = IntersectionTests.IntersectionTests.lineSegmentPlane(
|
1002
|
+
p0,
|
1003
|
+
p1,
|
1004
|
+
XZ_PLANE,
|
1005
|
+
intersectionScratch
|
1006
|
+
);
|
1007
|
+
if (
|
1008
|
+
defaultValue.defined(intersection) &&
|
1009
|
+
!Matrix3.Cartesian3.equalsEpsilon(intersection, p0, Math$1.CesiumMath.EPSILON7) &&
|
1010
|
+
!Matrix3.Cartesian3.equalsEpsilon(intersection, p1, Math$1.CesiumMath.EPSILON7)
|
1011
|
+
) {
|
1012
|
+
if (groundPolylineGeometry.arcType === ArcType.ArcType.GEODESIC) {
|
1013
|
+
splitPositions.push(Matrix3.Cartesian3.clone(intersection));
|
1014
|
+
} else if (groundPolylineGeometry.arcType === ArcType.ArcType.RHUMB) {
|
1015
|
+
intersectionLongitude = ellipsoid.cartesianToCartographic(
|
1016
|
+
intersection,
|
1017
|
+
cartographicScratch0
|
1018
|
+
).longitude;
|
1019
|
+
c0 = ellipsoid.cartesianToCartographic(p0, cartographicScratch0);
|
1020
|
+
c1 = ellipsoid.cartesianToCartographic(p1, cartographicScratch1);
|
1021
|
+
rhumbLine.setEndPoints(c0, c1);
|
1022
|
+
intersectionCartographic = rhumbLine.findIntersectionWithLongitude(
|
1023
|
+
intersectionLongitude,
|
1024
|
+
cartographicIntersectionScratch
|
1025
|
+
);
|
1026
|
+
intersection = ellipsoid.cartographicToCartesian(
|
1027
|
+
intersectionCartographic,
|
1028
|
+
intersectionScratch
|
1029
|
+
);
|
1030
|
+
if (
|
1031
|
+
defaultValue.defined(intersection) &&
|
1032
|
+
!Matrix3.Cartesian3.equalsEpsilon(intersection, p0, Math$1.CesiumMath.EPSILON7) &&
|
1033
|
+
!Matrix3.Cartesian3.equalsEpsilon(intersection, p1, Math$1.CesiumMath.EPSILON7)
|
1034
|
+
) {
|
1035
|
+
splitPositions.push(Matrix3.Cartesian3.clone(intersection));
|
1036
|
+
}
|
1037
|
+
}
|
1038
|
+
}
|
1039
|
+
}
|
1040
|
+
let cartographicsLength = splitPositions.length;
|
1041
|
+
|
1042
|
+
let cartographics = new Array(cartographicsLength);
|
1043
|
+
for (i = 0; i < cartographicsLength; i++) {
|
1044
|
+
const cartographic = Matrix3.Cartographic.fromCartesian(
|
1045
|
+
splitPositions[i],
|
1046
|
+
ellipsoid
|
1047
|
+
);
|
1048
|
+
cartographic.height = 0.0;
|
1049
|
+
cartographics[i] = cartographic;
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
cartographics = arrayRemoveDuplicates.arrayRemoveDuplicates(
|
1053
|
+
cartographics,
|
1054
|
+
Matrix3.Cartographic.equalsEpsilon
|
1055
|
+
);
|
1056
|
+
cartographicsLength = cartographics.length;
|
1057
|
+
|
1058
|
+
if (cartographicsLength < 2) {
|
1059
|
+
return undefined;
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
/**** Build heap-side arrays for positions, interpolated cartographics, and normals from which to compute vertices ****/
|
1063
|
+
// We build a "wall" and then decompose it into separately connected component "volumes" because we need a lot
|
1064
|
+
// of information about the wall. Also, this simplifies interpolation.
|
1065
|
+
// Convention: "next" and "end" are locally forward to each segment of the wall,
|
1066
|
+
// and we are computing normals pointing towards the local right side of the vertices in each segment.
|
1067
|
+
const cartographicsArray = [];
|
1068
|
+
const normalsArray = [];
|
1069
|
+
const bottomPositionsArray = [];
|
1070
|
+
const topPositionsArray = [];
|
1071
|
+
|
1072
|
+
let previousBottom = previousBottomScratch;
|
1073
|
+
let vertexBottom = vertexBottomScratch;
|
1074
|
+
let vertexTop = vertexTopScratch;
|
1075
|
+
let nextBottom = nextBottomScratch;
|
1076
|
+
let vertexNormal = vertexNormalScratch;
|
1077
|
+
|
1078
|
+
// First point - either loop or attach a "perpendicular" normal
|
1079
|
+
const startCartographic = cartographics[0];
|
1080
|
+
const nextCartographic = cartographics[1];
|
1081
|
+
|
1082
|
+
const prestartCartographic = cartographics[cartographicsLength - 1];
|
1083
|
+
previousBottom = getPosition(
|
1084
|
+
ellipsoid,
|
1085
|
+
prestartCartographic,
|
1086
|
+
minHeight,
|
1087
|
+
previousBottom
|
1088
|
+
);
|
1089
|
+
nextBottom = getPosition(ellipsoid, nextCartographic, minHeight, nextBottom);
|
1090
|
+
vertexBottom = getPosition(
|
1091
|
+
ellipsoid,
|
1092
|
+
startCartographic,
|
1093
|
+
minHeight,
|
1094
|
+
vertexBottom
|
1095
|
+
);
|
1096
|
+
vertexTop = getPosition(ellipsoid, startCartographic, maxHeight, vertexTop);
|
1097
|
+
|
1098
|
+
if (loop) {
|
1099
|
+
vertexNormal = computeVertexMiterNormal(
|
1100
|
+
previousBottom,
|
1101
|
+
vertexBottom,
|
1102
|
+
vertexTop,
|
1103
|
+
nextBottom,
|
1104
|
+
vertexNormal
|
1105
|
+
);
|
1106
|
+
} else {
|
1107
|
+
vertexNormal = computeRightNormal(
|
1108
|
+
startCartographic,
|
1109
|
+
nextCartographic,
|
1110
|
+
maxHeight,
|
1111
|
+
ellipsoid,
|
1112
|
+
vertexNormal
|
1113
|
+
);
|
1114
|
+
}
|
1115
|
+
|
1116
|
+
Matrix3.Cartesian3.pack(vertexNormal, normalsArray, 0);
|
1117
|
+
Matrix3.Cartesian3.pack(vertexBottom, bottomPositionsArray, 0);
|
1118
|
+
Matrix3.Cartesian3.pack(vertexTop, topPositionsArray, 0);
|
1119
|
+
cartographicsArray.push(startCartographic.latitude);
|
1120
|
+
cartographicsArray.push(startCartographic.longitude);
|
1121
|
+
|
1122
|
+
interpolateSegment(
|
1123
|
+
startCartographic,
|
1124
|
+
nextCartographic,
|
1125
|
+
minHeight,
|
1126
|
+
maxHeight,
|
1127
|
+
granularity,
|
1128
|
+
arcType,
|
1129
|
+
ellipsoid,
|
1130
|
+
normalsArray,
|
1131
|
+
bottomPositionsArray,
|
1132
|
+
topPositionsArray,
|
1133
|
+
cartographicsArray
|
1134
|
+
);
|
1135
|
+
|
1136
|
+
// All inbetween points
|
1137
|
+
for (i = 1; i < cartographicsLength - 1; ++i) {
|
1138
|
+
previousBottom = Matrix3.Cartesian3.clone(vertexBottom, previousBottom);
|
1139
|
+
vertexBottom = Matrix3.Cartesian3.clone(nextBottom, vertexBottom);
|
1140
|
+
const vertexCartographic = cartographics[i];
|
1141
|
+
getPosition(ellipsoid, vertexCartographic, maxHeight, vertexTop);
|
1142
|
+
getPosition(ellipsoid, cartographics[i + 1], minHeight, nextBottom);
|
1143
|
+
|
1144
|
+
computeVertexMiterNormal(
|
1145
|
+
previousBottom,
|
1146
|
+
vertexBottom,
|
1147
|
+
vertexTop,
|
1148
|
+
nextBottom,
|
1149
|
+
vertexNormal
|
1150
|
+
);
|
1151
|
+
|
1152
|
+
index = normalsArray.length;
|
1153
|
+
Matrix3.Cartesian3.pack(vertexNormal, normalsArray, index);
|
1154
|
+
Matrix3.Cartesian3.pack(vertexBottom, bottomPositionsArray, index);
|
1155
|
+
Matrix3.Cartesian3.pack(vertexTop, topPositionsArray, index);
|
1156
|
+
cartographicsArray.push(vertexCartographic.latitude);
|
1157
|
+
cartographicsArray.push(vertexCartographic.longitude);
|
1158
|
+
|
1159
|
+
interpolateSegment(
|
1160
|
+
cartographics[i],
|
1161
|
+
cartographics[i + 1],
|
1162
|
+
minHeight,
|
1163
|
+
maxHeight,
|
1164
|
+
granularity,
|
1165
|
+
arcType,
|
1166
|
+
ellipsoid,
|
1167
|
+
normalsArray,
|
1168
|
+
bottomPositionsArray,
|
1169
|
+
topPositionsArray,
|
1170
|
+
cartographicsArray
|
1171
|
+
);
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
// Last point - either loop or attach a normal "perpendicular" to the wall.
|
1175
|
+
const endCartographic = cartographics[cartographicsLength - 1];
|
1176
|
+
const preEndCartographic = cartographics[cartographicsLength - 2];
|
1177
|
+
|
1178
|
+
vertexBottom = getPosition(
|
1179
|
+
ellipsoid,
|
1180
|
+
endCartographic,
|
1181
|
+
minHeight,
|
1182
|
+
vertexBottom
|
1183
|
+
);
|
1184
|
+
vertexTop = getPosition(ellipsoid, endCartographic, maxHeight, vertexTop);
|
1185
|
+
|
1186
|
+
if (loop) {
|
1187
|
+
const postEndCartographic = cartographics[0];
|
1188
|
+
previousBottom = getPosition(
|
1189
|
+
ellipsoid,
|
1190
|
+
preEndCartographic,
|
1191
|
+
minHeight,
|
1192
|
+
previousBottom
|
1193
|
+
);
|
1194
|
+
nextBottom = getPosition(
|
1195
|
+
ellipsoid,
|
1196
|
+
postEndCartographic,
|
1197
|
+
minHeight,
|
1198
|
+
nextBottom
|
1199
|
+
);
|
1200
|
+
|
1201
|
+
vertexNormal = computeVertexMiterNormal(
|
1202
|
+
previousBottom,
|
1203
|
+
vertexBottom,
|
1204
|
+
vertexTop,
|
1205
|
+
nextBottom,
|
1206
|
+
vertexNormal
|
1207
|
+
);
|
1208
|
+
} else {
|
1209
|
+
vertexNormal = computeRightNormal(
|
1210
|
+
preEndCartographic,
|
1211
|
+
endCartographic,
|
1212
|
+
maxHeight,
|
1213
|
+
ellipsoid,
|
1214
|
+
vertexNormal
|
1215
|
+
);
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
index = normalsArray.length;
|
1219
|
+
Matrix3.Cartesian3.pack(vertexNormal, normalsArray, index);
|
1220
|
+
Matrix3.Cartesian3.pack(vertexBottom, bottomPositionsArray, index);
|
1221
|
+
Matrix3.Cartesian3.pack(vertexTop, topPositionsArray, index);
|
1222
|
+
cartographicsArray.push(endCartographic.latitude);
|
1223
|
+
cartographicsArray.push(endCartographic.longitude);
|
1224
|
+
|
1225
|
+
if (loop) {
|
1226
|
+
interpolateSegment(
|
1227
|
+
endCartographic,
|
1228
|
+
startCartographic,
|
1229
|
+
minHeight,
|
1230
|
+
maxHeight,
|
1231
|
+
granularity,
|
1232
|
+
arcType,
|
1233
|
+
ellipsoid,
|
1234
|
+
normalsArray,
|
1235
|
+
bottomPositionsArray,
|
1236
|
+
topPositionsArray,
|
1237
|
+
cartographicsArray
|
1238
|
+
);
|
1239
|
+
index = normalsArray.length;
|
1240
|
+
for (i = 0; i < 3; ++i) {
|
1241
|
+
normalsArray[index + i] = normalsArray[i];
|
1242
|
+
bottomPositionsArray[index + i] = bottomPositionsArray[i];
|
1243
|
+
topPositionsArray[index + i] = topPositionsArray[i];
|
1244
|
+
}
|
1245
|
+
cartographicsArray.push(startCartographic.latitude);
|
1246
|
+
cartographicsArray.push(startCartographic.longitude);
|
1247
|
+
}
|
1248
|
+
|
1249
|
+
return generateGeometryAttributes(
|
1250
|
+
loop,
|
1251
|
+
projection,
|
1252
|
+
bottomPositionsArray,
|
1253
|
+
topPositionsArray,
|
1254
|
+
normalsArray,
|
1255
|
+
cartographicsArray,
|
1256
|
+
compute2dAttributes
|
1257
|
+
);
|
1258
|
+
};
|
1259
|
+
|
1260
|
+
// If the end normal angle is too steep compared to the direction of the line segment,
|
1261
|
+
// "break" the miter by rotating the normal 90 degrees around the "up" direction at the point
|
1262
|
+
// For ultra precision we would want to project into a plane, but in practice this is sufficient.
|
1263
|
+
const lineDirectionScratch = new Matrix3.Cartesian3();
|
1264
|
+
const matrix3Scratch = new Matrix3.Matrix3();
|
1265
|
+
const quaternionScratch = new Transforms.Quaternion();
|
1266
|
+
function breakMiter(endGeometryNormal, startBottom, endBottom, endTop) {
|
1267
|
+
const lineDirection = direction(endBottom, startBottom, lineDirectionScratch);
|
1268
|
+
|
1269
|
+
const dot = Matrix3.Cartesian3.dot(lineDirection, endGeometryNormal);
|
1270
|
+
if (dot > MITER_BREAK_SMALL || dot < MITER_BREAK_LARGE) {
|
1271
|
+
const vertexUp = direction(endTop, endBottom, vertexUpScratch);
|
1272
|
+
const angle =
|
1273
|
+
dot < MITER_BREAK_LARGE
|
1274
|
+
? Math$1.CesiumMath.PI_OVER_TWO
|
1275
|
+
: -Math$1.CesiumMath.PI_OVER_TWO;
|
1276
|
+
const quaternion = Transforms.Quaternion.fromAxisAngle(
|
1277
|
+
vertexUp,
|
1278
|
+
angle,
|
1279
|
+
quaternionScratch
|
1280
|
+
);
|
1281
|
+
const rotationMatrix = Matrix3.Matrix3.fromQuaternion(quaternion, matrix3Scratch);
|
1282
|
+
Matrix3.Matrix3.multiplyByVector(
|
1283
|
+
rotationMatrix,
|
1284
|
+
endGeometryNormal,
|
1285
|
+
endGeometryNormal
|
1286
|
+
);
|
1287
|
+
return true;
|
1288
|
+
}
|
1289
|
+
return false;
|
1290
|
+
}
|
1291
|
+
|
1292
|
+
const endPosCartographicScratch = new Matrix3.Cartographic();
|
1293
|
+
const normalStartpointScratch = new Matrix3.Cartesian3();
|
1294
|
+
const normalEndpointScratch = new Matrix3.Cartesian3();
|
1295
|
+
function projectNormal(
|
1296
|
+
projection,
|
1297
|
+
cartographic,
|
1298
|
+
normal,
|
1299
|
+
projectedPosition,
|
1300
|
+
result
|
1301
|
+
) {
|
1302
|
+
const position = Matrix3.Cartographic.toCartesian(
|
1303
|
+
cartographic,
|
1304
|
+
projection._ellipsoid,
|
1305
|
+
normalStartpointScratch
|
1306
|
+
);
|
1307
|
+
let normalEndpoint = Matrix3.Cartesian3.add(position, normal, normalEndpointScratch);
|
1308
|
+
let flipNormal = false;
|
1309
|
+
|
1310
|
+
const ellipsoid = projection._ellipsoid;
|
1311
|
+
let normalEndpointCartographic = ellipsoid.cartesianToCartographic(
|
1312
|
+
normalEndpoint,
|
1313
|
+
endPosCartographicScratch
|
1314
|
+
);
|
1315
|
+
// If normal crosses the IDL, go the other way and flip the result.
|
1316
|
+
// In practice this almost never happens because the cartographic start
|
1317
|
+
// and end points of each segment are "nudged" to be on the same side
|
1318
|
+
// of the IDL and slightly away from the IDL.
|
1319
|
+
if (
|
1320
|
+
Math.abs(cartographic.longitude - normalEndpointCartographic.longitude) >
|
1321
|
+
Math$1.CesiumMath.PI_OVER_TWO
|
1322
|
+
) {
|
1323
|
+
flipNormal = true;
|
1324
|
+
normalEndpoint = Matrix3.Cartesian3.subtract(
|
1325
|
+
position,
|
1326
|
+
normal,
|
1327
|
+
normalEndpointScratch
|
1328
|
+
);
|
1329
|
+
normalEndpointCartographic = ellipsoid.cartesianToCartographic(
|
1330
|
+
normalEndpoint,
|
1331
|
+
endPosCartographicScratch
|
1332
|
+
);
|
1333
|
+
}
|
1334
|
+
|
1335
|
+
normalEndpointCartographic.height = 0.0;
|
1336
|
+
const normalEndpointProjected = projection.project(
|
1337
|
+
normalEndpointCartographic,
|
1338
|
+
result
|
1339
|
+
);
|
1340
|
+
result = Matrix3.Cartesian3.subtract(
|
1341
|
+
normalEndpointProjected,
|
1342
|
+
projectedPosition,
|
1343
|
+
result
|
1344
|
+
);
|
1345
|
+
result.z = 0.0;
|
1346
|
+
result = Matrix3.Cartesian3.normalize(result, result);
|
1347
|
+
if (flipNormal) {
|
1348
|
+
Matrix3.Cartesian3.negate(result, result);
|
1349
|
+
}
|
1350
|
+
return result;
|
1351
|
+
}
|
1352
|
+
|
1353
|
+
const adjustHeightNormalScratch = new Matrix3.Cartesian3();
|
1354
|
+
const adjustHeightOffsetScratch = new Matrix3.Cartesian3();
|
1355
|
+
function adjustHeights(
|
1356
|
+
bottom,
|
1357
|
+
top,
|
1358
|
+
minHeight,
|
1359
|
+
maxHeight,
|
1360
|
+
adjustHeightBottom,
|
1361
|
+
adjustHeightTop
|
1362
|
+
) {
|
1363
|
+
// bottom and top should be at WALL_INITIAL_MIN_HEIGHT and WALL_INITIAL_MAX_HEIGHT, respectively
|
1364
|
+
const adjustHeightNormal = Matrix3.Cartesian3.subtract(
|
1365
|
+
top,
|
1366
|
+
bottom,
|
1367
|
+
adjustHeightNormalScratch
|
1368
|
+
);
|
1369
|
+
Matrix3.Cartesian3.normalize(adjustHeightNormal, adjustHeightNormal);
|
1370
|
+
|
1371
|
+
const distanceForBottom = minHeight - WALL_INITIAL_MIN_HEIGHT;
|
1372
|
+
let adjustHeightOffset = Matrix3.Cartesian3.multiplyByScalar(
|
1373
|
+
adjustHeightNormal,
|
1374
|
+
distanceForBottom,
|
1375
|
+
adjustHeightOffsetScratch
|
1376
|
+
);
|
1377
|
+
Matrix3.Cartesian3.add(bottom, adjustHeightOffset, adjustHeightBottom);
|
1378
|
+
|
1379
|
+
const distanceForTop = maxHeight - WALL_INITIAL_MAX_HEIGHT;
|
1380
|
+
adjustHeightOffset = Matrix3.Cartesian3.multiplyByScalar(
|
1381
|
+
adjustHeightNormal,
|
1382
|
+
distanceForTop,
|
1383
|
+
adjustHeightOffsetScratch
|
1384
|
+
);
|
1385
|
+
Matrix3.Cartesian3.add(top, adjustHeightOffset, adjustHeightTop);
|
1386
|
+
}
|
1387
|
+
|
1388
|
+
const nudgeDirectionScratch = new Matrix3.Cartesian3();
|
1389
|
+
function nudgeXZ(start, end) {
|
1390
|
+
const startToXZdistance = Plane.Plane.getPointDistance(XZ_PLANE, start);
|
1391
|
+
const endToXZdistance = Plane.Plane.getPointDistance(XZ_PLANE, end);
|
1392
|
+
let offset = nudgeDirectionScratch;
|
1393
|
+
// Larger epsilon than what's used in GeometryPipeline, a centimeter in world space
|
1394
|
+
if (Math$1.CesiumMath.equalsEpsilon(startToXZdistance, 0.0, Math$1.CesiumMath.EPSILON2)) {
|
1395
|
+
offset = direction(end, start, offset);
|
1396
|
+
Matrix3.Cartesian3.multiplyByScalar(offset, Math$1.CesiumMath.EPSILON2, offset);
|
1397
|
+
Matrix3.Cartesian3.add(start, offset, start);
|
1398
|
+
} else if (
|
1399
|
+
Math$1.CesiumMath.equalsEpsilon(endToXZdistance, 0.0, Math$1.CesiumMath.EPSILON2)
|
1400
|
+
) {
|
1401
|
+
offset = direction(start, end, offset);
|
1402
|
+
Matrix3.Cartesian3.multiplyByScalar(offset, Math$1.CesiumMath.EPSILON2, offset);
|
1403
|
+
Matrix3.Cartesian3.add(end, offset, end);
|
1404
|
+
}
|
1405
|
+
}
|
1406
|
+
|
1407
|
+
// "Nudge" cartographic coordinates so start and end are on the same side of the IDL.
|
1408
|
+
// Nudge amounts are tiny, basically just an IDL flip.
|
1409
|
+
// Only used for 2D/CV.
|
1410
|
+
function nudgeCartographic(start, end) {
|
1411
|
+
const absStartLon = Math.abs(start.longitude);
|
1412
|
+
const absEndLon = Math.abs(end.longitude);
|
1413
|
+
if (
|
1414
|
+
Math$1.CesiumMath.equalsEpsilon(absStartLon, Math$1.CesiumMath.PI, Math$1.CesiumMath.EPSILON11)
|
1415
|
+
) {
|
1416
|
+
const endSign = Math$1.CesiumMath.sign(end.longitude);
|
1417
|
+
start.longitude = endSign * (absStartLon - Math$1.CesiumMath.EPSILON11);
|
1418
|
+
return 1;
|
1419
|
+
} else if (
|
1420
|
+
Math$1.CesiumMath.equalsEpsilon(absEndLon, Math$1.CesiumMath.PI, Math$1.CesiumMath.EPSILON11)
|
1421
|
+
) {
|
1422
|
+
const startSign = Math$1.CesiumMath.sign(start.longitude);
|
1423
|
+
end.longitude = startSign * (absEndLon - Math$1.CesiumMath.EPSILON11);
|
1424
|
+
return 2;
|
1425
|
+
}
|
1426
|
+
return 0;
|
1427
|
+
}
|
1428
|
+
|
1429
|
+
const startCartographicScratch = new Matrix3.Cartographic();
|
1430
|
+
const endCartographicScratch = new Matrix3.Cartographic();
|
1431
|
+
|
1432
|
+
const segmentStartTopScratch = new Matrix3.Cartesian3();
|
1433
|
+
const segmentEndTopScratch = new Matrix3.Cartesian3();
|
1434
|
+
const segmentStartBottomScratch = new Matrix3.Cartesian3();
|
1435
|
+
const segmentEndBottomScratch = new Matrix3.Cartesian3();
|
1436
|
+
const segmentStartNormalScratch = new Matrix3.Cartesian3();
|
1437
|
+
const segmentEndNormalScratch = new Matrix3.Cartesian3();
|
1438
|
+
|
1439
|
+
const getHeightCartographics = [
|
1440
|
+
startCartographicScratch,
|
1441
|
+
endCartographicScratch,
|
1442
|
+
];
|
1443
|
+
const getHeightRectangleScratch = new Matrix2.Rectangle();
|
1444
|
+
|
1445
|
+
const adjustHeightStartTopScratch = new Matrix3.Cartesian3();
|
1446
|
+
const adjustHeightEndTopScratch = new Matrix3.Cartesian3();
|
1447
|
+
const adjustHeightStartBottomScratch = new Matrix3.Cartesian3();
|
1448
|
+
const adjustHeightEndBottomScratch = new Matrix3.Cartesian3();
|
1449
|
+
|
1450
|
+
const segmentStart2DScratch = new Matrix3.Cartesian3();
|
1451
|
+
const segmentEnd2DScratch = new Matrix3.Cartesian3();
|
1452
|
+
const segmentStartNormal2DScratch = new Matrix3.Cartesian3();
|
1453
|
+
const segmentEndNormal2DScratch = new Matrix3.Cartesian3();
|
1454
|
+
|
1455
|
+
const offsetScratch = new Matrix3.Cartesian3();
|
1456
|
+
const startUpScratch = new Matrix3.Cartesian3();
|
1457
|
+
const endUpScratch = new Matrix3.Cartesian3();
|
1458
|
+
const rightScratch = new Matrix3.Cartesian3();
|
1459
|
+
const startPlaneNormalScratch = new Matrix3.Cartesian3();
|
1460
|
+
const endPlaneNormalScratch = new Matrix3.Cartesian3();
|
1461
|
+
const encodeScratch = new EncodedCartesian3.EncodedCartesian3();
|
1462
|
+
|
1463
|
+
const encodeScratch2D = new EncodedCartesian3.EncodedCartesian3();
|
1464
|
+
const forwardOffset2DScratch = new Matrix3.Cartesian3();
|
1465
|
+
const right2DScratch = new Matrix3.Cartesian3();
|
1466
|
+
|
1467
|
+
const normalNudgeScratch = new Matrix3.Cartesian3();
|
1468
|
+
|
1469
|
+
const scratchBoundingSpheres = [new Transforms.BoundingSphere(), new Transforms.BoundingSphere()];
|
1470
|
+
|
1471
|
+
// Winding order is reversed so each segment's volume is inside-out
|
1472
|
+
const REFERENCE_INDICES = [
|
1473
|
+
0,
|
1474
|
+
2,
|
1475
|
+
1,
|
1476
|
+
0,
|
1477
|
+
3,
|
1478
|
+
2, // right
|
1479
|
+
0,
|
1480
|
+
7,
|
1481
|
+
3,
|
1482
|
+
0,
|
1483
|
+
4,
|
1484
|
+
7, // start
|
1485
|
+
0,
|
1486
|
+
5,
|
1487
|
+
4,
|
1488
|
+
0,
|
1489
|
+
1,
|
1490
|
+
5, // bottom
|
1491
|
+
5,
|
1492
|
+
7,
|
1493
|
+
4,
|
1494
|
+
5,
|
1495
|
+
6,
|
1496
|
+
7, // left
|
1497
|
+
5,
|
1498
|
+
2,
|
1499
|
+
6,
|
1500
|
+
5,
|
1501
|
+
1,
|
1502
|
+
2, // end
|
1503
|
+
3,
|
1504
|
+
6,
|
1505
|
+
2,
|
1506
|
+
3,
|
1507
|
+
7,
|
1508
|
+
6, // top
|
1509
|
+
];
|
1510
|
+
const REFERENCE_INDICES_LENGTH = REFERENCE_INDICES.length;
|
1511
|
+
|
1512
|
+
// Decompose the "wall" into a series of shadow volumes.
|
1513
|
+
// Each shadow volume's vertices encode a description of the line it contains,
|
1514
|
+
// including mitering planes at the end points, a plane along the line itself,
|
1515
|
+
// and attributes for computing length-wise texture coordinates.
|
1516
|
+
function generateGeometryAttributes(
|
1517
|
+
loop,
|
1518
|
+
projection,
|
1519
|
+
bottomPositionsArray,
|
1520
|
+
topPositionsArray,
|
1521
|
+
normalsArray,
|
1522
|
+
cartographicsArray,
|
1523
|
+
compute2dAttributes
|
1524
|
+
) {
|
1525
|
+
let i;
|
1526
|
+
let index;
|
1527
|
+
const ellipsoid = projection._ellipsoid;
|
1528
|
+
|
1529
|
+
// Each segment will have 8 vertices
|
1530
|
+
const segmentCount = bottomPositionsArray.length / 3 - 1;
|
1531
|
+
const vertexCount = segmentCount * 8;
|
1532
|
+
const arraySizeVec4 = vertexCount * 4;
|
1533
|
+
const indexCount = segmentCount * 36;
|
1534
|
+
|
1535
|
+
const indices =
|
1536
|
+
vertexCount > 65535
|
1537
|
+
? new Uint32Array(indexCount)
|
1538
|
+
: new Uint16Array(indexCount);
|
1539
|
+
const positionsArray = new Float64Array(vertexCount * 3);
|
1540
|
+
|
1541
|
+
const startHiAndForwardOffsetX = new Float32Array(arraySizeVec4);
|
1542
|
+
const startLoAndForwardOffsetY = new Float32Array(arraySizeVec4);
|
1543
|
+
const startNormalAndForwardOffsetZ = new Float32Array(arraySizeVec4);
|
1544
|
+
const endNormalAndTextureCoordinateNormalizationX = new Float32Array(
|
1545
|
+
arraySizeVec4
|
1546
|
+
);
|
1547
|
+
const rightNormalAndTextureCoordinateNormalizationY = new Float32Array(
|
1548
|
+
arraySizeVec4
|
1549
|
+
);
|
1550
|
+
|
1551
|
+
let startHiLo2D;
|
1552
|
+
let offsetAndRight2D;
|
1553
|
+
let startEndNormals2D;
|
1554
|
+
let texcoordNormalization2D;
|
1555
|
+
|
1556
|
+
if (compute2dAttributes) {
|
1557
|
+
startHiLo2D = new Float32Array(arraySizeVec4);
|
1558
|
+
offsetAndRight2D = new Float32Array(arraySizeVec4);
|
1559
|
+
startEndNormals2D = new Float32Array(arraySizeVec4);
|
1560
|
+
texcoordNormalization2D = new Float32Array(vertexCount * 2);
|
1561
|
+
}
|
1562
|
+
|
1563
|
+
/*** Compute total lengths for texture coordinate normalization ***/
|
1564
|
+
// 2D
|
1565
|
+
const cartographicsLength = cartographicsArray.length / 2;
|
1566
|
+
let length2D = 0.0;
|
1567
|
+
|
1568
|
+
const startCartographic = startCartographicScratch;
|
1569
|
+
startCartographic.height = 0.0;
|
1570
|
+
const endCartographic = endCartographicScratch;
|
1571
|
+
endCartographic.height = 0.0;
|
1572
|
+
|
1573
|
+
let segmentStartCartesian = segmentStartTopScratch;
|
1574
|
+
let segmentEndCartesian = segmentEndTopScratch;
|
1575
|
+
|
1576
|
+
if (compute2dAttributes) {
|
1577
|
+
index = 0;
|
1578
|
+
for (i = 1; i < cartographicsLength; i++) {
|
1579
|
+
// Don't clone anything from previous segment b/c possible IDL touch
|
1580
|
+
startCartographic.latitude = cartographicsArray[index];
|
1581
|
+
startCartographic.longitude = cartographicsArray[index + 1];
|
1582
|
+
endCartographic.latitude = cartographicsArray[index + 2];
|
1583
|
+
endCartographic.longitude = cartographicsArray[index + 3];
|
1584
|
+
|
1585
|
+
segmentStartCartesian = projection.project(
|
1586
|
+
startCartographic,
|
1587
|
+
segmentStartCartesian
|
1588
|
+
);
|
1589
|
+
segmentEndCartesian = projection.project(
|
1590
|
+
endCartographic,
|
1591
|
+
segmentEndCartesian
|
1592
|
+
);
|
1593
|
+
length2D += Matrix3.Cartesian3.distance(
|
1594
|
+
segmentStartCartesian,
|
1595
|
+
segmentEndCartesian
|
1596
|
+
);
|
1597
|
+
index += 2;
|
1598
|
+
}
|
1599
|
+
}
|
1600
|
+
|
1601
|
+
// 3D
|
1602
|
+
const positionsLength = topPositionsArray.length / 3;
|
1603
|
+
segmentEndCartesian = Matrix3.Cartesian3.unpack(
|
1604
|
+
topPositionsArray,
|
1605
|
+
0,
|
1606
|
+
segmentEndCartesian
|
1607
|
+
);
|
1608
|
+
let length3D = 0.0;
|
1609
|
+
|
1610
|
+
index = 3;
|
1611
|
+
for (i = 1; i < positionsLength; i++) {
|
1612
|
+
segmentStartCartesian = Matrix3.Cartesian3.clone(
|
1613
|
+
segmentEndCartesian,
|
1614
|
+
segmentStartCartesian
|
1615
|
+
);
|
1616
|
+
segmentEndCartesian = Matrix3.Cartesian3.unpack(
|
1617
|
+
topPositionsArray,
|
1618
|
+
index,
|
1619
|
+
segmentEndCartesian
|
1620
|
+
);
|
1621
|
+
length3D += Matrix3.Cartesian3.distance(segmentStartCartesian, segmentEndCartesian);
|
1622
|
+
index += 3;
|
1623
|
+
}
|
1624
|
+
|
1625
|
+
/*** Generate segments ***/
|
1626
|
+
let j;
|
1627
|
+
index = 3;
|
1628
|
+
let cartographicsIndex = 0;
|
1629
|
+
let vec2sWriteIndex = 0;
|
1630
|
+
let vec3sWriteIndex = 0;
|
1631
|
+
let vec4sWriteIndex = 0;
|
1632
|
+
let miterBroken = false;
|
1633
|
+
|
1634
|
+
let endBottom = Matrix3.Cartesian3.unpack(
|
1635
|
+
bottomPositionsArray,
|
1636
|
+
0,
|
1637
|
+
segmentEndBottomScratch
|
1638
|
+
);
|
1639
|
+
let endTop = Matrix3.Cartesian3.unpack(topPositionsArray, 0, segmentEndTopScratch);
|
1640
|
+
let endGeometryNormal = Matrix3.Cartesian3.unpack(
|
1641
|
+
normalsArray,
|
1642
|
+
0,
|
1643
|
+
segmentEndNormalScratch
|
1644
|
+
);
|
1645
|
+
|
1646
|
+
if (loop) {
|
1647
|
+
const preEndBottom = Matrix3.Cartesian3.unpack(
|
1648
|
+
bottomPositionsArray,
|
1649
|
+
bottomPositionsArray.length - 6,
|
1650
|
+
segmentStartBottomScratch
|
1651
|
+
);
|
1652
|
+
if (breakMiter(endGeometryNormal, preEndBottom, endBottom, endTop)) {
|
1653
|
+
// Miter broken as if for the last point in the loop, needs to be inverted for first point (clone of endBottom)
|
1654
|
+
endGeometryNormal = Matrix3.Cartesian3.negate(
|
1655
|
+
endGeometryNormal,
|
1656
|
+
endGeometryNormal
|
1657
|
+
);
|
1658
|
+
}
|
1659
|
+
}
|
1660
|
+
|
1661
|
+
let lengthSoFar3D = 0.0;
|
1662
|
+
let lengthSoFar2D = 0.0;
|
1663
|
+
|
1664
|
+
// For translating bounding volume
|
1665
|
+
let sumHeights = 0.0;
|
1666
|
+
|
1667
|
+
for (i = 0; i < segmentCount; i++) {
|
1668
|
+
const startBottom = Matrix3.Cartesian3.clone(endBottom, segmentStartBottomScratch);
|
1669
|
+
const startTop = Matrix3.Cartesian3.clone(endTop, segmentStartTopScratch);
|
1670
|
+
let startGeometryNormal = Matrix3.Cartesian3.clone(
|
1671
|
+
endGeometryNormal,
|
1672
|
+
segmentStartNormalScratch
|
1673
|
+
);
|
1674
|
+
|
1675
|
+
if (miterBroken) {
|
1676
|
+
startGeometryNormal = Matrix3.Cartesian3.negate(
|
1677
|
+
startGeometryNormal,
|
1678
|
+
startGeometryNormal
|
1679
|
+
);
|
1680
|
+
}
|
1681
|
+
|
1682
|
+
endBottom = Matrix3.Cartesian3.unpack(
|
1683
|
+
bottomPositionsArray,
|
1684
|
+
index,
|
1685
|
+
segmentEndBottomScratch
|
1686
|
+
);
|
1687
|
+
endTop = Matrix3.Cartesian3.unpack(topPositionsArray, index, segmentEndTopScratch);
|
1688
|
+
endGeometryNormal = Matrix3.Cartesian3.unpack(
|
1689
|
+
normalsArray,
|
1690
|
+
index,
|
1691
|
+
segmentEndNormalScratch
|
1692
|
+
);
|
1693
|
+
|
1694
|
+
miterBroken = breakMiter(endGeometryNormal, startBottom, endBottom, endTop);
|
1695
|
+
|
1696
|
+
// 2D - don't clone anything from previous segment b/c possible IDL touch
|
1697
|
+
startCartographic.latitude = cartographicsArray[cartographicsIndex];
|
1698
|
+
startCartographic.longitude = cartographicsArray[cartographicsIndex + 1];
|
1699
|
+
endCartographic.latitude = cartographicsArray[cartographicsIndex + 2];
|
1700
|
+
endCartographic.longitude = cartographicsArray[cartographicsIndex + 3];
|
1701
|
+
let start2D;
|
1702
|
+
let end2D;
|
1703
|
+
let startGeometryNormal2D;
|
1704
|
+
let endGeometryNormal2D;
|
1705
|
+
|
1706
|
+
if (compute2dAttributes) {
|
1707
|
+
const nudgeResult = nudgeCartographic(startCartographic, endCartographic);
|
1708
|
+
start2D = projection.project(startCartographic, segmentStart2DScratch);
|
1709
|
+
end2D = projection.project(endCartographic, segmentEnd2DScratch);
|
1710
|
+
const direction2D = direction(end2D, start2D, forwardOffset2DScratch);
|
1711
|
+
direction2D.y = Math.abs(direction2D.y);
|
1712
|
+
|
1713
|
+
startGeometryNormal2D = segmentStartNormal2DScratch;
|
1714
|
+
endGeometryNormal2D = segmentEndNormal2DScratch;
|
1715
|
+
if (
|
1716
|
+
nudgeResult === 0 ||
|
1717
|
+
Matrix3.Cartesian3.dot(direction2D, Matrix3.Cartesian3.UNIT_Y) > MITER_BREAK_SMALL
|
1718
|
+
) {
|
1719
|
+
// No nudge - project the original normal
|
1720
|
+
// Or, if the line's angle relative to the IDL is very acute,
|
1721
|
+
// in which case snapping will produce oddly shaped volumes.
|
1722
|
+
startGeometryNormal2D = projectNormal(
|
1723
|
+
projection,
|
1724
|
+
startCartographic,
|
1725
|
+
startGeometryNormal,
|
1726
|
+
start2D,
|
1727
|
+
segmentStartNormal2DScratch
|
1728
|
+
);
|
1729
|
+
endGeometryNormal2D = projectNormal(
|
1730
|
+
projection,
|
1731
|
+
endCartographic,
|
1732
|
+
endGeometryNormal,
|
1733
|
+
end2D,
|
1734
|
+
segmentEndNormal2DScratch
|
1735
|
+
);
|
1736
|
+
} else if (nudgeResult === 1) {
|
1737
|
+
// Start is close to IDL - snap start normal to align with IDL
|
1738
|
+
endGeometryNormal2D = projectNormal(
|
1739
|
+
projection,
|
1740
|
+
endCartographic,
|
1741
|
+
endGeometryNormal,
|
1742
|
+
end2D,
|
1743
|
+
segmentEndNormal2DScratch
|
1744
|
+
);
|
1745
|
+
startGeometryNormal2D.x = 0.0;
|
1746
|
+
// If start longitude is negative and end longitude is less negative, relative right is unit -Y
|
1747
|
+
// If start longitude is positive and end longitude is less positive, relative right is unit +Y
|
1748
|
+
startGeometryNormal2D.y = Math$1.CesiumMath.sign(
|
1749
|
+
startCartographic.longitude - Math.abs(endCartographic.longitude)
|
1750
|
+
);
|
1751
|
+
startGeometryNormal2D.z = 0.0;
|
1752
|
+
} else {
|
1753
|
+
// End is close to IDL - snap end normal to align with IDL
|
1754
|
+
startGeometryNormal2D = projectNormal(
|
1755
|
+
projection,
|
1756
|
+
startCartographic,
|
1757
|
+
startGeometryNormal,
|
1758
|
+
start2D,
|
1759
|
+
segmentStartNormal2DScratch
|
1760
|
+
);
|
1761
|
+
endGeometryNormal2D.x = 0.0;
|
1762
|
+
// If end longitude is negative and start longitude is less negative, relative right is unit Y
|
1763
|
+
// If end longitude is positive and start longitude is less positive, relative right is unit -Y
|
1764
|
+
endGeometryNormal2D.y = Math$1.CesiumMath.sign(
|
1765
|
+
startCartographic.longitude - endCartographic.longitude
|
1766
|
+
);
|
1767
|
+
endGeometryNormal2D.z = 0.0;
|
1768
|
+
}
|
1769
|
+
}
|
1770
|
+
|
1771
|
+
/****************************************
|
1772
|
+
* Geometry descriptors of a "line on terrain,"
|
1773
|
+
* as opposed to the "shadow volume used to draw
|
1774
|
+
* the line on terrain":
|
1775
|
+
* - position of start + offset to end
|
1776
|
+
* - start, end, and right-facing planes
|
1777
|
+
* - encoded texture coordinate offsets
|
1778
|
+
****************************************/
|
1779
|
+
|
1780
|
+
/* 3D */
|
1781
|
+
const segmentLength3D = Matrix3.Cartesian3.distance(startTop, endTop);
|
1782
|
+
|
1783
|
+
const encodedStart = EncodedCartesian3.EncodedCartesian3.fromCartesian(
|
1784
|
+
startBottom,
|
1785
|
+
encodeScratch
|
1786
|
+
);
|
1787
|
+
const forwardOffset = Matrix3.Cartesian3.subtract(
|
1788
|
+
endBottom,
|
1789
|
+
startBottom,
|
1790
|
+
offsetScratch
|
1791
|
+
);
|
1792
|
+
const forward = Matrix3.Cartesian3.normalize(forwardOffset, rightScratch);
|
1793
|
+
|
1794
|
+
let startUp = Matrix3.Cartesian3.subtract(startTop, startBottom, startUpScratch);
|
1795
|
+
startUp = Matrix3.Cartesian3.normalize(startUp, startUp);
|
1796
|
+
let rightNormal = Matrix3.Cartesian3.cross(forward, startUp, rightScratch);
|
1797
|
+
rightNormal = Matrix3.Cartesian3.normalize(rightNormal, rightNormal);
|
1798
|
+
|
1799
|
+
let startPlaneNormal = Matrix3.Cartesian3.cross(
|
1800
|
+
startUp,
|
1801
|
+
startGeometryNormal,
|
1802
|
+
startPlaneNormalScratch
|
1803
|
+
);
|
1804
|
+
startPlaneNormal = Matrix3.Cartesian3.normalize(startPlaneNormal, startPlaneNormal);
|
1805
|
+
|
1806
|
+
let endUp = Matrix3.Cartesian3.subtract(endTop, endBottom, endUpScratch);
|
1807
|
+
endUp = Matrix3.Cartesian3.normalize(endUp, endUp);
|
1808
|
+
let endPlaneNormal = Matrix3.Cartesian3.cross(
|
1809
|
+
endGeometryNormal,
|
1810
|
+
endUp,
|
1811
|
+
endPlaneNormalScratch
|
1812
|
+
);
|
1813
|
+
endPlaneNormal = Matrix3.Cartesian3.normalize(endPlaneNormal, endPlaneNormal);
|
1814
|
+
|
1815
|
+
const texcoordNormalization3DX = segmentLength3D / length3D;
|
1816
|
+
const texcoordNormalization3DY = lengthSoFar3D / length3D;
|
1817
|
+
|
1818
|
+
/* 2D */
|
1819
|
+
let segmentLength2D = 0.0;
|
1820
|
+
let encodedStart2D;
|
1821
|
+
let forwardOffset2D;
|
1822
|
+
let right2D;
|
1823
|
+
let texcoordNormalization2DX = 0.0;
|
1824
|
+
let texcoordNormalization2DY = 0.0;
|
1825
|
+
if (compute2dAttributes) {
|
1826
|
+
segmentLength2D = Matrix3.Cartesian3.distance(start2D, end2D);
|
1827
|
+
|
1828
|
+
encodedStart2D = EncodedCartesian3.EncodedCartesian3.fromCartesian(
|
1829
|
+
start2D,
|
1830
|
+
encodeScratch2D
|
1831
|
+
);
|
1832
|
+
forwardOffset2D = Matrix3.Cartesian3.subtract(
|
1833
|
+
end2D,
|
1834
|
+
start2D,
|
1835
|
+
forwardOffset2DScratch
|
1836
|
+
);
|
1837
|
+
|
1838
|
+
// Right direction is just forward direction rotated by -90 degrees around Z
|
1839
|
+
// Similarly with plane normals
|
1840
|
+
right2D = Matrix3.Cartesian3.normalize(forwardOffset2D, right2DScratch);
|
1841
|
+
const swap = right2D.x;
|
1842
|
+
right2D.x = right2D.y;
|
1843
|
+
right2D.y = -swap;
|
1844
|
+
|
1845
|
+
texcoordNormalization2DX = segmentLength2D / length2D;
|
1846
|
+
texcoordNormalization2DY = lengthSoFar2D / length2D;
|
1847
|
+
}
|
1848
|
+
/** Pack **/
|
1849
|
+
for (j = 0; j < 8; j++) {
|
1850
|
+
const vec4Index = vec4sWriteIndex + j * 4;
|
1851
|
+
const vec2Index = vec2sWriteIndex + j * 2;
|
1852
|
+
const wIndex = vec4Index + 3;
|
1853
|
+
|
1854
|
+
// Encode sidedness of vertex relative to right plane in texture coordinate normalization X,
|
1855
|
+
// whether vertex is top or bottom of volume in sign/magnitude of normalization Y.
|
1856
|
+
const rightPlaneSide = j < 4 ? 1.0 : -1.0;
|
1857
|
+
const topBottomSide =
|
1858
|
+
j === 2 || j === 3 || j === 6 || j === 7 ? 1.0 : -1.0;
|
1859
|
+
|
1860
|
+
// 3D
|
1861
|
+
Matrix3.Cartesian3.pack(encodedStart.high, startHiAndForwardOffsetX, vec4Index);
|
1862
|
+
startHiAndForwardOffsetX[wIndex] = forwardOffset.x;
|
1863
|
+
|
1864
|
+
Matrix3.Cartesian3.pack(encodedStart.low, startLoAndForwardOffsetY, vec4Index);
|
1865
|
+
startLoAndForwardOffsetY[wIndex] = forwardOffset.y;
|
1866
|
+
|
1867
|
+
Matrix3.Cartesian3.pack(
|
1868
|
+
startPlaneNormal,
|
1869
|
+
startNormalAndForwardOffsetZ,
|
1870
|
+
vec4Index
|
1871
|
+
);
|
1872
|
+
startNormalAndForwardOffsetZ[wIndex] = forwardOffset.z;
|
1873
|
+
|
1874
|
+
Matrix3.Cartesian3.pack(
|
1875
|
+
endPlaneNormal,
|
1876
|
+
endNormalAndTextureCoordinateNormalizationX,
|
1877
|
+
vec4Index
|
1878
|
+
);
|
1879
|
+
endNormalAndTextureCoordinateNormalizationX[wIndex] =
|
1880
|
+
texcoordNormalization3DX * rightPlaneSide;
|
1881
|
+
|
1882
|
+
Matrix3.Cartesian3.pack(
|
1883
|
+
rightNormal,
|
1884
|
+
rightNormalAndTextureCoordinateNormalizationY,
|
1885
|
+
vec4Index
|
1886
|
+
);
|
1887
|
+
|
1888
|
+
let texcoordNormalization = texcoordNormalization3DY * topBottomSide;
|
1889
|
+
if (texcoordNormalization === 0.0 && topBottomSide < 0.0) {
|
1890
|
+
texcoordNormalization = 9.0; // some value greater than 1.0
|
1891
|
+
}
|
1892
|
+
rightNormalAndTextureCoordinateNormalizationY[
|
1893
|
+
wIndex
|
1894
|
+
] = texcoordNormalization;
|
1895
|
+
|
1896
|
+
// 2D
|
1897
|
+
if (compute2dAttributes) {
|
1898
|
+
startHiLo2D[vec4Index] = encodedStart2D.high.x;
|
1899
|
+
startHiLo2D[vec4Index + 1] = encodedStart2D.high.y;
|
1900
|
+
startHiLo2D[vec4Index + 2] = encodedStart2D.low.x;
|
1901
|
+
startHiLo2D[vec4Index + 3] = encodedStart2D.low.y;
|
1902
|
+
|
1903
|
+
startEndNormals2D[vec4Index] = -startGeometryNormal2D.y;
|
1904
|
+
startEndNormals2D[vec4Index + 1] = startGeometryNormal2D.x;
|
1905
|
+
startEndNormals2D[vec4Index + 2] = endGeometryNormal2D.y;
|
1906
|
+
startEndNormals2D[vec4Index + 3] = -endGeometryNormal2D.x;
|
1907
|
+
|
1908
|
+
offsetAndRight2D[vec4Index] = forwardOffset2D.x;
|
1909
|
+
offsetAndRight2D[vec4Index + 1] = forwardOffset2D.y;
|
1910
|
+
offsetAndRight2D[vec4Index + 2] = right2D.x;
|
1911
|
+
offsetAndRight2D[vec4Index + 3] = right2D.y;
|
1912
|
+
|
1913
|
+
texcoordNormalization2D[vec2Index] =
|
1914
|
+
texcoordNormalization2DX * rightPlaneSide;
|
1915
|
+
|
1916
|
+
texcoordNormalization = texcoordNormalization2DY * topBottomSide;
|
1917
|
+
if (texcoordNormalization === 0.0 && topBottomSide < 0.0) {
|
1918
|
+
texcoordNormalization = 9.0; // some value greater than 1.0
|
1919
|
+
}
|
1920
|
+
texcoordNormalization2D[vec2Index + 1] = texcoordNormalization;
|
1921
|
+
}
|
1922
|
+
}
|
1923
|
+
|
1924
|
+
// Adjust height of volume in 3D
|
1925
|
+
const adjustHeightStartBottom = adjustHeightStartBottomScratch;
|
1926
|
+
const adjustHeightEndBottom = adjustHeightEndBottomScratch;
|
1927
|
+
const adjustHeightStartTop = adjustHeightStartTopScratch;
|
1928
|
+
const adjustHeightEndTop = adjustHeightEndTopScratch;
|
1929
|
+
|
1930
|
+
const getHeightsRectangle = Matrix2.Rectangle.fromCartographicArray(
|
1931
|
+
getHeightCartographics,
|
1932
|
+
getHeightRectangleScratch
|
1933
|
+
);
|
1934
|
+
const minMaxHeights = ApproximateTerrainHeights$1.getMinimumMaximumHeights(
|
1935
|
+
getHeightsRectangle,
|
1936
|
+
ellipsoid
|
1937
|
+
);
|
1938
|
+
const minHeight = minMaxHeights.minimumTerrainHeight;
|
1939
|
+
const maxHeight = minMaxHeights.maximumTerrainHeight;
|
1940
|
+
|
1941
|
+
sumHeights += minHeight;
|
1942
|
+
sumHeights += maxHeight;
|
1943
|
+
|
1944
|
+
adjustHeights(
|
1945
|
+
startBottom,
|
1946
|
+
startTop,
|
1947
|
+
minHeight,
|
1948
|
+
maxHeight,
|
1949
|
+
adjustHeightStartBottom,
|
1950
|
+
adjustHeightStartTop
|
1951
|
+
);
|
1952
|
+
adjustHeights(
|
1953
|
+
endBottom,
|
1954
|
+
endTop,
|
1955
|
+
minHeight,
|
1956
|
+
maxHeight,
|
1957
|
+
adjustHeightEndBottom,
|
1958
|
+
adjustHeightEndTop
|
1959
|
+
);
|
1960
|
+
|
1961
|
+
// Nudge the positions away from the "polyline" a little bit to prevent errors in GeometryPipeline
|
1962
|
+
let normalNudge = Matrix3.Cartesian3.multiplyByScalar(
|
1963
|
+
rightNormal,
|
1964
|
+
Math$1.CesiumMath.EPSILON5,
|
1965
|
+
normalNudgeScratch
|
1966
|
+
);
|
1967
|
+
Matrix3.Cartesian3.add(
|
1968
|
+
adjustHeightStartBottom,
|
1969
|
+
normalNudge,
|
1970
|
+
adjustHeightStartBottom
|
1971
|
+
);
|
1972
|
+
Matrix3.Cartesian3.add(adjustHeightEndBottom, normalNudge, adjustHeightEndBottom);
|
1973
|
+
Matrix3.Cartesian3.add(adjustHeightStartTop, normalNudge, adjustHeightStartTop);
|
1974
|
+
Matrix3.Cartesian3.add(adjustHeightEndTop, normalNudge, adjustHeightEndTop);
|
1975
|
+
|
1976
|
+
// If the segment is very close to the XZ plane, nudge the vertices slightly to avoid touching it.
|
1977
|
+
nudgeXZ(adjustHeightStartBottom, adjustHeightEndBottom);
|
1978
|
+
nudgeXZ(adjustHeightStartTop, adjustHeightEndTop);
|
1979
|
+
|
1980
|
+
Matrix3.Cartesian3.pack(adjustHeightStartBottom, positionsArray, vec3sWriteIndex);
|
1981
|
+
Matrix3.Cartesian3.pack(adjustHeightEndBottom, positionsArray, vec3sWriteIndex + 3);
|
1982
|
+
Matrix3.Cartesian3.pack(adjustHeightEndTop, positionsArray, vec3sWriteIndex + 6);
|
1983
|
+
Matrix3.Cartesian3.pack(adjustHeightStartTop, positionsArray, vec3sWriteIndex + 9);
|
1984
|
+
|
1985
|
+
normalNudge = Matrix3.Cartesian3.multiplyByScalar(
|
1986
|
+
rightNormal,
|
1987
|
+
-2.0 * Math$1.CesiumMath.EPSILON5,
|
1988
|
+
normalNudgeScratch
|
1989
|
+
);
|
1990
|
+
Matrix3.Cartesian3.add(
|
1991
|
+
adjustHeightStartBottom,
|
1992
|
+
normalNudge,
|
1993
|
+
adjustHeightStartBottom
|
1994
|
+
);
|
1995
|
+
Matrix3.Cartesian3.add(adjustHeightEndBottom, normalNudge, adjustHeightEndBottom);
|
1996
|
+
Matrix3.Cartesian3.add(adjustHeightStartTop, normalNudge, adjustHeightStartTop);
|
1997
|
+
Matrix3.Cartesian3.add(adjustHeightEndTop, normalNudge, adjustHeightEndTop);
|
1998
|
+
|
1999
|
+
nudgeXZ(adjustHeightStartBottom, adjustHeightEndBottom);
|
2000
|
+
nudgeXZ(adjustHeightStartTop, adjustHeightEndTop);
|
2001
|
+
|
2002
|
+
Matrix3.Cartesian3.pack(
|
2003
|
+
adjustHeightStartBottom,
|
2004
|
+
positionsArray,
|
2005
|
+
vec3sWriteIndex + 12
|
2006
|
+
);
|
2007
|
+
Matrix3.Cartesian3.pack(
|
2008
|
+
adjustHeightEndBottom,
|
2009
|
+
positionsArray,
|
2010
|
+
vec3sWriteIndex + 15
|
2011
|
+
);
|
2012
|
+
Matrix3.Cartesian3.pack(adjustHeightEndTop, positionsArray, vec3sWriteIndex + 18);
|
2013
|
+
Matrix3.Cartesian3.pack(adjustHeightStartTop, positionsArray, vec3sWriteIndex + 21);
|
2014
|
+
|
2015
|
+
cartographicsIndex += 2;
|
2016
|
+
index += 3;
|
2017
|
+
|
2018
|
+
vec2sWriteIndex += 16;
|
2019
|
+
vec3sWriteIndex += 24;
|
2020
|
+
vec4sWriteIndex += 32;
|
2021
|
+
|
2022
|
+
lengthSoFar3D += segmentLength3D;
|
2023
|
+
lengthSoFar2D += segmentLength2D;
|
2024
|
+
}
|
2025
|
+
|
2026
|
+
index = 0;
|
2027
|
+
let indexOffset = 0;
|
2028
|
+
for (i = 0; i < segmentCount; i++) {
|
2029
|
+
for (j = 0; j < REFERENCE_INDICES_LENGTH; j++) {
|
2030
|
+
indices[index + j] = REFERENCE_INDICES[j] + indexOffset;
|
2031
|
+
}
|
2032
|
+
indexOffset += 8;
|
2033
|
+
index += REFERENCE_INDICES_LENGTH;
|
2034
|
+
}
|
2035
|
+
|
2036
|
+
const boundingSpheres = scratchBoundingSpheres;
|
2037
|
+
Transforms.BoundingSphere.fromVertices(
|
2038
|
+
bottomPositionsArray,
|
2039
|
+
Matrix3.Cartesian3.ZERO,
|
2040
|
+
3,
|
2041
|
+
boundingSpheres[0]
|
2042
|
+
);
|
2043
|
+
Transforms.BoundingSphere.fromVertices(
|
2044
|
+
topPositionsArray,
|
2045
|
+
Matrix3.Cartesian3.ZERO,
|
2046
|
+
3,
|
2047
|
+
boundingSpheres[1]
|
2048
|
+
);
|
2049
|
+
const boundingSphere = Transforms.BoundingSphere.fromBoundingSpheres(boundingSpheres);
|
2050
|
+
|
2051
|
+
// Adjust bounding sphere height and radius to cover more of the volume
|
2052
|
+
boundingSphere.radius += sumHeights / (segmentCount * 2.0);
|
2053
|
+
|
2054
|
+
const attributes = {
|
2055
|
+
position: new GeometryAttribute.GeometryAttribute({
|
2056
|
+
componentDatatype: ComponentDatatype.ComponentDatatype.DOUBLE,
|
2057
|
+
componentsPerAttribute: 3,
|
2058
|
+
normalize: false,
|
2059
|
+
values: positionsArray,
|
2060
|
+
}),
|
2061
|
+
startHiAndForwardOffsetX: getVec4GeometryAttribute(
|
2062
|
+
startHiAndForwardOffsetX
|
2063
|
+
),
|
2064
|
+
startLoAndForwardOffsetY: getVec4GeometryAttribute(
|
2065
|
+
startLoAndForwardOffsetY
|
2066
|
+
),
|
2067
|
+
startNormalAndForwardOffsetZ: getVec4GeometryAttribute(
|
2068
|
+
startNormalAndForwardOffsetZ
|
2069
|
+
),
|
2070
|
+
endNormalAndTextureCoordinateNormalizationX: getVec4GeometryAttribute(
|
2071
|
+
endNormalAndTextureCoordinateNormalizationX
|
2072
|
+
),
|
2073
|
+
rightNormalAndTextureCoordinateNormalizationY: getVec4GeometryAttribute(
|
2074
|
+
rightNormalAndTextureCoordinateNormalizationY
|
2075
|
+
),
|
2076
|
+
};
|
2077
|
+
|
2078
|
+
if (compute2dAttributes) {
|
2079
|
+
attributes.startHiLo2D = getVec4GeometryAttribute(startHiLo2D);
|
2080
|
+
attributes.offsetAndRight2D = getVec4GeometryAttribute(offsetAndRight2D);
|
2081
|
+
attributes.startEndNormals2D = getVec4GeometryAttribute(startEndNormals2D);
|
2082
|
+
attributes.texcoordNormalization2D = new GeometryAttribute.GeometryAttribute({
|
2083
|
+
componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
|
2084
|
+
componentsPerAttribute: 2,
|
2085
|
+
normalize: false,
|
2086
|
+
values: texcoordNormalization2D,
|
2087
|
+
});
|
2088
|
+
}
|
2089
|
+
|
2090
|
+
return new GeometryAttribute.Geometry({
|
2091
|
+
attributes: attributes,
|
2092
|
+
indices: indices,
|
2093
|
+
boundingSphere: boundingSphere,
|
2094
|
+
});
|
2095
|
+
}
|
2096
|
+
|
2097
|
+
function getVec4GeometryAttribute(typedArray) {
|
2098
|
+
return new GeometryAttribute.GeometryAttribute({
|
2099
|
+
componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
|
2100
|
+
componentsPerAttribute: 4,
|
2101
|
+
normalize: false,
|
2102
|
+
values: typedArray,
|
2103
|
+
});
|
2104
|
+
}
|
2105
|
+
|
2106
|
+
/**
|
2107
|
+
* Approximates an ellipsoid-tangent vector in 2D by projecting the end point into 2D.
|
2108
|
+
* Exposed for testing.
|
2109
|
+
*
|
2110
|
+
* @param {MapProjection} projection Map Projection for projecting coordinates to 2D.
|
2111
|
+
* @param {Cartographic} cartographic The cartographic origin point of the normal.
|
2112
|
+
* Used to check if the normal crosses the IDL during projection.
|
2113
|
+
* @param {Cartesian3} normal The normal in 3D.
|
2114
|
+
* @param {Cartesian3} projectedPosition The projected origin point of the normal in 2D.
|
2115
|
+
* @param {Cartesian3} result Result parameter on which to store the projected normal.
|
2116
|
+
* @private
|
2117
|
+
*/
|
2118
|
+
GroundPolylineGeometry._projectNormal = projectNormal;
|
2119
|
+
|
2120
|
+
function createGroundPolylineGeometry(groundPolylineGeometry, offset) {
|
2121
|
+
return ApproximateTerrainHeights$1.initialize().then(function () {
|
2122
|
+
if (defaultValue.defined(offset)) {
|
2123
|
+
groundPolylineGeometry = GroundPolylineGeometry.unpack(
|
2124
|
+
groundPolylineGeometry,
|
2125
|
+
offset
|
2126
|
+
);
|
2127
|
+
}
|
2128
|
+
return GroundPolylineGeometry.createGeometry(groundPolylineGeometry);
|
2129
|
+
});
|
2130
|
+
}
|
2131
|
+
|
2132
|
+
return createGroundPolylineGeometry;
|
2133
|
+
|
2134
|
+
}));
|