GEOS  3.9.1dev
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
geos::operation::overlayng::ElevationModel Class Reference

A simple elevation model used to populate missing Z values in overlay results. More...

#include <ElevationModel.h>

Collaboration diagram for geos::operation::overlayng::ElevationModel:
[legend]

Classes

class  ElevationCell
 

Public Member Functions

 ElevationModel (const geom::Envelope &extent, int numCellX, int numCellY)
 
void add (const geom::Geometry &geom)
 
double getZ (double x, double y)
 
void populateZ (geom::Geometry &geom)
 Computes Z values for any missing Z values in a geometry, using the computed model. More...
 

Static Public Member Functions

static std::unique_ptr< ElevationModelcreate (const geom::Geometry &geom1, const geom::Geometry &geom2)
 
static std::unique_ptr< ElevationModelcreate (const geom::Geometry &geom1)
 

Protected Member Functions

void add (double x, double y, double z)
 

Private Member Functions

void init ()
 
ElevationCellgetCell (double x, double y)
 
int getCellOffset (int ix, int iy)
 

Private Attributes

geom::Envelope extent
 
int numCellX
 
int numCellY
 
double cellSizeX
 
double cellSizeY
 
std::vector< ElevationCellcells
 
bool isInitialized = false
 
bool hasZValue = false
 
double averageZ = DoubleNotANumber
 

Static Private Attributes

static const int DEFAULT_CELL_NUM
 

Detailed Description

A simple elevation model used to populate missing Z values in overlay results.

The model divides the extent of the input geometry(s) into an NxM grid. The default grid size is 3x3. If the input has no extent in the X or Y dimension, that dimension is given grid size 1. The elevation of each grid cell is computed as the average of the Z values of the input vertices in that cell (if any). If a cell has no input vertices within it, it is assigned the average elevation over all cells.

If no input vertices have Z values, the model does not assign a Z value.

The elevation of an arbitrary location is determined as the Z value of the nearest grid cell.

An elevation model can be used to populate missing Z values in an overlay result geometry.

Author
Martin Davis

Definition at line 65 of file ElevationModel.h.

Constructor & Destructor Documentation

geos::operation::overlayng::ElevationModel::ElevationModel ( const geom::Envelope extent,
int  numCellX,
int  numCellY 
)

Member Function Documentation

void geos::operation::overlayng::ElevationModel::add ( double  x,
double  y,
double  z 
)
protected
void geos::operation::overlayng::ElevationModel::add ( const geom::Geometry geom)
static std::unique_ptr<ElevationModel> geos::operation::overlayng::ElevationModel::create ( const geom::Geometry geom1,
const geom::Geometry geom2 
)
static
static std::unique_ptr<ElevationModel> geos::operation::overlayng::ElevationModel::create ( const geom::Geometry geom1)
static
ElevationCell& geos::operation::overlayng::ElevationModel::getCell ( double  x,
double  y 
)
private
int geos::operation::overlayng::ElevationModel::getCellOffset ( int  ix,
int  iy 
)
inlineprivate

Definition at line 118 of file ElevationModel.h.

double geos::operation::overlayng::ElevationModel::getZ ( double  x,
double  y 
)

Gets the model Z value at a given location. If the location lies outside the model grid extent, this returns the Z value of the nearest grid cell. If the model has no elevation computed (i.e. due to empty input), the value is returned as a double NaN.

Parameters
xthe x ordinate of the location
ythe y ordinate of the location
Returns
the computed model Z value
void geos::operation::overlayng::ElevationModel::init ( )
private
void geos::operation::overlayng::ElevationModel::populateZ ( geom::Geometry geom)

Computes Z values for any missing Z values in a geometry, using the computed model.

If the model has no Z value, or the geometry coordinate dimension does not include Z, no action is taken.

Parameters
geomthe geometry to elevate

Member Data Documentation

double geos::operation::overlayng::ElevationModel::averageZ = DoubleNotANumber
private

Definition at line 112 of file ElevationModel.h.

std::vector<ElevationCell> geos::operation::overlayng::ElevationModel::cells
private

Definition at line 109 of file ElevationModel.h.

double geos::operation::overlayng::ElevationModel::cellSizeX
private

Definition at line 107 of file ElevationModel.h.

double geos::operation::overlayng::ElevationModel::cellSizeY
private

Definition at line 108 of file ElevationModel.h.

const int geos::operation::overlayng::ElevationModel::DEFAULT_CELL_NUM
staticprivate

Definition at line 103 of file ElevationModel.h.

geom::Envelope geos::operation::overlayng::ElevationModel::extent
private

Definition at line 104 of file ElevationModel.h.

bool geos::operation::overlayng::ElevationModel::hasZValue = false
private

Definition at line 111 of file ElevationModel.h.

bool geos::operation::overlayng::ElevationModel::isInitialized = false
private

Definition at line 110 of file ElevationModel.h.

int geos::operation::overlayng::ElevationModel::numCellX
private

Definition at line 105 of file ElevationModel.h.

int geos::operation::overlayng::ElevationModel::numCellY
private

Definition at line 106 of file ElevationModel.h.


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