C# Class MapAround.IO.ShapeFile

Represents an ESRI Shape-file. Implements methods for reading and writing.
ファイルを表示 Open project: gkrsu/maparound.core Class Usage Examples

Public Methods

Method Description
GetDbaseHeader ( DbaseFieldDescriptor dbFields, int count ) : DbaseFileHeader

Generates a dBase file header.

GetDbaseHeader ( Feature feature, List attributeNames, int count ) : DbaseFileHeader

Gets a stub of dBase file header

GetDbaseHeader ( string dbfFile ) : DbaseFileHeader

Gets the header from a dbf file.

GetShapeType ( IGeometry geom ) : ShapeType

Given a geomtery object, returns the equilivent shape file type.

Read ( string fileName, BoundingRectangle bounds ) : void

Reads a shape-file data (geometries and attributes).

ReadAttributes ( string dbaseFile ) : void

Reads a dBase file and merges dBase records with shapes.

ReadHeader ( Stream stream ) : void

Reads the header oe shape-file. Headers are placed into .shp and .shx files.

ReadIndex ( string fileName ) : int[]

Reads the index of shape-file.

ReadRecord ( Stream stream, int recordOffset, BoundingRectangle bounds ) : ShapeFileRecord

Reads a record from the specified stream.

ReadShapes ( Stream stream, int offsets, BoundingRectangle bounds ) : void

Reads the shapes from specified stream.

ReadShapes ( string fileName, int offsets, BoundingRectangle bounds ) : void

Reads the shapes of shape-file.

ShapeFile ( ) : System

Initializes a new instance of MapAround.IO.Shapefile.

ToString ( ) : string

Returns a System.String that represents the current MapAround.IO.ShapeFiler.

Write ( string fileName, ICollection features ) : void

Writes a collection of features into the shape-file.

WriteAttributes ( string dbaseFile, ICollection featureCollection ) : void

Writes the attribute file.

WriteShapes ( string filename, GeometryCollection geometryCollection ) : void

Writes shapes.

Private Methods

Method Description
GetShapeHandler ( ShapeType type ) : ShapeHandler

Returns the appropriate class to convert a shaperecord to an MapAround geometry given the type of shape.

MergeAttributes ( DataTable table ) : void

Merges attribute rows with the shape file records.

RecountColumnLengths ( DbaseFileHeader DbaseHeader, IEnumerable Features ) : void

Computes the sizes of attribute fileds taking into accound attribute values of the features.

RecountRecords ( DbaseFileHeader DbaseHeader, IEnumerable Features ) : void

Computes the count of DBF records

isRecordInView ( BoundingRectangle bounds, ShapeFileRecord record ) : bool

Method Details

GetDbaseHeader() public static method

Generates a dBase file header.
public static GetDbaseHeader ( DbaseFieldDescriptor dbFields, int count ) : DbaseFileHeader
dbFields DbaseFieldDescriptor An array containing the dBase filed descriptors
count int The record count
return DbaseFileHeader

GetDbaseHeader() public static method

Gets a stub of dBase file header
public static GetDbaseHeader ( Feature feature, List attributeNames, int count ) : DbaseFileHeader
feature Feature The feature
attributeNames List A list containing the attribute names
count int The record count
return DbaseFileHeader

GetDbaseHeader() public static method

Gets the header from a dbf file.
public static GetDbaseHeader ( string dbfFile ) : DbaseFileHeader
dbfFile string The DBF file.
return DbaseFileHeader

GetShapeType() public static method

Given a geomtery object, returns the equilivent shape file type.
public static GetShapeType ( IGeometry geom ) : ShapeType
geom IGeometry A Geometry object.
return ShapeType

Read() public method

Reads a shape-file data (geometries and attributes).
public Read ( string fileName, BoundingRectangle bounds ) : void
fileName string The file name
bounds BoundingRectangle The bounding rectangle. Only those records are read, /// which bounding rectangles intersect with this rectangle
return void

ReadAttributes() public method

Reads a dBase file and merges dBase records with shapes.
public ReadAttributes ( string dbaseFile ) : void
dbaseFile string The dBase file name
return void

ReadHeader() public method

Reads the header oe shape-file. Headers are placed into .shp and .shx files.
public ReadHeader ( Stream stream ) : void
stream Stream A System.IO.Stream instance to read
return void

ReadIndex() public method

Reads the index of shape-file.
public ReadIndex ( string fileName ) : int[]
fileName string The file name
return int[]

ReadRecord() public method

Reads a record from the specified stream.
public ReadRecord ( Stream stream, int recordOffset, BoundingRectangle bounds ) : ShapeFileRecord
stream Stream A System.IO.Stream instance to read
recordOffset int An offset of record
bounds BoundingRectangle An object representing a bounds of the reading area
return ShapeFileRecord

ReadShapes() public method

Reads the shapes from specified stream.
public ReadShapes ( Stream stream, int offsets, BoundingRectangle bounds ) : void
stream Stream A System.IO.Stream instance to read shapes
offsets int An array containing the offset of records to read
bounds BoundingRectangle The bounding rectangle. Only those records are read, /// which bounding rectangles intersect with this rectangle
return void

ReadShapes() public method

Reads the shapes of shape-file.
public ReadShapes ( string fileName, int offsets, BoundingRectangle bounds ) : void
fileName string The file name
offsets int An array containing offsets of the records to read
bounds BoundingRectangle The bounding rectangle. Only those records are read, /// which bounding rectangles intersect with this rectangle
return void

ShapeFile() public method

Initializes a new instance of MapAround.IO.Shapefile.
public ShapeFile ( ) : System
return System

ToString() public method

Returns a System.String that represents the current MapAround.IO.ShapeFiler.
public ToString ( ) : string
return string

Write() public method

Writes a collection of features into the shape-file.
public Write ( string fileName, ICollection features ) : void
fileName string The string defining file name without .shp extension
features ICollection The collection of features to write
return void

WriteAttributes() public method

Writes the attribute file.
public WriteAttributes ( string dbaseFile, ICollection featureCollection ) : void
dbaseFile string file attributes
featureCollection ICollection A collection containing features which attributes is to be written
return void

WriteShapes() public method

Writes shapes.
public WriteShapes ( string filename, GeometryCollection geometryCollection ) : void
filename string The string value defining shape file name without .shp extension
geometryCollection GeometryCollection MapAround.Geometry.GeometryCollection instance containing /// the geometries to write to shape file
return void