react-map4d-map 1.2.5 → 1.2.7

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/index.js CHANGED
@@ -781,19 +781,15 @@ var MFMap = function MFMap(props) {
781
781
 
782
782
  var createCallback = function createCallback() {
783
783
  window[callback.current] = function () {
784
- if (mapDomRef.current) {
785
- var options = props.options;
786
- mapRef.current = new window.map4d.Map(mapDomRef.current, options);
784
+ var options = props.options;
785
+ mapRef.current = new window.map4d.Map(mapDomRef.current, options);
787
786
 
788
- if (props.onMapReady) {
789
- props.onMapReady(mapRef.current, id);
790
- }
791
-
792
- registerEvent();
793
- setMap(mapRef.current);
794
- } else {
795
- console.error("MFMap: map element is NOT found");
787
+ if (props.onMapReady) {
788
+ props.onMapReady(mapRef.current, id);
796
789
  }
790
+
791
+ registerEvent();
792
+ setMap(mapRef.current);
797
793
  };
798
794
  };
799
795
 
@@ -836,7 +832,7 @@ var MFMap = function MFMap(props) {
836
832
 
837
833
  destroy();
838
834
  };
839
- }, [props.environment, props.version, props.accessKey]);
835
+ }, [props.environment, props.version, props.accessKey, props.options]);
840
836
 
