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
CRSManager Class Reference

Singleton that queries the GDAL CRS database and manages CRS objects. More...

#include <crsmanager.h>

Inheritance diagram for CRSManager:
Collaboration diagram for CRSManager:

Signals

void recentCRSesChanged ()
 Emitted when the recent-CRS list changes.
 

Public Member Functions

QList< CRSInfoqueryDatabase (const QString &keyword={}, const QString &authority={}, bool includeDeprecated=false) const
 Returns a flat list of all (or matching) CRS records from the GDAL database.
 
int totalCRSCount () const
 Returns the total number of non-deprecated CRSes in the GDAL database.
 
QStringList availableAuthorities () const
 Returns the list of authority names found in the GDAL database.
 
SpatialReferenceSystemcreateFromAuthCode (const QString &authName, int code, QObject *parent=nullptr) const
 Creates a CRS from an authority + code pair.
 
SpatialReferenceSystemcreateFromWktOrProj (const QString &wktOrProj, QObject *parent=nullptr) const
 Creates a CRS from a WKT2 or PROJ string.
 
bool areSameCRS (const SpatialReferenceSystem &a, const SpatialReferenceSystem &b) const
 Returns true when a and b represent the same CRS.
 
SpatialReferenceSystemwgs84 () const
 Returns the WGS 84 geographic CRS (EPSG:4326).
 
SpatialReferenceSystemwebMercator () const
 Returns the Web Mercator projected CRS (EPSG:3857).
 
QList< QPair< QString, int > > recentCRSes () const
 Returns authority:code pairs the user has recently used.
 
void addRecentCRS (const QString &authName, int code)
 Records an authority+code pair as recently used.
 
void clearRecentCRSes ()
 Clears the recent-CRS list.
 
void loadSettings ()
 Loads recent CRS list from persistent settings.
 
void saveSettings () const
 Saves recent CRS list to persistent settings.
 

Static Public Member Functions

static CRSManagerinstance ()
 Returns the application-wide singleton instance.
 

Properties

int totalCRSCount
 
QStringList authorities
 

Detailed Description

Singleton that queries the GDAL CRS database and manages CRS objects.

Provides methods to:

  • List all CRSes available in the GDAL database (filterable by authority / type / keyword).
  • Create SpatialReferenceSystem instances by authority+code or WKT/PROJ string.
  • Compare two SRSes for equality.
  • Query units for a CRS.

Usage:

QList<CRSInfo> list = mgr.queryDatabase("UTM", "EPSG", false);
Singleton that queries the GDAL CRS database and manages CRS objects.
Definition crsmanager.h:51
static CRSManager & instance()
Returns the application-wide singleton instance.
Definition crsmanager.cpp:79
QList< CRSInfo > queryDatabase(const QString &keyword={}, const QString &authority={}, bool includeDeprecated=false) const
Returns a flat list of all (or matching) CRS records from the GDAL database.
Definition crsmanager.cpp:110

Member Function Documentation

◆ addRecentCRS()

void CRSManager::addRecentCRS ( const QString &  authName,
int  code 
)

Records an authority+code pair as recently used.

Here is the call graph for this function:

◆ areSameCRS()

bool CRSManager::areSameCRS ( const SpatialReferenceSystem a,
const SpatialReferenceSystem b 
) const

Returns true when a and b represent the same CRS.

◆ availableAuthorities()

QStringList CRSManager::availableAuthorities ( ) const

Returns the list of authority names found in the GDAL database.

◆ clearRecentCRSes()

void CRSManager::clearRecentCRSes ( )

Clears the recent-CRS list.

Here is the call graph for this function:

◆ createFromAuthCode()

SpatialReferenceSystem * CRSManager::createFromAuthCode ( const QString &  authName,
int  code,
QObject *  parent = nullptr 
) const

Creates a CRS from an authority + code pair.

Parameters
authNamee.g. "EPSG".
codeNumeric authority code.
parentQt parent for the new object.
Returns
Heap-allocated SpatialReferenceSystem, or nullptr on failure. Caller takes ownership unless a parent is given.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createFromWktOrProj()

SpatialReferenceSystem * CRSManager::createFromWktOrProj ( const QString &  wktOrProj,
QObject *  parent = nullptr 
) const

Creates a CRS from a WKT2 or PROJ string.

Parameters
wktOrProjWKT2 or PROJ string.
parentQt parent for the new object.
Returns
Heap-allocated SpatialReferenceSystem, or nullptr on failure.
Here is the call graph for this function:

◆ instance()

CRSManager & CRSManager::instance ( )
static

Returns the application-wide singleton instance.

Here is the caller graph for this function:

◆ loadSettings()

void CRSManager::loadSettings ( )

Loads recent CRS list from persistent settings.

◆ queryDatabase()

QList< CRSInfo > CRSManager::queryDatabase ( const QString &  keyword = {},
const QString &  authority = {},
bool  includeDeprecated = false 
) const

Returns a flat list of all (or matching) CRS records from the GDAL database.

Parameters
keywordFree-text filter (matches name / code string). Empty = no filter.
authorityAuthority filter, e.g. "EPSG". Empty = all authorities.
includeDeprecatedWhether to include deprecated CRSes (default: false).
Returns
List of matching CRSInfo records, sorted by authority then code.

◆ recentCRSes()

QList< QPair< QString, int > > CRSManager::recentCRSes ( ) const

Returns authority:code pairs the user has recently used.

◆ recentCRSesChanged

void CRSManager::recentCRSesChanged ( )
signal

Emitted when the recent-CRS list changes.

Here is the caller graph for this function:

◆ saveSettings()

void CRSManager::saveSettings ( ) const

Saves recent CRS list to persistent settings.

◆ totalCRSCount()

int CRSManager::totalCRSCount ( ) const

Returns the total number of non-deprecated CRSes in the GDAL database.

◆ webMercator()

SpatialReferenceSystem * CRSManager::webMercator ( ) const

Returns the Web Mercator projected CRS (EPSG:3857).

◆ wgs84()

SpatialReferenceSystem * CRSManager::wgs84 ( ) const

Returns the WGS 84 geographic CRS (EPSG:4326).

The returned pointer is owned by CRSManager and stays valid for the lifetime of the application.

Property Documentation

◆ authorities

QStringList CRSManager::authorities
read

◆ totalCRSCount

int CRSManager::totalCRSCount
read

The documentation for this class was generated from the following files: