| | |
| | | * 加载WMS,拼接FILTER,LAYERS参数等 |
| | | */ |
| | | import { WFS_URL } from '../../conf/Constants' |
| | | import { lrtrim } from '../../utils/utils' |
| | | function WfsHelper () { |
| | | this.filters = [] |
| | | this.typeNames = [] |
| | |
| | | REQUEST: 'getfeature', |
| | | OUTPUTFORMAT: 'application/json', |
| | | maxFeatures: 10, |
| | | version: '1.0.0', |
| | | startIndex: 0 |
| | | version: '1.0.0' |
| | | } |
| | | |
| | | this.setTypeName = (typeName) => { |
| | | this.typeNames = typeName |
| | | if (typeof typeName === 'string' || typeName instanceof String) { |
| | | const comma = typeName.indexOf(',') |
| | | if (comma >= 0) { |
| | | const typeNameArr = typeName.split(',') |
| | | for (let i = 0; i < typeNameArr.length; i++) { |
| | | this.addTypeName(lrtrim(typeNameArr[i])) |
| | | } |
| | | } |
| | | } else if (Array.isArray(typeName)) { |
| | | this.typeNames = typeName |
| | | } |
| | | } |
| | | |
| | | this.setFilter = (filter) => { |
| | | console.log(filter) |
| | | if (typeof filter === 'string' || filter instanceof String) { |
| | | const eq = filter.indexOf('=') |
| | | const lk = filter.indexOf('like') |
| | | if (eq >= 0) { |
| | | const filterArr = filter.split('=') |
| | | this.addEquals(lrtrim(filterArr[0]), lrtrim(filterArr[1])) |
| | | } |
| | | if (lk >= 0) { |
| | | const filterArr = filter.split('like') |
| | | this.addLike(lrtrim(filterArr[0]), lrtrim(filterArr[1])) |
| | | } |
| | | } else if (Array.isArray(filter)) { |
| | | this.filters = filter |
| | | } |
| | | } |
| | | |
| | | this.clearFilter = () => { |
| | |
| | | this.params.startIndex = startIndex |
| | | this.page = page |
| | | } |
| | | |
| | | this.setPageSize = (pageSize) => { |
| | | this.pageSize = pageSize |
| | | } |
| | | |
| | | this.setMaxFeatures = (maxFeatures) => { |
| | | this.params.maxFeatures = maxFeatures |
| | | } |
| | | } |
| | | |
| | | export default WfsHelper |