"use strict";
|
|
Object.defineProperty(exports, "__esModule", {
|
value: true
|
});
|
exports["default"] = void 0;
|
var wfsConfig = {
|
url: "",
|
layer: "",
|
color: "",
|
property: "",
|
keyVal: "",
|
polygonLayer: null,
|
wfsLayer: null,
|
// 参数初始化
|
Init: function Init() {
|
this.url = "https://cim.smartearth.cn/SEserver/wfsserver/SubicBayAreaVector_wfs";
|
this.layer = "GeoEntity";
|
this.color = "#f40824";
|
this.keyVal = "市政";
|
this.setPolyGonStart();
|
},
|
//wfsLayer初始化
|
setPolyGonStart: function setPolyGonStart() {
|
this.polygonLayer = earthCtrl.factory.createWfsLayer("polygon", {
|
urls: this.url,
|
layer: this.layer,
|
color: this.color,
|
extrudedHeight: 100,
|
// 拉伸高度,无拉伸高度则为贴地面
|
extrudedkey: "ELEVATION"
|
});
|
this.setWfsLayerStart();
|
},
|
//wfsLayer初始化
|
setWfsLayerStart: function setWfsLayerStart() {
|
this.wfsLayer = new OpenLayers.Protocol.WFS({
|
version: "1.1.0",
|
url: this.url,
|
layer: this.layer
|
});
|
this.setLayerQuery();
|
},
|
setLayerQuery: function setLayerQuery() {
|
var filter = new OpenLayers.Filter.Comparison({
|
type: OpenLayers.Filter.Comparison.EQUAL_TO,
|
property: "SJFL",
|
value: this.keyVals
|
});
|
var that = this;
|
console.log(this.wfsLayer);
|
that.wfsLayer.read({
|
filter: filter,
|
callback: function callback(result) {
|
console.log(1231, result);
|
|
if (result.success() && result.features.length > 0) {
|
var feature = result.features[0]; // var lon = Number(feature.attributes.lon);
|
// var lat = Number(feature.attributes.lat);
|
|
that.setLayerQuery2(feature);
|
}
|
}
|
});
|
},
|
setLayerQuery2: function setLayerQuery2() {
|
var that = this;
|
var wfs2 = new OpenLayers.Protocol.WFS({
|
version: "1.1.0",
|
url: this.url,
|
featureType: this.layer,
|
geometryName: "TargetType"
|
});
|
wfs2.read({
|
filter: new OpenLayers.Filter.Spatial({
|
type: OpenLayers.Filter.Spatial.DWITHIN,
|
value: feature.geometry,
|
distance: 0.1,
|
distanceUnits: "km"
|
}),
|
callback: function callback(result) {
|
console.log('w1223', result);
|
|
if (result.success()) {
|
if (result.features && result.features.length) {
|
that.addFeaturesToMap(result.features);
|
}
|
}
|
}
|
});
|
},
|
addFeaturesToMap: function addFeaturesToMap(features) {
|
var highlightColor = Cesium.Color.YELLOW.withAlpha(0.5);
|
var highlightIds = [];
|
features.forEach(function (feature) {
|
var id = feature.attributes.OBJECTID;
|
highlightIds.push(id);
|
});
|
this.polygonLayer.setHighlightColor(highlightIds, highlightColor);
|
}
|
};
|
var _default = wfsConfig;
|
exports["default"] = _default;
|