@zendir/ui 0.2.8 → 0.2.10
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/react/charts/GroundTrackMap.d.ts +6 -1
- package/dist/react/charts/GroundTrackMap.js +21 -19
- package/dist/react/charts/GroundTrackMap.js.map +1 -1
- package/dist/react/charts/GroundTrackMapLeaflet.d.ts +6 -1
- package/dist/react/charts/GroundTrackMapLeaflet.js +29 -21
- package/dist/react/charts/GroundTrackMapLeaflet.js.map +1 -1
- package/package.json +1 -1
|
@@ -217,6 +217,11 @@ export interface GroundTrackMapProps {
|
|
|
217
217
|
* `enabled` is the new toggle state.
|
|
218
218
|
*/
|
|
219
219
|
onLayerChange?: (layerId: string, enabled: boolean) => void;
|
|
220
|
+
/**
|
|
221
|
+
* Show sun and moon position markers on the map.
|
|
222
|
+
* Requires `showTerminator`. Default: true when terminator is enabled.
|
|
223
|
+
*/
|
|
224
|
+
showCelestialMarkers?: boolean;
|
|
220
225
|
}
|
|
221
|
-
export declare function GroundTrackMap({ groundTrack, satellites, groundStations, accessMask, teamPaths, showTerminator, terminatorTime, showGrid, showLegend, showEquator, showRecenterButton, showMapStyleToggle, isLoading, emptyMessage, width, height, minHeight, defaultCenter, defaultZoom, className, onSatelliteClick, onStationClick, mapProvider, tileUrl, nightTileUrl, lightSources, pins, pinsEditable, onPinAdd, onPinUpdate, onPinRemove, customLayers, onLayerChange, }: GroundTrackMapProps): React.ReactElement;
|
|
226
|
+
export declare function GroundTrackMap({ groundTrack, satellites, groundStations, accessMask, teamPaths, showTerminator, terminatorTime, showGrid, showLegend, showEquator, showRecenterButton, showMapStyleToggle, isLoading, emptyMessage, width, height, minHeight, defaultCenter, defaultZoom, className, onSatelliteClick, onStationClick, mapProvider, tileUrl, nightTileUrl, lightSources, pins, pinsEditable, onPinAdd, onPinUpdate, onPinRemove, customLayers, onLayerChange, showCelestialMarkers, }: GroundTrackMapProps): React.ReactElement;
|
|
222
227
|
export default GroundTrackMap;
|
|
@@ -79,14 +79,14 @@ function hexToRgb(hex) {
|
|
|
79
79
|
return [255, 238, 221];
|
|
80
80
|
}
|
|
81
81
|
function calculateTerminatorContinuous(date, depressionDeg = 0, numPoints = 360) {
|
|
82
|
-
const dayOfYear = Math.floor((date.getTime() -
|
|
82
|
+
const dayOfYear = Math.floor((date.getTime() - Date.UTC(date.getUTCFullYear(), 0, 0)) / 864e5);
|
|
83
83
|
const declination = -23.44 * Math.cos(2 * Math.PI / 365 * (dayOfYear + 10));
|
|
84
84
|
const decRad = declination * Math.PI / 180;
|
|
85
85
|
const B = 2 * Math.PI / 365 * (dayOfYear - 81);
|
|
86
86
|
const eotMinutes = 9.87 * Math.sin(2 * B) - 7.53 * Math.cos(B) - 1.5 * Math.sin(B);
|
|
87
87
|
const utcHours = date.getUTCHours() + date.getUTCMinutes() / 60 + date.getUTCSeconds() / 3600;
|
|
88
88
|
const solarHours = utcHours + eotMinutes / 60;
|
|
89
|
-
const
|
|
89
|
+
const subSolarLon = -(solarHours - 12) * 15;
|
|
90
90
|
const depRad = depressionDeg * Math.PI / 180;
|
|
91
91
|
const sunset = [];
|
|
92
92
|
const sunrise = [];
|
|
@@ -96,12 +96,12 @@ function calculateTerminatorContinuous(date, depressionDeg = 0, numPoints = 360)
|
|
|
96
96
|
const cosH = -(Math.sin(depRad) + Math.sin(latRad) * Math.sin(decRad)) / (Math.cos(latRad) * Math.cos(decRad));
|
|
97
97
|
if (cosH < -1) ;
|
|
98
98
|
else if (cosH > 1) {
|
|
99
|
-
sunset.push([lat,
|
|
100
|
-
sunrise.push([lat,
|
|
99
|
+
sunset.push([lat, subSolarLon]);
|
|
100
|
+
sunrise.push([lat, subSolarLon + 360]);
|
|
101
101
|
} else {
|
|
102
102
|
const H = Math.acos(cosH) * 180 / Math.PI;
|
|
103
|
-
sunset.push([lat,
|
|
104
|
-
sunrise.push([lat,
|
|
103
|
+
sunset.push([lat, subSolarLon + H]);
|
|
104
|
+
sunrise.push([lat, subSolarLon + 360 - H]);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
return { sunset, sunrise };
|
|
@@ -147,7 +147,8 @@ function GroundTrackMap({
|
|
|
147
147
|
onPinUpdate,
|
|
148
148
|
onPinRemove,
|
|
149
149
|
customLayers,
|
|
150
|
-
onLayerChange
|
|
150
|
+
onLayerChange,
|
|
151
|
+
showCelestialMarkers
|
|
151
152
|
}) {
|
|
152
153
|
const { tokens } = useTheme();
|
|
153
154
|
const canvasRef = useRef(null);
|
|
@@ -233,13 +234,13 @@ function GroundTrackMap({
|
|
|
233
234
|
ctx.fillRect(0, 0, W, H);
|
|
234
235
|
if (showTerminator) {
|
|
235
236
|
const now = terminatorTime ?? /* @__PURE__ */ new Date();
|
|
236
|
-
const BAND_STEP =
|
|
237
|
-
const MAX_DEP =
|
|
238
|
-
const NIGHT_ALPHA = 0.
|
|
237
|
+
const BAND_STEP = 1.5;
|
|
238
|
+
const MAX_DEP = 30;
|
|
239
|
+
const NIGHT_ALPHA = 0.38;
|
|
239
240
|
const bandSteps = [];
|
|
240
241
|
for (let d = 0; d <= MAX_DEP; d += BAND_STEP) {
|
|
241
242
|
const t = Math.min(d / 18, 1);
|
|
242
|
-
const alpha = t
|
|
243
|
+
const alpha = Math.pow(t, 1.6) * (NIGHT_ALPHA * 0.85) + (d > 18 ? (d - 18) / 12 * (NIGHT_ALPHA * 0.15) : 0);
|
|
243
244
|
bandSteps.push({ depression: d, alpha: Math.min(alpha, NIGHT_ALPHA) });
|
|
244
245
|
}
|
|
245
246
|
bandSteps.push({ depression: 90, alpha: NIGHT_ALPHA });
|
|
@@ -261,7 +262,7 @@ function GroundTrackMap({
|
|
|
261
262
|
prevAlpha = zone.alpha;
|
|
262
263
|
continue;
|
|
263
264
|
}
|
|
264
|
-
ctx.fillStyle = `rgba(
|
|
265
|
+
ctx.fillStyle = `rgba(42, 58, 82, ${bandAlpha.toFixed(4)})`;
|
|
265
266
|
for (const offset of [-360, 0, 360]) {
|
|
266
267
|
ctx.beginPath();
|
|
267
268
|
for (let i = 0; i < poly.length; i++) {
|
|
@@ -283,8 +284,8 @@ function GroundTrackMap({
|
|
|
283
284
|
const terminatorEdge = calculateTerminatorContinuous(now, 0);
|
|
284
285
|
if (terminatorEdge.sunset.length > 2) {
|
|
285
286
|
ctx.save();
|
|
286
|
-
ctx.strokeStyle = "rgba(
|
|
287
|
-
ctx.lineWidth =
|
|
287
|
+
ctx.strokeStyle = "rgba(143, 174, 200, 0.08)";
|
|
288
|
+
ctx.lineWidth = 3;
|
|
288
289
|
for (const curve of [terminatorEdge.sunset, terminatorEdge.sunrise]) {
|
|
289
290
|
for (const offset of [-360, 0, 360]) {
|
|
290
291
|
ctx.beginPath();
|
|
@@ -297,7 +298,7 @@ function GroundTrackMap({
|
|
|
297
298
|
ctx.stroke();
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
|
-
ctx.strokeStyle = "rgba(
|
|
301
|
+
ctx.strokeStyle = "rgba(154, 184, 216, 0.35)";
|
|
301
302
|
ctx.lineWidth = 1;
|
|
302
303
|
for (const curve of [terminatorEdge.sunset, terminatorEdge.sunrise]) {
|
|
303
304
|
for (const offset of [-360, 0, 360]) {
|
|
@@ -543,12 +544,12 @@ function GroundTrackMap({
|
|
|
543
544
|
const r = light.radius ?? 4;
|
|
544
545
|
const intensity = light.intensity ?? 0.8;
|
|
545
546
|
const color = light.color ?? "#ffeedd";
|
|
546
|
-
const dayOfYear = Math.floor((now.getTime() -
|
|
547
|
+
const dayOfYear = Math.floor((now.getTime() - Date.UTC(now.getUTCFullYear(), 0, 0)) / 864e5);
|
|
547
548
|
const declination = -23.44 * Math.cos(2 * Math.PI / 365 * (dayOfYear + 10));
|
|
548
549
|
const decRad = declination * Math.PI / 180;
|
|
549
|
-
const
|
|
550
|
+
const lsSubSolarLon = -(now.getUTCHours() + now.getUTCMinutes() / 60 - 12) * 15;
|
|
550
551
|
const latRad = light.latitude * Math.PI / 180;
|
|
551
|
-
const sinAlt = Math.sin(latRad) * Math.sin(decRad) + Math.cos(latRad) * Math.cos(decRad) * Math.cos((light.longitude -
|
|
552
|
+
const sinAlt = Math.sin(latRad) * Math.sin(decRad) + Math.cos(latRad) * Math.cos(decRad) * Math.cos((light.longitude - lsSubSolarLon) * Math.PI / 180);
|
|
552
553
|
const solarAltDeg = Math.asin(sinAlt) * 180 / Math.PI;
|
|
553
554
|
let nightFactor;
|
|
554
555
|
if (solarAltDeg >= 0) nightFactor = 0;
|
|
@@ -1019,7 +1020,8 @@ function GroundTrackMap({
|
|
|
1019
1020
|
onPinUpdate,
|
|
1020
1021
|
onPinRemove,
|
|
1021
1022
|
customLayers,
|
|
1022
|
-
onLayerChange
|
|
1023
|
+
onLayerChange,
|
|
1024
|
+
showCelestialMarkers
|
|
1023
1025
|
}
|
|
1024
1026
|
)
|
|
1025
1027
|
}
|