Skip to content

Commit

Permalink
added max elevation
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnha committed Jan 4, 2024
1 parent 5d34eed commit cadaa8e
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions src/leo-client-app/src/components/DetailedDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const DetailedDisplay: React.FC<DetailedDisplayProps> = ({
const [data, setData] = useState<DataPoint[]>([]);
const [startAzimuth, setStartAzimuth] = useState<number>();
const [endAzimuth, setEndAzimuth] = useState<number>();
const [maxElevation, setmaxElevation] = useState<number>();
const router = useRouter();

useEffect(() => {
Expand Down Expand Up @@ -73,6 +74,23 @@ const DetailedDisplay: React.FC<DetailedDisplayProps> = ({
console.error("Error fetching end azimuth:", error);
});

// Get max elevation
fetch(
`http://localhost:3001/satellite/getMaxElevation?START_DATE=${startTime}&END_DATE=${endTime}`
)
.then((response) => {
if (!response.ok) {
throw Error("Network response was not ok");
}
return response.json();
})
.then((data) => {
setmaxElevation(data.maxElevation);
})
.catch((error) => {
console.error("Error fetching end azimuth:", error);
});

//Plot the polar plot
fetch(
`http://localhost:3001/satellite/getPolarPlotData?START_DATE=${startTime}&END_DATE=${endTime}`
Expand Down Expand Up @@ -191,11 +209,19 @@ const DetailedDisplay: React.FC<DetailedDisplayProps> = ({
return (
<div>
<div id="plot"></div>
{typeof startAzimuth === "number" && <p>Start Azimuth: {startAzimuth}</p>}
{typeof endAzimuth === "number" && <p>End Azimuth: {endAzimuth}</p>}
{typeof startAzimuth === "number" && (
<p>Start Azimuth: {startAzimuth}°</p>
)}
{typeof endAzimuth === "number" && <p>End Azimuth: {endAzimuth}°</p>}
{typeof maxElevation === "number" && (
<p>Max Elevation: {maxElevation}°</p>
)}
{typeof startTime === "string" && <p>AOS: {formatTime(startTime)}</p>}
{typeof endTime === "string" && <p>LOS: {formatTime(endTime)}</p>}
<p>Measurements closest to the nearest minute.</p>
<p>
Max elevation closest to the nearest second. AOS and LOS closest to the
nearest minute.
</p>
</div>
);
};
Expand Down

0 comments on commit cadaa8e

Please sign in to comment.