"use strict";(self.webpackChunklizmap_web_client=self.webpackChunklizmap_web_client||[]).push([["398"],{8121:function(e,t,o){o.r(t),o.d(t,{default:()=>l});var n=o(352),r=o(3389);function i(e){return[e.x,e.y]}class l{constructor(e,t){this.geometryFactory=e||new r.Z,this.ol=t||"undefined"!=typeof ol&&ol}inject(e,t,o,n,r,i,l,g){this.ol={geom:{Point:e,LineString:t,LinearRing:o,Polygon:n,MultiPoint:r,MultiLineString:i,MultiPolygon:l,GeometryCollection:g}}}read(e){let t=this.ol;if(e instanceof t.geom.Point)return this.convertFromPoint(e);if(e instanceof t.geom.LineString)return this.convertFromLineString(e);if(e instanceof t.geom.LinearRing)return this.convertFromLinearRing(e);if(e instanceof t.geom.Polygon)return this.convertFromPolygon(e);if(e instanceof t.geom.MultiPoint)return this.convertFromMultiPoint(e);else if(e instanceof t.geom.MultiLineString)return this.convertFromMultiLineString(e);else if(e instanceof t.geom.MultiPolygon)return this.convertFromMultiPolygon(e);else if(e instanceof t.geom.GeometryCollection)return this.convertFromCollection(e)}convertFromPoint(e){let t=e.getCoordinates();return this.geometryFactory.createPoint(new n.Z(t[0],t[1]))}convertFromLineString(e){return this.geometryFactory.createLineString(e.getCoordinates().map(function(e){return new n.Z(e[0],e[1])}))}convertFromLinearRing(e){return this.geometryFactory.createLinearRing(e.getCoordinates().map(function(e){return new n.Z(e[0],e[1])}))}convertFromPolygon(e){let t=e.getLinearRings(),o=null,n=[];for(let e=0;e<t.length;e++){let r=this.convertFromLinearRing(t[e]);0===e?o=r:n.push(r)}return this.geometryFactory.createPolygon(o,n)}convertFromMultiPoint(e){let t=e.getPoints().map(function(e){return this.convertFromPoint(e)},this);return this.geometryFactory.createMultiPoint(t)}convertFromMultiLineString(e){let t=e.getLineStrings().map(function(e){return this.convertFromLineString(e)},this);return this.geometryFactory.createMultiLineString(t)}convertFromMultiPolygon(e){let t=e.getPolygons().map(function(e){return this.convertFromPolygon(e)},this);return this.geometryFactory.createMultiPolygon(t)}convertFromCollection(e){let t=e.getGeometries().map(function(e){return this.read(e)},this);return this.geometryFactory.createGeometryCollection(t)}write(e){if("Point"===e.getGeometryType())return this.convertToPoint(e.getCoordinate());if("LineString"===e.getGeometryType())return this.convertToLineString(e);if("LinearRing"===e.getGeometryType())return this.convertToLinearRing(e);if("Polygon"===e.getGeometryType())return this.convertToPolygon(e);if("MultiPoint"===e.getGeometryType())return this.convertToMultiPoint(e);else if("MultiLineString"===e.getGeometryType())return this.convertToMultiLineString(e);else if("MultiPolygon"===e.getGeometryType())return this.convertToMultiPolygon(e);else if("GeometryCollection"===e.getGeometryType())return this.convertToCollection(e)}convertToPoint(e){return new this.ol.geom.Point([e.x,e.y])}convertToLineString(e){let t=e._points._coordinates.map(i);return new this.ol.geom.LineString(t)}convertToLinearRing(e){let t=e._points._coordinates.map(i);return new this.ol.geom.LinearRing(t)}convertToPolygon(e){let t=[e._shell._points._coordinates.map(i)];for(let o=0;o<e._holes.length;o++)t.push(e._holes[o]._points._coordinates.map(i));return new this.ol.geom.Polygon(t)}convertToMultiPoint(e){return new this.ol.geom.MultiPoint(e.getCoordinates().map(i))}convertToMultiLineString(e){let t=[];for(let o=0;o<e._geometries.length;o++)t.push(this.convertToLineString(e._geometries[o]).getCoordinates());return new this.ol.geom.MultiLineString(t)}convertToMultiPolygon(e){let t=[];for(let o=0;o<e._geometries.length;o++)t.push(this.convertToPolygon(e._geometries[o]).getCoordinates());return new this.ol.geom.MultiPolygon(t)}convertToCollection(e){let t=[];for(let o=0;o<e._geometries.length;o++){let n=e._geometries[o];t.push(this.write(n))}return new this.ol.geom.GeometryCollection(t)}}}}]);
//# sourceMappingURL=OLparser.bundle.js.map