Skip to content

Commit

Permalink
【ICL-1511】使用数据集构建泰森多边形,传入L.Polygon | ol.geom.Polygon | GeoJSONObject等…
Browse files Browse the repository at this point in the history
…格式设置裁剪区域参数clipRegion报错 review by qiwei
  • Loading branch information
chenxianhuii committed Dec 12, 2023
1 parent 1f0e54d commit 058e2fe
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/leaflet/services/SpatialAnalystService.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ export var SpatialAnalystService = ServiceBase.extend({
if (params.clipParam && params.clipParam.clipRegion) {
params.clipParam.clipRegion = Util.toSuperMapGeometry(params.clipParam.clipRegion);
}
if (params.clipRegion) {
params.clipRegion = Util.toSuperMapGeometry(params.clipRegion);
}
//支持格式:Vector Layers; GeoJson
if (params.sourceGeometry) {
var SRID = null;
Expand Down
3 changes: 3 additions & 0 deletions src/mapboxgl/services/SpatialAnalystService.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ export class SpatialAnalystService extends ServiceBase {
if (params.clipParam && params.clipParam.clipRegion) {
params.clipParam.clipRegion = Util.toSuperMapGeometry(params.clipParam.clipRegion);
}
if (params.clipRegion) {
params.clipRegion = Util.toSuperMapGeometry(params.clipRegion);
}
//sourceRoute 路由对象。用于里程分析,该对象可以是用户自己生 成或在数据源中查询得到的符合标准的路由对象;geojson格式
if (params.sourceRoute) {
if (params.sourceRoute) {
Expand Down
3 changes: 3 additions & 0 deletions src/maplibregl/services/SpatialAnalystService.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ export class SpatialAnalystService extends ServiceBase {
if (params.clipParam && params.clipParam.clipRegion) {
params.clipParam.clipRegion = Util.toSuperMapGeometry(params.clipParam.clipRegion);
}
if (params.clipRegion) {
params.clipRegion = Util.toSuperMapGeometry(params.clipRegion);
}
//sourceRoute 路由对象。用于里程分析,该对象可以是用户自己生 成或在数据源中查询得到的符合标准的路由对象;geojson格式
if (params.sourceRoute) {
if (params.sourceRoute) {
Expand Down
3 changes: 3 additions & 0 deletions src/openlayers/services/SpatialAnalystService.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,9 @@ export class SpatialAnalystService extends ServiceBase {
if (params.clipParam && params.clipParam.clipRegion) {
params.clipParam.clipRegion = this.convertGeometry(params.clipParam.clipRegion);
}
if (params.clipRegion) {
params.clipRegion = this.convertGeometry(params.clipRegion);
}
//支持格式:Vector Layers; GeoJson
if (params.sourceGeometry) {
var SRID = null;
Expand Down
10 changes: 9 additions & 1 deletion test/leaflet/services/ThiessenAnalysisSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,16 @@ describe('leaflet_SpatialAnalystService_thiessenAnalysis', () => {

it('thiessenAnalysis', (done) => {
var dsThiessenAnalystParameters = new DatasetThiessenAnalystParameters({
dataset: "Factory@Changchun"
dataset: "Factory@Changchun",
clipRegion: polygon
});
var polygon = L.polygon([
[-1000, 5000],
[-1000, 7000],
[-3000, 7000],
[-3000, 5000],
[-1000, 5000]
]);
var thiessenAnalystService = spatialAnalystService(spatialAnalystURL, options);
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
expect(method).toBe("POST");
Expand Down
13 changes: 12 additions & 1 deletion test/mapboxgl/services/ThiessenAnalysisSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,19 @@ describe('mapboxgl_SpatialAnalystService_thiessenAnalysis', () => {
//泰森多边形分析 数据集泰森多边形
it('thiessenAnalysis_byDataset', (done) => {
var datasetThiessenAnalystParameters = new DatasetThiessenAnalystParameters({
dataset: "Town_P@Jingjin"
dataset: "Town_P@Jingjin",
clipRegion: polygon
});
var polygon = {
"type": "Polygon",
"coordinates": [[
[116, 39],
[117, 39],
[117, 38],
[116, 38],
[116, 39]
]]
};
var service = new SpatialAnalystService(url, options);
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
expect(method).toBe("POST");
Expand Down
13 changes: 12 additions & 1 deletion test/maplibregl/services/ThiessenAnalysisSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,19 @@ describe('maplibregl_SpatialAnalystService_thiessenAnalysis', () => {
//泰森多边形分析 数据集泰森多边形
it('thiessenAnalysis_byDataset', (done) => {
var datasetThiessenAnalystParameters = new DatasetThiessenAnalystParameters({
dataset: "Town_P@Jingjin"
dataset: "Town_P@Jingjin",
clipRegion: polygon
});
var polygon = {
"type": "Polygon",
"coordinates": [[
[116, 39],
[117, 39],
[117, 38],
[116, 38],
[116, 39]
]]
};
var service = new SpatialAnalystService(url, options);
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
expect(method).toBe("POST");
Expand Down
13 changes: 12 additions & 1 deletion test/openlayers/services/ThiessenAnalysisSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from '../../../src/common/util/FetchRequest';

import Point from 'ol/geom/Point';
import Polygon from 'ol/geom/Polygon';

var originalTimeout, serviceResults;
var changchunServiceUrl = GlobeParameter.spatialAnalystURL_Changchun;
Expand All @@ -28,8 +29,18 @@ describe('openlayers_SpatialAnalystService_thiessenAnalysis', () => {
//数据集泰森多边形
it('thiessenAnalysis_datasets', (done) => {
var dThiessenAnalystParameters = new DatasetThiessenAnalystParameters({
dataset: "Factory@Changchun"
dataset: "Factory@Changchun",
clipRegion: polygon
});
var polygon = new Polygon([
[
[5000, -1000],
[7000, -1000],
[7000, -3000],
[5000, -3000],
[5000, -1000]
]
])
var spatialAnalystService = new SpatialAnalystService(changchunServiceUrl);
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
expect(method).toBe("POST");
Expand Down

0 comments on commit 058e2fe

Please sign in to comment.