-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodes.hpp
146 lines (128 loc) · 5.14 KB
/
nodes.hpp
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// This file is part of gfp-las
// Copyright (C) 2018-2022 Ravi Peters
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <geoflow/geoflow.hpp>
namespace geoflow::nodes::las {
class LASLoaderNode:public Node {
std::string filepath = "";
int thin_nth=5;
int filter_class = 6;
bool do_class_filter = true;
std::string wkt_="";
public:
using Node::Node;
void init() {
add_output("points", typeid(PointCollection));
add_output("classification", typeid(vec1i));
add_output("intensity", typeid(vec1f));
add_output("order", typeid(vec1f));
add_output("colors", typeid(vec3f));
add_param(ParamPath(filepath, "filepath", "File path"));
add_param(ParamBoundedInt(thin_nth, 0, 100, "thin_nth", "Thin factor"));
add_param(ParamBoundedInt(filter_class, 0, 100, "filter_class", "Filter class"));
add_param(ParamBool(do_class_filter, "do_filter", "Do class filter"));
add_param(ParamString(wkt_, "wkt", "Override CRS"));
}
void process();
};
class LASVecLoaderNode:public Node {
std::string filepaths = "";
int thin_nth=5;
int filter_class = 6;
bool do_class_filter = true;
bool merge_output = false;
public:
using Node::Node;
void init() {
add_vector_output("point_clouds", typeid(PointCollection));
add_param(ParamPath(filepaths, "las_filepaths", "Folder with LAS files, OR a space separated list of LAS files"));
add_param(ParamBoundedInt(thin_nth, 0, 100, "thin_nth", "Thin factor"));
add_param(ParamBoundedInt(filter_class, 0, 100, "filter_class", "Filter class"));
add_param(ParamBool(do_class_filter, "do_filter", "Do class filter"));
add_param(ParamBool(merge_output, "merge_output", "Merge the input files into a single output. If true, the output vector will have only a single element which is the merged point cloud."));
}
void process();
};
class LASWriterNode:public Node {
std::string filepath = "";
std::string output_crs = "";
public:
using Node::Node;
void init() {
add_input("point_clouds", {typeid(PointCollection)});
// add_output("classification", typeid(vec1i));
// add_output("intensity", typeid(vec1f));
// add_poly_input("attributes", {typeid(bool), typeid(int), typeid(float), typeid(std::string), typeid(Date), typeid(Time), typeid(DateTime)});
add_param(ParamPath(filepath, "filepath", "File path"));
add_param(ParamString(output_crs, "output_crs", "Output CRS"));
}
void process();
bool parameters_valid() override {
if (manager.substitute_globals(filepath).empty())
return false;
else
return true;
}
};
class LASVecWriterNode:public Node {
std::string filepath = "";
std::string output_crs = "";
public:
using Node::Node;
void init() {
add_vector_input("point_clouds", {typeid(PointCollection)});
// add_output("classification", typeid(vec1i));
// add_output("intensity", typeid(vec1f));
add_param(ParamPath(filepath, "filepath", "File path with stem"));
add_param(ParamString(output_crs, "output_crs", "Output CRS"));
}
void process();
bool parameters_valid() override {
if (manager.substitute_globals(filepath).empty())
return false;
else
return true;
}
};
class PointCloudClassSplitNode:public Node {
int class_A_ = 2;
int class_B_ = 6;
int class_C_ = 0;
int class_D_ = 1;
public:
using Node::Node;
void init() {
add_input("point_cloud", {typeid(PointCollection)});
add_output("A", typeid(PointCollection));
add_output("B", typeid(PointCollection));
add_output("C", typeid(PointCollection));
add_output("D", typeid(PointCollection));
// add_output("intensity", typeid(vec1f));
add_param(ParamInt(class_A_, "class A", "Classification code for output A"));
add_param(ParamInt(class_B_, "class B", "Classification code for output A"));
add_param(ParamInt(class_C_, "class C", "Classification code for output A"));
add_param(ParamInt(class_D_, "class D", "Classification code for output A"));
}
void process();
};
// class PointCloudStatsCalcNode:public Node {
// float percentile_=0.05;
// public:
// using Node::Node;
// void init() {
// add_input("point_cloud", {typeid(PointCollection)});
// add_output("percentile_z", typeid(float));
// add_param(ParamBoundedFloat(ground_percentile, 0, 1, "ground_percentile", "Ground elevation percentile"));
// }
// void process();
// };
}