@ohuoy/easymap 1.0.19 → 1.0.21

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.
Files changed (57) hide show
  1. package/dist/bundle.js +318 -290
  2. package/dist/example - /345/211/257/346/234/254/bundle.js" +318 -290
  3. package/dist/example - /345/211/257/346/234/254/index.html" +11 -11
  4. package/index.js +4 -0
  5. package/lib/threebox-plugin/CHANGELOG.md +665 -0
  6. package/lib/threebox-plugin/LICENSE.txt +97 -0
  7. package/lib/threebox-plugin/README.md +199 -0
  8. package/lib/threebox-plugin/exports.js +2 -0
  9. package/lib/threebox-plugin/main.js +8 -0
  10. package/lib/threebox-plugin/package.json +44 -0
  11. package/lib/threebox-plugin/server.stop.js +13 -0
  12. package/lib/threebox-plugin/src/Threebox.js +1216 -0
  13. package/lib/threebox-plugin/src/animation/AnimationManager.js +483 -0
  14. package/lib/threebox-plugin/src/camera/CameraSync.js +302 -0
  15. package/lib/threebox-plugin/src/objects/CSS2DRenderer.js +245 -0
  16. package/lib/threebox-plugin/src/objects/LabelRenderer.js +71 -0
  17. package/lib/threebox-plugin/src/objects/Object3D.js +34 -0
  18. package/lib/threebox-plugin/src/objects/effects/BuildingShadows.js +115 -0
  19. package/lib/threebox-plugin/src/objects/extrusion.js +61 -0
  20. package/lib/threebox-plugin/src/objects/fflate.min.js +15 -0
  21. package/lib/threebox-plugin/src/objects/label.js +29 -0
  22. package/lib/threebox-plugin/src/objects/line.js +1386 -0
  23. package/lib/threebox-plugin/src/objects/loadObj.js +142 -0
  24. package/lib/threebox-plugin/src/objects/loaders/ColladaLoader.js +3751 -0
  25. package/lib/threebox-plugin/src/objects/loaders/FBXLoader.js +3864 -0
  26. package/lib/threebox-plugin/src/objects/loaders/GLTFLoader.js +3857 -0
  27. package/lib/threebox-plugin/src/objects/loaders/MTLLoader.js +498 -0
  28. package/lib/threebox-plugin/src/objects/loaders/OBJLoader.js +818 -0
  29. package/lib/threebox-plugin/src/objects/objects.js +1113 -0
  30. package/lib/threebox-plugin/src/objects/sphere.js +28 -0
  31. package/lib/threebox-plugin/src/objects/tooltip.js +27 -0
  32. package/lib/threebox-plugin/src/objects/tube.js +35 -0
  33. package/lib/threebox-plugin/src/three.js +6 -0
  34. package/lib/threebox-plugin/src/three.module.js +54571 -0
  35. package/lib/threebox-plugin/src/utils/ValueGenerator.js +11 -0
  36. package/lib/threebox-plugin/src/utils/constants.js +21 -0
  37. package/lib/threebox-plugin/src/utils/material.js +52 -0
  38. package/lib/threebox-plugin/src/utils/suncalc.js +322 -0
  39. package/lib/threebox-plugin/src/utils/utils.js +424 -0
  40. package/lib/threebox-plugin/src/utils/validate.js +115 -0
  41. package/package.json +18 -18
  42. package/src/components/EasyMapMarker.js +8 -0
  43. package/src/components/control/DrawBar.js +5 -0
  44. package/src/components/control/TilesBar.js +116 -27
  45. package/src/components/control/Toobars.js +20 -1
  46. package/src/components/layer/AlarmLayer.js +4 -1
  47. package/src/components/layer/AnimationBarbsLayer.js +1 -1
  48. package/src/components/layer/AnimationLayer copy.js +1 -1
  49. package/src/components/layer/AnimationLayer.js +11 -3
  50. package/src/components/layer/CustomIconLayer.js +1 -1
  51. package/src/components/layer/ExtrusionLayer.js +1 -1
  52. package/src/components/layer/ExtrusionLayerold.js +2 -1
  53. package/src/components/layer/MarkerAreaLayer.js +1 -1
  54. package/src/components/layer/PathLineLayer.js +1 -1
  55. package/src/components/layer/ThreeScanLayer.js +51 -14
  56. package/src/components/layer/ThreeWallLayer.js +1 -1
  57. package/webpack.config.js +2 -1
