Skip to content

Commit

Permalink
feat: update State printing to support extended state (#231)
Browse files Browse the repository at this point in the history
* 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 <vishwa2710@gmail.com>

* refactor: remove full coordinates print line for consistency with previous printing

---------

Co-authored-by: Vishwa Shah <vishwa2710@gmail.com>
  • Loading branch information
kyle-cochran and vishwa2710 authored Oct 5, 2023
1 parent d358179 commit 3a708d6
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/OpenSpaceToolkit/Astrodynamics/Trajectory/State.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/// Apache License 2.0

// #include <Eigen/Core>

#include <OpenSpaceToolkit/Core/Error.hpp>
#include <OpenSpaceToolkit/Core/Utilities.hpp>

Expand Down Expand Up @@ -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<Shared<const CoordinatesSubset>> 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();
}

Expand Down

0 comments on commit 3a708d6

Please sign in to comment.