forked from SuperMap/iClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeoHashGridAggParameter.js
More file actions
62 lines (55 loc) · 2.28 KB
/
GeoHashGridAggParameter.js
File metadata and controls
62 lines (55 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* Copyright© 2000 - 2019 SuperMap Software Co.Ltd. All rights reserved.
* This program are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
import {SuperMap} from "../SuperMap";
import {AggregationType} from '../REST';
import {Util} from '../commontypes/Util';
import {AggregationParameter} from "./AggregationParameter";
/**
* @class SuperMap.GeoHashGridAggParameter
* @classdesc 格网聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
* @category iServer Data FeatureResults
* @param {Object} option - 初始化参数。
* @param {number} [option.precision=5] - 网格中数字的精度。
* @param {SuperMap.AggregationType} [option.aggType=SuperMap.AggregationType.GEOHASH_GRID] - 格网聚合类型。
*/
export class GeoHashGridAggParameter extends AggregationParameter {
constructor(option) {
super(option);
/**
* @member {number} [SuperMap.GeoHashGridAggParameter.prototype.precision=5]
* @description 网格中数字的精度。
*/
this.precision = 5;
/**
* @member {SuperMap.AggregationType} [SuperMap.GeoHashGridAggParameter.prototype.aggType=SuperMap.AggregationType.GEOHASH_GRID]
* @description 格网聚合类型。
*/
this.aggType = AggregationType.GEOHASH_GRID;
Util.extend(this, option);
this.CLASS_NAME = "SuperMap.GeoHashGridAggParameter";
}
destroy() {
super.destroy();
this.aggType = null;
}
/**
* @function SuperMap.GeoHashGridAggParameter.toJsonParameters
* @description 将对象转为 JSON 格式。
* @param param 转换对象。
* @returns {string|object}
*/
static toJsonParameters(param) {
var parameters = {
aggName: param.aggName,
aggFieldName: param.aggFieldName,
aggType: param.aggType,
precision: param.precision
};
if (param.subAgg) {
parameters.subAgg = param.subAgg;
}
return Util.toJson(parameters);
}
}
SuperMap.GeoHashGridAggParameter = GeoHashGridAggParameter;