| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/// @file |
| 2 |
|
|
/// @brief The JSON fields of bodies and bases. |
| 3 |
|
|
#pragma once |
| 4 |
|
|
|
| 5 |
|
|
#include "terraingen/config/config.h" |
| 6 |
|
|
#include "terraingen/config/fields/common.h" |
| 7 |
|
|
|
| 8 |
|
|
#include <string_view> |
| 9 |
|
|
|
| 10 |
|
|
namespace terraingen::config { |
| 11 |
|
|
|
| 12 |
|
|
template <> struct SpecName<PlaneSurfaceSpec> { |
| 13 |
|
|
static constexpr std::string_view kName = "plane"; |
| 14 |
|
|
static constexpr std::string_view kDescription = |
| 15 |
|
|
"A flat projected frame in metres, for local sites."; |
| 16 |
|
|
}; |
| 17 |
|
138 |
template <typename IO> void Fields(IO& /*io*/, PlaneSurfaceSpec& /*spec*/) {} |
| 18 |
|
|
|
| 19 |
|
|
template <> struct SpecName<SphereSurfaceSpec> { |
| 20 |
|
|
static constexpr std::string_view kName = "sphere"; |
| 21 |
|
|
static constexpr std::string_view kDescription = |
| 22 |
|
|
"A whole body such as a planet or moon: positions in longitude and latitude (degrees) and " |
| 23 |
|
|
"features generated over the whole body."; |
| 24 |
|
|
}; |
| 25 |
|
47 |
template <typename IO> void Fields(IO& io, SphereSurfaceSpec& spec) { |
| 26 |
3/3
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::SphereSurfaceSpec&):
✓ Branch 4 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::SphereSurfaceSpec&):
✓ Branch 4 taken 17 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::SphereSurfaceSpec&):
✓ Branch 4 taken 21 times.
|
47 |
io("radius", spec.radius, "Radius of the body's datum sphere, in metres; required.", "m", |
| 27 |
|
47 |
Above(0.0)); |
| 28 |
|
47 |
} |
| 29 |
|
|
|
| 30 |
|
|
template <> struct SpecName<EllipsoidSurfaceSpec> { |
| 31 |
|
|
static constexpr std::string_view kName = "ellipsoid"; |
| 32 |
|
|
static constexpr std::string_view kDescription = |
| 33 |
|
|
"A whole body shaped as a triaxial ellipsoid, such as an elongated moon or asteroid: " |
| 34 |
|
|
"planetocentric longitude and latitude (degrees), heights along the direction from the " |
| 35 |
|
|
"centre, and features generated over the whole body."; |
| 36 |
|
|
}; |
| 37 |
|
31 |
template <typename IO> void Fields(IO& io, EllipsoidSurfaceSpec& spec) { |
| 38 |
3/3
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::EllipsoidSurfaceSpec&):
✓ Branch 4 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::EllipsoidSurfaceSpec&):
✓ Branch 4 taken 4 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::EllipsoidSurfaceSpec&):
✓ Branch 4 taken 18 times.
|
31 |
io("radii", spec.radii, |
| 39 |
|
|
"Semi-axes a, b and c of the datum ellipsoid in metres, along x (longitude 0), y " |
| 40 |
|
|
"(longitude 90) and z (the north pole); exactly three, each positive.", |
| 41 |
|
31 |
"m", Above(0.0)); |
| 42 |
|
31 |
} |
| 43 |
|
|
|
| 44 |
|
|
template <> struct SpecName<ShapeModelSurfaceSpec> { |
| 45 |
|
|
static constexpr std::string_view kName = "shape_model"; |
| 46 |
|
|
static constexpr std::string_view kDescription = |
| 47 |
|
|
"A whole star-shaped body such as an asteroid, from a shape model: planetocentric " |
| 48 |
|
|
"longitude and latitude (degrees), heights along the direction from the centre, and " |
| 49 |
|
|
"features generated over the whole body. The model is resampled along rays from its " |
| 50 |
|
|
"origin, keeping the outermost surface where a ray crosses it more than once."; |
| 51 |
|
|
}; |
| 52 |
|
30 |
template <typename IO> void Fields(IO& io, ShapeModelSurfaceSpec& spec) { |
| 53 |
6/6
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::ShapeModelSurfaceSpec&):
✓ Branch 2 taken 9 times.
✓ Branch 7 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::ShapeModelSurfaceSpec&):
✓ Branch 2 taken 3 times.
✓ Branch 7 taken 3 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::ShapeModelSurfaceSpec&):
✓ Branch 2 taken 18 times.
✓ Branch 7 taken 18 times.
|
60 |
io("path", spec.path, |
| 54 |
|
30 |
InputPathHelp("Shape model in body-fixed coordinates around its origin: a Gaskell ICQ " |
| 55 |
|
|
"model (.icq) or a closed mesh (.obj, .gltf, .glb or .stl)")); |
| 56 |
3/3
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::ShapeModelSurfaceSpec&):
✓ Branch 4 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::ShapeModelSurfaceSpec&):
✓ Branch 4 taken 3 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::ShapeModelSurfaceSpec&):
✓ Branch 4 taken 18 times.
|
30 |
io("q", spec.q, |
| 57 |
|
|
"Intervals per cube face edge of the radial grid the model is resampled on, 1 to 4096; " |
| 58 |
|
|
"unset keeps an ICQ model's own Q and uses 256 for a mesh.", |
| 59 |
|
30 |
"", Between(1.0, 4096.0)); |
| 60 |
3/3
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::ShapeModelSurfaceSpec&):
✓ Branch 4 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::ShapeModelSurfaceSpec&):
✓ Branch 4 taken 3 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::ShapeModelSurfaceSpec&):
✓ Branch 4 taken 18 times.
|
30 |
io("metres_per_unit", spec.metresPerUnit, |
| 61 |
|
|
"Metres per unit of the file's coordinates; unset is 1000 for an ICQ model, whose " |
| 62 |
|
|
"coordinates are kilometres, and 1 for a mesh.", |
| 63 |
|
30 |
"m", Above(0.0)); |
| 64 |
|
30 |
} |
| 65 |
|
|
|
| 66 |
|
|
template <> struct SpecName<RasterSourceSpec> { |
| 67 |
|
|
static constexpr std::string_view kName = "raster"; |
| 68 |
|
|
static constexpr std::string_view kDescription = |
| 69 |
|
|
"A heightmap read from a GeoTIFF in its own projected coordinates, optionally resampled, " |
| 70 |
|
|
"to add relief to a real DEM."; |
| 71 |
|
|
}; |
| 72 |
|
64 |
template <typename IO> void Fields(IO& io, RasterSourceSpec& source) { |
| 73 |
6/6
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::RasterSourceSpec&):
✓ Branch 3 taken 9 times.
✓ Branch 8 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::RasterSourceSpec&):
✓ Branch 3 taken 13 times.
✓ Branch 8 taken 13 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::RasterSourceSpec&):
✓ Branch 3 taken 42 times.
✓ Branch 8 taken 42 times.
|
64 |
io("path", source.path, InputPathHelp("GeoTIFF to read the heights from")); |
| 74 |
|
64 |
GeoTiffSourceOptions& read = source.read; |
| 75 |
3/3
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 13 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 42 times.
|
64 |
io("band", read.band, "Band of the file to read, counting from 0."); |
| 76 |
3/3
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 13 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 42 times.
|
64 |
io("pixel_size", read.pixelSize, |
| 77 |
|
|
"Cell size in metres to resample the raster to over the same extent, as when upscaling a " |
| 78 |
|
|
"DEM. Unset keeps the file's.", |
| 79 |
|
64 |
"m", Above(0.0)); |
| 80 |
3/3
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 12 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 42 times.
|
64 |
io("resampling", read.resampling, "Interpolation used when resampling to the cell size."); |
| 81 |
3/3
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 12 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 42 times.
|
63 |
io("scale", read.scale, |
| 82 |
|
|
"Factor each sample is multiplied by, replacing the band's scale from the file's GDAL " |
| 83 |
|
|
"metadata. Unset keeps the file's."); |
| 84 |
3/3
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 12 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 42 times.
|
63 |
io("offset", read.offset, |
| 85 |
|
|
"Added to each scaled sample, replacing the band's offset from the file's GDAL metadata. " |
| 86 |
|
|
"Unset keeps the file's.", |
| 87 |
|
|
"m"); |
| 88 |
3/3
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 12 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::RasterSourceSpec&):
✓ Branch 4 taken 42 times.
|
63 |
io("low_pass", read.lowPass, |
| 89 |
|
|
"Standard deviation in metres of a Gaussian low-pass applied to the file's heights before " |
| 90 |
|
|
"any resampling, keeping a DEM's low frequencies for synthetic detail to be added to; a " |
| 91 |
|
|
"dem_detail layer can add the removed detail back. 0 keeps every frequency.", |
| 92 |
|
63 |
"m", AtLeast(0.0)); |
| 93 |
|
63 |
} |
| 94 |
|
|
|
| 95 |
|
|
template <> struct SpecName<ChainSourceSpec> { |
| 96 |
|
|
static constexpr std::string_view kName = "chain"; |
| 97 |
|
|
static constexpr std::string_view kDescription = |
| 98 |
|
|
"Several bases tried in order, each filling where those before it have no data; its grid " |
| 99 |
|
|
"is the first one's."; |
| 100 |
|
|
}; |
| 101 |
|
31 |
template <typename IO> void Fields(IO& io, ChainSourceSpec& source) { |
| 102 |
3/3
void terraingen::config::Fields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::ChainSourceSpec&):
✓ Branch 4 taken 9 times.
void terraingen::config::Fields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::ChainSourceSpec&):
✓ Branch 4 taken 3 times.
void terraingen::config::Fields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::ChainSourceSpec&):
✓ Branch 4 taken 19 times.
|
31 |
io("sources", source.sources, |
| 103 |
|
|
"Bases tried in order, each filling where those before it have no data; the chain's grid " |
| 104 |
|
|
"is the first one's."); |
| 105 |
|
31 |
} |
| 106 |
|
|
|
| 107 |
|
|
} // namespace terraingen::config |
| 108 |
|
|
|