public PolygonTests() { _exteriorRing3D = new CoordinateList(_coordinatesXYZ); _interiorRings3D = new CoordinateList[2]; _interiorRings3D[0] = new CoordinateList(new Coordinate[] { _coordinatesXYZ[0], _coordinatesXYZ[1], _coordinatesXYZ[0] }); _interiorRings3D[1] = new CoordinateList(new Coordinate[] { _coordinatesXYZ[1], _coordinatesXYZ[2], _coordinatesXYZ[1] }); }
public void Intersects_LineLine_ReturnsaTrueForIntersectingLines() { ICoordinateList line1 = new CoordinateList(new Coordinate[] { new Coordinate(1.0, 1.0), new Coordinate(2.0, 1.0), new Coordinate(2.0, 2.0) }); ICoordinateList line2 = new CoordinateList(new Coordinate[] { new Coordinate(1.0, 0.0), new Coordinate(1.5, 2.0), new Coordinate(2.0, -1.0) }); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.True(target.Intersects(line1, line2)); }
/// <summary> /// Initializes a new instance of the <c>Polygon</c> class with the given exterior boundary and specific holes /// </summary> /// <param name="srid">The <c>SRID</c> of the coordinate reference system.</param> /// <param name="exteriorRing">The exterior boundary of the polygon.</param> /// <param name="interiorRings">The collection of interior boundaries defining holes in the polygon.</param> public Polygon(int srid, CoordinateList exteriorRing, IEnumerable <ICoordinateList> interiorRings) : base(srid) { this.ExteriorRing = exteriorRing; this.InteriorRings = interiorRings.ToList(); }
/// <summary> /// Initializes a new instance of the <c>LineString</c> class with specified coordinates and specified coordinate reference system. /// </summary> /// <param name="srid">The <c>SRID</c> of the coordinate reference system.</param> /// <param name="coords">The collection of coordinates to be copied to the new LineStringBase.</param> public LineString(int srid, IEnumerable <Coordinate> coords) : base(srid) { _coordinates = new CoordinateList(coords); }
/// <summary> /// Initializes a new instance of the <c>LineString</c> class with specified coordinates and WSG84 coordinate reference system. /// </summary> /// <param name="coords">The collection of coordinates to be copied to the new LineString.</param> public LineString(IEnumerable <Coordinate> coords) : base() { _coordinates = new CoordinateList(coords); }
/// <summary> /// Initializes a new instance of the <c>LineString</c> class that is empty and has assigned specified coordinate reference system. /// </summary> /// <param name="srid">The <c>SRID</c> of the coordinate reference system.</param> public LineString(int srid) : base(srid) { _coordinates = new CoordinateList(); }
/// <summary> /// Initializes a new instance of the <c>LineString</c> class that is empty and has assigned WSG84 coordinate reference system. /// </summary> public LineString() : base() { _coordinates = new CoordinateList(); }
public void IsInRing_ThrowsArgumentExceptionIfRingHasLessThen3Points() { Coordinate c = new Coordinate(0, 0); CoordinateList ring = new CoordinateList(new Coordinate[] { new Coordinate(0, 1), new Coordinate(1, 0) }); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.Throws<ArgumentException>(() => target.IsInRing(c, ring)); }
public void IsInRing_ThrowsArgumentExceptionIfCoordinateListDoesNotRepresentRing() { Coordinate c = new Coordinate(0, 0); CoordinateList ring = new CoordinateList(new Coordinate[] { new Coordinate(0, 1), new Coordinate(1, 0), new Coordinate(1, 2) }); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.Throws<ArgumentException>(() => target.IsInRing(c, ring)); }
private void CheckInteriorRings(Polygon target, CoordinateList[] expected) { Assert.Equal(expected.Length, target.InteriorRings.Count); for (int i = 0; i < expected.Length; i++) { Assert.Same(expected[i], target.InteriorRings[i]); } }
/// <summary> /// Initializes a new instance of the <c>Polygon</c> class with the given exterior boundary and specific holes /// </summary> /// <param name="srid">The <c>SRID</c> of the coordinate reference system.</param> /// <param name="exteriorRing">The exterior boundary of the polygon.</param> /// <param name="interiorRings">The collection of interior boundaries defining holes in the polygon.</param> public Polygon(int srid, CoordinateList exteriorRing, IEnumerable<ICoordinateList> interiorRings) : base(srid) { this.ExteriorRing = exteriorRing; this.InteriorRings = interiorRings.ToList(); }
/// <summary> /// Initializes a new instance of the <c>LineString</c> class with specified coordinates and specified coordinate reference system. /// </summary> /// <param name="srid">The <c>SRID</c> of the coordinate reference system.</param> /// <param name="coords">The collection of coordinates to be copied to the new LineStringBase.</param> public LineString(int srid, IEnumerable<Coordinate> coords) : base(srid) { _coordinates = new CoordinateList(coords); }
/// <summary> /// Initializes a new instance of the <c>LineString</c> class with specified coordinates and WSG84 coordinate reference system. /// </summary> /// <param name="coords">The collection of coordinates to be copied to the new LineString.</param> public LineString(IEnumerable<Coordinate> coords) : base() { _coordinates = new CoordinateList(coords); }