Terrain-adaptive Steiner point selector from a DTM raster.
More...
#include <dtmthinner.h>
|
| | DTMThinner () |
| |
| | ~DTMThinner () |
| |
| | DTMThinner (const DTMThinner &)=delete |
| |
| DTMThinner & | operator= (const DTMThinner &)=delete |
| |
| bool | open (const QString &filePath, int band=1) |
| |
| void | close () |
| |
| bool | isOpen () const noexcept |
| |
| QVector< QPointF > | generatePoints (const MapExtent &domain, const DTMThinnerOptions &opts={}, QVector< double > *outZ=nullptr, const DTMProgressFn &progress={}, const DTMThinnerLimits &limits={}) const |
| | Generate terrain-significant sample points within domain.
|
| |
| double | pixelSize () const |
| |
| QString | crsWkt () const |
| |
| QString | errorMsg () const |
| |
| double | sampleAt (double x, double y) const |
| | Sample the DTM at a single map-CRS coordinate. Returns NaN when out-of-bounds or NoData.
|
| |
| void | sampleMany (const QVector< QPointF > &xy, QVector< double > *outZ, qint64 maxBufBytes=kMaxReadBufBytesDefault) const |
| | Batch bilinear sampling at many DTM-CRS coordinates.
|
| |
| void | readPixels (const MapExtent &bbox, QVector< QPointF > &xyOut, QVector< double > &zOut) const |
| | Read every valid raster pixel whose centre falls within bbox.
|
| |
Terrain-adaptive Steiner point selector from a DTM raster.
Usage:
QVector<double> z;
if (thinner.
open(dtmPath)) {
for (
int i = 0;
i <
pts.size(); ++
i) {
gen.addSteinerPoint(sp);
}
}
Terrain-adaptive Steiner point selector from a DTM raster.
Definition dtmthinner.h:132
bool open(const QString &filePath, int band=1)
Definition dtmthinner.cpp:319
QVector< QPointF > generatePoints(const MapExtent &domain, const DTMThinnerOptions &opts={}, QVector< double > *outZ=nullptr, const DTMProgressFn &progress={}, const DTMThinnerLimits &limits={}) const
Generate terrain-significant sample points within domain.
Definition dtmthinner.cpp:693
size_t i
Definition contourjob.cpp:27
QVector< QPointF > pts
Definition meshpatch.cpp:62
A point that must appear as a vertex in the output mesh.
Definition meshgenerator.h:46
bool hasZ
If true, z is exact — skip DTM re-sampling in post-mesh step.
Definition meshgenerator.h:51
QPointF xy
Definition meshgenerator.h:47
double z
Pre-sampled elevation when hasZ is true (e.g. from DTM thinner).
Definition meshgenerator.h:50
◆ DTMThinner() [1/2]
| mesh::DTMThinner::DTMThinner |
( |
| ) |
|
◆ ~DTMThinner()
| mesh::DTMThinner::~DTMThinner |
( |
| ) |
|
◆ DTMThinner() [2/2]
| mesh::DTMThinner::DTMThinner |
( |
const DTMThinner & |
| ) |
|
|
delete |
◆ close()
| void mesh::DTMThinner::close |
( |
| ) |
|
◆ crsWkt()
| QString mesh::DTMThinner::crsWkt |
( |
| ) |
const |
◆ errorMsg()
| QString mesh::DTMThinner::errorMsg |
( |
| ) |
const |
|
inline |
◆ generatePoints()
Generate terrain-significant sample points within domain.
Grids that exceed limits.maxGridBytes are processed in row bands with a halo (see file header "Scaling notes") — output is bit-identical to the untiled run for pass counts ≤ kMaxThinningHalo.
- Parameters
-
| domain | Meshing extent (same CRS as the DTM raster). |
| opts | Thinning parameters. |
| outZ | If non-null, filled with the exact DEM elevation for each returned point (parallel array). These values should be used directly — do NOT re-sample them from the DTM later. |
| progress | Optional progress/cancel callback (see DTMProgressFn). |
| limits | Resource ceilings — defaults are production values; exposed for tests. |
- Returns
- (x, y) coordinates of retained terrain-feature vertices.
◆ isOpen()
| bool mesh::DTMThinner::isOpen |
( |
| ) |
const |
|
noexcept |
◆ open()
| bool mesh::DTMThinner::open |
( |
const QString & |
filePath, |
|
|
int |
band = 1 |
|
) |
| |
◆ operator=()
◆ pixelSize()
| double mesh::DTMThinner::pixelSize |
( |
| ) |
const |
◆ readPixels()
| void mesh::DTMThinner::readPixels |
( |
const MapExtent & |
bbox, |
|
|
QVector< QPointF > & |
xyOut, |
|
|
QVector< double > & |
zOut |
|
) |
| const |
Read every valid raster pixel whose centre falls within bbox.
Issues a single bulk RasterIO call for the entire bounding box — far faster than calling sampleAt() per pixel. Pixel centres are reported in the raster's native map CRS (same as sampleAt()).
The caller is responsible for transforming the returned (x,y) to the mesh CRS if the two CRSs differ.
Regions whose output points would exceed the same ~2 GB working-set ceiling used by generatePoints() are refused up front: nothing is appended and the reason lands in errorMsg(). (A full-DEM bbox on a multi-GB raster would otherwise demand tens of GB and die at the Windows commit limit as an uncatchable-looking bad_alloc.)
- Parameters
-
| bbox | Axis-aligned bounding box in the raster's own CRS. |
| xyOut | Pixel-centre map coordinates (DTM CRS) — appended. |
| zOut | Corresponding elevation values — appended (parallel). |
◆ sampleAt()
Sample the DTM at a single map-CRS coordinate. Returns NaN when out-of-bounds or NoData.
◆ sampleMany()
| void mesh::DTMThinner::sampleMany |
( |
const QVector< QPointF > & |
xy, |
|
|
QVector< double > * |
outZ, |
|
|
qint64 |
maxBufBytes = kMaxReadBufBytesDefault |
|
) |
| const |
Batch bilinear sampling at many DTM-CRS coordinates.
outZ is resized to xy.size(); each entry equals what sampleAt() would return for that point (NaN when out-of-range, NoData in the 2×2 window, or on read failure). Queries are binned into raster row-strips sized to maxBufBytes and each strip is read with ONE RasterIO call (with a 1-row overlap so bilinear windows spanning a strip boundary resolve), instead of one RasterIO per point. Results are bit-identical to per-point sampleAt(). maxBufBytes is exposed for tests.
◆ kMaxGridBytesDefault
| constexpr qint64 mesh::DTMThinner::kMaxGridBytesDefault = qint64(2048) * 1024 * 1024 |
|
staticconstexpr |
Per-band grid working-set ceiling (~46 bytes per grid point).
◆ kMaxReadBufBytesDefault
| constexpr qint64 mesh::DTMThinner::kMaxReadBufBytesDefault = qint64(256) * 1024 * 1024 |
|
staticconstexpr |
Raster scratch-buffer ceiling shared by the banded readers.
◆ kMaxRetainedPointsDefault
| constexpr qint64 mesh::DTMThinner::kMaxRetainedPointsDefault = 64ll * 1024 * 1024 |
|
staticconstexpr |
Total retained-points ceiling across all bands (~64 M points).
◆ kMaxThinningHalo
| constexpr int mesh::DTMThinner::kMaxThinningHalo = 64 |
|
staticconstexpr |
Maximum halo width — and therefore the per-band pass cap — in multi-band mode. "(unlimited)" passes are truncated to this.
The documentation for this class was generated from the following files:
- /home/runner/work/openswmm.gui/openswmm.gui/include/mesh/dtmthinner.h
- /home/runner/work/openswmm.gui/openswmm.gui/src/mesh/dtmthinner.cpp