WATERSHED Class Reference

Watershed analysys based on DEM. More...

#include <mi32/watermdl.h>

List of all members.

Classes

class  ATTRIBUTE
 This class is designed to provide hydrological features. More...
class  POLYGON
 This class is designed to provide 2dimensional hydrological feature. More...
class  POUR
 This class is designed to provide pouring hydrological feature. More...
class  POURCANDIDATE
 This is temporary class. More...

Public Types

enum  DIRECTION {
  DIRECTION_Null = 0, DIRECTION_TopRight = 1, DIRECTION_Right = 2, DIRECTION_BottomRight = 3,
  DIRECTION_Bottom = 4, DIRECTION_BottomLeft = 5, DIRECTION_Left = 6, DIRECTION_TopLeft = 7,
  DIRECTION_Top = 8, DIRECTION_DepressionFlat = 12, DIRECTION_Minimum = 13, DIRECTION_Multiple = 14,
  DIRECTION_Flat = 15
}
enum  EXTREMA {
  EXTREMA_Null = 0, EXTREMA_Normal = 1, EXTREMA_Maximum = 2, EXTREMA_Minimum = 3,
  EXTREMA_Flat = 4, EXTREMA_FlatExit = 5, EXTREMA_FlatEntry = 6, EXTREMA_Saddle = 7
}
enum  FLAGS {
  FLAGS_None = 0x0000, FLAGS_FillDepressions = 0x0001, FLAGS_FillUpperDepressions = 0x0002, FLAGS_FillLowerDepressions = 0x0004,
  FLAGS_FillDoubleDepressions = 0x0008, FLAGS_FillDepressionsMask = 0x000F, FLAGS_FlowPath = 0x0010, FLAGS_Basin = 0x0020,
  FLAGS_Ridge = 0x0040, FLAGS_CatchmentArea = 0x0100, FLAGS_TopographicIndex = 0x0200, FLAGS_MaximumUpFlow = 0x0400,
  FLAGS_DownFlow = 0x0800, FLAGS_BasinAttribute = 0x1000, FLAGS_WatershedAttribute = 0x2000, FLAGS_ObjectMask = 0x3F70
}
enum  OUTPUT {
  OUTPUT_None = -1, OUTPUT_First = 0, OUTPUT_RasterAdjusted = 0, OUTPUT_RasterExtrema = 1,
  OUTPUT_RasterFlowDirection = 2, OUTPUT_RasterAccumulation = 3, OUTPUT_RasterWatershed = 4, OUTPUT_RasterCatchmentArea = 5,
  OUTPUT_RasterTopographicIndex = 6, OUTPUT_RasterMaximumUpFlow = 7, OUTPUT_RasterDownFlow = 8, OUTPUT_VectorWatershed = 9,
  OUTPUT_VectorFlowPath = 10, OUTPUT_VectorBasin = 11, OUTPUT_VectorRidge = 12, OUTPUT_VectorUserFlowPath = 13,
  OUTPUT_VectorUserBasin = 14, OUTPUT_VectorSegmentedFlowPath = 15, OUTPUT_Count = 16
}
enum  SEGMENTATIONINTERVAL { SEGMENTATIONINTERVAL_Equal = 0, SEGMENTATIONINTERVAL_Unequal = 1, SEGMENTATIONINTERVAL_Exponential = 2 }
enum  SEGMENTATIONPARAMETER { SEGMENTATIONPARAMETER_None = 0, SEGMENTATIONPARAMETER_FlowAccumulation = 1, SEGMENTATIONPARAMETER_Elevation = 2 }
enum  STATUS { STATUS_NotInitialized = -1, STATUS_Initial = 0, STATUS_HasDepressions = 1, STATUS_DepressionsFilled = 2 }

Public Member Functions

 WATERSHED (const RVC::OBJITEM &objitem)
 ~WATERSHED ()
ERRVALUE Compute (const FLAGS flags)
ERRVALUE ComputeElements (const SIMPLE_ARRAY< LPOINT2D > &seeds, const FLAGS flags)
ERRVALUE ComputeExtraRasters (const FLAGS flags)
ERRVALUE ComputeFlowpathSegmentation (const SEGMENTATIONPARAMETER parameter, const SEGMENTATIONINTERVAL interval, const DOUBLE_ARRAY< double > &values)
UINT32 DepressionMaximumArea () const
double DepressionMaximumDepth () const
UINT32 DepressionMaximumNullArea () const
UINT32 DepressionMinimumDepthArea () const
ERRVALUE FillDepressions (const SIMPLE_ARRAY< INT32 > &depressions, const FLAGS flags)
UINT32 GetBasin () const
UINT32 GetBranch () const
UINT32 GetDefaultBasin ()
UINT32 GetDefaultBranch ()
UINT32 GetDefaultInlet ()
UINT32 GetDefaultOutlet ()
const INT32 GetIDOfWatershedPolygonAtPoint (const DPOINT2D &point)
const INT32 GetIDOfWatershedPolygonForVectorPolygon (const INT32 index) const
UINT32 GetInlet () const
const INT32 GetNumberOfDoublePours () const
INT32 GetNumberOfObjects () const
const INT32 GetNumberOfPours () const
const INT32 GetNumberOfVectorPolygons () const
const INT32 GetNumberOfWatershedPolygons () const
const INT32 GetNumberOfWatershedPolygonsWithDepression () const
bool GetObjItem (const OUTPUT id, RVC::OBJITEM &objitem) const
UINT32 GetOutlet () const
bool GetPour (POUR &pour, const INT32 index)
bool GetPutNullCellAtUnfilledDepression () const
STATUS GetStatus () const
bool GetWatershedPolygon (POLYGON &polygon, const INT32 index)
bool IsValleySeparated () const
void SetBasin (const UINT32 basin)
void SetBranch (const UINT32 branch)
void SetDepressionMaximumArea (const UINT32 area)
void SetDepressionMaximumDepth (const double depth)
void SetDepressionMaximumNullArea (const UINT32 area)
void SetDepressionMinimumDepthArea (const UINT32 area)
void SetInlet (const UINT32 inlet)
ERRVALUE SetMask (const RVC::OBJITEM &objitem, const bool use)
void SetOutlet (const UINT32 outlet)
void SetPutNullCellAtUnfilledDepression (const bool value)
void SetValleySeparation (const bool separation)

Static Public Member Functions

static UINT32 GetDefaultBasin (WATERSHED *watershed)
static UINT32 GetDefaultBranch (WATERSHED *watershed)
static UINT32 GetDefaultInlet (WATERSHED *watershed)
static UINT32 GetDefaultOutlet (WATERSHED *watershed)

Static Public Attributes

static const UINT32 DefaultBasin
static const UINT32 DefaultBranch
static const UINT32 DefaultInlet
static const UINT32 DefaultOutlet
static const bool DefaultValleySeparation
static const UINT32 MinimumBasin
static const UINT32 MinimumBranch
static const UINT32 MinimumInlet
static const UINT32 MinimumOutlet
static const UINT32 s_DefaultDepressionMaximumArea
static const double s_DefaultDepressionMaximumDepth
static const UINT32 s_DefaultDepressionMaximumNullArea
static const UINT32 s_DefaultDepressionMinimumDepthArea
static const bool s_DefaultPutNullCellAtUnfilledDepression
static const UINT32 s_MaximumDepressionMaximumArea
static const double s_MaximumDepressionMaximumDepth
static const UINT32 s_MaximumDepressionMaximumNullArea
static const UINT32 s_MaximumDepressionMinimumDepthArea
static const UINT32 s_MinimumDepressionMaximumArea
static const double s_MinimumDepressionMaximumDepth
static const UINT32 s_MinimumDepressionMaximumNullArea
static const UINT32 s_MinimumDepressionMinimumDepthArea

Detailed Description

Watershed analysys based on DEM.

This class is designed to provide computation of different hydrological features. It is based on well-known D8 algorithm. When you are working with this class you have to expect 3 states in calculation:

1. Initial state Object has this status immediately after initialisation or after calling any method that working with mask. It is preferably use masking methods after initialisation. Masking methods are important for selection area of interest in DEM. Value 0 in mask has the same meaning as null value in elevation raster. By calling Compute method with different combination of flags process jumps into other state depends on flags.

2. State with depressions In this state it is available to research watershed system: how many watersheds with depressions, how those watersheds with depressions connected to each others, where water pours out and in for every watershed with or without depressions. It is possible to fill out some selected set of watershed with depressions and see combining watershed as result of this filling. It can be done by calling FillDepressions method with different combination of flags and/or selected set of watershed ID. When all depressions will be filling out process is transferred in next state.

3. State without depressions When all depressions are filled out or haven't existed it is possible to calculated those hydrological features as flow paths, basins, ridges. It can be done by calling ComputeElements with different combinations of flags and/or selected set of seed points. If selected set is present user-defined flow paths and basins will be computed, otherwise process will calculate flow paths, basins and ridges depends on automaticaly-calculated seeds points defined by parameters BASIN, BRANCH, INLET, OUTLET, VALLEYSEPARATION.


