sgsPy
structurally guided sampling
Loading...
Searching...
No Matches
sgs::existing::Existing

#include <existing.h>

Public Member Functions

 Existing (vector::GDALVectorWrapper *p_vect, raster::GDALRasterWrapper *p_rast, double *GT, int64_t width, OGRLayer *p_samples, bool plot, std::vector< double > &xCoords, std::vector< double > &yCoords, bool addAllPoints=true)
bool containsIndex (int64_t x, int64_t y)
OGRPoint getPoint (int64_t x, int64_t y)
bool containsCoordinates (double xCoord, double yCoord)
size_t count ()

Public Attributes

bool used
boost::unordered::unordered_flat_map< int64_t, OGRPoint > samples
double IGT [6]
int64_t width

Detailed Description

This struct handles existing sample plot points. It has a constructor which takes a GDALVectorWrapper, geotransform, and width of the raster as parameters.

The points are stored within an unordered map. This map can then be checked to see if it contains particular index values.

Constructor & Destructor Documentation

◆ Existing()

sgs::existing::Existing::Existing ( vector::GDALVectorWrapper * p_vect,
raster::GDALRasterWrapper * p_rast,
double * GT,
int64_t width,
OGRLayer * p_samples,
bool plot,
std::vector< double > & xCoords,
std::vector< double > & yCoords,
bool addAllPoints = true )
inline

Constructor for the Existing struct.

First, check to ensure the GDALRasterWrapper isn't a null pointer.

Calculates the inverse geotransform of the given transform, using GDAL's inv_geotransform function.

Iterates through the features of the input vector. Every feature must be either a Point or a MultiPoint. Every point is converted from their x and y coordinates to a single index value, which is then stored in an unordered map. The existing points are also added to the output layer.

The width of the raster is used to calculate this final index value.

Parameters
GDALVectorWrapper*p_vect
double*GT
int64_twidth
OGRLayer*p_samples
boolplot
std::vector<double>&xCoords
std::vector<double>&yCoords

Member Function Documentation

◆ containsCoordinates()

bool sgs::existing::Existing::containsCoordinates ( double xCoord,
double yCoord )
inline

Checker function which converts x coordinate and y coordinate values to an index usign the inverse geotransform.

If this index is contained in the samples unordered_map, True is returned, otherwise the result will be false.

Parameters
doublexCoord
doubleyCoord
Returns
bool

◆ containsIndex()

bool sgs::existing::Existing::containsIndex ( int64_t x,
int64_t y )
inline

Checker function which converts x and y indices values to a single index value. If this index is contained in the samples unordered_map, True is returned, otherwise the result will be false.

This function will be used when determining sample plot placement, when iterating through an input raster.

Parameters
int64_tx
int64_ty
Returns
bool

◆ count()

size_t sgs::existing::Existing::count ( )
inline

Get the number of existing sample points.

Returns
size_t

◆ getPoint()

OGRPoint sgs::existing::Existing::getPoint ( int64_t x,
int64_t y )
inline

if the map has already been checked, gets the OGRPoint which is associated with a particular value.

Parameters
int64_tx
int64_ty
Returns
OGRPoint

Member Data Documentation

◆ IGT

double sgs::existing::Existing::IGT[6]

◆ samples

boost::unordered::unordered_flat_map<int64_t, OGRPoint> sgs::existing::Existing::samples

◆ used

bool sgs::existing::Existing::used

◆ width

int64_t sgs::existing::Existing::width

The documentation for this struct was generated from the following file: