From 5554abba41acebfcefd0c6eccd51d0f229b2f43d Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期四, 30 九月 2021 11:29:03 +0800
Subject: [PATCH] add refresh widget function
---
js/function.js | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/js/function.js b/js/function.js
index b2d5b02..159f0c4 100644
--- a/js/function.js
+++ b/js/function.js
@@ -41,14 +41,13 @@
(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 = { geoserver_url_predix: 'http://58.246.27.194:7011/', nodejs_url_predix: 'http://58.246.27.194:7012/', userid: 2, queryDataType: 'hour',weathercitycode:'101020100',wind360:0,windSpeed:10 }
mars3d.global_variables.queryDataTStart = getDefaultDateTime();
mars3d.global_variables.queryDataTStartGeo = getDefaultDateTimeGeo();
mars3d.global_variables.queryDataTEnd = getDefaultDateTimeEnd();
// for tmp hight light graphic and
//mars3d.global_variables.tmpHighlightGraphic;
//mars3d.global_variables.tmpHighlightGraphicLayer;
-
function initLayersByUserid() {
@@ -88,7 +87,6 @@
layer.options.parameters.viewparams = "userid:" + mars3d.global_variables.userid + ";datatime:" + mars3d.global_variables.queryDataTStartGeo;
layer.reload();
} else if ([layer.id] == 1001) {
-
var tmpguokong = map.getLayerById(1001);
tmpguokong.clear(true);
getGuokongPointFromServer(tmpguokong);
@@ -108,6 +106,23 @@
function refreshWidgets() {
+ refreshSingleWidget("widgetsTS/weather/widget.js",{});
+
+}
+
+function refreshSingleWidget(widget_path,params){
+
+ if (mars3d.widget.isActivate(widget_path)) {
+ var tempWiget = mars3d.widget.getClass(widget_path);
+ tempWiget.reloadData();
+ } else {
+ var tempWiget =mars3d.widget.activate({
+ uri: widget_path,
+ params: params,
+ });
+ tempWiget.reloadData();
+ }
+
}
function addGraphictoHighlightLayer() {
mars3d.global_variables.tmpHighlightGraphicLayer.addGraphic(mars3d.global_variables.tmpHighlightGraphic);
--
Gitblit v1.9.1