From 3a708d6bf26d668631687fb8ba0df8bea8151dda Mon Sep 17 00:00:00 2001 From: kyle-cochran Date: Thu, 5 Oct 2023 09:53:38 -0700 Subject: [PATCH] feat: update State printing to support extended state (#231) * feat: update State printing to support extended state * feat: explicitly print the Frame * Update src/OpenSpaceToolkit/Astrodynamics/Trajectory/State.cpp Co-authored-by: Vishwa Shah * refactor: remove full coordinates print line for consistency with previous printing --------- Co-authored-by: Vishwa Shah --- .../Astrodynamics/Trajectory/State.cpp | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/OpenSpaceToolkit/Astrodynamics/Trajectory/State.cpp b/src/OpenSpaceToolkit/Astrodynamics/Trajectory/State.cpp index a790c9611..df469e9fb 100644 --- a/src/OpenSpaceToolkit/Astrodynamics/Trajectory/State.cpp +++ b/src/OpenSpaceToolkit/Astrodynamics/Trajectory/State.cpp @@ -1,5 +1,7 @@ /// Apache License 2.0 +// #include + #include #include @@ -354,10 +356,22 @@ void State::print(std::ostream& anOutputStream, bool displayDecorator) const ostk::core::utils::Print::Line(anOutputStream) << "Instant:" << (this->instant_.isDefined() ? this->instant_.toString() : "Undefined"); ostk::core::utils::Print::Line(anOutputStream) - << "Position:" << (this->isDefined() ? this->getPosition().toString(12) : "Undefined"); - ostk::core::utils::Print::Line(anOutputStream) - << "Velocity:" << (this->isDefined() ? this->getVelocity().toString(12) : "Undefined"); + << "Frame:" << (this->frameSPtr_->isDefined() ? this->frameSPtr_->getName() : "Undefined"); + + if (!this->isDefined()) + { + ostk::core::utils::Print::Line(anOutputStream) << "Coordinates: Undefined"; + } + else + { + const Array> subsets = this->coordinatesBrokerSPtr_->getSubsets(); + for (const auto& subset : subsets) + { + ostk::core::utils::Print::Line(anOutputStream) + << subset->getName() << this->extractCoordinates(subset).toString(4); + } + } displayDecorator ? ostk::core::utils::Print::Footer(anOutputStream) : void(); }