15 int projections_image_width = 2048;
16 int projections_image_height = 1024;
18 int projections_mode_radio = 0;
20 bool projection_auto_mode =
false, projection_auto_scale_mode =
false;
21 double projection_autoscale_x = 0.016, projection_autoscale_y = 0.016;
23 int projections_current_selected_proj = 0;
25 float projections_equirectangular_tl_lon = -180;
26 float projections_equirectangular_tl_lat = 90;
27 float projections_equirectangular_br_lon = 180;
28 float projections_equirectangular_br_lat = -90;
30 float projections_utm_center_lon = 0;
31 float projections_utm_offset_y = 0;
32 float projections_utm_scale = 2400;
33 int projections_utm_zone = 30;
34 bool projections_utm_south =
false;
36 float projections_stereo_center_lon = 0;
37 float projections_stereo_center_lat = 0;
38 float projections_stereo_scale = 2400;
40 float projections_tpers_lon = 0;
41 float projections_tpers_lat = 0;
42 float projections_tpers_alt = 30000000;
43 float projections_tpers_ang = 0;
44 float projections_tpers_azi = 0;
45 float projections_tpers_scale = 8000;
47 float projections_azeq_lon = 0;
48 float projections_azeq_lat = 90;
50 NLOHMANN_DEFINE_TYPE_INTRUSIVE(
ProjectionConfigUI, projections_image_width, projections_image_height, projections_mode_radio, projection_auto_mode, projection_auto_scale_mode,
51 projection_autoscale_x, projection_autoscale_y, projections_current_selected_proj, projections_equirectangular_tl_lon, projections_equirectangular_tl_lat,
52 projections_equirectangular_br_lon, projections_equirectangular_br_lat, projections_utm_center_lon, projections_utm_offset_y, projections_utm_scale,
53 projections_utm_zone, projections_utm_south, projections_stereo_center_lon, projections_stereo_center_lat, projections_stereo_scale, projections_tpers_lon,
54 projections_tpers_lat, projections_tpers_alt, projections_tpers_ang, projections_tpers_azi, projections_tpers_scale, projections_azeq_lon,
55 projections_azeq_lat);
58 nlohmann::json get_proj()
62 if (projections_current_selected_proj == 0)
64 cfg[
"type"] =
"equirec";
65 cfg[
"offset_x"] = projections_equirectangular_tl_lon;
66 cfg[
"offset_y"] = projections_equirectangular_tl_lat;
67 cfg[
"scalar_x"] = (projections_equirectangular_br_lon - projections_equirectangular_tl_lon) /
double(projections_image_width);
68 cfg[
"scalar_y"] = (projections_equirectangular_br_lat - projections_equirectangular_tl_lat) /
double(projections_image_height);
70 else if (projections_current_selected_proj == 1)
73 cfg[
"scale"] = projections_utm_scale;
74 cfg[
"zone"] = projections_utm_zone;
75 cfg[
"south"] = projections_utm_south;
76 cfg[
"offset_y"] = projections_utm_offset_y;
78 else if (projections_current_selected_proj == 2)
80 cfg[
"type"] =
"stereo";
81 cfg[
"center_lon"] = projections_stereo_center_lon;
82 cfg[
"center_lat"] = projections_stereo_center_lat;
83 cfg[
"scale"] = projections_stereo_scale;
84 cfg[
"width"] = projections_image_width;
85 cfg[
"height"] = projections_image_height;
87 else if (projections_current_selected_proj == 3)
89 cfg[
"type"] =
"tpers";
90 cfg[
"center_lon"] = projections_tpers_lon;
91 cfg[
"center_lat"] = projections_tpers_lat;
92 cfg[
"altitude"] = projections_tpers_alt;
93 cfg[
"tilt"] = projections_tpers_ang;
94 cfg[
"azimuth"] = projections_tpers_azi;
95 cfg[
"scale"] = projections_tpers_scale;
96 cfg[
"width"] = projections_image_width;
97 cfg[
"height"] = projections_image_height;
107 if (projection_auto_scale_mode)
109 cfg[
"scale_x"] = projection_autoscale_x;
110 cfg[
"scale_y"] = projection_autoscale_y;
114 cfg[
"width"] = projections_image_width;
115 cfg[
"height"] = projections_image_height;
123 ImGui::Text(
"Output image : ");
124 ImGui::SetNextItemWidth(ImGui::GetWindowWidth() * 0.40f);
125 ImGui::InputInt(
"##width", &projections_image_width, 0);
127 ImGui::Text(u8
"\uea76");
129 ImGui::SetNextItemWidth(ImGui::GetWindowWidth() * 0.40f);
130 ImGui::InputInt(
"##height", &projections_image_height, 0);
136 ImGui::SetNextItemWidth(ImGui::GetWindowWidth() * 0.96f);
137 ImGui::Combo(
"##targetproj", &projections_current_selected_proj,
141 "Satellite (TPERS)\0"
145 if (projections_current_selected_proj == 0)
147 if (!projection_auto_mode)
149 ImGui::Text(
"Top Left Coordinates :");
150 ImGui::InputFloat(
"Lat##tl", &projections_equirectangular_tl_lat);
151 ImGui::InputFloat(
"Lon##tl", &projections_equirectangular_tl_lon);
153 ImGui::Text(
"Bottom Right Coordinates :");
154 ImGui::InputFloat(
"Lat##br", &projections_equirectangular_br_lat);
155 ImGui::InputFloat(
"Lon##br", &projections_equirectangular_br_lon);
158 else if (projections_current_selected_proj == 1)
160 ImGui::InputInt(
"UTM Zone###projutmzone", &projections_utm_zone);
161 if (projections_utm_zone > 60)
162 projections_utm_zone = 60;
163 if (projections_utm_zone < 1)
164 projections_utm_zone = 1;
165 ImGui::Checkbox(
"South###projutmsouth", &projections_utm_south);
166 ImGui::InputFloat(
"Northing (m)##utm", &projections_utm_offset_y);
168 ImGui::InputFloat(
"Scale (m/px)##utm", &projections_utm_scale);
170 else if (projections_current_selected_proj == 2)
172 ImGui::Text(
"Center Coordinates :");
173 ImGui::InputFloat(
"Lat##stereo", &projections_stereo_center_lat);
174 ImGui::InputFloat(
"Lon##stereo", &projections_stereo_center_lon);
176 ImGui::InputFloat(
"Scale (m/px)##stereo", &projections_stereo_scale);
178 else if (projections_current_selected_proj == 3)
180 ImGui::Text(
"Center Coordinates :");
181 ImGui::InputFloat(
"Lat##tpers", &projections_tpers_lat);
182 ImGui::InputFloat(
"Lon##tpers", &projections_tpers_lon);
184 ImGui::InputFloat(
"Altitude (m)##tpers", &projections_tpers_alt);
185 ImGui::InputFloat(
"Angle##tpers", &projections_tpers_ang);
186 ImGui::InputFloat(
"Azimuth##tpers", &projections_tpers_azi);
188 ImGui::InputFloat(
"Scale##tpers", &projections_tpers_scale);
191 if (projections_current_selected_proj == 0 || projections_current_selected_proj == 2)
193 ImGui::Checkbox(
"Auto Mode###pojautomode", &projection_auto_mode);
194 ImGui::Checkbox(
"Auto Scale Mode##projautoscalemode", &projection_auto_scale_mode);
195 if (projection_auto_scale_mode)
197 ImGui::InputDouble(
"Scale X (m/px)##projscalexauto", &projection_autoscale_x);
198 ImGui::InputDouble(
"Scale Y (m/px)##projscalexauto", &projection_autoscale_y);