C# 클래스 SharpMap.Data.Providers.MsSql

상속: IFeatureProvider, IFileBased, IDisposable
파일 보기 프로젝트 열기: jumpinjackie/fdotoolbox

공개 메소드들

메소드 설명
Close ( ) : void

Closes the datasource

CreateDataTable ( SharpMap datasource, string tablename, string connstr ) : int

Creates a new table in a Microsoft SQL Server database and copies rows from an existing datasource.

The datatable created will contain six extra columns besides the attribute data: "OID" (Object ID row), "WKB_Geometry" (Geometry stored as WKB), and Envelope_MinX, Envelope_MinY, Envelope_MaxX, Envelope_MaxY for geometry bounding box.

Upload a ShapeFile to a database: public void CreateDatabase(string shapeFile) { if (!System.IO.File.Exists(shapeFile)) { MessageBox.Show("File not found"); return; } ShapeFile shp = new ShapeFile(shapeFile, false); //Create tablename from filename string tablename = shapeFile.Substring(shapeFile.LastIndexOf('\\') + 1, shapeFile.LastIndexOf('.') - shapeFile.LastIndexOf('\\') - 1); //Create connectionstring string connstr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|GeoDatabase.mdf;Integrated Security=True;User Instance=True"; int count = SharpMap.Data.Providers.MsSql.CreateDataTable(shp, tablename, connstr); MessageBox.Show("Uploaded " + count.ToString() + " features to datatable '" + tablename + "'"); }

Dispose ( ) : void

Disposes the object

ExecuteIntersectionQuery ( SharpMap geom, FeatureDataSet ds ) : void

Returns the features that intersects with 'geom' [NOT IMPLEMENTED]

ExecuteIntersectionQuery ( SharpMap bbox, SharpMap ds ) : void

Returns all features with the view box

GetExtents ( ) : SharpMap.Geometries.BoundingBox

Boundingbox of dataset

GetFeature ( uint RowID ) : SharpMap.Data.FeatureDataRow

Returns a datarow based on a RowID

GetFeatureCount ( ) : int

Returns the number of features in the dataset

GetGeometriesInView ( SharpMap bbox ) : List

Returns geometries within the specified bounding box

GetGeometryByID ( uint oid ) : SharpMap.Geometries.Geometry

Returns the geometry corresponding to the Object ID

GetObjectIDsInView ( SharpMap bbox ) : List

Returns geometry Object IDs whose bounding box intersects 'bbox'

GetXYTolerance ( ) : double?
MsSql ( string ConnectionStr, string tablename, string geometryColumnName, string OID_ColumnName ) : System

Initializes a new connection to MS Sql Server

Open ( ) : void

Opens the datasource

비공개 메소드들

메소드 설명
Dispose ( bool disposing ) : void
GetBoxClause ( SharpMap bbox ) : string
Type2SqlType ( Type t ) : SqlDbType

Returns the name of the SqlServer datatype based on a .NET datatype

메소드 상세

Close() 공개 메소드

Closes the datasource
public Close ( ) : void
리턴 void

CreateDataTable() 공개 정적인 메소드

Creates a new table in a Microsoft SQL Server database and copies rows from an existing datasource.

The datatable created will contain six extra columns besides the attribute data: "OID" (Object ID row), "WKB_Geometry" (Geometry stored as WKB), and Envelope_MinX, Envelope_MinY, Envelope_MaxX, Envelope_MaxY for geometry bounding box.

Upload a ShapeFile to a database: public void CreateDatabase(string shapeFile) { if (!System.IO.File.Exists(shapeFile)) { MessageBox.Show("File not found"); return; } ShapeFile shp = new ShapeFile(shapeFile, false); //Create tablename from filename string tablename = shapeFile.Substring(shapeFile.LastIndexOf('\\') + 1, shapeFile.LastIndexOf('.') - shapeFile.LastIndexOf('\\') - 1); //Create connectionstring string connstr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|GeoDatabase.mdf;Integrated Security=True;User Instance=True"; int count = SharpMap.Data.Providers.MsSql.CreateDataTable(shp, tablename, connstr); MessageBox.Show("Uploaded " + count.ToString() + " features to datatable '" + tablename + "'"); }

public static CreateDataTable ( SharpMap datasource, string tablename, string connstr ) : int
datasource SharpMap Datasource to upload
tablename string Name of table to create (existing table will be overwritten!)
connstr string Connection string to database
리턴 int

Dispose() 공개 메소드

Disposes the object
public Dispose ( ) : void
리턴 void

ExecuteIntersectionQuery() 공개 메소드

Returns the features that intersects with 'geom' [NOT IMPLEMENTED]
public ExecuteIntersectionQuery ( SharpMap geom, FeatureDataSet ds ) : void
geom SharpMap
ds FeatureDataSet FeatureDataSet to fill data into
리턴 void

ExecuteIntersectionQuery() 공개 메소드

Returns all features with the view box
public ExecuteIntersectionQuery ( SharpMap bbox, SharpMap ds ) : void
bbox SharpMap view box
ds SharpMap FeatureDataSet to fill data into
리턴 void

GetExtents() 공개 메소드

Boundingbox of dataset
public GetExtents ( ) : SharpMap.Geometries.BoundingBox
리턴 SharpMap.Geometries.BoundingBox

GetFeature() 공개 메소드

Returns a datarow based on a RowID
public GetFeature ( uint RowID ) : SharpMap.Data.FeatureDataRow
RowID uint
리턴 SharpMap.Data.FeatureDataRow

GetFeatureCount() 공개 메소드

Returns the number of features in the dataset
public GetFeatureCount ( ) : int
리턴 int

GetGeometriesInView() 공개 메소드

Returns geometries within the specified bounding box
public GetGeometriesInView ( SharpMap bbox ) : List
bbox SharpMap
리턴 List

GetGeometryByID() 공개 메소드

Returns the geometry corresponding to the Object ID
public GetGeometryByID ( uint oid ) : SharpMap.Geometries.Geometry
oid uint Object ID
리턴 SharpMap.Geometries.Geometry

GetObjectIDsInView() 공개 메소드

Returns geometry Object IDs whose bounding box intersects 'bbox'
public GetObjectIDsInView ( SharpMap bbox ) : List
bbox SharpMap
리턴 List

GetXYTolerance() 공개 메소드

public GetXYTolerance ( ) : double?
리턴 double?

MsSql() 공개 메소드

Initializes a new connection to MS Sql Server
public MsSql ( string ConnectionStr, string tablename, string geometryColumnName, string OID_ColumnName ) : System
ConnectionStr string Connectionstring
tablename string Name of data table
geometryColumnName string Name of geometry column
OID_ColumnName string Name of column with unique identifier
리턴 System

Open() 공개 메소드

Opens the datasource
public Open ( ) : void
리턴 void