|
@@ -101,20 +101,9 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
- // // 图层查询
|
|
|
- // var JmapQuery = new JMapQuery(window.jMap); // JMap为初始化地图时,实例化的JMap对象
|
|
|
- // //例1:查询图层记录总量
|
|
|
- // var qp = new JMapQueryParam({
|
|
|
- // queryMapService: "mh_dyn_district",
|
|
|
- // queryMapLayers: [1],
|
|
|
- // returnCountOnly: true,
|
|
|
- // callBack: testQueryCallBack
|
|
|
- // });
|
|
|
- // JmapQuery.execQuery(qp);
|
|
|
+ // 图层查询
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- //例2:查询图层列表
|
|
|
+ //例:查询图层列表
|
|
|
var JmapQuery = new JMapQuery(window.jMap); // JMap为初始化地图时,实例化的JMap对象
|
|
|
|
|
|
var qp2 = new JMapQueryParam({
|
|
@@ -127,17 +116,6 @@ export default {
|
|
|
});
|
|
|
JmapQuery.execQuery(qp2);
|
|
|
|
|
|
- // var qp4 = new JMapQueryParam({
|
|
|
- // queryMapService: "mh_dyn_district",
|
|
|
- // queryMapLayers: [2],
|
|
|
- // groupByFieldsForStatistics: ['subdistrict'], // 所需进行分组查询字段
|
|
|
- // onStatisticField: 'subdistrict', // 将在其上计算统计信息的字段名称
|
|
|
- // statisticType: 'count', // 统计信息的类型
|
|
|
- // outStatisticFieldName: 'num', // 指定输出字段名称(别名)
|
|
|
- // callBack: testQueryCallBack
|
|
|
- // });
|
|
|
- // JmapQuery.execQuery(qp4);
|
|
|
-
|
|
|
|
|
|
// 图层查询完毕的回调函数
|
|
|
function testQueryCallBack(obj) {
|
|
@@ -156,55 +134,71 @@ export default {
|
|
|
bigNewArr.push(newArr)
|
|
|
|
|
|
})
|
|
|
+ let arrayAll = [];
|
|
|
+ bigNewArr.forEach(function(item, index) {
|
|
|
+ var idx = index + 1;
|
|
|
+ console.log(idx)
|
|
|
+ var color = ["#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", ];
|
|
|
+
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ console.log(1111111)
|
|
|
+ //区域分布
|
|
|
+ var target = {
|
|
|
+ id: idx,
|
|
|
+ attributes: {
|
|
|
+ name: '测试区域分布'
|
|
|
+ },
|
|
|
+ position: item,
|
|
|
+ label: {
|
|
|
+ // text: "测试区域分布",
|
|
|
+ font: "16px Helvetica",
|
|
|
+ color: "rgb(255, 0, 0, .8)",
|
|
|
+ pixelOffset: [0, -50]
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var options = {
|
|
|
+ isZoom: true,
|
|
|
+ click: regionLocateCallBack,
|
|
|
+ style: {
|
|
|
+ color: color[index],
|
|
|
+ transparency: 0.2,
|
|
|
+ outline: true,
|
|
|
+ outlineColor: 'blue',
|
|
|
+ }
|
|
|
+
|
|
|
+ };
|
|
|
+ jMap.Locate.regionLocate(target, options);
|
|
|
+
|
|
|
+ console.log(11111112222222)
|
|
|
+
|
|
|
+ // 分布点点击事件的回调函数
|
|
|
+ function regionLocateCallBack(obj) {
|
|
|
+ console.log(obj); // obj为返回值
|
|
|
+ }
|
|
|
+
|
|
|
+ }, idx * 1)
|
|
|
|
|
|
|
|
|
- // 首先定义一个接收合并之后值的数组
|
|
|
- let arrayAll = [];
|
|
|
|
|
|
- bigNewArr.forEach(function(item, index) {
|
|
|
item.forEach(function(i) {
|
|
|
arrayAll.push(i)
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
console.log(222)
|
|
|
console.log(arrayAll)
|
|
|
|
|
|
|
|
|
|
|
|
- //区域分布
|
|
|
- var target = {
|
|
|
- id: '100001',
|
|
|
- attributes: {
|
|
|
- name: '测试区域分布'
|
|
|
- },
|
|
|
- position: arrayAll,
|
|
|
- label: {
|
|
|
- text: "测试区域分布",
|
|
|
- font: "16px Helvetica",
|
|
|
- color: "rgb(255, 0, 0, .8)",
|
|
|
- pixelOffset: [0, -50]
|
|
|
- }
|
|
|
- };
|
|
|
- var options = {
|
|
|
- isZoom: true,
|
|
|
- click: regionLocateCallBack,
|
|
|
- style: {
|
|
|
- // color: '',
|
|
|
- transparency: 0.6,
|
|
|
- outline: true,
|
|
|
- outlineColor: 'green',
|
|
|
- perPositionHeight: true
|
|
|
- }
|
|
|
|
|
|
|
|
|
- };
|
|
|
- window.jMap.Locate.regionLocate(target, options);
|
|
|
- // 分布点点击事件的回调函数
|
|
|
- function regionLocateCallBack(obj) {
|
|
|
- console.log(obj); // obj为返回值
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|