Member Enumeration Documentation

Enumerator:
DIRECTION_Null 

Meaning of flow direction raster cell value.

No directions defined

DIRECTION_TopRight 
DIRECTION_Right 
DIRECTION_BottomRight 
DIRECTION_Bottom 
DIRECTION_BottomLeft 
DIRECTION_Left 
DIRECTION_TopLeft 
DIRECTION_Top 
DIRECTION_DepressionFlat 
DIRECTION_Minimum 

Cell on depressions minimum flat.

Cell on local minimum

DIRECTION_Multiple 

Cell with multiple possible direction of flow.

DIRECTION_Flat 

Cell on flat area.

Enumerator:
EXTREMA_Null 

Meaning of flow direction raster cell value.

Cell with null value

EXTREMA_Normal 

Normal cell without extrema.

EXTREMA_Maximum 

Cell with local maximum.

EXTREMA_Minimum 

Cell with local minimum.

EXTREMA_Flat 

Cell on flat area.

EXTREMA_FlatExit 

Cell on flat area is gate to exit from flat area.

EXTREMA_FlatEntry 

Cell on flat area is gate to entry to flat area.

EXTREMA_Saddle 

Saddle cell.

Enumerator:
FLAGS_None 

Flags that can change flow of watershed process.

No action flag

FLAGS_FillDepressions 

Fill depressions (not for state without depressions).

FLAGS_FillUpperDepressions 

Fill upper depressions that pour to selected set of depressions (only for state with depressions).

FLAGS_FillLowerDepressions 

Fill lower depressions that pour from selected set of depressions (only for state with depressions).

FLAGS_FillDoubleDepressions 

Fill only depressions that pour only to each other.

(only for state with depressions)

FLAGS_FillDepressionsMask 

Mask for depressions actions.

FLAGS_FlowPath 

Calculate flow paths in state without depressions.

FLAGS_Basin 

Calculate basins in state without depressions.

FLAGS_Ridge 

Calculate ridges in state without depressions.

FLAGS_CatchmentArea 

Calculate specific catchment area.

FLAGS_TopographicIndex 

Calculate compound topographic index.

FLAGS_MaximumUpFlow 

Calculate maximum up stream flow distance.

FLAGS_DownFlow 

Calculate down stream flow distance.

FLAGS_BasinAttribute 

Calculate geomorphic attributes for basins.

FLAGS_WatershedAttribute 

Calculate geomorphic attributes for watersheds.

FLAGS_ObjectMask 

Mask for calculations actions.

Enumerator:
OUTPUT_None 

Output objects produced by watershed process.

OUTPUT_First 
OUTPUT_RasterAdjusted 

Object that represents modified version of original DEM due by depressions filling.

OUTPUT_RasterExtrema 

4-bits raster represents extrema values on original DEM

OUTPUT_RasterFlowDirection 

4-bits raster represents flow directionon adjusted DEM

OUTPUT_RasterAccumulation 

32-bits signed raster represents flow accumulation in number of cells in adjusted DEM

OUTPUT_RasterWatershed 

32-bits signed raster represents watershed area.

Cells belong to the same watershed if they have the same cell value

OUTPUT_RasterCatchmentArea 

32-bits floating point raster represents specific catchment area values

OUTPUT_RasterTopographicIndex 

32-bits floating point raster represents compound flow directionon adjusted DEM

OUTPUT_RasterMaximumUpFlow 

32-bits floating point raster represents maximum length up stream flow

OUTPUT_RasterDownFlow 

32-bits floating point raster represents length down stream flow

OUTPUT_VectorWatershed 

3D vector object is vectorization form of watershed raster and 3D vector points as pour points if any

OUTPUT_VectorFlowPath 

3D vector object represents flow paths on DEM for automatically calaculated seed points

OUTPUT_VectorBasin 

3D vector object represents basins on DEM for automatically calaculated seed points

OUTPUT_VectorRidge 

3D vector object represents ridges on DEM

OUTPUT_VectorUserFlowPath 

3D vector object represents flow paths on DEM for user-defined seed points

OUTPUT_VectorUserBasin 

3D vector object represents basins on DEM for user-defined seed points

OUTPUT_VectorSegmentedFlowPath 
OUTPUT_Count 
Enumerator:
SEGMENTATIONINTERVAL_Equal 
SEGMENTATIONINTERVAL_Unequal 
SEGMENTATIONINTERVAL_Exponential 
Enumerator:
SEGMENTATIONPARAMETER_None 
SEGMENTATIONPARAMETER_FlowAccumulation 
SEGMENTATIONPARAMETER_Elevation 
Enumerator:
STATUS_NotInitialized 

Status of watershed process.

Not initialized state

STATUS_Initial 

Initial state.

STATUS_HasDepressions 

State with depressions.

STATUS_DepressionsFilled 

State without depressions.


Constructor & Destructor Documentation

WATERSHED::WATERSHED ( const RVC::OBJITEM objitem  ) 
Parameters:
objitem Constructor by RVC::OBJITEM
WATERSHED::~WATERSHED (  ) 

Member Function Documentation

ERRVALUE WATERSHED::Compute ( const FLAGS  flags  ) 

Computes different hydrological features depends on flags.

Returns:
ERRVALUE
Parameters:
flags Flags (see FLAGS enum)
ERRVALUE WATERSHED::ComputeElements ( const SIMPLE_ARRAY< LPOINT2D > &  seeds,
const FLAGS  flags 
)

Computes different hydrological elements as flow paths, basins, ridges depends on selected set of seed points and/or flags.

Returns:
ERRVALUE
Parameters:
seeds Seed points
flags Flags (see FLAGS enum)
ERRVALUE WATERSHED::ComputeExtraRasters ( const FLAGS  flags  ) 

Computes hydrological elements as SCA, CTI, Maximum Up Stream and Down Stream flow distances.

depends on flags

Returns:
ERRVALUE
Parameters:
flags Flags (see FLAGS enum)
ERRVALUE WATERSHED::ComputeFlowpathSegmentation ( const SEGMENTATIONPARAMETER  parameter,
const SEGMENTATIONINTERVAL  interval,
const DOUBLE_ARRAY< double > &  values 
)

Computes flow path segmentation depending on parameter and interval values.

Returns:
ERRVALUE
UINT32 WATERSHED::DepressionMaximumArea (  )  const [inline]

Get current depression maximum area to fill.

Returns:
Current depression maximum area to fill
double WATERSHED::DepressionMaximumDepth (  )  const [inline]

Get current depression maximum depth to fill.

Returns:
Current depression maximum depth to fill
UINT32 WATERSHED::DepressionMaximumNullArea (  )  const [inline]

Get current depression maximum null area to fill.

Returns:
Current depression maximum null area to fill
UINT32 WATERSHED::DepressionMinimumDepthArea (  )  const [inline]

Get current depression minimum depth area to fill.

Returns:
Current depression minimum depth area to fill
ERRVALUE WATERSHED::FillDepressions ( const SIMPLE_ARRAY< INT32 > &  depressions,
const FLAGS  flags 
)

Fills depressions in different ways depends on selected set of watersheds with depressions and/or flags.

Returns:
ERRVALUE
Parameters:
depressions Selected set of watersheds ID with depressions
flags Flags (see FLAGS enum)
UINT32 WATERSHED::GetBasin (  )  const [inline]

Get current basin value.

Returns:
Current basin value
UINT32 WATERSHED::GetBranch (  )  const [inline]

Get current branch value.

Returns:
Current branch value
UINT32 WATERSHED::GetDefaultBasin (  )  [inline]
static UINT32 WATERSHED::GetDefaultBasin ( WATERSHED watershed  )  [inline, static]
UINT32 WATERSHED::GetDefaultBranch (  )  [inline]
static UINT32 WATERSHED::GetDefaultBranch ( WATERSHED watershed  )  [inline, static]
UINT32 WATERSHED::GetDefaultInlet (  )  [inline]
static UINT32 WATERSHED::GetDefaultInlet ( WATERSHED watershed  )  [inline, static]
UINT32 WATERSHED::GetDefaultOutlet (  )  [inline]
static UINT32 WATERSHED::GetDefaultOutlet ( WATERSHED watershed  )  [inline, static]
const INT32 WATERSHED::GetIDOfWatershedPolygonAtPoint ( const DPOINT2D point  ) 

Get watershed polygon ID in watershed system at given point.

Returns:
Watershed polygon ID or -1
Parameters:
point Given point
const INT32 WATERSHED::GetIDOfWatershedPolygonForVectorPolygon ( const INT32  index  )  const [inline]

Get watershed polygon ID in watershed system for given vector polygon element ID that belongs to this watershed.

Returns:
Watershed polygon ID or -1
Parameters:
index Vector polygon element ID
UINT32 WATERSHED::GetInlet (  )  const [inline]

Get current inlet value.

Returns:
Current inlet value
const INT32 WATERSHED::GetNumberOfDoublePours (  )  const [inline]

Get number of double pour points in watershed system.

Returns:
Number of double pour points
INT32 WATERSHED::GetNumberOfObjects (  )  const

