diff --git a/sample/cesiumWindSample/gui.js b/sample/cesiumWindSample/gui.js index 151773a..e2acb1c 100644 --- a/sample/cesiumWindSample/gui.js +++ b/sample/cesiumWindSample/gui.js @@ -1,21 +1,20 @@ var demo = Cesium.defaultValue(demo, false); export const fileOptions = { - dataDirectory: demo - ? "https://raw.githubusercontent.com/RaymanNg/3D-Wind-Field/master/data/" + dataDirectory : "../../public/windData/", dataFile: "demo.nc", - glslDirectory: demo ? "../cesiumWindSample/glsl/" : "glsl/", + glslDirectory: "glsl/", }; export const defaultParticleSystemOptions = { - maxParticles: 128 * 128, - particleHeight: 25.0, + maxParticles: 110 * 110, + particleHeight: 30.0, fadeOpacity: 0.996, - dropRate: 0.03, - dropRateBump: 0.04, - speedFactor: 1.6, - lineWidth: 3.0, + dropRate: 0.02, + dropRateBump: 0.02, + speedFactor: 4.0, + lineWidth: 4.0, }; const globeLayers = [ @@ -24,7 +23,7 @@ const globeLayers = [ // { name: "2024.01.08.06:00", type: "2401080600", fileName: "2401080600.nc" }, { - name: "WorldTerrain", + name: "2018.09.16.00:00", type: "WorldTerrain", fileName: "demo.nc", }, @@ -45,8 +44,15 @@ export class Panel { this.dropRateBump = defaultParticleSystemOptions.dropRateBump; this.speedFactor = defaultParticleSystemOptions.speedFactor; this.lineWidth = defaultParticleSystemOptions.lineWidth; - this.globeLayer = defaultLayerOptions.globeLayer; + this.cameraToRecon = () => { + var event = new CustomEvent("cameraToRecon"); + window.dispatchEvent(event); + }; + this.cameraToSeoul = () => { + var event = new CustomEvent("cameraToSeoul"); + window.dispatchEvent(event); + }; this.WMS_URL = defaultLayerOptions.WMS_URL; var layerNames = []; @@ -72,39 +78,49 @@ export class Panel { window.dispatchEvent(event); }; + // const onCameraChange = function () {}; + // add:function(){ alert("clicked") + window.onload = function () { - var gui = new dat.GUI({ autoPlace: false }); - gui - .add(that, "maxParticles", 1, 256 * 256, 1) + this.gui = new dat.GUI({ autoPlace: false }); + + this.gui + .add(that, "maxParticles", 1, 110 * 110, 1) .onFinishChange(onParticleSystemOptionsChange); - gui - .add(that, "particleHeight", 0.1, 10000, 0.01) + this.gui + .add(that, "particleHeight", 0.1, 100, 0.01) .onFinishChange(onParticleSystemOptionsChange); - gui + this.gui .add(that, "fadeOpacity", 0.9, 0.999, 0.001) .onFinishChange(onParticleSystemOptionsChange); - // gui + // this.gui // .add(that, "dropRate", 0.0, 0.1) // .onFinishChange(onParticleSystemOptionsChange); - // gui + // this.gui // .add(that, "dropRateBump", 0, 0.2) // .onFinishChange(onParticleSystemOptionsChange); - gui - .add(that, "speedFactor", 0.0001, 8) + this.gui + .add(that, "speedFactor", 0.0001, 4) .onFinishChange(onParticleSystemOptionsChange); - gui - .add(that, "lineWidth", 0.0001, 16.0) + this.gui + .add(that, "lineWidth", 0.0001, 2.0) .onFinishChange(onParticleSystemOptionsChange); - gui + this.gui .add(that, "layerToShow", layerNames) .onFinishChange(onLayerOptionsChange); + this.gui.add(that, "cameraToRecon").onFinishChange(); + this.gui.add(that, "cameraToSeoul").onFinishChange(); + var panelContainer = document .getElementsByClassName("cesium-widget") .item(0); - gui.domElement.classList.add("myPanel"); - panelContainer.appendChild(gui.domElement); + this.gui.domElement.classList.add("myPanel"); + + console.log("gui", this.gui); + + panelContainer.appendChild(this.gui.domElement); }; } diff --git a/sample/cesiumWindSample/particleSystem.js b/sample/cesiumWindSample/particleSystem.js index 5e28cb9..23842d7 100644 --- a/sample/cesiumWindSample/particleSystem.js +++ b/sample/cesiumWindSample/particleSystem.js @@ -86,7 +86,7 @@ export class ParticleSystem { this.particlesRendering.primitives.segments.attributeLocations, bufferUsage: Cesium.BufferUsage.STATIC_DRAW, }); - console.log(vertexArray); + // console.log(vertexArray); this.particlesRendering.primitives.segments.commandToExecute.vertexArray = vertexArray; } diff --git a/sample/cesiumWindSample/particlesComputing.js b/sample/cesiumWindSample/particlesComputing.js index 1fc5901..ef084d4 100644 --- a/sample/cesiumWindSample/particlesComputing.js +++ b/sample/cesiumWindSample/particlesComputing.js @@ -86,20 +86,20 @@ export class ParticlesComputing { data.dimensions.lat, data.dimensions.lev ); - console.log("dimension", dimension); + // console.log("dimension", dimension); const minimum = new Cesium.Cartesian3( data.lon.min, data.lat.min, data.lev.min ); - console.log("minimum", minimum); + // console.log("minimum", minimum); const maximum = new Cesium.Cartesian3( data.lon.max, data.lat.max, data.lev.max ); - console.log("maximum", maximum); + // console.log("maximum", maximum); const interval = new Cesium.Cartesian3( (maximum.x - minimum.x) / (dimension.x - 1), diff --git a/sample/cesiumWindSample/wind3D.js b/sample/cesiumWindSample/wind3D.js index 460d0b7..d00cc6d 100644 --- a/sample/cesiumWindSample/wind3D.js +++ b/sample/cesiumWindSample/wind3D.js @@ -53,7 +53,7 @@ export class Wind3D { Cesium.Cartesian3.ZERO, 0.99 * 6378137.0 // 반지름 ); - this.updateViewerParameters(); + // this.updateViewerParameters(); this.imageryLayers = this.viewer.imageryLayers; this.setGlobeLayer(this.panel.getUserInput()); @@ -156,31 +156,31 @@ export class Wind3D { break; } - // case "2401081200": { - // this.viewer.imageryLayers.addImageryProvider( - // await Cesium.createWorldImageryAsync() - // ); - // this.addData(globeLayer.fileName); - - // break; - // } - - // case "2401080000": { - // this.viewer.imageryLayers.addImageryProvider( - // await Cesium.createWorldImageryAsync() - // ); - // this.addData(globeLayer.fileName); - - // break; - // } - // case "2401080600": { - // this.viewer.imageryLayers.addImageryProvider( - // await Cesium.createWorldImageryAsync() - // ); - // this.addData(globeLayer.fileName); - - // break; - // } + case "2401081200": { + this.viewer.imageryLayers.addImageryProvider( + await Cesium.createWorldImageryAsync() + ); + this.addData(globeLayer.fileName); + + break; + } + + case "2401080000": { + this.viewer.imageryLayers.addImageryProvider( + await Cesium.createWorldImageryAsync() + ); + this.addData(globeLayer.fileName); + + break; + } + case "2401080600": { + this.viewer.imageryLayers.addImageryProvider( + await Cesium.createWorldImageryAsync() + ); + this.addData(globeLayer.fileName); + + break; + } } setTimeout( () => @@ -191,27 +191,128 @@ export class Wind3D { 7800 ), }), - 3000 + 4000 ); } async setTileset() { const assetsList = [ - // 2386135, 2387624, 2387625, 2387627, 2387628, 2387629, 2387632, 2387633, - // 2387634, 2387635, 2387639, 2387647, 2387650, 2387651, 2387652, 2387655, - // 2387719, 2387720, 2387721, 2387723, 2387724, 2387725, 2387728, 2387735, - // 2387737, 2387775, 2387776, 2387777, 2387778, 2387779, 2387780, 2387781, - // 2387782, 2387792, 2387794, 2387796, 2387797, 2387798, 2387800, 2387802, - // 2387803, 2387804, 2387805, 2387806, 2387855, 2387856, 2387858, - // 2387861, 2387862, 2387863, 2387864, 2387865, 2387902, 2387903, 2387905, - // 2387906, 2387911, 2387912, 2387913, 2387970, 2387972, 2387974, 2387978, - // 2387979, 2387980, 2388059, 2388060, 2388063, 2388064, 2388065, 2388066, - // 2388067, 2388068, 2388069, 2388170, 2388171, 2388172, 2388175, 2388176, - // 2388177, 2388178, 2388179, 2388180, 2388183, 2388184, 2388185, 2388187, - // 2388188, 2388189, 2388191, 2388192, 2388195, 2388197, 2388198, 2388200, - // 2388201, 2388204, 2388209, 2388210, 2388211, 2388212, 2388213, 2388214, - // 2388215, 2388216, 2388217, 2388218, 2388219, 2388220, 2388221, 2388222, - // 2388223, 2388224, 2388225, 2388226, 2388227, + // 2386135, + // 2387624, + // 2387625, + // 2387627, + // 2387628, + // 2387629, + // 2387632, + // 2387633, + // 2387634, + // 2387635, + // 2387639, + // 2387647, + // 2387650, + // 2387651, + // 2387652, + // 2387655, + // 2387719, + // 2387720, + // 2387721, + // 2387723, + // 2387724, + // 2387725, + // 2387728, + // 2387735, + // 2387737, + // 2387775, + // 2387776, + // 2387777, + // 2387778, + // 2387779, + // 2387780, + // 2387781, + // 2387782, + // 2387792, + // 2387794, + // 2387796, + // 2387797, + // 2387798, + // 2387800, + // 2387802, + // 2387803, + // 2387804, + // 2387805, + // 2387806, + // 2387855, + // 2387856, + // 2387858, + // 2387861, + // 2387862, + // 2387863, + // 2387864, + // 2387865, + // 2387902, + // 2387903, + // 2387905, + // 2387906, + // 2387911, + // 2387912, + // 2387913, + // 2387970, + // 2387972, + // 2387974, + // 2387978, + // 2387979, + // 2387980, + // 2388059, + // 2388060, + // 2388063, + // 2388064, + // 2388065, + // 2388066, + // 2388067, + // 2388068, + // 2388069, + // 2388170, + // 2388171, + // 2388172, + // 2388175, + // 2388176, + // 2388177, + // 2388178, + // 2388179, + // 2388180, + // 2388183, + // 2388184, + // 2388185, + // 2388187, + // 2388188, + // 2388189, + // 2388191, + // 2388192, + // 2388195, + // 2388197, + // 2388198, + // 2388200, + // 2388201, + // 2388204, + // 2388209, + // 2388210, + // 2388211, + // 2388212, + // 2388213, + // 2388214, + // 2388215, + // 2388216, + // 2388217, + // 2388218, + // 2388219, + // 2388220, + // 2388221, + // 2388222, + // 2388223, + // 2388224, + // 2388225, + // 2388226, + // 2388227, 2387852, //고려대학교 지역 ]; @@ -269,6 +370,7 @@ export class Wind3D { return height; } } + // max = 26224244.XXXXXX, tilt 399 , min 151 getMaxNumByHeight(viewHeight) { // y=kx+b k=defaultParticleNum/initHeight @@ -276,23 +378,27 @@ export class Wind3D { if (viewHeight > 20000000) { return Math.ceil(k * viewHeight + 2000); } else if (viewHeight > 15000000) { - return Math.ceil(k * viewHeight + 5000); + return Math.ceil(k * viewHeight + viewHeight / 3000); } else if (viewHeight > 10000000) { - return Math.ceil(k * viewHeight + 7000); + return Math.ceil(k * viewHeight + viewHeight / 1000); } else if (viewHeight > 5000000) { - return Math.ceil(k * viewHeight + 9000); + return Math.ceil(k * viewHeight + viewHeight / 800); } else if (viewHeight > 1000000) { - return Math.ceil(k * viewHeight + 6000); + return Math.ceil(k * viewHeight + viewHeight / 350); } else if (viewHeight > 100000) { - return Math.ceil(k * viewHeight + 3000); + return Math.ceil(k * viewHeight + viewHeight / 250); + } else if (viewHeight > 50000) { + return Math.ceil(k * viewHeight + viewHeight / 150); } else if (viewHeight > 10000) { - return Math.ceil(k * viewHeight + 1000); + return Math.ceil(k * viewHeight + viewHeight / 100); + } else if (viewHeight > 5000) { + return Math.ceil(k * viewHeight + viewHeight / 80); } else if (viewHeight > 1000) { - return Math.ceil(k * viewHeight + 180); + return Math.ceil(k * viewHeight + viewHeight / 25); } else if (viewHeight > 500) { - return Math.ceil(k * viewHeight + 150); + return Math.ceil(k * viewHeight + viewHeight / 8); } else { - return Math.ceil(k * viewHeight + 100); + return Math.ceil(k * viewHeight + viewHeight); } } getLineWidthByHeight(viewHeight) { @@ -311,7 +417,7 @@ export class Wind3D { } else if (viewHeight > 2000) { return 0.6; } else if (viewHeight > 1000) { - return 0.3; + return 0.4; } else if (viewHeight > 100) { return 0.14; } else { @@ -345,7 +451,7 @@ export class Wind3D { } else if (viewHeight > 500) { return 1.0; } else { - return 0.8; + return 0.4; } } @@ -371,8 +477,8 @@ export class Wind3D { that.panel.lineWidth = lineWidth; that.panel.fadeOpacity = fadeOpacity; that.panel.speedFactor = speedFactor; - console.log("当前相机视角高度(单位 m):", viewHeight); - console.log(that.panel.getUserInput()); + console.log("height:", viewHeight); + // console.log(that.panel.getUserInput()); that.particleSystem.applyUserInput(that.panel.getUserInput()); that.updateViewerParameters(); @@ -380,6 +486,10 @@ export class Wind3D { // that.scene.primitives.show = true; // setTimeout(); that.primitivesArray.forEach((primitive) => (primitive.show = true)); + + for (var i in gui.__controllers) { + gui.__controllers[i].updateDisplay(); + } }); var resized = false; @@ -403,6 +513,26 @@ export class Wind3D { that.particleSystem.applyUserInput(that.panel.getUserInput()); }); + window.addEventListener("cameraToRecon", function () { + that.viewer.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees( + 127.0363431764427, + 37.585353994499876, + 7800 + ), + }); + }); + + window.addEventListener("cameraToSeoul", function () { + that.viewer.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees( + 126.991703, + 37.552802, + 57800 + ), + }); + }); + window.addEventListener("layerOptionsChanged", async function () { that.removePrimitives(); that.setGlobeLayer(that.panel.getUserInput()); diff --git a/sample/cesiumWindSeoulSample/gui.js b/sample/cesiumWindSeoulSample/gui.js index 987450b..6ffb465 100644 --- a/sample/cesiumWindSeoulSample/gui.js +++ b/sample/cesiumWindSeoulSample/gui.js @@ -1,21 +1,20 @@ var demo = Cesium.defaultValue(demo, false); export const fileOptions = { - dataDirectory: demo - ? "https://raw.githubusercontent.com/RaymanNg/3D-Wind-Field/master/data/" + dataDirectory : "../../public/windData/", dataFile: "demo.nc", - glslDirectory: demo ? "../cesiumWindSample/glsl/" : "glsl/", + glslDirectory: "glsl/", }; export const defaultParticleSystemOptions = { - maxParticles: 128 * 128, - particleHeight: 25.0, + maxParticles: 110 * 110, + particleHeight: 30.0, fadeOpacity: 0.996, - dropRate: 0.03, - dropRateBump: 0.04, - speedFactor: 1.6, - lineWidth: 3.0, + dropRate: 0.02, + dropRateBump: 0.02, + speedFactor: 4.0, + lineWidth: 4.0, }; const globeLayers = [ @@ -45,8 +44,15 @@ export class Panel { this.dropRateBump = defaultParticleSystemOptions.dropRateBump; this.speedFactor = defaultParticleSystemOptions.speedFactor; this.lineWidth = defaultParticleSystemOptions.lineWidth; - this.globeLayer = defaultLayerOptions.globeLayer; + this.cameraToRecon = () => { + var event = new CustomEvent("cameraToRecon"); + window.dispatchEvent(event); + }; + this.cameraToSeoul = () => { + var event = new CustomEvent("cameraToSeoul"); + window.dispatchEvent(event); + }; this.WMS_URL = defaultLayerOptions.WMS_URL; var layerNames = []; @@ -72,39 +78,49 @@ export class Panel { window.dispatchEvent(event); }; + // const onCameraChange = function () {}; + // add:function(){ alert("clicked") + window.onload = function () { - var gui = new dat.GUI({ autoPlace: false }); - gui - .add(that, "maxParticles", 1, 256 * 256, 1) + this.gui = new dat.GUI({ autoPlace: false }); + + this.gui + .add(that, "maxParticles", 1, 110 * 110, 1) .onFinishChange(onParticleSystemOptionsChange); - gui - .add(that, "particleHeight", 0.1, 10000, 0.01) + this.gui + .add(that, "particleHeight", 0.1, 100, 0.01) .onFinishChange(onParticleSystemOptionsChange); - gui + this.gui .add(that, "fadeOpacity", 0.9, 0.999, 0.001) .onFinishChange(onParticleSystemOptionsChange); - // gui + // this.gui // .add(that, "dropRate", 0.0, 0.1) // .onFinishChange(onParticleSystemOptionsChange); - // gui + // this.gui // .add(that, "dropRateBump", 0, 0.2) // .onFinishChange(onParticleSystemOptionsChange); - gui - .add(that, "speedFactor", 0.0001, 8) + this.gui + .add(that, "speedFactor", 0.0001, 4) .onFinishChange(onParticleSystemOptionsChange); - gui - .add(that, "lineWidth", 0.0001, 16.0) + this.gui + .add(that, "lineWidth", 0.0001, 2.0) .onFinishChange(onParticleSystemOptionsChange); - gui + this.gui .add(that, "layerToShow", layerNames) .onFinishChange(onLayerOptionsChange); + this.gui.add(that, "cameraToRecon").onFinishChange(); + this.gui.add(that, "cameraToSeoul").onFinishChange(); + var panelContainer = document .getElementsByClassName("cesium-widget") .item(0); - gui.domElement.classList.add("myPanel"); - panelContainer.appendChild(gui.domElement); + this.gui.domElement.classList.add("myPanel"); + + console.log("gui", this.gui); + + panelContainer.appendChild(this.gui.domElement); }; } diff --git a/sample/cesiumWindSeoulSample/particleSystem.js b/sample/cesiumWindSeoulSample/particleSystem.js index 5e28cb9..23842d7 100644 --- a/sample/cesiumWindSeoulSample/particleSystem.js +++ b/sample/cesiumWindSeoulSample/particleSystem.js @@ -86,7 +86,7 @@ export class ParticleSystem { this.particlesRendering.primitives.segments.attributeLocations, bufferUsage: Cesium.BufferUsage.STATIC_DRAW, }); - console.log(vertexArray); + // console.log(vertexArray); this.particlesRendering.primitives.segments.commandToExecute.vertexArray = vertexArray; } diff --git a/sample/cesiumWindSeoulSample/particlesComputing.js b/sample/cesiumWindSeoulSample/particlesComputing.js index 1fc5901..ef084d4 100644 --- a/sample/cesiumWindSeoulSample/particlesComputing.js +++ b/sample/cesiumWindSeoulSample/particlesComputing.js @@ -86,20 +86,20 @@ export class ParticlesComputing { data.dimensions.lat, data.dimensions.lev ); - console.log("dimension", dimension); + // console.log("dimension", dimension); const minimum = new Cesium.Cartesian3( data.lon.min, data.lat.min, data.lev.min ); - console.log("minimum", minimum); + // console.log("minimum", minimum); const maximum = new Cesium.Cartesian3( data.lon.max, data.lat.max, data.lev.max ); - console.log("maximum", maximum); + // console.log("maximum", maximum); const interval = new Cesium.Cartesian3( (maximum.x - minimum.x) / (dimension.x - 1), diff --git a/sample/cesiumWindSeoulSample/wind3D.js b/sample/cesiumWindSeoulSample/wind3D.js index 471c50a..719069c 100644 --- a/sample/cesiumWindSeoulSample/wind3D.js +++ b/sample/cesiumWindSeoulSample/wind3D.js @@ -5,7 +5,7 @@ import { defaultParticleSystemOptions, fileOptions } from "./gui.js"; export class Wind3D { constructor(panel, mode) { - console.log(panel); + // console.log(panel); var options = { // use Sentinel-2 instead of the default Bing Maps because Bing Maps sessions is limited contextOptions: { @@ -53,7 +53,7 @@ export class Wind3D { Cesium.Cartesian3.ZERO, 0.99 * 6378137.0 // 반지름 ); - this.updateViewerParameters(); + // this.updateViewerParameters(); this.imageryLayers = this.viewer.imageryLayers; this.setGlobeLayer(this.panel.getUserInput()); @@ -156,23 +156,23 @@ export class Wind3D { break; } - // case "2401081200": { - // this.viewer.imageryLayers.addImageryProvider( - // await Cesium.createWorldImageryAsync() - // ); - // this.addData(globeLayer.fileName); - - // break; - // } - - // case "2401080000": { - // this.viewer.imageryLayers.addImageryProvider( - // await Cesium.createWorldImageryAsync() - // ); - // this.addData(globeLayer.fileName); - - // break; - // } + case "2401081200": { + this.viewer.imageryLayers.addImageryProvider( + await Cesium.createWorldImageryAsync() + ); + this.addData(globeLayer.fileName); + + break; + } + + case "2401080000": { + this.viewer.imageryLayers.addImageryProvider( + await Cesium.createWorldImageryAsync() + ); + this.addData(globeLayer.fileName); + + break; + } case "2401080600": { this.viewer.imageryLayers.addImageryProvider( await Cesium.createWorldImageryAsync() @@ -191,27 +191,128 @@ export class Wind3D { 7800 ), }), - 3000 + 4000 ); } async setTileset() { const assetsList = [ - 2386135, 2387624, 2387625, 2387627, 2387628, 2387629, 2387632, 2387633, - 2387634, 2387635, 2387639, 2387647, 2387650, 2387651, 2387652, 2387655, - 2387719, 2387720, 2387721, 2387723, 2387724, 2387725, 2387728, 2387735, - 2387737, 2387775, 2387776, 2387777, 2387778, 2387779, 2387780, 2387781, - 2387782, 2387792, 2387794, 2387796, 2387797, 2387798, 2387800, 2387802, - 2387803, 2387804, 2387805, 2387806, 2387855, 2387856, 2387858, - 2387861, 2387862, 2387863, 2387864, 2387865, 2387902, 2387903, 2387905, - 2387906, 2387911, 2387912, 2387913, 2387970, 2387972, 2387974, 2387978, - 2387979, 2387980, 2388059, 2388060, 2388063, 2388064, 2388065, 2388066, - 2388067, 2388068, 2388069, 2388170, 2388171, 2388172, 2388175, 2388176, - 2388177, 2388178, 2388179, 2388180, 2388183, 2388184, 2388185, 2388187, - 2388188, 2388189, 2388191, 2388192, 2388195, 2388197, 2388198, 2388200, - 2388201, 2388204, 2388209, 2388210, 2388211, 2388212, 2388213, 2388214, - 2388215, 2388216, 2388217, 2388218, 2388219, 2388220, 2388221, 2388222, - 2388223, 2388224, 2388225, 2388226, 2388227, + 2386135, + 2387624, + 2387625, + 2387627, + 2387628, + 2387629, + 2387632, + 2387633, + 2387634, + 2387635, + 2387639, + 2387647, + 2387650, + 2387651, + 2387652, + 2387655, + 2387719, + 2387720, + 2387721, + 2387723, + 2387724, + 2387725, + 2387728, + 2387735, + 2387737, + 2387775, + 2387776, + 2387777, + 2387778, + 2387779, + 2387780, + 2387781, + 2387782, + 2387792, + 2387794, + 2387796, + 2387797, + 2387798, + 2387800, + 2387802, + 2387803, + 2387804, + 2387805, + 2387806, + 2387855, + 2387856, + 2387858, + 2387861, + 2387862, + 2387863, + 2387864, + 2387865, + 2387902, + 2387903, + 2387905, + 2387906, + 2387911, + 2387912, + 2387913, + 2387970, + 2387972, + 2387974, + 2387978, + 2387979, + 2387980, + 2388059, + 2388060, + 2388063, + 2388064, + 2388065, + 2388066, + 2388067, + 2388068, + 2388069, + 2388170, + 2388171, + 2388172, + 2388175, + 2388176, + 2388177, + 2388178, + 2388179, + 2388180, + 2388183, + 2388184, + 2388185, + 2388187, + 2388188, + 2388189, + 2388191, + 2388192, + 2388195, + 2388197, + 2388198, + 2388200, + 2388201, + 2388204, + 2388209, + 2388210, + 2388211, + 2388212, + 2388213, + 2388214, + 2388215, + 2388216, + 2388217, + 2388218, + 2388219, + 2388220, + 2388221, + 2388222, + 2388223, + 2388224, + 2388225, + 2388226, + 2388227, 2387852, //고려대학교 지역 ]; @@ -269,6 +370,7 @@ export class Wind3D { return height; } } + // max = 26224244.XXXXXX, tilt 399 , min 151 getMaxNumByHeight(viewHeight) { // y=kx+b k=defaultParticleNum/initHeight @@ -276,23 +378,27 @@ export class Wind3D { if (viewHeight > 20000000) { return Math.ceil(k * viewHeight + 2000); } else if (viewHeight > 15000000) { - return Math.ceil(k * viewHeight + 5000); + return Math.ceil(k * viewHeight + viewHeight / 3000); } else if (viewHeight > 10000000) { - return Math.ceil(k * viewHeight + 7000); + return Math.ceil(k * viewHeight + viewHeight / 1000); } else if (viewHeight > 5000000) { - return Math.ceil(k * viewHeight + 9000); + return Math.ceil(k * viewHeight + viewHeight / 800); } else if (viewHeight > 1000000) { - return Math.ceil(k * viewHeight + 6000); + return Math.ceil(k * viewHeight + viewHeight / 350); } else if (viewHeight > 100000) { - return Math.ceil(k * viewHeight + 3000); + return Math.ceil(k * viewHeight + viewHeight / 250); + } else if (viewHeight > 50000) { + return Math.ceil(k * viewHeight + viewHeight / 150); } else if (viewHeight > 10000) { - return Math.ceil(k * viewHeight + 1000); + return Math.ceil(k * viewHeight + viewHeight / 100); + } else if (viewHeight > 5000) { + return Math.ceil(k * viewHeight + viewHeight / 80); } else if (viewHeight > 1000) { - return Math.ceil(k * viewHeight + 180); + return Math.ceil(k * viewHeight + viewHeight / 25); } else if (viewHeight > 500) { - return Math.ceil(k * viewHeight + 150); + return Math.ceil(k * viewHeight + viewHeight / 8); } else { - return Math.ceil(k * viewHeight + 100); + return Math.ceil(k * viewHeight + viewHeight); } } getLineWidthByHeight(viewHeight) { @@ -311,7 +417,7 @@ export class Wind3D { } else if (viewHeight > 2000) { return 0.6; } else if (viewHeight > 1000) { - return 0.3; + return 0.4; } else if (viewHeight > 100) { return 0.14; } else { @@ -345,7 +451,7 @@ export class Wind3D { } else if (viewHeight > 500) { return 1.0; } else { - return 0.8; + return 0.4; } } @@ -371,8 +477,8 @@ export class Wind3D { that.panel.lineWidth = lineWidth; that.panel.fadeOpacity = fadeOpacity; that.panel.speedFactor = speedFactor; - console.log("当前相机视角高度(单位 m):", viewHeight); - console.log(that.panel.getUserInput()); + console.log("height:", viewHeight); + // console.log(that.panel.getUserInput()); that.particleSystem.applyUserInput(that.panel.getUserInput()); that.updateViewerParameters(); @@ -380,6 +486,10 @@ export class Wind3D { // that.scene.primitives.show = true; // setTimeout(); that.primitivesArray.forEach((primitive) => (primitive.show = true)); + + for (var i in gui.__controllers) { + gui.__controllers[i].updateDisplay(); + } }); var resized = false; @@ -403,6 +513,26 @@ export class Wind3D { that.particleSystem.applyUserInput(that.panel.getUserInput()); }); + window.addEventListener("cameraToRecon", function () { + that.viewer.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees( + 127.0363431764427, + 37.585353994499876, + 7800 + ), + }); + }); + + window.addEventListener("cameraToSeoul", function () { + that.viewer.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees( + 126.991703, + 37.552802, + 57800 + ), + }); + }); + window.addEventListener("layerOptionsChanged", async function () { that.removePrimitives(); that.setGlobeLayer(that.panel.getUserInput());