egovamap 0.17.1 → 0.17.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.
@@ -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) => {
@@ -756,8 +756,8 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig,con
756
756
  /**
757
757
  *等值面生成
758
758
  **/
759
- that.isobands = function(attrarry,xarry,yarry,breaks,breakcolors,cellwidth,boundary,hascelllabel,labelcolor,callback){
760
- scene.fire(msgPrefix + ":isobands", { args: [attrarry,xarry,yarry,breaks,breakcolors,cellwidth,boundary,hascelllabel,labelcolor,callback] },
759
+ that.isobands = function(attrarry,xarry,yarry,breaks,breakcolors,cellwidth,boundary,hascelllabel,labelcolor,callback, options){
760
+ scene.fire(msgPrefix + ":isobands", { args: [attrarry,xarry,yarry,breaks,breakcolors,cellwidth,boundary,hascelllabel,labelcolor,callback, options] },
761
761
  parentScene);
762
762
  }
763
763
 
@@ -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) {
@@ -3442,11 +3442,13 @@ var EGovaMap = function (containerID, callback, mapConfig, mapType, mapParam, co
3442
3442
  * @param {Object} boundary 边界要素
3443
3443
  * @param {Number} hascelllabel 是否获取插值数值
3444
3444
  * @param {Number} labelcolor 插值颜色
3445
+ * @param {Function} callback 回调函数
3446
+ * @param {Object} options 设置插值方法,如{model:"IDW",b:2},表示使用反距离权重插值,b表示距离的幂
3445
3447
  */
3446
- that.isobands = function(attrarry,xarry,yarry,breaks,breakcolors,cellwidth,boundary,hascelllabel,labelcolor,callback){
3448
+ that.isobands = function(attrarry,xarry,yarry,breaks,breakcolors,cellwidth,boundary,hascelllabel,labelcolor,callback,options){
3447
3449
  if (scene == null) { return; }
3448
3450
  if (gisMap != null) {
3449
- gisMap.isobands(attrarry,xarry,yarry,breaks,breakcolors,cellwidth,boundary,hascelllabel,labelcolor,callback);
3451
+ gisMap.isobands(attrarry,xarry,yarry,breaks,breakcolors,cellwidth,boundary,hascelllabel,labelcolor,callback,options);
3450
3452
  }
3451
3453
  }
3452
3454
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "egovamap",
3
- "version": "0.17.1",
3
+ "version": "0.17.4",
4
4
  "description": "eUrbanGIS SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {