ShapeNetwork Class Reference

Represents a network built from the polyline shapefile. More...

Collaboration diagram for ShapeNetwork:
Collaboration graph

Public Member Functions

int Build (Shapefile Shapefile, int ShapeIndex, int FinalPointIndex, double Tolerance, AmbiguityResolution ar, ICallback cBack)
 Builds a shape network from the specified line shapefile using the shape index to determine which shape in the shapefile is to be used as the outlet shape. More...
 
bool Close ()
 Closes the shape network. More...
 
bool DeleteShape (int ShapeIndex)
 Deletes a shape from the shape network. More...
 
int get_AmbigShapeIndex (int Index)
 Gets the shape index of an ambiguous shape in the shape network. More...
 
double get_DistanceToOutlet (int PointIndex)
 Gets the distance from the specified point in the current shape to the outlet point in the shape network. More...
 
string get_ErrorMsg (int ErrorCode)
 Retrieves the error message associated with the specified error code. More...
 
bool MoveDown ()
 Moves the current shape pointer down the network by one link. More...
 
bool MoveTo (int ShapeIndex)
 Moves the current shape pointer to the shape specified by the shape index. More...
 
bool MoveToOutlet ()
 Moves the current shape pointer to the outlet shape in the shape network. More...
 
bool MoveUp (int UpIndex)
 Moves the current shape pointer up the shape network, taking the specified path. More...
 
bool Open (Shapefile sf, ICallback cBack)
 Opens a shape network. More...
 
Grid RasterizeD8 (bool UseNetworkBounds, GridHeader Header, double Cellsize, ICallback cBack)
 Rasterizes the network into a D8 grid. More...
 

Properties

Shape CurrentShape [get]
 Gets the current shape object in the shape network. More...
 
int CurrentShapeIndex [get]
 Gets the index of the current shape in the shape network. More...
 
ICallback GlobalCallback [get, set]
 The global callback is the interface used by MapWinGIS to pass progress and error events to interested applications. More...
 
string Key [get, set]
 The key may be used by the programmer to store any string data associated with the object. More...
 
int LastErrorCode [get]
 Retrieves the last error generated in the object. More...
 
int NetworkSize [get]
 Gets the number of shapes in the shape network. More...
 
int NumDirectUps [get]
 Gets the number of upstream shapes in the network before the next fork. More...
 
int ParentIndex [get, set]
 Gets the index of the parent of the current shape. If the current shape is the outlet shape in the shape network, -1 will be returned. More...
 
Shapefile Shapefile [get]
 Gets the shapefile used to create the network. More...
 

Detailed Description

Represents a network built from the polyline shapefile.

A shape network is created from the shapes in a polyline shapefile which allows you to traverse the shapefile simulating water flowing in a watershed to a single outlet. To create a shape network from a polyline shapefile, first choose an outlet shape from the shapes in the shapefile. Next, choose an outlet point within the specified outlet shape. Finally, you need to select a tolerance value. The tolerance is used to determine whether to include a shape in the shape network if it is not connected to the network. Using this starting criteria, a shape network can be created from the polyline shapefile.

Member Function Documentation

◆ Build()

int ShapeNetwork.Build ( Shapefile  Shapefile,
int  ShapeIndex,
int  FinalPointIndex,
double  Tolerance,
AmbiguityResolution  ar,
ICallback  cBack 
)

Builds a shape network from the specified line shapefile using the shape index to determine which shape in the shapefile is to be used as the outlet shape.

Parameters
ShapefileThe shapefile to be used to create the shape network.
ShapeIndexThe index of the shape in the specified shapefile to be used as the outlet shape for the shape network
FinalPointIndexThe point index of the point in the specified outlet shape to be used as the outlet point for the shape network.
ToleranceThe tolerance used to find disconnected segments to merge into the network.
arThe ambiguity resolution method used to resolve any ambiguity while building the shape network. Distance to outlet is the only ambiguity resolution method implemented.
cBackOptional. The ICallback object which will receive progress and error messages during the creation of the shape network.
Returns
The success or failure of building the shape network. If a non-zero integer is returned, the shape network build was successful. If a zero is returned, the shape network build was not successful.

◆ Close()

bool ShapeNetwork.Close ( )

Closes the shape network.

Returns
A boolean value representing the success or failure of closing the shape network.

◆ DeleteShape()

bool ShapeNetwork.DeleteShape ( int  ShapeIndex)

Deletes a shape from the shape network.

Parameters
ShapeIndexThe index of the shape to be deleted from the shape network.
Returns
A boolean value representing the success or failure of deleting the shape from the shape network.

