public void MpsBufferArea() { Coordinate[] c = new Coordinate[36]; Random rnd = new Random(); GeoAPI.Geometries.ICoordinate[] ccheck = new GeoAPI.Geometries.ICoordinate[36]; GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory gf = new GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory(); for (int i = 0; i < 36; i++) { c[i] = new Coordinate((rnd.NextDouble() + 360) - 180, (rnd.NextDouble() * 180) - 90); double x = c[i].X; double y = c[i].Y; GisSharpBlog.NetTopologySuite.Geometries.Coordinate ctemp = new GisSharpBlog.NetTopologySuite.Geometries.Coordinate(x, y); ccheck[i] = ctemp; } GeoAPI.Geometries.IMultiPoint mpsCheck = gf.CreateMultiPoint(ccheck); MultiPoint mps = new MultiPoint(c); double area = mps.Buffer(500).Area; double areacheck = mpsCheck.Buffer(500).Area; if (Math.Abs(area - areacheck) > 0.000000001) { Assert.AreEqual(mps.Buffer(500).Area, mpsCheck.Buffer(500).Area); } }
public void Buffer() { Coordinate[] c = new Coordinate[36]; Random rnd = new Random(); for (int i = 0; i < 36; i++) { c[i] = new Coordinate((rnd.NextDouble() + 360) - 180, (rnd.NextDouble() * 180) - 90); } MultiPoint mps = new MultiPoint(c); byte[] vals = mps.ToBinary(); WkbReader wkb = new WkbReader(); IGeometry g = wkb.Read(vals); MultiPoint mpsCheck = g as MultiPoint; if (mpsCheck != null) { Assert.AreEqual(mps.Buffer(200).Area, mpsCheck.Buffer(200).Area); } else { Assert.Fail("The test failed because the MpsCheck was null."); } }
/// <summary> /// /// </summary> public void Start() { try { Write(multiPoint.Area); Write(multiPoint.Boundary); Write(multiPoint.BoundaryDimension); Write(multiPoint.Centroid); Write(multiPoint.Coordinate); Write(multiPoint.Coordinates); Write(multiPoint.Dimension); Write(multiPoint.Envelope); Write(multiPoint.EnvelopeInternal); Write(multiPoint.Geometries.Length); Write(multiPoint.InteriorPoint); Write(multiPoint.IsEmpty); Write(multiPoint.IsSimple); Write(multiPoint.IsValid); Write(multiPoint.Length); Write(multiPoint.NumGeometries); Write(multiPoint.NumPoints); Write(multiPoint.Buffer(10)); Write(multiPoint.Buffer(10, new BufferParameters { EndCapStyle = EndCapStyle.Flat })); Write(multiPoint.Buffer(10, new BufferParameters { EndCapStyle = EndCapStyle.Square })); Write(multiPoint.Buffer(10, 20)); Write(multiPoint.Buffer(10, new BufferParameters(20) { EndCapStyle = EndCapStyle.Flat })); Write(multiPoint.Buffer(10, new BufferParameters(20) { EndCapStyle = EndCapStyle.Square })); Write(multiPoint.ConvexHull()); byte[] bytes = multiPoint.AsBinary(); var test1 = new WKBReader().Read(bytes); Write(test1.ToString()); bytes = new GDBWriter().Write(multiPoint); test1 = new GDBReader().Read(bytes); Write(test1.ToString()); } catch (Exception ex) { throw ex; } }
public void MpsBufferArea() { var c = new Coordinate[36]; var rnd = new Random(); var ccheck = new GeoAPI.Geometries.Coordinate[36]; var gf = new NetTopologySuite.Geometries.GeometryFactory(); for (var i = 0; i < 36; i++) { c[i] = new Coordinate((rnd.NextDouble() + 360) - 180, (rnd.NextDouble() * 180) - 90); var x = c[i].X; var y = c[i].Y; var ctemp = new GeoAPI.Geometries.Coordinate(x, y); ccheck[i] = ctemp; } GeoAPI.Geometries.IMultiPoint mpsCheck = gf.CreateMultiPoint(ccheck); var mps = new MultiPoint(c); var area = mps.Buffer(500).Area; var areacheck = mpsCheck.Buffer(500).Area; Assert.IsTrue(Math.Abs(area - areacheck) < 1e-6); }
public void Buffer() { Coordinate[] c = new Coordinate[36]; Random rnd = new Random(); for (int i = 0; i < 36; i++) { c[i] = new Coordinate((rnd.NextDouble() + 360) - 180, (rnd.NextDouble() * 180) - 90); } MultiPoint mps = new MultiPoint(c); byte[] vals = mps.ToBinary(); WkbReader wkb = new WkbReader(); IGeometry g = wkb.Read(vals); MultiPoint mpsCheck = g as MultiPoint; if (mpsCheck != null) { Assert.AreEqual(mps.Buffer(200).Area, mpsCheck.Buffer(200).Area); } else { Assert.Fail("The test failed because the MpsCheck was null."); } }
public void MpsBufferArea() { var c = new Coordinate[36]; var rnd = new Random(); var ccheck = new GeoAPI.Geometries.Coordinate[36]; var gf = new NetTopologySuite.Geometries.GeometryFactory(); for (var i = 0; i < 36; i++) { c[i] = new Coordinate((rnd.NextDouble() + 360) - 180, (rnd.NextDouble() * 180) - 90); var x = c[i].X; var y = c[i].Y; var ctemp = new GeoAPI.Geometries.Coordinate(x, y); ccheck[i] = ctemp; } GeoAPI.Geometries.IMultiPoint mpsCheck = gf.CreateMultiPoint(ccheck); var mps = new MultiPoint(c); var area = mps.Buffer(500).Area; var areacheck = mpsCheck.Buffer(500).Area; Assert.IsTrue(Math.Abs(area - areacheck) < 1e-6 ); }