|
31 | 31 |
|
32 | 32 | from .converters import coerce_to_datetime
|
33 | 33 | from .utilities import lla_from_position
|
| 34 | +from .utilities import lla_from_state |
| 35 | +from .utilities import position_from_lla |
34 | 36 |
|
35 | 37 | DEFAULT_SATELLITE_IMAGE: str = (
|
36 | 38 | "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADJSURBVDhPnZHRDcMgEEMZjVEYpaNklIzSEfLfD4qNnXAJSFWfhO7w2Zc0Tf9QG2rXrEzSUeZLOGm47WoH95x3Hl3jEgilvDgsOQUTqsNl68ezEwn1vae6lceSEEYvvWNT/Rxc4CXQNGadho1NXoJ+9iaqc2xi2xbt23PJCDIB6TQjOC6Bho/sDy3fBQT8PrVhibU7yBFcEPaRxOoeTwbwByCOYf9VGp1BYI1BA+EeHhmfzKbBoJEQwn1yzUZtyspIQUha85MpkNIXB7GizqDEECsAAAAASUVORK5CYII="
|
37 | 39 | )
|
38 |
| -DEFAULT_STEP_DURATION: Duration = Duration.seconds(1.0) |
| 40 | +DEFAULT_STEP_DURATION: Duration = Duration.seconds(10.0) |
39 | 41 |
|
40 | 42 |
|
41 | 43 | @dataclass
|
@@ -376,6 +378,47 @@ def _create_celestial_body_direction_state(
|
376 | 378 |
|
377 | 379 | return self
|
378 | 380 |
|
| 381 | + def add_ground_tracks( |
| 382 | + self, |
| 383 | + profile_or_trajectory: Profile | Trajectory, |
| 384 | + time_step: Duration | None = None, |
| 385 | + ) -> Viewer: |
| 386 | + """ |
| 387 | + Add ground tracks to the viewer. |
| 388 | +
|
| 389 | + Args: |
| 390 | + profile_or_trajectory (Profile | Trajectory): The profile or trajectory to be added. |
| 391 | + time_step (Duration, optional): The duration of each step in the grid. |
| 392 | + Default to None. If None, the default step duration is used. |
| 393 | +
|
| 394 | + Returns: |
| 395 | + Viewer: The Viewer. |
| 396 | + """ |
| 397 | + time_step = time_step or DEFAULT_STEP_DURATION |
| 398 | + |
| 399 | + ground_track_positions: list[Position] = [] |
| 400 | + for state in profile_or_trajectory.get_states_at( |
| 401 | + self._interval.generate_grid(time_step) |
| 402 | + ): |
| 403 | + lla: LLA = lla_from_state(state) |
| 404 | + ground_track_positions.append( |
| 405 | + position_from_lla( |
| 406 | + LLA( |
| 407 | + latitude=lla.get_latitude(), |
| 408 | + longitude=lla.get_longitude(), |
| 409 | + altitude=Length.meters(0.0), |
| 410 | + ) |
| 411 | + ) |
| 412 | + ) |
| 413 | + |
| 414 | + self.add_line( |
| 415 | + positions=ground_track_positions, |
| 416 | + size=1, |
| 417 | + color=cesiumpy.color.GRAY, |
| 418 | + ) |
| 419 | + |
| 420 | + return self |
| 421 | + |
379 | 422 | def add_target(
|
380 | 423 | self,
|
381 | 424 | position: Position,
|
@@ -496,9 +539,7 @@ def _repr_html_(self) -> str:
|
496 | 539 |
|
497 | 540 |
|
498 | 541 | def _generate_llas(states: list[State]) -> list[LLA]:
|
499 |
| - return [ |
500 |
| - lla_from_position(state.get_position(), state.get_instant()) for state in states |
501 |
| - ] |
| 542 | + return list(map(lla_from_state, states)) |
502 | 543 |
|
503 | 544 |
|
504 | 545 | def _generate_sampled_position_from_llas(
|
|
0 commit comments