|
| 1 | +import { Zondy } from '../../common/Base'; |
| 2 | +import { DataStoreService } from '../ServiceBase'; |
| 3 | + |
| 4 | +/** |
| 5 | + * @author 创新中心-潘卓然 |
| 6 | + * @class module:弹性搜索服务.EsGeocodeService |
| 7 | + * @param gdbp 发布在igs上的pg图层gdbp地址,可以从中解析libName(数据库名)、schemas(工作空间名)、tableName(表名) |
| 8 | + * @param {EsGeocodeParameter} option 查询条件 |
| 9 | + * @param {Boolean} [option.includeProperites = true] 查询结果中是否包含属性 |
| 10 | + * @param {String} [option.where] 属性条件 (例如:id>5,id<10) |
| 11 | + * @param {String} [option.fields] 统计计算中用于分组字段名列表 |
| 12 | + * @param {String} [option.geometry] 几何信息,圆、多边形等 |
| 13 | + * @param {String} [option.geoFormat="wkt"] 几何类型,wkt、wkb、geojson、自定义等 |
| 14 | + * @param {String} [option.sref] 动态投影坐标系 ID,支持 MapGIS 和 EPSG 标准编号,其中 MapGIS 只支持当前库中自带的坐标系的 ID,EPSG 标准请 使用 EPSG:4326 格式,若指定了该参数,则系统认为 geometry 的坐标系为此坐标系 |
| 15 | + */ |
| 16 | +export default class EsGeocodeService extends DataStoreService { |
| 17 | + constructor(option) { |
| 18 | + super(option); |
| 19 | + |
| 20 | + /** |
| 21 | + * @member module:弹性搜索服务.EsGeocodeService.prototype.includeProperites |
| 22 | + * @description 查询结果中是否包含属性 |
| 23 | + * @type Boolean |
| 24 | + * @default true |
| 25 | + */ |
| 26 | + this.includeProperites = option.includeProperites; |
| 27 | + /** |
| 28 | + * @member module:弹性搜索服务.EsGeocodeService.prototype.where |
| 29 | + * @description 属性条件 (例如:id>5,id<10) |
| 30 | + * @type String |
| 31 | + */ |
| 32 | + this.where = option.where; |
| 33 | + /** |
| 34 | + * @member module:弹性搜索服务.EsGeocodeService.prototype.fields |
| 35 | + * @description 统计计算中用于分组字段名列表 |
| 36 | + * @type String |
| 37 | + */ |
| 38 | + this.fields = option.fields; |
| 39 | + /** |
| 40 | + * @member module:弹性搜索服务.EsGeocodeService.prototype.geometry |
| 41 | + * @description 几何信息,圆、多边形等 |
| 42 | + * @type String |
| 43 | + */ |
| 44 | + this.geometry = option.geometry; |
| 45 | + /** |
| 46 | + * @member module:弹性搜索服务.EsGeocodeService.prototype.geoFormat |
| 47 | + * @description 几何类型,wkt、wkb、geojson、自定义等 |
| 48 | + * @type String |
| 49 | + */ |
| 50 | + this.geoFormat = option.geoFormat; |
| 51 | + /** |
| 52 | + * @member module:弹性搜索服务.EsGeocodeService.prototype.sref |
| 53 | + * @description 动态投影坐标系 ID,支持 MapGIS 和 EPSG 标准编号, |
| 54 | + * 其中 MapGIS 只支持当前库中自带的坐标系的 ID,EPSG 标准请 使用 EPSG:4326 格式, |
| 55 | + * 若指定了该参数,则系统认为 geometry 的坐标系为此坐标系 |
| 56 | + * @type String |
| 57 | + */ |
| 58 | + this.sref = option.sref; |
| 59 | + } |
| 60 | + /** |
| 61 | + * @description 查询函数,向服务器发送请求,返回地名地址格式数据 |
| 62 | + * @function module:弹性搜索服务.EsGeocodeService.prototype.query |
| 63 | + * @param {Function} onSuccess 查询成功回调函数。 |
| 64 | + * @param {Function} onError 查询失败回调函数。 |
| 65 | + */ |
| 66 | + query(onSuccess, onError) { |
| 67 | + let { serviceUrl, options } = this; |
| 68 | + let url = this.getFullUrl(serviceUrl, options); |
| 69 | + this.get(url, onSuccess, onError); |
| 70 | + } |
| 71 | +} |
0 commit comments