egovamap 0.17.2 → 0.17.5

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.
@@ -22,28 +22,55 @@ var egovaBI = function(globeMap, gisMap, mapType){
22
22
  });
23
23
  }
24
24
 
25
- function interpolateColor(start, end, count) {
26
- if (count < 2) return [start, end];
27
- var r = end[0] - start[0];
28
- var g = end[1] - start[1];
29
- var b = end[2] - start[2];
30
- var opacity = end[3] - start[3];
25
+ function interpolateColor(startColor, endColor, count) {
26
+ if (count < 2) return [startColor, endColor];
27
+
28
+ var start = rgbToRgbArray(startColor);
29
+ var end = rgbToRgbArray(endColor);
30
+ var end0 = end[0];
31
+ var end1 = end[1];
32
+ var end2 = end[2];
33
+ var end3 = end[3];
34
+ var start0 = start[0];
35
+ var start1 = start[1];
36
+ var start2 = start[2];
37
+ var start3 = start[3];
38
+
39
+ var r = end0 - start0;
40
+ var g = end1 - start1;
41
+ var b = end2 - start2;
42
+ var opacity = end3 - start3;
31
43
  var step = 1.0 / count;
32
- var colors = [start];
44
+ var colors = [startColor];
33
45
  var _count = count - 1;
34
46
  for (var i = 1; i < _count; i++) {
35
47
  var interval = step * i;
36
- colors.push([
37
- Math.round(start[0] + interval * r),
38
- Math.round(start[1] + interval * g),
39
- Math.round(start[2] + interval * b),
40
- Math.round(start[3] + interval * opacity),
41
- ])
48
+ colors.push('rgba(' +
49
+ Math.round(start0 + interval * r) + ',' +
50
+ Math.round(start1 + interval * g) + ',' +
51
+ Math.round(start2 + interval * b) + ',' +
52
+ (start3 + interval * opacity) +
53
+ ')');
42
54
  }
43
- colors.push(end);
55
+ colors.push(endColor);
44
56
  return colors;
45
57
  }
46
58
 
59
+ function rgbToRgbArray(color) {
60
+ if (!color || (typeof color == 'string'&&color.indexOf('rgb') == -1)) return color;
61
+
62
+ var r, g, b, a;
63
+ var rgbaAttr = color.match(/[\d.]+/g);
64
+ if (rgbaAttr.length >= 3) {
65
+ r = parseInt(rgbaAttr[0]);
66
+ g = parseInt(rgbaAttr[1]);
67
+ b = parseInt(rgbaAttr[2]);
68
+ if (rgbaAttr.length > 3) a = parseFloat(rgbaAttr[3]);
69
+ else a = 1;
70
+ }
71
+ return [ r, g, b, a];
72
+ };
73
+
47
74
  // 查询idb是否存在表
48
75
  function checkObjectStore (storeName) {
49
76
  return new Promise((resolve, reject) => {
@@ -670,11 +670,11 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
670
670
  that.callMap('showLayerTree', openTree);
671
671
  }
672
672
  /* I查询 */
673
- that.identify = function (type, humanID, mapID) {
673
+ that.identify = function (type, humanID, mapID, options, callback) {
674
674
  if (scene == null)
675
675
  return;
676
676
  //scene.fire(msgPrefix + ":identify", { args: [type, humanID, mapID] }, parentScene);
677
- that.callMap('identify', type, humanID, mapID);
677
+ that.callMap('identify', type, humanID, mapID, options, callback);
678
678
  }
679
679
  /* 地理编码查询 */
680
680
  that.geoCode = function (searchStr, callback) {
@@ -886,7 +886,7 @@ var EGovaMap = function (containerID, callback, mapConfig, mapType, mapParam, co
886
886
  }
887
887
 
888
888
  /* I查询 */
889
- that.identify = function (type, humanID, mapID) {
889
+ that.identify = function (type, humanID, mapID, options, callback) {
890
890
  if (scene == null)
891
891
  return;
892
892
  if (gisMap != null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "egovamap",
3
- "version": "0.17.2",
3
+ "version": "0.17.5",
4
4
  "description": "eUrbanGIS SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {