Heightfield Analysis 1.0
WatershedAnalysis Class Reference

A heightfield flow routing structure. More...

#include <watershed.h>

Inheritance diagram for WatershedAnalysis:
Array2 Box2

Public Member Functions

 WatershedAnalysis (const ScalarField2 &, bool=false)
 Create the heightfield flow routing structure.
 
QVector< QPoint > Watershed (const QPoint &) const
 Compute the watershed of the argument point.
 
QVector< QPoint > River (const QPoint &) const
 Compute the longest river flowing to the argument point.
 
QVector< QPoint > River (const QPoint &, const QPoint &) const
 Compute the river connecting two points.
 
double WatershedArea (const QPoint &) const
 Compute the drainage area of the watershed flowing through the argument point.
 
double RiverLength (const QPoint &) const
 Compute the length of the longest river flowing to the argument point.
 
double RiverLength (const QVector< QPoint >) const
 Compute the river length of a set of points.
 
void Draw (QGraphicsScene &, int, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw a rectangle.
 
void DrawWatershed (QGraphicsScene &, const QVector< QPoint > &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw the watershed.
 
double BreachingCost () const
 Compute the breaching cost.
 
double FillingCost () const
 Compute the filling cost.
 
double Flow (int, int) const
 Compute flow.
 

Protected Attributes

HeightField hf
 Reference to heightfield.
 
ScalarField2 area
 Drainage area.
 
Array2I upstream
 Upstream topology.
 
Array2I downstream
 Downstream topology.
 

Detailed Description

A heightfield flow routing structure.

This class implements a structure that stores the drainage area and the corresponding upstream and downstream directed graphs.

It is needed to compute the watersheds.

Constructor & Destructor Documentation

◆ WatershedAnalysis()

WatershedAnalysis::WatershedAnalysis ( const ScalarField2 & s,
bool steep = false )
explicit

Create the heightfield flow routing structure.

Parameters
sThe heightfield.
steepFlag, set to true if we rely on the steepest slope, false for multiple convergent and divergent flows.

Member Function Documentation

◆ BreachingCost()

double WatershedAnalysis::BreachingCost ( ) const

Compute the breaching cost.

This function computes the volume of bedrock removed by the breaching process. It then converts it into an average height (like precipitation) by dividing by the area of the terrain.

Results are in meters per squared-meter.

double e = 1000.0*a.BreachingCost(); // Multiply by 1000 to get cost in millimeters per squared meter.
WatershedAnalysis(const ScalarField2 &, bool=false)
Create the heightfield flow routing structure.
Definition watershed.cpp:17
HeightField hf
Reference to heightfield.
Definition watershed.h:7

◆ Draw()

void WatershedAnalysis::Draw ( QGraphicsScene & scene,
int n,
const QPen & pen = QPen(),
const QBrush & brush = QBrush() ) const

Draw a rectangle.

Parameters
sceneGraphics scene.
penThe pen.
nUpstream or downstream.
brushThe brush, should the box be filled.

◆ DrawWatershed()

void WatershedAnalysis::DrawWatershed ( QGraphicsScene & scene,
const QVector< QPoint > & w,
const QPen & pen = QPen(),
const QBrush & brush = QBrush() ) const

Draw the watershed.

Parameters
sceneGraphics scene.
wSet of watershed points.
penThe pen.
brushThe brush, should the box be filled.

◆ FillingCost()

double WatershedAnalysis::FillingCost ( ) const

Compute the filling cost.

See also
WatershedAnalysis::BreachingCost() const

◆ Flow()

double WatershedAnalysis::Flow ( int i,
int j ) const

Compute flow.

Uses a power law to compute flow from drainage area.

◆ River() [1/2]

QVector< QPoint > WatershedAnalysis::River ( const QPoint & p) const

Compute the longest river flowing to the argument point.

Parameters
pPoint.

◆ River() [2/2]

QVector< QPoint > WatershedAnalysis::River ( const QPoint & a,
const QPoint & b ) const

Compute the river connecting two points.

The function returns the river flowing to a pit if no connecting river path exists.

Parameters
a,bStarting (source) and ending (outlet) points.

◆ RiverLength() [1/2]

double WatershedAnalysis::RiverLength ( const QPoint & p) const

Compute the length of the longest river flowing to the argument point.

See also
WatershedAnalysis::River
Parameters
pPoint.

◆ RiverLength() [2/2]

double WatershedAnalysis::RiverLength ( const QVector< QPoint > river) const

Compute the river length of a set of points.

Parameters
riverSet of points defining the river.

◆ Watershed()

QVector< QPoint > WatershedAnalysis::Watershed ( const QPoint & p) const

Compute the watershed of the argument point.

Parameters
pPoint.

◆ WatershedArea()

double WatershedAnalysis::WatershedArea ( const QPoint & p) const

Compute the drainage area of the watershed flowing through the argument point.

See also
WatershedAnalysis::Watershed
Parameters
pPoint.