C# Class TestShapeFile.ShapeFile

The ShapeFile class represents the contents of a single ESRI shapefile. This is the class which contains functionality for reading shapefiles and their corresponding dBASE attribute files.
You can call the Read() method to import both shapes and attributes at once. Or, you can open the file stream yourself and read the file header or individual records one at a time. The advantage of this is that it allows you to implement your own progress reporting functionality, for example.
Datei anzeigen Open project: TNOCS/csTouch

Public Methods

Method Description
Read ( string fileName ) : void

Read both shapes and attributes from the given shapefile (and its corresponding dBASE file). This is the top-level method for reading an ESRI shapefile.

ReadAttributes ( string dbaseFile ) : void

Read the table from specified dBASE (DBF) file and merge the rows with shapefile records.

The filename of the dBASE file is expected to follow 8.3 naming conventions. If it doesn't follow the convention, we try to determine the 8.3 short name ourselves (but the name we come up with may not be correct in all cases).

ReadShapeFileHeader ( Stream stream ) : void

Read the file header of the shapefile.

ReadShapeFileRecord ( Stream stream ) : ShapeFileRecord

Read a shapefile record.

ReadShapes ( Stream stream ) : void

Read shapes (geometry) from the given stream.

ReadShapes ( string fileName ) : void

Read shapes (geometry) from the given shapefile.

ShapeFile ( ) : System

Constructor for the ShapeFile class.

ToString ( ) : string

Output the File Header in the form of a string.

Private Methods

Method Description
MergeAttributes ( DataTable table ) : void

Merge data rows from the given table with the shapefile records.

ReadDouble64_LE ( Stream stream ) : double

Read an 8-byte double using little endian (Intel) byte ordering.

ReadInt32_BE ( Stream stream ) : int

Read a 4-byte integer using big endian byte ordering.

ReadInt32_LE ( Stream stream ) : int

Read a 4-byte integer using little endian (Intel) byte ordering.

ReadMultipoint ( Stream stream, ShapeFileRecord record ) : void

Read a shapefile MultiPoint record.

ReadPoint ( Stream stream, ShapeFileRecord record ) : void

Read a shapefile Point record.

ReadPolygon ( Stream stream, ShapeFileRecord record ) : void

Read a shapefile Polygon record.

Method Details

Read() public method

Read both shapes and attributes from the given shapefile (and its corresponding dBASE file). This is the top-level method for reading an ESRI shapefile.
public Read ( string fileName ) : void
fileName string Full pathname of the shapefile.
return void

ReadAttributes() public method

Read the table from specified dBASE (DBF) file and merge the rows with shapefile records.
The filename of the dBASE file is expected to follow 8.3 naming conventions. If it doesn't follow the convention, we try to determine the 8.3 short name ourselves (but the name we come up with may not be correct in all cases).
public ReadAttributes ( string dbaseFile ) : void
dbaseFile string Full file path of the dBASE (DBF) file.
return void

ReadShapeFileHeader() public method

Read the file header of the shapefile.
public ReadShapeFileHeader ( Stream stream ) : void
stream Stream Input stream.
return void

ReadShapeFileRecord() public method

Read a shapefile record.
public ReadShapeFileRecord ( Stream stream ) : ShapeFileRecord
stream Stream Input stream.
return ShapeFileRecord

ReadShapes() public method

Read shapes (geometry) from the given stream.
public ReadShapes ( Stream stream ) : void
stream Stream Input stream for a shapefile.
return void

ReadShapes() public method

Read shapes (geometry) from the given shapefile.
public ReadShapes ( string fileName ) : void
fileName string Full pathname of the shapefile.
return void

ShapeFile() public method

Constructor for the ShapeFile class.
public ShapeFile ( ) : System
return System

ToString() public method

Output the File Header in the form of a string.
public ToString ( ) : string
return string