Visual Vibration Tracking 0.2
Загрузка...
Поиск...
Не найдено
output_to_csv.cpp
1#include "VVT-V2/output_to_csv.h"
2
3OutputToCsv::OutputToCsv(std::string output_file_name, std::vector<Point2f>& point_coordinates, std::vector<double>& point_time_coordinates, int point_id) :
4 output_file_name_{ output_file_name },
5 coordinates_{ &point_coordinates },
6 time_coordinates_{ &point_time_coordinates },
7 point_id_{ point_id }
8{
9}
10
12{
13 std::ofstream file;
14 file.open(output_file_name_, std::fstream::app);
15
16 // Запишем ID точки
17 file << "Point " + std::to_string(point_id_) + "\n";
18
19 // Запишем временные позиции точки
20 file << "Time pos;";
21 for (int i = 0; i < time_coordinates_->size(); i++)
22 {
23 file << std::to_string(time_coordinates_->at(i)) + ";";
24 }
25 file << "\n";
26
27 // Запишем координаты
28 // Сначала по X
29 file << "X pos; ";
30 for (int i = 0; i < coordinates_->size(); i++)
31 {
32 file << std::to_string(coordinates_->at(i).x) + ";";
33 }
34 file << "\n";
35
36 // Затем по Y
37 file << "Y pos; ";
38 for (int i = 0; i < coordinates_->size(); i++)
39 {
40 file << std::to_string(coordinates_->at(i).y) + ";";
41 }
42 file << "\n";
43
44 file.close();
45
46}
int point_id_
ID точки
Definition: output_to_csv.h:50
std::string output_file_name_
Имя (путь) файла, в который будет производиться запись
Definition: output_to_csv.h:38
OutputToCsv(std::string output_file_name, std::vector< Point2f > &point_coordinates, std::vector< double > &point_time_coordinates, int point_id)
Конструктор этого класса
std::vector< Point2f > * coordinates_
Контейнер для пространственных координат (позиций на экране) точки
Definition: output_to_csv.h:42
std::vector< double > * time_coordinates_
Контейнер для временных координат (позиций на экране) точки
Definition: output_to_csv.h:46
void Write()
Добавляет данные для записи