public void QueryPoints() { string[] lineTables = new[] { "bridges", "buildings" }; foreach (var table in lineTables) { using (var cmd = conn.CreateCommand()) { cmd.CommandText = $"SELECT * FROM {table}"; using (var reader = cmd.ExecuteReader()) { int geomColumn = 0; while (!reader.GetDataTypeName(geomColumn).EndsWith(".geometry")) { geomColumn++; } while (reader.Read()) { var geomValue = SqlGeometry.Deserialize(reader.GetSqlBytes(geomColumn)); //Assert.IsInstanceOfType(<SqlGeometry>(geomValue); var g = geomValue as SqlGeometry; Assert.IsFalse(g.IsNull); Assert.AreEqual("POINT", g.STGeometryType().Value, true); Assert.AreEqual(1, g.STNumGeometries().Value); Assert.AreEqual(101, g.STSrid); Assert.IsFalse(g.STX.IsNull); Assert.IsFalse(g.STY.IsNull); Assert.IsTrue(g.Z.IsNull); Assert.IsTrue(g.M.IsNull); } } } } }
public override object ToDbValue(Type fieldType, object value) { if (value == null) { return(SqlGeometry.Null); } if (value is SqlGeometry) { return(value); } if (value is string) { var str = value as string; return(SqlGeometry.Parse(str)); } if (value is byte[]) { var bin = value as byte[]; var sqlBin = new System.Data.SqlTypes.SqlBytes(bin); return(SqlGeometry.Deserialize(sqlBin)); } return(base.ToDbValue(fieldType, value)); }
public void QueryMultiPolygons() { string[] lineTables = new[] { "forests", "ponds" }; foreach (var table in lineTables) { using (var cmd = conn.CreateCommand()) { cmd.CommandText = $"SELECT * FROM {table}"; using (var reader = cmd.ExecuteReader()) { int geomColumn = 0; while (!reader.GetDataTypeName(geomColumn).EndsWith(".geometry")) { geomColumn++; } while (reader.Read()) { var geomValue = SqlGeometry.Deserialize(reader.GetSqlBytes(geomColumn)); Assert.IsInstanceOfType(geomValue, typeof(SqlGeometry)); var g = geomValue as SqlGeometry; Assert.IsFalse(g.IsNull); Assert.AreEqual(101, g.STSrid); Assert.AreEqual(2, g.STNumGeometries().Value); Assert.AreEqual("MULTIPOLYGON", g.STGeometryType().Value.ToUpper()); } } } } }
public void QueryPolygons() { string[] lineTables = new[] { "lakes", "buildings", "named_places" }; foreach (var table in lineTables) { using (var cmd = conn.CreateCommand()) { cmd.CommandText = $"SELECT * FROM {table}"; using (var reader = cmd.ExecuteReader()) { int geomColumn = 0; while (!reader.GetDataTypeName(geomColumn).EndsWith(".geometry")) { geomColumn++; } if (table == "buildings") { geomColumn++; //this table has two columns. Second is polygons } while (reader.Read()) { var geom = reader.GetSqlBytes(geomColumn); var g = SqlGeometry.Deserialize(geom); Assert.False(g.IsNull); Assert.Equal(101, g.STSrid); Assert.Equal(1, g.STNumGeometries().Value); Assert.Equal("POLYGON", g.STGeometryType().Value.ToUpper()); } } } } }
public void QueryMultiLineStrings() { string[] lineTables = new[] { "divided_routes" }; foreach (var table in lineTables) { using (var cmd = conn.CreateCommand()) { cmd.CommandText = $"SELECT * FROM {table}"; using (var reader = cmd.ExecuteReader()) { int geomColumn = 0; while (!reader.GetDataTypeName(geomColumn).EndsWith(".geometry")) { geomColumn++; } while (reader.Read()) { var geom = reader.GetSqlBytes(geomColumn); var g = SqlGeometry.Deserialize(geom); Assert.False(g.IsNull); Assert.Equal(101, g.STSrid); Assert.Equal(2, g.STNumGeometries().Value); Assert.Equal("MULTILINESTRING", g.STGeometryType().Value, true); } } } } }
private void TestCommunes() { List <SqlGeometry> geom = new List <SqlGeometry>(); SpatialTrace.Enable(); SpatialTrace.TraceText("Open DB connection"); SpatialTrace.Indent(); using (SqlConnection con = new SqlConnection(@"Data Source=.;Initial Catalog=SampleSpatialData;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False")) { con.Open(); using (SqlCommand com = new SqlCommand("SELECT geom, INSEE_COM + ' ' + NOM_COM FROM dbo.COMMUNE --WHERE geom2154.STNumInteriorRing() > 0", con)) { int i = 0; using (SqlDataReader reader = com.ExecuteReader()) { SpatialTrace.TraceText("Reading results DB\t\t connection"); SpatialTrace.Indent(); while (reader.Read()) { i++; // workaround https://msdn.microsoft.com/fr-fr/library/ms143179(v=sql.120).aspx // In version 11.0 only SqlGeometry curGeom = SqlGeometry.Deserialize(reader.GetSqlBytes(0)); //// In version 10.0 or 11.0 //curGeom = new SqlGeometry(); //curGeom.Read(new BinaryReader(reader.GetSqlBytes(0).Stream)); geom.Add(curGeom); SpatialTrace.SetFillColor(GetRandomColor()); SpatialTrace.SetLineColor(GetRandomColor()); SpatialTrace.SetLineWidth(GetRandomStrokeWidth()); SpatialTrace.TraceGeometry(curGeom, reader[1].ToString()); } SpatialTrace.Unindent(); } } } SpatialTrace.Unindent(); ((ISpatialViewer)viewer).SetGeometry(SqlGeomStyledFactory.Create(geom, null, null, null, "Sample")); }
//public static SqlBytes SerializeSqlGeographyMultiPoint(Point2dCollection points2d) //{ // SqlGeometryBuilder buildpoint = new SqlGeometryBuilder(); // buildpoint.SetSrid(0); // buildpoint.BeginGeometry(OpenGisGeometryType.MultiPoint); // foreach (Point2d point in points2d) // { // buildpoint.AddLine(point.X, point.Y, 0, null); // } // buildpoint.EndFigure(); // buildpoint.EndGeometry(); // return buildpoint.ConstructedGeometry.Serialize(); //} public static Point3dCollection DerializeSqlGeographyMultiPoint(SqlBytes points) { SqlGeometry wktpoints = SqlGeometry.Deserialize(points); if (wktpoints == null) { throw new ArgumentNullException(nameof(wktpoints)); } Point3dCollection point3D = new Point3dCollection(); for (int n = 1; n < wktpoints.STNumPoints(); n++) { SqlGeometry pnt = wktpoints.STPointN(n); point3D.Add(new Point3d((double)pnt.STX, (double)pnt.STY, (double)pnt.Z)); } return(point3D); }
public MainWindow() { InitializeComponent(); // Define 3D mesh object MeshGeometry3D mesh = new MeshGeometry3D(); // Experiment with changing this value to create either a smooth or hard-edged mesh Boolean smooth = false; // EDIT THE SQLCONNECTION STRING HERE using (SqlConnection conn = new SqlConnection("server=localhost\\SQL2012EXPRESS;Trusted_Connection=yes;database=ProSpatial")) { // Define the stored procedure that returns the 3D triangulated mesh SqlCommand comm = new SqlCommand(); comm.CommandText = "GeometryTriangulate3d"; comm.CommandType = CommandType.StoredProcedure; comm.Connection = conn; // Pass in the MultiPoint to be triangulated SqlGeometry WolfPoint = SqlGeometry.STMPointFromText(new SqlChars("MULTIPOINT ((532101.12 5121560.53 432.31), (532100.44 5121557.35 432.62), (532100.22 5121547.64 434.28), (532100.97 5121550.66 432.14), (532101.61 5121553.86 432.65), (532102.27 5121557.03 432.63), (532102.94 5121560.21 432.46), (532105.43 5121562.63 432.28), (532104.77 5121559.46 432.56), (532104.1 5121556.28 432.74), (532103.46 5121553.09 432.48), (532102.78 5121549.93 432.88), (532100.26 5121530.64 440.67), (532100.93 5121533.78 440.38), (532101.61 5121536.89 439.81), (532104.45 5121549.21 434.75), (532105.21 5121552.24 432.51), (532105.86 5121555.43 432.76), (532106.52 5121558.61 432.68), (532107.19 5121561.78 432.54), (532109.57 5121563.62 432.76), (532108.91 5121560.43 432.71), (532108.25 5121557.26 432.83), (532107.61 5121554.06 432.57), (532106.91 5121550.96 433.79), (532106.16 5121547.94 436.09), (532104.03 5121538.75 440.38), (532103.36 5121535.63 440.83), (532102.71 5121532.48 440.92), (532102.04 5121529.37 441.38), (532100.7 5121523.17 442.5), (532100.08 5121512.23 444.65), (532100.75 5121515.32 444.14), (532102.75 5121524.64 442.98), (532104.09 5121530.86 442.11), (532104.77 5121533.98 441.63), (532105.44 5121537.1 441.18), (532106.1 5121540.26 441.18), (532108.28 5121549.4 436.04), (532109.75 5121555.55 432.71), (532110.4 5121558.74 432.87), (532111.07 5121561.91 432.71), (532113.22 5121562.6 432.81), (532112.56 5121559.42 432.95), (532111.91 5121556.26 432.91), (532111.2 5121553.18 434.37), (532110.47 5121550.12 436.13), (532109.75 5121547.07 437.8), (532109.02 5121544.04 439.73), (532108.31 5121540.97 441.08), (532107.63 5121537.88 441.97), (532106.97 5121534.75 442.21), (532106.32 5121531.61 442.26), (532105.65 5121528.51 442.82), (532104.99 5121525.41 443.24), (532104.34 5121522.29 443.45), (532103.02 5121516.1 444.23), (532102.37 5121513.01 444.53), (532101.71 5121509.92 444.83), (532101.06 5121506.82 445.14), (532100.38 5121503.78 446.08), (532101.27 5121500.05 446.49), (532101.93 5121503.14 446.26), (532102.61 5121506.18 445.36), (532103.26 5121509.3 445.25), (532103.93 5121512.39 444.67), (532104.59 5121515.52 444.64), (532105.24 5121518.64 444.5), (532105.92 5121521.73 443.82), (532107.26 5121527.97 443.08), (532107.92 5121531.09 442.73), (532108.58 5121534.23 442.62), (532109.26 5121537.35 442.15), (532109.94 5121540.47 441.52), (532110.64 5121543.56 440.4), (532112.84 5121552.73 435.15), (532113.59 5121555.77 433.01), (532114.25 5121558.96 433.04), (532114.91 5121562.14 432.94), (532124.74 5121597.75 425.41), (532117.17 5121563.01 432.99), (532116.52 5121559.85 433.05), (532115.86 5121556.68 433.07), (532112.96 5121544.46 440.13), (532110.91 5121535.18 442.63), (532109.58 5121528.96 443.58), (532108.93 5121525.84 443.73), (532108.27 5121522.73 444), (532107.61 5121519.63 444.39), (532106.95 5121516.54 444.83), (532106.3 5121513.45 445.07), (532105.66 5121510.33 445.09), (532105.01 5121507.23 445.4), (532104.34 5121504.17 446.05), (532103.67 5121501.12 446.89), (532105.56 5121502.68 446.69), (532106.24 5121505.73 445.9), (532107.57 5121511.91 444.92), (532108.22 5121515.04 444.84), (532108.89 5121518.16 444.57), (532109.54 5121521.3 444.52), (532110.21 5121524.4 443.98), (532110.88 5121527.52 443.62), (532111.54 5121530.65 443.36), (532113.57 5121540.02 441.72), (532114.27 5121543.13 440.87), (532117.89 5121558.53 433.08), (532118.55 5121561.72 433.11), (532126.87 5121599.81 425.42), (532121.32 5121564.99 433.08), (532120.66 5121561.8 433.16), (532120.01 5121558.61 433.02), (532119.27 5121555.55 435.04), (532118.57 5121552.45 436.2), (532116.42 5121543.23 440.71), (532113.06 5121527.69 443.92), (532112.4 5121524.56 444.12), (532111.73 5121521.48 444.86), (532111.08 5121518.33 444.84), (532110.43 5121515.21 445.06), (532109.78 5121512.08 445.15), (532109.12 5121509 445.62), (532108.46 5121505.91 446.19), (532107.79 5121502.85 446.89), (532109.95 5121505.55 446.52), (532110.62 5121508.63 445.89), (532111.3 5121511.7 445.17), (532111.95 5121514.85 445.23), (532112.61 5121517.98 444.97), (532113.27 5121521.1 444.67), (532114.6 5121527.33 444.02), (532117.99 5121542.9 441.1), (532118.67 5121546.03 440.46), (532121.6 5121558.29 433.5), (532122.27 5121561.47 433.23), (532122.93 5121564.64 433.17), (532129.86 5121596.33 426.45), (532131.65 5121595.62 426.88), (532124.81 5121563.98 433.3), (532124.15 5121560.79 433.29), (532120.59 5121545.39 440.53), (532119.91 5121542.27 441.3), (532119.23 5121539.18 442.12), (532117.89 5121532.95 443.17), (532117.2 5121529.87 444.24), (532116.55 5121526.75 444.42), (532115.89 5121523.63 444.79), (532115.25 5121520.48 444.75), (532114.59 5121517.35 444.98), (532113.95 5121514.23 445.04), (532113.3 5121511.12 445.23), (532111.95 5121504.99 446.97), (532111.28 5121501.93 447.66), (532112.35 5121500.03 448.15), (532113.03 5121503.1 447.36), (532113.71 5121506.16 446.53), (532114.39 5121509.23 445.79), (532115.05 5121512.33 445.35), (532115.71 5121515.46 445.09), (532116.37 5121518.6 445.05), (532117.03 5121521.72 444.73), (532117.68 5121524.85 444.65), (532118.35 5121527.96 444.15), (532119.02 5121531.08 443.76), (532119.72 5121534.16 442.67), (532121.74 5121543.55 441.27), (532122.45 5121546.63 439.92), (532126.03 5121562.13 433.32), (532126.69 5121565.3 433.25), (532134.89 5121593.95 428.19), (532128.75 5121565.43 433.37), (532128.1 5121562.25 433.33), (532124.56 5121546.76 439.7), (532122.52 5121537.44 442.06), (532121.86 5121534.31 442.43), (532121.17 5121531.23 443.37), (532120.51 5121528.12 443.89), (532119.84 5121525 444.42), (532119.18 5121521.88 444.82), (532117.87 5121515.64 445.29), (532117.22 5121512.52 445.37), (532116.57 5121509.42 445.72), (532115.9 5121506.35 446.49), (532115.22 5121503.28 447.25), (532114.56 5121500.23 447.85), (532116.58 5121502.45 447.42), (532117.26 5121505.5 446.59), (532117.93 5121508.58 445.9), (532118.59 5121511.69 445.65), (532119.25 5121514.82 445.39), (532119.92 5121517.94 445), (532120.57 5121521.08 444.94), (532121.24 5121524.19 444.49), (532121.91 5121527.32 444.11), (532122.59 5121530.43 443.47), (532123.27 5121533.54 442.83), (532125.33 5121542.86 440.47), (532126.71 5121549.08 438.66), (532129.58 5121561.49 433.3), (532130.23 5121564.69 433.45), (532130.89 5121567.87 433.4), (532138.11 5121592.18 429.87), (532132.68 5121566.72 433.55), (532132.03 5121563.53 433.47), (532129.2 5121551.06 438.36), (532128.52 5121547.92 438.88), (532127.84 5121544.79 439.74), (532127.15 5121541.67 440.47), (532126.46 5121538.56 441.44), (532125.09 5121532.35 443.11), (532124.42 5121529.24 443.66), (532123.75 5121526.13 444.29), (532123.09 5121523 444.59), (532122.44 5121519.87 444.87), (532121.78 5121516.76 445.26), (532121.12 5121513.63 445.41), (532120.47 5121510.52 445.68), (532119.81 5121507.41 446.07), (532119.15 5121504.33 446.69), (532118.47 5121501.27 447.47), (532119.74 5121500.14 447.54), (532120.4 5121503.23 447.1), (532121.08 5121506.29 446.35), (532121.74 5121509.37 445.91), (532122.39 5121512.48 445.74), (532123.05 5121515.57 445.26), (532123.7 5121518.69 445.1), (532124.37 5121521.78 444.61), (532125.03 5121524.89 444.29), (532125.69 5121528 443.91), (532127.73 5121537.3 441.84), (532129.12 5121543.47 439.72), (532129.79 5121546.61 439.35), (532130.49 5121549.71 438.29), (532131.16 5121552.84 437.92), (532133.32 5121562.08 433.32), (532133.97 5121565.27 433.59), (532134.63 5121568.45 433.54), (532139.37 5121590.59 430.54), (532141.55 5121599.99 426.3), (532142.85 5121597.12 427.12), (532142.12 5121593.96 428.47), (532136.63 5121568.59 433.68), (532135.97 5121565.4 433.67), (532135.33 5121562.2 433.51), (532133.85 5121556.05 437.39), (532133.18 5121552.89 437.7), (532132.51 5121549.75 438.16), (532131.83 5121546.62 438.84), (532131.15 5121543.49 439.6), (532130.45 5121540.39 440.74), (532129.76 5121537.29 441.67), (532128.39 5121531.09 443.43), (532127.72 5121527.98 444.02), (532127.06 5121524.87 444.51), (532125.73 5121518.62 445.23), (532124.4 5121512.42 446.32), (532123.77 5121509.25 445.96), (532123.12 5121506.13 446.17), (532122.45 5121503.06 446.9), (532123.4 5121500.22 447.15), (532124.05 5121503.3 446.74), (532124.72 5121506.36 446.05), (532125.37 5121509.47 445.96), (532126 5121512.63 446.29), (532126.69 5121515.69 445.38), (532127.34 5121518.8 445.13), (532128 5121521.93 444.95), (532128.66 5121525.04 444.69), (532130.02 5121531.24 443.2), (532131.38 5121537.43 441.71), (532132.08 5121540.53 440.68), (532132.78 5121543.62 439.53), (532133.47 5121546.72 438.69), (532134.14 5121549.85 438.29), (532134.82 5121552.98 437.68), (532135.49 5121556.12 437.27), (532136.96 5121562.27 433.72), (532137.61 5121565.45 433.75), (532138.27 5121568.63 433.74), (532138.91 5121571.83 434.09), (532142.32 5121587.67 431.57), (532143.03 5121590.81 430.49), (532143.77 5121593.93 428.76), (532144.48 5121597.09 427.68), (532146.62 5121598.48 426.98), (532143.73 5121585.88 432.47), (532143.07 5121582.68 432.44), (532140.4 5121569.98 433.83), (532139.74 5121566.78 433.85), (532139.1 5121563.59 433.59), (532136.95 5121554.29 438.06), (532136.3 5121551.12 438.06), (532135.63 5121548 438.65), (532134.95 5121544.87 439.3), (532134.26 5121541.76 440.27), (532133.57 5121538.66 441.24), (532132.89 5121535.55 442.07), (532132.2 5121532.48 443.12), (532131.53 5121529.37 443.71), (532130.85 5121526.28 444.46), (532130.18 5121523.18 445.1), (532129.54 5121520.04 445.08), (532128.89 5121516.92 445.31), (532128.23 5121513.82 445.82), (532127.57 5121510.72 446.25), (532126.92 5121507.62 446.53), (532126.29 5121504.48 446.25), (532125.63 5121501.4 446.84), (532127.44 5121502.25 446.76), (532128.09 5121505.37 446.66), (532128.73 5121508.49 446.71), (532129.39 5121511.58 446.31), (532130.07 5121514.65 445.52), (532130.73 5121517.77 445.22), (532132.05 5121524 444.6), (532132.73 5121527.11 444.07), (532133.41 5121530.19 443.24), (532134.07 5121533.32 442.94), (532134.77 5121536.39 441.77), (532135.47 5121539.47 440.72), (532136.15 5121542.57 439.96), (532136.83 5121545.7 439.31), (532137.51 5121548.83 438.8), (532138.18 5121551.97 438.41), (532138.85 5121555.1 437.97), (532141.02 5121564.4 433.54), (532141.66 5121567.6 433.93), (532142.32 5121570.79 433.95), (532142.98 5121574 434.05), (532143.64 5121577.18 434.04), (532144.32 5121580.34 433.5), (532145 5121583.52 433.09), (532145.66 5121586.72 433.05), (532147.11 5121593 430.35), (532147.85 5121596.15 428.83), (532149.5 5121595.95 429.06), (532148.76 5121592.8 430.8), (532148 5121589.67 432.75), (532146.63 5121583.29 433.9), (532145.97 5121580.08 433.95), (532145.31 5121576.88 434.01), (532144.66 5121573.68 434.07), (532144 5121570.48 434.03), (532143.35 5121567.27 433.93), (532142.71 5121564.06 433.7), (532139.88 5121551.58 438.66), (532139.21 5121548.43 438.97), (532138.54 5121545.28 439.44), (532137.84 5121542.18 440.62), (532137.17 5121539.03 441.01), (532136.49 5121535.92 441.85), (532135.82 5121532.8 442.44), (532135.14 5121529.69 443.23), (532134.46 5121526.59 444.04), (532133.79 5121523.48 444.57), (532133.13 5121520.36 445.04), (532132.46 5121517.28 445.74), (532131.81 5121514.14 445.82), (532131.13 5121511.07 446.69), (532130.48 5121507.95 446.87), (532129.85 5121504.83 446.77), (532129.21 5121501.7 446.71), (532130.74 5121501.15 446.67), (532131.37 5121504.3 447.02), (532132.02 5121507.42 446.96), (532132.68 5121510.52 446.64), (532133.34 5121513.63 446.37), (532134 5121516.72 445.91), (532134.67 5121519.83 445.48), (532136.02 5121526.01 444.16), (532136.69 5121529.12 443.68), (532137.36 5121532.25 443.24), (532138.07 5121535.33 441.94), (532138.75 5121538.45 441.31), (532140.12 5121544.69 439.98), (532140.8 5121547.83 439.41), (532144.25 5121563.52 435.74), (532144.98 5121566.61 434.02), (532145.64 5121569.81 434.05), (532146.3 5121573.02 434.18), (532146.96 5121576.22 434.21), (532147.63 5121579.4 433.93), (532148.28 5121582.62 434.19), (532149.66 5121588.98 433.01), (532150.39 5121592.12 431.57), (532151.13 5121595.26 429.86), (532153.3 5121597.1 429.45), (532152.56 5121593.96 431.07), (532149.79 5121581.27 434.04), (532149.13 5121578.08 434.23), (532148.47 5121574.89 434.25), (532147.82 5121571.69 434.21), (532147.17 5121568.49 434.1), (532146.54 5121565.28 433.7), (532145.77 5121562.23 436.18), (532142.35 5121546.58 440.09), (532141.67 5121543.44 440.72), (532141.01 5121540.31 441.11), (532140.34 5121537.17 441.5), (532138.97 5121530.98 443.3), (532138.31 5121527.86 443.71), (532137.61 5121524.8 445.04), (532136.97 5121521.66 445.05), (532136.31 5121518.54 445.42), (532135.62 5121515.48 446.43), (532134.32 5121509.26 446.86), (532133.68 5121506.15 447.08), (532133.03 5121503.05 447.22), (532134.24 5121501.07 447.35), (532134.89 5121504.19 447.3), (532135.55 5121507.3 446.98), (532136.2 5121510.43 446.93), (532137.53 5121516.64 446.05), (532138.19 5121519.77 445.83), (532138.87 5121522.85 444.92), (532139.54 5121525.99 444.65), (532140.23 5121529.08 443.64), (532140.92 5121532.16 442.66), (532141.6 5121535.27 442.11), (532142.27 5121538.42 441.66), (532142.95 5121541.55 441.02), (532143.63 5121544.68 440.45), (532144.31 5121547.82 440.01), (532144.98 5121550.98 439.59), (532147.82 5121563.43 434.86), (532148.52 5121566.58 433.99), (532149.17 5121569.78 434.14), (532149.82 5121572.98 434.25), (532150.48 5121576.19 434.29), (532151.15 5121579.39 434.21), (532151.82 5121582.58 434), (532154.48 5121586.38 433.63), (532153.81 5121583.2 433.95), (532153.15 5121580.02 434.13), (532152.48 5121576.83 434.31), (532151.83 5121573.63 434.3), (532151.18 5121570.43 434.24), (532149.86 5121564.06 434.45), (532147.66 5121554.83 439.94), (532146.99 5121551.69 440.42), (532146.34 5121548.52 440.43), (532145.68 5121545.36 440.67), (532145.02 5121542.21 441.02), (532144.35 5121539.09 441.57), (532143.69 5121535.96 441.94), (532143.01 5121532.84 442.59), (532142.34 5121529.73 443.25), (532141.63 5121526.69 444.77), (532140.97 5121523.57 445.19), (532140.29 5121520.48 445.99), (532139.64 5121517.35 446.17), (532137.69 5121508 446.72), (532137.03 5121504.9 447.28), (532136.38 5121501.8 447.53), (532137.79 5121501.01 447.56), (532138.45 5121504.13 447.34), (532139.11 5121507.22 446.91), (532139.78 5121510.31 446.35), (532141.06 5121516.6 446.52), (532141.74 5121519.71 445.96), (532142.42 5121522.81 445.22), (532143.08 5121525.93 444.81), (532144.49 5121532.09 442.51), (532145.15 5121535.24 442.15), (532145.82 5121538.38 441.8), (532146.49 5121541.52 441.39), (532147.17 5121544.66 440.82), (532147.84 5121547.83 440.56), (532151.35 5121563.46 435.57), (532152.09 5121566.55 433.6), (532152.72 5121569.78 434.25), (532153.38 5121572.99 434.27), (532154.04 5121576.18 434.27), (532154.71 5121579.38 434.17), (532155.38 5121582.58 434.01), (532156.05 5121585.78 433.84), (532158.31 5121587.38 433.69), (532157.65 5121584.2 433.9), (532156.98 5121581.02 434.09), (532156.32 5121577.82 434.24), (532155.67 5121574.64 434.3), (532155.01 5121571.45 434.34), (532154.36 5121568.25 434.3), (532153.66 5121565.11 435.24), (532152.96 5121562.01 436.51), (532151.5 5121555.85 440.04), (532150.13 5121549.6 441.53), (532149.49 5121546.43 441.54), (532148.83 5121543.28 441.73), (532148.18 5121540.12 441.77), (532147.52 5121536.99 442.16), (532146.85 5121533.87 442.75), (532146.18 5121530.75 443.23), (532145.51 5121527.64 443.84), (532144.83 5121524.56 444.7), (532144.14 5121521.5 445.89), (532143.49 5121518.37 445.93), (532142.81 5121515.32 446.97), (532142.18 5121512.16 446.67), (532141.55 5121509 446.39), (532140.88 5121505.92 447.13), (532140.23 5121502.81 447.4), (532141.4 5121500.87 447.46), (532142.06 5121503.98 447.22), (532142.71 5121507.1 446.93), (532143.4 5121510.17 446.06), (532144.02 5121513.36 446.76), (532144.68 5121516.49 446.44), (532145.34 5121519.61 446.17), (532146.01 5121522.72 445.64), (532146.72 5121525.79 444.46), (532148.08 5121532.02 443.14), (532149.42 5121538.3 442.29), (532150.1 5121541.45 441.79), (532150.76 5121544.61 441.63), (532152.78 5121554.07 440.49), (532154.21 5121560.29 437.95), (532156.35 5121569.68 434.38), (532157.01 5121572.88 434.37), (532157.67 5121576.08 434.3), (532158.34 5121579.27 434.12), (532159.01 5121582.47 433.97), (532159.68 5121585.66 433.73), (532160.36 5121588.86 433.52), (532162.24 5121589.12 433.4), (532161.57 5121585.94 433.71), (532160.91 5121582.75 433.87), (532160.25 5121579.56 434.06), (532159.58 5121576.37 434.33), (532158.92 5121573.19 434.45), (532158.26 5121570 434.51), (532157.59 5121566.84 435.04), (532156.86 5121563.73 436.59), (532156.13 5121560.64 438.36), (532154.05 5121551.26 441.15), (532152.72 5121544.98 441.94), (532152.05 5121541.84 442.33), (532151.39 5121538.68 442.61), (532150.74 5121535.52 442.64), (532150.06 5121532.41 443.37), (532149.39 5121529.28 443.89), (532148.72 5121526.15 444.51), (532148.03 5121523.09 445.61), (532147.37 5121519.96 445.93), (532146.71 5121516.84 446.26), (532146.06 5121513.7 446.36), (532145.43 5121510.55 446.15), (532144.76 5121507.47 446.91), (532144.11 5121504.36 447.16), (532143.46 5121501.24 447.23), (532144.94 5121500.51 446.95), (532145.58 5121503.65 447.04), (532146.23 5121506.78 446.94), (532147.56 5121513 446.04), (532148.2 5121516.16 446.3), (532148.87 5121519.27 445.8), (532150.24 5121525.47 444.37), (532150.9 5121528.6 444.1), (532151.58 5121531.73 443.48), (532152.24 5121534.87 443.17), (532152.91 5121538.02 442.93), (532153.58 5121541.16 442.44), (532154.25 5121544.32 442.22), (532154.92 5121547.49 441.93), (532155.58 5121550.65 441.8), (532157.69 5121560.04 438.74), (532158.43 5121563.13 436.97), (532159.15 5121566.24 435.6), (532159.86 5121569.38 434.5), (532160.52 5121572.59 434.54), (532161.19 5121575.79 434.42), (532161.87 5121578.96 433.95), (532162.55 5121582.16 433.67), (532163.21 5121585.36 433.61), (532163.88 5121588.55 433.36), (532166.09 5121589.94 433.21), (532165.43 5121586.74 433.39), (532164.77 5121583.54 433.35), (532163.41 5121577.19 434.39), (532162.75 5121574 434.57), (532162.1 5121570.81 434.58), (532161.44 5121567.61 434.63), (532160.7 5121564.52 436.42), (532159.97 5121561.42 438.07), (532157.18 5121548.95 442.22), (532156.53 5121545.78 442.29), (532155.87 5121542.61 442.45), (532155.2 5121539.49 443.06), (532153.88 5121533.19 443.55), (532153.22 5121530.04 443.79), (532152.56 5121526.91 444.11), (532151.88 5121523.8 444.81), (532151.22 5121520.68 445.22), (532150.55 5121517.57 445.78), (532149.91 5121514.43 445.81), (532149.24 5121511.32 446.39), (532148.58 5121508.23 446.86), (532147.93 5121505.09 446.91), (532147.3 5121501.94 446.66), (532148.57 5121500.36 445.96), (532149.18 5121503.54 446.63), (532149.83 5121506.7 446.85), (532150.48 5121509.84 446.77), (532151.15 5121512.93 446.08), (532151.84 5121515.99 445.11), (532152.5 5121519.14 445.04), (532153.16 5121522.29 444.76), (532153.83 5121525.41 444.32), (532154.49 5121528.55 444.1), (532155.82 5121534.83 443.61), (532156.48 5121537.98 443.38), (532157.82 5121544.25 442.68), (532158.47 5121547.42 442.66), (532159.14 5121550.57 442.38), (532161.25 5121559.92 439.13), (532162.72 5121566.12 435.87), (532163.45 5121569.22 434.31), (532164.09 5121572.43 434.65), (532164.76 5121575.62 434.56), (532167.46 5121588.34 433.14), (532168.14 5121591.53 432.87), (532170.36 5121592.64 432.57), (532169.69 5121589.44 432.86), (532166.98 5121576.69 434.65), (532166.32 5121573.49 434.7), (532165.66 5121570.3 434.71), (532164.98 5121567.14 435.23), (532162.8 5121557.82 440.08), (532162.08 5121554.71 441.48), (532160.72 5121548.43 442.85), (532160.06 5121545.27 443.03), (532159.41 5121542.1 443.11), (532158.74 5121538.96 443.61), (532158.08 5121535.79 443.78), (532156.76 5121529.47 444.1), (532156.1 5121526.33 444.39), (532155.45 5121523.17 444.48), (532154.8 5121520.02 444.62), (532154.14 5121516.88 444.8), (532153.45 5121513.81 445.9), (532152.77 5121510.72 446.68), (532152.12 5121507.59 446.84), (532151.49 5121504.41 446.52), (532150.88 5121501.23 445.88), (532152.69 5121502.71 445.63), (532153.3 5121505.92 446.63), (532153.94 5121509.07 446.76), (532154.6 5121512.21 446.56), (532155.3 5121515.27 445.35), (532155.98 5121518.35 444.52), (532156.63 5121521.5 444.6), (532157.28 5121524.68 444.65), (532157.95 5121527.82 444.25), (532158.61 5121530.96 444.1), (532159.28 5121534.1 443.79), (532159.93 5121537.28 443.79), (532160.6 5121540.44 443.55), (532161.28 5121543.57 442.89), (532161.93 5121546.74 443.02), (532162.59 5121549.92 442.95), (532164 5121556.15 440.88), (532166.92 5121568.57 434.53), (532167.57 5121571.78 434.78), (532168.23 5121574.97 434.74), (532170.98 5121587.68 432.55), (532171.64 5121590.89 432.58), (532172.32 5121594.09 432.3), (532174.79 5121596.02 431.87), (532174.12 5121592.81 432.19), (532173.46 5121589.59 432.12), (532170.71 5121576.86 434.72), (532170.05 5121573.67 434.84), (532169.39 5121570.47 434.83), (532164.43 5121548.6 443.35), (532163.78 5121545.42 443.23), (532163.13 5121542.26 443.39), (532162.45 5121539.12 444), (532161.8 5121535.95 443.98), (532161.15 5121532.8 444.13), (532160.49 5121529.63 444.21), (532159.85 5121526.46 444.13), (532159.19 5121523.33 444.45), (532158.54 5121520.19 444.6), (532157.88 5121517.05 444.88), (532157.18 5121513.98 446.1), (532156.51 5121510.88 446.68), (532155.87 5121507.73 446.65), (532155.26 5121504.53 445.83), (532154.62 5121501.39 445.79), (532156.29 5121502.53 445.31), (532156.91 5121505.7 445.83), (532157.52 5121508.89 446.69), (532158.18 5121512.03 446.57), (532158.86 5121515.13 445.85), (532159.55 5121518.19 444.76), (532160.21 5121521.32 444.57), (532160.88 5121524.45 444.12), (532161.53 5121527.62 444.18), (532162.18 5121530.78 444.21), (532162.83 5121533.93 444.17), (532163.47 5121537.11 444.45), (532164.15 5121540.23 443.82), (532164.82 5121543.39 443.6), (532165.47 5121546.56 443.7), (532170.47 5121568.34 434.66), (532171.12 5121571.55 434.91), (532171.79 5121574.74 434.83), (532175.23 5121590.64 432.02), (532175.89 5121593.85 431.97), (532176.58 5121597.05 431.62), (532178.35 5121595.56 431.56), (532177.68 5121592.36 431.76), (532176.98 5121589.18 432.55), (532174.25 5121576.44 434.78), (532173.59 5121573.25 434.93), (532172.94 5121570.04 434.78), (532171.5 5121563.79 437.6), (532170.75 5121560.73 439.83), (532167.3 5121545.08 444.1), (532166.66 5121541.9 443.97), (532165.99 5121538.75 444.29), (532165.33 5121535.6 444.54), (532164.69 5121532.42 444.37), (532164.05 5121529.26 444.27), (532163.41 5121526.09 444.13), (532162.75 5121522.97 444.52), (532162.09 5121519.85 444.85), (532161.42 5121516.75 445.59), (532160.74 5121513.66 446.4), (532160.08 5121510.53 446.61), (532159.45 5121507.37 446.35), (532158.86 5121504.12 445.02), (532158.2 5121501.02 445.45), (532159.78 5121501.64 445.9), (532160.46 5121504.72 445.29), (532161.06 5121507.92 446.3), (532161.7 5121511.08 446.59), (532162.35 5121514.2 446.42), (532163.03 5121517.29 445.64), (532163.72 5121520.37 444.81), (532164.38 5121523.49 444.48), (532165.03 5121526.64 444.52), (532165.66 5121529.82 444.92), (532166.33 5121532.96 444.56), (532166.98 5121536.11 444.59), (532167.64 5121539.27 444.53), (532168.99 5121545.71 444.04), (532172.44 5121561.21 439.77), (532173.19 5121564.29 437.83), (532174.65 5121570.53 434.83), (532175.3 5121573.73 434.97), (532175.96 5121576.91 434.85), (532179.43 5121592.8 431.59), (532180.1 5121596.01 431.37), (532180.78 5121599.2 431.03), (532182.69 5121598.36 430.85), (532182.02 5121595.15 431.17), (532177.89 5121576.04 434.91), (532177.23 5121572.85 435.07), (532176.58 5121569.64 434.87), (532175.1 5121563.45 438.56), (532170.92 5121544.69 444.61), (532170.27 5121541.53 444.65), (532169.61 5121538.37 444.83), (532168.96 5121535.2 444.85), (532168.31 5121532.04 444.82), (532167.65 5121528.9 445.19), (532167.02 5121525.72 444.81), (532166.38 5121522.56 444.75), (532165.72 5121519.44 445.15), (532165.04 5121516.35 445.97), (532164.37 5121513.25 446.47), (532163.73 5121510.11 446.49), (532163.11 5121506.93 445.93), (532162.46 5121503.81 446.16), (532161.83 5121500.66 445.92), (532163.55 5121501.92 445.81), (532164.19 5121505.06 445.86), (532164.83 5121508.22 446.15), (532165.46 5121511.38 446.48), (532166.11 5121514.5 446.39), (532166.79 5121517.59 445.74), (532167.46 5121520.7 445.26), (532168.12 5121523.83 444.93), (532168.77 5121526.99 445.08), (532169.41 5121530.16 445.18), (532170.07 5121533.31 445.14), (532170.74 5121536.45 444.74), (532171.38 5121539.62 444.87), (532172.04 5121542.78 444.93), (532176.94 5121564.65 438.04), (532177.71 5121567.72 435.79), (532178.4 5121570.88 435), (532179.06 5121574.08 435.07), (532179.73 5121577.29 434.97), (532183.9 5121596.36 430.85), (532184.59 5121599.57 430.5), (532186.24 5121597.29 430.48), (532183.42 5121584.58 434.28), (532182.07 5121578.2 435.06), (532181.41 5121575 435.11), (532180.75 5121571.79 435.12), (532180.07 5121568.63 435.68), (532174.42 5121543.67 444.96), (532173.78 5121540.5 444.88), (532173.12 5121537.35 445.01), (532172.45 5121534.2 445.48), (532171.82 5121531.03 445.23), (532171.17 5121527.86 445.14), (532170.53 5121524.71 445.1), (532169.88 5121521.56 445.2), (532169.21 5121518.44 445.66), (532168.54 5121515.34 446.32), (532167.89 5121512.21 446.47), (532167.25 5121509.05 446.27), (532166.62 5121505.89 445.95), (532165.97 5121502.76 446.12), (532167.16 5121501.28 445.98), (532167.82 5121504.42 445.95), (532168.46 5121507.58 446.1), (532169.09 5121510.74 446.43), (532169.74 5121513.87 446.36), (532170.41 5121516.98 445.9), (532171.08 5121520.1 445.45), (532171.75 5121523.23 445.13), (532172.39 5121526.41 445.32), (532173.03 5121529.58 445.53), (532173.68 5121532.74 445.66), (532174.35 5121535.87 445.19), (532175.01 5121539.03 445.07), (532175.67 5121542.18 444.84), (532176.33 5121545.34 444.69), (532182.03 5121570.32 435.16), (532182.7 5121573.52 435.15), (532183.36 5121576.72 435.06), (532184.7 5121583.11 434.72), (532188.24 5121599 430.15), (532190.23 5121597.93 429.92), (532188.1 5121588.41 433.12), (532186.7 5121582.07 434.89), (532186.03 5121578.89 435.24), (532185.38 5121575.69 435.16), (532184.72 5121572.5 435.18), (532184.06 5121569.3 435.29), (532179.1 5121547.49 443.88), (532177.75 5121541.21 444.91), (532177.09 5121538.05 445.17), (532176.44 5121534.9 445.33), (532175.78 5121531.76 445.58), (532175.13 5121528.6 445.48), (532174.49 5121525.44 445.45), (532173.85 5121522.28 445.35), (532173.19 5121519.14 445.61), (532172.52 5121516.04 446.13), (532171.87 5121512.91 446.32), (532171.23 5121509.78 446.34), (532170.6 5121506.64 446.18), (532169.95 5121503.51 446.21), (532169.31 5121500.38 446.17), (532170.93 5121501.29 446.4), (532171.58 5121504.43 446.36), (532172.24 5121507.57 446.23), (532172.89 5121510.73 446.28), (532173.54 5121513.88 446.26), (532174.2 5121517.01 445.94), (532174.87 5121520.15 445.72), (532175.54 5121523.27 445.1), (532176.18 5121526.46 445.57), (532176.83 5121529.63 445.54), (532177.48 5121532.81 445.63), (532178.15 5121535.96 445.33), (532178.81 5121539.13 445.25), (532179.48 5121542.29 444.84), (532180.16 5121545.44 444.46), (532180.85 5121548.58 443.75), (532185.86 5121570.52 435.2), (532186.52 5121573.73 435.26), (532187.19 5121576.93 435.2), (532189.97 5121589.68 432.56), (532192.12 5121599.24 429.55), (532191.66 5121587.49 433.16), (532190.27 5121581.15 434.86), (532189.59 5121577.98 435.29), (532188.94 5121574.78 435.27), (532188.28 5121571.58 435.29), (532183.34 5121549.7 443.22), (532182.66 5121546.57 443.9), (532181.31 5121540.3 445.05), (532180 5121534 445.48), (532179.33 5121530.88 446.02), (532178.05 5121524.54 445.65), (532177.4 5121521.4 445.72), (532176.75 5121518.26 445.87), (532176.1 5121515.13 446.12), (532175.45 5121512 446.24), (532174.81 5121508.85 446.12), (532174.16 5121505.73 446.26), (532173.51 5121502.61 446.46), (532174.77 5121501.39 446.47), (532175.41 5121504.53 446.61), (532176.08 5121507.64 446.18), (532176.73 5121510.78 446.17), (532177.38 5121513.93 446.22), (532178.05 5121517.06 445.87), (532178.7 5121520.22 445.9), (532179.34 5121523.38 446), (532182 5121535.99 445.2), (532182.66 5121539.14 444.95), (532184.01 5121545.45 444.21), (532189.7 5121570.49 435.24), (532190.36 5121573.69 435.33), (532191.02 5121576.9 435.31), (532193.11 5121586.44 433.27), (532196.97 5121594.52 430.81), (532196.25 5121591.37 432.16), (532195.6 5121588.16 432.04), (532194.89 5121585 433.12), (532192.81 5121575.51 435.37), (532192.16 5121572.31 435.33), (532191.51 5121569.13 435.38), (532187.94 5121553.57 441.94), (532186.56 5121547.33 443.71), (532185.88 5121544.21 444.45), (532185.21 5121541.09 444.98), (532184.56 5121537.93 445.1), (532183.89 5121534.78 445.38), (532183.22 5121531.67 446.04), (532181.28 5121522.2 445.97), (532180.65 5121519.04 445.67), (532179.99 5121515.92 446.02), (532179.35 5121512.78 446.06), (532178.7 5121509.64 446.16), (532178.05 5121506.51 446.23), (532177.4 5121503.39 446.46), (532176.76 5121500.27 446.49), (532178.44 5121500.92 446.39), (532179.09 5121504.07 446.43), (532179.75 5121507.21 446.29), (532180.41 5121510.34 446.05), (532181.06 5121513.5 446.04), (532181.73 5121516.65 445.82), (532182.38 5121519.8 445.75), (532183.02 5121523 446.21), (532184.33 5121529.34 446.21), (532185 5121532.47 445.77), (532185.68 5121535.62 445.37), (532186.35 5121538.78 444.96), (532187.7 5121545.09 444.27), (532188.4 5121548.22 443.24), (532189.1 5121551.35 442.31), (532190.51 5121557.62 440.46), (532191.25 5121560.73 438.72), (532193.39 5121570.16 435.36), (532194.05 5121573.38 435.45), (532194.72 5121576.59 435.41), (532196.83 5121586.09 432.82), (532198.21 5121592.48 431.8), (532198.92 5121595.66 430.94), (532198.37 5121583.5 433.44), (532196.95 5121577.19 435.58), (532196.3 5121573.99 435.54), (532195.65 5121570.79 435.42), (532194.99 5121567.6 435.42), (532193.53 5121561.39 438.74), (532192.85 5121558.22 439.27), (532192.14 5121555.1 440.45), (532191.4 5121552.02 442.24), (532190.72 5121548.89 442.97), (532190.01 5121545.78 444.13), (532188.69 5121539.48 444.72), (532188.03 5121536.33 444.94), (532187.35 5121533.2 445.64), (532186.69 5121530.05 445.74), (532184.75 5121520.57 445.81), (532184.11 5121517.41 445.62), (532183.45 5121514.29 445.89), (532182.81 5121511.13 445.75), (532182.15 5121508.01 446.25), (532181.48 5121504.91 446.72), (532180.85 5121501.75 446.47), (532182.04 5121500.11 446.86), (532182.67 5121503.3 447.35), (532183.34 5121506.42 446.85), (532184.02 5121509.53 446.27), (532184.69 5121512.65 445.8), (532185.35 5121515.81 445.7), (532186.01 5121518.97 445.56), (532187.96 5121528.5 445.96), (532188.63 5121531.66 445.7), (532189.3 5121534.8 445.27), (532189.99 5121537.92 444.53), (532190.66 5121541.08 444.22), (532191.34 5121544.24 443.89), (532192.03 5121547.39 443.23), (532192.75 5121550.51 441.9), (532193.45 5121553.64 440.89), (532194.17 5121556.77 439.69), (532194.85 5121559.94 439.29), (532196.31 5121566.18 436.33), (532197.02 5121569.35 435.44), (532197.68 5121572.56 435.51), (532198.34 5121575.77 435.5), (532199.91 5121572.69 435.59), (532199.26 5121569.48 435.53), (532198.6 5121566.31 435.72), (532197.14 5121560.09 438.8), (532196.45 5121556.94 439.65), (532193.01 5121541.25 443.37), (532192.32 5121538.13 444.28), (532191.64 5121535.01 444.91), (532188.36 5121519.28 445.86), (532187.72 5121516.11 445.57), (532187.07 5121512.97 445.69), (532186.4 5121509.86 446.19), (532185.73 5121506.75 446.76), (532185.08 5121503.62 446.89), (532184.43 5121500.48 446.94), (532185.99 5121500.82 446.83), (532186.62 5121503.97 447.11), (532187.28 5121507.08 446.81), (532187.96 5121510.18 446.12), (532188.64 5121513.28 445.57), (532189.29 5121516.42 445.43), (532189.93 5121519.61 445.85), (532192.56 5121532.2 445.36), (532193.94 5121538.43 443.78), (532194.61 5121541.59 443.47), (532195.98 5121547.86 442.2), (532196.68 5121550.98 441.28), (532197.41 5121554.09 439.7), (532198.08 5121557.27 439.48), (532198.78 5121560.41 438.62), (532199.87 5121554.98 439.73), (532198.48 5121548.7 441.49), (532196.42 5121539.27 443.58), (532195.74 5121536.14 444.26), (532195.06 5121533.01 444.94), (532191.81 5121517.18 444.96), (532191.13 5121514.07 445.51), (532190.49 5121510.9 445.36), (532189.78 5121507.86 446.94), (532189.12 5121504.73 447.29), (532188.49 5121501.56 446.86), (532189.74 5121500.23 446.82), (532190.38 5121503.39 447), (532191.03 5121506.56 447.2), (532191.73 5121509.61 445.95), (532192.41 5121512.71 445.36), (532193.06 5121515.85 445.24), (532193.7 5121519.03 445.5), (532197.02 5121534.76 444.51), (532197.71 5121537.86 443.56), (532198.39 5121541 443.13), (532199.07 5121544.12 442.49), (532199.77 5121547.25 441.62), (532199.88 5121537.4 443.28), (532199.19 5121534.28 444.17), (532195.89 5121518.52 445.33), (532195.25 5121515.35 445.13), (532194.6 5121512.2 445.24), (532193.92 5121509.09 445.91), (532193.22 5121506.04 447.22), (532192.56 5121502.9 447.35), (532193.82 5121501.64 446.99), (532195.14 5121507.88 446.49), (532195.86 5121510.89 444.91), (532196.5 5121514.04 445.17), (532197.17 5121517.14 444.63), (532199.43 5121516.94 444.53), (532198.76 5121513.83 445.05), (532198.13 5121510.64 444.74), (532197.41 5121507.59 446.2), (532196.08 5121501.38 447.26), (532197.97 5121503.1 447.2), (532198.64 5121506.22 446.86), (532199.36 5121509.24 445.27))"), 26910); SqlParameter Points = new SqlParameter("@MultiPoint", WolfPoint); Points.UdtTypeName = "geometry"; comm.Parameters.Add(Points); try { // Open the connection conn.Open(); // Execute the procedure SqlDataReader dataReader = comm.ExecuteReader(); // Loop through the results while (dataReader.Read()) { // First column in the results contains geometry triangles SqlGeometry tri = SqlGeometry.Deserialize(dataReader.GetSqlBytes(0)); // Loop through each vertex of this triangle for (int n = 1; n <= 3; n++) { SqlGeometry point = tri.STPointN(n); double X = (double)point.STX; double Y = (double)point.STY; double Z = point.HasZ ? (double)point.Z : 0; if (smooth) { /** * Option A - Smooth mesh * Use this code to add only distinct vertices to the mesh */ Point3D p3d = new Point3D(X, Z, -Y); int idx = mesh.Positions.IndexOf(p3d); // This point hasn't been added yet, so add it to the Positions array if (idx == -1) { mesh.Positions.Add(p3d); mesh.TextureCoordinates.Add(new Point(X, -Y)); mesh.TriangleIndices.Add(mesh.Positions.Count - 1); } // The point already exists, so just added a reference to it to the triangle indices array else { mesh.TriangleIndices.Add(idx); } } else { /** * Option B - Hard edge mesh * Use this code to add all vertices to the mesh, which will duplicate any shared vertices */ mesh.Positions.Add(new Point3D(X, Z, -Y)); mesh.TextureCoordinates.Add(new Point(X, -Y)); } } } // All points added to the mesh, so close the reader dataReader.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } // Display some info about the mesh info.Text = "Vertices:" + mesh.Positions.Count + " Faces: " + (smooth ? mesh.TriangleIndices.Count / 3 : mesh.Positions.Count / 3); // Define a simple material with which to render the geometry Material mat = new DiffuseMaterial(Brushes.SlateGray); /* * // Or, add a texture map to the model * ImageBrush imgBrush = new ImageBrush(); * imgBrush.ImageSource = new BitmapImage(new Uri(@"http://www.example.com/texture.jpg", UriKind.Absolute)); * Material mat = new DiffuseMaterial(imgBrush); */ // Create a new 3d Model using the mesh and material geomModel = new GeometryModel3D(mesh, mat); // Add a transform so we can rotate/transform/scale the model geomModel.Transform = new Transform3DGroup(); // Add the model to the scene group.Children.Add(geomModel); // Calculate the camera position Rect3D r = group.Children[1].Bounds; // Look at the midpoint of the model lookAt = new Point3D(r.X + (r.SizeX / 2), r.Y + (r.SizeY / 2), r.Z + (r.SizeZ / 2)); // Locate the camera in middle front and slightly above the model this.camera.Position = new Point3D(r.X + (r.SizeX / 2) - 10, r.Y + (r.SizeY * 2) + 20, r.Z + (r.SizeZ * 1.2) + 5); // Work out the vector from the camera to the point of focus this.camera.LookDirection = new Vector3D(lookAt.X - this.camera.Position.X, lookAt.Y - this.camera.Position.Y, lookAt.Z - this.camera.Position.Z); // Add a transform so we can rotate/transform the camera this.camera.Transform = new MatrixTransform3D(); }