From 5ba92069f66278baf9d019f02c361e1817291ee4 Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期日, 26 九月 2021 14:41:45 +0800
Subject: [PATCH] add geoserver time format
---
js/function.js | 61 ++++++++++++++++++++++++++++--
widgetsTS/dataTime/widget.js | 15 ++++++-
2 files changed, 69 insertions(+), 7 deletions(-)
diff --git a/js/function.js b/js/function.js
index 1a72de7..807054a 100644
--- a/js/function.js
+++ b/js/function.js
@@ -13,8 +13,22 @@
(day > 9 ? day : ("0" + day)) + " " +
(hours > 9 ? hours : ("0" + hours)) + ":00:00";
}
+function getDefaultDateTimeGeo() {
+ var date = new Date;
+ date.setHours(date.getHours() - 2);
+ var year = date.getFullYear();//骞�
+ var month = date.getMonth();//鏈�
+ var day = date.getDate();//鏃�
+ var hours = date.getHours();//鏃�
+ return year +
+ ((month + 1) > 9 ? (month + 1) : "0" + (month + 1)) +
+ (day > 9 ? day : ("0" + day)) +
+ (hours > 9 ? hours : ("0" + hours)) + "0000";
+}
mars3d.global_variables = { geoserver_url_predix: 'http://58.246.27.194:7011/', nodejs_url_predix: 'http://58.246.27.194:7012/', userid: 2, queryDataType: 'hour' };
mars3d.global_variables.queryDataTStart = getDefaultDateTime();
+mars3d.global_variables.queryDataTStartGeo = getDefaultDateTimeGeo();
+
mars3d.global_variables.queryDataTEnd = getDefaultDateTime();
@@ -23,6 +37,7 @@
//addMaskShanghai();
addTDTAnnoLayer();
+ //TODO
$.getJSON("data/getLayerListByUserid.json", { userid: mars3d.global_variables.userid }, (result) => {
result.data.forEach((item) => {
if ([item['type']] == 'wms') {
@@ -54,7 +69,7 @@
"styles": item.style_prefix + item.styleoptions[0],
"transparent": "true",
"format": "image/png",
- "viewparams": "userid:" + mars3d.global_variables.userid + ";datatime:" + mars3d.global_variables.queryDataTStart
+ "viewparams": "userid:" + mars3d.global_variables.userid + ";datatime:" + mars3d.global_variables.queryDataTStartGeo
},
center: { "lat": 30.487351, "lng": 121.613269, "alt": 54033, "heading": 359, "pitch": -40 },
noCenter: true,
@@ -145,6 +160,40 @@
"<br /><br /><p><a href='#' onclick='javascript:showDetail(1001,\"" + item["SiteName"] + "\")' >璇︾粏淇℃伅</a></p>";
return html;
});
+
+ guokongLayer.reloadGuokongDian = function (){
+ guokongLayer.removeALL // 绫讳技
+ $.getJSON("http://58.246.27.194:7012/dataapi/Bdata?bid=get_1001_list_hour&datatime=2021-09-06%2012:00:00&qindex=pm25", (result) => {
+ var pointColorArr = ["#f33349", "#fff000", "#33347f"];
+ for (var i = 0, len = result.data.result.length; i < len; i++) {
+ var item = result.data.result[i];
+ var jd = result.data.result[i].Longitude;
+ var wd = result.data.result[i].Latitude;
+ var clr = pointColorArr[i % pointColorArr.length];
+ var graphic = new mars3d.graphic.DivLightPoint({
+ position: Cesium.Cartesian3.fromDegrees(jd, wd),
+ style: {
+ color: clr,
+ heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
+ highlight: {
+ type: "divLightPoint",
+ diffHeight: 600,
+ material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.CircleWave, {
+ color: "#ffff00",
+ count: 3,
+ speed: 20,
+ }),
+ },
+ distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 200000), //鎸夎璺濊窛绂绘樉绀�
+ },
+ show: true,
+ attr: item,
+ });
+ guokongLayer.addGraphic(graphic);
+ }
+ });
+
+ };
// add 鍥芥帶鐐�
$.getJSON("http://58.246.27.194:7012/dataapi/Bdata?bid=get_1001_list_hour&datatime=2021-09-06%2012:00:00&qindex=pm25", (result) => {
var pointColorArr = ["#f33349", "#fff000", "#33347f"];
@@ -176,8 +225,9 @@
}
});
-
}
+
+
function addWindLayer(item) {
$.getJSON("data/getWindParametersByTime.json", { datatype: mars3d.global_variables.queryDataType, datatime: mars3d.global_variables.queryDataTStart }, (result) => {
@@ -374,6 +424,8 @@
});
}
+
+
function reLoadLayers() {
var layers = map.getLayers({ layers: true });
@@ -382,12 +434,11 @@
console.log(layer.name+":"+layer.type);
if ([layer.type] == 'wms') {
-
layer.options.layers = "konglu_58:" + layer.options.geoname_prefix + mars3d.global_variables.queryDataType;
- layer.options.parameters.viewparams = "userid:" + mars3d.global_variables.userid + ";datatime:" + mars3d.global_variables.queryDataTStart;
+ layer.options.parameters.viewparams = "userid:" + mars3d.global_variables.userid + ";datatime:" + mars3d.global_variables.queryDataTStartGeo;
layer.reload();
-
}
+
});
}
diff --git a/widgetsTS/dataTime/widget.js b/widgetsTS/dataTime/widget.js
index 7487f84..5e94605 100644
--- a/widgetsTS/dataTime/widget.js
+++ b/widgetsTS/dataTime/widget.js
@@ -95,7 +95,12 @@
todayHighlight: 1 //濡傛灉涓簍rue, 楂樹寒褰撳墠鏃ユ湡
}).on("changeDate", function () {
- mars3d.global_variables.queryDataTStart = $('#appDate').val() + " 00:00:00";
+ var tmpDatetime = $('#appDate').val() + " 00:00:00";
+ tmpDatetime.replace('-','');
+ tmpDatetime.replace(' ','');
+ tmpDatetime.replace(':','');
+
+ mars3d.global_variables.queryDataTStartGeo = tmpDatetime;
reLoadLayers();
refreshWidgets();
@@ -118,7 +123,13 @@
todayHighlight: 1 //濡傛灉涓簍rue, 楂樹寒褰撳墠鏃ユ湡
}).on("changeDate", function () {
- mars3d.global_variables.queryDataTStart = $('#appDateHour').val();
+ var tmpDatetime = $('#appDateHour').val();
+ tmpDatetime.replace('-','');
+ tmpDatetime.replace(' ','');
+ tmpDatetime.replace(':','');
+
+
+ mars3d.global_variables.queryDataTStartGeo = tmpDatetime;
reLoadLayers();
refreshWidgets();
--
Gitblit v1.9.1