1 line
24 KiB
JavaScript
1 line
24 KiB
JavaScript
"use strict";(self.webpackChunk_farmos_org_farmos_map=self.webpackChunk_farmos_org_farmos_map||[]).push([[243],{8373:(e,t,r)=>{r.d(t,{Z:()=>G});var i,n=r(8714),o=r(2071),a=r(291),s=r(5487),u=r(1090),h=r(4754),l=r(2217),d=r(188),g=r(4515),_=r(9781),f=r(2796),c=r(9271),p=r(933),y=r(8683),v=r(8641),m=r(1900),x=r(7539),C=r(5537),E=r(2033),F=r(2290),S=r(4187),T=(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),P=[0,0,0,0],b=[],L="modifyend",w=function(e){function t(t,r,i){var n=e.call(this,t)||this;return n.features=r,n.mapBrowserEvent=i,n}return T(t,e),t}(a.ZP);function M(e,t){return e.index-t.index}function I(e,t,r){var i=t.geometry;if(i.getType()===h.Z.CIRCLE){var n=i;if(1===t.index){var o=(0,F.getUserProjection)();o&&(n=n.clone().transform(o,r));var a=(0,m.bI)(n.getCenter(),(0,F.fromUserCoordinate)(e,r)),s=Math.sqrt(a)-n.getRadius();return s*s}}var u=(0,F.fromUserCoordinate)(e,r);return b[0]=(0,F.fromUserCoordinate)(t.segment[0],r),b[1]=(0,F.fromUserCoordinate)(t.segment[1],r),(0,m.Bs)(u,b)}function A(e,t,r){var i=t.geometry;if(i.getType()===h.Z.CIRCLE&&1===t.index){var n=i,o=(0,F.getUserProjection)();return o&&(n=n.clone().transform(o,r)),(0,F.toUserCoordinate)(n.getClosestPoint((0,F.fromUserCoordinate)(e,r)),r)}var a=(0,F.fromUserCoordinate)(e,r);return b[0]=(0,F.fromUserCoordinate)(t.segment[0],r),b[1]=(0,F.fromUserCoordinate)(t.segment[1],r),(0,F.toUserCoordinate)((0,m.oL)(a,b),r)}const G=function(e){function t(t){var r,i,a=e.call(this,t)||this;if(a.on,a.once,a.un,a.boundHandleFeatureChange_=a.handleFeatureChange_.bind(a),a.condition_=t.condition?t.condition:y.Xp,a.defaultDeleteCondition_=function(e){return(0,y.Ko)(e)&&(0,y.Kf)(e)},a.deleteCondition_=t.deleteCondition?t.deleteCondition:a.defaultDeleteCondition_,a.insertVertexCondition_=t.insertVertexCondition?t.insertVertexCondition:y.Bx,a.vertexFeature_=null,a.vertexSegments_=null,a.lastPixel_=[0,0],a.ignoreNextSingleClick_=!1,a.featuresBeingModified_=null,a.rBush_=new _.Z,a.pixelTolerance_=void 0!==t.pixelTolerance?t.pixelTolerance:10,a.snappedToVertex_=!1,a.changingFeature_=!1,a.dragSegments_=[],a.overlay_=new c.default({source:new p.default({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.style?t.style:(r=(0,x.createEditingStyle)(),function(e,t){return r[h.Z.POINT]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),a.SEGMENT_WRITERS_={Point:a.writePointGeometry_.bind(a),LineString:a.writeLineStringGeometry_.bind(a),LinearRing:a.writeLineStringGeometry_.bind(a),Polygon:a.writePolygonGeometry_.bind(a),MultiPoint:a.writeMultiPointGeometry_.bind(a),MultiLineString:a.writeMultiLineStringGeometry_.bind(a),MultiPolygon:a.writeMultiPolygonGeometry_.bind(a),Circle:a.writeCircleGeometry_.bind(a),GeometryCollection:a.writeGeometryCollectionGeometry_.bind(a)},a.source_=null,a.hitDetection_=null,t.features?i=t.features:t.source&&(a.source_=t.source,i=new n.Z(a.source_.getFeatures()),a.source_.addEventListener(f.Z.ADDFEATURE,a.handleSourceAdd_.bind(a)),a.source_.addEventListener(f.Z.REMOVEFEATURE,a.handleSourceRemove_.bind(a))),!i)throw new Error("The modify interaction requires features, a source or a layer");return t.hitDetection&&(a.hitDetection_=t.hitDetection),a.features_=i,a.features_.forEach(a.addFeature_.bind(a)),a.features_.addEventListener(o.Z.ADD,a.handleFeatureAdd_.bind(a)),a.features_.addEventListener(o.Z.REMOVE,a.handleFeatureRemove_.bind(a)),a.lastPointerEvent_=null,a.delta_=[0,0],a.snapToPointer_=void 0===t.snapToPointer?!a.hitDetection_:t.snapToPointer,a}return T(t,e),t.prototype.addFeature_=function(e){var t=e.getGeometry();if(t){var r=this.SEGMENT_WRITERS_[t.getType()];r&&r(e,t)}var i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,i),e.addEventListener(s.Z.CHANGE,this.boundHandleFeatureChange_)},t.prototype.willModifyFeatures_=function(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new n.Z;for(var r=this.featuresBeingModified_.getArray(),i=0,o=t.length;i<o;++i)for(var a=t[i],s=0,u=a.length;s<u;++s){var h=a[s].feature;h&&-1===r.indexOf(h)&&this.featuresBeingModified_.push(h)}0===this.featuresBeingModified_.getLength()?this.featuresBeingModified_=null:this.dispatchEvent(new w("modifystart",this.featuresBeingModified_,e))}},t.prototype.removeFeature_=function(e){this.removeFeatureSegmentData_(e),this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.removeEventListener(s.Z.CHANGE,this.boundHandleFeatureChange_)},t.prototype.removeFeatureSegmentData_=function(e){var t=this.rBush_,r=[];t.forEach((function(t){e===t.feature&&r.push(t)}));for(var i=r.length-1;i>=0;--i){for(var n=r[i],o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===n&&this.dragSegments_.splice(o,1);t.remove(n)}},t.prototype.setActive=function(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.prototype.setActive.call(this,t)},t.prototype.setMap=function(t){this.overlay_.setMap(t),e.prototype.setMap.call(this,t)},t.prototype.getOverlay=function(){return this.overlay_},t.prototype.handleSourceAdd_=function(e){e.feature&&this.features_.push(e.feature)},t.prototype.handleSourceRemove_=function(e){e.feature&&this.features_.remove(e.feature)},t.prototype.handleFeatureAdd_=function(e){this.addFeature_(e.element)},t.prototype.handleFeatureChange_=function(e){if(!this.changingFeature_){var t=e.target;this.removeFeature_(t),this.addFeature_(t)}},t.prototype.handleFeatureRemove_=function(e){var t=e.element;this.removeFeature_(t)},t.prototype.writePointGeometry_=function(e,t){var r=t.getCoordinates(),i={feature:e,geometry:t,segment:[r,r]};this.rBush_.insert(t.getExtent(),i)},t.prototype.writeMultiPointGeometry_=function(e,t){for(var r=t.getCoordinates(),i=0,n=r.length;i<n;++i){var o=r[i],a={feature:e,geometry:t,depth:[i],index:i,segment:[o,o]};this.rBush_.insert(t.getExtent(),a)}},t.prototype.writeLineStringGeometry_=function(e,t){for(var r=t.getCoordinates(),i=0,n=r.length-1;i<n;++i){var o=r.slice(i,i+2),a={feature:e,geometry:t,index:i,segment:o};this.rBush_.insert((0,v.boundingExtent)(o),a)}},t.prototype.writeMultiLineStringGeometry_=function(e,t){for(var r=t.getCoordinates(),i=0,n=r.length;i<n;++i)for(var o=r[i],a=0,s=o.length-1;a<s;++a){var u=o.slice(a,a+2),h={feature:e,geometry:t,depth:[i],index:a,segment:u};this.rBush_.insert((0,v.boundingExtent)(u),h)}},t.prototype.writePolygonGeometry_=function(e,t){for(var r=t.getCoordinates(),i=0,n=r.length;i<n;++i)for(var o=r[i],a=0,s=o.length-1;a<s;++a){var u=o.slice(a,a+2),h={feature:e,geometry:t,depth:[i],index:a,segment:u};this.rBush_.insert((0,v.boundingExtent)(u),h)}},t.prototype.writeMultiPolygonGeometry_=function(e,t){for(var r=t.getCoordinates(),i=0,n=r.length;i<n;++i)for(var o=r[i],a=0,s=o.length;a<s;++a)for(var u=o[a],h=0,l=u.length-1;h<l;++h){var d=u.slice(h,h+2),g={feature:e,geometry:t,depth:[a,i],index:h,segment:d};this.rBush_.insert((0,v.boundingExtent)(d),g)}},t.prototype.writeCircleGeometry_=function(e,t){var r=t.getCenter(),i={feature:e,geometry:t,index:0,segment:[r,r]},n={feature:e,geometry:t,index:1,segment:[r,r]},o=[i,n];i.featureSegments=o,n.featureSegments=o,this.rBush_.insert((0,v.createOrUpdateFromCoordinate)(r),i);var a=t,s=(0,F.getUserProjection)();if(s&&this.getMap()){var u=this.getMap().getView().getProjection();a=a.clone().transform(s,u),a=(0,E.Bb)(a).transform(u,s)}this.rBush_.insert(a.getExtent(),n)},t.prototype.writeGeometryCollectionGeometry_=function(e,t){for(var r=t.getGeometriesArray(),i=0;i<r.length;++i){var n=r[i];(0,this.SEGMENT_WRITERS_[n.getType()])(e,n)}},t.prototype.createOrUpdateVertexFeature_=function(e,t,r){var i=this.vertexFeature_;return i?i.getGeometry().setCoordinates(e):(i=new u.default(new d.default(e)),this.vertexFeature_=i,this.overlay_.getSource().addFeature(i)),i.set("features",t),i.set("geometries",r),i},t.prototype.handleEvent=function(t){return!t.originalEvent||(this.lastPointerEvent_=t,t.map.getView().getInteracting()||t.type!=l.Z.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(t),this.vertexFeature_&&this.deleteCondition_(t)&&(r=!(t.type!=l.Z.SINGLECLICK||!this.ignoreNextSingleClick_)||this.removePoint()),t.type==l.Z.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),e.prototype.handleEvent.call(this,t)&&!r);var r},t.prototype.handleDragEvent=function(e){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(e,this.dragSegments_);for(var t=[e.coordinate[0]+this.delta_[0],e.coordinate[1]+this.delta_[1]],r=[],i=[],n=0,o=this.dragSegments_.length;n<o;++n){var a=this.dragSegments_[n],s=a[0],u=s.feature;-1===r.indexOf(u)&&r.push(u);var l=s.geometry;-1===i.indexOf(l)&&i.push(l);for(var d=s.depth,g=void 0,_=s.segment,f=a[1];t.length<l.getStride();)t.push(_[f][t.length]);switch(l.getType()){case h.Z.POINT:g=t,_[0]=t,_[1]=t;break;case h.Z.MULTI_POINT:(g=l.getCoordinates())[s.index]=t,_[0]=t,_[1]=t;break;case h.Z.LINE_STRING:(g=l.getCoordinates())[s.index+f]=t,_[f]=t;break;case h.Z.MULTI_LINE_STRING:case h.Z.POLYGON:(g=l.getCoordinates())[d[0]][s.index+f]=t,_[f]=t;break;case h.Z.MULTI_POLYGON:(g=l.getCoordinates())[d[1]][d[0]][s.index+f]=t,_[f]=t;break;case h.Z.CIRCLE:if(_[0]=t,_[1]=t,0===s.index)this.changingFeature_=!0,l.setCenter(t),this.changingFeature_=!1;else{this.changingFeature_=!0;var c=e.map.getView().getProjection(),p=(0,m.TE)((0,F.fromUserCoordinate)(l.getCenter(),c),(0,F.fromUserCoordinate)(t,c)),y=(0,F.getUserProjection)();if(y){var v=l.clone().transform(y,c);v.setRadius(p),p=v.transform(c,y).getRadius()}l.setRadius(p),this.changingFeature_=!1}}g&&this.setGeometryCoordinates_(l,g)}this.createOrUpdateVertexFeature_(t,r,i)},t.prototype.handleDownEvent=function(e){if(!this.condition_(e))return!1;var t=e.coordinate;this.handlePointerAtPixel_(e.pixel,e.map,t),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var i=e.map.getView().getProjection(),n=[],o=r.getGeometry().getCoordinates(),a=(0,v.boundingExtent)([o]),s=this.rBush_.getInExtent(a),u={};s.sort(M);for(var l=0,d=s.length;l<d;++l){var g=s[l],_=g.segment,f=(0,S.sq)(g.geometry),c=g.depth;if(c&&(f+="-"+c.join("-")),u[f]||(u[f]=new Array(2)),g.geometry.getType()!==h.Z.CIRCLE||1!==g.index)if(!(0,m.fS)(_[0],o)||u[f][0])if(!(0,m.fS)(_[1],o)||u[f][1])(0,S.sq)(_)in this.vertexSegments_&&!u[f][0]&&!u[f][1]&&this.insertVertexCondition_(e)&&n.push(g);else{if((g.geometry.getType()===h.Z.LINE_STRING||g.geometry.getType()===h.Z.MULTI_LINE_STRING)&&u[f][0]&&0===u[f][0].index)continue;this.dragSegments_.push([g,1]),u[f][1]=g}else this.dragSegments_.push([g,0]),u[f][0]=g;else{var p=A(t,g,i);(0,m.fS)(p,o)&&!u[f][0]&&(this.dragSegments_.push([g,0]),u[f][0]=g)}}n.length&&this.willModifyFeatures_(e,[n]);for(var y=n.length-1;y>=0;--y)this.insertVertex_(n[y],o)}return!!this.vertexFeature_},t.prototype.handleUpEvent=function(e){for(var t=this.dragSegments_.length-1;t>=0;--t){var r=this.dragSegments_[t][0],i=r.geometry;if(i.getType()===h.Z.CIRCLE){var n=i.getCenter(),o=r.featureSegments[0],a=r.featureSegments[1];o.segment[0]=n,o.segment[1]=n,a.segment[0]=n,a.segment[1]=n,this.rBush_.update((0,v.createOrUpdateFromCoordinate)(n),o);var s=i,u=(0,F.getUserProjection)();if(u){var l=e.map.getView().getProjection();s=s.clone().transform(u,l),s=(0,E.Bb)(s).transform(l,u)}this.rBush_.update(s.getExtent(),a)}else this.rBush_.update((0,v.boundingExtent)(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new w(L,this.featuresBeingModified_,e)),this.featuresBeingModified_=null),!1},t.prototype.handlePointerMove_=function(e){this.lastPixel_=e.pixel,this.handlePointerAtPixel_(e.pixel,e.map,e.coordinate)},t.prototype.handlePointerAtPixel_=function(e,t,r){var i,n,o=this,a=r||t.getCoordinateFromPixel(e),s=t.getView().getProjection();if(this.hitDetection_){var u="object"==typeof this.hitDetection_?function(e){return e===o.hitDetection_}:void 0;t.forEachFeatureAtPixel(e,(function(e,t,r){if((r=r||e.getGeometry()).getType()===h.Z.POINT&&(0,C.q9)(o.features_.getArray(),e)){n=r;var a=r.getFlatCoordinates().slice(0,2);i=[{feature:e,geometry:r,segment:[a,a]}]}return!0}),{layerFilter:u})}if(!i){var l=(0,F.fromUserExtent)((0,v.createOrUpdateFromCoordinate)(a,P),s),d=t.getView().getResolution()*this.pixelTolerance_,g=(0,F.toUserExtent)((0,v.buffer)(l,d,P),s);i=this.rBush_.getInExtent(g)}if(i&&i.length>0){var _=i.sort((function(e,t){return I(a,e,s)-I(a,t,s)}))[0],f=_.segment,c=A(a,_,s),p=t.getPixelFromCoordinate(c),y=(0,m.TE)(e,p);if(n||y<=this.pixelTolerance_){var x={};if(x[(0,S.sq)(f)]=!0,this.snapToPointer_||(this.delta_[0]=c[0]-a[0],this.delta_[1]=c[1]-a[1]),_.geometry.getType()===h.Z.CIRCLE&&1===_.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(c,[_.feature],[_.geometry]);else{var E=t.getPixelFromCoordinate(f[0]),T=t.getPixelFromCoordinate(f[1]),b=(0,m.bI)(p,E),L=(0,m.bI)(p,T);y=Math.sqrt(Math.min(b,L)),this.snappedToVertex_=y<=this.pixelTolerance_,this.snappedToVertex_&&(c=b>L?f[1]:f[0]),this.createOrUpdateVertexFeature_(c,[_.feature],[_.geometry]);var w={};w[(0,S.sq)(_.geometry)]=!0;for(var M=1,G=i.length;M<G;++M){var Z=i[M].segment;if(!((0,m.fS)(f[0],Z[0])&&(0,m.fS)(f[1],Z[1])||(0,m.fS)(f[0],Z[1])&&(0,m.fS)(f[1],Z[0])))break;var O=(0,S.sq)(i[M].geometry);O in w||(w[O]=!0,x[(0,S.sq)(Z)]=!0)}}return void(this.vertexSegments_=x)}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},t.prototype.insertVertex_=function(e,t){for(var r,i=e.segment,n=e.feature,o=e.geometry,a=e.depth,s=e.index;t.length<o.getStride();)t.push(0);switch(o.getType()){case h.Z.MULTI_LINE_STRING:case h.Z.POLYGON:(r=o.getCoordinates())[a[0]].splice(s+1,0,t);break;case h.Z.MULTI_POLYGON:(r=o.getCoordinates())[a[1]][a[0]].splice(s+1,0,t);break;case h.Z.LINE_STRING:(r=o.getCoordinates()).splice(s+1,0,t);break;default:return}this.setGeometryCoordinates_(o,r);var u=this.rBush_;u.remove(e),this.updateSegmentIndices_(o,s,a,1);var l={segment:[i[0],t],feature:n,geometry:o,depth:a,index:s};u.insert((0,v.boundingExtent)(l.segment),l),this.dragSegments_.push([l,1]);var d={segment:[t,i[1]],feature:n,geometry:o,depth:a,index:s+1};u.insert((0,v.boundingExtent)(d.segment),d),this.dragSegments_.push([d,0]),this.ignoreNextSingleClick_=!0},t.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=l.Z.POINTERDRAG){var e=this.lastPointerEvent_;this.willModifyFeatures_(e,this.dragSegments_);var t=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new w(L,this.featuresBeingModified_,e)),this.featuresBeingModified_=null,t}return!1},t.prototype.removeVertex_=function(){var e,t,r,i,n,o,a,s,u,l,d,g=this.dragSegments_,_={},f=!1;for(n=g.length-1;n>=0;--n)l=(r=g[n])[0],d=(0,S.sq)(l.feature),l.depth&&(d+="-"+l.depth.join("-")),d in _||(_[d]={}),0===r[1]?(_[d].right=l,_[d].index=l.index):1==r[1]&&(_[d].left=l,_[d].index=l.index+1);for(d in _){switch(u=_[d].right,a=_[d].left,(s=(o=_[d].index)-1)<0&&(s=0),e=t=(i=(l=void 0!==a?a:u).geometry).getCoordinates(),f=!1,i.getType()){case h.Z.MULTI_LINE_STRING:t[l.depth[0]].length>2&&(t[l.depth[0]].splice(o,1),f=!0);break;case h.Z.LINE_STRING:t.length>2&&(t.splice(o,1),f=!0);break;case h.Z.MULTI_POLYGON:e=e[l.depth[1]];case h.Z.POLYGON:(e=e[l.depth[0]]).length>4&&(o==e.length-1&&(o=0),e.splice(o,1),f=!0,0===o&&(e.pop(),e.push(e[0]),s=e.length-1))}if(f){this.setGeometryCoordinates_(i,t);var c=[];if(void 0!==a&&(this.rBush_.remove(a),c.push(a.segment[0])),void 0!==u&&(this.rBush_.remove(u),c.push(u.segment[1])),void 0!==a&&void 0!==u){var p={depth:l.depth,feature:l.feature,geometry:l.geometry,index:s,segment:c};this.rBush_.insert((0,v.boundingExtent)(p.segment),p)}this.updateSegmentIndices_(i,o,l.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),g.length=0}}return f},t.prototype.setGeometryCoordinates_=function(e,t){this.changingFeature_=!0,e.setCoordinates(t),this.changingFeature_=!1},t.prototype.updateSegmentIndices_=function(e,t,r,i){this.rBush_.forEachInExtent(e.getExtent(),(function(n){n.geometry===e&&(void 0===r||void 0===n.depth||(0,C.fS)(n.depth,r))&&n.index>t&&(n.index+=i)}))},t}(g.Z)},7517:(e,t,r)=>{r.d(t,{Z:()=>m});var i,n=r(8714),o=r(2071),a=r(291),s=r(4754),u=r(7182),h=r(9271),l=r(6885),d=r(9374),g=r(7539),_=r(5537),f=r(4187),c=r(8683),p=(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),y=function(e){function t(t,r,i,n){var o=e.call(this,t)||this;return o.selected=r,o.deselected=i,o.mapBrowserEvent=n,o}return p(t,e),t}(a.ZP),v={};const m=function(e){function t(t){var r=e.call(this)||this;r.on,r.once,r.un;var i,o,a=t||{};if(r.boundAddFeature_=r.addFeature_.bind(r),r.boundRemoveFeature_=r.removeFeature_.bind(r),r.condition_=a.condition?a.condition:c.Kf,r.addCondition_=a.addCondition?a.addCondition:c.Fi,r.removeCondition_=a.removeCondition?a.removeCondition:c.Fi,r.toggleCondition_=a.toggleCondition?a.toggleCondition:c.vY,r.multi_=!!a.multi&&a.multi,r.filter_=a.filter?a.filter:l.uX,r.hitTolerance_=a.hitTolerance?a.hitTolerance:0,r.style_=void 0!==a.style?a.style:(i=(0,g.createEditingStyle)(),(0,_.l7)(i[s.Z.POLYGON],i[s.Z.LINE_STRING]),(0,_.l7)(i[s.Z.GEOMETRY_COLLECTION],i[s.Z.LINE_STRING]),function(e){return e.getGeometry()?i[e.getGeometry().getType()]:null}),r.features_=a.features||new n.Z,a.layers)if("function"==typeof a.layers)o=a.layers;else{var u=a.layers;o=function(e){return(0,_.q9)(u,e)}}else o=l.uX;return r.layerFilter_=o,r.featureLayerAssociation_={},r}return p(t,e),t.prototype.addFeatureLayerAssociation_=function(e,t){this.featureLayerAssociation_[(0,f.sq)(e)]=t},t.prototype.getFeatures=function(){return this.features_},t.prototype.getHitTolerance=function(){return this.hitTolerance_},t.prototype.getLayer=function(e){return this.featureLayerAssociation_[(0,f.sq)(e)]},t.prototype.setHitTolerance=function(e){this.hitTolerance_=e},t.prototype.setMap=function(t){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),e.prototype.setMap.call(this,t),t?(this.features_.addEventListener(o.Z.ADD,this.boundAddFeature_),this.features_.addEventListener(o.Z.REMOVE,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(o.Z.ADD,this.boundAddFeature_),this.features_.removeEventListener(o.Z.REMOVE,this.boundRemoveFeature_))},t.prototype.addFeature_=function(e){var t=e.element;if(this.style_&&this.applySelectedStyle_(t),!this.getLayer(t)){var r=this.getMap().getAllLayers().find((function(e){if(e instanceof h.default&&e.getSource()&&e.getSource().hasFeature(t))return e}));r&&this.addFeatureLayerAssociation_(t,r)}},t.prototype.removeFeature_=function(e){var t=e.element;this.style_&&this.restorePreviousStyle_(t)},t.prototype.getStyle=function(){return this.style_},t.prototype.applySelectedStyle_=function(e){var t=(0,f.sq)(e);t in v||(v[t]=e.getStyle()),e.setStyle(this.style_)},t.prototype.restorePreviousStyle_=function(e){for(var r=this.getMap().getInteractions().getArray(),i=r.length-1;i>=0;--i){var n=r[i];if(n!==this&&n instanceof t&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(e))return void e.setStyle(n.getStyle())}var o=(0,f.sq)(e);e.setStyle(v[o]),delete v[o]},t.prototype.removeFeatureLayerAssociation_=function(e){delete this.featureLayerAssociation_[(0,f.sq)(e)]},t.prototype.handleEvent=function(e){if(!this.condition_(e))return!0;var t=this.addCondition_(e),r=this.removeCondition_(e),i=this.toggleCondition_(e),n=!t&&!r&&!i,o=e.map,a=this.getFeatures(),s=[],u=[];if(n){(0,d.ZH)(this.featureLayerAssociation_),o.forEachFeatureAtPixel(e.pixel,function(e,t){if(this.filter_(e,t))return this.addFeatureLayerAssociation_(e,t),u.push(e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var h=a.getLength()-1;h>=0;--h){var l=a.item(h),g=u.indexOf(l);g>-1?u.splice(g,1):(a.remove(l),s.push(l))}0!==u.length&&a.extend(u)}else{o.forEachFeatureAtPixel(e.pixel,function(e,n){if(this.filter_(e,n))return!t&&!i||(0,_.q9)(a.getArray(),e)?(r||i)&&(0,_.q9)(a.getArray(),e)&&(s.push(e),this.removeFeatureLayerAssociation_(e)):(this.addFeatureLayerAssociation_(e,n),u.push(e)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var f=s.length-1;f>=0;--f)a.remove(s[f]);a.extend(u)}return(u.length>0||s.length>0)&&this.dispatchEvent(new y("select",u,s,e)),!0},t}(u.default)},3232:(e,t,r)=>{r.d(t,{Z:()=>_});var i,n=r(8714),o=r(291),a=r(4049),s=r(4515),u=r(6885),h=r(8683),l=r(5537),d=(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),g=function(e){function t(t,r,i,n,o){var a=e.call(this,t)||this;return a.features=r,a.coordinate=i,a.startCoordinate=n,a.mapBrowserEvent=o,a}return d(t,e),t}(o.ZP);const _=function(e){function t(t){var r,i=this,n=t||{};if((i=e.call(this,n)||this).on,i.once,i.un,i.lastCoordinate_=null,i.startCoordinate_=null,i.features_=void 0!==n.features?n.features:null,n.layers&&!i.features_)if("function"==typeof n.layers)r=n.layers;else{var o=n.layers;r=function(e){return(0,l.q9)(o,e)}}else r=u.uX;return i.layerFilter_=r,i.filter_=n.filter&&!i.features_?n.filter:u.uX,i.hitTolerance_=n.hitTolerance?n.hitTolerance:0,i.condition_=n.condition?n.condition:h.Bx,i.lastFeature_=null,i.addChangeListener(a.Z.ACTIVE,i.handleActiveChanged_),i}return d(t,e),t.prototype.handleDownEvent=function(e){if(!e.originalEvent||!this.condition_(e))return!1;if(this.lastFeature_=this.featuresAtPixel_(e.pixel,e.map),!this.lastCoordinate_&&this.lastFeature_){this.startCoordinate_=e.coordinate,this.lastCoordinate_=e.coordinate,this.handleMoveEvent(e);var t=this.features_||new n.Z([this.lastFeature_]);return this.dispatchEvent(new g("translatestart",t,e.coordinate,this.startCoordinate_,e)),!0}return!1},t.prototype.handleUpEvent=function(e){if(this.lastCoordinate_){this.lastCoordinate_=null,this.handleMoveEvent(e);var t=this.features_||new n.Z([this.lastFeature_]);return this.dispatchEvent(new g("translateend",t,e.coordinate,this.startCoordinate_,e)),this.startCoordinate_=null,!0}return!1},t.prototype.handleDragEvent=function(e){if(this.lastCoordinate_){var t=e.coordinate,r=t[0]-this.lastCoordinate_[0],i=t[1]-this.lastCoordinate_[1],o=this.features_||new n.Z([this.lastFeature_]);o.forEach((function(e){var t=e.getGeometry();t.translate(r,i),e.setGeometry(t)})),this.lastCoordinate_=t,this.dispatchEvent(new g("translating",o,t,this.startCoordinate_,e))}},t.prototype.handleMoveEvent=function(e){var t=e.map.getViewport();this.featuresAtPixel_(e.pixel,e.map)?(t.classList.remove(this.lastCoordinate_?"ol-grab":"ol-grabbing"),t.classList.add(this.lastCoordinate_?"ol-grabbing":"ol-grab")):t.classList.remove("ol-grab","ol-grabbing")},t.prototype.featuresAtPixel_=function(e,t){return t.forEachFeatureAtPixel(e,function(e,t){if(this.filter_(e,t)&&(!this.features_||(0,l.q9)(this.features_.getArray(),e)))return e}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})},t.prototype.getHitTolerance=function(){return this.hitTolerance_},t.prototype.setHitTolerance=function(e){this.hitTolerance_=e},t.prototype.setMap=function(t){var r=this.getMap();e.prototype.setMap.call(this,t),this.updateState_(r)},t.prototype.handleActiveChanged_=function(){this.updateState_(null)},t.prototype.updateState_=function(e){var t=this.getMap(),r=this.getActive();t&&r||(t=t||e)&&t.getViewport().classList.remove("ol-grab","ol-grabbing")},t}(s.Z)}}]); |