SatDump 2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
punctiform_product.h
Go to the documentation of this file.
1#pragma once
2
6
7#include "common/geodetic/json.h"
8#include "core/exception.h"
9#include "product.h"
10
11namespace satdump
12{
13 namespace products
14 {
18 class PunctiformProduct : public Product
19 {
20 public:
25 {
26 // TODOREWORK int abs_index = -1;
27 std::string channel_name;
28 std::vector<double> timestamps;
29 std::vector<geodetic::geodetic_coords_t> positions;
30 std::vector<double> data;
31
32 // std::string calibration_type = ""; /* TODOREWORK */
33 NLOHMANN_DEFINE_TYPE_INTRUSIVE(DataHolder, /*abs_index,*/ channel_name, timestamps, positions, data)
34 };
35
36 std::vector<DataHolder> data;
37
38 public:
39 // TODOREWORK
40 void set_tle(nlohmann::json tle) { contents["tle"] = tle; }
41
42 bool has_tle() { return contents.contains("tle"); }
43
44 nlohmann::json get_tle() { return contents["tle"]; }
45
46 private:
47 void *satellite_tracker = nullptr;
48
49 public:
50 // TODOREWORK
51 geodetic::geodetic_coords_t get_sample_position(int ch_index, int sample_index);
52
53 int getChannelIndexByName(std::string name)
54 {
55 for (int i = 0; i < data.size(); i++)
56 if (data[i].channel_name == name)
57 return i;
58 throw satdump_exception("Invalid channel for punctiform product : " + name);
59 }
60
61 DataHolder &getChannelByName(std::string name)
62 {
63 for (auto &d : data)
64 if (d.channel_name == name)
65 return d;
66 throw satdump_exception("Invalid channel for punctiform product : " + name);
67 }
68
69 public:
70 // TODOREWORK
71
72 public:
73 virtual void save(std::string directory);
74 virtual void load(std::string file);
75
76 PunctiformProduct() { type = "punctiform"; }
77 virtual ~PunctiformProduct();
78 };
79 } // namespace products
80} // namespace satdump
virtual void load(std::string file)
Load the product. This should refer to the product.cbor file.
Definition punctiform_product.cpp:17
virtual void save(std::string directory)
Save the product. Depending on the type this will save a product.cbor and other files in the same dir...
Definition punctiform_product.cpp:10
Core Product implementation.
TODOREWORK.
Definition punctiform_product.h:25