UNPKG

x_ite

Version:

X_ITE X3D Browser, view and manipulate X3D, VRML, glTF and other 3D sources in HTML.

1,409 lines (1,169 loc) 110 kB
/* X_ITE v11.6.6 */ const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.6.6")]; /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ // UNUSED EXPORTS: default ;// external "__X_ITE_X3D__ .Components" const external_X_ITE_X3D_Components_namespaceObject = __X_ITE_X3D__ .Components; var external_X_ITE_X3D_Components_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Components_namespaceObject); ;// external "__X_ITE_X3D__ .Fields" const external_X_ITE_X3D_Fields_namespaceObject = __X_ITE_X3D__ .Fields; var external_X_ITE_X3D_Fields_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Fields_namespaceObject); ;// external "__X_ITE_X3D__ .X3DFieldDefinition" const external_X_ITE_X3D_X3DFieldDefinition_namespaceObject = __X_ITE_X3D__ .X3DFieldDefinition; var external_X_ITE_X3D_X3DFieldDefinition_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DFieldDefinition_namespaceObject); ;// external "__X_ITE_X3D__ .FieldDefinitionArray" const external_X_ITE_X3D_FieldDefinitionArray_namespaceObject = __X_ITE_X3D__ .FieldDefinitionArray; var external_X_ITE_X3D_FieldDefinitionArray_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_FieldDefinitionArray_namespaceObject); ;// external "__X_ITE_X3D__ .X3DNode" const external_X_ITE_X3D_X3DNode_namespaceObject = __X_ITE_X3D__ .X3DNode; var external_X_ITE_X3D_X3DNode_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DNode_namespaceObject); ;// external "__X_ITE_X3D__ .X3DCoordinateNode" const external_X_ITE_X3D_X3DCoordinateNode_namespaceObject = __X_ITE_X3D__ .X3DCoordinateNode; var external_X_ITE_X3D_X3DCoordinateNode_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DCoordinateNode_namespaceObject); ;// external "__X_ITE_X3D__ .X3DConstants" const external_X_ITE_X3D_X3DConstants_namespaceObject = __X_ITE_X3D__ .X3DConstants; var external_X_ITE_X3D_X3DConstants_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DConstants_namespaceObject); ;// external "__X_ITE_X3D__ .Namespace" const external_X_ITE_X3D_Namespace_namespaceObject = __X_ITE_X3D__ .Namespace; var external_X_ITE_X3D_Namespace_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Namespace_namespaceObject); ;// ./src/standard/Math/Geometry/Spheroid3.js function Spheroid3 (semiMajorAxis = 1, semiMinorAxis = 1, use_f_1 = false) { this .set (semiMajorAxis, semiMinorAxis, use_f_1); } Object .assign (Spheroid3 .prototype, { copy () { const copy = Object .create (Spheroid3 .prototype); copy .semiMajorAxis = this .semiMajorAxis; // a copy .semiMinorAxis = this .semiMinorAxis; // c return copy; }, assign (spheroid) { this .semiMajorAxis = spheroid .semiMajorAxis; this .semiMinorAxis = spheroid .semiMinorAxis; return this; }, equals (spheroid) { return this .semiMajorAxis === spheroid .semiMajorAxis && this .semiMinorAxis === spheroid .semiMinorAxis; }, set (semiMajorAxis = 1, semiMinorAxis = 1, use_f_1 = false) { if (use_f_1) { const f_1 = semiMinorAxis; this .semiMajorAxis = semiMajorAxis; // a this .semiMinorAxis = semiMajorAxis * (1 - (1 / f_1)); // c } else { this .semiMajorAxis = semiMajorAxis; // a this .semiMinorAxis = semiMinorAxis; // c } return this; }, toString () { return `${this .semiMajorAxis} ${this .semiMinorAxis}`; }, }); const __default__ = Spheroid3; ; /* harmony default export */ const Geometry_Spheroid3 = (external_X_ITE_X3D_Namespace_default().add ("Spheroid3", __default__)); ;// ./src/standard/Geospatial/ReferenceEllipsoids.js const ReferenceEllipsoids = new Map ([ // Earth // X3D Specification ["AA", new Geometry_Spheroid3 (6377563.396, 299.3249646, true)], // Airy 1830 ["AM", new Geometry_Spheroid3 (6377340.189, 299.3249646, true)], // Modified Airy ["AN", new Geometry_Spheroid3 (6378160, 298.25, true)], // Australian National ["BN", new Geometry_Spheroid3 (6377483.865, 299.1528128, true)], // Bessel 1841 (Namibia) ["BR", new Geometry_Spheroid3 (6377397.155, 299.1528128, true)], // Bessel 1841 (Ethiopia Indonesia...) ["CC", new Geometry_Spheroid3 (6378206.4, 294.9786982, true)], // Clarke 1866 ["CD", new Geometry_Spheroid3 (6378249.145, 293.465, true)], // Clarke 1880 ["EA", new Geometry_Spheroid3 (6377276.345, 300.8017, true)], // Everest (India 1830) ["EB", new Geometry_Spheroid3 (6377298.556, 300.8017, true)], // Everest (Sabah & Sarawak) ["EC", new Geometry_Spheroid3 (6377301.243, 300.8017, true)], // Everest (India 1956) ["ED", new Geometry_Spheroid3 (6377295.664, 300.8017, true)], // Everest (W. Malaysia 1969) ["EE", new Geometry_Spheroid3 (6377304.063, 300.8017, true)], // Everest (W. Malaysia & Singapore 1948) ["EF", new Geometry_Spheroid3 (6377309.613, 300.8017, true)], // Everest (Pakistan) ["FA", new Geometry_Spheroid3 (6378155, 298.3, true)], // Modified Fischer 1960 ["HE", new Geometry_Spheroid3 (6378200, 298.3, true)], // Helmert 1906 ["HO", new Geometry_Spheroid3 (6378270, 297, true)], // Hough 1960 ["ID", new Geometry_Spheroid3 (6378160, 298.247, true)], // Indonesian 1974 ["IN", new Geometry_Spheroid3 (6378388, 297, true)], // International 1924 ["KA", new Geometry_Spheroid3 (6378245, 298.3, true)], // Krassovsky 1940 ["RF", new Geometry_Spheroid3 (6378137, 298.257222101, true)], // Geodetic Reference System 1980 (GRS 80) ["SA", new Geometry_Spheroid3 (6378160, 298.25, true)], // South American 1969 ["WD", new Geometry_Spheroid3 (6378135, 298.26, true)], // WGS 72 ["WE", new Geometry_Spheroid3 (6378137, 298.257223563, true)], // WGS 84 // Solar System // https:,//en.wikipedia.de // Can someone give me more accurate parameters. ["SUN", new Geometry_Spheroid3 (696342000, 1 / 9e-6, true)], ["MERCURY", new Geometry_Spheroid3 (2439700, 2439700)], ["VENUS", new Geometry_Spheroid3 (6051800, 6051800)], ["MOON", new Geometry_Spheroid3 (1738140, 1735970)], ["MARS", new Geometry_Spheroid3 (3395428, 3377678)], // https",//adsabs.harvard.edu/abs/2010EM%26P..106....1A ["JUPITER", new Geometry_Spheroid3 (71492000, 66854000)], ["SATURN", new Geometry_Spheroid3 (60268000, 54364000)], ["URANUS", new Geometry_Spheroid3 (2555000, 24973000)], ["NEPTUNE", new Geometry_Spheroid3 (24764000, 24341000)], ["PLUTO", new Geometry_Spheroid3 (1153000, 1153000)], ]); const ReferenceEllipsoids_default_ = ReferenceEllipsoids; ; /* harmony default export */ const Geospatial_ReferenceEllipsoids = (external_X_ITE_X3D_Namespace_default().add ("ReferenceEllipsoids", ReferenceEllipsoids_default_)); ;// ./src/standard/Geospatial/Geodetic.js const EPS_H = 1e-3, EPS_P = 1e-10, IMAX = 30; function Geodetic (spheroid, latitudeFirst, radians) { this .longitudeFirst = ! latitudeFirst; this .degrees = ! radians; this .a = spheroid .semiMajorAxis; this .c = spheroid .semiMinorAxis; this .c2a2 = (spheroid .semiMinorAxis / this .a) ** 2; this .ecc2 = 1 - this .c2a2; } Object .assign (Geodetic .prototype, { convert (geodetic, result) { const elevation = geodetic .z; if (this .longitudeFirst) { var latitude = geodetic .y, longitude = geodetic .x; } else { var latitude = geodetic .x, longitude = geodetic .y; } if (this .degrees) { latitude *= Math .PI / 180; longitude *= Math .PI / 180; } return this .convertRadians (latitude, longitude, elevation, result); }, convertRadians (latitude, longitude, elevation, result) { const slat = Math .sin (latitude), slat2 = slat ** 2, clat = Math .cos (latitude), N = this .a / Math .sqrt (1 - this .ecc2 * slat2), Nhl = (N + elevation) * clat; return result .set (Nhl * Math .cos (longitude), Nhl * Math .sin (longitude), (N * this .c2a2 + elevation) * slat); }, apply (geocentric, result) { this .applyRadians (geocentric, result); if (this .degrees) { result .x *= 180 / Math .PI; // latitude result .y *= 180 / Math .PI; // longitude } if (this .longitudeFirst) { const tmp = result .x; result .x = result .y; // latitude result .y = tmp; // longitude } return result; }, applyRadians (geocentric, result) { const x = geocentric .x, y = geocentric .y, z = geocentric .z; const P = Math .sqrt (x * x + y * y); // Handle pole case. if (P == 0) return result .set (Math .PI, 0, z - this .c); let latitude = 0, longitude = Math .atan2 (y, x), elevation = 0; let a = this .a, N = a, ecc2 = this .ecc2; for (let i = 0; i < IMAX; ++ i) { const h0 = elevation, b0 = latitude; latitude = Math .atan (z / P / (1 - ecc2 * N / (N + elevation))); const sin_p = Math .sin (latitude); N = a / Math .sqrt (1 - ecc2 * sin_p * sin_p); elevation = P / Math .cos (latitude) - N; if (Math .abs (elevation - h0) < EPS_H && Math .abs (latitude - b0) < EPS_P) break; } return result .set (latitude, longitude, elevation); }, normal (geocentric, result) { const geodetic = this .applyRadians (geocentric, result); const latitude = geodetic .x, longitude = geodetic .y; const clat = Math .cos (latitude); const nx = Math .cos (longitude) * clat, ny = Math .sin (longitude) * clat, nz = Math .sin (latitude); return result .set (nx, ny, nz); }, }); const Geodetic_default_ = Geodetic; ; /* harmony default export */ const Geospatial_Geodetic = (external_X_ITE_X3D_Namespace_default().add ("Geodetic", Geodetic_default_)); ;// external "__X_ITE_X3D__ .Algorithm" const external_X_ITE_X3D_Algorithm_namespaceObject = __X_ITE_X3D__ .Algorithm; var external_X_ITE_X3D_Algorithm_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Algorithm_namespaceObject); ;// ./src/standard/Geospatial/UniversalTransverseMercator.js const N0 = 1.0e7, E0 = 5.0e5, k0 = 0.9996; function UniversalTransverseMercator (spheroid, zone, northernHemisphere, northingFirst) { const a = spheroid .semiMajorAxis, ecc2 = 1 - (spheroid .semiMinorAxis / a) ** 2, EE = ecc2 / (1 - ecc2), e1 = (1 - Math .sqrt (1 - ecc2)) / (1 + Math .sqrt (1 - ecc2)); this .southernHemisphere = ! northernHemisphere; this .eastingFirst = ! northingFirst; this .a = a; this .ecc2 = ecc2; this .EE = EE; this .E8 = 8 * EE; this .E9 = 9 * EE; this .E252 = 252 * EE; this .e1 = e1; this .A = k0 * (a * (1 - ecc2 / 4 - 3 * ecc2 * ecc2 / 64 - 5 * ecc2 * ecc2 * ecc2 / 256)); this .B = 3 * e1 / 2 - 7 * e1 * e1 * e1 / 32; this .C = 21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32; this .D = 151 * e1 * e1 * e1 / 96; this .E = a * (1 - ecc2); this .W = 1 - ecc2 / 4 - 3 * ecc2 * ecc2 / 64 - 5 * ecc2 * ecc2 * ecc2 / 256; this .X = 3 * ecc2 / 8 + 3 * ecc2 * ecc2 / 32 + 45 * ecc2 * ecc2 * ecc2 / 1024; this .Y = 15 * ecc2 * ecc2 / 256 + 45 * ecc2 * ecc2 * ecc2 / 1024; this .Z = 35 * ecc2 * ecc2 * ecc2 / 3072; this .longitude0 = external_X_ITE_X3D_Algorithm_default().radians (zone * 6 - 183); this .geodeticConverter = new Geospatial_Geodetic (spheroid, true, true); } Object .assign (UniversalTransverseMercator .prototype, { convert (utm, result) { // https://gist.github.com/duedal/840476 if (this .eastingFirst) { var northing = utm .y, easting = utm .x; } else { var northing = utm .x, easting = utm .y; } // Check for southern hemisphere and remove offset from easting. let S = this .southernHemisphere; if (northing < 0) { S = ! this .southernHemisphere; northing = -northing; } if (S) northing -= N0; easting -= E0; // Begin calculation. const mu = northing / this .A, phi1 = mu + this .B * Math .sin (2 * mu) + this .C * Math .sin (4 * mu) + this .D * Math .sin (6 * mu); const sinphi1 = Math .sin (phi1) ** 2, cosphi1 = Math .cos (phi1), tanphi1 = Math .tan (phi1); const N1 = this .a / Math .sqrt (1 - this .ecc2 * sinphi1), T2 = tanphi1 ** 2, T8 = tanphi1 ** 8, C1 = this .EE * T2, C2 = C1 * C1, R1 = this .E / (1 - this .ecc2 * sinphi1) ** 1.5, I = easting / (N1 * k0); const J = (5 + 3 * T2 + 10 * C1 - 4 * C2 - this .E9) * I ** 4 / 24, K = (61 + 90 * T2 + 298 * C1 + 45 * T8 - this .E252 - 3 * C2) * I ** 6 / 720, L = (5 - 2 * C1 + 28 * T2 - 3 * C2 + this .E8 + 24 * T8) * I ** 5 / 120; const latitude = phi1 - (N1 * tanphi1 / R1) * (I * I / 2 - J + K), longitude = this .longitude0 + (I - (1 + 2 * T2 + C1) * I ** 3 / 6 + L) / cosphi1; return this .geodeticConverter .convertRadians (latitude, longitude, utm .z, result); }, apply (geocentric, result) { // https://gist.github.com/duedal/840476 const geodetic = this .geodeticConverter .applyRadians (geocentric, result), latitude = geodetic .x, longitude = geodetic .y; const tanlat = Math .tan (latitude), coslat = Math .cos (latitude); const EE = this .EE, N = this .a / Math .sqrt (1 - this .ecc2 * Math .sin (latitude) ** 2), T = tanlat * tanlat, T6 = T * T * T, C = EE * coslat * coslat, A = coslat * (longitude - this .longitude0); const M = this .a * (this .W * latitude - this .X * Math .sin (2 * latitude) + this .Y * Math .sin (4 * latitude) - this .Z * Math .sin (6 * latitude)); const easting = k0 * N * (A + (1 - T + C) * A ** 3 / 6 + (5 - 18 * T6 + 72 * C - 58 * EE) * A ** 5 / 120) + E0; let northing = k0 * (M + N * tanlat * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A ** 4 / 24 + (61 - 58 * T6 + 600 * C - 330 * EE) * A ** 6 / 720)); if (latitude < 0) { northing += N0; if (! this .southernHemisphere) northing = -northing; } else { if (this .southernHemisphere) northing = -northing; } if (this .eastingFirst) return result .set (easting, northing, geodetic .z); return result .set (northing, easting, geodetic .z); }, }); const UniversalTransverseMercator_default_ = UniversalTransverseMercator; ; /* harmony default export */ const Geospatial_UniversalTransverseMercator = (external_X_ITE_X3D_Namespace_default().add ("UniversalTransverseMercator", UniversalTransverseMercator_default_)); ;// ./src/x_ite/Browser/Geospatial/Geocentric.js function Geocentric () { } Object .assign (Geocentric .prototype, { convert (geocentric, result) { return result .assign (geocentric); }, apply (geocentric, result) { return result .assign (geocentric); }, slerp (source, destination, t) { const sourceLength = source .norm (), destinationLength = destination .norm (); source .normalize (); destination .normalize (); return external_X_ITE_X3D_Algorithm_default().simpleSlerp (source, destination, t) .multiply (external_X_ITE_X3D_Algorithm_default().lerp (sourceLength, destinationLength, t)); }, }); const Geocentric_default_ = Geocentric; ; /* harmony default export */ const Geospatial_Geocentric = (external_X_ITE_X3D_Namespace_default().add ("Geocentric", Geocentric_default_)); ;// ./src/x_ite/Browser/Geospatial/GeospatialObject.js let i = 0; const GD = i ++, UTM = i ++, GC = i ++; const CoordinateSystems = new Map ([ ["GD", GD], ["GDC", GD], ["UTM", UTM], ["GC", GC], ["GCC", GC], ["GS", GC], ]); const Zone = /^Z(\d+)$/; const GeospatialObject = { GD: GD, UTM: UTM, GC: GC, getReferenceFrame (geoSystem, radians) { switch (this .getCoordinateSystem (geoSystem)) { case GD: { return new Geospatial_Geodetic (this .getEllipsoid (geoSystem), this .getLatitudeFirst (geoSystem), radians); } case UTM: { return new Geospatial_UniversalTransverseMercator (this .getEllipsoid (geoSystem), this .getZone (geoSystem), this .getNorthernHemisphere (geoSystem), this .getNorthingFirst (geoSystem)); } case GC: { return new Geospatial_Geocentric (); } } return new Geospatial_Geodetic (Geospatial_ReferenceEllipsoids .get ("WE"), true, radians); }, getElevationFrame (geoSystem, radians) { return new Geospatial_Geodetic (this .getEllipsoid (geoSystem), true, radians); }, getCoordinateSystem (geoSystem) { for (const gs of geoSystem) { const coordinateSystem = CoordinateSystems .get (gs); if (coordinateSystem !== undefined) return coordinateSystem; } return GD; }, getEllipsoid (geoSystem) { for (const gs of geoSystem) { const ellipsoid = Geospatial_ReferenceEllipsoids .get (gs); if (ellipsoid !== undefined) return ellipsoid; } return Geospatial_ReferenceEllipsoids .get ("WE"); }, // getEllipsoidString (geoSystem) // { // for (const gs of geoSystem) // { // const ellipsoid = ReferenceEllipsoids .get (gs); // if (ellipsoid !== undefined) // return gs; // } // return "WE"; // }, isStandardOrder (geoSystem) { switch (this .getCoordinateSystem (geoSystem)) { case GD: { return this .getLatitudeFirst (geoSystem); } case UTM: { return this .getNorthingFirst (geoSystem); } case GC: { return true; } } return this .getLatitudeFirst (geoSystem); }, getLatitudeFirst (geoSystem) { for (const gs of geoSystem) { if (gs === "longitude_first") return false; } return true; }, getNorthingFirst (geoSystem) { for (const gs of geoSystem) { if (gs === "easting_first") return false; } return true; }, getZone (geoSystem) { for (const gs of geoSystem) { const match = gs .match (Zone); if (match) return parseInt (match [1]); } return 1; }, getNorthernHemisphere (geoSystem) { for (const gs of geoSystem) { if (gs === "S") return false; } return true; }, }; const GeospatialObject_default_ = GeospatialObject; ; /* harmony default export */ const Geospatial_GeospatialObject = (external_X_ITE_X3D_Namespace_default().add ("GeospatialObject", GeospatialObject_default_)); ;// external "__X_ITE_X3D__ .X3DCast" const external_X_ITE_X3D_X3DCast_namespaceObject = __X_ITE_X3D__ .X3DCast; var external_X_ITE_X3D_X3DCast_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DCast_namespaceObject); ;// external "__X_ITE_X3D__ .Vector3" const external_X_ITE_X3D_Vector3_namespaceObject = __X_ITE_X3D__ .Vector3; var external_X_ITE_X3D_Vector3_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Vector3_namespaceObject); ;// external "__X_ITE_X3D__ .Matrix4" const external_X_ITE_X3D_Matrix4_namespaceObject = __X_ITE_X3D__ .Matrix4; var external_X_ITE_X3D_Matrix4_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Matrix4_namespaceObject); ;// ./src/x_ite/Components/Geospatial/X3DGeospatialObject.js const vector = new (external_X_ITE_X3D_Vector3_default()) (), result = new (external_X_ITE_X3D_Vector3_default()) (), t = new (external_X_ITE_X3D_Vector3_default()) (), x = new (external_X_ITE_X3D_Vector3_default()) (), y = new (external_X_ITE_X3D_Vector3_default()) (), z = new (external_X_ITE_X3D_Vector3_default()) (); function X3DGeospatialObject (executionContext) { this .addType ((external_X_ITE_X3D_X3DConstants_default()).X3DGeospatialObject); this .radians = false; this .origin = new (external_X_ITE_X3D_Vector3_default()) (); this .originMatrix = new (external_X_ITE_X3D_Matrix4_default()) (); this .invOriginMatrix = new (external_X_ITE_X3D_Matrix4_default()) (); } Object .assign (X3DGeospatialObject .prototype, { initialize () { this ._geoSystem .addInterest ("set_geoSystem__", this); this ._geoOrigin .addInterest ("set_geoOrigin__", this); this .set_geoSystem__ (); this .set_geoOrigin__ (); }, set_geoSystem__ () { this .coordinateSystem = Geospatial_GeospatialObject .getCoordinateSystem (this ._geoSystem); this .referenceFrame = Geospatial_GeospatialObject .getReferenceFrame (this ._geoSystem, this .radians); this .elevationFrame = Geospatial_GeospatialObject .getElevationFrame (this ._geoSystem, this .radians); this .standardOrder = Geospatial_GeospatialObject .isStandardOrder (this ._geoSystem); }, set_geoOrigin__ () { if (this .geoOriginNode) { this .geoOriginNode .removeInterest ("set_origin__", this); this .geoOriginNode .removeInterest ("set_rotateYUp__", this); this .geoOriginNode .removeInterest ("addNodeEvent", this); } this .geoOriginNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).GeoOrigin, this ._geoOrigin); if (this .geoOriginNode) { this .geoOriginNode .addInterest ("set_origin__", this); this .geoOriginNode .addInterest ("set_rotateYUp__", this); this .geoOriginNode .addInterest ("addNodeEvent", this); } this .set_origin__ (); this .set_rotateYUp__ (); }, set_origin__ () { if (this .geoOriginNode) this .geoOriginNode .getOrigin (this .origin); else this .origin .set (0); this .set_originMatrix__ (); }, set_originMatrix__ () { if (this .geoOriginNode) { // Position const t = this .origin; // Let's work out the orientation at that location in order // to maintain a view where +Y is in the direction of gravitational // up for that region of the planet's surface. This will be the // value of the rotation matrix for the transform. this .elevationFrame .normal (t, y); x .set (0, 0, 1) .cross (y); // Handle pole cases. if (x .equals ((external_X_ITE_X3D_Vector3_default()).Zero)) x .set (1, 0, 0); z .assign (x) .cross (y); x .normalize (); z .normalize (); this .originMatrix .set (x .x, x .y, x .z, 0, y .x, y .y, y .z, 0, z .x, z .y, z .z, 0, t .x, t .y, t .z, 1); this .invOriginMatrix .assign (this .originMatrix) .inverse (); } }, set_rotateYUp__ () { if (this .geoOriginNode && this .geoOriginNode ._rotateYUp .getValue ()) { this .getCoord = getCoordRotateYUp; this .getGeoCoord = getGeoCoordRotateYUp; this .getGeoUpVector = getGeoUpVectorRotateYUp; this .getLocationMatrix = getLocationMatrixRotateYUp; } else { delete this .getCoord; delete this .getGeoCoord; delete this .getGeoUpVector; delete this .getLocationMatrix; } }, getReferenceFrame () { return this .referenceFrame; }, getStandardOrder () { return this .standardOrder; }, getCoord (geoPoint, result) { return this .referenceFrame .convert (geoPoint, result) .subtract (this .origin); }, getGeoCoord (point, result) { return this .referenceFrame .apply (vector .assign (point) .add (this .origin), result); }, getGeoElevation (point) { return this .getGeoCoord (point, result) .z; }, getGeoUpVector (point, result) { return this .elevationFrame .normal (vector .assign (point) .add (this .origin), result); }, getLocationMatrix (geoPoint, result) { const origin = this .origin, locationMatrix = getStandardLocationMatrix .call (this, geoPoint, result); // translateRight (-origin) locationMatrix [12] -= origin .x; locationMatrix [13] -= origin .y; locationMatrix [14] -= origin .z; return locationMatrix; }, dispose () { }, }); function getCoordRotateYUp (geoPoint, result) { return this .invOriginMatrix .multVecMatrix (this .referenceFrame .convert (geoPoint, result)); } function getGeoCoordRotateYUp (point, result) { return this .referenceFrame .apply (this .originMatrix .multVecMatrix (vector .assign (point)), result); } function getGeoUpVectorRotateYUp (point, result) { return this .invOriginMatrix .multDirMatrix (this .elevationFrame .normal (this .originMatrix .multVecMatrix (vector .assign (point)), result)); } function getLocationMatrixRotateYUp (geoPoint, result) { return getStandardLocationMatrix .call (this, geoPoint, result) .multRight (this .invOriginMatrix); } function getStandardLocationMatrix (geoPoint, result) { // Position this .referenceFrame .convert (geoPoint, t); // Let's work out the orientation at that location in order // to maintain a view where +Y is in the direction of gravitional // up for that region of the planet's surface. This will be the // value of the rotation matrix for the transform. this .elevationFrame .normal (t, y); x .set (0, 0, 1) .cross (y); // Handle pole cases. if (x .equals ((external_X_ITE_X3D_Vector3_default()).Zero)) x .set (1, 0, 0); z .assign (x) .cross (y); x .normalize (); z .normalize (); return result .set (x .x, x .y, x .z, 0, y .x, y .y, y .z, 0, z .x, z .y, z .z, 0, t .x, t .y, t .z, 1); } Object .defineProperties (X3DGeospatialObject, external_X_ITE_X3D_X3DNode_default().getStaticProperties ("X3DGeospatialObject", "Geospatial", 1)); const X3DGeospatialObject_default_ = X3DGeospatialObject; ; /* harmony default export */ const Geospatial_X3DGeospatialObject = (external_X_ITE_X3D_Namespace_default().add ("X3DGeospatialObject", X3DGeospatialObject_default_)); ;// external "__X_ITE_X3D__ .Triangle3" const external_X_ITE_X3D_Triangle3_namespaceObject = __X_ITE_X3D__ .Triangle3; var external_X_ITE_X3D_Triangle3_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Triangle3_namespaceObject); ;// ./src/x_ite/Components/Geospatial/GeoCoordinate.js function GeoCoordinate (executionContext) { external_X_ITE_X3D_X3DCoordinateNode_default().call (this, executionContext); Geospatial_X3DGeospatialObject .call (this, executionContext); this .addType ((external_X_ITE_X3D_X3DConstants_default()).GeoCoordinate); } Object .assign (Object .setPrototypeOf (GeoCoordinate .prototype, (external_X_ITE_X3D_X3DCoordinateNode_default()).prototype), Geospatial_X3DGeospatialObject .prototype, { initialize () { external_X_ITE_X3D_X3DCoordinateNode_default().prototype .initialize .call (this); Geospatial_X3DGeospatialObject .prototype .initialize .call (this); }, set1Point: (() => { const result = new (external_X_ITE_X3D_Vector3_default()) (); return function (index, point) { this ._point [index] = this .getGeoCoord (point, result); }; })(), get1Point: (() => { const p = new (external_X_ITE_X3D_Vector3_default()) (); return function (index, result) { if (index < this .length) { const point = this .point; index *= 3; return this .getCoord (p .set (point [index], point [index + 1], point [index + 2]), result); } else { return result .set (0); } }; })(), addPoint: (() => { const p = new (external_X_ITE_X3D_Vector3_default()) (), g = new (external_X_ITE_X3D_Vector3_default()) (); return function (index, array) { if (index < this .length) { const point = this .point; index *= 3; this .getCoord (p .set (point [index], point [index + 1], point [index + 2]), g); array .push (g [0], g [1], g [2], 1); } else { array .push (0, 0, 0, 1); } }; })(), addPoints: (() => { const p = new (external_X_ITE_X3D_Vector3_default()) (), g = new (external_X_ITE_X3D_Vector3_default()) (); return function (array) { const point = this .point, length = this .length * 3; for (let index = 0; index < length; index += 3) { this .getCoord (p .set (point [index], point [index + 1], point [index + 2]), g); array .push (g [0], g [1], g [2], 1); } return array; }; })(), getNormal: (() => { const point1 = new (external_X_ITE_X3D_Vector3_default()) (), point2 = new (external_X_ITE_X3D_Vector3_default()) (), point3 = new (external_X_ITE_X3D_Vector3_default()) (); return function (index1, index2, index3) { // The index[1,2,3] cannot be less than 0. const length = this .length; if (index1 < length && index2 < length && index3 < length) { return external_X_ITE_X3D_Triangle3_default().normal (this .get1Point (index1, point1), this .get1Point (index2, point2), this .get1Point (index3, point3), new (external_X_ITE_X3D_Vector3_default()) ()); } return new (external_X_ITE_X3D_Vector3_default()) (); }; })(), getQuadNormal: (() => { const point1 = new (external_X_ITE_X3D_Vector3_default()) (), point2 = new (external_X_ITE_X3D_Vector3_default()) (), point3 = new (external_X_ITE_X3D_Vector3_default()) (), point4 = new (external_X_ITE_X3D_Vector3_default()) (); return function (index1, index2, index3, index4) { // The index[1,2,3,4] cannot be less than 0. const length = this .length; if (index1 < length && index2 < length && index3 < length && index4 < length) { return external_X_ITE_X3D_Triangle3_default().quadNormal (this .get1Point (index1, point1), this .get1Point (index2, point2), this .get1Point (index3, point3), this .get1Point (index4, point4), new (external_X_ITE_X3D_Vector3_default()) ()); } return new (external_X_ITE_X3D_Vector3_default()) (); }; })(), dispose () { Geospatial_X3DGeospatialObject .prototype .dispose .call (this); external_X_ITE_X3D_X3DCoordinateNode_default().prototype .dispose .call (this); }, }); Object .defineProperties (GeoCoordinate, { ... external_X_ITE_X3D_X3DNode_default().getStaticProperties ("GeoCoordinate", "Geospatial", 1, "coord", "3.0"), fieldDefinitions: { value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "geoOrigin", new (external_X_ITE_X3D_Fields_default()).SFNode ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "geoSystem", new (external_X_ITE_X3D_Fields_default()).MFString ("GD", "WE")), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "point", new (external_X_ITE_X3D_Fields_default()).MFVec3d ()), ]), enumerable: true, }, }); const GeoCoordinate_default_ = GeoCoordinate; ; /* harmony default export */ const Geospatial_GeoCoordinate = (external_X_ITE_X3D_Namespace_default().add ("GeoCoordinate", GeoCoordinate_default_)); ;// external "__X_ITE_X3D__ .X3DGeometryNode" const external_X_ITE_X3D_X3DGeometryNode_namespaceObject = __X_ITE_X3D__ .X3DGeometryNode; var external_X_ITE_X3D_X3DGeometryNode_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DGeometryNode_namespaceObject); ;// external "__X_ITE_X3D__ .Vector2" const external_X_ITE_X3D_Vector2_namespaceObject = __X_ITE_X3D__ .Vector2; var external_X_ITE_X3D_Vector2_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Vector2_namespaceObject); ;// ./src/x_ite/Components/Geospatial/GeoElevationGrid.js function GeoElevationGrid (executionContext) { external_X_ITE_X3D_X3DGeometryNode_default().call (this, executionContext); Geospatial_X3DGeospatialObject .call (this, executionContext); this .addType ((external_X_ITE_X3D_X3DConstants_default()).GeoElevationGrid); // Units this ._set_height .setUnit ("length"); this ._creaseAngle .setUnit ("angle"); this ._height .setUnit ("length"); } Object .assign (Object .setPrototypeOf (GeoElevationGrid .prototype, (external_X_ITE_X3D_X3DGeometryNode_default()).prototype), Geospatial_X3DGeospatialObject .prototype, { initialize () { external_X_ITE_X3D_X3DGeometryNode_default().prototype .initialize .call (this); Geospatial_X3DGeospatialObject .prototype .initialize .call (this); this ._set_height .addFieldInterest (this ._height); this ._color .addInterest ("set_color__", this); this ._texCoord .addInterest ("set_texCoord__", this); this ._tangent .addInterest ("set_tangent__", this); this ._normal .addInterest ("set_normal__", this); this .set_color__ (); this .set_texCoord__ (); this .set_tangent__ (); this .set_normal__ (); }, getHeight (index) { if (index < this ._height .length) return this ._height [index] * this ._yScale .getValue (); return 0; }, createTexCoords () { const texCoords = [ ], xDimension = this ._xDimension .getValue (), zDimension = this ._zDimension .getValue (), xSize = xDimension - 1, zSize = zDimension - 1; for (let z = 0; z < zDimension; ++ z) { for (let x = 0; x < xDimension; ++ x) texCoords .push (new (external_X_ITE_X3D_Vector2_default()) (x / xSize, z / zSize)); } return texCoords; }, createNormals (points, coordIndex, creaseAngle) { const cw = !this ._ccw .getValue (), normalIndex = new Map (), normals = [ ]; for (let p = 0; p < points .length; ++ p) normalIndex .set (p, [ ]); for (let c = 0; c < coordIndex .length; c += 3) { const c0 = coordIndex [c], c1 = coordIndex [c + 1], c2 = coordIndex [c + 2]; normalIndex .get (c0) .push (normals .length); normalIndex .get (c1) .push (normals .length + 1); normalIndex .get (c2) .push (normals .length + 2); const normal = external_X_ITE_X3D_Triangle3_default().normal (points [c0], points [c1], points [c2], new (external_X_ITE_X3D_Vector3_default()) ()); if (cw) normal .negate (); normals .push (normal); normals .push (normal); normals .push (normal); } if (!this ._normalPerVertex .getValue ()) return normals; return this .refineNormals (normalIndex, normals, creaseAngle ?? this ._creaseAngle .getValue ()); }, createCoordIndex () { // p1 - p4 // | \ | // p2 - p3 const coordIndex = [ ], xDimension = this ._xDimension .getValue (), zDimension = this ._zDimension .getValue (), xSize = xDimension - 1, zSize = zDimension - 1; for (let z = 0; z < zSize; ++ z) { for (let x = 0; x < xSize; ++ x) { const i1 = z * xDimension + x, i2 = (z + 1) * xDimension + x, i3 = (z + 1) * xDimension + (x + 1), i4 = z * xDimension + (x + 1); coordIndex .push (i1); // p1 coordIndex .push (i3); // p3 coordIndex .push (i2); // p2 coordIndex .push (i1); // p1 coordIndex .push (i4); // p4 coordIndex .push (i3); // p3 } } return coordIndex; }, createPoints () { const points = [ ], xDimension = this ._xDimension .getValue (), zDimension = this ._zDimension .getValue (), xSpacing = this ._xSpacing .getValue (), zSpacing = this ._zSpacing .getValue (); // When the geoSystem is "GD", xSpacing refers to the number of units of longitude in angle base units between // adjacent height values and zSpacing refers to the number of units of latitude in angle base units between // vertical height values. // When the geoSystem is "UTM", xSpacing refers to the number of eastings (length base units) between adjacent // height values and zSpacing refers to the number of northings (length base units) between vertical height values. if (this .getStandardOrder ()) { for (let z = 0; z < zDimension; ++ z) { for (let x = 0; x < xDimension; ++ x) { const point = new (external_X_ITE_X3D_Vector3_default()) (zSpacing * z, // latitude, northing xSpacing * x, // longitude, easting this .getHeight (x + z * xDimension)); point .add (this ._geoGridOrigin .getValue ()); points .push (this .getCoord (point, point)); } } } else { for (let z = 0; z < zDimension; ++ z) { for (let x = 0; x < xDimension; ++ x) { const point = new (external_X_ITE_X3D_Vector3_default()) (xSpacing * x, // longitude, easting zSpacing * z, // latitude, northing this .getHeight (x + z * xDimension)); point .add (this ._geoGridOrigin .getValue ()); points .push (this .getCoord (point, point)); } } } return points; }, build () { if (this ._xDimension .getValue () < 2 || this ._zDimension .getValue () < 2) return; const colorPerVertex = this ._colorPerVertex .getValue (), normalPerVertex = this ._normalPerVertex .getValue (), coordIndex = this .createCoordIndex (), colorNode = this .getColor (), texCoordNode = this .getTexCoord (), tangentNode = this .getTangent (), normalNode = this .getNormal (), points = this .createPoints (), colorArray = this .getColors (), multiTexCoordArray = this .getMultiTexCoords (), tangentArray = this .getTangents (), normalArray = this .getNormals (), vertexArray = this .getVertices (); let face = 0; // Vertex attribute //std::vector <std::vector <float>> attribArrays (attribNodes .size ()); //for (size_t a = 0, size = attribNodes .size (); a < size; ++ a) // attribArrays [a] .reserve (coordIndex .size ()); if (texCoordNode) { texCoordNode .init (multiTexCoordArray); } else { var texCoords = this .createTexCoords (), texCoordArray = this .getTexCoords (); multiTexCoordArray .push (texCoordArray); } // Build geometry for (let c = 0; c < coordIndex .length; ++ face) { for (let p = 0; p < 6; ++ p, ++ c) { const index = coordIndex [c], { x, y, z } = points [index]; //for (size_t a = 0, size = attribNodes .size (); a < size; ++ a) // attribNodes [a] -> addValue (attribArrays [a], i); colorNode ?.addColor (colorPerVertex ? index : face, colorArray); if (texCoordNode) { texCoordNode .addPoint (index, multiTexCoordArray); } else { const { x, y } = texCoords [index]; texCoordArray .push (x, y, 0, 1); } tangentNode ?.addVector (normalPerVertex ? index : face, tangentArray); normalNode ?.addVector (normalPerVertex ? index : face, normalArray); vertexArray .push (x, y, z, 1); } } // Add auto-generated normals if needed. if (!normalNode) { const normals = this .createNormals (points, coordIndex); for (const { x, y, z } of normals) normalArray .push (x, y, z); } this .setSolid (this ._solid .getValue ()); this .setCCW (this ._ccw .getValue ()); }, dispose () { Geospatial_X3DGeospatialObject .prototype .dispose .call (this); external_X_ITE_X3D_X3DGeometryNode_default().prototype .dispose .call (this); }, }); Object .defineProperties (GeoElevationGrid, { ... external_X_ITE_X3D_X3DNode_default().getStaticProperties ("GeoElevationGrid", "Geospatial", 1, "geometry", "3.0"), fieldDefinitions: { value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "geoOrigin", new (external_X_ITE_X3D_Fields_default()).SFNode ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "geoSystem", new (external_X_ITE_X3D_Fields_default()).MFString ("GD", "WE")), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOnly, "set_height", new (external_X_ITE_X3D_Fields_default()).MFDouble ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "geoGridOrigin", new (external_X_ITE_X3D_Fields_default()).SFVec3d ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "xDimension", new (external_X_ITE_X3D_Fields_default()).SFInt32 ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "zDimension", new (external_X_ITE_X3D_Fields_default()).SFInt32 ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "xSpacing", new (external_X_ITE_X3D_Fields_default()).SFDouble (1)), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "zSpacing", new (external_X_ITE_X3D_Fields_default()).SFDouble (1)), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "yScale", new (external_X_ITE_X3D_Fields_default()).SFFloat (1)), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "solid", new (external_X_ITE_X3D_Fields_default()).SFBool (true)), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "ccw", new (external_X_ITE_X3D_Fields_default()).SFBool (true)), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "creaseAngle", new (external_X_ITE_X3D_Fields_default()).SFDouble ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "colorPerVertex", new (external_X_ITE_X3D_Fields_default()).SFBool (true)), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "normalPerVertex", new (external_X_ITE_X3D_Fields_default()).SFBool (true)), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "color", new (external_X_ITE_X3D_Fields_default()).SFNode ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "texCoord", new (external_X_ITE_X3D_Fields_default()).SFNode ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "tangent", new (external_X_ITE_X3D_Fields_default()).SFNode ()), // experimental new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "normal", new (external_X_ITE_X3D_Fields_default()).SFNode ()), new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "height", new (external_X_ITE_X3D_Fields_default()).MFDouble (0, 0)), ]), enumerable: true, }, }); const GeoElevationGrid_default_ = GeoElevationGrid; ; /* harmony default export */ const Geospatial_GeoElevationGrid = (external_X_ITE_X3D_Namespace_default().add ("GeoElevationGrid", GeoElevationGrid_default_)); ;// external "__X_ITE_X3D__ .X3DChildNode" const external_X_ITE_X3D_X3DChildNode_namespaceObject = __X_ITE_X3D__ .X3DChildNode; var external_X_ITE_X3D_X3DChildNode_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DChildNode_namespaceObject); ;// external "__X_ITE_X3D__ .X3DBoundedObject" const external_X_ITE_X3D_X3DBoundedObject_namespaceObject = __X_ITE_X3D__ .X3DBoundedObject; var external_X