◆ get_AmbigShapeIndex()

int ShapeNetwork.get_AmbigShapeIndex ( int  Index)

Gets the shape index of an ambiguous shape in the shape network.

The first ambiguous shape is at index 0. If there are no ambiguous shapes, AmbigShapeIndex(0) will return -1. If AmbigShapeIndex returns -1 and the index you specified isn't 0, it means there are no more ambiguous shapes in the shape network.

Parameters
IndexThe index into the ambiguous shapes in the shape network.
Returns
The shape index of the ambiguous shape. Returns -1 if there isn't an ambiguous shape at the specified ambiguous shape index.

◆ get_DistanceToOutlet()

double ShapeNetwork.get_DistanceToOutlet ( int  PointIndex)

Gets the distance from the specified point in the current shape to the outlet point in the shape network.

Parameters
PointIndexThe index of a point in the current shape.
Returns
The distance from the specified point in the current shape to the outlet point in the shape network.

◆ get_ErrorMsg()

string ShapeNetwork.get_ErrorMsg ( int  ErrorCode)

Retrieves the error message associated with the specified error code.

Parameters
ErrorCodeThe error code for which the error message is required.
Returns
The error message description for the specified error code.

◆ MoveDown()

bool ShapeNetwork.MoveDown ( )

Moves the current shape pointer down the network by one link.

Returns
A boolean value representing the success or failure of moving the current shape pointer down the shape network by one link.

◆ MoveTo()

bool ShapeNetwork.MoveTo ( int  ShapeIndex)

Moves the current shape pointer to the shape specified by the shape index.

Parameters
ShapeIndexThe shape index of the shape in the network to move the current shape pointer to.
Returns
A boolean value representing the success or failure of moving the current shape pointer to the specified shape.

◆ MoveToOutlet()

bool ShapeNetwork.MoveToOutlet ( )

Moves the current shape pointer to the outlet shape in the shape network.

Returns
A boolean value representing the success or failure of moving the current shape pointer to the outlet shape in the shape network.

◆ MoveUp()

bool ShapeNetwork.MoveUp ( int  UpIndex)

Moves the current shape pointer up the shape network, taking the specified path.

Parameters
UpIndexThe index of the shape in the shape network to use as the upstream path. This is necessary because a node may have more than one upstream path.
Returns
A boolean value representing the success or failure of moving the current shape pointer up in the shape network.

◆ Open()

bool ShapeNetwork.Open ( Shapefile  sf,
ICallback  cBack 
)

Opens a shape network.

Parameters
sfThe shapefile object to open as a shape network.
cBackOptional. ICallback object which will receive progress and error messages while the shape network is opened.
Returns
A boolean value representing the success or failure of opening the shape network

◆ RasterizeD8()

Grid ShapeNetwork.RasterizeD8 ( bool  UseNetworkBounds,
GridHeader  Header,
double  Cellsize,
ICallback  cBack 
)

Rasterizes the network into a D8 grid.

Parameters
UseNetworkBoundsA boolean value representing whether the shape network bounds will be used as the only bounds for the D8 grid or not.
HeaderOptional. A grid header to use to create the new grid.
CellsizeOptional. The cell size to use in creating the D8 grid.
cBackOptional. The ICallback object which will receive progress and error messages when the grid is being created.
Returns
Optional. The rasterized Grid representing the shape network.

Property Documentation

◆ CurrentShape

Shape ShapeNetwork.CurrentShape
get

Gets the current shape object in the shape network.

◆ CurrentShapeIndex

int ShapeNetwork.CurrentShapeIndex
get

Gets the index of the current shape in the shape network.

◆ GlobalCallback

ICallback ShapeNetwork.GlobalCallback
getset

The global callback is the interface used by MapWinGIS to pass progress and error events to interested applications.

◆ Key

string ShapeNetwork.Key
getset

The key may be used by the programmer to store any string data associated with the object.

◆ LastErrorCode

int ShapeNetwork.LastErrorCode
get

Retrieves the last error generated in the object.

◆ NetworkSize

int ShapeNetwork.NetworkSize
get

Gets the number of shapes in the shape network.

◆ NumDirectUps

int ShapeNetwork.NumDirectUps
get

Gets the number of upstream shapes in the network before the next fork.

◆ ParentIndex

int ShapeNetwork.ParentIndex
getset

Gets the index of the parent of the current shape. If the current shape is the outlet shape in the shape network, -1 will be returned.

◆ Shapefile

Shapefile ShapeNetwork.Shapefile
get

Gets the shapefile used to create the network.