public static IEnumerable<TerrainService.shPoint> getPolygonPoints(string polygon_guid) { List<TerrainService.shPoint> pntsList = new System.Collections.Generic.List<TerrainService.shPoint>(); string sql = "select * from polygon_points where polygon_guid='" + polygon_guid + "' order by point_num"; using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection)) using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, connection)) { DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds.Reset(); da.Fill(ds); dt = ds.Tables[0]; if (dt == null || dt.Rows == null || dt.Rows.Count == 0) { return null; } foreach (DataRow row in dt.Rows) { TerrainService.shPoint mp = new TerrainService.shPoint(); mp.x = System.Convert.ToDouble(row["pointx"]); mp.y = System.Convert.ToDouble(row["pointy"]); pntsList.Add(mp); } } return pntsList; }
public static IEnumerable <TerrainService.shPoint> getPolygonPoints(string polygon_guid) { List <TerrainService.shPoint> pntsList = new System.Collections.Generic.List <TerrainService.shPoint>(); string sql = "select * from polygon_points where polygon_guid='" + polygon_guid + "' order by point_num"; using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection)) using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, connection)) { DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds.Reset(); da.Fill(ds); dt = ds.Tables[0]; if (dt == null || dt.Rows == null || dt.Rows.Count == 0) { return(null); } foreach (DataRow row in dt.Rows) { TerrainService.shPoint mp = new TerrainService.shPoint(); mp.x = System.Convert.ToDouble(row["pointx"]); mp.y = System.Convert.ToDouble(row["pointy"]); pntsList.Add(mp); } } return(pntsList); }