| | |
| | | layer.item.baseLayer = true; |
| | | } |
| | | }, |
| | | // 市政杆体聚合 |
| | | initLdgCluster(treeNode) { |
| | | if (treeNode.checked == false) { |
| | | window.mapapi.removeLayer(window.ldgclusterLayer); |
| | |
| | | source: clusterSource, |
| | | style: function (feature) { |
| | | var size = feature.get("features").length; |
| | | if (size <= 100) { |
| | | if (size == 1) { |
| | | return new ol.style.Style({ |
| | | image: new ol.style.Icon({ |
| | | anchor: [0.5, 1], |
| | |
| | | |
| | | window.mapapi.addLayer(window.ldgclusterLayer); |
| | | } else if (treeNode.name == "路名牌杆 ") { |
| | | window.tldgclusterLayer = new ol.layer.Vector({ |
| | | window.tldgclusterLayer = new ol.layer.Vector({ |
| | | source: clusterSource, |
| | | style: function (feature) { |
| | | var size = feature.get("features").length; |
| | | if (size <= 100) { |
| | | if (size == 1) { |
| | | return new ol.style.Style({ |
| | | image: new ol.style.Icon({ |
| | | anchor: [0.5, 1], |
| | |
| | | window.mapapi.removeLayer(window.jkspclusterLayer); |
| | | window.mapapi.removeLayer(window.qiyeclusterLayer); |
| | | loading.close(); |
| | | window.mapapi.getView().on("change:resolution", function (event) { |
| | | if ( |
| | | window.mapapi.getView().getZoom() == |
| | | window.mapapi.getView().getMaxZoom() |
| | | ) { |
| | | clusterSource.setDistance(0); |
| | | } else { |
| | | clusterSource.setDistance(40); |
| | | } |
| | | }); |
| | | }, |
| | | // 视频监控聚合 |
| | | initCluster(treeNode) { |
| | | if (treeNode.checked == false) { |
| | | window.mapapi.removeLayer(window.jkspclusterLayer); |
| | |
| | | |
| | | // 创建聚合显示样式 |
| | | var styleCache = {}; |
| | | window.jkspclusterLayer = new ol.layer.Vector({ |
| | | window.jkspclusterLayer = new ol.layer.Vector({ |
| | | source: clusterSource, |
| | | style: function (feature) { |
| | | var size = feature.get("features").length; |
| | | if (size <= 100) { |
| | | if (size == 1) { |
| | | return new ol.style.Style({ |
| | | image: new ol.style.Icon({ |
| | | anchor: [0.5, 1], |
| | |
| | | window.mapapi.removeLayer(window.qiyeclusterLayer); |
| | | window.mapapi.addLayer(window.jkspclusterLayer); |
| | | loading.close(); |
| | | window.mapapi.getView().on("change:resolution", function (event) { |
| | | if ( |
| | | window.mapapi.getView().getZoom() == |
| | | window.mapapi.getView().getMaxZoom() |
| | | ) { |
| | | clusterSource.setDistance(0); |
| | | } else { |
| | | clusterSource.setDistance(40); |
| | | } |
| | | }); |
| | | // new Cesium.GeoJsonDataSource.load( |
| | | // treeNode.urls + |
| | | // "?version=1.3.0&request=GetFeature&format=json&typename=" + |
| | |
| | | // loading.close(); |
| | | // }); |
| | | }, |
| | | testSDKcluster() { |
| | | let clusterLayer1 = new SmartEarth.ClusterLayer(Viewer, { |
| | | style: "clustering", |
| | | }); |
| | | axios |
| | | .get( |
| | | window.gisBaseUrl + |
| | | "/gisserver/wfsserver/qiyelianqiye?version=1.3.0&request=GetFeature&format=json&typename=企业链企业" |
| | | ) |
| | | .then((res) => { |
| | | let positions = generatePosition(20000); |
| | | positions.forEach((item) => { |
| | | clusterLayer1.add(item, { |
| | | image: "./static/SmartEarthSDK/Workers/image/xzspj/qiye.png", |
| | | }); |
| | | }); |
| | | // res.data.features.forEach((item) => { |
| | | // clusterLayer1.add( |
| | | // new SmartEarth.Degrees( |
| | | // item.geometry.coordinates[0], |
| | | // item.geometry.coordinates[1] |
| | | // ), |
| | | // { |
| | | // name: `QY&${item.properties.ID}&${item.properties["QYMC"]}&${item.properties["DZ"]}&${item.properties["BZDZ"]}&${item.properties["XYDM"]}&${item.geometry.coordinates[0]}&${item.geometry.coordinates[1]}`, |
| | | // image: SmartEarthRootUrl + "Workers/image/mark.png", |
| | | // } |
| | | // ); |
| | | // }); |
| | | }); |
| | | }, |
| | | //企业信息加载 |
| | | |
| | | //企业信息聚合 |
| | | qiyeCluster(treeNode) { |
| | | if (treeNode.checked == false) { |
| | | window.mapapi.removeLayer(window.qiyeclusterLayer); |
| | |
| | | "?version=1.3.0&request=GetFeature&format=json&typename=" + |
| | | treeNode.layer, |
| | | }); |
| | | |
| | | |
| | | // 创建聚合层 |
| | | var clusterSource = new ol.source.Cluster({ |
| | | distance: 200, |
| | | distance: 40, |
| | | source: vectorSource, |
| | | }); |
| | | |
| | | // 创建聚合显示样式 |
| | | var styleCache = {}; |
| | | window.qiyeclusterLayer = new ol.layer.Vector({ |
| | | window.qiyeclusterLayer = new ol.layer.Vector({ |
| | | source: clusterSource, |
| | | style: function (feature) { |
| | | var size = feature.get("features").length; |
| | | if (size <= 1300) { |
| | | if (size == 1) { |
| | | return new ol.style.Style({ |
| | | image: new ol.style.Icon({ |
| | | anchor: [0.5, 1], |
| | |
| | | window.mapapi.removeLayer(window.jkspclusterLayer); |
| | | window.mapapi.addLayer(window.qiyeclusterLayer); |
| | | loading.close(); |
| | | //监听最大层级 聚合距离为0 取消聚合 |
| | | window.mapapi.getView().on("change:resolution", function (event) { |
| | | if ( |
| | | window.mapapi.getView().getZoom() == |
| | | window.mapapi.getView().getMaxZoom() |
| | | ) { |
| | | clusterSource.setDistance(0); |
| | | // clusterSource.getSource().clear() |
| | | // console.log("企业"); |
| | | } else { |
| | | clusterSource.setDistance(40); |
| | | } |
| | | }); |
| | | // 监听地图单击事件 |
| | | // window.mapapi.on("singleclick", function (e) { |
| | | // var pixel = window.mapapi.getEventPixel(e.originalEvent); |
| | | // var currentFeature = window.mapapi.forEachFeatureAtPixel( |
| | | // pixel, |
| | | // function (feature, layer) { |
| | | // return feature; |
| | | // } |
| | | // ); |
| | | // if (currentFeature) { |
| | | // var features = currentFeature.get("features"); |
| | | // if (features.length > 1) { |
| | | // console.log(features); |
| | | // window.alert("当前聚合圈下共有" + features.length + "个要素"); |
| | | // } |
| | | // if (features.length == 1) { |
| | | // console.log(features); |
| | | |
| | | // window.alert("当前要素未被聚合,只有" + features.length + "个要素"); |
| | | // } |
| | | // } |
| | | // }); |
| | | // let dataSource; |
| | | // if (treeNode.layer == "企业链企业") { |
| | | // // console.log(store.qiyeJsonInfo); |
| | |
| | | // } |
| | | // }); |
| | | }, |
| | | |
| | | testSDKcluster() { |
| | | let clusterLayer1 = new SmartEarth.ClusterLayer(Viewer, { |
| | | style: "clustering", |
| | | }); |
| | | axios |
| | | .get( |
| | | window.gisBaseUrl + |
| | | "/gisserver/wfsserver/qiyelianqiye?version=1.3.0&request=GetFeature&format=json&typename=企业链企业" |
| | | ) |
| | | .then((res) => { |
| | | let positions = generatePosition(20000); |
| | | positions.forEach((item) => { |
| | | clusterLayer1.add(item, { |
| | | image: "./static/SmartEarthSDK/Workers/image/xzspj/qiye.png", |
| | | }); |
| | | }); |
| | | // res.data.features.forEach((item) => { |
| | | // clusterLayer1.add( |
| | | // new SmartEarth.Degrees( |
| | | // item.geometry.coordinates[0], |
| | | // item.geometry.coordinates[1] |
| | | // ), |
| | | // { |
| | | // name: `QY&${item.properties.ID}&${item.properties["QYMC"]}&${item.properties["DZ"]}&${item.properties["BZDZ"]}&${item.properties["XYDM"]}&${item.geometry.coordinates[0]}&${item.geometry.coordinates[1]}`, |
| | | // image: SmartEarthRootUrl + "Workers/image/mark.png", |
| | | // } |
| | | // ); |
| | | // }); |
| | | }); |
| | | }, |
| | | // initCluster(treeNode) { |
| | | // let that = this; |
| | | // let imgUrl; |