public void GeoCircle_Serialize() { var circle1 = new GeoCircle(GeoCoordinate.Origin, 10, GeoHelper.EarthRadiusMiles); var circle2 = (GeoCircle)GeoRegion.Parse(circle1.ToString()); Assert.AreEqual(circle1, circle2); }
private void AddCircle(GeoCircle geoCircle) { GameObject planeObject = new GameObject(geoCircle.ToString()); planeObject.transform.SetParent(faceWrapper.transform); CircleBehaviour circleBehaviour = planeObject.AddComponent <CircleBehaviour>(); circleBehaviour.Init(geoCircle); circleBehaviour.SetData(geometry.Circle(geoCircle)); circleMap.Add(geoCircle, circleBehaviour); elementMap.Add(geoCircle, circleBehaviour); }
public void GeoCircle_Bounds() { var circle = new GeoCircle(GeoCoordinate.Origin, 10, GeoHelper.EarthRadiusMiles); var r = circle.Bounds; Assert.IsTrue(Math.Abs(r.Southwest.Longitude - GeoHelper.Plot(circle.Center, 270, circle.Radius, GeoHelper.EarthRadiusMiles).Longitude) < 0.01); Assert.IsTrue(Math.Abs(r.Northeast.Longitude - GeoHelper.Plot(circle.Center, 90, circle.Radius, GeoHelper.EarthRadiusMiles).Longitude) < 0.01); Assert.IsTrue(Math.Abs(r.Southwest.Latitude - GeoHelper.Plot(circle.Center, 180, circle.Radius, GeoHelper.EarthRadiusMiles).Latitude) < 0.01); Assert.IsTrue(Math.Abs(r.Northeast.Latitude - GeoHelper.Plot(circle.Center, 0, circle.Radius, GeoHelper.EarthRadiusMiles).Latitude) < 0.01); // Make sure that bounds are restored after serialization. circle = new GeoCircle(circle.ToString()); Assert.AreEqual(r, circle.Bounds); }