-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicsDataCollection.cs
More file actions
78 lines (64 loc) · 1.96 KB
/
DynamicsDataCollection.cs
File metadata and controls
78 lines (64 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using ReadWriteCsv;
public class DynamicsDataCollection{
public List<SerializedDynamicsData> dataCollection = new List<SerializedDynamicsData>();
public List<CsvRow> rows = new List<CsvRow>();
public CsvRow header = new CsvRow();
public DynamicsDataCollection(){
header.Add("x-coordinate");
header.Add("y-coordinate");
header.Add("z-coordinate");
header.Add("Heading");
header.Add ("Bank");
header.Add ("Pitch");
header.Add ("Speed");
header.Add ("Altitude");
header.Add ("Aircraft Type");
header.Add ("Score");
header.Add ("CameraRig x-rotation");
header.Add ("CameraRig y-rotation");
header.Add ("CameraRig z-rotation");
header.Add ("Closest Point x-coordinate");
header.Add("Closest Point y-coordinate");
header.Add("Closest Point z-coordinate");
header.Add("Bearing Horizontal");
header.Add("Bearing Vertical");
header.Add("Aspect Horizontal");
header.Add("Aspect Vertical");
header.Add("Target Aircraft x-coordinate");
header.Add("Target Aircraft y-coordinate");
header.Add("Target Aircraft z-coordinate");
header.Add("Target Aircraft Heading");
header.Add("Target Aircraft Bank");
header.Add("Target Aircraft Pitch");
header.Add("Target Aircraft Speed");
header.Add("Target Aircraft Altitude");
header.Add ("Target Aircraft Type");
header.Add ("Airspace Violated");
rows.Add(header);
}
public int getSize(){
return dataCollection.Count;
}
public void addDataRow(CsvRow row, SerializedDynamicsData data){
rows.Add (row);
dataCollection.Add (data);
}
public SerializedDynamicsData getData(int aircraftIndex){
if (aircraftIndex < 0 || aircraftIndex >= dataCollection.Count)
return null;
return dataCollection[aircraftIndex];
}
public void writeToFile(string fileName){
using (CsvFileWriter writer = new CsvFileWriter(fileName))
{
foreach (CsvRow row in rows)
{
writer.WriteRow(row);
}
}
}
}