wertyz-vue 3.10.3 → 3.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wMapNext.js +1 -1
- package/dist/wertyzVue.js +1 -1
- package/package.json +1 -1
package/dist/wMapNext.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ol/Map"),require("ol/View"),require("ol/proj"),require("ol/source"),require("ol/layer/Tile"),require("ol/source/Vector"),require("ol/layer/VectorImage"),require("ol/layer/Vector"),require("ol-ext/layer/AnimatedCluster"),require("ol/geom"),require("ol/Feature"),require("ol/style"),require("ol/Overlay"),require("ol/extent"),require("ol/interaction/Modify"),require("ol/interaction/Draw"),require("ol/events/condition"),require("ol-contextmenu/dist/ol-contextmenu.js")):"function"==typeof define&&define.amd?define("wertyzvue",["ol/Map","ol/View","ol/proj","ol/source","ol/layer/Tile","ol/source/Vector","ol/layer/VectorImage","ol/layer/Vector","ol-ext/layer/AnimatedCluster","ol/geom","ol/Feature","ol/style","ol/Overlay","ol/extent","ol/interaction/Modify","ol/interaction/Draw","ol/events/condition","ol-contextmenu/dist/ol-contextmenu.js"],t):"object"==typeof exports?exports.wertyzvue=t(require("ol/Map"),require("ol/View"),require("ol/proj"),require("ol/source"),require("ol/layer/Tile"),require("ol/source/Vector"),require("ol/layer/VectorImage"),require("ol/layer/Vector"),require("ol-ext/layer/AnimatedCluster"),require("ol/geom"),require("ol/Feature"),require("ol/style"),require("ol/Overlay"),require("ol/extent"),require("ol/interaction/Modify"),require("ol/interaction/Draw"),require("ol/events/condition"),require("ol-contextmenu/dist/ol-contextmenu.js")):e.wertyzvue=t(e["ol/Map"],e["ol/View"],e["ol/proj"],e["ol/source"],e["ol/layer/Tile"],e["ol/source/Vector"],e["ol/layer/VectorImage"],e["ol/layer/Vector"],e["ol-ext/layer/AnimatedCluster"],e["ol/geom"],e["ol/Feature"],e["ol/style"],e["ol/Overlay"],e["ol/extent"],e["ol/interaction/Modify"],e["ol/interaction/Draw"],e["ol/events/condition"],e["ol-contextmenu/dist/ol-contextmenu.js"])}(self,(e,t,r,o,s,i,n,a,l,u,d,c,p,h,y,g,m,f)=>(()=>{"use strict";var v={1005:e=>{e.exports=n},1189:e=>{e.exports=t},1273:e=>{e.exports=o},1849:e=>{e.exports=c},2085:e=>{e.exports=l},2418:e=>{e.exports=d},2617:e=>{e.exports=i},2948:e=>{e.exports=p},3139:e=>{e.exports=g},4275:e=>{e.exports=m},5327:e=>{e.exports=f},5922:e=>{e.exports=s},5993:e=>{e.exports=a},7604:e=>{e.exports=u},7963:e=>{e.exports=y},8218:t=>{t.exports=e},8407:e=>{e.exports=r},8432:e=>{e.exports=h}},w={};function x(e){var t=w[e];if(void 0!==t)return t.exports;var r=w[e]={exports:{}};return v[e](r,r.exports,x),r.exports}x.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return x.d(t,{a:t}),t},x.d=(e,t)=>{for(var r in t)x.o(t,r)&&!x.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},x.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),x.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var C={};x.r(C),x.d(C,{ClusterLayerWrapper:()=>le,ContextMenuWrapper:()=>Le,ContextMenuWrapperItem:()=>Fe,Control:()=>Ee,DrawCircleWrapper:()=>Ce,DrawPolygonWrapper:()=>xe,DrawWrapper:()=>we,FeatureCircleBuilder:()=>pe,FeatureLineStringBuilder:()=>he,FeaturePointBuilder:()=>de,FeaturePolygonBuilder:()=>ce,GEOMETRY:()=>Q,Interaction:()=>fe,LayerWrapper:()=>ae,MapProcessor:()=>se,MapProcessorCluster:()=>ie,MapWrapper:()=>ne,ModifyWrapper:()=>ve,OverlayWrapper:()=>ye,Processor:()=>oe,calculateCentroid:()=>me,calculateDistance:()=>te,calculateDistanceLine:()=>re,calculateMidPoint:()=>ge,prepareLatitude:()=>$,prepareLongitude:()=>ee});var E=x(8218),F=x.n(E),L=x(1189),P=x.n(L),I=x(8407),S=x(1273),W=x(5922),O=x.n(W),M=x(2617),q=x.n(M),A=x(1005),V=x.n(A),D=x(5993),T=x.n(D),B=x(2085),N=x.n(B),b=x(7604),G=x(2418),z=x.n(G),H=x(1849),K=x(2948),_=x.n(K),j=x(8432),R=x(7963),k=x.n(R),Y=x(3139),Z=x.n(Y),U=x(4275),X=x(5327),J=x.n(X);const Q={POINT:"Point",LINE:"LineString",POLYGON:"Polygon",CIRCLE:"Circle"};function $(e){return e>90||e<-90?e/1e5:e}function ee(e){return e>180||e<-180?e/1e5:e}function te(e,t){const r=.017453292519943295,o=Math.cos,s=$(e.latitude),i=$(t.latitude),n=ee(e.longitude),a=ee(t.longitude),l=.5-o((i-s)*r)/2+o(s*r)*o(i*r)*(1-o((a-n)*r))/2;return Math.round(12742*Math.asin(Math.sqrt(l))*1e3)}function re(e){let t=0;return e.forEach((r,o)=>{void 0!==e[o+1]&&(t+=te(r,e[o+1]))}),t}class oe{layerWrapper=null;featureBuilder=null;modifyWrapper=null;overlayWrapper=null;contextMenuWrapper=null;drawWrappers=[];constructor(){}getLayerWrapper(){return this.layerWrapper}getModifyWrapper(){return this.modifyWrapper}getOverlayWrapper(){return this.overlayWrapper}getDrawWrappers(){return this.drawWrappers}getContextMenuWrapper(){return this.contextMenuWrapper}includeModify(e){if(!this.layerWrapper)throw new Error("LayerWrapper is null");this.modifyWrapper=new ve({...e,source:this.layerWrapper.getSource()})}includeOverlay(e){this.overlayWrapper=new ye({...e})}includeDraw(e,t){e.source=this.layerWrapper.getSource(),t===Q.CIRCLE?this.drawWrappers.push(new Ce(e)):t===Q.POLYGON&&this.drawWrappers.push(new xe(e))}includeContextMenu(e){this.contextMenuWrapper=new Le(e)}setData(e,t=!1){this.featureBuilder&&(this.layerWrapper.removeAllFeatures(t),this.addData(e))}addData(e){if(this.featureBuilder){const t=this.featureBuilder.create(e);this.layerWrapper.addFeatures(Array.isArray(t)?t:[t])}}getDrawWrapperByType(e){return this.drawWrappers.find(t=>t.options.type===e)}setFeatureCoordinates(e,t){if(this.featureBuilder){const r=this.layerWrapper.getFeatureById(e);r&&this.featureBuilder.setCoordinate(r,t)}}setFeatureStyle(e,t){if(this.featureBuilder){const r=this.layerWrapper.getFeatureById(e);r&&this.featureBuilder.setStyle(r,t)}}}class se extends oe{constructor(e){super(),this.layerWrapper=new ae(e)}}class ie extends oe{constructor(e){super(),this.layerWrapper=new le(e)}}class ne{map=null;tileLayer=null;mapEvents={};options={hitTolerance:10};static EVENTS={CLICK:"click",SINGLECLICK:"singleclick",MOVEEND:"moveend"};constructor(e=null,t={}){e&&this.init(e,t)}init(e,t={}){const r={zoom:t.zoom?t.zoom:4,center:(0,I.fromLonLat)(t.center?t.center:[0,0])},o={source:new S.OSM({})};this.tileLayer=new(O())(o);const s={target:e,layers:[this.tileLayer],view:new(P())(r)};this.map=new(F())(s),this.initEvents(),this.options.hitTolerance=void 0!==t.hitTolerance?t.hitTolerance:10}initEvents(){for(const e in ne.EVENTS)this.map.on(ne.EVENTS[e],t=>this.#e(ne.EVENTS[e],t))}getMap(){return this.map}getTileLayer(){return this.tileLayer}getViewPortCoordinates(){return this.map.getView().calculateExtent(this.map.getSize())}getViewCenter(){return(0,I.transform)(this.map.getView().getCenter(),"EPSG:3857","EPSG:4326")}addLayer(e){console.log(e.getLayer()),this.map.addLayer(e.getLayer())}removeLayer(e){this.map.removeLayer(e.getLayer())}addOverlay(e){e&&e.getOverlay()&&this.map.addOverlay(e.getOverlay())}addControl(e){e&&e.getControl()&&this.map.addControl(e.getControl())}addInteraction(e){e&&e.getInteraction()&&this.map.addInteraction(e.getInteraction())}getFeatureFromPixel(e){return this.map.forEachFeatureAtPixel(e,e=>e)}getLayerFromPixel(e){return this.map.forEachFeatureAtPixel(e,(e,t)=>t)}getZoomLevel(){return this.map.getView().getZoom()}fitToLayer(e,t={}){if(e.getSource().getFeatures().length>0){const r={size:this.map.getSize(),maxZoom:t.zoom?t.zoom:20,padding:t.padding?t.padding:[30,30,30,30],duration:t.duration?t.duration:0},o=e.getSource().getExtent();this.map.getView().fit(o,r)}}fitToFeature(e,t={}){const r={size:this.map.getSize(),maxZoom:t.zoom?t.zoom:20,padding:t.padding?t.padding:[20,20,20,20],duration:t.duration?t.duration:0},o=e.getGeometry().getExtent();this.map.getView().fit(o,r)}on(e,t){this.mapEvents.hasOwnProperty(e)?this.mapEvents[e].push(t):this.mapEvents[e]=[t]}off(e,t){this.mapEvents.hasOwnProperty(e)&&(this.mapEvents[e]=this.mapEvents[e].filter(e=>e!==t))}#e(e,t){this.mapEvents.hasOwnProperty(e)&&this.mapEvents[e].forEach(e=>{void 0!==t.pixel?this.map.forEachFeatureAtPixel(t.pixel,(r,o)=>{setTimeout(e(r,o,t),1)},{hitTolerance:this.options.hitTolerance}):setTimeout(e(t),1)})}addProcessor(e){this.addLayer(e.getLayerWrapper()),this.addInteraction(e.getModifyWrapper()),this.addOverlay(e.getOverlayWrapper()),this.addControl(e.getContextMenuWrapper()),e.drawWrappers.forEach(e=>this.addInteraction(e))}}class ae{layer=null;source=null;sourceEvents={};static EVENTS={ADD_FEATURE:"addfeature"};constructor(e={}){this.source=new(q())({wrapX:!1});const t={name:e?.name??"Layer",style:e?.style??new H.Style,zIndex:e?.zIndex??1,opacity:e?.opacity??1,source:this.source};e.useVectorImage?this.layer=new(V())(t):this.layer=new(T())(t),this.initEvents()}initEvents(){for(const e in ae.EVENTS)this.source.on(ae.EVENTS[e],t=>this.#e(ae.EVENTS[e],t))}addFeatures(e){this.source.addFeatures(e)}addFeature(e){this.source.addFeature(e)}removeAllFeatures(e=!1){this.source.clear(e)}removeFeatures(e){this.source.removeFeatures(e)}removeFeature(e){this.source.removeFeature(e)}removeFeatureById(e){const t=this.getFeatureById(e);t&&this.removeFeature(t)}removeFeaturesByProperty(e,t){this.removeFeatures(this.getFeaturesByProperty(e,t))}getFeatureById(e){return this.source.getFeatureById(e)}getFeaturesByProperty(e,t){const r=[];return this.source.getFeatures.forEach(o=>{o.get("properties")[e]===t&&r.push(o)}),r}getAllFeatures(){return this.source.getFeatures()}getLayer(){return this.layer}getSource(){return this.source}getName(){return this.layer.get("name")}show(){this.layer.setVisible(!0)}hide(){this.layer.setVisible(!1)}setStyle(e){this.layer.setStyle(e)}on(e,t){this.sourceEvents.hasOwnProperty(e)?this.sourceEvents[e].push(t):this.sourceEvents[e]=[t]}off(e,t){this.sourceEvents.hasOwnProperty(e)&&(this.sourceEvents[e]=this.sourceEvents[e].filter(e=>e!==t))}#e(e,t){this.sourceEvents.hasOwnProperty(e)&&this.sourceEvents[e].forEach(e=>{setTimeout(e(t),1)})}}class le extends ae{cluster=null;constructor(e){super(e);const t={source:this.source,distance:e?.distance??50};this.cluster=new S.Cluster(t);const r={name:e?.name??"ClusterLayer",style:e?.style??new H.Style,zIndex:e?.zIndex??1,animationDuration:e?.animationDuration??200,options:e?.opacity??1,source:this.cluster};this.layer=new(N())(r),console.log(this.source)}setDistance(e){this.cluster.setDistance(e)}}class ue{options={style:null,idKey:null,nestedKey:null};constructor(e={}){this.options.style=void 0!==e.style?e.style:null,this.options.idKey=void 0!==e.idKey?e.idKey:null,this.options.nestedKey=void 0!==e.nestedKey?e.nestedKey:null}getOLCoordinate(e){const t=ee(e.longitude),r=$(e.latitude);return(0,I.fromLonLat)([t,r])}setId(e,t,r){this.options.idKey?e.setId(r[this.options.idKey]):void 0!==t.id?e.setId(t.id):void 0!==r.id&&e.setId(r.id)}setStyle(e,t=null){e.setStyle(t??this.options?.style??null)}setCoordinate(e,t){e.getGeometry().setCoordinates(this.getOLCoordinate(t))}createFeatures(e){return e.map(e=>this.createFeature(e))}createFeature(e){throw new Error("Method is not implemented")}}class de extends ue{constructor(e={}){super(e)}createFeature(e){const t=this.options.nestedKey?e[this.options.nestedKey]:e,r=this.getOLCoordinate(t),o={geometry:new b.Point(r)},s=new(z())(o);return s.set("properties",e),this.setId(s,t,e),this.setStyle(s,e?.style??null),s}create(e){return Array.isArray(e)?this.createFeatures(e):this.createFeature(e)}}class ce extends ue{constructor(e={}){super(e)}parsePoints(e){const t=[];for(let r=0,o=e.length;r<o;r++){const o=e[r].coordinate;t.push(this.getOLCoordinate(o))}return[t]}createFeature(e){console.log(e);const t=this.parsePoints(e.points),r={geometry:new b.Polygon(t)},o=new(z())(r);return o.set("properties",e),this.setId(o,e,e),this.setStyle(o,e?.style??null),o}create(e){return Array.isArray(e)?this.createFeatures(e):this.createFeature(e)}}class pe extends ue{constructor(e={}){super(e)}createFeature(e){const t=this.options.nestedKey?e[this.options.nestedKey]:e,r=this.getOLCoordinate(t);console.log(r);const o={geometry:new b.Circle(r,e.radius)},s=new(z())(o);return s.set("properties",e),this.setId(s,t,e),this.setStyle(s,e?.style??null),s}create(e){return Array.isArray(e)?this.createFeatures(e):this.createFeature(e)}}class he extends ue{constructor(e={}){super(e)}parsePoints(e){const t=[];for(let r=0,o=e.length;r<o;r++){const o=e[r].coordinate;t.push(this.getOLCoordinate(o))}return t}createFeature(e){const t=this.parsePoints(e.points),r={geometry:new b.LineString(t)},o=new(z())(r);return o.set("properties",e),this.setId(o,e,e),this.setStyle(o,e?.style??null),o}create(e){return Array.isArray(e)?this.createFeatures(e):this.createFeature(e)}}class ye{overlay=null;constructor(e={}){const t={element:document.getElementById(void 0!==e.element?e.element:null),offset:void 0!==e.offset?e.offset:[0,-30],positioning:"bottom-center"};this.overlay=new(_())(t)}getOverlay(){return this.overlay}setPositionByFeature(e){if(e){let t=e.getGeometry().getExtent();this.overlay.setPosition((0,j.getCenter)(t))}else this.overlay.setPosition(void 0)}setContent(e){element.innerHTML=e}show(e,t){void 0!==t&&this.setContent(t),void 0!==e&&this.setPositionByFeature(e)}hide(){this.overlay.setPosition(void 0)}}function ge(e){return{latitude:(e[0].latitude+e[1].latitude)/2,longitude:(e[0].longitude+e[1].longitude)/2}}function me(e){const t={latitude:0,longitude:0},r=e.length;for(let o=0;o<r;o++){let r=e[o];t.latitude+=r.latitude,t.longitude+=r.longitude}return t.latitude/=r,t.longitude/=r,t}class fe{interaction=null;constructor(){}setActive(e){this.interaction.setActive(e)}getInteraction(){return this.interaction}_parseCircleCoordinates(e){const t=e.getGeometry().getCenter(),r=e.getGeometry().getRadius(),o=(0,I.toLonLat)(t);return{longitude:o[0].toFixed(5),latitude:o[1].toFixed(5),radius:r}}_parsePointCoordinates(e){const t=(0,I.toLonLat)(e.getGeometry().getCoordinates());return{longitude:t[0].toFixed(5),latitude:t[1].toFixed(5),id:e.getId()}}_parsePolygonCoordinates(e){const t=e.getGeometry().getCoordinates()[0],r=[];for(let e=0,o=t.length;e<o;e++){const o=(0,I.toLonLat)(t[e]);r.push({longitude:o[0].toFixed(5),latitude:o[1].toFixed(5),order:e+1})}return{id:e.getId(),points:r}}_parseLSCoordinates(e){const t=e.getGeometry().getCoordinates();if(!this.options.editFirstAndLastPoint){const r=t[0],o=t[t.length-1],s=this.oldCoordinates[0],i=this.oldCoordinates[this.oldCoordinates.length-1];if(r[0]!==s[0]||r[1]!==s[1]||o[0]!==i[0]||o[1]!==i[1])return e.getGeometry().setCoordinates(this.oldCoordinates),void(this.oldCoordinates=null)}return{id:e.getId(),points:t.map((e,t)=>{const r=(0,I.toLonLat)(e);return{order:t+1,longitude:+(1e5*r[0]).toFixed(0),latitude:+(1e5*r[1]).toFixed(0)}})}}}class ve extends fe{options={source:null,features:[],startModifyHandler:null,endModifyHandler:null,hitDteection:null,style:null,alwaysOneFeature:!0,editFirstAndLastPoint:!1};oldCoordinates=null;constructor(e){super(),this.options=e;const t={source:this.options.source,features:this.options.features,hitDetection:this.options.hitDetection??10,style:this.options.style,active:this.options.active??!1,deleteCondition:U.shiftKeyOnly};this.options.editFirstAndLastPoint||(t.vertexFilter=(e,t)=>{if(console.log(t),t.getType()===Q.LINE){const r=t.getCoordinates(),o=e[0]===r[0][0]&&e[1]===r[0][1],s=e[0]===r[r.length-1][0]&&e[1]===r[r.length-1][1];return!(o||s)}return!0}),this.interaction=new(k())(t),this.interaction.on("modifystart",this.#t.bind(this)),this.interaction.on("modifyend",this.#r.bind(this)),this.setActive(!1)}#r(e){const t=e.features.getArray();this.options.endModifyHandler&&this.options.endModifyHandler(this.#o(t),t)}#t(e){const t=e.features.getArray()[0].getGeometry().getCoordinates();this.oldCoordinates=t,this.options.startModifyHandler&&this.options.startModifyHandler(e)}#o(e){if(!this.options.alwaysOneFeature)return e.map(e=>{let t=e.getGeometry().getCoordinates();return t.length>=2&&Array.isArray(t[0])?this._parseLSCoordinates(e):1===t.length?this._parsePolygonCoordinates(e):this._parsePointCoordinates(e)});{const t=e[0],r=t.getGeometry().getCoordinates();for(let t=1;t<e.length;t++){const r=e[t],o=r.get("properties").coordinate,s=(0,I.fromLonLat)([+o.longitude,+o.latitude]);r.getGeometry().setCoordinates(s)}if(r.length>=2&&Array.isArray(r[0]))return[this._parseLSCoordinates(t)];if(1!==r.length)return[this._parsePointCoordinates(t)];this._parsePolygonCoordinates(t)}}}class we extends fe{options={source:null,style:null,type:null,endDrawHandler:null,startDrawHandler:null,active:!1};constructor(e=null){super(),this.options=e;const t={source:this.options.source,style:this.options.style,type:this.options.type,active:this.options?.active??!1};this.interaction=new(Z())(t),this.interaction.on("drawend",this.drawEndEvent.bind(this)),this.interaction.on("drawstart",this.drawStartEvent.bind(this)),this.setActive(!1)}drawEndEvent(){throw new Error("Not implemented method")}drawStartEvent(){this.options.startDrawHandler&&this.options.startDrawHandler()}}class xe extends we{constructor(e){e.type=Q.POLYGON,super(e)}drawEndEvent(e){if(this.options.endDrawHandler){const t=e.feature;this.options.endDrawHandler(this._parsePolygonCoordinates(t),Q.POLYGON,e.feature)}}}class Ce extends we{constructor(e){e.type=Q.CIRCLE,super(e)}drawEndEvent(e){if(this.options.endDrawHandler){const t=e.feature;this.options.endDrawHandler(this._parseCircleCoordinates(t),Q.CIRCLE,e.feature)}}}class Ee{control=null;getControl(){return this.control}}class Fe{text=null;classname=null;callback=null;icon=null;items=null;constructor(){return this}setText(e){return this.text=e,this}setClassName(e){return this.classname=e,this}setCallback(e){return this.callback=e,this}setIcon(e){return this.icon=e,this}setItems(e){return this.items=e,this}addItem(e){return this.items||(this.items=[]),this.items.push(e),this}}class Le extends Ee{options={items:[],defaultItems:!1,width:null};constructor(e){super(),this.options=e,this.coordinates=null;const t={items:this.options?.items??[],defaultItems:this.options?.defaultItems??!1,width:this.options?.width??170};this.control=new(J())(t)}addItems(e){this.control.extend(e)}addItem(e){this.control.push(e)}removeItems(){this.control.clear()}removeLastItem(){this.control.pop()}}return C})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ol/Map"),require("ol/View"),require("ol/proj"),require("ol/source"),require("ol/layer/Tile"),require("ol/source/Vector"),require("ol/layer/VectorImage"),require("ol/layer/Vector"),require("ol-ext/layer/AnimatedCluster"),require("ol/geom"),require("ol/Feature"),require("ol/style"),require("ol/Overlay"),require("ol/extent"),require("ol/interaction/Modify"),require("ol/interaction/Draw"),require("ol/events/condition"),require("ol-contextmenu/dist/ol-contextmenu.js")):"function"==typeof define&&define.amd?define("wertyzvue",["ol/Map","ol/View","ol/proj","ol/source","ol/layer/Tile","ol/source/Vector","ol/layer/VectorImage","ol/layer/Vector","ol-ext/layer/AnimatedCluster","ol/geom","ol/Feature","ol/style","ol/Overlay","ol/extent","ol/interaction/Modify","ol/interaction/Draw","ol/events/condition","ol-contextmenu/dist/ol-contextmenu.js"],t):"object"==typeof exports?exports.wertyzvue=t(require("ol/Map"),require("ol/View"),require("ol/proj"),require("ol/source"),require("ol/layer/Tile"),require("ol/source/Vector"),require("ol/layer/VectorImage"),require("ol/layer/Vector"),require("ol-ext/layer/AnimatedCluster"),require("ol/geom"),require("ol/Feature"),require("ol/style"),require("ol/Overlay"),require("ol/extent"),require("ol/interaction/Modify"),require("ol/interaction/Draw"),require("ol/events/condition"),require("ol-contextmenu/dist/ol-contextmenu.js")):e.wertyzvue=t(e["ol/Map"],e["ol/View"],e["ol/proj"],e["ol/source"],e["ol/layer/Tile"],e["ol/source/Vector"],e["ol/layer/VectorImage"],e["ol/layer/Vector"],e["ol-ext/layer/AnimatedCluster"],e["ol/geom"],e["ol/Feature"],e["ol/style"],e["ol/Overlay"],e["ol/extent"],e["ol/interaction/Modify"],e["ol/interaction/Draw"],e["ol/events/condition"],e["ol-contextmenu/dist/ol-contextmenu.js"])}(self,(e,t,r,o,s,i,n,a,l,u,d,c,p,h,y,g,m,f)=>(()=>{"use strict";var v={1005:e=>{e.exports=n},1189:e=>{e.exports=t},1273:e=>{e.exports=o},1849:e=>{e.exports=c},2085:e=>{e.exports=l},2418:e=>{e.exports=d},2617:e=>{e.exports=i},2948:e=>{e.exports=p},3139:e=>{e.exports=g},4275:e=>{e.exports=m},5327:e=>{e.exports=f},5922:e=>{e.exports=s},5993:e=>{e.exports=a},6051:e=>{e.exports=h},7604:e=>{e.exports=u},7963:e=>{e.exports=y},8218:t=>{t.exports=e},8407:e=>{e.exports=r}},w={};function x(e){var t=w[e];if(void 0!==t)return t.exports;var r=w[e]={exports:{}};return v[e](r,r.exports,x),r.exports}x.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return x.d(t,{a:t}),t},x.d=(e,t)=>{for(var r in t)x.o(t,r)&&!x.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},x.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),x.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var C={};x.r(C),x.d(C,{ClusterLayerWrapper:()=>le,ContextMenuWrapper:()=>Le,ContextMenuWrapperItem:()=>Fe,Control:()=>Ee,DrawCircleWrapper:()=>Ce,DrawPolygonWrapper:()=>xe,DrawWrapper:()=>we,FeatureCircleBuilder:()=>pe,FeatureLineStringBuilder:()=>he,FeaturePointBuilder:()=>de,FeaturePolygonBuilder:()=>ce,GEOMETRY:()=>Q,Interaction:()=>fe,LayerWrapper:()=>ae,MapProcessor:()=>se,MapProcessorCluster:()=>ie,MapWrapper:()=>ne,ModifyWrapper:()=>ve,OverlayWrapper:()=>ye,Processor:()=>oe,calculateCentroid:()=>me,calculateDistance:()=>te,calculateDistanceLine:()=>re,calculateMidPoint:()=>ge,prepareLatitude:()=>$,prepareLongitude:()=>ee});var E=x(8218),F=x.n(E),L=x(1189),P=x.n(L),I=x(8407),S=x(1273),W=x(5922),O=x.n(W),M=x(2617),q=x.n(M),A=x(1005),V=x.n(A),D=x(5993),T=x.n(D),B=x(2085),N=x.n(B),b=x(7604),G=x(2418),z=x.n(G),H=x(1849),K=x(2948),_=x.n(K),j=x(6051),R=x(7963),k=x.n(R),Y=x(3139),Z=x.n(Y),U=x(4275),X=x(5327),J=x.n(X);const Q={POINT:"Point",LINE:"LineString",POLYGON:"Polygon",CIRCLE:"Circle"};function $(e){return e>90||e<-90?e/1e5:e}function ee(e){return e>180||e<-180?e/1e5:e}function te(e,t){const r=.017453292519943295,o=Math.cos,s=$(e.latitude),i=$(t.latitude),n=ee(e.longitude),a=ee(t.longitude),l=.5-o((i-s)*r)/2+o(s*r)*o(i*r)*(1-o((a-n)*r))/2;return Math.round(12742*Math.asin(Math.sqrt(l))*1e3)}function re(e){let t=0;return e.forEach((r,o)=>{void 0!==e[o+1]&&(t+=te(r,e[o+1]))}),t}class oe{layerWrapper=null;featureBuilder=null;modifyWrapper=null;overlayWrapper=null;contextMenuWrapper=null;drawWrappers=[];constructor(){}getLayerWrapper(){return this.layerWrapper}getModifyWrapper(){return this.modifyWrapper}getOverlayWrapper(){return this.overlayWrapper}getDrawWrappers(){return this.drawWrappers}getContextMenuWrapper(){return this.contextMenuWrapper}includeModify(e){if(!this.layerWrapper)throw new Error("LayerWrapper is null");this.modifyWrapper=new ve({...e,source:this.layerWrapper.getSource()})}includeOverlay(e){this.overlayWrapper=new ye({...e})}includeDraw(e,t){e.source=this.layerWrapper.getSource(),t===Q.CIRCLE?this.drawWrappers.push(new Ce(e)):t===Q.POLYGON&&this.drawWrappers.push(new xe(e))}includeContextMenu(e){this.contextMenuWrapper=new Le(e)}setData(e,t=!1){this.featureBuilder&&(this.layerWrapper.removeAllFeatures(t),this.addData(e))}addData(e){if(this.featureBuilder){const t=this.featureBuilder.create(e);this.layerWrapper.addFeatures(Array.isArray(t)?t:[t])}}getDrawWrapperByType(e){return this.drawWrappers.find(t=>t.options.type===e)}setFeatureCoordinates(e,t){if(this.featureBuilder){const r=this.layerWrapper.getFeatureById(e);r&&this.featureBuilder.setCoordinate(r,t)}}setFeatureStyle(e,t){if(this.featureBuilder){const r=this.layerWrapper.getFeatureById(e);r&&this.featureBuilder.setStyle(r,t)}}}class se extends oe{constructor(e){super(),this.layerWrapper=new ae(e)}}class ie extends oe{constructor(e){super(),this.layerWrapper=new le(e)}}class ne{map=null;tileLayer=null;mapEvents={};options={hitTolerance:10};static EVENTS={CLICK:"click",SINGLECLICK:"singleclick",MOVEEND:"moveend"};constructor(e=null,t={}){e&&this.init(e,t)}init(e,t={}){const r={zoom:t.zoom?t.zoom:4,center:(0,I.fromLonLat)(t.center?t.center:[0,0])},o={source:new S.OSM({})};this.tileLayer=new(O())(o);const s={target:e,layers:[this.tileLayer],view:new(P())(r)};this.map=new(F())(s),this.initEvents(),this.options.hitTolerance=void 0!==t.hitTolerance?t.hitTolerance:10}initEvents(){for(const e in ne.EVENTS)this.map.on(ne.EVENTS[e],t=>this.#e(ne.EVENTS[e],t))}getMap(){return this.map}getTileLayer(){return this.tileLayer}getViewPortCoordinates(){return this.map.getView().calculateExtent(this.map.getSize())}getViewCenter(){return(0,I.transform)(this.map.getView().getCenter(),"EPSG:3857","EPSG:4326")}addLayer(e){console.log(e.getLayer()),this.map.addLayer(e.getLayer())}removeLayer(e){this.map.removeLayer(e.getLayer())}addOverlay(e){e&&e.getOverlay()&&this.map.addOverlay(e.getOverlay())}addControl(e){e&&e.getControl()&&this.map.addControl(e.getControl())}addInteraction(e){e&&e.getInteraction()&&this.map.addInteraction(e.getInteraction())}getFeatureFromPixel(e){return this.map.forEachFeatureAtPixel(e,e=>e)}getLayerFromPixel(e){return this.map.forEachFeatureAtPixel(e,(e,t)=>t)}getZoomLevel(){return this.map.getView().getZoom()}fitToLayer(e,t={}){if(e.getSource().getFeatures().length>0){const r={size:this.map.getSize(),maxZoom:t.zoom?t.zoom:20,padding:t.padding?t.padding:[30,30,30,30],duration:t.duration?t.duration:0},o=e.getSource().getExtent();this.map.getView().fit(o,r)}}fitToFeature(e,t={}){const r={size:this.map.getSize(),maxZoom:t.zoom?t.zoom:20,padding:t.padding?t.padding:[20,20,20,20],duration:t.duration?t.duration:0},o=e.getGeometry().getExtent();this.map.getView().fit(o,r)}on(e,t){this.mapEvents.hasOwnProperty(e)?this.mapEvents[e].push(t):this.mapEvents[e]=[t]}off(e,t){this.mapEvents.hasOwnProperty(e)&&(this.mapEvents[e]=this.mapEvents[e].filter(e=>e!==t))}#e(e,t){this.mapEvents.hasOwnProperty(e)&&this.mapEvents[e].forEach(e=>{void 0!==t.pixel?this.map.forEachFeatureAtPixel(t.pixel,(r,o)=>{setTimeout(e(r,o,t),1)},{hitTolerance:this.options.hitTolerance}):setTimeout(e(t),1)})}addProcessor(e){this.addLayer(e.getLayerWrapper()),this.addInteraction(e.getModifyWrapper()),this.addOverlay(e.getOverlayWrapper()),this.addControl(e.getContextMenuWrapper()),e.drawWrappers.forEach(e=>this.addInteraction(e))}}class ae{layer=null;source=null;sourceEvents={};static EVENTS={ADD_FEATURE:"addfeature"};constructor(e={}){this.source=new(q())({wrapX:!1});const t={name:e?.name??"Layer",style:e?.style??new H.Style,zIndex:e?.zIndex??1,opacity:e?.opacity??1,source:this.source};e.useVectorImage?this.layer=new(V())(t):this.layer=new(T())(t),this.initEvents()}initEvents(){for(const e in ae.EVENTS)this.source.on(ae.EVENTS[e],t=>this.#e(ae.EVENTS[e],t))}addFeatures(e){this.source.addFeatures(e)}addFeature(e){this.source.addFeature(e)}removeAllFeatures(e=!1){this.source.clear(e)}removeFeatures(e){this.source.removeFeatures(e)}removeFeature(e){this.source.removeFeature(e)}removeFeatureById(e){const t=this.getFeatureById(e);t&&this.removeFeature(t)}removeFeaturesByProperty(e,t){this.removeFeatures(this.getFeaturesByProperty(e,t))}getFeatureById(e){return this.source.getFeatureById(e)}getFeaturesByProperty(e,t){const r=[];return this.source.getFeatures.forEach(o=>{o.get("properties")[e]===t&&r.push(o)}),r}getAllFeatures(){return this.source.getFeatures()}getLayer(){return this.layer}getSource(){return this.source}getName(){return this.layer.get("name")}show(){this.layer.setVisible(!0)}hide(){this.layer.setVisible(!1)}setStyle(e){this.layer.setStyle(e)}on(e,t){this.sourceEvents.hasOwnProperty(e)?this.sourceEvents[e].push(t):this.sourceEvents[e]=[t]}off(e,t){this.sourceEvents.hasOwnProperty(e)&&(this.sourceEvents[e]=this.sourceEvents[e].filter(e=>e!==t))}#e(e,t){this.sourceEvents.hasOwnProperty(e)&&this.sourceEvents[e].forEach(e=>{setTimeout(e(t),1)})}}class le extends ae{cluster=null;constructor(e){super(e);const t={source:this.source,distance:e?.distance??50};this.cluster=new S.Cluster(t);const r={name:e?.name??"ClusterLayer",style:e?.style??new H.Style,zIndex:e?.zIndex??1,animationDuration:e?.animationDuration??200,options:e?.opacity??1,source:this.cluster};this.layer=new(N())(r),console.log(this.source)}setDistance(e){this.cluster.setDistance(e)}}class ue{options={style:null,idKey:null,nestedKey:null};constructor(e={}){this.options.style=void 0!==e.style?e.style:null,this.options.idKey=void 0!==e.idKey?e.idKey:null,this.options.nestedKey=void 0!==e.nestedKey?e.nestedKey:null}getOLCoordinate(e){const t=ee(e.longitude),r=$(e.latitude);return(0,I.fromLonLat)([t,r])}setId(e,t,r){this.options.idKey?e.setId(r[this.options.idKey]):void 0!==t.id?e.setId(t.id):void 0!==r.id&&e.setId(r.id)}setStyle(e,t=null){e.setStyle(t??this.options?.style??null)}setCoordinate(e,t){e.getGeometry().setCoordinates(this.getOLCoordinate(t))}createFeatures(e){return e.map(e=>this.createFeature(e))}createFeature(e){throw new Error("Method is not implemented")}}class de extends ue{constructor(e={}){super(e)}createFeature(e){const t=this.options.nestedKey?e[this.options.nestedKey]:e,r=this.getOLCoordinate(t),o={geometry:new b.Point(r)},s=new(z())(o);return s.set("properties",e),this.setId(s,t,e),this.setStyle(s,e?.style??null),s}create(e){return Array.isArray(e)?this.createFeatures(e):this.createFeature(e)}}class ce extends ue{constructor(e={}){super(e)}parsePoints(e){const t=[];for(let r=0,o=e.length;r<o;r++){const o=e[r].coordinate;t.push(this.getOLCoordinate(o))}return[t]}createFeature(e){console.log(e);const t=this.parsePoints(e.points),r={geometry:new b.Polygon(t)},o=new(z())(r);return o.set("properties",e),this.setId(o,e,e),this.setStyle(o,e?.style??null),o}create(e){return Array.isArray(e)?this.createFeatures(e):this.createFeature(e)}}class pe extends ue{constructor(e={}){super(e)}createFeature(e){const t=this.options.nestedKey?e[this.options.nestedKey]:e,r=this.getOLCoordinate(t);console.log(r);const o={geometry:new b.Circle(r,e.radius)},s=new(z())(o);return s.set("properties",e),this.setId(s,t,e),this.setStyle(s,e?.style??null),s}create(e){return Array.isArray(e)?this.createFeatures(e):this.createFeature(e)}}class he extends ue{constructor(e={}){super(e)}parsePoints(e){const t=[];for(let r=0,o=e.length;r<o;r++){const o=e[r].coordinate;t.push(this.getOLCoordinate(o))}return t}createFeature(e){const t=this.parsePoints(e.points),r={geometry:new b.LineString(t)},o=new(z())(r);return o.set("properties",e),this.setId(o,e,e),this.setStyle(o,e?.style??null),o}create(e){return Array.isArray(e)?this.createFeatures(e):this.createFeature(e)}}class ye{overlay=null;constructor(e={}){const t={element:document.getElementById(void 0!==e.element?e.element:null),offset:void 0!==e.offset?e.offset:[0,-30],positioning:"bottom-center"};this.overlay=new(_())(t)}getOverlay(){return this.overlay}setPositionByFeature(e){if(e){let t=e.getGeometry().getExtent();this.overlay.setPosition((0,j.getCenter)(t))}else this.overlay.setPosition(void 0)}setContent(e){element.innerHTML=e}show(e,t){void 0!==t&&this.setContent(t),void 0!==e&&this.setPositionByFeature(e)}hide(){this.overlay.setPosition(void 0)}}function ge(e){return{latitude:(e[0].latitude+e[1].latitude)/2,longitude:(e[0].longitude+e[1].longitude)/2}}function me(e){const t={latitude:0,longitude:0},r=e.length;for(let o=0;o<r;o++){let r=e[o];t.latitude+=r.latitude,t.longitude+=r.longitude}return t.latitude/=r,t.longitude/=r,t}class fe{interaction=null;constructor(){}setActive(e){this.interaction.setActive(e)}getInteraction(){return this.interaction}_parseCircleCoordinates(e){const t=e.getGeometry().getCenter(),r=e.getGeometry().getRadius(),o=(0,I.toLonLat)(t);return{longitude:o[0].toFixed(5),latitude:o[1].toFixed(5),radius:r}}_parsePointCoordinates(e){const t=(0,I.toLonLat)(e.getGeometry().getCoordinates());return{longitude:t[0].toFixed(5),latitude:t[1].toFixed(5),id:e.getId()}}_parsePolygonCoordinates(e){const t=e.getGeometry().getCoordinates()[0],r=[];for(let e=0,o=t.length;e<o;e++){const o=(0,I.toLonLat)(t[e]);r.push({longitude:o[0].toFixed(5),latitude:o[1].toFixed(5),order:e+1})}return{id:e.getId(),points:r}}_parseLSCoordinates(e){const t=e.getGeometry().getCoordinates();if(!this.options.editFirstAndLastPoint){const r=t[0],o=t[t.length-1],s=this.oldCoordinates[0],i=this.oldCoordinates[this.oldCoordinates.length-1];if(r[0]!==s[0]||r[1]!==s[1]||o[0]!==i[0]||o[1]!==i[1])return e.getGeometry().setCoordinates(this.oldCoordinates),void(this.oldCoordinates=null)}return{id:e.getId(),points:t.map((e,t)=>{const r=(0,I.toLonLat)(e);return{order:t+1,longitude:+(1e5*r[0]).toFixed(0),latitude:+(1e5*r[1]).toFixed(0)}})}}}class ve extends fe{options={source:null,features:[],startModifyHandler:null,endModifyHandler:null,hitDteection:null,style:null,alwaysOneFeature:!0,editFirstAndLastPoint:!1};oldCoordinates=null;constructor(e){super(),this.options=e;const t={source:this.options.source,features:this.options.features,hitDetection:this.options.hitDetection??10,style:this.options.style,active:this.options.active??!1,deleteCondition:U.shiftKeyOnly};this.options.editFirstAndLastPoint||(t.vertexFilter=(e,t)=>{if(console.log(t),t.getType()===Q.LINE){const r=t.getCoordinates(),o=e[0]===r[0][0]&&e[1]===r[0][1],s=e[0]===r[r.length-1][0]&&e[1]===r[r.length-1][1];return!(o||s)}return!0}),this.interaction=new(k())(t),this.interaction.on("modifystart",this.#t.bind(this)),this.interaction.on("modifyend",this.#r.bind(this)),this.setActive(!1)}#r(e){const t=e.features.getArray();this.options.endModifyHandler&&this.options.endModifyHandler(this.#o(t),t)}#t(e){const t=e.features.getArray()[0].getGeometry().getCoordinates();this.oldCoordinates=t,this.options.startModifyHandler&&this.options.startModifyHandler(e)}#o(e){if(!this.options.alwaysOneFeature)return e.map(e=>{let t=e.getGeometry().getCoordinates();return t.length>=2&&Array.isArray(t[0])?this._parseLSCoordinates(e):1===t.length?this._parsePolygonCoordinates(e):this._parsePointCoordinates(e)});{const t=e[0],r=t.getGeometry().getCoordinates();for(let t=1;t<e.length;t++){const r=e[t],o=r.get("properties").coordinate,s=(0,I.fromLonLat)([+o.longitude,+o.latitude]);r.getGeometry().setCoordinates(s)}if(r.length>=2&&Array.isArray(r[0]))return[this._parseLSCoordinates(t)];if(1!==r.length)return[this._parsePointCoordinates(t)];this._parsePolygonCoordinates(t)}}}class we extends fe{options={source:null,style:null,type:null,endDrawHandler:null,startDrawHandler:null,active:!1};constructor(e=null){super(),this.options=e;const t={source:this.options.source,style:this.options.style,type:this.options.type,active:this.options?.active??!1};this.interaction=new(Z())(t),this.interaction.on("drawend",this.drawEndEvent.bind(this)),this.interaction.on("drawstart",this.drawStartEvent.bind(this)),this.setActive(!1)}drawEndEvent(){throw new Error("Not implemented method")}drawStartEvent(){this.options.startDrawHandler&&this.options.startDrawHandler()}}class xe extends we{constructor(e){e.type=Q.POLYGON,super(e)}drawEndEvent(e){if(this.options.endDrawHandler){const t=e.feature;this.options.endDrawHandler(this._parsePolygonCoordinates(t),Q.POLYGON,e.feature)}}}class Ce extends we{constructor(e){e.type=Q.CIRCLE,super(e)}drawEndEvent(e){if(this.options.endDrawHandler){const t=e.feature;this.options.endDrawHandler(this._parseCircleCoordinates(t),Q.CIRCLE,e.feature)}}}class Ee{control=null;getControl(){return this.control}}class Fe{text=null;classname=null;callback=null;icon=null;items=null;constructor(){return this}setText(e){return this.text=e,this}setClassName(e){return this.classname=e,this}setCallback(e){return this.callback=e,this}setIcon(e){return this.icon=e,this}setItems(e){return this.items=e,this}addItem(e){return this.items||(this.items=[]),this.items.push(e),this}}class Le extends Ee{options={items:[],defaultItems:!1,width:null};constructor(e){super(),this.options=e,this.coordinates=null;const t={items:this.options?.items??[],defaultItems:this.options?.defaultItems??!1,width:this.options?.width??170};this.control=new(J())(t)}addItems(e){this.control.extend(e)}addItem(e){this.control.push(e)}removeItems(){this.control.clear()}removeLastItem(){this.control.pop()}}return C})());
|