egovamap 0.12.0 → 0.12.4
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/egovamap/egovaBI.js +128 -73
- package/egovamap/egovagis.js +5 -1
- package/egovamap/egovagisviewer.js +9 -6
- package/egovamap/egovaglobe.js +2 -0
- package/egovamap/egovamap.js +5 -5
- package/package.json +1 -1
package/egovamap/egovaBI.js
CHANGED
|
@@ -7,6 +7,21 @@ var egovaBI = function(globeMap, gisMap, mapType){
|
|
|
7
7
|
return b;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
function getImgSize(url) {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
let img = new Image();
|
|
13
|
+
img.onload = function() {
|
|
14
|
+
resolve({ width: img.width, height: img.height });
|
|
15
|
+
img = null;
|
|
16
|
+
};
|
|
17
|
+
img.onerror = function() {
|
|
18
|
+
resolve({ width: 0, height: 0 });
|
|
19
|
+
img = null;
|
|
20
|
+
};
|
|
21
|
+
img.src = url;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
10
25
|
function interpolateColor(start, end, count) {
|
|
11
26
|
if (count < 2) return [start, end];
|
|
12
27
|
var r = end[0] - start[0];
|
|
@@ -54,52 +69,19 @@ var egovaBI = function(globeMap, gisMap, mapType){
|
|
|
54
69
|
})
|
|
55
70
|
}
|
|
56
71
|
|
|
57
|
-
function deal2DPoints(layerName, positions, options){
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
style: options.clusterStyle.symbolUrl ? {
|
|
71
|
-
type: "picture-marker",
|
|
72
|
-
url: options.clusterStyle.symbolUrl,
|
|
73
|
-
width: options.clusterStyle.clusterSymbolWidth + "px",
|
|
74
|
-
height: options.clusterStyle.clusterSymbolHeight + "px"
|
|
75
|
-
} : {
|
|
76
|
-
"type": "simple-marker",
|
|
77
|
-
"style": "circle",
|
|
78
|
-
"color": [255, 168, 0, 200],
|
|
79
|
-
"size": 25,
|
|
80
|
-
"outline": { //if outline has been specified
|
|
81
|
-
"color": [255, 168, 0, 200],
|
|
82
|
-
"width": 2
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
labelStyle:{
|
|
86
|
-
type:"text",
|
|
87
|
-
color: options.clusterStyle.fillColor,
|
|
88
|
-
text:"",
|
|
89
|
-
xoffset:options.clusterStyle.textStartX + "px",
|
|
90
|
-
yoffset:options.clusterStyle.textStartY + "px",
|
|
91
|
-
font:{
|
|
92
|
-
size: options.clusterStyle.fontSize + "px",
|
|
93
|
-
weight: options.clusterStyle.fontWeight || "normal",
|
|
94
|
-
family: options.clusterStyle.family || "microsoft-yahei"
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
var hasHover = null;
|
|
101
|
-
var callback = null;
|
|
102
|
-
datalist = positions.map(function(p){
|
|
72
|
+
function deal2DPoints(layerName, positions, options) {
|
|
73
|
+
let datalist = [];
|
|
74
|
+
let zoom = options.common.zoom;
|
|
75
|
+
let clear = options.common.clear;
|
|
76
|
+
let highLightType = -1;
|
|
77
|
+
let infoStyle = null;
|
|
78
|
+
let renderCanvas = null;
|
|
79
|
+
let tagName = layerName;
|
|
80
|
+
let clusterOption = null;
|
|
81
|
+
|
|
82
|
+
let hasHover = null;
|
|
83
|
+
let callback = null;
|
|
84
|
+
datalist = positions.map(function(p) {
|
|
103
85
|
p.minZoom = options.common.beginLevel;
|
|
104
86
|
p.maxZoom = options.common.endLevel;
|
|
105
87
|
p.symbolType = -1;
|
|
@@ -107,41 +89,98 @@ var egovaBI = function(globeMap, gisMap, mapType){
|
|
|
107
89
|
p.scale = options.textStyle.scale;
|
|
108
90
|
p.angle = options.textStyle.angle;
|
|
109
91
|
//textValue
|
|
110
|
-
if(options.textStyle.enableText){
|
|
92
|
+
if (options.textStyle.enableText) {
|
|
111
93
|
p.labelStyle = {
|
|
112
|
-
type:"text",
|
|
113
|
-
xoffset:options.textStyle.xoffset + "px",
|
|
114
|
-
yoffset:options.textStyle.yoffset + "px",
|
|
115
|
-
text:p.textValue,
|
|
116
|
-
color:options.textStyle.fillColor,
|
|
117
|
-
font:{
|
|
94
|
+
type: "text",
|
|
95
|
+
xoffset: options.textStyle.xoffset + "px",
|
|
96
|
+
yoffset: options.textStyle.yoffset + "px",
|
|
97
|
+
text: p.textValue,
|
|
98
|
+
color: options.textStyle.fillColor,
|
|
99
|
+
font: {
|
|
118
100
|
size: options.textStyle.fontSize + "px",
|
|
119
101
|
weight: options.textStyle.fontWeight,
|
|
120
102
|
family: options.textStyle.family || "microsoft-yahei"
|
|
121
103
|
}
|
|
122
|
-
}
|
|
104
|
+
};
|
|
123
105
|
}
|
|
124
106
|
p.useLabelBg = options.textStyle.textBackground;
|
|
125
|
-
if(p.useLabelBg){
|
|
107
|
+
if (p.useLabelBg) {
|
|
126
108
|
p.labelBgStyle = {
|
|
127
|
-
type:
|
|
128
|
-
url:
|
|
129
|
-
}
|
|
109
|
+
type: "picture-marker",
|
|
110
|
+
url: options.textStyle.textBackgroundUrl
|
|
111
|
+
};
|
|
130
112
|
}
|
|
131
113
|
return p;
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
return new Promise((resolve, reject) => {
|
|
117
|
+
try {
|
|
118
|
+
let args = {
|
|
119
|
+
datalist: datalist,
|
|
120
|
+
zoom: zoom,
|
|
121
|
+
clear: clear,
|
|
122
|
+
highLightType: highLightType,
|
|
123
|
+
infoStyle: infoStyle,
|
|
124
|
+
renderCanvas: renderCanvas,
|
|
125
|
+
tagName: tagName,
|
|
126
|
+
clusterOption: null,
|
|
127
|
+
hasHover: hasHover,
|
|
128
|
+
callback: callback
|
|
129
|
+
};
|
|
130
|
+
if (options.clusterStyle.clusterEnabled) {
|
|
131
|
+
clusterOption = {
|
|
132
|
+
clusterType: 1,
|
|
133
|
+
distance: options.clusterStyle.clusterDistance,
|
|
134
|
+
style: null,
|
|
135
|
+
labelStyle: {
|
|
136
|
+
type: "text",
|
|
137
|
+
color: options.clusterStyle.fillColor,
|
|
138
|
+
text: "",
|
|
139
|
+
xoffset: options.clusterStyle.textStartX + "px",
|
|
140
|
+
yoffset: options.clusterStyle.textStartY + "px",
|
|
141
|
+
font: {
|
|
142
|
+
size: options.clusterStyle.fontSize + "px",
|
|
143
|
+
weight: options.clusterStyle.fontWeight || "normal",
|
|
144
|
+
family: options.clusterStyle.family || "microsoft-yahei"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
let useCustomClusterStyle = options.clusterStyle.symbolUrl && options.clusterStyle.useCustomStyle;
|
|
150
|
+
let clusterStyle = {
|
|
151
|
+
type: "simple-marker",
|
|
152
|
+
style: "circle",
|
|
153
|
+
color: [255, 168, 0, 200],
|
|
154
|
+
size: 25 * options.clusterStyle.scale + "px",
|
|
155
|
+
outline: {
|
|
156
|
+
color: [255, 168, 0, 200],
|
|
157
|
+
width: 2
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
clusterOption.style = clusterStyle;
|
|
161
|
+
if (useCustomClusterStyle) {
|
|
162
|
+
getImgSize(options.clusterStyle.symbolUrl).then(szie => {
|
|
163
|
+
clusterStyle = {
|
|
164
|
+
type: "picture-marker",
|
|
165
|
+
url: options.clusterStyle.symbolUrl,
|
|
166
|
+
width: szie.width * options.clusterStyle.scale + "px",
|
|
167
|
+
height: szie.height * options.clusterStyle.scale + "px"
|
|
168
|
+
};
|
|
169
|
+
clusterOption.style = clusterStyle;
|
|
170
|
+
args.clusterOption = clusterOption;
|
|
171
|
+
resolve(args);
|
|
172
|
+
});
|
|
173
|
+
} else {
|
|
174
|
+
args.clusterOption = clusterOption;
|
|
175
|
+
resolve(args);
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
resolve(args);
|
|
179
|
+
}
|
|
180
|
+
} catch (err) {
|
|
181
|
+
reject(err);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
145
184
|
}
|
|
146
185
|
|
|
147
186
|
/*
|
|
@@ -231,8 +270,24 @@ var egovaBI = function(globeMap, gisMap, mapType){
|
|
|
231
270
|
globeMap.drawPoints(layerName, positions, options);
|
|
232
271
|
}
|
|
233
272
|
if(gisMap && mapType == "map"){
|
|
234
|
-
|
|
235
|
-
|
|
273
|
+
deal2DPoints(layerName, positions, options).then(args => {
|
|
274
|
+
gisMap.showMultiObjectCurrentPosition(
|
|
275
|
+
args.datalist,
|
|
276
|
+
args.zoom,
|
|
277
|
+
args.clear,
|
|
278
|
+
args.highLightType,
|
|
279
|
+
args.infoStyle,
|
|
280
|
+
args.renderCanvas,
|
|
281
|
+
options.clickCallback,
|
|
282
|
+
args.tagName,
|
|
283
|
+
args.clusterOption,
|
|
284
|
+
args.hasHover,
|
|
285
|
+
options.mouseOverCallback,
|
|
286
|
+
options.mouseOutCallback,
|
|
287
|
+
layerName,
|
|
288
|
+
options.option
|
|
289
|
+
);
|
|
290
|
+
});
|
|
236
291
|
}
|
|
237
292
|
}
|
|
238
293
|
/*
|
package/egovamap/egovagis.js
CHANGED
|
@@ -16,6 +16,8 @@ function setCookie(name,value){
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function checkGisServerURL(url,callback){
|
|
19
|
+
if(!url) return;
|
|
20
|
+
|
|
19
21
|
var cookieUrl = getCookie("gisUrl");
|
|
20
22
|
var gisProxyList = url.split(";");
|
|
21
23
|
cookieUrl&&gisProxyList.push(cookieUrl);
|
|
@@ -1077,12 +1079,14 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig,con
|
|
|
1077
1079
|
}
|
|
1078
1080
|
|
|
1079
1081
|
/**查询表信息*/
|
|
1080
|
-
that.queryObjectInfo = function (geoShapes, tableName, xFieldName, yFieldName, callback, usePage, currentPage, numPerPage) {
|
|
1082
|
+
that.queryObjectInfo = function (geoShapes, tableName, xFieldName, yFieldName, callback, usePage, currentPage, numPerPage, params) {
|
|
1081
1083
|
var queryParam = {
|
|
1082
1084
|
'tableName': tableName,
|
|
1083
1085
|
'xFieldName': xFieldName,
|
|
1084
1086
|
'yFieldName': yFieldName
|
|
1085
1087
|
};
|
|
1088
|
+
if(params) queryParam = MapUtils.deepClones(true, {}, queryParam, params);
|
|
1089
|
+
|
|
1086
1090
|
that.removeEventBind("queryObjectInfoCallback");
|
|
1087
1091
|
that.bindEvent("queryObjectInfoCallback", callback);
|
|
1088
1092
|
scene.fire(msgPrefix + ':queryObjectInfo', {args: [JSON.stringify(geoShapes), JSON.stringify(queryParam), usePage, currentPage, numPerPage]}, parentScene, false);
|
|
@@ -18,6 +18,8 @@ function setCookie(name, value) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function checkGisServerURL(url, callback) {
|
|
21
|
+
if(!url) return;
|
|
22
|
+
|
|
21
23
|
var cookieUrl = getCookie("gisUrl");
|
|
22
24
|
var gisProxyList = url.split(";");
|
|
23
25
|
cookieUrl && gisProxyList.push(cookieUrl);
|
|
@@ -57,7 +59,6 @@ function checkGISProxy(proxyUrl, params, callback) {
|
|
|
57
59
|
img.onload = function (e1) {
|
|
58
60
|
if (!params.isLoad) {
|
|
59
61
|
params.isLoad = true;
|
|
60
|
-
context.gisServerURL = proxyUrl;
|
|
61
62
|
setCookie("gisUrl", proxyUrl);
|
|
62
63
|
callback(proxyUrl);
|
|
63
64
|
}
|
|
@@ -830,7 +831,7 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
|
|
|
830
831
|
}
|
|
831
832
|
|
|
832
833
|
/* 初始化实时案件分布 */
|
|
833
|
-
that.initRecCurrentV2Distribution = function (infoJson, colors, layerName, clickCallback) {
|
|
834
|
+
that.initRecCurrentV2Distribution = function (infoJson, colors, layerName, clickCallback, sizeScale) {
|
|
834
835
|
if (scene == null || infoJson.length == 0)
|
|
835
836
|
return;
|
|
836
837
|
var cb = function (type, data) {
|
|
@@ -838,7 +839,7 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
|
|
|
838
839
|
clickCallback(data);
|
|
839
840
|
}
|
|
840
841
|
};
|
|
841
|
-
that.callMap('initRecCurrentV2Distribution', infoJson, colors, layerName, cb);
|
|
842
|
+
that.callMap('initRecCurrentV2Distribution', infoJson, colors, layerName, cb, sizeScale);
|
|
842
843
|
}
|
|
843
844
|
/* 显示实时案件分布 */
|
|
844
845
|
that.showRecCurrentV2Distribution = function (infoJson, zoom, highLight) {
|
|
@@ -856,7 +857,7 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
|
|
|
856
857
|
}
|
|
857
858
|
|
|
858
859
|
/* 显示多个自定义图标 */
|
|
859
|
-
that.showMultiObjectCurrentPosition = function (jsonInfo, zoom, bClear, hStyleID, infoStyle, bCanvas, clickCallback, tagName, clusterOption, hasHover, mouseOverCallback, mouseOutCallback) {
|
|
860
|
+
that.showMultiObjectCurrentPosition = function (jsonInfo, zoom, bClear, hStyleID, infoStyle, bCanvas, clickCallback, tagName, clusterOption, hasHover, mouseOverCallback, mouseOutCallback, layerName, options) {
|
|
860
861
|
if (scene == null)
|
|
861
862
|
return;
|
|
862
863
|
|
|
@@ -871,7 +872,7 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
|
|
|
871
872
|
that.fireCallback(type, data);
|
|
872
873
|
}
|
|
873
874
|
};
|
|
874
|
-
that.callMap('showMultiObjectCurrentPosition', jsonInfo, zoom, bClear, hStyleID, infoStyle, bCanvas, tagName, clusterOption, hasHover, cb);
|
|
875
|
+
that.callMap('showMultiObjectCurrentPosition', jsonInfo, zoom, bClear, hStyleID, infoStyle, bCanvas, tagName, clusterOption, hasHover, cb, layerName, options);
|
|
875
876
|
}
|
|
876
877
|
|
|
877
878
|
/* 高亮显示自定义图标 */
|
|
@@ -1560,12 +1561,14 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
|
|
|
1560
1561
|
}
|
|
1561
1562
|
|
|
1562
1563
|
/**查询表信息*/
|
|
1563
|
-
that.queryObjectInfo = function (geoShapes, tableName, xFieldName, yFieldName, callback, usePage, currentPage, numPerPage) {
|
|
1564
|
+
that.queryObjectInfo = function (geoShapes, tableName, xFieldName, yFieldName, callback, usePage, currentPage, numPerPage, params) {
|
|
1564
1565
|
var queryParam = {
|
|
1565
1566
|
'tableName': tableName,
|
|
1566
1567
|
'xFieldName': xFieldName,
|
|
1567
1568
|
'yFieldName': yFieldName
|
|
1568
1569
|
};
|
|
1570
|
+
if(params) queryParam = MapUtils.deepClones(true, {}, queryParam, params);
|
|
1571
|
+
|
|
1569
1572
|
var cb = function (type, data) {
|
|
1570
1573
|
if (callback && type == 'queryObjectInfoCallback') {
|
|
1571
1574
|
callback(data);
|
package/egovamap/egovaglobe.js
CHANGED
package/egovamap/egovamap.js
CHANGED
|
@@ -671,7 +671,7 @@ var EGovaMap = function (containerID, callback, mapConfig, mapType, mapParam, co
|
|
|
671
671
|
if (globeMap != null) {
|
|
672
672
|
globeMap.showLayer(name);
|
|
673
673
|
}
|
|
674
|
-
if (gisMap != null) {
|
|
674
|
+
if (gisMap != null && gisMap.setLayerVisible) {
|
|
675
675
|
var args = [arguments[0], true];
|
|
676
676
|
gisMap.setLayerVisible.apply(this, args);
|
|
677
677
|
}
|
|
@@ -686,7 +686,7 @@ var EGovaMap = function (containerID, callback, mapConfig, mapType, mapParam, co
|
|
|
686
686
|
if (globeMap != null) {
|
|
687
687
|
globeMap.hideLayer(name);
|
|
688
688
|
}
|
|
689
|
-
if (gisMap != null) {
|
|
689
|
+
if (gisMap != null && gisMap.setLayerVisible) {
|
|
690
690
|
var args = [arguments[0], false];
|
|
691
691
|
gisMap.setLayerVisible.apply(this, args);
|
|
692
692
|
}
|
|
@@ -2281,7 +2281,7 @@ var EGovaMap = function (containerID, callback, mapConfig, mapType, mapParam, co
|
|
|
2281
2281
|
}
|
|
2282
2282
|
}
|
|
2283
2283
|
|
|
2284
|
-
that.queryObjectInfo = function (geoShapes, tableName, xFieldName, yFieldName, callback, usePage, currentPage, numPerPage) {
|
|
2284
|
+
that.queryObjectInfo = function (geoShapes, tableName, xFieldName, yFieldName, callback, usePage, currentPage, numPerPage, params) {
|
|
2285
2285
|
if (!scene)
|
|
2286
2286
|
return;
|
|
2287
2287
|
if (gisMap)
|
|
@@ -3603,11 +3603,11 @@ var EGovaMap = function (containerID, callback, mapConfig, mapType, mapParam, co
|
|
|
3603
3603
|
* @param {*} colors 颜色数组
|
|
3604
3604
|
* @returns
|
|
3605
3605
|
*/
|
|
3606
|
-
that.initRecCurrentV2Distribution = function(infoJson, colors, layerName, clickCallback){
|
|
3606
|
+
that.initRecCurrentV2Distribution = function(infoJson, colors, layerName, clickCallback, sizeScale){
|
|
3607
3607
|
if (scene == null)
|
|
3608
3608
|
return;
|
|
3609
3609
|
if (gisMap != null) {
|
|
3610
|
-
gisMap.initRecCurrentV2Distribution(infoJson, colors, layerName, clickCallback);
|
|
3610
|
+
gisMap.initRecCurrentV2Distribution(infoJson, colors, layerName, clickCallback, sizeScale);
|
|
3611
3611
|
}
|
|
3612
3612
|
}
|
|
3613
3613
|
|