|
@@ -25,7 +25,7 @@ const Nightscape = {
|
|
|
startNight(isNight) {
|
|
|
let that = this;
|
|
|
scene.globe.show = true;
|
|
|
- viewer.scene.hdrEnabled = isNight;
|
|
|
+ viewer.scene.hdrEnabled = true;
|
|
|
viewer.scene.bloomEffect.show = false;
|
|
|
|
|
|
// 是否开启夜景
|
|
@@ -33,6 +33,7 @@ const Nightscape = {
|
|
|
if (this.dgdsq) {
|
|
|
clearTimeout(this.dgdsq);
|
|
|
}
|
|
|
+
|
|
|
if (scene.layers.find("白天")) scene.layers.find("白天").visible = true;
|
|
|
if (scene.layers.find("夜晚")) scene.layers.find("夜晚").visible = false;
|
|
|
scene.sun.show = true;
|
|
@@ -43,48 +44,35 @@ const Nightscape = {
|
|
|
this.switchLight(true); //白天
|
|
|
this.setHypsometric(false); //夜景材质
|
|
|
viewer.imageryLayers.remove(this.imageLayer);
|
|
|
+ //泛光
|
|
|
+ scene.bloomEffect.show = false;
|
|
|
} else {
|
|
|
scene.sun.show = false;
|
|
|
+
|
|
|
if (scene.layers.find("白天")) scene.layers.find("白天").visible = false;
|
|
|
if (scene.layers.find("夜晚")) scene.layers.find("夜晚").visible = true;
|
|
|
+
|
|
|
+ debugger;
|
|
|
+ // var layer = scene.layers.find("BaoPo@BaoPo0621N");
|
|
|
+ //泛光
|
|
|
+ // scene.bloomEffect.show = true;
|
|
|
+ // scene.bloomEffect.bloomIntensity = 0.5;
|
|
|
+ // scene.bloomEffect.threshold = 0.8;
|
|
|
+ // scene.hdrEnabled = true;
|
|
|
+
|
|
|
+ // var p1 = Cesium.Cartesian3.fromDegrees(109.483493671187, 18.2992501184806, 300);
|
|
|
+ // var p2 = Cesium.Cartesian3.fromDegrees(109.517609654785, 18.3174247770029, 300);
|
|
|
+
|
|
|
+ // var lineLight = new Cesium.DirectionalLight(p1, {
|
|
|
+ // targetPosition: p2,
|
|
|
+ // color: Cesium.Color.WHITE,
|
|
|
+ // intensity: 1
|
|
|
+ // })
|
|
|
+ // scene.addLightSource(lineLight);
|
|
|
// 泛光线底纹
|
|
|
let roadLine1 = Cesium.GeoJsonDataSource.load(
|
|
|
window.NightLightUrl.csfgx.url
|
|
|
);
|
|
|
- debugger
|
|
|
- var layer = scene.layers.find("BaoPo@BaoPo0621N");
|
|
|
-
|
|
|
- // //修改线框
|
|
|
- // layer.style3D.lineWidth = 1.5;
|
|
|
- // layer.style3D.lineColor = new Cesium.Color(0 / 255, 0 / 255, 0 / 255, 1);
|
|
|
- // layer.style3D.fillStyle = Cesium.FillStyle.Fill_And_WireFrame ;
|
|
|
- // layer.wireFrameMode = Cesium.WireFrameType.EffectOutline;
|
|
|
-
|
|
|
- // var customJGD = new Cesium.SpotLight(new Cesium.Cartesian3.fromDegrees(109.51265531383535, 18.311520512333716, 100),
|
|
|
- // new Cesium.Cartesian3.fromDegrees(109.53073971317, 18.3524456120148, 300), {
|
|
|
- // color: new Cesium.Color(0.2, 0.3, 0.3, 1),
|
|
|
- // cutoffDistance: 2000,
|
|
|
- // decay: 0,
|
|
|
- // intensity: 100
|
|
|
- // })
|
|
|
- // customJGD.angle = Math.PI / 100
|
|
|
- // var x = 109.53073971317
|
|
|
- // var y = 18.3524456120148
|
|
|
- // var z = 300
|
|
|
- // var ount = 1
|
|
|
- // setInterval(function () {
|
|
|
- // scene.po
|
|
|
- // var xx = x + ount * 0.003
|
|
|
- // var yy = y + 0.002 * ount
|
|
|
- // if (xx > 109.35600) {
|
|
|
- // xx = x
|
|
|
- // yy = y
|
|
|
- // ount = 1
|
|
|
- // }
|
|
|
- // ount++
|
|
|
- // customJGD.targetPosition = new Cesium.Cartesian3.fromDegrees(xx, yy, 300)
|
|
|
- // }, 1000)
|
|
|
- // scene.addLightSource(customJGD);
|
|
|
roadLine1
|
|
|
.then(function (dataSource) {
|
|
|
viewer.dataSources.add(dataSource);
|
|
@@ -121,7 +109,7 @@ const Nightscape = {
|
|
|
let line = lines_1[i];
|
|
|
line.polyline.material = new Cesium.PolylineGlowMaterialProperty({
|
|
|
//设置Glow材质
|
|
|
- glowPower: window.NightLightUrl.csfgx.glowPower,
|
|
|
+ glowPower: window.NightLightUrl.csfgx.glowPower,
|
|
|
color: new Cesium.Color(
|
|
|
window.NightLightUrl.csfgx.fgdxColor.r,
|
|
|
window.NightLightUrl.csfgx.fgdxColor.g,
|
|
@@ -144,7 +132,7 @@ const Nightscape = {
|
|
|
var SpotLightPos3 = new Cesium.Cartesian3.fromDegrees(
|
|
|
p[0],
|
|
|
p[1],
|
|
|
- p[2] + 20
|
|
|
+ p[2]
|
|
|
);
|
|
|
// var SpotLightPos32 = new Cesium.Cartesian3.fromDegrees(
|
|
|
// p[0],
|
|
@@ -171,41 +159,41 @@ const Nightscape = {
|
|
|
scene.addLightSource(SpotLight33);
|
|
|
});
|
|
|
});
|
|
|
- //小区灯光
|
|
|
- Cesium.loadJson(window.NightLightUrl.residential.url).then((response) => {
|
|
|
- let features = response.features;
|
|
|
- features.forEach((element) => {
|
|
|
- let p = element.geometry.coordinates;
|
|
|
- var SpotLightPos3 = new Cesium.Cartesian3.fromDegrees(
|
|
|
- p[0],
|
|
|
- p[1],
|
|
|
- p[2]+3
|
|
|
- );
|
|
|
- // var SpotLightPos32 = new Cesium.Cartesian3.fromDegrees(
|
|
|
- // p[0],
|
|
|
- // p[1],
|
|
|
- // p[2]
|
|
|
- // );
|
|
|
- var SpotLightOptions3 = {
|
|
|
- cutoffDistance: window.NightLightUrl.yshdg.cutoffDistance,
|
|
|
- color: new Cesium.Color(
|
|
|
- window.NightLightUrl.residential.LightColor.r,
|
|
|
- window.NightLightUrl.residential.LightColor.g,
|
|
|
- window.NightLightUrl.residential.LightColor.b,
|
|
|
- window.NightLightUrl.residential.LightColor.a
|
|
|
- ),
|
|
|
- decay: window.NightLightUrl.residential.decay,
|
|
|
- intensity: window.NightLightUrl.residential.intensity,
|
|
|
- };
|
|
|
+ //小区灯光
|
|
|
+ Cesium.loadJson(window.NightLightUrl.residential.url).then((response) => {
|
|
|
+ let features = response.features;
|
|
|
+ features.forEach((element) => {
|
|
|
+ let p = element.geometry.coordinates;
|
|
|
+ var SpotLightPos3 = new Cesium.Cartesian3.fromDegrees(
|
|
|
+ p[0],
|
|
|
+ p[1],
|
|
|
+ p[2] + 3
|
|
|
+ );
|
|
|
+ // var SpotLightPos32 = new Cesium.Cartesian3.fromDegrees(
|
|
|
+ // p[0],
|
|
|
+ // p[1],
|
|
|
+ // p[2]
|
|
|
+ // );
|
|
|
+ var SpotLightOptions3 = {
|
|
|
+ cutoffDistance: window.NightLightUrl.yshdg.cutoffDistance,
|
|
|
+ color: new Cesium.Color(
|
|
|
+ window.NightLightUrl.residential.LightColor.r,
|
|
|
+ window.NightLightUrl.residential.LightColor.g,
|
|
|
+ window.NightLightUrl.residential.LightColor.b,
|
|
|
+ window.NightLightUrl.residential.LightColor.a
|
|
|
+ ),
|
|
|
+ decay: window.NightLightUrl.residential.decay,
|
|
|
+ intensity: window.NightLightUrl.residential.intensity,
|
|
|
+ };
|
|
|
|
|
|
- let SpotLightresidential = new Cesium.PointLight(
|
|
|
- SpotLightPos3,
|
|
|
- // SpotLightPos32,
|
|
|
- SpotLightOptions3
|
|
|
- );
|
|
|
- scene.addLightSource(SpotLightresidential);
|
|
|
+ let SpotLightresidential = new Cesium.PointLight(
|
|
|
+ SpotLightPos3,
|
|
|
+ // SpotLightPos32,
|
|
|
+ SpotLightOptions3
|
|
|
+ );
|
|
|
+ scene.addLightSource(SpotLightresidential);
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
// 体育场灯光
|
|
|
Cesium.loadJson(window.NightLightUrl.tycdg.url).then((response) => {
|
|
|
let features = response.features;
|
|
@@ -253,12 +241,16 @@ const Nightscape = {
|
|
|
// // 道路灯光
|
|
|
Cesium.loadJson(window.NightLightUrl.dldg.url).then((response) => {
|
|
|
let features = response.features;
|
|
|
- features.forEach((element) => {
|
|
|
+ for (var i = 0; i < features.length; i++) {
|
|
|
+ var element = features[i];
|
|
|
+
|
|
|
+ // if (i % 2 == 0)
|
|
|
+ // continue;
|
|
|
let p = element.geometry.coordinates;
|
|
|
var SpotLightPos3 = new Cesium.Cartesian3.fromDegrees(
|
|
|
p[0],
|
|
|
p[1],
|
|
|
- p[2] + 40
|
|
|
+ p[2] + window.NightLightUrl.dldg.baseHeight
|
|
|
);
|
|
|
var SpotLightOptions3 = {
|
|
|
cutoffDistance: window.NightLightUrl.dldg.cutoffDistance,
|
|
@@ -278,7 +270,22 @@ const Nightscape = {
|
|
|
SpotLightOptions3
|
|
|
);
|
|
|
scene.addLightSource(SpotLight33);
|
|
|
- });
|
|
|
+ debugger;
|
|
|
+ // var SpotLightPos31 = new Cesium.Cartesian3.fromDegrees(p[0],
|
|
|
+ // p[1],
|
|
|
+ // p[2] + 100)
|
|
|
+ // var SpotLightPos32 = new Cesium.Cartesian3.fromDegrees(p[0]-0.0005,
|
|
|
+ // p[1]-0.0005,
|
|
|
+ // p[2])
|
|
|
+ // let SpotLight33 = new Cesium.SpotLight(
|
|
|
+ // SpotLightPos31, SpotLightPos32, {
|
|
|
+ // color: new Cesium.Color(1, 1, 1, 1), //光源颜色
|
|
|
+ // distance: 200, // 光照距离
|
|
|
+ // decay: 0.5, // 衰减大小
|
|
|
+ // intensity: 1 // 光照强度
|
|
|
+ // })
|
|
|
+ // scene.addLightSource(SpotLight33);
|
|
|
+ }
|
|
|
});
|
|
|
// 草坪灯光
|
|
|
Cesium.loadJson(window.NightLightUrl.cpdg.url).then((response) => {
|
|
@@ -311,7 +318,7 @@ const Nightscape = {
|
|
|
scene.addLightSource(SpotLight33);
|
|
|
});
|
|
|
});
|
|
|
-
|
|
|
+ //流动线
|
|
|
this.loadldx();
|
|
|
this.switchLight(false);
|
|
|
scene.skyAtmosphere.show = false;
|
|
@@ -330,50 +337,63 @@ const Nightscape = {
|
|
|
this.dgdsq = setInterval(function () {
|
|
|
//创建分层设色对象 设置最大/最小可见高度 颜色表 显示模式 透明度及线宽
|
|
|
var colorTable = new Cesium.ColorTable();
|
|
|
+ //粉色
|
|
|
if (that.tycindex == 0) {
|
|
|
colorTable.insert(
|
|
|
- 61,
|
|
|
- new Cesium.Color(255 / 255, 255 / 255, 255 / 255)
|
|
|
- );
|
|
|
- colorTable.insert(
|
|
|
- 43,
|
|
|
- new Cesium.Color(255 / 255, 0 / 255, 234 / 255)
|
|
|
- );
|
|
|
- colorTable.insert(30, new Cesium.Color(13 / 255, 255 / 255, 0 / 255));
|
|
|
- } else if (that.tycindex == 1) {
|
|
|
- colorTable.insert(
|
|
|
- 61,
|
|
|
- new Cesium.Color(255 / 255, 255 / 255, 255 / 255)
|
|
|
- );
|
|
|
- colorTable.insert(
|
|
|
- 43,
|
|
|
- new Cesium.Color(255 / 255, 255 / 255, 0 / 255)
|
|
|
+ 58,
|
|
|
+ new Cesium.Color(211 / 255, 28 / 255, 186 / 255)
|
|
|
);
|
|
|
colorTable.insert(
|
|
|
30,
|
|
|
- new Cesium.Color(0 / 255, 232 / 255, 255 / 255)
|
|
|
- );
|
|
|
- } else {
|
|
|
- colorTable.insert(
|
|
|
- 61,
|
|
|
- new Cesium.Color(255 / 255, 255 / 255, 255 / 255)
|
|
|
- );
|
|
|
- colorTable.insert(
|
|
|
- 43,
|
|
|
- new Cesium.Color(95 / 255, 234 / 255, 106 / 255)
|
|
|
- );
|
|
|
- colorTable.insert(
|
|
|
- 30,
|
|
|
- new Cesium.Color(95 / 255, 234 / 255, 106 / 255)
|
|
|
+ new Cesium.Color(211 / 255, 28 / 255, 186 / 255)
|
|
|
);
|
|
|
+ // colorTable.insert(30, new Cesium.Color(13 / 255, 255 / 255, 0 / 255));
|
|
|
+ }
|
|
|
+ //绿色
|
|
|
+ else if (that.tycindex == 1) {
|
|
|
+ //绿色
|
|
|
+ colorTable.insert(58, new Cesium.Color(0 / 255, 104 / 255, 0 / 255));
|
|
|
+ colorTable.insert(30, new Cesium.Color(0 / 255, 104 / 255, 0 / 255));
|
|
|
+ // colorTable.insert(
|
|
|
+ // 30,
|
|
|
+ // new Cesium.Color(0 / 255, 232 / 255, 255 / 255)
|
|
|
+ // );
|
|
|
+ }
|
|
|
+ //蓝色
|
|
|
+ else if (that.tycindex == 2) {
|
|
|
+ colorTable.insert(58, new Cesium.Color(3 / 255, 3 / 255, 188 / 255));
|
|
|
+ colorTable.insert(30, new Cesium.Color(3 / 255, 3 / 255, 188 / 255));
|
|
|
+ // colorTable.insert(
|
|
|
+ // 30,
|
|
|
+ // new Cesium.Color(95 / 255, 234 / 255, 106 / 255)
|
|
|
+ // );
|
|
|
}
|
|
|
+ // 紫色
|
|
|
+ else if (that.tycindex == 3) {
|
|
|
+ colorTable.insert(58, new Cesium.Color(184 / 255, 5 / 255, 18 / 255));
|
|
|
+ colorTable.insert(30, new Cesium.Color(184 / 255, 5 / 255, 18 / 255));
|
|
|
+ // colorTable.insert(
|
|
|
+ // 30,
|
|
|
+ // new Cesium.Color(95 / 255, 234 / 255, 106 / 255)
|
|
|
+ // );
|
|
|
+ }
|
|
|
+ //金色
|
|
|
+ else {
|
|
|
+ colorTable.insert(58, new Cesium.Color(86 / 255, 66 / 255, 0 / 255));
|
|
|
+ colorTable.insert(30, new Cesium.Color(115 / 255, 94 / 255, 0 / 255));
|
|
|
+ // colorTable.insert(
|
|
|
+ // 30,
|
|
|
+ // new Cesium.Color(95 / 255, 234 / 255, 106 / 255)
|
|
|
+ // );
|
|
|
+ }
|
|
|
+
|
|
|
var layer = scene.layers.find("TYCB@BaoPo0621N");
|
|
|
var hyp = new Cesium.HypsometricSetting();
|
|
|
- hyp.MaxVisibleValue = 61;
|
|
|
- hyp.MinVisibleValue = 30;
|
|
|
+ hyp.MaxVisibleValue = 58;
|
|
|
+ hyp.MinVisibleValue = 26.8;
|
|
|
hyp.ColorTable = colorTable;
|
|
|
- hyp.DisplayMode = Cesium.HypsometricSettingEnum.DisplayMode.FACE;
|
|
|
- hyp.Opacity = 0.5;
|
|
|
+ hyp.DisplayMode = Cesium.HypsometricSettingEnum.DisplayMode.NEAREST;
|
|
|
+ hyp.Opacity = 0.75;
|
|
|
hyp.LineInterval = 1.0;
|
|
|
//设置图层分层设色属性
|
|
|
layer.hypsometricSetting = {
|
|
@@ -381,12 +401,36 @@ const Nightscape = {
|
|
|
// CoverageArea: ps,
|
|
|
analysisMode:
|
|
|
Cesium.HypsometricSettingEnum.AnalysisRegionMode.ARM_ALL,
|
|
|
+ // DisplayMode:Cesium.HypsometricSettingEnum.DisplayMode.FACE_AND_LINE
|
|
|
};
|
|
|
that.tycindex += 1;
|
|
|
- if (that.tycindex >= 3) {
|
|
|
+ if (that.tycindex > 4) {
|
|
|
that.tycindex = 0;
|
|
|
}
|
|
|
- }, 1000 * 2);
|
|
|
+ }, 1000 * 5);
|
|
|
+
|
|
|
+ // //模型图层泛光
|
|
|
+ var layerP = scene.layers.find("BaoPo@BaoPo0621N");
|
|
|
+ // layerP.bloomEffect.enable =true
|
|
|
+ // layerP.bloomEffect.speed =3
|
|
|
+ // layerP.bloomEffect.period =5
|
|
|
+ // layerP.bloomEffect.maxBloomHeight =8
|
|
|
+ // layerP.partlyTransparent =true
|
|
|
+ layerP.hasLight = true;
|
|
|
+ layerP.bloomEffect.enable = true;
|
|
|
+ layerP.bloomEffect.maxBloomHeight = 1.2;
|
|
|
+ layerP.bloomEffect.period = 2;
|
|
|
+ layerP.bloomEffect.speed = 50;
|
|
|
+ // // layerP.hasWireframe =true;
|
|
|
+ // layerP.style3D.lineWidth = 1.5;
|
|
|
+ // layerP.style3D.lineColor = new Cesium.Color(0 / 255, 255 / 255, 0 / 255, 1);
|
|
|
+ // layerP.style3D.fillStyle = Cesium.FillStyle.Fill_And_WireFrame ;
|
|
|
+ // layerP.wireFrameMode = Cesium.WireFrameType.EffectOutline;
|
|
|
+ // // layerP. wireFrameMode =Cesium.WireFrameType.Quad
|
|
|
+ // // var s3mpolylineEffect = layerP.effect;
|
|
|
+ // // var EffectSetting = s3mpolylineEffect.getEffectSetting();
|
|
|
+ // // s3mpolylineEffect.setValue('PolylineType', 0);
|
|
|
+ // // s3mpolylineEffect.setValue('Width', 5);
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -394,15 +438,10 @@ const Nightscape = {
|
|
|
switchLight(isDayLight) {
|
|
|
if (isDayLight) {
|
|
|
//设置环境光(白天)
|
|
|
- scene.lightSource.ambientLightColor = new Cesium.Color(
|
|
|
- 0.65,
|
|
|
- 0.65,
|
|
|
- 0.65,
|
|
|
- 1
|
|
|
- );
|
|
|
+ scene.lightSource.ambientLightColor = new Cesium.Color(0.1, 0.1, 0.1, 1);
|
|
|
} else {
|
|
|
//设置环境光(夜晚)
|
|
|
- // scene.lightSource.ambientLightColor = new Cesium.Color(0.3, 0.3, 0.3, 1);
|
|
|
+ // scene.lightSource.ambientLightColor = new Cesium.Color(34/255, 34/255, 34/255,0.5);
|
|
|
// 添加光源
|
|
|
|
|
|
// this.addLightSource({
|
|
@@ -478,18 +517,18 @@ const Nightscape = {
|
|
|
// gyIntensity: 2,
|
|
|
// });
|
|
|
//操场光源
|
|
|
- this.addLightSource({
|
|
|
- gyType: "点光源",
|
|
|
- cartesian: new Cesium.Cartesian3.fromDegrees(
|
|
|
- 109.51144104226398,
|
|
|
- 18.311654492261003,
|
|
|
- 24.172257598338254
|
|
|
- ),
|
|
|
- gyDecay: 2,
|
|
|
- gyDistance: 200,
|
|
|
- gyColor: "rgba(255,255,255,1)",
|
|
|
- gyIntensity: 2,
|
|
|
- });
|
|
|
+ // this.addLightSource({
|
|
|
+ // gyType: "点光源",
|
|
|
+ // cartesian: new Cesium.Cartesian3.fromDegrees(
|
|
|
+ // 109.51144104226398,
|
|
|
+ // 18.311654492261003,
|
|
|
+ // 24.172257598338254
|
|
|
+ // ),
|
|
|
+ // gyDecay: 2,
|
|
|
+ // gyDistance: 200,
|
|
|
+ // gyColor: "rgba(255,255,255,1)",
|
|
|
+ // gyIntensity: 2,
|
|
|
+ // });
|
|
|
|
|
|
// 新增直射光1--西南侧光
|
|
|
var position = new Cesium.Cartesian3.fromDegrees(
|
|
@@ -655,12 +694,12 @@ const Nightscape = {
|
|
|
*/
|
|
|
loadldx() {
|
|
|
let that = this;
|
|
|
- //道路中线流动
|
|
|
+ //道路中线流动
|
|
|
Cesium.loadJson(window.NightLightUrl.dlzxx.url).then((jsonData) => {
|
|
|
debugger;
|
|
|
jsonData.features.forEach((route) => {
|
|
|
let list = route.geometry.coordinates.flat(Infinity);
|
|
|
-
|
|
|
+
|
|
|
let dl = viewer.entities.add({
|
|
|
// 用于打底的线
|
|
|
polyline: {
|
|
@@ -703,11 +742,11 @@ const Nightscape = {
|
|
|
});
|
|
|
});
|
|
|
//楼顶流动线
|
|
|
- var liness=[]
|
|
|
-
|
|
|
+ var liness = [];
|
|
|
+
|
|
|
Cesium.loadJson(window.NightLightUrl.buildTopLine.url).then((jsonData) => {
|
|
|
debugger;
|
|
|
- liness=jsonData
|
|
|
+ liness = jsonData;
|
|
|
jsonData.features.forEach((route) => {
|
|
|
let list = route.geometry.coordinates.flat(Infinity);
|
|
|
let topLine = viewer.entities.add({
|
|
@@ -737,8 +776,6 @@ const Nightscape = {
|
|
|
this.buildTopLines.push(topLine);
|
|
|
});
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
// changlineColor(){},
|
|
|
|