SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmmvis::io::rastergeoref Namespace Reference

Classes

struct  GeorefProbe
 What a cheap read-only open reveals about a raster's georeferencing — for dialog prefill/validation. More...
 
struct  WorldFileParams
 The six lines of an ESRI world file, in file order. More...
 

Functions

bool parseWorldFile (const QString &path, WorldFileParams *out, QString *err)
 Parses a world file: six whitespace/newline-separated doubles.
 
QStringList worldFileCandidates (const QString &imagePath)
 Conventional world-file sidecar paths for imagePath, in priority order.
 
void worldFileToGeoTransform (const WorldFileParams &wf, double gt[6])
 Converts world-file parameters to a GDAL GeoTransform.
 
bool applyPamGeoref (const QString &imagePath, const double *gt6, const QString &crsWkt, QString *err)
 Persists georeferencing on imagePath so every later plain GDAL open sees it.
 
GeorefProbe probeGeoref (const QString &imagePath)
 Probes imagePath read-only; never fails (an unopenable file simply yields a default-constructed probe).
 
QString authCodeToWkt (const QString &authCode, QString *err)
 Resolves a CRS identifier ("EPSG:26985" or anything else OGRSpatialReference::SetFromUserInput accepts) to WKT.
 

Function Documentation

◆ applyPamGeoref()

bool openswmmvis::io::rastergeoref::applyPamGeoref ( const QString &  imagePath,
const double gt6,
const QString &  crsWkt,
QString *  err 
)

Persists georeferencing on imagePath so every later plain GDAL open sees it.

First tries the driver's native update path (GDALOpenEx with GDAL_OF_UPDATE + SetGeoTransform/SetSpatialRef — GTiff writes internally or to PAM as GDAL decides). If the driver refuses update access (PNG/JPEG do), writes/merges the PAM sidecar "<imagePath>.aux.xml" directly, preserving any existing non-georef PAM content (statistics, histograms). Finally verifies by reopening read-only.

Parameters
imagePathRaster to georeference.
gt6Optional GeoTransform (6 doubles, CORNER-anchored — see worldFileToGeoTransform()); nullptr = don't set.
crsWktCRS as WKT (see authCodeToWkt()); empty = don't set.
errOptional; receives a message on failure.
Returns
true when the georeferencing is written AND visible on reopen.
Here is the call graph for this function:

◆ authCodeToWkt()

QString openswmmvis::io::rastergeoref::authCodeToWkt ( const QString &  authCode,
QString *  err 
)

Resolves a CRS identifier ("EPSG:26985" or anything else OGRSpatialReference::SetFromUserInput accepts) to WKT.

Parameters
authCodeCRS identifier.
errOptional; receives a message on failure.
Returns
WKT string, or an empty string on failure.
Here is the call graph for this function:

◆ parseWorldFile()

bool openswmmvis::io::rastergeoref::parseWorldFile ( const QString &  path,
WorldFileParams out,
QString *  err 
)

Parses a world file: six whitespace/newline-separated doubles.

Locale-independent (world files always use '.' as the decimal separator).

Parameters
pathWorld file to read.
outReceives the parsed parameters on success.
errOptional; receives a message on failure (unreadable file, fewer than six values, or a non-numeric value).
Returns
true on success.

◆ probeGeoref()

GeorefProbe openswmmvis::io::rastergeoref::probeGeoref ( const QString &  imagePath)

Probes imagePath read-only; never fails (an unopenable file simply yields a default-constructed probe).

Here is the call graph for this function:

◆ worldFileCandidates()

QStringList openswmmvis::io::rastergeoref::worldFileCandidates ( const QString &  imagePath)

Conventional world-file sidecar paths for imagePath, in priority order.

For the common formats the conventional three-letter name comes first (.tif/.tiff → .tfw, .png → .pgw, .jpg/.jpeg → .jgw, .bmp → .bpw), followed by the generic "first + last letter of the extension + w" form, the full "extension + w" form (e.g. .tifw), and finally the format-agnostic .wld.

Pure path arithmetic — ALL candidates are returned whether or not they exist on disk; the caller checks existence.

◆ worldFileToGeoTransform()

void openswmmvis::io::rastergeoref::worldFileToGeoTransform ( const WorldFileParams wf,
double  gt[6] 
)

Converts world-file parameters to a GDAL GeoTransform.

A world file anchors C/F at the CENTER of the top-left pixel; the GDAL GeoTransform anchors gt[0]/gt[3] at its top-left CORNER: gt[0] = C − A/2 − B/2 and gt[3] = F − D/2 − E/2, with gt[1]=A, gt[2]=B, gt[4]=D, gt[5]=E.