GEOS 3.15.0beta1
geos::operation::grid::Grid< extent_tag > Class Template Reference

The Grid class represents a grid of constant-size rectangular cells that covers a specified envelope. The width of the cells may be different from the height. If the Grid has an "infinite" extent rather than a "bounded" extent, then an extra row and column will be added on all side of the grid. The size of the cells in these columns may be larger than those in the primary grid, such that the extended grid covers a "domain" that is larger than the extent of the regular grid. More...

#include <Grid.h>

Public Member Functions

 Grid (const geom::Envelope &extent, double dx, double dy)
 Construct a bounded grid covering a specified extent.
 Grid (const geom::Envelope &extent, double dx, double dy, const geom::Envelope &domain)
size_t getColumn (double x) const
 Get the column in which the specified x coordinate would fall.
size_t getRow (double y) const
 Get the row in which the specified y coordinate would fall.
std::size_t getCell (double x, double y) const
bool isEmpty () const
size_t getNumRows () const
size_t getNumCols () const
size_t getSize () const
double xmin () const
double xmax () const
double ymin () const
double ymax () const
double dx () const
double dy () const
const geom::EnvelopegetExtent () const
size_t getRowOffset (const Grid &other) const
size_t getColOffset (const Grid &other) const
double getColX (size_t col) const
 Get the x coordinate at the center of the specified column.
double getRowY (size_t row) const
 Get the y coordinate at the center of the specified row.
Grid crop (const geom::Envelope &e) const
Grid< extent_tag > shrinkToFit (const geom::Envelope &b, bool calcExtentFromNewGrid=true) const
bool operator== (const Grid< extent_tag > &b) const
bool operator!= (const Grid< extent_tag > &b) const
geom::Envelope getCellEnvelope (size_t row, size_t col) const

Static Public Member Functions

static Grid makeEmpty ()

Friends

Grid< infinite_extent > make_infinite (const Grid< bounded_extent > &grid, const geom::Envelope &domain)
Grid< bounded_extent > make_finite (const Grid< infinite_extent > &grid)

Detailed Description

template<typename extent_tag>
class geos::operation::grid::Grid< extent_tag >

The Grid class represents a grid of constant-size rectangular cells that covers a specified envelope. The width of the cells may be different from the height. If the Grid has an "infinite" extent rather than a "bounded" extent, then an extra row and column will be added on all side of the grid. The size of the cells in these columns may be larger than those in the primary grid, such that the extended grid covers a "domain" that is larger than the extent of the regular grid.

Constructor & Destructor Documentation

◆ Grid()

template<typename extent_tag>
geos::operation::grid::Grid< extent_tag >::Grid ( const geom::Envelope & extent,
double dx,
double dy,
const geom::Envelope & domain )
inline

Construct an infinite grid covering a specified extent with regularly-sized cells, and adding a row and column of variably-sized cells to each edge of the primary grid such that the specified domain is covered.

Member Function Documentation

◆ getCell()

template<typename extent_tag>
std::size_t geos::operation::grid::Grid< extent_tag >::getCell ( double x,
double y ) const
inline

Get the cell index in which the specified x and y values would fall. Cells are indexed from left-to-right, then top-to-bottom.

References getColumn(), and getRow().

◆ getColOffset()

template<typename extent_tag>
size_t geos::operation::grid::Grid< extent_tag >::getColOffset ( const Grid< extent_tag > & other) const
inline

Return the number of columns by which another grid is offset from this Grid. It is assumed that the two grids have the same resolution, and that the minimum x value of the other grid is greater than or equal to the minimum x value of this grid.

References geos::geom::Envelope::getMinX(), and Grid().

Referenced by shrinkToFit().

◆ getRowOffset()

template<typename extent_tag>
size_t geos::operation::grid::Grid< extent_tag >::getRowOffset ( const Grid< extent_tag > & other) const
inline

Return the number of rows by which another grid is offset from this Grid. It is assumed that the two grids have the same resolution, and that the maximum y value of the other grid is less than or equal to the maximum y value of this grid.

References geos::geom::Envelope::getMaxY(), and Grid().

Referenced by shrinkToFit().

◆ shrinkToFit()

template<typename extent_tag>
Grid< extent_tag > geos::operation::grid::Grid< extent_tag >::shrinkToFit ( const geom::Envelope & b,
bool calcExtentFromNewGrid = true ) const
inline

Reduce the size of the grid to contain only the provided Envelope If calcExtentFromNewGrid is true, then the xmax and ymin of the new grid will be calculated relative to the origin point of the original grid rather than the newly cropped grid.

References geos::geom::Envelope::contains(), geos::geom::Envelope::getArea(), getColOffset(), getColumn(), geos::geom::Envelope::getHeight(), geos::geom::Envelope::getMaxX(), geos::geom::Envelope::getMaxY(), geos::geom::Envelope::getMinX(), geos::geom::Envelope::getMinY(), getRow(), getRowOffset(), geos::geom::Envelope::getWidth(), and Grid().


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