public void AddGeometryColumn(string tableName, string columnName, int srid, EnumGeometryType geometryType, int dimension) { ConnectionState connectionState = this.SQLiteDatabaseConn.State; if (this.SQLiteDatabaseConn.State != ConnectionState.Open) { this.SQLiteDatabaseConn.Open(); } this.LoadSpatialLiteExtension(); String addGeometryColumnClause = String.Format("('{0}', '{1}', {2}, '{3}', {4})", tableName, columnName, srid, geometryType.GetStringValue(), dimension); Trace.WriteLine("AddGeometryColumn: " + string.Format("SELECT AddGeometryColumn {0};", addGeometryColumnClause)); try { using (SQLiteCommand cmd = new SQLiteCommand( string.Format("SELECT AddGeometryColumn {0};", addGeometryColumnClause), this.SQLiteDatabaseConn)) { object result = cmd.ExecuteScalar(); if (Convert.ToInt32(result) == 0) { throw new SQLiteException(string.Format( "Cannot create geometry column with type of '{0}', srid:{1}", geometryType.GetStringValue(), srid)); } } } catch (SQLiteException) { throw; } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.StackTrace); throw; } finally { if (connectionState == ConnectionState.Closed) { this.SQLiteDatabaseConn.Close(); } } }
public MapFeatureGeometry(EnumGeometryType type, List <Vertex> vertices) { this.geometryType = type; this.Vertices = vertices; }
public MapFeatureGeometry(EnumGeometryType type) { this.geometryType = type; this.Vertices = new List <Vertex>(); }
public void AddGeometryColumn(string tableName, string columnName, int srid, EnumGeometryType geometryType) { AddGeometryColumn(tableName, columnName, srid, geometryType, 2); }
public void SetGeometry(EnumGeometryType type, List <Vertex> vertices) { this.Geometry = new MapFeatureGeometry(type, vertices); }