@@ -0,0 +1,11 @@
1
+ const ValueGenerator = function(input) {
2
+ if(typeof input === 'object' && input.property !== undefined) // Value name comes from a property in each item
3
+ return (f => f.properties[input.property]);
4
+ else if(typeof input === 'object' && input.generator !== undefined) // Value name generated by a function run on each item
5
+ return input.generator;
6
+ else return (() => input);
7
+
8
+ return undefined;
9
+ }
10
+ export default ValueGenerator
11
+ // module.exports = exports = ValueGenerator;
@@ -0,0 +1,21 @@
1
+ const WORLD_SIZE = 1024000; //TILE_SIZE * 2000
2
+ const MERCATOR_A = 6378137.0; // 900913 projection property. (Deprecated) Replaced by EARTH_RADIUS
3
+ const FOV_ORTHO = 0.1 / 180 * Math.PI; //Mapbox doesn't accept 0 as FOV
4
+ const FOV = Math.atan(3 / 4); //from Mapbox https://github.com/mapbox/mapbox-gl-js/blob/main/src/geo/transform.js#L93
5
+ const EARTH_RADIUS = 6371008.8; //from Mapbox https://github.com/mapbox/mapbox-gl-js/blob/0063cbd10a97218fb6a0f64c99bf18609b918f4c/src/geo/lng_lat.js#L11
6
+ const EARTH_CIRCUMFERENCE_EQUATOR = 40075017 //from Mapbox https://github.com/mapbox/mapbox-gl-js/blob/0063cbd10a97218fb6a0f64c99bf18609b918f4c/src/geo/lng_lat.js#L117
7
+
8
+ export default {
9
+ WORLD_SIZE: WORLD_SIZE,
10
+ PROJECTION_WORLD_SIZE: WORLD_SIZE / (EARTH_RADIUS * Math.PI * 2),
11
+ MERCATOR_A: EARTH_RADIUS,
12
+ DEG2RAD: Math.PI / 180,
13
+ RAD2DEG: 180 / Math.PI,
14
+ EARTH_RADIUS: EARTH_RADIUS,
15
+ EARTH_CIRCUMFERENCE: 2 * Math.PI * EARTH_RADIUS, //40075000, // In meters
16
+ EARTH_CIRCUMFERENCE_EQUATOR: EARTH_CIRCUMFERENCE_EQUATOR,
17
+ FOV_ORTHO: FOV_ORTHO, // closest to 0
18
+ FOV: FOV, // Math.atan(3/4) radians. If this value is changed, FOV_DEGREES must be calculated
19
+ FOV_DEGREES: FOV * 180 / Math.PI, // Math.atan(3/4) in degrees
20
+ TILE_SIZE: 512
21
+ }
@@ -0,0 +1,52 @@
1
+ // This module creates a THREE material from the options object provided into the Objects class.
2
+ // Users can do this in one of three ways:
3
+
4
+ // - provide a preset THREE.Material in the `material` parameter
5
+ // - specify a `material` string, `color`, and/or `opacity` as modifications of the default material
6
+ // - provide none of these parameters, to use the default material
7
+ import utils from '../utils/utils.js';
8
+ // var utils = require("../utils/utils.js");
9
+ import * as THREE from '../three.module.js'
10
+
11
+ var defaults = {
12
+ material: 'MeshBasicMaterial',
13
+ color: 'black',
14
+ opacity: 1
15
+ };
16
+
17
+
18
+ function material (options) {
19
+
20
+ var output;
21
+
22
+ if (options) {
23
+
24
+ options = utils._validate(options, defaults);
25
+
26
+ // check if user provided material object
27
+ if (options.material && options.material.isMaterial) output = options.material;
28
+
29
+ // check if user provided any material parameters. create new material object based on that.
30
+ else if (options.material || options.color || options.opacity){
31
+ output = new THREE[options.material]({color: options.color, transparent: options.opacity<1});
32
+ }
33
+
34
+ // if neither, return default material
35
+ else output = generateDefaultMaterial();
36
+
37
+ output.opacity = options.opacity;
38
+ if (options.side) output.side = options.side
39
+
40
+ }
41
+
42
+ // if no options, return default
43
+ else output = generateDefaultMaterial();
44
+
45
+ function generateDefaultMaterial(){
46
+ return new THREE[defaults.material]({color: defaults.color});
47
+ }
48
+
49
+ return output
50
+ }
51
+ export default material
52
+ //module.exports = exports = material;
@@ -0,0 +1,322 @@
1
+ /*
2
+ (c) 2011-2015, Vladimir Agafonkin
3
+ SunCalc is a JavaScript library for calculating sun/moon position and light phases.
4
+ https://github.com/mourner/suncalc
5
+ */
6
+
7
+ // (function () {
8
+ // 'use strict';
9
+
10
+ // shortcuts for easier to read formulas
11
+
12
+ var PI = Math.PI,
13
+ sin = Math.sin,
14
+ cos = Math.cos,
15
+ tan = Math.tan,
16
+ asin = Math.asin,
17
+ atan = Math.atan2,
18
+ acos = Math.acos,
19
+ rad = PI / 180;
20
+
21
+ // sun calculations are based on http://aa.quae.nl/en/reken/zonpositie.html formulas
22
+
23
+
24
+ // date/time constants and conversions
25
+
26
+ var dayMs = 1000 * 60 * 60 * 24,
27
+ J1970 = 2440588,
28
+ J2000 = 2451545;
29
+
30
+ function toJulian(date) { return date.valueOf() / dayMs - 0.5 + J1970; }
31
+ function fromJulian(j) { return new Date((j + 0.5 - J1970) * dayMs); }
32
+ function toDays(date) { return toJulian(date) - J2000; }
33
+
34
+ // general calculations for position
35
+
36
+ var e = rad * 23.4397; // obliquity of the Earth
37
+
38
+ function rightAscension(l, b) { return atan(sin(l) * cos(e) - tan(b) * sin(e), cos(l)); }
39
+ function declination(l, b) { return asin(sin(b) * cos(e) + cos(b) * sin(e) * sin(l)); }
40
+
41
+ function azimuth(H, phi, dec) { return atan(sin(H), cos(H) * sin(phi) - tan(dec) * cos(phi)); }
42
+ function altitude(H, phi, dec) { return asin(sin(phi) * sin(dec) + cos(phi) * cos(dec) * cos(H)); }
43
+
44
+ function siderealTime(d, lw) { return rad * (280.16 + 360.9856235 * d) - lw; }
45
+
46
+ function astroRefraction(h) {
47
+ if (h < 0) // the following formula works for positive altitudes only.
48
+ h = 0; // if h = -0.08901179 a div/0 would occur.
49
+
50
+ // formula 16.4 of "Astronomical Algorithms" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.
51
+ // 1.02 / tan(h + 10.26 / (h + 5.10)) h in degrees, result in arc minutes -> converted to rad:
52
+ return 0.0002967 / Math.tan(h + 0.00312536 / (h + 0.08901179));
53
+ }
54
+
55
+ // general sun calculations
56
+
57
+ function solarMeanAnomaly(d) { return rad * (357.5291 + 0.98560028 * d); }
58
+
59
+ function eclipticLongitude(M) {
60
+
61
+ var C = rad * (1.9148 * sin(M) + 0.02 * sin(2 * M) + 0.0003 * sin(3 * M)), // equation of center
62
+ P = rad * 102.9372; // perihelion of the Earth
63
+
64
+ return M + C + P + PI;
65
+ }
66
+
67
+ function sunCoords(d) {
68
+
69
+ var M = solarMeanAnomaly(d),
70
+ L = eclipticLongitude(M);
71
+
72
+ return {
73
+ dec: declination(L, 0),
74
+ ra: rightAscension(L, 0)
75
+ };
76
+ }
77
+
78
+
79
+ var SunCalc = {};
80
+
81
+
82
+ // calculates sun position for a given date and latitude/longitude
83
+
84
+ SunCalc.getPosition = function (date, lat, lng) {
85
+
86
+ var lw = rad * -lng,
87
+ phi = rad * lat,
88
+ d = toDays(date),
89
+
90
+ c = sunCoords(d),
91
+ H = siderealTime(d, lw) - c.ra;
92
+
93
+ return {
94
+ azimuth: azimuth(H, phi, c.dec),
95
+ altitude: altitude(H, phi, c.dec)
96
+ };
97
+ };
98
+
99
+ SunCalc.toJulian = function (date) {
100
+ return toJulian(date);
101
+ };
102
+
103
+ // sun times configuration (angle, morning name, evening name)
104
+
105
+ var times = SunCalc.times = [
106
+ [-0.833, 'sunrise', 'sunset'],
107
+ [-0.3, 'sunriseEnd', 'sunsetStart'],
108
+ [-6, 'dawn', 'dusk'],
109
+ [-12, 'nauticalDawn', 'nauticalDusk'],
110
+ [-18, 'nightEnd', 'night'],
111
+ [6, 'goldenHourEnd', 'goldenHour']
112
+ ];
113
+
114
+ // adds a custom time to the times config
115
+
116
+ SunCalc.addTime = function (angle, riseName, setName) {
117
+ times.push([angle, riseName, setName]);
118
+ };
119
+
120
+
121
+ // calculations for sun times
122
+
123
+ var J0 = 0.0009;
124
+
125
+ function julianCycle(d, lw) { return Math.round(d - J0 - lw / (2 * PI)); }
126
+
127
+ function approxTransit(Ht, lw, n) { return J0 + (Ht + lw) / (2 * PI) + n; }
128
+ function solarTransitJ(ds, M, L) { return J2000 + ds + 0.0053 * sin(M) - 0.0069 * sin(2 * L); }
129
+
130
+ function hourAngle(h, phi, d) { return acos((sin(h) - sin(phi) * sin(d)) / (cos(phi) * cos(d))); }
131
+ function observerAngle(height) { return -2.076 * Math.sqrt(height) / 60; }
132
+
133
+ // returns set time for the given sun altitude
134
+ function getSetJ(h, lw, phi, dec, n, M, L) {
135
+
136
+ var w = hourAngle(h, phi, dec),
137
+ a = approxTransit(w, lw, n);
138
+ return solarTransitJ(a, M, L);
139
+ }
140
+
141
+
142
+ // calculates sun times for a given date, latitude/longitude, and, optionally,
143
+ // the observer height (in meters) relative to the horizon
144
+
145
+ SunCalc.getTimes = function (date, lat, lng, height) {
146
+
147
+ height = height || 0;
148
+
149
+ var lw = rad * -lng,
150
+ phi = rad * lat,
151
+
152
+ dh = observerAngle(height),
153
+
154
+ d = toDays(date),
155
+ n = julianCycle(d, lw),
156
+ ds = approxTransit(0, lw, n),
157
+
158
+ M = solarMeanAnomaly(ds),
159
+ L = eclipticLongitude(M),
160
+ dec = declination(L, 0),
161
+
162
+ Jnoon = solarTransitJ(ds, M, L),
163
+
164
+ i, len, time, h0, Jset, Jrise;
165
+
166
+
167
+ var result = {
168
+ solarNoon: fromJulian(Jnoon),
169
+ nadir: fromJulian(Jnoon - 0.5)
170
+ };
171
+
172
+ for (i = 0, len = times.length; i < len; i += 1) {
173
+ time = times[i];
174
+ h0 = (time[0] + dh) * rad;
175
+
176
+ Jset = getSetJ(h0, lw, phi, dec, n, M, L);
177
+ Jrise = Jnoon - (Jset - Jnoon);
178
+
179
+ result[time[1]] = fromJulian(Jrise);
180
+ result[time[2]] = fromJulian(Jset);
181
+ }
182
+
183
+ return result;
184
+ };
185
+
186
+
187
+ // moon calculations, based on http://aa.quae.nl/en/reken/hemelpositie.html formulas
188
+
189
+ function moonCoords(d) { // geocentric ecliptic coordinates of the moon
190
+
191
+ var L = rad * (218.316 + 13.176396 * d), // ecliptic longitude
192
+ M = rad * (134.963 + 13.064993 * d), // mean anomaly
193
+ F = rad * (93.272 + 13.229350 * d), // mean distance
194
+
195
+ l = L + rad * 6.289 * sin(M), // longitude
196
+ b = rad * 5.128 * sin(F), // latitude
197
+ dt = 385001 - 20905 * cos(M); // distance to the moon in km
198
+
199
+ return {
200
+ ra: rightAscension(l, b),
201
+ dec: declination(l, b),
202
+ dist: dt
203
+ };
204
+ }
205
+
206
+ SunCalc.getMoonPosition = function (date, lat, lng) {
207
+
208
+ var lw = rad * -lng,
209
+ phi = rad * lat,
210
+ d = toDays(date),
211
+
212
+ c = moonCoords(d),
213
+ H = siderealTime(d, lw) - c.ra,
214
+ h = altitude(H, phi, c.dec),
215
+ // formula 14.1 of "Astronomical Algorithms" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.
216
+ pa = atan(sin(H), tan(phi) * cos(c.dec) - sin(c.dec) * cos(H));
217
+
218
+ h = h + astroRefraction(h); // altitude correction for refraction
219
+
220
+ return {
221
+ azimuth: azimuth(H, phi, c.dec),
222
+ altitude: h,
223
+ distance: c.dist,
224
+ parallacticAngle: pa
225
+ };
226
+ };
227
+
228
+
229
+ // calculations for illumination parameters of the moon,
230
+ // based on http://idlastro.gsfc.nasa.gov/ftp/pro/astro/mphase.pro formulas and
231
+ // Chapter 48 of "Astronomical Algorithms" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.
232
+
233
+ SunCalc.getMoonIllumination = function (date) {
234
+
235
+ var d = toDays(date || new Date()),
236
+ s = sunCoords(d),
237
+ m = moonCoords(d),
238
+
239
+ sdist = 149598000, // distance from Earth to Sun in km
240
+
241
+ phi = acos(sin(s.dec) * sin(m.dec) + cos(s.dec) * cos(m.dec) * cos(s.ra - m.ra)),
242
+ inc = atan(sdist * sin(phi), m.dist - sdist * cos(phi)),
243
+ angle = atan(cos(s.dec) * sin(s.ra - m.ra), sin(s.dec) * cos(m.dec) -
244
+ cos(s.dec) * sin(m.dec) * cos(s.ra - m.ra));
245
+
246
+ return {
247
+ fraction: (1 + cos(inc)) / 2,
248
+ phase: 0.5 + 0.5 * inc * (angle < 0 ? -1 : 1) / Math.PI,
249
+ angle: angle
250
+ };
251
+ };
252
+
253
+
254
+ function hoursLater(date, h) {
255
+ return new Date(date.valueOf() + h * dayMs / 24);
256
+ }
257
+
258
+ // calculations for moon rise/set times are based on http://www.stargazing.net/kepler/moonrise.html article
259
+
260
+ SunCalc.getMoonTimes = function (date, lat, lng, inUTC) {
261
+ var t = new Date(date);
262
+ if (inUTC) t.setUTCHours(0, 0, 0, 0);
263
+ else t.setHours(0, 0, 0, 0);
264
+
265
+ var hc = 0.133 * rad,
266
+ h0 = SunCalc.getMoonPosition(t, lat, lng).altitude - hc,
267
+ h1, h2, rise, set, a, b, xe, ye, d, roots, x1, x2, dx;
268
+
269
+ // go in 2-hour chunks, each time seeing if a 3-point quadratic curve crosses zero (which means rise or set)
270
+ for (var i = 1; i <= 24; i += 2) {
271
+ h1 = SunCalc.getMoonPosition(hoursLater(t, i), lat, lng).altitude - hc;
272
+ h2 = SunCalc.getMoonPosition(hoursLater(t, i + 1), lat, lng).altitude - hc;
273
+
274
+ a = (h0 + h2) / 2 - h1;
275
+ b = (h2 - h0) / 2;
276
+ xe = -b / (2 * a);
277
+ ye = (a * xe + b) * xe + h1;
278
+ d = b * b - 4 * a * h1;
279
+ roots = 0;
280
+
281
+ if (d >= 0) {
282
+ dx = Math.sqrt(d) / (Math.abs(a) * 2);
283
+ x1 = xe - dx;
284
+ x2 = xe + dx;
285
+ if (Math.abs(x1) <= 1) roots++;
286
+ if (Math.abs(x2) <= 1) roots++;
287
+ if (x1 < -1) x1 = x2;
288
+ }
289
+
290
+ if (roots === 1) {
291
+ if (h0 < 0) rise = i + x1;
292
+ else set = i + x1;
293
+
294
+ } else if (roots === 2) {
295
+ rise = i + (ye < 0 ? x2 : x1);
296
+ set = i + (ye < 0 ? x1 : x2);
297
+ }
298
+
299
+ if (rise && set) break;
300
+
301
+ h0 = h2;
302
+ }
303
+
304
+ var result = {};
305
+
306
+ if (rise) result.rise = hoursLater(t, rise);
307
+ if (set) result.set = hoursLater(t, set);
308
+
309
+ if (!rise && !set) result[ye > 0 ? 'alwaysUp' : 'alwaysDown'] = true;
310
+
311
+ return result;
312
+ };
313
+
314
+
315
+ //// export as Node module / AMD module / browser variable
316
+ //if (typeof exports === 'object' && typeof module !== 'undefined') module.exports = SunCalc;
317
+ //else if (typeof define === 'function' && define.amd) define(SunCalc);
318
+ //else window.SunCalc = SunCalc;
319
+ export default SunCalc
320
+ // module.exports = exports = SunCalc
321
+ //}());
322
+