From 6d4664008d3fa694fcbb4adecf108587563814bf Mon Sep 17 00:00:00 2001 From: Matthias Stein Date: Fri, 30 Apr 2021 15:55:31 +0200 Subject: [PATCH] Fix #11 --- .../actions/CircleSpatialInputAction.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/js/bundles/dn_selectionactions/actions/CircleSpatialInputAction.js b/src/main/js/bundles/dn_selectionactions/actions/CircleSpatialInputAction.js index 370a79b..3b5a30c 100644 --- a/src/main/js/bundles/dn_selectionactions/actions/CircleSpatialInputAction.js +++ b/src/main/js/bundles/dn_selectionactions/actions/CircleSpatialInputAction.js @@ -14,8 +14,8 @@ * limitations under the License. */ import CancelablePromise from "apprt-core/CancelablePromise"; -import Polygon from "esri/geometry/Polygon"; import Circle from "esri/geometry/Circle"; +import {difference} from "esri/geometry/geometryEngine" import CircleSpatialInputWidget from "../widgets/CircleSpatialInputWidget.vue"; import Vue from "apprt-vue/Vue"; import VueDijit from "apprt-vue/VueDijit"; @@ -92,7 +92,7 @@ export default class CircleSpatialInputAction { // prevent popup evt.stopPropagation(); const point = view.toMap({x: evt.x, y: evt.y}); - const circleGeometry = this[_geometry] = this.createDonut(point); + const circleGeometry = this[_geometry] = this.createDonutOrCircle(point); if (args.queryBuilderSelection) { this.closeWidget(); } else { @@ -122,17 +122,13 @@ export default class CircleSpatialInputAction { } } - createDonut(point) { - const circleGeometry = new Polygon({ - spatialReference: point.spatialReference - }); + createDonutOrCircle(point) { const model = this._circleSpatialInputWidgetModel; + let circleGeometry = this.createCircle(point, model.outerRadius); if (model.innerRadius > 0) { const innerCircle = this.createCircle(point, model.innerRadius); - circleGeometry.addRing(innerCircle.rings[0]); + circleGeometry = difference(circleGeometry, innerCircle); } - const outerCircle = this.createCircle(point, model.outerRadius); - circleGeometry.addRing(outerCircle.rings[0]); return circleGeometry; }