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

An axis-aligned bounding box in the coordinate space of a given CRS. More...

#include <mapextent.h>

Collaboration diagram for MapExtent:

Public Member Functions

 MapExtent ()=default
 Constructs a default (null) extent.
 
 MapExtent (double xMin, double yMin, double xMax, double yMax)
 Constructs an extent from explicit coordinates.
 
 MapExtent (const QRectF &rect)
 Constructs an extent from a QRectF (x-left, y-bottom, width, height).
 
double xMin () const
 
double yMin () const
 
double xMax () const
 
double yMax () const
 
double width () const
 
double height () const
 
double centerX () const
 
double centerY () const
 
bool isValid () const
 Returns true when all coordinates are finite and xMin < xMax and yMin < yMax.
 
bool isNull () const
 Returns true when this extent is equal to a default-constructed one.
 
QRectF toRectF () const
 Returns a QRectF(xMin, yMin, width, height) representation.
 
QString toString () const
 Returns a human-readable "[xMin, yMin] — [xMax, yMax]" string.
 
void setXMin (double v)
 
void setYMin (double v)
 
void setXMax (double v)
 
void setYMax (double v)
 
void expandToInclude (double x, double y)
 Expands this extent to include the point (x, y).
 
void expandToInclude (const MapExtent &other)
 Expands this extent to include all of other.
 
void growByFactor (double factor)
 Grows the extent by factor on all sides (relative to centre).
 
MapExtent scaled (double factor) const
 Returns a new extent scaled by factor around the centre point.
 
MapExtent panned (double dx, double dy) const
 Returns a new extent panned by the given delta values.
 
MapExtent intersected (const MapExtent &other) const
 Returns the intersection of this extent and other. Returns a null extent if they do not overlap.
 
MapExtent united (const MapExtent &other) const
 Returns an extent that exactly contains both this and other.
 
bool contains (double x, double y) const
 Returns true when this extent contains the given point.
 
bool contains (const MapExtent &other) const
 Returns true when this extent fully contains other.
 
bool intersects (const MapExtent &other) const
 Returns true when this extent intersects (overlaps) other.
 
bool operator== (const MapExtent &other) const
 
bool operator!= (const MapExtent &other) const
 

Detailed Description

An axis-aligned bounding box in the coordinate space of a given CRS.

Stores the geographic or projected envelope used by the MapCanvas to define the visible area and by layers to report their spatial extent. All coordinate values are in the units of the associated CRS.

Constructor & Destructor Documentation

◆ MapExtent() [1/3]

MapExtent::MapExtent ( )
default

Constructs a default (null) extent.

Here is the caller graph for this function:

◆ MapExtent() [2/3]

MapExtent::MapExtent ( double  xMin,
double  yMin,
double  xMax,
double  yMax 
)

Constructs an extent from explicit coordinates.

Parameters
xMinLeft / west boundary.
yMinBottom / south boundary.
xMaxRight / east boundary.
yMaxTop / north boundary.

◆ MapExtent() [3/3]

MapExtent::MapExtent ( const QRectF &  rect)
explicit

Constructs an extent from a QRectF (x-left, y-bottom, width, height).

Member Function Documentation

◆ centerX()

double MapExtent::centerX ( ) const
inline
Here is the caller graph for this function:

◆ centerY()

double MapExtent::centerY ( ) const
inline
Here is the caller graph for this function:

◆ contains() [1/2]

bool MapExtent::contains ( const MapExtent other) const

Returns true when this extent fully contains other.

◆ contains() [2/2]

bool MapExtent::contains ( double  x,
double  y 
) const

Returns true when this extent contains the given point.

◆ expandToInclude() [1/2]

void MapExtent::expandToInclude ( const MapExtent other)

Expands this extent to include all of other.

Here is the call graph for this function:

◆ expandToInclude() [2/2]

void MapExtent::expandToInclude ( double  x,
double  y 
)

Expands this extent to include the point (x, y).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ growByFactor()

void MapExtent::growByFactor ( double  factor)

Grows the extent by factor on all sides (relative to centre).

Parameters
factore.g. 0.1 for 10 % padding on each side.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ height()

double MapExtent::height ( ) const
inline
Here is the caller graph for this function:

◆ intersected()

MapExtent MapExtent::intersected ( const MapExtent other) const

Returns the intersection of this extent and other. Returns a null extent if they do not overlap.

Here is the call graph for this function:

◆ intersects()

bool MapExtent::intersects ( const MapExtent other) const

Returns true when this extent intersects (overlaps) other.

◆ isNull()

bool MapExtent::isNull ( ) const

Returns true when this extent is equal to a default-constructed one.

Here is the caller graph for this function:

◆ isValid()

bool MapExtent::isValid ( ) const

Returns true when all coordinates are finite and xMin < xMax and yMin < yMax.

Here is the caller graph for this function:

◆ operator!=()

bool MapExtent::operator!= ( const MapExtent other) const

◆ operator==()

bool MapExtent::operator== ( const MapExtent other) const

◆ panned()

MapExtent MapExtent::panned ( double  dx,
double  dy 
) const

Returns a new extent panned by the given delta values.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scaled()

MapExtent MapExtent::scaled ( double  factor) const

Returns a new extent scaled by factor around the centre point.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setXMax()

void MapExtent::setXMax ( double  v)
inline

◆ setXMin()

void MapExtent::setXMin ( double  v)
inline

◆ setYMax()

void MapExtent::setYMax ( double  v)
inline

◆ setYMin()

void MapExtent::setYMin ( double  v)
inline

◆ toRectF()

QRectF MapExtent::toRectF ( ) const

Returns a QRectF(xMin, yMin, width, height) representation.

Here is the call graph for this function:

◆ toString()

QString MapExtent::toString ( ) const

Returns a human-readable "[xMin, yMin] — [xMax, yMax]" string.

◆ united()

MapExtent MapExtent::united ( const MapExtent other) const

Returns an extent that exactly contains both this and other.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ width()

double MapExtent::width ( ) const
inline
Here is the caller graph for this function:

◆ xMax()

double MapExtent::xMax ( ) const
inline
Here is the caller graph for this function:

◆ xMin()

double MapExtent::xMin ( ) const
inline
Here is the caller graph for this function:

◆ yMax()

double MapExtent::yMax ( ) const
inline
Here is the caller graph for this function:

◆ yMin()

double MapExtent::yMin ( ) const
inline
Here is the caller graph for this function:

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