public void Constructor_IEnumerableCoordinate_SetsMinMaxValues() { Envelope source = new Envelope(_coordinates); Envelope target = new Envelope(source); CheckBoundaries(target, _expectedBounds[0], _expectedBounds[1], _expectedBounds[2], _expectedBounds[3], _expectedBounds[4], _expectedBounds[5], _expectedBounds[6], _expectedBounds[7]); }
public void CheckBoundaries(Envelope target, double minX, double maxX, double minY, double maxY, double minZ, double maxZ, double minM, double maxM) { Assert.Equal(minX, target.MinX); Assert.Equal(maxX, target.MaxX); Assert.Equal(minY, target.MinY); Assert.Equal(maxY, target.MaxY); Assert.Equal(minZ, target.MinZ); Assert.Equal(maxZ, target.MaxZ); Assert.Equal(minM, target.MinM); Assert.Equal(maxM, target.MaxM); }
public void Extend_IEnumerableCoordinate_DoNothingForEmptyCollection() { Envelope target = new Envelope(_coordinates); target.Extend(new Coordinate[] {}); CheckBoundaries(target, _expectedBounds[0], _expectedBounds[1], _expectedBounds[2], _expectedBounds[3], _expectedBounds[4], _expectedBounds[5], _expectedBounds[6], _expectedBounds[7]); }
public void Extend_Envelope_DoNothingIfEnvelopeIsInsideTargetEnvelope() { Envelope target = new Envelope(_coordinates); target.Extend(new Envelope(_coordinates[1])); CheckBoundaries(target, _expectedBounds[0], _expectedBounds[1], _expectedBounds[2], _expectedBounds[3], _expectedBounds[4], _expectedBounds[5], _expectedBounds[6], _expectedBounds[7]); }
/// <summary> /// Extends this <c>Envelope</c> to cover specified <c>Envelope</c>. /// </summary> /// <param name="envelope">The <c>Envelope</c> to be covered by extended Envelope.</param> public void Extend(Envelope envelope) { if (double.IsNaN(_bounds[XIndex][0]) || double.IsNaN(_bounds[YIndex][0])) { _bounds[XIndex][0] = envelope.MinX; _bounds[XIndex][1] = envelope.MaxX; _bounds[YIndex][0] = envelope.MinY; _bounds[YIndex][1] = envelope.MaxY; _bounds[ZIndex][0] = envelope.MinZ; _bounds[ZIndex][1] = envelope.MaxZ; _bounds[MIndex][0] = envelope.MinM; _bounds[MIndex][1] = envelope.MaxM; } else { if (envelope.MinX < _bounds[XIndex][0]) { _bounds[XIndex][0] = envelope.MinX; } if (envelope.MaxX > _bounds[XIndex][1]) { _bounds[XIndex][1] = envelope.MaxX; } if (envelope.MinY < _bounds[YIndex][0]) { _bounds[YIndex][0] = envelope.MinY; } if (envelope.MaxY > _bounds[YIndex][1]) { _bounds[YIndex][1] = envelope.MaxY; } if (envelope.MinZ < _bounds[ZIndex][0]) { _bounds[ZIndex][0] = envelope.MinZ; } if (envelope.MaxZ > _bounds[ZIndex][1]) { _bounds[ZIndex][1] = envelope.MaxZ; } if (envelope.MinM < _bounds[MIndex][0]) { _bounds[MIndex][0] = envelope.MinM; } if (envelope.MaxM > _bounds[MIndex][1]) { _bounds[MIndex][1] = envelope.MaxM; } } }
public void GetEnvelope_ReturnsEnvelopeOfLineString() { LineString target = new LineString(_coordinatesXYZ); Envelope expected = new Envelope(_coordinatesXYZ); Assert.Equal(expected, target.GetEnvelope()); }
public void GetEnvelopeReturnsMembersEnvelope() { Envelope expectedEnvelope = new Envelope(new Coordinate(1.1, 2.2)); Mock<Way> member = new Mock<Way>(11); member.Setup(function => function.GetEnvelope()).Returns(expectedEnvelope); RelationMember target = new RelationMember(member.Object); Assert.Same(expectedEnvelope, target.GetEnvelope()); }
public void Equals_ReturnsTrueForTheEnvelopeWithTheSameBounds() { Envelope target = new Envelope(_coordinates); Envelope other = new Envelope(target); Assert.True(target.Equals(other)); }
public void Equals_ReturnsFalseForTheEnvelopeWithDifferentBounds(Coordinate[] corners) { Envelope target = new Envelope(_coordinates); Envelope other = new Envelope(corners); Assert.False(target.Equals(other)); }
public void Equals_ReturnsTrueForSameObjectInstance() { Envelope target = new Envelope(_coordinates); Assert.True(target.Equals(target)); }
public void Equals_ReturnsFalseForOtherObjectType() { Envelope target = new Envelope(_coordinates); object other = "string"; Assert.False(target.Equals(other)); }
public void Equals_ReturnsFalseForNull() { Envelope target = new Envelope(_coordinates); object other = null; Assert.False(target.Equals(other)); }
/// <summary> /// Initializes a new instance of the <c>Envelope</c> class as copy of specified <c>Envelope</c>. /// </summary> /// <param name="source">The <c>Envelope</c> object whose values are to be copied.</param> public Envelope(Envelope source) { this.Initialize(source.MinX, source.MaxX, source.MinY, source.MaxY, source.MinZ, source.MaxZ, source.MinM, source.MaxM); }
public void Extend_IEnumerableCoordinate_ExtendsEnvelope() { Envelope target = new Envelope(_coordinates); target.Extend(new Coordinate[] {_lowerValues, _higherValues }); CheckBoundaries(target, _lowerValues.X, _higherValues.X, _lowerValues.Y, _higherValues.Y, _lowerValues.Z, _higherValues.Z, _lowerValues.M, _higherValues.M); }
public void Extend_Coordinate_DoNothingForCoordinateInsideEnvelope() { Envelope target = new Envelope(_coordinates); target.Extend(_insideCoordinate); CheckBoundaries(target, _expectedBounds[0], _expectedBounds[1], _expectedBounds[2], _expectedBounds[3], _expectedBounds[4], _expectedBounds[5], _expectedBounds[6], _expectedBounds[7]); }
public void Extend_IEnumerableCoordinate_SetsMinMaxValuesOnEmptyEnvelope() { Envelope target = new Envelope(); target.Extend(_coordinates); CheckBoundaries(target, _expectedBounds[0], _expectedBounds[1], _expectedBounds[2], _expectedBounds[3], _expectedBounds[4], _expectedBounds[5], _expectedBounds[6], _expectedBounds[7]); }
public void Extend_Coordinate_DoNothingIfCoordinateIsEmpty() { Envelope target = new Envelope(_coordinates); target.Extend(Coordinate.Empty); CheckBoundaries(target, _expectedBounds[0], _expectedBounds[1], _expectedBounds[2], _expectedBounds[3], _expectedBounds[4], _expectedBounds[5], _expectedBounds[6], _expectedBounds[7]); }
public void Constructor_Coordinate_InitializesXYZProperties() { Envelope target = new Envelope(_coordinates[0]); CheckBoundaries(target, _coordinates[0].X, _coordinates[0].X, _coordinates[0].Y, _coordinates[0].Y, _coordinates[0].Z, _coordinates[0].Z, _coordinates[0].M, _coordinates[0].M); }
public void Extend_Coordinate_ExtendsEnvelopeToHigherValues() { Envelope target = new Envelope(_coordinates); target.Extend(_higherValues); CheckBoundaries(target, _expectedBounds[0], _higherValues.X, _expectedBounds[2], _higherValues.Y, _expectedBounds[4], _higherValues.Z, _expectedBounds[6], _higherValues.M); }
public void Constructor__InitializesBoundsToNaNValues() { Envelope target = new Envelope(); Assert.Equal(double.NaN, target.MinX); Assert.Equal(double.NaN, target.MaxX); Assert.Equal(double.NaN, target.MinY); Assert.Equal(double.NaN, target.MaxY); Assert.Equal(double.NaN, target.MinZ); Assert.Equal(double.NaN, target.MaxZ); Assert.Equal(double.NaN, target.MinM); Assert.Equal(double.NaN, target.MaxM); }
public void Extend_Coordinate_ExtendsEnvelopeToLowerValues() { Envelope target = new Envelope(_coordinates); target.Extend(_lowerValues); CheckBoundaries(target, _lowerValues.X, _expectedBounds[1], _lowerValues.Y, _expectedBounds[3], _lowerValues.Z, _expectedBounds[5], _lowerValues.M, _expectedBounds[7]); }
public void GetEnvelopeReturnsEnvelopeOfLineString() { Envelope expectedEnvelope = new Envelope(_coordinatesXYZ); Polygon target = new Polygon(_exteriorRing3D); Envelope envelope = target.GetEnvelope(); Assert.Equal(expectedEnvelope, envelope); }
public void Extend_Coordinate_SetsMinMaxValuesOnEmptyEnvelope() { Envelope target = new Envelope(); target.Extend(_coordinates[0]); CheckBoundaries(target, _coordinates[0].X, _coordinates[0].X, _coordinates[0].Y, _coordinates[0].Y, _coordinates[0].Z, _coordinates[0].Z, _coordinates[0].M, _coordinates[0].M); }
public void GetEnvelopeReturnsUnionOfMembersEnvelopes() { GeometryCollection<Geometry> target = new GeometryCollection<Geometry>(_geometries); Envelope expected = new Envelope(new Coordinate[] {_geometries[0].Position, _geometries[1].Position, _geometries[2].Position}); Assert.Equal(expected, target.GetEnvelope()); }
/// <summary> /// Determines whether two <c>Envelope</c> instances are equal. /// </summary> /// <param name="other">The <c>Envelope</c> to compare with the current <c>Envelope</c></param> /// <returns>true if the specified <c>Envelope</c> is equal to the current <c>Envelope</c>; otherwise, false.</returns> public bool Equals(Envelope other) { return ((this.MinX == other.MinX) || (double.IsNaN(this.MinX) && double.IsNaN(other.MinX))) && ((this.MinY == other.MinY) || (double.IsNaN(this.MinY) && double.IsNaN(other.MinY))) && ((this.MinZ == other.MinZ) || (double.IsNaN(this.MinZ) && double.IsNaN(other.MinZ))) && ((this.MinM == other.MinM) || (double.IsNaN(this.MinM) && double.IsNaN(other.MinM))) && ((this.MaxX == other.MaxX) || (double.IsNaN(this.MaxX) && double.IsNaN(other.MaxX))) && ((this.MaxY == other.MaxY) || (double.IsNaN(this.MaxY) && double.IsNaN(other.MaxY))) && ((this.MaxZ == other.MaxZ) || (double.IsNaN(this.MaxZ) && double.IsNaN(other.MaxZ))) && ((this.MaxM == other.MaxM) || (double.IsNaN(this.MaxM) && double.IsNaN(other.MaxM))); }