landxml/bundles/landxml.node.js

3 lines
349 KiB
JavaScript
Raw Permalink Normal View History

2020-12-10 16:54:02 +01:00
/*! For license information please see landxml.node.js.LICENSE.txt */
2021-06-30 15:15:22 +02:00
module.exports=(()=>{var t={8899:(t,e,r)=>{"use strict";var n=r(5266),i=6378137;function o(t){var e=0;if(t&&t.length>0){e+=Math.abs(s(t[0]));for(var r=1;r<t.length;r++)e-=Math.abs(s(t[r]))}return e}function s(t){var e,r,n,o,s,h,u=0,c=t.length;if(c>2){for(h=0;h<c;h++)h===c-2?(n=c-2,o=c-1,s=0):h===c-1?(n=c-1,o=0,s=1):(n=h,o=h+1,s=h+2),e=t[n],r=t[o],u+=(a(t[s][0])-a(e[0]))*Math.sin(a(r[1]));u=u*i*i/2}return u}function a(t){return t*Math.PI/180}e.Z=function(t){return n.geomReduce(t,(function(t,e){return t+function(t){var e,r=0;switch(t.type){case"Polygon":return o(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)r+=o(t.coordinates[e]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)}),0)}},3470:(t,e)=>{"use strict";function r(t){var e={type:"Feature"};return Object.keys(t).forEach((function(r){switch(r){case"type":case"properties":case"geometry":return;default:e[r]=t[r]}})),e.properties=n(t.properties),e.geometry=i(t.geometry),e}function n(t){var e={};return t?(Object.keys(t).forEach((function(r){var i=t[r];"object"==typeof i?null===i?e[r]=null:Array.isArray(i)?e[r]=i.map((function(t){return t})):e[r]=n(i):e[r]=i})),e):e}function i(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return i(t)})),e):(e.coordinates=o(t.coordinates),e)}function o(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return o(t)}))}e.Z=function(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return r(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(r){switch(r){case"type":case"features":return;default:e[r]=t[r]}})),e.features=t.features.map((function(t){return r(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return i(t);default:throw new Error("unknown GeoJSON type")}}},1257:(t,e)=>{"use strict";function r(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function n(t,e,n){return void 0===n&&(n={}),r({type:"Point",coordinates:t},e,n)}function i(t,e,n){void 0===n&&(n={});for(var i=0,o=t;i<o.length;i++){var s=o[i];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<s[s.length-1].length;a++)if(s[s.length-1][a]!==s[0][a])throw new Error("First and last Position are not equivalent.")}return r({type:"Polygon",coordinates:t},e,n)}function o(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return r({type:"LineString",coordinates:t},e,n)}function s(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function a(t,e,n){return void 0===n&&(n={}),r({type:"MultiLineString",coordinates:t},e,n)}function h(t,e,n){return void 0===n&&(n={}),r({type:"MultiPoint",coordinates:t},e,n)}function u(t,e,n){return void 0===n&&(n={}),r({type:"MultiPolygon",coordinates:t},e,n)}function c(t,r){void 0===r&&(r="kilometers");var n=e.factors[r];if(!n)throw new Error(r+" units is invalid");return t*n}function l(t,r){void 0===r&&(r="kilometers");var n=e.factors[r];if(!n)throw new Error(r+" units is invalid");return t/n}function f(t){return t%(2*Math.PI)*180/Math.PI}function p(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)&&!/^\s*$/.test(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=6371008.8,e.factors={centimeters:100*e.earthRadius,centimetres:100*e.earthRadius,degrees:e.earthRadius/111325,feet:3.28084*e.earthRadius,inches:39.37*e.earthRadius,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:1e3*e.earthRadius,millimetres:1e3*e.earthRadius,nauticalmiles:e.earthRadius/1852,radians:1,yards:e.earthRadius/1.0936},e.unitsFactors={centimeters:100,centimetre
2020-12-10 16:54:02 +01:00
//# sourceMappingURL=landxml.node.js.map