Skip to content

Commit f475d72

Browse files
committed
refactor & cleanup
1 parent fbc67b7 commit f475d72

File tree

14 files changed

+24
-54
lines changed

14 files changed

+24
-54
lines changed

app/app.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from flask import Flask, request, jsonify, send_file
1+
from flask import Flask, request
22
from flask_cors import CORS
33

44
from astroquery.jplhorizons import Horizons
@@ -9,14 +9,11 @@
99
from astropy.coordinates import SkyCoord
1010

1111
from astropy.table import Table
12-
import pymongo
13-
import urllib.parse
1412
import json
1513
import numpy as np
1614

1715
from satellites import get_satellites
1816
from planets import get_info, get_planets_data
19-
from cache import get_cache_data, get_cache_satellites, search_satellites_cache_db, search_planets_cache_db
2017

2118
app = Flask(__name__)
2219

app/cache.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from flask import abort
2-
import pymongo
32
from datetime import datetime
43
from database import connect_to_db, close_db_connection
54

frontend/README.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

frontend/src/components/DataSelection/paramsPicker/ParamsPicker.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const ParamsPicker: React.FC<ParamsPickerProps> = ({ visualisationMode }) => {
4040
openError(true);
4141
return false;
4242
}
43-
console.log(startValue, endValue);
4443
if (startValue === null) return;
4544
const newUserOptions: UserOptions = {
4645
mode: mode === undefined ? 'RealTime' : mode,

frontend/src/components/GUI/Clock.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class Clock {
1919
time === undefined
2020
? `${visualisationOptions.start} 00:00:00`
2121
: `${visualisationOptions.start} ${time!.hours}:${time!.minutes}:00`;
22-
console.log('TIME', constructInitValue);
22+
2323
this.startDate = new Date(constructInitValue);
2424
this.endDate = visualisationOptions.end !== undefined ? new Date(visualisationOptions.end) : undefined;
2525
this.findUpdateParameters(speedMode);
@@ -62,7 +62,6 @@ export class Clock {
6262
};
6363

6464
public stopClock = () => {
65-
console.log('stop clock');
6665
this.stop = true;
6766
};
6867

@@ -86,26 +85,23 @@ export class Clock {
8685
public findNextValue = () => {
8786
if (this.stop) return;
8887

89-
// const update = this.startDate.getHours() + this.upadeValue;
9088
this.startDate.setTime(this.startDate.getTime() + (this.upadeValue*60*60*1000));
91-
// this.startDate.setUTCHours(update);
92-
93-
if (this.checkIfEndDateReached()) {
94-
console.log('end clock');
95-
return;
96-
}
9789

9890
this.clock.text = `${this.startDate.getDate()} - ${
9991
this.startDate.getMonth() + 1
10092
} - ${this.startDate.getFullYear()}`;
10193

94+
if (this.checkIfEndDateReached()) {
95+
return;
96+
}
10297
};
10398

10499
private checkIfEndDateReached = () => {
105100
if (this.endDate === undefined) return false;
106101

107102
if (this.startDate.getTime() > this.endDate.getTime()) {
108103
this.onEndDateReached();
104+
this.stop = true;
109105
new MessageHandler('End date reached.', '220px');
110106
return true;
111107
}

frontend/src/components/GUI/UserPanel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Scene, Mesh } from '@babylonjs/core';
33
import { VisualisationData } from '../../types/planetInterfaces';
44
import { FetchData, VisualisationOptions } from '../../types/period';
55
import Info from './InfoPanel';
6-
import { Timer } from '../SolarSystem/Timer';
6+
import { Timer } from '../../utils/movement/Timer';
77
import { Clock } from './Clock';
88
import Label from './Label';
99
import { TimeSelection } from '../../types/userOptions';

frontend/src/components/LandingPage/Info.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,18 @@ const ParamsTable = styled.table`
4747
border: 0.5px solid #171738;
4848
border-collapse: collapse;
4949
width: 60%;
50-
margin-top: 30px;
50+
margin-top: 20px;
5151
margin-bottom: 30px;
5252
`;
5353

5454
const TableHeader = styled.th`
5555
border: 0.5px solid #171738;
56-
height: 25px;
56+
height: 20px;
5757
`;
5858

5959
const TableContent = styled.td`
6060
border: 0.5px solid #171738;
61-
height: 30px;
61+
height: 25px;
6262
`;
6363

6464
const Info: React.FC<InfoProps> = ({ onClose }) => {
@@ -165,7 +165,7 @@ const Info: React.FC<InfoProps> = ({ onClose }) => {
165165
<div>
166166
When all parameters are correctly set, the start button apprears. On click, the visualisation
167167
starts.
168-
<br></br><br></br>
168+
<br></br>
169169
The visualisation contains of the rendered model and user interface containing:
170170
<li style={{marginBottom: '5px', marginTop: '10px'}}><b>Clock</b> - displays the current visusalisation date and time.</li>
171171
<li style={{marginBottom: '5px'}}><b>"More info" button</b> - displays more info about the visible celestial bodies.</li>

frontend/src/components/PlanetSystem/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export const PlanetSystemScene = () => {
2626
const [planetsData, setPlanetsData] = useState<PlanetData[]>([]);
2727
const fetchData = findFetchParameters('Satellite');
2828
const options: UserOptions = useSelector((state: RootStateOrAny) => state.userOptions);
29-
console.log('STATE', options);
3029
const { start, end } = defineStartingPeriod(fetchData.period, options.startDate);
3130

3231
const satellitesNumber = satellitesMap.get(options.planet!);
@@ -49,7 +48,6 @@ export const PlanetSystemScene = () => {
4948
`http://localhost:5000/getSatellitesJPLData?planet=${options.planet}&start=${start}&end=${end}&step=${fetchData.step}`,
5049
);
5150
resCode = response.status;
52-
console.log(resCode)
5351
const data = await response.json();
5452
const readyData = [];
5553
for (const key in data) {

frontend/src/components/SolarSystem/SceneComponent.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const SceneComponent = (props: any) => {
2121
if (reactCanvas.current) {
2222
const engine = new Engine(reactCanvas.current, antialias, engineOptions, adaptToDeviceRatio);
2323
const initScene = new Scene(engine, sceneOptions);
24-
console.log(planetsData)
2524
if (initScene !== undefined && initScene.isReady()) {
2625
const initData = new SceneData(planetsData, initScene, fetchData.refill);
2726
const info = new Info('SolarSystem');

frontend/src/components/SolarSystem/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export const InitSceneData = () => {
4040
`http://localhost:5000/getPlanetsJPLData?name=${planets}&start=${start}&end=${end}&step=${fetchData.step}`,
4141
);
4242
const data = await response.json();
43-
console.log('fetch', data);
4443
const readyData = [];
4544
for (const key in data) {
4645
const newPlanetData: PlanetData = { planet: key, position: rescaleData(data[key], key, false) };
@@ -49,7 +48,6 @@ export const InitSceneData = () => {
4948

5049
setPlanetsData([...readyData]);
5150
} catch (e: any) {
52-
console.log(e);
5351
openError(true);
5452
} finally {
5553
openSpinner(false);

frontend/src/components/SolarSystem/MovePlanets.ts renamed to frontend/src/utils/movement/MovePlanets.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Scene, LinesMesh, Vector3, Curve3, MeshBuilder, Mesh } from '@babylonjs/core';
22
import { DatesPeriod, FetchData, VisualisationOptions } from '../../types/period';
33
import { VisualisationData } from '../../types/planetInterfaces';
4-
import { findNewPeriod } from '../../utils/findFetchPeriod';
5-
import getPlanetOrbitData from '../../utils/getOrbiteData';
6-
import ErrorHandler from '../../utils/handlers/ErrorHandler';
4+
import { findNewPeriod } from '../findFetchPeriod';
5+
import getPlanetOrbitData from '../getOrbiteData';
6+
import ErrorHandler from '../handlers/ErrorHandler';
77

8-
interface OribteDrawer {
8+
interface OribtDrawer {
99
linesMesh: LinesMesh;
1010
initPosition: Vector3;
1111
buffer: Vector3[];
@@ -21,8 +21,8 @@ export class MovePlanets {
2121
stopFetch: boolean = false;
2222
errorHandler: ErrorHandler;
2323
scene: Scene;
24-
linesMeshes: Map<string, OribteDrawer>;
25-
oribteDrawerCounter: number = 0;
24+
linesMeshes: Map<string, OribtDrawer>;
25+
oribtDrawerCounter: number = 0;
2626
draw: boolean = true;
2727
stopClock: () => void;
2828
planet?: Mesh;
@@ -41,10 +41,9 @@ export class MovePlanets {
4141
this.fetchData = fetchData;
4242
this.errorHandler = new ErrorHandler(this.onDataEnd);
4343
this.scene = scene;
44-
this.linesMeshes = new Map<string, OribteDrawer>();
44+
this.linesMeshes = new Map<string, OribtDrawer>();
4545
this.stopClock = stopClock;
4646
for (let el of visualisationData) {
47-
// if (planets.includes(el.planet.name)) {
4847
const initPoints = [];
4948

5049
for (let i = 0; i < 10; i++) {
@@ -55,22 +54,22 @@ export class MovePlanets {
5554
points: initPoints,
5655
updatable: true,
5756
});
57+
5858
this.linesMeshes.set(el.planet.name, {
5959
linesMesh: lineMesh,
6060
initPosition: el.orbit[10],
6161
buffer: initPoints,
6262
});
63-
// }
6463
}
6564

6665
this.planet = planet;
6766
}
6867

6968
movePlanet = async () => {
70-
this.oribteDrawerCounter++;
71-
if ((this.oribteDrawerCounter = 10)) {
69+
this.oribtDrawerCounter++;
70+
if ((this.oribtDrawerCounter = 10)) {
7271
this.draw = true;
73-
this.oribteDrawerCounter = 0;
72+
this.oribtDrawerCounter = 0;
7473
}
7574
if (this.visualisationData !== undefined && !this.stop && !this.checkIfEndDateReached()) {
7675
for (let data of this.visualisationData) {
@@ -149,7 +148,6 @@ export class MovePlanets {
149148
const toModify = data.get(el.planet.name);
150149

151150
if (toModify !== undefined) {
152-
console.log(toModify);
153151
el.length = el.orbit.length + toModify!.length;
154152
el.orbit.push(...toModify!);
155153
el.iter = 0;

frontend/src/components/SolarSystem/Timer.ts renamed to frontend/src/utils/movement/Timer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Scene, AdvancedTimer, Mesh } from '@babylonjs/core';
22
import { FetchData, VisualisationOptions } from '../../types/period';
33
import { VisualisationData } from '../../types/planetInterfaces';
4-
import setMovementTimer from '../../utils/setMovementTimer';
4+
import setMovementTimer from './setMovementTimer';
55
import { MovePlanets } from './MovePlanets';
66

77
export class Timer {

frontend/src/utils/setMovementTimer.ts renamed to frontend/src/utils/movement/setMovementTimer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Scene, AdvancedTimer } from '@babylonjs/core';
2-
import { MovePlanets } from '../components/SolarSystem/MovePlanets';
2+
import { MovePlanets } from './MovePlanets';
33

44
interface MovementTimer {
55
scene: Scene;

0 commit comments

Comments
 (0)