1 line
21 KiB
JavaScript
1 line
21 KiB
JavaScript
"use strict";(self.webpackChunk_farmos_org_farmos_map=self.webpackChunk_farmos_org_farmos_map||[]).push([[807],{7276:(t,e,i)=>{i.d(e,{Z:()=>c});var o,n=i(4754),r=i(2967),s=i(8641),a=i(8527),h=i(6442),u=(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),d=function(t){function e(e,i,o){var n=t.call(this)||this;if(void 0!==o&&void 0===i)n.setFlatCoordinates(o,e);else{var r=i||0;n.setCenterAndRadius(e,r,o)}return n}return u(e,t),e.prototype.clone=function(){var t=new e(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t},e.prototype.closestPointXY=function(t,e,i,o){var n=this.flatCoordinates,r=t-n[0],s=e-n[1],a=r*r+s*s;if(a<o){if(0===a)for(var h=0;h<this.stride;++h)i[h]=n[h];else{var u=this.getRadius()/Math.sqrt(a);for(i[0]=n[0]+u*r,i[1]=n[1]+u*s,h=2;h<this.stride;++h)i[h]=n[h]}return i.length=this.stride,a}return o},e.prototype.containsXY=function(t,e){var i=this.flatCoordinates,o=t-i[0],n=e-i[1];return o*o+n*n<=this.getRadiusSquared_()},e.prototype.getCenter=function(){return this.flatCoordinates.slice(0,this.stride)},e.prototype.computeExtent=function(t){var e=this.flatCoordinates,i=e[this.stride]-e[0];return(0,s.createOrUpdate)(e[0]-i,e[1]-i,e[0]+i,e[1]+i,t)},e.prototype.getRadius=function(){return Math.sqrt(this.getRadiusSquared_())},e.prototype.getRadiusSquared_=function(){var t=this.flatCoordinates[this.stride]-this.flatCoordinates[0],e=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return t*t+e*e},e.prototype.getType=function(){return n.Z.CIRCLE},e.prototype.intersectsExtent=function(t){var e=this.getExtent();if((0,s.intersects)(t,e)){var i=this.getCenter();return t[0]<=i[0]&&t[2]>=i[0]||t[1]<=i[1]&&t[3]>=i[1]||(0,s.forEachCorner)(t,this.intersectsCoordinate.bind(this))}return!1},e.prototype.setCenter=function(t){var e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],o=t.slice();o[e]=o[0]+i;for(var n=1;n<e;++n)o[e+n]=t[n];this.setFlatCoordinates(this.layout,o),this.changed()},e.prototype.setCenterAndRadius=function(t,e,i){this.setLayout(i,t,0),this.flatCoordinates||(this.flatCoordinates=[]);var o=this.flatCoordinates,n=(0,a.IG)(o,0,t,this.stride);o[n++]=o[0]+e;for(var r=1,s=this.stride;r<s;++r)o[n++]=o[r];o.length=n,this.changed()},e.prototype.getCoordinates=function(){return null},e.prototype.setCoordinates=function(t,e){},e.prototype.setRadius=function(t){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+t,this.changed()},e.prototype.rotate=function(t,e){var i=this.getCenter(),o=this.getStride();this.setCenter((0,h.U1)(i,0,i.length,o,t,e,i)),this.changed()},e.prototype.translate=function(t,e){var i=this.getCenter(),o=this.getStride();this.setCenter((0,h.Iu)(i,0,i.length,o,t,e,i)),this.changed()},e}(r.ZP);d.prototype.transform;const c=d},5010:(t,e,i)=>{i.d(e,{N_:()=>S,ZP:()=>Z});var o,n=i(7276),r=i(291),s=i(5487),a=i(1090),h=i(4754),u=i(4049),d=i(2083),c=i(8630),_=i(2217),l=i(7403),p=i(6259),f=i(3643),g=i(188),y=i(4515),m=i(2033),v=i(9271),C=i(933),k=i(6885),w=i(8683),P=i(7539),E=i(2290),T=i(1900),F=(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),x="Point",L="LineString",G="Polygon",D="Circle",M="drawstart",O=function(t){function e(e,i){var o=t.call(this,e)||this;return o.feature=i,o}return F(e,t),e}(r.ZP);function S(t,e){return function(i,o,r){var s=(0,E.fromUserCoordinate)(i[0],r),a=(0,E.fromUserCoordinate)(i[i.length-1],r),h=Math.sqrt((0,T.bI)(s,a)),u=o||(0,m.Bb)(new n.Z(s),t),d=e;if(!e&&0!==e){var c=a[0]-s[0],_=a[1]-s[1];d=Math.atan2(_,c)}(0,m.Ej)(u,s,h,d);var l=(0,E.getUserProjection)();return l&&u.transform(r,l),u}}const Z=function(t){function e(e){var i=this,o=e;o.stopDown||(o.stopDown=k.Dv),(i=t.call(this,o)||this).on,i.once,i.un,i.shouldHandle_=!1,i.downPx_=null,i.downTimeout_,i.lastDragTime_,i.pointerType_,i.freehand_=!1,i.source_=e.source?e.source:null,i.features_=e.features?e.features:null,i.snapTolerance_=e.snapTolerance?e.snapTolerance:12,i.type_=e.type,i.mode_=function(t){switch(t){case h.Z.POINT:case h.Z.MULTI_POINT:return x;case h.Z.LINE_STRING:case h.Z.MULTI_LINE_STRING:return L;case h.Z.POLYGON:case h.Z.MULTI_POLYGON:return G;case h.Z.CIRCLE:return D;default:throw new Error("Invalid type: "+t)}}(i.type_),i.stopClick_=!!e.stopClick,i.minPoints_=e.minPoints?e.minPoints:i.mode_===G?3:2,i.maxPoints_=i.mode_===D?2:e.maxPoints?e.maxPoints:1/0,i.finishCondition_=e.finishCondition?e.finishCondition:k.uX;var r,s=e.geometryFunction;if(!s){var a,c=i.mode_;c===D?s=function(t,e,i){var o=e||new n.Z([NaN,NaN]),r=(0,E.fromUserCoordinate)(t[0],i),s=(0,T.bI)(r,(0,E.fromUserCoordinate)(t[t.length-1],i));o.setCenterAndRadius(r,Math.sqrt(s));var a=(0,E.getUserProjection)();return a&&o.transform(i,a),o}:(c===x?a=g.default:c===L?a=d.Z:c===G&&(a=m.ZP),s=function(t,e,i){return e?c===G?t[0].length?e.setCoordinates([t[0].concat([t[0][0]])]):e.setCoordinates([]):e.setCoordinates(t):e=new a(t),e})}return i.geometryFunction_=s,i.dragVertexDelay_=void 0!==e.dragVertexDelay?e.dragVertexDelay:500,i.finishCoordinate_=null,i.sketchFeature_=null,i.sketchPoint_=null,i.sketchCoords_=null,i.sketchLine_=null,i.sketchLineCoords_=null,i.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,i.overlay_=new v.default({source:new C.default({useSpatialIndex:!1,wrapX:!!e.wrapX&&e.wrapX}),style:e.style?e.style:(r=(0,P.createEditingStyle)(),function(t,e){return r[t.getGeometry().getType()]}),updateWhileInteracting:!0}),i.geometryName_=e.geometryName,i.condition_=e.condition?e.condition:w.rM,i.freehandCondition_,e.freehand?i.freehandCondition_=w.Bx:i.freehandCondition_=e.freehandCondition?e.freehandCondition:w.vY,i.addChangeListener(u.Z.ACTIVE,i.updateState_),i}return F(e,t),e.prototype.setMap=function(e){t.prototype.setMap.call(this,e),this.updateState_()},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleEvent=function(e){e.originalEvent.type===s.Z.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!==x&&this.freehandCondition_(e);var i=e.type===_.Z.POINTERMOVE,o=!0;return!this.freehand_&&this.lastDragTime_&&e.type===_.Z.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,i=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===_.Z.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),o=!1):this.freehand_&&e.type===_.Z.POINTERDOWN?o=!1:i&&this.getPointerCount()<2?(o=e.type===_.Z.POINTERMOVE)&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):("mouse"===e.originalEvent.pointerType||e.type===_.Z.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===_.Z.DBLCLICK&&(o=!1),t.prototype.handleEvent.call(this,e)&&o},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new c.Z(_.Z.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)},e.prototype.handleUpEvent=function(t){var e=!0;if(0===this.getPointerCount())if(this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t),this.shouldHandle_){var i=!this.finishCoordinate_;i&&this.startDrawing_(t.coordinate),!i&&this.freehand_?this.finishDrawing():this.freehand_||i&&this.mode_!==x||(this.atFinish_(t.pixel)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate)),e=!1}else this.freehand_&&this.abortDrawing();return!e&&this.stopClick_&&t.preventDefault(),e},e.prototype.handlePointerMove_=function(t){if(this.pointerType_=t.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,i=t.pixel,o=e[0]-i[0],n=e[1]-i[1],r=o*o+n*n;if(this.shouldHandle_=this.freehand_?r>this.squaredClickTolerance_:r<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?this.modifyDrawing_(t.coordinate):this.createOrUpdateSketchPoint_(t.coordinate.slice())},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var i=!1,o=[this.finishCoordinate_],n=this.mode_;if(n===x)e=!0;else if(n===D)e=2===this.sketchCoords_.length;else if(n===L)i=this.sketchCoords_.length>this.minPoints_;else if(n===G){var r=this.sketchCoords_;i=r[0].length>this.minPoints_,o=[r[0][0],r[0][r[0].length-2]]}if(i)for(var s=this.getMap(),a=0,h=o.length;a<h;a++){var u=o[a],d=s.getPixelFromCoordinate(u),c=t[0]-d[0],_=t[1]-d[1],l=this.freehand_?1:this.snapTolerance_;if(e=Math.sqrt(c*c+_*_)<=l){this.finishCoordinate_=u;break}}}return e},e.prototype.createOrUpdateSketchPoint_=function(t){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(t):(this.sketchPoint_=new a.default(new g.default(t)),this.updateSketchFeatures_())},e.prototype.createOrUpdateCustomSketchLine_=function(t){this.sketchLine_||(this.sketchLine_=new a.default);var e=t.getLinearRing(0),i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(e.getLayout(),e.getFlatCoordinates()),i.changed()):(i=new d.Z(e.getFlatCoordinates(),e.getLayout()),this.sketchLine_.setGeometry(i))},e.prototype.startDrawing_=function(t){var e=this.getMap().getView().getProjection();this.finishCoordinate_=t,this.mode_===x?this.sketchCoords_=t.slice():this.mode_===G?(this.sketchCoords_=[[t.slice(),t.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[t.slice(),t.slice()],this.sketchLineCoords_&&(this.sketchLine_=new a.default(new d.Z(this.sketchLineCoords_)));var i=this.geometryFunction_(this.sketchCoords_,void 0,e);this.sketchFeature_=new a.default,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(i),this.updateSketchFeatures_(),this.dispatchEvent(new O(M,this.sketchFeature_))},e.prototype.modifyDrawing_=function(t){var e,i,o=this.getMap(),n=this.sketchFeature_.getGeometry(),r=o.getView().getProjection();this.mode_===x?i=this.sketchCoords_:this.mode_===G?(i=(e=this.sketchCoords_[0])[e.length-1],this.atFinish_(o.getPixelFromCoordinate(t))&&(t=this.finishCoordinate_.slice())):i=(e=this.sketchCoords_)[e.length-1],i[0]=t[0],i[1]=t[1],this.geometryFunction_(this.sketchCoords_,n,r),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(t),n.getType()===h.Z.POLYGON&&this.mode_!==G?this.createOrUpdateCustomSketchLine_(n):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()},e.prototype.addToDrawing_=function(t){var e,i,o=this.sketchFeature_.getGeometry(),n=this.getMap().getView().getProjection(),r=this.mode_;r===L||r===D?(this.finishCoordinate_=t.slice(),(i=this.sketchCoords_).length>=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(t.slice()),this.geometryFunction_(i,o,n)):r===G&&((i=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(t.slice()),e&&(this.finishCoordinate_=i[0]),this.geometryFunction_(this.sketchCoords_,o,n)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),o=this.mode_;if(o===L||o===D){if((t=this.sketchCoords_).splice(-2,1),t.length>=2){this.finishCoordinate_=t[t.length-2].slice();var n=this.finishCoordinate_.slice();t[t.length-1]=n,this.createOrUpdateSketchPoint_(n)}this.geometryFunction_(t,e,i),e.getType()===h.Z.POLYGON&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if(o===G){(t=this.sketchCoords_[0]).splice(-2,1);var r=this.sketchLine_.getGeometry();t.length>=2&&(n=t[t.length-2].slice(),t[t.length-1]=n,this.createOrUpdateSketchPoint_(n)),r.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,i)}1===t.length&&this.abortDrawing(),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,i=t.getGeometry(),o=this.getMap().getView().getProjection();this.mode_===L?(e.pop(),this.geometryFunction_(e,i,o)):this.mode_===G&&(e[0].pop(),this.geometryFunction_(e,i,o),e=i.getCoordinates()),this.type_===h.Z.MULTI_POINT?t.setGeometry(new p.Z([e])):this.type_===h.Z.MULTI_LINE_STRING?t.setGeometry(new l.Z([e])):this.type_===h.Z.MULTI_POLYGON&&t.setGeometry(new f.Z([e])),this.dispatchEvent(new O("drawend",t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),t},e.prototype.abortDrawing=function(){var t=this.abortDrawing_();t&&this.dispatchEvent(new O("drawabort",t))},e.prototype.appendCoordinates=function(t){var e,i=this.mode_,o=!this.sketchFeature_;if(o&&this.startDrawing_(t[0]),i===L||i===D)e=this.sketchCoords_;else{if(i!==G)return;e=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}o&&e.shift(),e.pop();for(var n=0;n<t.length;n++)this.addToDrawing_(t[n]);var r=t[t.length-1];this.addToDrawing_(r),this.modifyDrawing_(r)},e.prototype.extend=function(t){var e=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=e.getCoordinates();var i=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=i.slice(),this.sketchCoords_.push(i.slice()),this.sketchPoint_=new a.default(new g.default(i)),this.updateSketchFeatures_(),this.dispatchEvent(new O(M,this.sketchFeature_))},e.prototype.updateSketchFeatures_=function(){var t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);var e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)},e.prototype.updateState_=function(){var t=this.getMap(),e=this.getActive();t&&e||this.abortDrawing(),this.overlay_.setMap(e?t:null)},e}(y.Z)},6002:(t,e,i)=>{i.d(e,{Z:()=>k});var o,n=i(2071),r=i(5487),s=i(4754),a=i(4515),h=i(9781),u=i(2796),d=i(6885),c=i(8641),_=i(1900),l=i(2033),p=i(2290),f=i(4187),g=i(9374),y=i(5818),m=(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});function v(t){return t.feature?t.feature:t.element?t.element:void 0}var C=[];const k=function(t){function e(e){var i=this,o=e||{},n=o;return n.handleDownEvent||(n.handleDownEvent=d.uX),n.stopDown||(n.stopDown=d.Dv),(i=t.call(this,n)||this).source_=o.source?o.source:null,i.vertex_=void 0===o.vertex||o.vertex,i.edge_=void 0===o.edge||o.edge,i.features_=o.features?o.features:null,i.featuresListenerKeys_=[],i.featureChangeListenerKeys_={},i.indexedFeaturesExtents_={},i.pendingFeatures_={},i.pixelTolerance_=void 0!==o.pixelTolerance?o.pixelTolerance:10,i.rBush_=new h.Z,i.GEOMETRY_SEGMENTERS_={Point:i.segmentPointGemetry_.bind(i),LineString:i.segmentLineStringGemetry_.bind(i),LinearRing:i.segmentLineStringGemetry_.bind(i),Polygon:i.segmentPolygonGemetry_.bind(i),MultiPoint:i.segmentMultiPointGemetry_.bind(i),MultiLineString:i.segmentMultiLineStringGemetry_.bind(i),MultiPolygon:i.segmentMultiPolygonGemetry_.bind(i),GeometryCollection:i.segmentGeometryCollectionGemetry_.bind(i),Circle:i.segmentCircleGemetry_.bind(i)},i}return m(e,t),e.prototype.addFeature=function(t,e){var i=void 0===e||e,o=(0,f.sq)(t),n=t.getGeometry();if(n){var s=this.GEOMETRY_SEGMENTERS_[n.getType()];if(s){this.indexedFeaturesExtents_[o]=n.getExtent((0,c.createEmpty)());var a=[];if(s(a,n),1===a.length)this.rBush_.insert((0,c.boundingExtent)(a[0]),{feature:t,segment:a[0]});else if(a.length>1){var h=a.map((function(t){return(0,c.boundingExtent)(t)})),u=a.map((function(e){return{feature:t,segment:e}}));this.rBush_.load(h,u)}}}i&&(this.featureChangeListenerKeys_[o]=(0,y.oL)(t,r.Z.CHANGE,this.handleFeatureChange_,this))},e.prototype.forEachFeatureAdd_=function(t){this.addFeature(t)},e.prototype.forEachFeatureRemove_=function(t){this.removeFeature(t)},e.prototype.getFeatures_=function(){var t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t},e.prototype.handleEvent=function(e){var i=this.snapTo(e.pixel,e.coordinate,e.map);return i&&(e.coordinate=i.vertex.slice(0,2),e.pixel=i.vertexPixel),t.prototype.handleEvent.call(this,e)},e.prototype.handleFeatureAdd_=function(t){var e=v(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=v(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var i=(0,f.sq)(e);i in this.pendingFeatures_||(this.pendingFeatures_[i]=e)}else this.updateFeature_(e)},e.prototype.handleUpEvent=function(t){var e=(0,g.KX)(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1},e.prototype.removeFeature=function(t,e){var i=void 0===e||e,o=(0,f.sq)(t),n=this.indexedFeaturesExtents_[o];if(n){var r=this.rBush_,s=[];r.forEachInExtent(n,(function(e){t===e.feature&&s.push(e)}));for(var a=s.length-1;a>=0;--a)r.remove(s[a])}i&&((0,y.bN)(this.featureChangeListenerKeys_[o]),delete this.featureChangeListenerKeys_[o])},e.prototype.setMap=function(e){var i=this.getMap(),o=this.featuresListenerKeys_,r=this.getFeatures_();i&&(o.forEach(y.bN),o.length=0,r.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?o.push((0,y.oL)(this.features_,n.Z.ADD,this.handleFeatureAdd_,this),(0,y.oL)(this.features_,n.Z.REMOVE,this.handleFeatureRemove_,this)):this.source_&&o.push((0,y.oL)(this.source_,u.Z.ADDFEATURE,this.handleFeatureAdd_,this),(0,y.oL)(this.source_,u.Z.REMOVEFEATURE,this.handleFeatureRemove_,this)),r.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,i){var o=i.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),n=i.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_]),r=(0,c.boundingExtent)([o,n]),a=this.rBush_.getInExtent(r),h=a.length;if(0===h)return null;var u,d=i.getView().getProjection(),l=(0,p.fromUserCoordinate)(e,d),f=1/0,g=this.pixelTolerance_*this.pixelTolerance_,y=function(){if(u){var e=i.getPixelFromCoordinate(u);if((0,_.bI)(t,e)<=g)return{vertex:u,vertexPixel:[Math.round(e[0]),Math.round(e[1])]}}return null};if(this.vertex_){for(var m=0;m<h;++m)(v=a[m]).feature.getGeometry().getType()!==s.Z.CIRCLE&&v.segment.forEach((function(t){var e=(0,p.fromUserCoordinate)(t,d),i=(0,_.bI)(l,e);i<f&&(u=t,f=i)}));if(L=y())return L}if(this.edge_){for(m=0;m<h;++m){var v,k=null;if((v=a[m]).feature.getGeometry().getType()===s.Z.CIRCLE){var w=v.feature.getGeometry(),P=(0,p.getUserProjection)();P&&(w=w.clone().transform(P,d)),k=(0,p.toUserCoordinate)((0,_.Ed)(l,w),d)}else{var E=v.segment,T=E[0],F=E[1];F&&(C[0]=(0,p.fromUserCoordinate)(T,d),C[1]=(0,p.fromUserCoordinate)(F,d),k=(0,_.oL)(l,C))}if(k){var x=(0,_.bI)(l,k);x<f&&(u=k,f=x)}}var L;if(L=y())return L}return null},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.segmentCircleGemetry_=function(t,e){var i=this.getMap().getView().getProjection(),o=e,n=(0,p.getUserProjection)();n&&(o=o.clone().transform(n,i));var r=(0,l.Bb)(o);n&&r.transform(i,n);for(var s=r.getCoordinates()[0],a=0,h=s.length-1;a<h;++a)t.push(s.slice(a,a+2))},e.prototype.segmentGeometryCollectionGemetry_=function(t,e){for(var i=e.getGeometriesArray(),o=0;o<i.length;++o){var n=this.GEOMETRY_SEGMENTERS_[i[o].getType()];n&&n(t,i[o])}},e.prototype.segmentLineStringGemetry_=function(t,e){for(var i=e.getCoordinates(),o=0,n=i.length-1;o<n;++o)t.push(i.slice(o,o+2))},e.prototype.segmentMultiLineStringGemetry_=function(t,e){for(var i=e.getCoordinates(),o=0,n=i.length;o<n;++o)for(var r=i[o],s=0,a=r.length-1;s<a;++s)t.push(r.slice(s,s+2))},e.prototype.segmentMultiPointGemetry_=function(t,e){e.getCoordinates().forEach((function(e){t.push([e])}))},e.prototype.segmentMultiPolygonGemetry_=function(t,e){for(var i=e.getCoordinates(),o=0,n=i.length;o<n;++o)for(var r=i[o],s=0,a=r.length;s<a;++s)for(var h=r[s],u=0,d=h.length-1;u<d;++u)t.push(h.slice(u,u+2))},e.prototype.segmentPointGemetry_=function(t,e){t.push([e.getCoordinates()])},e.prototype.segmentPolygonGemetry_=function(t,e){for(var i=e.getCoordinates(),o=0,n=i.length;o<n;++o)for(var r=i[o],s=0,a=r.length-1;s<a;++s)t.push(r.slice(s,s+2))},e}(a.Z)}}]); |