From 058e2fe44a83ae5bb47c3225f383ae6398ead0fa Mon Sep 17 00:00:00 2001 From: chenxianhui Date: Tue, 12 Dec 2023 20:11:27 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90ICL-1511=E3=80=91=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E6=9E=84=E5=BB=BA=E6=B3=B0=E6=A3=AE?= =?UTF-8?q?=E5=A4=9A=E8=BE=B9=E5=BD=A2=EF=BC=8C=E4=BC=A0=E5=85=A5L.Polygon?= =?UTF-8?q?=20|=20ol.geom.Polygon=20|=20GeoJSONObject=E7=AD=89=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E8=AE=BE=E7=BD=AE=E8=A3=81=E5=89=AA=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=8F=82=E6=95=B0clipRegion=E6=8A=A5=E9=94=99=20review=20by=20?= =?UTF-8?q?qiwei?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/leaflet/services/SpatialAnalystService.js | 3 +++ src/mapboxgl/services/SpatialAnalystService.js | 3 +++ src/maplibregl/services/SpatialAnalystService.js | 3 +++ src/openlayers/services/SpatialAnalystService.js | 3 +++ test/leaflet/services/ThiessenAnalysisSpec.js | 10 +++++++++- test/mapboxgl/services/ThiessenAnalysisSpec.js | 13 ++++++++++++- test/maplibregl/services/ThiessenAnalysisSpec.js | 13 ++++++++++++- test/openlayers/services/ThiessenAnalysisSpec.js | 13 ++++++++++++- 8 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/leaflet/services/SpatialAnalystService.js b/src/leaflet/services/SpatialAnalystService.js index a900bd2cc4..bb44fcda81 100644 --- a/src/leaflet/services/SpatialAnalystService.js +++ b/src/leaflet/services/SpatialAnalystService.js @@ -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; diff --git a/src/mapboxgl/services/SpatialAnalystService.js b/src/mapboxgl/services/SpatialAnalystService.js index 6b6de30779..b8227afc30 100644 --- a/src/mapboxgl/services/SpatialAnalystService.js +++ b/src/mapboxgl/services/SpatialAnalystService.js @@ -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) { diff --git a/src/maplibregl/services/SpatialAnalystService.js b/src/maplibregl/services/SpatialAnalystService.js index 0781ecfd45..fe985aefb9 100644 --- a/src/maplibregl/services/SpatialAnalystService.js +++ b/src/maplibregl/services/SpatialAnalystService.js @@ -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) { diff --git a/src/openlayers/services/SpatialAnalystService.js b/src/openlayers/services/SpatialAnalystService.js index 44d8993361..31e256b97c 100644 --- a/src/openlayers/services/SpatialAnalystService.js +++ b/src/openlayers/services/SpatialAnalystService.js @@ -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; diff --git a/test/leaflet/services/ThiessenAnalysisSpec.js b/test/leaflet/services/ThiessenAnalysisSpec.js index b7e1810b6b..de9b98315b 100644 --- a/test/leaflet/services/ThiessenAnalysisSpec.js +++ b/test/leaflet/services/ThiessenAnalysisSpec.js @@ -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"); diff --git a/test/mapboxgl/services/ThiessenAnalysisSpec.js b/test/mapboxgl/services/ThiessenAnalysisSpec.js index b5ed4b16d6..04c252c9c4 100644 --- a/test/mapboxgl/services/ThiessenAnalysisSpec.js +++ b/test/mapboxgl/services/ThiessenAnalysisSpec.js @@ -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"); diff --git a/test/maplibregl/services/ThiessenAnalysisSpec.js b/test/maplibregl/services/ThiessenAnalysisSpec.js index 7261718041..bb875ccf02 100644 --- a/test/maplibregl/services/ThiessenAnalysisSpec.js +++ b/test/maplibregl/services/ThiessenAnalysisSpec.js @@ -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"); diff --git a/test/openlayers/services/ThiessenAnalysisSpec.js b/test/openlayers/services/ThiessenAnalysisSpec.js index 24358f5296..9f9f4a1898 100644 --- a/test/openlayers/services/ThiessenAnalysisSpec.js +++ b/test/openlayers/services/ThiessenAnalysisSpec.js @@ -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; @@ -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");