/// <param name="latLong"> /// the geographical coordinates of the map center. </param> /// <param name="zoomLevel"> /// the zoom level of the map. </param> /// <exception cref="IllegalArgumentException"> /// if {@code latLong} is null or {@code zoomLevel} is negative. </exception> public MapPosition(LatLong latLong, sbyte zoomLevel) { if (latLong == null) { throw new System.ArgumentException("latLong must not be null"); } else if (zoomLevel < 0) { throw new System.ArgumentException("zoomLevel must not be negative: " + zoomLevel); } this.LatLong = latLong; this.ZoomLevel = zoomLevel; }
public virtual void ContainsLatLongTest() { BoundingBox boundingBox = new BoundingBox(MIN_LATITUDE, MIN_LONGITUDE, MAX_LATITUDE, MAX_LONGITUDE); LatLong latLong1 = new LatLong(MIN_LATITUDE, MIN_LONGITUDE, true); LatLong latLong2 = new LatLong(MAX_LATITUDE, MAX_LONGITUDE, true); LatLong latLong3 = new LatLong(MIN_LONGITUDE, MIN_LONGITUDE, true); LatLong latLong4 = new LatLong(MAX_LATITUDE, MAX_LATITUDE, true); Assert.True(boundingBox.Contains(latLong1)); Assert.True(boundingBox.Contains(latLong2)); Assert.False(boundingBox.Contains(latLong3)); Assert.False(boundingBox.Contains(latLong4)); }
public virtual void EqualsTest() { LatLong latLong1 = new LatLong(LATITUDE, LONGITUDE, true); LatLong latLong2 = new LatLong(LATITUDE, LONGITUDE, true); LatLong latLong3 = new LatLong(LATITUDE, LATITUDE, true); LatLong latLong4 = new LatLong(LONGITUDE, LONGITUDE, true); TestUtils.EqualsTest(latLong1, latLong2); TestUtils.NotEqualsTest(latLong1, latLong3); TestUtils.NotEqualsTest(latLong1, latLong4); TestUtils.NotEqualsTest(latLong1, new object()); TestUtils.NotEqualsTest(latLong1, null); }
public virtual void ExtendLatLongTest() { BoundingBox boundingBox1 = new BoundingBox(MIN_LATITUDE, MIN_LONGITUDE, MAX_LATITUDE, MAX_LONGITUDE); BoundingBox boundingBox2 = new BoundingBox(MIN_LATITUDE - 1, MIN_LONGITUDE - 1, MAX_LATITUDE, MAX_LONGITUDE); BoundingBox boundingBox3 = new BoundingBox(MIN_LATITUDE, MIN_LONGITUDE, MAX_LATITUDE + 1, MAX_LONGITUDE + 1); Assert.AreEqual(boundingBox1, boundingBox1.ExtendCoordinates(new LatLong(MIN_LATITUDE, MIN_LONGITUDE))); Assert.AreEqual(boundingBox2, boundingBox2.ExtendCoordinates(new LatLong(MAX_LATITUDE, MAX_LONGITUDE))); Assert.AreEqual(boundingBox3, boundingBox3.ExtendCoordinates(new LatLong(boundingBox3.CenterPoint.Latitude, boundingBox3.CenterPoint.Longitude))); LatLong latLong = new LatLong(MIN_LATITUDE - 1, MAX_LONGITUDE + 1); Assert.True(boundingBox1.ExtendCoordinates(latLong).Contains(latLong)); latLong = new LatLong(MAX_LATITUDE + 1, MAX_LONGITUDE + 1); Assert.True(boundingBox1.ExtendCoordinates(latLong).Contains(latLong)); latLong = new LatLong(MAX_LATITUDE + 1, MIN_LONGITUDE - 1); Assert.True(boundingBox1.ExtendCoordinates(latLong).Contains(latLong)); latLong = new LatLong(MIN_LATITUDE - 1, MIN_LONGITUDE - 1); Assert.True(boundingBox1.ExtendCoordinates(latLong).Contains(latLong)); }
public virtual void ToStringTest() { LatLong latLong = new LatLong(LATITUDE, LONGITUDE, true); Assert.AreEqual(GEO_POINT_TO_STRING, latLong.ToString()); }
public virtual void SerializeTest() { LatLong latLong = new LatLong(LATITUDE, LONGITUDE, true); TestUtils.SerializeTest(latLong); }
private static MapPosition invokeConstructor(LatLong latLong, sbyte zoomLevel) { return(new MapPosition(latLong, zoomLevel)); }
/// <summary> /// Creates a BoundingBox extended up to <code>LatLong</code> (but does not cross date line/poles). </summary> /// <param name="latLong"> coordinates up to the extension </param> /// <returns> an extended BoundingBox or this (if contains coordinates) </returns> public virtual BoundingBox ExtendCoordinates(LatLong latLong) { return(ExtendCoordinates(latLong.Latitude, latLong.Longitude)); }
/// <param name="latLong"> /// the LatLong whose coordinates should be checked. </param> /// <returns> true if this BoundingBox contains the given LatLong, false otherwise. </returns> public virtual bool Contains(LatLong latLong) { return(Contains(latLong.Latitude, latLong.Longitude)); }