speedandcurrent 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/correctionTable.js +26 -14
- package/index.js +219 -165
- package/package.json +2 -2
- package/public/TableRenderer.js +8 -6
- package/public/app.js +29 -19
- package/public/index.html +22 -14
- package/public/main.css +177 -0
- package/public/vectors.html +1 -1
- package/public/vectors.js +30 -50
- package/public/style.css +0 -184
- package/public/vectors.css +0 -59
package/public/app.js
CHANGED
|
@@ -40,7 +40,7 @@ export function handleAngleUnitChange(value) {
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
export function handleTableStyleChange(value) {
|
|
43
|
-
console.log(value);
|
|
43
|
+
//console.log(value);
|
|
44
44
|
if (value == "cartesian") {
|
|
45
45
|
tableRenderer.setCellFormat(cartesian);
|
|
46
46
|
}
|
|
@@ -112,7 +112,7 @@ async function getFromServer(endpoint) {
|
|
|
112
112
|
if (response.status === 503) {
|
|
113
113
|
document.getElementById("message").innerHTML = "Plugin is not running";
|
|
114
114
|
} else {
|
|
115
|
-
document.getElementById("message").innerHTML = "Failed to fetch data";
|
|
115
|
+
document.getElementById("message").innerHTML = "Failed to fetch data. Error: " + response.status + " " + response.statusText;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
else {
|
|
@@ -158,15 +158,17 @@ function updatePolar(data) {
|
|
|
158
158
|
stepsList.innerHTML = ''; // Clear previous steps
|
|
159
159
|
|
|
160
160
|
const table = document.createElement('table');
|
|
161
|
+
table.classList.add('polar');
|
|
161
162
|
const headerRow = document.createElement('tr');
|
|
162
163
|
headerRow.innerHTML = '<th>Label</th><th>Speed</th><th>Angle</th>';
|
|
163
164
|
table.appendChild(headerRow);
|
|
164
165
|
|
|
165
|
-
data.
|
|
166
|
+
data.polars.forEach(polar => {
|
|
166
167
|
const row = document.createElement('tr');
|
|
167
|
-
if (
|
|
168
|
-
row.
|
|
169
|
-
|
|
168
|
+
if (polar.id) {
|
|
169
|
+
row.id = polar.id;
|
|
170
|
+
}
|
|
171
|
+
row.innerHTML = `<td>${polar.displayAttributes.label}</td><td>${cSpeed(polar.magnitude)}</td><td>${cAngle(polar.angle)}</td>`;
|
|
170
172
|
table.appendChild(row);
|
|
171
173
|
});
|
|
172
174
|
|
|
@@ -178,15 +180,17 @@ function updateDelta(data) {
|
|
|
178
180
|
stepsList.innerHTML = ''; // Clear previous steps
|
|
179
181
|
|
|
180
182
|
const table = document.createElement('table');
|
|
183
|
+
table.classList.add('delta');
|
|
181
184
|
const headerRow = document.createElement('tr');
|
|
182
|
-
headerRow.innerHTML = '<th>Label</th><th>
|
|
185
|
+
headerRow.innerHTML = '<th>Label</th><th>Value</th>';
|
|
183
186
|
table.appendChild(headerRow);
|
|
184
187
|
|
|
185
|
-
data.deltas.forEach(
|
|
188
|
+
data.deltas.forEach(delta => {
|
|
186
189
|
const row = document.createElement('tr');
|
|
187
|
-
if (
|
|
188
|
-
row.
|
|
189
|
-
|
|
190
|
+
if (delta.id) {
|
|
191
|
+
row.id = delta.id;
|
|
192
|
+
}
|
|
193
|
+
row.innerHTML = `<td>${delta.displayAttributes.label}</td><td>${cAngle(delta.value)}</td>`;
|
|
190
194
|
table.appendChild(row);
|
|
191
195
|
});
|
|
192
196
|
|
|
@@ -197,16 +201,19 @@ function updateAttitude(data) {
|
|
|
197
201
|
const attitudeContainer = document.getElementById('attitude-container');
|
|
198
202
|
attitudeContainer.innerHTML = '';
|
|
199
203
|
const table = document.createElement('table');
|
|
204
|
+
table.classList.add('attitude');
|
|
205
|
+
|
|
200
206
|
const headerRow = document.createElement('tr');
|
|
201
|
-
headerRow.innerHTML = '<th>Label</th><th>roll</th><th>pitch</th>';
|
|
207
|
+
headerRow.innerHTML = '<th>Label</th><th>roll</th><th>pitch</th><th>yaw</th>';
|
|
202
208
|
table.appendChild(headerRow);
|
|
203
209
|
|
|
204
210
|
|
|
205
|
-
data.
|
|
211
|
+
data.attitudes.forEach(attitude => {
|
|
206
212
|
const row = document.createElement('tr');
|
|
207
|
-
if (
|
|
208
|
-
row.
|
|
209
|
-
|
|
213
|
+
if (attitude.id) {
|
|
214
|
+
row.id = attitude.id;
|
|
215
|
+
}
|
|
216
|
+
row.innerHTML = `<td>${attitude.displayAttributes.label}</td><td>${cAngle(attitude.value.roll)}</td><td>${cAngle(attitude.value.pitch)}</td><td>${cAngle(attitude.value.yaw)}</td>`;
|
|
210
217
|
table.appendChild(row);
|
|
211
218
|
});
|
|
212
219
|
attitudeContainer.appendChild(table);
|
|
@@ -215,8 +222,11 @@ function updateAttitude(data) {
|
|
|
215
222
|
function updateTable(data) {
|
|
216
223
|
const tableContainer = document.getElementById('table-container');
|
|
217
224
|
tableContainer.innerHTML = '';
|
|
218
|
-
|
|
219
|
-
|
|
225
|
+
data.tables.forEach(table => {
|
|
226
|
+
|
|
227
|
+
const tableElement = tableRenderer.render(table);
|
|
228
|
+
tableContainer.appendChild(tableElement);
|
|
229
|
+
});
|
|
220
230
|
}
|
|
221
231
|
|
|
222
232
|
|
|
@@ -226,7 +236,7 @@ async function fetchAndUpdateData() {
|
|
|
226
236
|
const data = await getFromServer('getResults'); // Updated endpoint
|
|
227
237
|
if (data) {
|
|
228
238
|
//console.log(data);
|
|
229
|
-
updateOptions(data);
|
|
239
|
+
//updateOptions(data);
|
|
230
240
|
updatePolar(data);
|
|
231
241
|
updateAttitude(data);
|
|
232
242
|
updateDelta(data);
|
package/public/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta charset="UTF-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>Speed and current</title>
|
|
8
|
-
<link rel="stylesheet" href="
|
|
8
|
+
<link rel="stylesheet" href="main.css">
|
|
9
9
|
</head>
|
|
10
10
|
|
|
11
11
|
<body>
|
|
@@ -53,26 +53,38 @@
|
|
|
53
53
|
<!-- Content below the fixed menu -->
|
|
54
54
|
<main class="content">
|
|
55
55
|
|
|
56
|
-
<section class="
|
|
57
|
-
<
|
|
56
|
+
<section class="graph">
|
|
57
|
+
<svg height="300px" width="300px" xmlns="http://www.w3.org/2000/svg" viewbox="-100 -100 200 200" id="canvas">
|
|
58
|
+
|
|
59
|
+
<!-- Draw the paths -->
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
<path id="hull" d="M -45 10 Q 15 25 30 0 Q 15 -25 -45 -10 z" stroke="black" fill="none" stroke-width="1"
|
|
63
|
+
transform="rotate(-90), scale(1, 1)" />
|
|
64
|
+
|
|
65
|
+
<line id="mast" x1="0" y1="0" x2="1" y2="8" stroke="brown" stroke-width="2" transform="rotate(-90)" />
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
Sorry, your browser does not support inline SVG.
|
|
69
|
+
</svg>
|
|
58
70
|
</section>
|
|
59
71
|
|
|
60
72
|
|
|
61
|
-
<section class="
|
|
73
|
+
<section class=" data ">
|
|
62
74
|
<h2>Deltas</h2>
|
|
63
75
|
<div id="delta-container">
|
|
64
76
|
<!-- Speeds table will be populated here -->
|
|
65
77
|
</div>
|
|
66
78
|
</section>
|
|
67
79
|
|
|
68
|
-
<section class="
|
|
80
|
+
<section class="data ">
|
|
69
81
|
<h2>Vectors</h2>
|
|
70
82
|
<div id="speeds-container">
|
|
71
|
-
<!--
|
|
83
|
+
<!-- Vectors table will be populated here -->
|
|
72
84
|
</div>
|
|
73
85
|
</section>
|
|
74
86
|
|
|
75
|
-
<section class="
|
|
87
|
+
<section class="data ">
|
|
76
88
|
<h2>Attitude</h2>
|
|
77
89
|
<div id="attitude-container">
|
|
78
90
|
<!-- attitude table will be populated here -->
|
|
@@ -80,7 +92,7 @@
|
|
|
80
92
|
</section>
|
|
81
93
|
|
|
82
94
|
|
|
83
|
-
<section class="
|
|
95
|
+
<section class="data ">
|
|
84
96
|
<h2>Correction table</h2>
|
|
85
97
|
<div id="table-container">
|
|
86
98
|
<!-- Steps table will be populated here -->
|
|
@@ -88,12 +100,7 @@
|
|
|
88
100
|
|
|
89
101
|
</section>
|
|
90
102
|
|
|
91
|
-
|
|
92
|
-
<h2>Plugin options</h2>
|
|
93
|
-
<div id="options-content">
|
|
94
|
-
<!-- Options table will be populated here -->
|
|
95
|
-
</div>
|
|
96
|
-
</section>
|
|
103
|
+
|
|
97
104
|
</main>
|
|
98
105
|
|
|
99
106
|
|
|
@@ -102,6 +109,7 @@
|
|
|
102
109
|
|
|
103
110
|
|
|
104
111
|
<script type="module" src="app.js"></script>
|
|
112
|
+
<script type="module" src="vectors.js"></script>
|
|
105
113
|
</body>
|
|
106
114
|
|
|
107
115
|
</html>
|
package/public/main.css
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/* --- CSS Variables for Colors --- */
|
|
2
|
+
:root {
|
|
3
|
+
/* Data type colors */
|
|
4
|
+
--polar-color: #0d47a1; /* darker blue */
|
|
5
|
+
--delta-color: #1b5e20; /* darker green */
|
|
6
|
+
--attitude-color: #b28704; /* darker yellow/gold */
|
|
7
|
+
--table2d-color: #4e342e; /* darker brown */
|
|
8
|
+
|
|
9
|
+
/* Instance colors */
|
|
10
|
+
--heading-color: #000000; /* black */
|
|
11
|
+
--attitude-color-instance: #000000; /* black */
|
|
12
|
+
--current-color: #0d47a1; /* darker blue */
|
|
13
|
+
--currentDamped-color: #0d47a1; /* darker blue */
|
|
14
|
+
--boatSpeed-color: #388e3c; /* darker green */
|
|
15
|
+
--boatSpeedDamped-color: #388e3c; /* darker green */
|
|
16
|
+
--correctedBoatSpeed-color: #27632a; /* even darker green */
|
|
17
|
+
--boatSpeedRefGround-color: #00575b; /* darker teal */
|
|
18
|
+
--groundSpeed-color: #5d4037; /* darker brown */
|
|
19
|
+
--groundSpeedDamped-color: #5d4037; /* darker brown */
|
|
20
|
+
--speedCorrection-color: #ad1457; /* darker pink/red */
|
|
21
|
+
--residual-color: #6a1b9a; /* darker purple */
|
|
22
|
+
--correctionTable-color: #4e342e; /* darker brown */
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* --- Data Type Classes --- */
|
|
26
|
+
|
|
27
|
+
.data {
|
|
28
|
+
color: black;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* --- Instance IDs for Specific Colors --- */
|
|
32
|
+
#heading {
|
|
33
|
+
color: var(--heading-color);
|
|
34
|
+
stroke: var(--heading-color);
|
|
35
|
+
}
|
|
36
|
+
#attitude {
|
|
37
|
+
color: var(--attitude-color-instance);
|
|
38
|
+
stroke: var(--attitude-color-instance);
|
|
39
|
+
}
|
|
40
|
+
#current, #currentDamped {
|
|
41
|
+
color: var(--current-color);
|
|
42
|
+
stroke: var(--current-color);
|
|
43
|
+
}
|
|
44
|
+
#boatSpeed, #boatSpeedDamped {
|
|
45
|
+
color: var(--boatSpeed-color);
|
|
46
|
+
stroke: var(--boatSpeed-color);
|
|
47
|
+
}
|
|
48
|
+
#correctedBoatSpeed {
|
|
49
|
+
color: var(--correctedBoatSpeed-color);
|
|
50
|
+
stroke: var(--correctedBoatSpeed-color);
|
|
51
|
+
}
|
|
52
|
+
#boatSpeedRefGround {
|
|
53
|
+
color: var(--boatSpeedRefGround-color);
|
|
54
|
+
stroke: var(--boatSpeedRefGround-color);
|
|
55
|
+
}
|
|
56
|
+
#groundSpeed, #groundSpeedDamped {
|
|
57
|
+
color: var(--groundSpeed-color);
|
|
58
|
+
stroke: var(--groundSpeed-color);
|
|
59
|
+
}
|
|
60
|
+
#speedCorrection {
|
|
61
|
+
color: var(--speedCorrection-color);
|
|
62
|
+
stroke: var(--speedCorrection-color);
|
|
63
|
+
}
|
|
64
|
+
#residual {
|
|
65
|
+
color: var(--residual-color);
|
|
66
|
+
stroke: var(--residual-color);
|
|
67
|
+
}
|
|
68
|
+
#correctionTable {
|
|
69
|
+
color: var(--correctionTable-color);
|
|
70
|
+
stroke: var(--correctionTable-color);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* --- Table and Cell Styling --- */
|
|
74
|
+
table {
|
|
75
|
+
border-collapse: collapse;
|
|
76
|
+
}
|
|
77
|
+
th, td {
|
|
78
|
+
border: 1px solid black;
|
|
79
|
+
padding: 5px;
|
|
80
|
+
}
|
|
81
|
+
.TableCell {
|
|
82
|
+
width: 60px;
|
|
83
|
+
height: 60px;
|
|
84
|
+
text-align: center;
|
|
85
|
+
vertical-align: middle;
|
|
86
|
+
font-size: 11px;
|
|
87
|
+
}
|
|
88
|
+
.selectedCell {
|
|
89
|
+
color: #fff;
|
|
90
|
+
background-color: #1976d2;
|
|
91
|
+
}
|
|
92
|
+
.emptyCell {
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* --- SVG Styling --- */
|
|
96
|
+
svg {
|
|
97
|
+
border: 1px solid #ccc;
|
|
98
|
+
height: auto;
|
|
99
|
+
aspect-ratio: 1 / 1;
|
|
100
|
+
svg {
|
|
101
|
+
width: 100vmin;
|
|
102
|
+
height: 100vmin;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
line {
|
|
106
|
+
stroke-width: 2;
|
|
107
|
+
}
|
|
108
|
+
#hull, #mast {
|
|
109
|
+
stroke: purple;
|
|
110
|
+
stroke-width: 1;
|
|
111
|
+
stroke-linecap: round;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* --- Menu and Layout --- */
|
|
115
|
+
body {
|
|
116
|
+
font-family: Arial, sans-serif;
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
margin: 15px 15px 15px 15px;
|
|
120
|
+
}
|
|
121
|
+
.menu-bar {
|
|
122
|
+
position: fixed;
|
|
123
|
+
top: 0;
|
|
124
|
+
left: 0;
|
|
125
|
+
width: 100%;
|
|
126
|
+
background: #6a6a6a;
|
|
127
|
+
color: black;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
padding: 10px 20px;
|
|
131
|
+
gap: 20px;
|
|
132
|
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
|
|
133
|
+
z-index: 1000;
|
|
134
|
+
}
|
|
135
|
+
.menu-item {
|
|
136
|
+
display: flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
gap: 5px;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
}
|
|
141
|
+
.menu-item label {
|
|
142
|
+
font-size: 14px;
|
|
143
|
+
color: black;
|
|
144
|
+
}
|
|
145
|
+
.menu-item select {
|
|
146
|
+
background: transparent;
|
|
147
|
+
border: 1px solid #888;
|
|
148
|
+
color: black;
|
|
149
|
+
font-size: 14px;
|
|
150
|
+
appearance: none;
|
|
151
|
+
padding-right: 15px;
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
}
|
|
154
|
+
.menu-item select::-ms-expand {
|
|
155
|
+
display: none;
|
|
156
|
+
}
|
|
157
|
+
#toggle-updates {
|
|
158
|
+
background: transparent;
|
|
159
|
+
border: 1px solid #888;
|
|
160
|
+
padding: 5px 15px;
|
|
161
|
+
border-radius: 4px;
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
}
|
|
164
|
+
#toggle-updates:hover {
|
|
165
|
+
background: #555;
|
|
166
|
+
}
|
|
167
|
+
.content {
|
|
168
|
+
margin-top: 60px;
|
|
169
|
+
}
|
|
170
|
+
.surfacePlot {
|
|
171
|
+
width: 100%;
|
|
172
|
+
height: 100%;
|
|
173
|
+
border: 1px solid black;
|
|
174
|
+
padding: 0;
|
|
175
|
+
margin: 0;
|
|
176
|
+
position: relative;
|
|
177
|
+
}
|
package/public/vectors.html
CHANGED
package/public/vectors.js
CHANGED
|
@@ -12,34 +12,17 @@ function getHeading(data) {
|
|
|
12
12
|
return heading;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
function getOffset(att, height) {
|
|
16
|
-
let offset = { x: 0, y: 0 };
|
|
17
|
-
offset.x = Math.sin(att.pitch) * height * 7.5;
|
|
18
|
-
offset.y = Math.sin(att.roll) * height * 7.5;
|
|
19
|
-
return offset;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function getAtt(data) {
|
|
23
|
-
let att = { pitch: 0, roll: 0 };
|
|
24
|
-
data.deltas.forEach(delta => {
|
|
25
|
-
if (delta.id == "attitude") {
|
|
26
|
-
att.pitch = (delta.value.pitch);
|
|
27
|
-
att.roll = (delta.value.roll);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
return att;
|
|
31
|
-
}
|
|
32
15
|
|
|
33
16
|
function getLargest(data) {
|
|
34
17
|
let largest = 1;
|
|
35
18
|
data.polars.forEach(polar => {
|
|
36
|
-
|
|
37
|
-
|
|
19
|
+
largest = Math.max(largest, Math.abs(polar.x));
|
|
20
|
+
largest = Math.max(largest, Math.abs(polar.y));
|
|
38
21
|
});
|
|
39
22
|
return largest;
|
|
40
23
|
}
|
|
41
24
|
|
|
42
|
-
function drawBoat(canvas,
|
|
25
|
+
function drawBoat(canvas, heading) {
|
|
43
26
|
|
|
44
27
|
|
|
45
28
|
const hull = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
@@ -69,13 +52,14 @@ function drawBoat(canvas, data, heading, offset, att) {
|
|
|
69
52
|
function drawVectors(canvas, data, heading, scale) {
|
|
70
53
|
data.polars.forEach(polar => {
|
|
71
54
|
const vector = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
72
|
-
vector.setAttribute("x1", 0
|
|
73
|
-
vector.setAttribute("y1", 0
|
|
74
|
-
vector.setAttribute("x2", polar.
|
|
75
|
-
vector.setAttribute("y2", polar.
|
|
55
|
+
vector.setAttribute("x1", 0 );
|
|
56
|
+
vector.setAttribute("y1", 0 );
|
|
57
|
+
vector.setAttribute("x2", polar.x * scale );
|
|
58
|
+
vector.setAttribute("y2", polar.y * scale );
|
|
76
59
|
vector.setAttribute("id", polar.id);
|
|
77
|
-
|
|
78
|
-
|
|
60
|
+
let dash;
|
|
61
|
+
let s = scale * 5 / 1.94384 - 1;
|
|
62
|
+
if (s > 50) {
|
|
79
63
|
s = s / 5;
|
|
80
64
|
dash = `1 1 ${s - 1} 1 ${s} 1 ${s} 1 ${s} 1 ${s - 1} 1 `;
|
|
81
65
|
}
|
|
@@ -84,7 +68,7 @@ function drawVectors(canvas, data, heading, scale) {
|
|
|
84
68
|
}
|
|
85
69
|
vector.setAttribute("stroke-dasharray", dash);
|
|
86
70
|
vector.setAttribute("stroke-dashoffset", `1`);
|
|
87
|
-
if (polar.plane == "
|
|
71
|
+
if (polar.displayAttributes.plane == "Ground")
|
|
88
72
|
vector.setAttribute("transform", `rotate(${-90})`);
|
|
89
73
|
else
|
|
90
74
|
vector.setAttribute("transform", `rotate(${heading - 90})`);
|
|
@@ -99,29 +83,31 @@ async function fetchVectorData() {
|
|
|
99
83
|
const canvas = document.getElementById("canvas");
|
|
100
84
|
canvas.innerHTML = "";
|
|
101
85
|
|
|
102
|
-
heading = getHeading(data);
|
|
103
|
-
largest = getLargest(data);
|
|
104
|
-
|
|
105
|
-
|
|
86
|
+
const heading = getHeading(data);
|
|
87
|
+
const largest = getLargest(data);
|
|
88
|
+
let time, deltaT;
|
|
89
|
+
|
|
106
90
|
if (previous == 0) {
|
|
107
91
|
previous = largest;
|
|
108
92
|
lastTime = new Date();
|
|
109
93
|
}
|
|
110
94
|
else {
|
|
111
95
|
time = new Date();
|
|
112
|
-
deltaT = (time - lastTime);
|
|
113
|
-
if (largest
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
96
|
+
deltaT = (time - lastTime)/1000;
|
|
97
|
+
if (largest != previous) {
|
|
98
|
+
if (largest > previous) {
|
|
99
|
+
previous *= (1.005 );
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
previous *= (0.9995 );
|
|
103
|
+
}
|
|
104
|
+
}
|
|
119
105
|
}
|
|
120
106
|
|
|
121
|
-
scale =
|
|
107
|
+
const scale = 95 / previous;
|
|
122
108
|
|
|
123
|
-
drawBoat(canvas,
|
|
124
|
-
drawVectors(canvas, data, heading, scale
|
|
109
|
+
drawBoat(canvas, heading);
|
|
110
|
+
drawVectors(canvas, data, heading, scale);
|
|
125
111
|
}
|
|
126
112
|
|
|
127
113
|
async function getFromServer(endpoint) {
|
|
@@ -140,9 +126,7 @@ async function fetchVectorData() {
|
|
|
140
126
|
throw new Error(`Error fetching data: ${response.statusText}`);
|
|
141
127
|
}
|
|
142
128
|
}
|
|
143
|
-
|
|
144
|
-
document.getElementById("message").innerHTML = "";
|
|
145
|
-
}
|
|
129
|
+
|
|
146
130
|
|
|
147
131
|
const data = await response.json();
|
|
148
132
|
return data;
|
|
@@ -154,12 +138,8 @@ async function fetchVectorData() {
|
|
|
154
138
|
}
|
|
155
139
|
|
|
156
140
|
function handleError(error) {
|
|
157
|
-
|
|
158
|
-
<div>
|
|
159
|
-
<p>${error}</p>
|
|
160
|
-
</div>
|
|
161
|
-
`;
|
|
141
|
+
console.log('Error:', error.message);
|
|
162
142
|
}
|
|
163
143
|
|
|
164
144
|
|
|
165
|
-
setInterval(fetchVectorData,
|
|
145
|
+
setInterval(fetchVectorData, 1000);
|
package/public/style.css
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
font-family: Arial, sans-serif;
|
|
3
|
-
display: flex;
|
|
4
|
-
|
|
5
|
-
position: relative;
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
margin: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
section {
|
|
12
|
-
width: 100%;
|
|
13
|
-
padding: 10px;
|
|
14
|
-
box-sizing: border-box;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
svg {
|
|
19
|
-
border: 1px solid #ccc;
|
|
20
|
-
width: 50%;
|
|
21
|
-
height: auto;
|
|
22
|
-
aspect-ratio: 1 / 1;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.label {
|
|
26
|
-
font-size: 12px;
|
|
27
|
-
text-anchor: middle;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
table {
|
|
31
|
-
border-collapse: collapse;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/* .correctionTable {
|
|
35
|
-
|
|
36
|
-
} */
|
|
37
|
-
|
|
38
|
-
th,
|
|
39
|
-
td {
|
|
40
|
-
border: 1px solid black;
|
|
41
|
-
padding: 5px;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
th {
|
|
45
|
-
background-color: #a2a2a2;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* tr:nth-child(even) {
|
|
49
|
-
background-color: #f2f2f2;
|
|
50
|
-
} */
|
|
51
|
-
|
|
52
|
-
.TablecolumnHeader {
|
|
53
|
-
text-align: center;
|
|
54
|
-
background-color: #a2a2a2;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.TableRowHeader {
|
|
58
|
-
text-align: right;
|
|
59
|
-
background-color: #a2a2a2;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.TableCell {
|
|
63
|
-
width: 60px;
|
|
64
|
-
/* Adjust the size as needed */
|
|
65
|
-
height: 60px;
|
|
66
|
-
/* Same as width to make it square */
|
|
67
|
-
text-align: center;
|
|
68
|
-
vertical-align: middle;
|
|
69
|
-
font-size: 11px;
|
|
70
|
-
background-color:white;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.selectedCell {
|
|
74
|
-
background-color: #ff0000;
|
|
75
|
-
color: #fff;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.emptyCell {
|
|
79
|
-
background-color: #f2f2f2;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/* Fixed menu bar */
|
|
83
|
-
.menu-bar {
|
|
84
|
-
position: fixed;
|
|
85
|
-
top: 0;
|
|
86
|
-
left: 0;
|
|
87
|
-
width: 100%;
|
|
88
|
-
background: #6a6a6a;
|
|
89
|
-
color: black;
|
|
90
|
-
display: flex;
|
|
91
|
-
align-items: center;
|
|
92
|
-
padding: 10px 20px;
|
|
93
|
-
gap: 20px;
|
|
94
|
-
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
|
|
95
|
-
z-index: 1000;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/* Menu items */
|
|
99
|
-
.menu-item {
|
|
100
|
-
display: flex;
|
|
101
|
-
align-items: center;
|
|
102
|
-
gap: 5px;
|
|
103
|
-
cursor: pointer;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/* Labels */
|
|
107
|
-
.menu-item label {
|
|
108
|
-
font-size: 14px;
|
|
109
|
-
color: black;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/* Dropdowns styled as text with dropdown arrow */
|
|
113
|
-
.menu-item select {
|
|
114
|
-
background: transparent;
|
|
115
|
-
border: none;
|
|
116
|
-
border: 1px solid #888;
|
|
117
|
-
color: black;
|
|
118
|
-
font-size: 14px;
|
|
119
|
-
appearance: none;
|
|
120
|
-
padding-right: 15px;
|
|
121
|
-
cursor: pointer;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/* Custom dropdown styling */
|
|
125
|
-
.menu-item select::-ms-expand {
|
|
126
|
-
display: none;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
/* Pause Button */
|
|
131
|
-
#toggle-updates {
|
|
132
|
-
background: transparent;
|
|
133
|
-
border: 1px solid #888;
|
|
134
|
-
padding: 5px 15px;
|
|
135
|
-
border-radius: 4px;
|
|
136
|
-
cursor: pointer;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
#toggle-updates:hover {
|
|
140
|
-
background: #555;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/* Push content below fixed menu */
|
|
144
|
-
.content {
|
|
145
|
-
margin-top: 60px;
|
|
146
|
-
: 20px;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.boatSpeed {
|
|
150
|
-
background-color: lightseagreen;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.correction {
|
|
154
|
-
background-color: red;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.correctedSpeed {
|
|
158
|
-
background-color: seagreen;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.residual {
|
|
162
|
-
background-color: rgb(250, 140, 158);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.current {
|
|
166
|
-
background-color: rgb(52, 52, 255);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
.groundSpeed {
|
|
171
|
-
background-color: brown;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.surfacePlot {
|
|
175
|
-
width: 100%;
|
|
176
|
-
|
|
177
|
-
height: 100%;
|
|
178
|
-
border: 1px solid black;
|
|
179
|
-
/* Keep the border for recognition */
|
|
180
|
-
padding: 0;
|
|
181
|
-
margin: 0;
|
|
182
|
-
position: relative;
|
|
183
|
-
/* Ensure it can be positioned correctly */
|
|
184
|
-
}
|