841
837
  var registerEvent = function registerEvent() {
842
838
  var _mapRef$current2, _mapRef$current3, _mapRef$current4, _mapRef$current5, _mapRef$current6, _mapRef$current7, _mapRef$current8, _mapRef$current9, _mapRef$current10, _mapRef$current11, _mapRef$current12, _mapRef$current13, _mapRef$current14, _mapRef$current15, _mapRef$current16, _mapRef$current17, _mapRef$current18, _mapRef$current19, _mapRef$current20;
@@ -1024,21 +1020,16 @@ var MFMap = function MFMap(props) {
1024
1020
  var newContext = {
1025
1021
  map: map
1026
1022
  };
1027
-
1028
- var refDiv = function refDiv(r) {
1029
- mapDomRef.current = r;
1030
- };
1031
-
1032
- return React__default.createElement(Map4dContext.Provider, {
1033
- value: newContext
1034
- }, React__default.createElement("div", {
1023
+ return React__default.createElement(React.Fragment, null, React__default.createElement("div", {
1035
1024
  style: {
1036
1025
  width: '100%',
1037
1026
  height: '100%',
1038
1027
  display: 'block'
1039
1028
  },
1040
- ref: refDiv
1041
- }), props.children);
1029
+ ref: mapDomRef
1030
+ }), React__default.createElement(Map4dContext.Provider, {
1031
+ value: newContext
1032
+ }, props.children));
1042
1033
  };
1043
1034
 
1044
1035
  var MFMarker = function MFMarker(props) {
@@ -1964,6 +1955,1250 @@ var MFTileOverlay = function MFTileOverlay(props) {
1964
1955
  return null;
1965
1956
  };
1966
1957
 
1958
+ function _defineProperties(target, props) {
1959
+ for (var i = 0; i < props.length; i++) {
1960
+ var descriptor = props[i];
1961
+ descriptor.enumerable = descriptor.enumerable || false;
1962
+ descriptor.configurable = true;
1963
+ if ("value" in descriptor) descriptor.writable = true;
1964
+ Object.defineProperty(target, descriptor.key, descriptor);
1965
+ }
1966
+ }
1967
+
1968
+ function _createClass(Constructor, protoProps, staticProps) {
1969
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1970
+ if (staticProps) _defineProperties(Constructor, staticProps);
1971
+ Object.defineProperty(Constructor, "prototype", {
1972
+ writable: false
1973
+ });
1974
+ return Constructor;
1975
+ }
1976
+
1977
+ function _inheritsLoose(subClass, superClass) {
1978
+ subClass.prototype = Object.create(superClass.prototype);
1979
+ subClass.prototype.constructor = subClass;
1980
+
1981
+ _setPrototypeOf(subClass, superClass);
1982
+ }
1983
+
1984
+ function _setPrototypeOf(o, p) {
1985
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
1986
+ o.__proto__ = p;
1987
+ return o;
1988
+ };
1989
+ return _setPrototypeOf(o, p);
1990
+ }
1991
+
1992
+ var Vector2 = /*#__PURE__*/function () {
1993
+ function Vector2(x, y) {
1994
+ if (x === void 0) {
1995
+ x = 0.0;
1996
+ }
1997
+
1998
+ if (y === void 0) {
1999
+ y = 0.0;
2000
+ }
2001
+
2002
+ this.x = x;
2003
+ this.y = y;
2004
+ }
2005
+
2006
+ var _proto = Vector2.prototype;
2007
+
2008
+ _proto.clone = function clone() {
2009
+ return new Vector2(this.x, this.y);
2010
+ };
2011
+
2012
+ _proto.normalize = function normalize() {
2013
+ var length = this.length;
2014
+ var x = 0.0;
2015
+ var y = 0.0;
2016
+
2017
+ if (length > 0) {
2018
+ x = this.x / length;
2019
+ y = this.y / length;
2020
+ }
2021
+
2022
+ return new Vector2(x, y);
2023
+ };
2024
+
2025
+ _proto.set = function set(a) {
2026
+ this.x = a.x;
2027
+ this.y = a.y;
2028
+ };
2029
+
2030
+ _proto.invert = function invert() {
2031
+ return new Vector2(-this.x, -this.y);
2032
+ };
2033
+
2034
+ _proto.rotate90 = function rotate90() {
2035
+ return new Vector2(this.y, -this.x);
2036
+ };
2037
+
2038
+ _proto.add = function add(a) {
2039
+ return new Vector2(a.x + this.x, a.y + this.y);
2040
+ };
2041
+
2042
+ _proto.subtract = function subtract(a) {
2043
+ if (!a) {
2044
+ return this.clone();
2045
+ }
2046
+
2047
+ return new Vector2(this.x - a.x, this.y - a.y);
2048
+ };
2049
+
2050
+ _proto.multiply = function multiply(a) {
2051
+ return new Vector2(a * this.x, a * this.y);
2052
+ };
2053
+
2054
+ _proto.rotateBy = function rotateBy(a) {
2055
+ var cos = Math.cos(a * Math.PI / 180);
2056
+ var sin = Math.sin(a * Math.PI / 180);
2057
+ return new Vector2(this.x * cos - this.y * sin, this.x * sin + this.y * cos);
2058
+ };
2059
+
2060
+ _proto.rotateByRadian = function rotateByRadian(a) {
2061
+ var cos = Math.cos(a);
2062
+ var sin = Math.sin(a);
2063
+ return new Vector2(this.x * cos - this.y * sin, this.x * sin + this.y * cos);
2064
+ };
2065
+
2066
+ _proto.cross = function cross(a) {
2067
+ return this.x * a.y - this.y * a.x;
2068
+ };
2069
+
2070
+ _proto.dot = function dot(a) {
2071
+ return a.x * this.x + a.y * this.y;
2072
+ };
2073
+
2074
+ Vector2.perp = function perp(v1, v2) {
2075
+ return new Vector2(v2[1] - v1[1], v1[0] - v2[0]);
2076
+ };
2077
+
2078
+ Vector2.neg = function neg(v) {
2079
+ return new Vector2(-v.x, -v.y);
2080
+ };
2081
+
2082
+ _createClass(Vector2, [{
2083
+ key: "length",
2084
+ get: function get() {
2085
+ return Math.sqrt(this.x * this.x + this.y * this.y);
2086
+ }
2087
+ }, {
2088
+ key: "lengthSq",
2089
+ get: function get() {
2090
+ return this.x * this.x + this.y * this.y;
2091
+ }
2092
+ }]);
2093
+
2094
+ return Vector2;
2095
+ }();
2096
+
2097
+ var MathUtils = /*#__PURE__*/function () {
2098
+ function MathUtils() {}
2099
+
2100
+ MathUtils.clamp = function clamp(value, min, max) {
2101
+ return value < min ? min : value > max ? max : value;
2102
+ };
2103
+
2104
+ MathUtils.toRadians = function toRadians(angleDegrees) {
2105
+ return angleDegrees * Math.PI / 180.0;
2106
+ };
2107
+
2108
+ MathUtils.distance = function distance(p1, p2) {
2109
+ return Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
2110
+ };
2111
+
2112
+ MathUtils.findNextPowerOf2 = function findNextPowerOf2(n) {
2113
+ n = n - 1;
2114
+ var lg = Math.log2(n);
2115
+ return 1 << lg + 1;
2116
+ };
2117
+
2118
+ MathUtils.findPreviousPowerOf2 = function findPreviousPowerOf2(n) {
2119
+ return 1 << 31 - Math.clz32(n);
2120
+ };
2121
+
2122
+ return MathUtils;
2123
+ }();
2124
+
2125
+ var Vector3 = /*#__PURE__*/function () {
2126
+ function Vector3(x, y, z) {
2127
+ if (x === void 0) {
2128
+ x = 0.0;
2129
+ }
2130
+
2131
+ if (y === void 0) {
2132
+ y = 0.0;
2133
+ }
2134
+
2135
+ if (z === void 0) {
2136
+ z = 0.0;
2137
+ }
2138
+
2139
+ this.x = x;
2140
+ this.y = y;
2141
+ this.z = z;
2142
+ }
2143
+
2144
+ var _proto = Vector3.prototype;
2145
+
2146
+ _proto.clone = function clone() {
2147
+ return new Vector3(this.x, this.y, this.z);
2148
+ };
2149
+
2150
+ _proto.buffer = function buffer() {
2151
+ return new Float32Array([this.x, this.y, this.z]);
2152
+ };
2153
+
2154
+ _proto.normalize = function normalize() {
2155
+ var length = this.length;
2156
+ var x = 0.0;
2157
+ var y = 0.0;
2158
+ var z = 0.0;
2159
+
2160
+ if (length > 0) {
2161
+ x = this.x / length;
2162
+ y = this.y / length;
2163
+ z = this.z / length;
2164
+ }
2165
+
2166
+ return new Vector3(x, y, z);
2167
+ };
2168
+
2169
+ _proto.set = function set(a) {
2170
+ this.x = a.x;
2171
+ this.y = a.y;
2172
+ this.z = a.z;
2173
+ };
2174
+
2175
+ _proto.invert = function invert() {
2176
+ return new Vector3(-this.x, -this.y, -this.z);
2177
+ };
2178
+
2179
+ _proto.rotate90 = function rotate90() {
2180
+ return new Vector3(this.y, -this.x, this.z);
2181
+ };
2182
+
2183
+ _proto.add = function add(a) {
2184
+ return new Vector3(a.x + this.x, a.y + this.y, a.z + this.z);
2185
+ };
2186
+
2187
+ _proto.subtract = function subtract(a) {
2188
+ if (!a) {
2189
+ return this.clone();
2190
+ }
2191
+
2192
+ return new Vector3(this.x - a.x, this.y - a.y, this.z - a.z);
2193
+ };
2194
+
2195
+ _proto.multiply = function multiply(a) {
2196
+ return new Vector3(a * this.x, a * this.y, a * this.z);
2197
+ };
2198
+
2199
+ _proto.rotateBy = function rotateBy(a) {
2200
+ var cos = Math.cos(a * Math.PI / 180);
2201
+ var sin = Math.sin(a * Math.PI / 180);
2202
+ return new Vector3(this.x * cos - this.y * sin, this.x * sin + this.y * cos);
2203
+ };
2204
+
2205
+ _proto.cross = function cross(a) {
2206
+ return new Vector3(this.y * a.z - this.z * a.y, this.z * a.x - this.x * a.z, this.x * a.y - this.y * a.x);
2207
+ };
2208
+
2209
+ _proto.dot = function dot(a) {
2210
+ return a.x * this.x + a.y * this.y + a.z * this.z;
2211
+ };
2212
+
2213
+ Vector3.perp = function perp(v1, v2) {
2214
+ return new Vector3(v2[1] - v1[1], v1[0] - v2[0]);
2215
+ };
2216
+
2217
+ Vector3.neg = function neg(v) {
2218
+ return new Vector3(-v.x, -v.y, -v.z);
2219
+ };
2220
+
2221
+ _createClass(Vector3, [{
2222
+ key: "length",
2223
+ get: function get() {
2224
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
2225
+ }
2226
+ }, {
2227
+ key: "lengthSq",
2228
+ get: function get() {
2229
+ return this.x * this.x + this.y * this.y + this.z * this.z;
2230
+ }
2231
+ }]);
2232
+
2233
+ return Vector3;
2234
+ }();
2235
+
2236
+ var Matrix4 = /*#__PURE__*/function () {
2237
+ function Matrix4(data) {
2238
+ if (data === void 0) {
2239
+ data = new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]);
2240
+ }
2241
+
2242
+ this.data = data;
2243
+ }
2244
+
2245
+ var _proto = Matrix4.prototype;
2246
+
2247
+ _proto.setIdentity = function setIdentity(x, y, z) {
2248
+ if (x === void 0) {
2249
+ x = 1.0;
2250
+ }
2251
+
2252
+ if (y === void 0) {
2253
+ y = 1.0;
2254
+ }
2255
+
2256
+ if (z === void 0) {
2257
+ z = 1.0;
2258
+ }
2259
+
2260
+ this.data[0] = x;
2261
+ this.data[1] = 0;
2262
+ this.data[2] = 0;
2263
+ this.data[3] = 0;
2264
+ this.data[4] = 0;
2265
+ this.data[5] = y;
2266
+ this.data[6] = 0;
2267
+ this.data[7] = 0;
2268
+ this.data[8] = 0;
2269
+ this.data[9] = 0;
2270
+ this.data[10] = z;
2271
+ this.data[11] = 0;
2272
+ this.data[12] = 0;
2273
+ this.data[13] = 0;
2274
+ this.data[14] = 0;
2275
+ this.data[15] = 1.0;
2276
+ return this;
2277
+ };
2278
+
2279
+ _proto.copy = function copy(other) {
2280
+ this.data[0] = other.data[0];
2281
+ this.data[1] = other.data[1];
2282
+ this.data[2] = other.data[2];
2283
+ this.data[3] = other.data[3];
2284
+ this.data[4] = other.data[4];
2285
+ this.data[5] = other.data[5];
2286
+ this.data[6] = other.data[6];
2287
+ this.data[7] = other.data[7];
2288
+ this.data[8] = other.data[8];
2289
+ this.data[9] = other.data[9];
2290
+ this.data[10] = other.data[10];
2291
+ this.data[11] = other.data[11];
2292
+ this.data[12] = other.data[12];
2293
+ this.data[13] = other.data[13];
2294
+ this.data[14] = other.data[14];
2295
+ this.data[15] = other.data[15];
2296
+ return this;
2297
+ };
2298
+
2299
+ Matrix4.translate = function translate(x, y, z) {
2300
+ if (z === void 0) {
2301
+ z = 0.0;
2302
+ }
2303
+
2304
+ return new Matrix4(new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0., 0.0, 0.0, 1.0, 0.0, x, y, z, 1.0]));
2305
+ };
2306
+
2307
+ _proto.translate = function translate(x, y, z) {
2308
+ if (z === void 0) {
2309
+ z = 0.0;
2310
+ }
2311
+
2312
+ this.data[12] += x;
2313
+ this.data[13] += y;
2314
+ this.data[14] += z;
2315
+ return this;
2316
+ };
2317
+
2318
+ Matrix4.rotateX = function rotateX(alpha) {
2319
+ alpha *= Math.PI / 180.0;
2320
+ var sinA = Math.sin(alpha);
2321
+ var cosA = Math.cos(alpha);
2322
+ return new Matrix4(new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, cosA, sinA, 0.0, 0.0, -sinA, cosA, 0.0, 0.0, 0.0, 0.0, 1.0]));
2323
+ };
2324
+
2325
+ _proto.setRotationX = function setRotationX(alpha) {
2326
+ alpha *= Math.PI / 180.0;
2327
+ var sinA = Math.sin(alpha);
2328
+ var cosA = Math.cos(alpha);
2329
+ this.setIdentity();
2330
+ this.data[5] = cosA;
2331
+ this.data[6] = sinA;
2332
+ this.data[9] = -sinA;
2333
+ this.data[10] = cosA;
2334
+ return this;
2335
+ };
2336
+
2337
+ _proto.rotateX = function rotateX(alpha) {
2338
+ alpha *= Math.PI / 180.0;
2339
+ var sinA = Math.sin(alpha);
2340
+ var cosA = Math.cos(alpha);
2341
+ var r1 = this.data[1];
2342
+ var r2 = this.data[2];
2343
+ this.data[1] = r1 * cosA - r2 * sinA;
2344
+ this.data[2] = r1 * sinA + r2 * cosA;
2345
+ r1 = this.data[5];
2346
+ r2 = this.data[6];
2347
+ this.data[5] = r1 * cosA - r2 * sinA;
2348
+ this.data[6] = r1 * sinA + r2 * cosA;
2349
+ r1 = this.data[9];
2350
+ r2 = this.data[10];
2351
+ this.data[9] = r1 * cosA - r2 * sinA;
2352
+ this.data[10] = r1 * sinA + r2 * cosA;
2353
+ r1 = this.data[13];
2354
+ r2 = this.data[14];
2355
+ this.data[13] = r1 * cosA - r2 * sinA;
2356
+ this.data[14] = r1 * sinA + r2 * cosA;
2357
+ return this;
2358
+ };
2359
+
2360
+ Matrix4.rotateY = function rotateY(alpha) {
2361
+ alpha *= Math.PI / 180.0;
2362
+ var sinA = Math.sin(alpha);
2363
+ var cosA = Math.cos(alpha);
2364
+ return new Matrix4(new Float32Array([cosA, 0.0, sinA, 0.0, 0.0, 1.0, 0.0, 0.0, -sinA, 0.0, cosA, 0.0, 0.0, 0.0, 0.0, 1.0]));
2365
+ };
2366
+
2367
+ _proto.setRotationY = function setRotationY(alpha) {
2368
+ alpha *= Math.PI / 180.0;
2369
+ var sinA = Math.sin(alpha);
2370
+ var cosA = Math.cos(alpha);
2371
+ this.setIdentity();
2372
+ this.data[0] = cosA;
2373
+ this.data[2] = sinA;
2374
+ this.data[8] = -sinA;
2375
+ this.data[10] = cosA;
2376
+ return this;
2377
+ };
2378
+
2379
+ _proto.rotateY = function rotateY(alpha) {
2380
+ alpha *= Math.PI / 180.0;
2381
+ var sinA = Math.sin(alpha);
2382
+ var cosA = Math.cos(alpha);
2383
+ var r0 = this.data[0];
2384
+ var r2 = this.data[2];
2385
+ this.data[0] = r0 * cosA - r2 * sinA;
2386
+ this.data[2] = r0 * sinA + r2 * cosA;
2387
+ r0 = this.data[4];
2388
+ r2 = this.data[6];
2389
+ this.data[4] = r0 * cosA - r2 * sinA;
2390
+ this.data[6] = r0 * sinA + r2 * cosA;
2391
+ r0 = this.data[8];
2392
+ r2 = this.data[10];
2393
+ this.data[8] = r0 * cosA - r2 * sinA;
2394
+ this.data[10] = r0 * sinA + r2 * cosA;
2395
+ r0 = this.data[12];
2396
+ r2 = this.data[14];
2397
+ this.data[12] = r0 * cosA - r2 * sinA;
2398
+ this.data[14] = r0 * sinA + r2 * cosA;
2399
+ return this;
2400
+ };
2401
+
2402
+ Matrix4.rotateZ = function rotateZ(alpha) {
2403
+ alpha *= Math.PI / 180.0;
2404
+ var sinA = Math.sin(alpha);
2405
+ var cosA = Math.cos(alpha);
2406
+ return new Matrix4(new Float32Array([cosA, sinA, 0.0, 0.0, -sinA, cosA, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]));
2407
+ };
2408
+
2409
+ _proto.setRotationZ = function setRotationZ(alpha) {
2410
+ alpha *= Math.PI / 180.0;
2411
+ var sinA = Math.sin(alpha);
2412
+ var cosA = Math.cos(alpha);
2413
+ this.setIdentity();
2414
+ this.data[0] = cosA;
2415
+ this.data[1] = sinA;
2416
+ this.data[4] = -sinA;
2417
+ this.data[5] = cosA;
2418
+ return this;
2419
+ };
2420
+
2421
+ _proto.rotateZ = function rotateZ(alpha) {
2422
+ alpha *= Math.PI / 180.0;
2423
+ var sinA = Math.sin(alpha);
2424
+ var cosA = Math.cos(alpha);
2425
+ var r0 = this.data[0];
2426
+ var r1 = this.data[1];
2427
+ this.data[0] = r0 * cosA - r1 * sinA;
2428
+ this.data[1] = r0 * sinA + r1 * cosA;
2429
+ r0 = this.data[4];
2430
+ r1 = this.data[5];
2431
+ this.data[4] = r0 * cosA - r1 * sinA;
2432
+ this.data[5] = r0 * sinA + r1 * cosA;
2433
+ r0 = this.data[8];
2434
+ r1 = this.data[9];
2435
+ this.data[8] = r0 * cosA - r1 * sinA;
2436
+ this.data[9] = r0 * sinA + r1 * cosA;
2437
+ r0 = this.data[12];
2438
+ r1 = this.data[13];
2439
+ this.data[12] = r0 * cosA - r1 * sinA;
2440
+ this.data[13] = r0 * sinA + r1 * cosA;
2441
+ return this;
2442
+ };
2443
+
2444
+ _proto.multiply = function multiply(matrix) {
2445
+ var result = new Matrix4(new Float32Array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]));
2446
+
2447
+ if (matrix == null) {
2448
+ return result;
2449
+ }
2450
+
2451
+ for (var i = 0; i < 4; ++i) {
2452
+ for (var j = 0; j < 4; ++j) {
2453
+ for (var k = 0; k < 4; ++k) {
2454
+ result.data[i * 4 + k] += this.data[i * 4 + j] * matrix.data[j * 4 + k];
2455
+ }
2456
+ }
2457
+ }
2458
+
2459
+ return result;
2460
+ };
2461
+
2462
+ Matrix4.ortho = function ortho(left, right, bottom, top, near, far) {
2463
+ if (near === void 0) {
2464
+ near = -100.0;
2465
+ }
2466
+
2467
+ if (far === void 0) {
2468
+ far = 100.0;
2469
+ }
2470
+
2471
+ return new Matrix4(new Float32Array([2.0 / (right - left), 0.0, 0.0, 0.0, 0.0, 2.0 / (top - bottom), 0.0, 0.0, 0.0, 0.0, -2.0 / (far - near), 0.0, -(left + right) / (right - left), -(top + bottom) / (top - bottom), -(near + far) / (near - far), 1.0]));
2472
+ };
2473
+
2474
+ _proto.setOrtho = function setOrtho(left, right, bottom, top, near, far) {
2475
+ if (near === void 0) {
2476
+ near = -100.0;
2477
+ }
2478
+
2479
+ if (far === void 0) {
2480
+ far = 100.0;
2481
+ }
2482
+
2483
+ this.data[0] = 2.0 / (right - left);
2484
+ this.data[1] = 0;
2485
+ this.data[2] = 0;
2486
+ this.data[3] = 0;
2487
+ this.data[4] = 0;
2488
+ this.data[5] = 2.0 / (top - bottom);
2489
+ this.data[6] = 0;
2490
+ this.data[7] = 0;
2491
+ this.data[8] = 0;
2492
+ this.data[9] = 0;
2493
+ this.data[10] = -2.0 / (far - near);
2494
+ this.data[11] = -1;
2495
+ this.data[12] = -(left + right) / (right - left);
2496
+ this.data[13] = -(top + bottom) / (top - bottom);
2497
+ this.data[14] = -(near + far) / (near - far);
2498
+ this.data[15] = 1.0;
2499
+ return this;
2500
+ };
2501
+
2502
+ Matrix4.perspective = function perspective(fov, aspect, near, far) {
2503
+ var y = Math.tan(fov / 2.0) * near;
2504
+ var x = y * aspect;
2505
+ return Matrix4.frustum(-x, x, -y, y, near, far);
2506
+ };
2507
+
2508
+ _proto.setPerspective = function setPerspective(fov, aspect, near, far) {
2509
+ var y = Math.tan(fov / 2.0) * near;
2510
+ var x = y * aspect;
2511
+ return this.setFrustum(-x, x, -y, y, near, far);
2512
+ };
2513
+
2514
+ Matrix4.frustum = function frustum(left, right, bottom, top, near, far) {
2515
+ if (near === void 0) {
2516
+ near = -100.0;
2517
+ }
2518
+
2519
+ if (far === void 0) {
2520
+ far = 100.0;
2521
+ }
2522
+
2523
+ return new Matrix4(new Float32Array([2 * near / (right - left), 0, 0, 0, 0, 2 * near / (top - bottom), 0, 0, (right + left) / (right - left), (top + bottom) / (top - bottom), -(far + near) / (far - near), -1, 0, 0, -2 * near * far / (far - near), 0]));
2524
+ };
2525
+
2526
+ _proto.setFrustum = function setFrustum(left, right, bottom, top, near, far) {
2527
+ if (near === void 0) {
2528
+ near = -100.0;
2529
+ }
2530
+
2531
+ if (far === void 0) {
2532
+ far = 100.0;
2533
+ }
2534
+
2535
+ this.data[0] = 2 * near / (right - left);
2536
+ this.data[1] = 0;
2537
+ this.data[2] = 0;
2538
+ this.data[3] = 0;
2539
+ this.data[4] = 0;
2540
+ this.data[5] = 2 * near / (top - bottom);
2541
+ this.data[6] = 0;
2542
+ this.data[7] = 0;
2543
+ this.data[8] = (right + left) / (right - left);
2544
+ this.data[9] = (top + bottom) / (top - bottom);
2545
+ this.data[10] = -(far + near) / (far - near);
2546
+ this.data[11] = -1;
2547
+ this.data[12] = 0;
2548
+ this.data[13] = 0;
2549
+ this.data[14] = -2 * near * far / (far - near);
2550
+ this.data[15] = 0;
2551
+ };
2552
+
2553
+ _proto.transform = function transform(vector, w) {
2554
+ if (w === void 0) {
2555
+ w = 0.0;
2556
+ }
2557
+
2558
+ var x = this.data[0 * 4 + 0] * vector.x + this.data[1 * 4 + 0] * vector.y + this.data[2 * 4 + 0] * vector.z + this.data[3 * 4 + 0] * w;
2559
+ var y = this.data[0 * 4 + 1] * vector.x + this.data[1 * 4 + 1] * vector.y + this.data[2 * 4 + 1] * vector.z + this.data[3 * 4 + 1] * w;
2560
+ var z = this.data[0 * 4 + 2] * vector.x + this.data[1 * 4 + 2] * vector.y + this.data[2 * 4 + 2] * vector.z + this.data[3 * 4 + 2] * w;
2561
+ w = this.data[0 * 4 + 3] * vector.x + this.data[1 * 4 + 3] * vector.y + this.data[2 * 4 + 3] * vector.z + this.data[3 * 4 + 3] * w;
2562
+
2563
+ if (w == 0) {
2564
+ w = 1;
2565
+ }
2566
+
2567
+ return new Vector3(x / w, y / w, z / w);
2568
+ };
2569
+
2570
+ _proto.buffer = function buffer() {
2571
+ return this.data;
2572
+ };
2573
+
2574
+ _proto.inverse = function inverse() {
2575
+ var rows = 4;
2576
+ var cols = 4;
2577
+ var A = this.data.slice();
2578
+ var B = new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]);
2579
+
2580
+ for (var c = 0; c < cols; ++c) {
2581
+ var r = c;
2582
+
2583
+ while (r < rows && A[r * 4 + c] == 0) {
2584
+ ++r;
2585
+ }
2586
+
2587
+ if (r == rows || A[r * 4 + c] == 0) {
2588
+ console.log("Cannot calculate inverse, determinant is zero");
2589
+ return this;
2590
+ }
2591
+
2592
+ if (r != c) {
2593
+ var _Ac = A.slice(c * rows, (c + 1) * rows);
2594
+
2595
+ var Ar = A.slice(r * rows, (r + 1) * rows);
2596
+ A.set(Ar, c * rows);
2597
+ A.set(_Ac, r * rows);
2598
+
2599
+ var _Bc = B.slice(c * rows, (c + 1) * rows);
2600
+
2601
+ var Br = B.slice(r * rows, (r + 1) * rows);
2602
+ B.set(Br, c * rows);
2603
+ B.set(_Bc, r * rows);
2604
+ }
2605
+
2606
+ var Ac = A.slice(c * rows, (c + 1) * rows);
2607
+ var Bc = B.slice(c * rows, (c + 1) * rows);
2608
+
2609
+ for (r = 0; r < rows; ++r) {
2610
+ var _Ar = A.slice(r * rows, (r + 1) * rows);
2611
+
2612
+ var _Br = B.slice(r * rows, (r + 1) * rows);
2613
+
2614
+ if (r != c) {
2615
+ if (_Ar[c] != 0) {
2616
+ var f = -_Ar[c] / Ac[c];
2617
+
2618
+ for (var s = c; s < cols; ++s) {
2619
+ _Ar[s] = _Ar[s] + f * Ac[s];
2620
+ }
2621
+
2622
+ A.set(_Ar, r * rows);
2623
+
2624
+ for (var _s = 0; _s < cols; ++_s) {
2625
+ _Br[_s] = _Br[_s] + f * Bc[_s];
2626
+ }
2627
+
2628
+ B.set(_Br, r * rows);
2629
+ }
2630
+ } else {
2631
+ var _f = Ac[c];
2632
+
2633
+ if (_f == 0) {
2634
+ console.log("Cannot calculate inverse, determinant is zero");
2635
+ return this;
2636
+ }
2637
+
2638
+ for (var _s2 = c; _s2 < cols; ++_s2) {
2639
+ _Ar[_s2] = _Ar[_s2] / _f;
2640
+ }
2641
+
2642
+ A.set(_Ar, r * rows);
2643
+
2644
+ for (var _s3 = 0; _s3 < cols; ++_s3) {
2645
+ _Br[_s3] = _Br[_s3] / _f;
2646
+ }
2647
+
2648
+ B.set(_Br, r * rows);
2649
+ }
2650
+ }
2651
+ }
2652
+
2653
+ return new Matrix4(B);
2654
+ };
2655
+
2656
+ _createClass(Matrix4, [{
2657
+ key: "position",
2658
+ get: function get() {
2659
+ return new Vector3(this.data[12], this.data[13], this.data[14]);
2660
+ }
2661
+ }]);
2662
+
2663
+ return Matrix4;
2664
+ }();
2665
+
2666
+ var Color = /*#__PURE__*/function () {
2667
+ function Color(red, green, blue, alpha) {
2668
+ if (red === void 0) {
2669
+ red = 0.0;
2670
+ }
2671
+
2672
+ if (green === void 0) {
2673
+ green = 0.0;
2674
+ }
2675
+
2676
+ if (blue === void 0) {
2677
+ blue = 0.0;
2678
+ }
2679
+
2680
+ if (alpha === void 0) {
2681
+ alpha = 1.0;
2682
+ }
2683
+
2684
+ this.alpha = alpha;
2685
+ this._buffer = new Float32Array([red, green, blue]);
2686
+ }
2687
+
2688
+ var _proto = Color.prototype;
2689
+
2690
+ _proto.rgbBuffer = function rgbBuffer() {
2691
+ return this._buffer;
2692
+ };
2693
+
2694
+ _proto.buffer = function buffer() {
2695
+ return new Float32Array([this.red, this.green, this.blue, this.alpha]);
2696
+ };
2697
+
2698
+ Color.fromHex = function fromHex(hexString) {
2699
+ if (hexString === void 0) {
2700
+ hexString = "000000";
2701
+ }
2702
+
2703
+ if (hexString.length == 4 || hexString.length == 7 || hexString.length == 9) {
2704
+ hexString = hexString.substring(1, hexString.length);
2705
+ }
2706
+
2707
+ if (hexString.length == 3) {
2708
+ hexString = hexString.split("").map(function (x) {
2709
+ return x + x;
2710
+ }).join("");
2711
+ }
2712
+
2713
+ var colorCode = parseInt(hexString, 16);
2714
+
2715
+ if (hexString.length == 6) {
2716
+ return new Color((colorCode >> 16) / 255, (colorCode >> 8 & 255) / 255, (colorCode & 255) / 255);
2717
+ } else {
2718
+ return new Color((colorCode >> 24 & 255) / 255, (colorCode >> 16 & 255) / 255, (colorCode >> 8 & 255) / 255, (colorCode & 255) / 255);
2719
+ }
2720
+ };
2721
+
2722
+ Color.fromInt = function fromInt(colorCode) {
2723
+ if (colorCode === void 0) {
2724
+ colorCode = 0;
2725
+ }
2726
+
2727
+ if (colorCode < 0) {
2728
+ colorCode = 0;
2729
+ }
2730
+
2731
+ return new Color((colorCode >> 16 & 255) / 255, (colorCode >> 8 & 255) / 255, (colorCode & 255) / 255);
2732
+ };
2733
+
2734
+ Color.fromVec3 = function fromVec3(color) {
2735
+ return new Color(color.x, color.y, color.z);
2736
+ };
2737
+
2738
+ Color.mix = function mix(a, b, factor) {
2739
+ return new Color(a.red * factor + b.red * (1 - factor), a.green * factor + b.green * (1 - factor), a.blue * factor + b.blue * (1 - factor), a.alpha * factor + b.alpha * (1 - factor));
2740
+ };
2741
+
2742
+ Color.isValid = function isValid(colorString) {
2743
+ return /^#?([0-9A-Fa-f]){6,8}$/i.test(colorString);
2744
+ };
2745
+
2746
+ _createClass(Color, [{
2747
+ key: "red",
2748
+ get: function get() {
2749
+ return this._buffer[0];
2750
+ }
2751
+ }, {
2752
+ key: "green",
2753
+ get: function get() {
2754
+ return this._buffer[1];
2755
+ }
2756
+ }, {
2757
+ key: "blue",
2758
+ get: function get() {
2759
+ return this._buffer[2];
2760
+ }
2761
+ }, {
2762
+ key: "rgba",
2763
+ get: function get() {
2764
+ return "rgba(" + this.red * 255 + "," + this.green * 255 + "," + this.blue * 255 + "," + this.alpha + ")";
2765
+ }
2766
+ }, {
2767
+ key: "code",
2768
+ get: function get() {
2769
+ var float2hex = function float2hex(f) {
2770
+ var hex = Math.floor(f * 255).toString(16);
2771
+ hex = hex.length == 1 ? "0" + hex : hex;
2772
+ hex = hex.length > 2 ? hex.substr(0, 2) : hex;
2773
+ return hex;
2774
+ };
2775
+
2776
+ return "#" + float2hex(this.red) + float2hex(this.green) + float2hex(this.blue) + float2hex(this.alpha);
2777
+ }
2778
+ }]);
2779
+
2780
+ return Color;
2781
+ }();
2782
+
2783
+ var MapConstants = /*#__PURE__*/function () {
2784
+ function MapConstants() {}
2785
+
2786
+ _createClass(MapConstants, null, [{
2787
+ key: "placeFontSize",
2788
+ get: function get() {
2789
+ return 12;
2790
+ }
2791
+ }, {
2792
+ key: "maxTiltIntersectWithScreen",
2793
+ get: function get() {
2794
+ return 90.0 - CameraConstants.fov * MathConstants.rad2Deg;
2795
+ }
2796
+ }]);
2797
+
2798
+ return MapConstants;
2799
+ }();
2800
+ MapConstants.none = -1.0;
2801
+ MapConstants.baseTileSize = 256;
2802
+ MapConstants.minLatitude = -85.051128779806604;
2803
+ MapConstants.maxLatitude = 85.051128779806604;
2804
+ MapConstants.maxLongitude = 180;
2805
+ MapConstants.minLongitude = -180;
2806
+ MapConstants.maxDegrees = 360;
2807
+ MapConstants.radiusEarthMeters = 6378137.0;
2808
+ MapConstants.halfEarthCircumFerenceInMeter = MapConstants.radiusEarthMeters * Math.PI;
2809
+ MapConstants.earthCircumFerenceInMeter = MapConstants.halfEarthCircumFerenceInMeter * 2;
2810
+ MapConstants.tileCacheSize = 512;
2811
+ MapConstants.baseMapLowestOrder = Number.MIN_SAFE_INTEGER;
2812
+ MapConstants.baseMapMiddleOrder = -1.0E6;
2813
+ MapConstants.buildingLayerOrder = 0;
2814
+ MapConstants.userPOILayerOrder = 1.0;
2815
+ MapConstants.pointGeoJsonWidth = 32;
2816
+ MapConstants.pointGeoJsonHeight = 32;
2817
+ MapConstants.placeSelectedIdPrefix = "maplink-selected-place-";
2818
+ MapConstants.placeWidth = 26;
2819
+ MapConstants.placeHeight = 32;
2820
+ MapConstants.spritePadding = 2.;
2821
+ MapConstants.poiFontWeight = "normal";
2822
+ MapConstants.poiMaxWidth = 120;
2823
+ MapConstants.poiNumLine = 2;
2824
+ MapConstants.poiDefaultColor = new Color(0.5, 0.6, 0.7);
2825
+ MapConstants.pointGeoJsonAnchor = [0.5, 1.0];
2826
+ MapConstants.infoWindowPadding = 2;
2827
+ MapConstants.flingMinVelocity = -10000.0;
2828
+ MapConstants.flingMaxVelocity = 10000.0;
2829
+ MapConstants.flingTimeConstant = 150.0;
2830
+ MapConstants.flingSpeedMultiply = 15;
2831
+ MapConstants.zoomSpeedMouseWheel = 15;
2832
+ MapConstants.minDurationFlyTo = 1000;
2833
+ MapConstants.maxDurationFlyTo = 13000;
2834
+ MapConstants.maxBearingAngle = 720;
2835
+ MapConstants.defaultMinZoom = 3;
2836
+ MapConstants.defaultMinZoom3d = 17;
2837
+ MapConstants.defaultMaxZoom = 22;
2838
+ MapConstants.defaultMaxNativeZoom = 19;
2839
+ MapConstants.geoJsonMinNativeZoom = 20;
2840
+ MapConstants.vectorBuildingsMinZoom = 17;
2841
+ MapConstants.tileExtend = 4096.0;
2842
+ MapConstants.defaultAnimationDuration = 300;
2843
+ MapConstants.defaultFlyZoom = 17.0;
2844
+ MapConstants.minTilt = 0.0;
2845
+ MapConstants.maxTilt2D = 40.0;
2846
+ MapConstants.maxTilt3D = 87.0;
2847
+ MapConstants.minTiltReduceFog = 75.0;
2848
+ MapConstants.minTimeMoving = 150.0;
2849
+ MapConstants.minTimeDoubleZoom = 500.0;
2850
+ MapConstants.minTimeSpanTo = 500.0;
2851
+ MapConstants.maxTimeSpanTo = 4000.0;
2852
+ MapConstants.skyboxMapBorderMinimum = 0.001;
2853
+ MapConstants.metersPerPixelAtLatitude = 0.0;
2854
+ MapConstants.mapBackgroundColor2D = Color.fromHex("#f2efe9");
2855
+ MapConstants.mapBackgroundColor3D = Color.fromHex("#e1e1e1");
2856
+ MapConstants.satellitePOIColor = new Color(1.0, 1.0, 1.0);
2857
+ MapConstants.satellitePOIHalo = new Color(0.0, 0.0, 0.0);
2858
+ MapConstants.mapBackgroundScaleRatio = 20000.0;
2859
+ MapConstants.clusterMaxPointCount = 1000000;
2860
+ MapConstants.biasMatrix = new Matrix4(new Float32Array([0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0]));
2861
+ MapConstants.FPS = 1000.0 / 15.0;
2862
+ MapConstants.buildingOverlayIdPrefix = "_overlay";
2863
+ MapConstants.customBuildingType = "custom_building";
2864
+ MapConstants.touchBoxSize = 8.0;
2865
+ MapConstants.zoomStep = 0.25;
2866
+ MapConstants.distanceRatioToForceMoveCamera = 3.0;
2867
+ MapConstants.gridIndexExtent = 4096;
2868
+ MapConstants.gridIndexN = 4;
2869
+ MapConstants.gridIndexPadding = 0;
2870
+ var MathConstants = function MathConstants() {};
2871
+ MathConstants.rad2Deg = 180 / Math.PI;
2872
+ MathConstants.deg2Rad = Math.PI / 180.0;
2873
+ MathConstants.epsilon = 1e-6;
2874
+ var CameraConstants = function CameraConstants() {};
2875
+ CameraConstants.fov = 30 * MathConstants.deg2Rad;
2876
+ CameraConstants.nearPlane = 0.1;
2877
+ CameraConstants.farPlane = 1000;
2878
+ CameraConstants.height = 15.5;
2879
+ var ColorConstants = /*#__PURE__*/function () {
2880
+ function ColorConstants() {}
2881
+
2882
+ ColorConstants.getSkyColor = function getSkyColor(name) {
2883
+ return ColorConstants.skyColors[name];
2884
+ };
2885
+
2886
+ ColorConstants.getFogColor = function getFogColor(name) {
2887
+ return ColorConstants.fogColors[name];
2888
+ };
2889
+
2890
+ ColorConstants.getLightColor = function getLightColor(name) {
2891
+ return ColorConstants.lightColors[name];
2892
+ };
2893
+
2894
+ return ColorConstants;
2895
+ }();
2896
+ ColorConstants.skyColors = {
2897
+ "Morning": Color.fromHex("cdf9ff"),
2898
+ "Noon": Color.fromHex("0783f4"),
2899
+ "AfterNoon": Color.fromHex("243a8b"),
2900
+ "Evening": Color.fromHex("182863")
2901
+ };
2902
+ ColorConstants.fogColors = {
2903
+ "Morning": Color.fromHex("FAD8C4"),
2904
+ "Noon": Color.fromHex("FAFAFA"),
2905
+ "AfterNoon": Color.fromHex("FAA899"),
2906
+ "Evening": Color.fromHex("141c36")
2907
+ };
2908
+ ColorConstants.lightColors = {
2909
+ "Morning": Color.fromHex("#DE8989"),
2910
+ "Noon": Color.fromHex("#F8F8F8"),
2911
+ "AfterNoon": Color.fromHex("#BE321A"),
2912
+ "Evening": Color.fromHex("#1E0032")
2913
+ };
2914
+
2915
+ var ClassType;
2916
+
2917
+ (function (ClassType) {
2918
+ ClassType[ClassType["MARKER"] = 0] = "MARKER";
2919
+ ClassType[ClassType["CIRCLE"] = 1] = "CIRCLE";
2920
+ ClassType[ClassType["POLYLINE"] = 2] = "POLYLINE";
2921
+ ClassType[ClassType["POLYGON"] = 3] = "POLYGON";
2922
+ ClassType[ClassType["POI"] = 4] = "POI";
2923
+ ClassType[ClassType["BUILDING"] = 5] = "BUILDING";
2924
+ ClassType[ClassType["VECTOR_TILE_LAYER"] = 6] = "VECTOR_TILE_LAYER";
2925
+ ClassType[ClassType["BUILDING_QUERY_RESULT"] = 7] = "BUILDING_QUERY_RESULT";
2926
+ ClassType[ClassType["POLYLINE_DATA"] = 8] = "POLYLINE_DATA";
2927
+ ClassType[ClassType["POLYGON_DATA"] = 9] = "POLYGON_DATA";
2928
+ ClassType[ClassType["ICON"] = 10] = "ICON";
2929
+ ClassType[ClassType["LATLNG"] = 11] = "LATLNG";
2930
+ ClassType[ClassType["POINT"] = 12] = "POINT";
2931
+ ClassType[ClassType["CAMERA_POSITION"] = 13] = "CAMERA_POSITION";
2932
+ ClassType[ClassType["LATLNG_BOUNDS"] = 14] = "LATLNG_BOUNDS";
2933
+ ClassType[ClassType["MARKER_LABEL"] = 15] = "MARKER_LABEL";
2934
+ ClassType[ClassType["FEATURE"] = 16] = "FEATURE";
2935
+ ClassType[ClassType["TILE_FEATURE"] = 17] = "TILE_FEATURE";
2936
+ ClassType[ClassType["VECTOR_TILE_FEATURE"] = 18] = "VECTOR_TILE_FEATURE";
2937
+ })(ClassType || (ClassType = {}));
2938
+
2939
+ var Map4dObject = /*#__PURE__*/function () {
2940
+ function Map4dObject(classType) {
2941
+ this.classType = classType;
2942
+ }
2943
+
2944
+ Map4dObject.isClassType = function isClassType(mapObject, classType) {
2945
+ var mfClassType = (mapObject || {}).classType;
2946
+ return mfClassType == classType;
2947
+ };
2948
+
2949
+ return Map4dObject;
2950
+ }();
2951
+
2952
+ var LatLng = /*#__PURE__*/function (_Map4dObject) {
2953
+ _inheritsLoose(LatLng, _Map4dObject);
2954
+
2955
+ function LatLng(lat, lng) {
2956
+ var _this;
2957
+
2958
+ _this = _Map4dObject.call(this, ClassType.LATLNG) || this;
2959
+ _this.lat = lat;
2960
+ _this.lng = lng;
2961
+ return _this;
2962
+ }
2963
+
2964
+ var _proto = LatLng.prototype;
2965
+
2966
+ _proto.equals = function equals(other) {
2967
+ return this.lat == other.lat && this.lng == other.lng;
2968
+ };
2969
+
2970
+ _proto.valid = function valid() {
2971
+ return isFinite(this.lat) && Math.abs(this.lat) <= 90;
2972
+ };
2973
+
2974
+ _proto.toString = function toString() {
2975
+ return "(" + this.lat + ", " + this.lng + ")";
2976
+ };
2977
+
2978
+ LatLng.convert = function convert(input) {
2979
+ if (Map4dObject.isClassType(input, ClassType.LATLNG)) {
2980
+ return input;
2981
+ }
2982
+
2983
+ if (Array.isArray(input) && input.length === 2) {
2984
+ return new LatLng(Number(input[1]), Number(input[0]));
2985
+ }
2986
+
2987
+ if (!Array.isArray(input) && typeof input === "object" && input !== null && "lat" in input && "lng" in input) {
2988
+ return new LatLng(Number(input.lat), Number(input.lng));
2989
+ }
2990
+
2991
+ throw new Error("`ILngLat` argument must be specified as a LngLat instance, an object " + "{lat: <lat>, lng: <lng>}, or an array of [<lng>, <lat>]");
2992
+ };
2993
+
2994
+ _proto.distanceTo = function distanceTo(target) {
2995
+ if (target == null) {
2996
+ return 0;
2997
+ }
2998
+
2999
+ var desc = LatLng.convert(target);
3000
+ var latStartRadian = MathConstants.deg2Rad * this.lat;
3001
+ var longStartRadian = MathConstants.deg2Rad * this.lng;
3002
+ var latDescRadian = MathConstants.deg2Rad * desc.lat;
3003
+ var longDescRadian = MathConstants.deg2Rad * desc.lng;
3004
+ var u = Math.sin((latDescRadian - latStartRadian) / 2);
3005
+ var v = Math.sin((longDescRadian - longStartRadian) / 2);
3006
+ return 2.0 * MapConstants.radiusEarthMeters * Math.asin(Math.sqrt(u * u + Math.cos(latStartRadian) * Math.cos(latDescRadian) * v * v));
3007
+ };
3008
+
3009
+ _proto.normalize = function normalize() {
3010
+ var sign = this.lat > 0 ? -1 : 1;
3011
+ var lat = (this.lat - sign * 90) % 180 + 90 * sign;
3012
+ sign = this.lng > 0 ? -1 : 1;
3013
+ var lng = (this.lng - sign * 180) % 380 + 180 * sign;
3014
+ return new LatLng(lat, lng);
3015
+ };
3016
+
3017
+ _proto.add = function add(a) {
3018
+ return new LatLng(this.lat + a.lat, this.lng + a.lng).normalize();
3019
+ };
3020
+
3021
+ _proto.subtract = function subtract(a) {
3022
+ if (!a) {
3023
+ return this;
3024
+ }
3025
+
3026
+ return new LatLng(this.lat - a.lat, this.lng - a.lng).normalize();
3027
+ };
3028
+
3029
+ return LatLng;
3030
+ }(Map4dObject);
3031
+
3032
+ var ProjectionMercator = /*#__PURE__*/function () {
3033
+ function ProjectionMercator() {}
3034
+
3035
+ ProjectionMercator.projectInternal = function projectInternal(latLng, worldSize) {
3036
+ var latitude = MathUtils.clamp(latLng.lat, MapConstants.minLatitude, MapConstants.maxLatitude);
3037
+ return new Vector2(MapConstants.maxLongitude + latLng.lng, MapConstants.maxLongitude - MathConstants.rad2Deg * Math.log(Math.tan(Math.PI / 4 + latitude * Math.PI / MapConstants.maxDegrees))).multiply(worldSize / MapConstants.maxDegrees);
3038
+ };
3039
+
3040
+ ProjectionMercator.convertToMeterFromLatLng = function convertToMeterFromLatLng(latLng) {
3041
+ var constrainedLatitude = MathUtils.clamp(latLng.lat, MapConstants.minLatitude, MapConstants.maxLatitude);
3042
+ var constrainedLongitude = latLng.lng;
3043
+ var m = 1 - 1e-15;
3044
+ var f = MathUtils.clamp(Math.sin(MathConstants.deg2Rad * constrainedLatitude), -m, m);
3045
+ var easting = MapConstants.radiusEarthMeters * constrainedLongitude * MathConstants.deg2Rad;
3046
+ var northing = 0.5 * MapConstants.radiusEarthMeters * Math.log((1 + f) / (1 - f));
3047
+ return new Vector2(easting, northing);
3048
+ };
3049
+
3050
+ ProjectionMercator.convertToLatLngFromMeter = function convertToLatLngFromMeter(meters) {
3051
+ var latitude = (2 * Math.atan(Math.exp(meters.y / MapConstants.radiusEarthMeters)) - Math.PI / 2.0) * MathConstants.rad2Deg;
3052
+ var longitude = meters.x * MathConstants.rad2Deg / MapConstants.radiusEarthMeters;
3053
+ return new LatLng(latitude, longitude);
3054
+ };
3055
+
3056
+ ProjectionMercator.projectZoom = function projectZoom(latLng, zoom) {
3057
+ return this.projectInternal(latLng, 1 << zoom);
3058
+ };
3059
+
3060
+ return ProjectionMercator;
3061
+ }();
3062
+
3063
+ var CoordinateTransformer = /*#__PURE__*/function () {
3064
+ function CoordinateTransformer(coordinates) {
3065
+ this.coordinates = [];
3066
+ this.coordinates = coordinates.map(function (coordinate) {
3067
+ return LatLng.convert(coordinate);
3068
+ });
3069
+ }
3070
+
3071
+ var _proto = CoordinateTransformer.prototype;
3072
+
3073
+ _proto.setCoordinates = function setCoordinates(coordinates) {
3074
+ this.coordinates = coordinates.map(function (coordinate) {
3075
+ return LatLng.convert(coordinate);
3076
+ });
3077
+ };
3078
+
3079
+ _proto.addCoordinates = function addCoordinates(coordinates) {
3080
+ var _this = this;
3081
+
3082
+ coordinates.forEach(function (coordinate) {
3083
+ return _this.coordinates.push(LatLng.convert(coordinate));
3084
+ });
3085
+ };
3086
+
3087
+ _proto.rotate = function rotate(degree, anchor) {
3088
+ if (anchor === void 0) {
3089
+ anchor = null;
3090
+ }
3091
+
3092
+ if (this.coordinates.length <= 1) {
3093
+ return this.coordinates.slice();
3094
+ }
3095
+
3096
+ var center = null;
3097
+
3098
+ if (anchor != null) {
3099
+ center = LatLng.convert(center);
3100
+ } else {
3101
+ center = this.center;
3102
+ }
3103
+
3104
+ var centerInMeters = ProjectionMercator.convertToMeterFromLatLng(center);
3105
+ var transformedCoordinates = [];
3106
+ var degreeInRadians = MathUtils.toRadians(degree);
3107
+ this.coordinates.forEach(function (coordinate) {
3108
+ var point = ProjectionMercator.convertToMeterFromLatLng(coordinate);
3109
+ point.x -= centerInMeters.x;
3110
+ point.y -= centerInMeters.y;
3111
+ var x = point.x;
3112
+ var y = point.y;
3113
+ point.x = x * Math.cos(degreeInRadians) - y * Math.sin(degreeInRadians);
3114
+ point.y = x * Math.sin(degreeInRadians) + y * Math.cos(degreeInRadians);
3115
+ transformedCoordinates.push(ProjectionMercator.convertToLatLngFromMeter(new Vector2(centerInMeters.x + point.x, centerInMeters.y + point.y)));
3116
+ });
3117
+ return transformedCoordinates;
3118
+ };
3119
+
3120
+ _proto.translate = function translate(target, anchor) {
3121
+ if (anchor === void 0) {
3122
+ anchor = null;
3123
+ }
3124
+
3125
+ if (this.coordinates.length <= 0) {
3126
+ return [];
3127
+ }
3128
+
3129
+ var newCenter = LatLng.convert(target);
3130
+ var oldCenter = null;
3131
+
3132
+ if (anchor != null) {
3133
+ oldCenter = LatLng.convert(anchor);
3134
+ } else {
3135
+ oldCenter = this.center;
3136
+ }
3137
+
3138
+ var transformedCoordinates = [];
3139
+ var translateVectorX = newCenter.lng - oldCenter.lng;
3140
+ var translateVectorY = newCenter.lat - oldCenter.lat;
3141
+ this.coordinates.forEach(function (coordinate) {
3142
+ transformedCoordinates.push(new LatLng(coordinate.lat + translateVectorY, coordinate.lng + translateVectorX));
3143
+ });
3144
+ return transformedCoordinates;
3145
+ };
3146
+
3147
+ _proto.scale = function scale(_scale, anchor) {
3148
+ if (anchor === void 0) {
3149
+ anchor = null;
3150
+ }
3151
+
3152
+ if (this.coordinates.length <= 1) {
3153
+ return this.coordinates.slice();
3154
+ }
3155
+
3156
+ var center = null;
3157
+
3158
+ if (anchor != null) {
3159
+ center = LatLng.convert(anchor);
3160
+ } else {
3161
+ center = this.center;
3162
+ }
3163
+
3164
+ var centerInMeters = ProjectionMercator.convertToMeterFromLatLng(center);
3165
+ var transformedCoordinates = [];
3166
+ this.coordinates.forEach(function (coordinate) {
3167
+ var point = ProjectionMercator.convertToMeterFromLatLng(coordinate);
3168
+ point.x -= centerInMeters.x;
3169
+ point.y -= centerInMeters.y;
3170
+ point.x *= _scale;
3171
+ point.y *= _scale;
3172
+ transformedCoordinates.push(ProjectionMercator.convertToLatLngFromMeter(new Vector2(centerInMeters.x + point.x, centerInMeters.y + point.y)));
3173
+ });
3174
+ return transformedCoordinates;
3175
+ };
3176
+
3177
+ _createClass(CoordinateTransformer, [{
3178
+ key: "center",
3179
+ get: function get() {
3180
+ if (this.coordinates.length == 0) {
3181
+ return null;
3182
+ }
3183
+
3184
+ var center = new LatLng(0, 0);
3185
+
3186
+ for (var i = 0; i < this.coordinates.length; ++i) {
3187
+ center.lat += this.coordinates[i].lat;
3188
+ center.lng += this.coordinates[i].lng;
3189
+ }
3190
+
3191
+ center.lat /= this.coordinates.length;
3192
+ center.lng /= this.coordinates.length;
3193
+ return center;
3194
+ }
3195
+ }]);
3196
+
3197
+ return CoordinateTransformer;
3198
+ }();
3199
+
3200
+ exports.CoordinateTransformer = CoordinateTransformer;
3201
+ exports.LatLng = LatLng;
1967
3202
  exports.MFBuilding = MFBuilding;
1968
3203
  exports.MFBuildingOverlay = MFBuildingOverlay;
1969
3204
  exports.MFCircle = MFCircle;