wertyz-vue 2.8.3 → 2.8.5
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 -0
- package/dist/wertyzVue.js +1 -1
- package/package.json +56 -50
- package/webpack.config.js +65 -45
package/dist/wMapNext.js
ADDED
|
@@ -0,0 +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")):"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"],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")):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"])}(self,(e,t,r,o,s,i,n,a,l,u,d,c,p,h,y,g,m)=>(()=>{"use strict";var f={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},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}},v={};function w(e){var t=v[e];if(void 0!==t)return t.exports;var r=v[e]={exports:{}};return f[e](r,r.exports,w),r.exports}w.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return w.d(t,{a:t}),t},w.d=(e,t)=>{for(var r in t)w.o(t,r)&&!w.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},w.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),w.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var E={};w.r(E),w.d(E,{ClusterLayerWrapper:()=>ie,DrawCircleWrapper:()=>ve,DrawPolygonWrapper:()=>fe,DrawWrapper:()=>me,FeatureCircleBuilder:()=>ue,FeatureLineStringBuilder:()=>de,FeaturePointBuilder:()=>ae,FeaturePolygonBuilder:()=>le,GEOMETRY:()=>U,Interaction:()=>ye,LayerWrapper:()=>se,MapProcessor:()=>te,MapProcessorCluster:()=>re,MapWrapper:()=>oe,ModifyWrapper:()=>ge,OverlayWrapper:()=>ce,Processor:()=>ee,calculateCentroid:()=>he,calculateDistance:()=>Q,calculateDistanceLine:()=>$,calculateMidPoint:()=>pe,prepareLatitude:()=>X,prepareLongitude:()=>J});var C=w(8218),F=w.n(C),x=w(1189),L=w.n(x),P=w(8407),S=w(1273),O=w(5922),I=w.n(O),W=w(2617),q=w.n(W),A=w(1005),M=w.n(A),V=w(5993),D=w.n(V),T=w(2085),B=w.n(T),G=w(7604),N=w(2418),z=w.n(N),H=w(1849),b=w(2948),K=w.n(b),_=w(8432),j=w(7963),R=w.n(j),Y=w(3139),Z=w.n(Y),k=w(4275);const U={POINT:"Point",LINE:"LineString",POLYGON:"Polygon",CIRCLE:"Circle"};function X(e){return e>90||e<-90?e/1e5:e}function J(e){return e>180||e<-180?e/1e5:e}function Q(e,t){const r=.017453292519943295,o=Math.cos,s=X(e.latitude),i=X(t.latitude),n=J(e.longitude),a=J(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 $(e){let t=0;return e.forEach((r,o)=>{void 0!==e[o+1]&&(t+=Q(r,e[o+1]))}),t}class ee{layerWrapper=null;featureBuilder=null;modifyWrapper=null;overlayWrapper=null;drawWrappers=[];constructor(){}getLayerWrapper(){return this.layerWrapper}getModifyWrapper(){return this.modifyWrapper}getOverlayWrapper(){return this.overlayWrapper}getDrawWrappers(){return this.drawWrappers}includeModify(e){if(!this.layerWrapper)throw new Error("LayerWrapper is null");this.modifyWrapper=new ge({...e,source:this.layerWrapper.getSource()})}includeOverlay(e){this.overlayWrapper=new ce({...e})}includeDraw(e,t){e.source=this.layerWrapper.getSource(),t===U.CIRCLE?this.drawWrappers.push(new ve(e)):t===U.POLYGON&&this.drawWrappers.push(new fe(e))}setData(e){this.featureBuilder&&(this.layerWrapper.removeAllFeatures(),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 te extends ee{constructor(e){super(),this.layerWrapper=new se(e)}}class re extends ee{constructor(e){super(),this.layerWrapper=new ie(e)}}class oe{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,P.fromLonLat)(t.center?t.center:[0,0])},o={source:new S.OSM({})};this.tileLayer=new(I())(o);const s={target:e,layers:[this.tileLayer],view:new(L())(r)};this.map=new(F())(s),this.initEvents(),this.options.hitTolerance=void 0!==t.hitTolerance?t.hitTolerance:10}initEvents(){for(const e in oe.EVENTS)this.map.on(oe.EVENTS[e],t=>this.#e(oe.EVENTS[e],t))}getMap(){return this.map}getTileLayer(){return this.tileLayer}getViewPortCoordinates(){return this.map.getView().calculateExtent(this.map.getSize())}getViewCenter(){return(0,P.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())}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()),e.drawWrappers.forEach(e=>this.addInteraction(e))}}class se{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(M())(t):this.layer=new(D())(t),this.initEvents()}initEvents(){for(const e in se.EVENTS)this.source.on(se.EVENTS[e],t=>this.#e(se.EVENTS[e],t))}addFeatures(e){this.source.addFeatures(e)}addFeature(e){this.source.addFeature(e)}removeAllFeatures(){this.source.clear()}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 ie extends se{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(B())(r),console.log(this.source)}setDistance(e){this.cluster.setDistance(e)}}class ne{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=J(e.longitude),r=X(e.latitude);return(0,P.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 ae extends ne{constructor(e={}){super(e)}createFeature(e){const t=this.options.nestedKey?e[this.options.nestedKey]:e,r=this.getOLCoordinate(t),o={geometry:new G.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 le extends ne{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 G.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 ue extends ne{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 G.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 de extends ne{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 G.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 ce{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(K())(t)}getOverlay(){return this.overlay}setPositionByFeature(e){if(e){let t=e.getGeometry().getExtent();this.overlay.setPosition((0,_.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 pe(e){return{latitude:(e[0].latitude+e[1].latitude)/2,longitude:(e[0].longitude+e[1].longitude)/2}}function he(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 ye{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,P.toLonLat)(t);return{longitude:o[0].toFixed(5),latitude:o[1].toFixed(5),radius:r}}_parsePointCoordinates(e){const t=(0,P.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,P.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,P.toLonLat)(e);return{order:t+1,longitude:+(1e5*r[0]).toFixed(0),latitude:+(1e5*r[1]).toFixed(0)}})}}}class ge extends ye{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:k.shiftKeyOnly};this.options.editFirstAndLastPoint||(t.vertexFilter=(e,t)=>{if(console.log(t),t.getType()===U.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(R())(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,P.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 me extends ye{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 fe extends me{constructor(e){e.type=U.POLYGON,super(e)}drawEndEvent(e){if(this.options.endDrawHandler){const t=e.feature;this.options.endDrawHandler(this._parsePolygonCoordinates(t),U.POLYGON,e.feature)}}}class ve extends me{constructor(e){e.type=U.CIRCLE,super(e)}drawEndEvent(e){if(this.options.endDrawHandler){const t=e.feature;this.options.endDrawHandler(this._parseCircleCoordinates(t),U.CIRCLE,e.feature)}}}return E})());
|