Get number of output objects that were calculated.

Returns:
Number of output objects
const INT32 WATERSHED::GetNumberOfPours (  )  const [inline]

Get number of pour points in watershed system.

Returns:
Number of pour points
const INT32 WATERSHED::GetNumberOfVectorPolygons (  )  const [inline]

Get number of vector polygons in watershed system.

Returns:
Number of vector polygons
const INT32 WATERSHED::GetNumberOfWatershedPolygons (  )  const [inline]

Get number of watershed polygons in watershed system.

Returns:
Number of watershed polygons
const INT32 WATERSHED::GetNumberOfWatershedPolygonsWithDepression (  )  const [inline]

Get number of watershed polygons with depression in watershed system.

Returns:
Number of watershed polygons with depression
bool WATERSHED::GetObjItem ( const OUTPUT  id,
RVC::OBJITEM objitem 
) const

Get output objitem that was calculated.

Returns:
true if it was calculated
Parameters:
id ID of output object (see OUTPUT enum)
UINT32 WATERSHED::GetOutlet (  )  const [inline]

Get current outlet value.

Returns:
Current outlet value
bool WATERSHED::GetPour ( POUR pour,
const INT32  index 
) [inline]

Get pour object in watershed system by index.

Returns:
true if exist, otherwise - false
Parameters:
pour POUR object returned
index Pour point ID
bool WATERSHED::GetPutNullCellAtUnfilledDepression (  )  const [inline]

Get put null cell at unfilled depression.

Returns:
true if set to be put otherwise - false
STATUS WATERSHED::GetStatus (  )  const [inline]

Get status of watershed process.

Returns:
Status (see STATUS enum)
bool WATERSHED::GetWatershedPolygon ( POLYGON polygon,
const INT32  index 
) [inline]

Get watershed polygon object in watershed system by index.

Returns:
true if exist, otherwise - false
Parameters:
polygon Watershed polygon object returned
index Watershed polygon ID
bool WATERSHED::IsValleySeparated (  )  const [inline]

Is valley set separated.

Returns:
true if set to be separated otherwise - false
void WATERSHED::SetBasin ( const UINT32  basin  )  [inline]

Set value as current basin value.

Parameters:
basin Value to be set as current basin value
void WATERSHED::SetBranch ( const UINT32  branch  )  [inline]

Set value as current branch value.

Parameters:
branch Value to be set as current branch value
void WATERSHED::SetDepressionMaximumArea ( const UINT32  area  )  [inline]

Set value as current depression maximum area to fill.

void WATERSHED::SetDepressionMaximumDepth ( const double  depth  )  [inline]

Set value as current depression maximum depth to fill.

void WATERSHED::SetDepressionMaximumNullArea ( const UINT32  area  )  [inline]

Set value as current depression maximum null area to fill.

void WATERSHED::SetDepressionMinimumDepthArea ( const UINT32  area  )  [inline]

Set value as current depression maximum area to fill.

void WATERSHED::SetInlet ( const UINT32  inlet  )  [inline]

Set value as current inlet value.

Parameters:
inlet Value to be set as current inlet value
ERRVALUE WATERSHED::SetMask ( const RVC::OBJITEM objitem,
const bool  use 
)

Set use mask from external <= 8bit raster by RVC::OBJITEM.

Returns:
ERRVALUE
Parameters:
objitem Set mask to watershed model
void WATERSHED::SetOutlet ( const UINT32  outlet  )  [inline]

Set value as current outlet value.

Parameters:
outlet Value to be set as current outlet value
void WATERSHED::SetPutNullCellAtUnfilledDepression ( const bool  value  )  [inline]

Set put null cell at unfilled depression.

void WATERSHED::SetValleySeparation ( const bool  separation  )  [inline]

Set valley separation by given value.

Parameters:
separation Separation value to be set as current

Member Data Documentation

Default basin value in pixels.

Basin value defines basin with total area more than basin value.

Default branch value in pixels.

Branch value defines branch flow path that collects water from area more than branch value.

Default inlet value in pixels.

Inlet value defines flow path than begins by collecting water from area more than inlet value.

Default outlet value in pixels.

Outlet value defines flow path that pours water out of boundary by collecting it from area more than outlet value

Valley separation if true separates main flow stream valley in areas from one branch merging to other.

Minimum basin value in pixels.

Minimum branch value in pixels.

Minimum inlet value in pixels.

Minimum outlet value in pixels.


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

Generated on Sun Oct 7 21:33:59 2012 for TNTsdk 2012 by  doxygen 1.6.1